Skip to content
0
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. SAMSON
  3. SAMSON
  4. How to show Atomtype Labels from GROMACS .gro File in SAMSON

How to show Atomtype Labels from GROMACS .gro File in SAMSON

Scheduled Pinned Locked Moved SAMSON
6 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    Mattia Felice
    wrote on last edited by Mattia Felice
    #1

    Dear SAMSON Development Team,

    I'm currently working on a document in SAMSON where I aim to display a molecule with specific custom labels for each atom. I'd like to show the 'atomtype' for each atom as imported from a GROMACS .gro file, which I found stored in each atom 'comment' value.

    I've been using the Python scripting console in SAMSON for this task, but I haven't been able to achieve the desired result. Specifically, I tried creating SBLabel objects and adding them to the document: the label objects are recognized in the pane on the left, but I'm struggling to display the created labels on the molecule.

    I would be grateful for any guidance or assistance you can provide on this matter!

    Thank you for your support and the continuous development of SAMSON.

    Kind regards,

    Mattia

    DmitriyMarinD 1 Reply Last reply
    1
    • M Mattia Felice

      Dear SAMSON Development Team,

      I'm currently working on a document in SAMSON where I aim to display a molecule with specific custom labels for each atom. I'd like to show the 'atomtype' for each atom as imported from a GROMACS .gro file, which I found stored in each atom 'comment' value.

      I've been using the Python scripting console in SAMSON for this task, but I haven't been able to achieve the desired result. Specifically, I tried creating SBLabel objects and adding them to the document: the label objects are recognized in the pane on the left, but I'm struggling to display the created labels on the molecule.

      I would be grateful for any guidance or assistance you can provide on this matter!

      Thank you for your support and the continuous development of SAMSON.

      Kind regards,

      Mattia

      DmitriyMarinD
      DmitriyMarinD
      DmitriyMarin
      wrote on last edited by
      #2

      Dear @Mattia-Felice ,

      Currently, the exposed SBLabel does not have an API to change its position - the position is determined by the label class itself depending on the label type (e.g., based on the centroid of the structure to which it has been applied). We will see how we can improve it in the future release.

      For now, what you can do is temporarily set the atomtype from the comment as the atom name, add the label via the interface, and then reset the name when needed either via the undo mechanism or via a saved list/map. Below is an example.

      1. Add labels by "Atoms (names)"
      2. Set GRO atomtypes from atom's comment:
      # get an indexer of all atoms in the active document
      atom_indexer = SAMSON.getNodes('n.t a')
      # or only selected atoms: n.s == node.selected
      #atom_indexer = SAMSON.getNodes('n.t a and n.s')
      
      # holding: take care of undo/redo in SAMSON
      SAMSON.beginHolding('Change atom name')
      
      atom_name_map = {}
      for atom in atom_indexer:
      	atom_name_map[atom] = atom.name
      	atom.name = atom.getComment()
      
      # stop holding the undoable operation
      SAMSON.endHolding()
      
      1. Reset using the stored atom map:
      # holding: take care of undo/redo in SAMSON
      SAMSON.beginHolding('Change atom name')
      
      for atom, name in atom_name_map.items():
      	atom.name = name
      
      SAMSON.endHolding()
      

      Please let me know if you have questions.

      Dmitriy,
      The SAMSON Team, https://s-c.io

      1 Reply Last reply
      1
      • M
        M
        Mattia Felice
        wrote on last edited by
        #3

        Hello Dmitriy,

        this worked like a charm! It's a very useful feature to be able to do this when working on a new forcefield.

        Thank you again for your prompt help!

        Mattia

        DmitriyMarinD 1 Reply Last reply
        0
        • M Mattia Felice

          Hello Dmitriy,

          this worked like a charm! It's a very useful feature to be able to do this when working on a new forcefield.

          Thank you again for your prompt help!

          Mattia

          DmitriyMarinD
          DmitriyMarinD
          DmitriyMarin
          wrote on last edited by
          #4

          Great!

          Do you often need to show the atomtypes that are stored in the comment record for atoms? And what else would you like to be able to show e.g. as labels or in some other way? This will help us to see what functionality is necessary to add.

          Dmitriy,
          The SAMSON Team, https://s-c.io

          1 Reply Last reply
          0
          • M
            M
            Mattia Felice
            wrote on last edited by
            #5

            Hello Dmitriy,

            having the atom types shown during the development of a force field it's very handy, especially when you want to check if e.g. the molecular SMARTS pattern one's applying to match a certain atom are working properly. I guess in the future this kind of work might be taken over by AI (e.g. https://github.com/choderalab/espaloma ), but for the time being it would be a very valuable feature, together with showing the charge and LJ parameters from a .top file, or analogous formats.

            Regarding other information that would be useful to show, if you ever plan to support reading molecular structures from the output from ab-initio packages such as GAUSSIAN, ORCA, etc., an invaluable feature would be the possibility to show the values of charge and spin population in the labels, together with color mapping. This is a feature I've seen implemented only in ChemCraft so far.

            Thank you for the interest in the feedback :)

            Mattia

            DmitriyMarinD 1 Reply Last reply
            0
            • M Mattia Felice

              Hello Dmitriy,

              having the atom types shown during the development of a force field it's very handy, especially when you want to check if e.g. the molecular SMARTS pattern one's applying to match a certain atom are working properly. I guess in the future this kind of work might be taken over by AI (e.g. https://github.com/choderalab/espaloma ), but for the time being it would be a very valuable feature, together with showing the charge and LJ parameters from a .top file, or analogous formats.

              Regarding other information that would be useful to show, if you ever plan to support reading molecular structures from the output from ab-initio packages such as GAUSSIAN, ORCA, etc., an invaluable feature would be the possibility to show the values of charge and spin population in the labels, together with color mapping. This is a feature I've seen implemented only in ChemCraft so far.

              Thank you for the interest in the feedback :)

              Mattia

              DmitriyMarinD
              DmitriyMarinD
              DmitriyMarin
              wrote on last edited by
              #6

              Dear @Mattia-Felice ,

              Thank you for the feedback! We will consider this for the next releases of SAMSON.

              We will surely add more labeling possibilities in the next release.

              As for formats from ab initio packages, SAMSON currently supports only Molden and it loads only the molecular structure from it. But we can add the possibility to load other data from it as well.

              Dmitriy,
              The SAMSON Team, https://s-c.io

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Login or register to search.
              • First post
                Last post