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. Feature requests
  4. Selection of bond locations

Selection of bond locations

Scheduled Pinned Locked Moved Feature requests
2 Posts 2 Posters 3.7k 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.
  • C
    C
    Cyril
    wrote on last edited by
    #1

    I suggest to implement the possibility to select bonds (without atoms) by location (for instance all bonds centered at z=2 A). Is it possible ? Thank you very much indeed !

    1 Reply Last reply
    0
    • DmitriyMarinD
      DmitriyMarinD
      DmitriyMarin
      wrote on last edited by
      #2

      Thank you @Cyril for the suggestion. We will see whether to add it as a feature in the next version of SAMSON or implement it as a SAMSON Element.

      For now, you can use Python Scripting in SAMSON. To use the Python Scripting SAMSON Element you will need to have a specific version of Python installed. Please, check the Python Scripting installation instructions for SAMSON. You can also check the SAMSON Python Scripting tutorials and documentation.

      The sample script for this task can be found below. You can either copy it inside of the Python Scripting console in SAMSON, or save it as a .py file and open this file in SAMSON when you need to execute this script.

      '''
      This example shows how to select bonds which center lies in between of two planes: z_min and z_max
      
      If you want to select bonds which center lies on a specific plane, just set z_min=z_max
      '''
      
      # Get an indexer of all bonds in the active document. Here we use SAMSON Node Specification Language to get only bonds
      allBondsIndexer = SAMSON.getNodes('node.type bond')
      
      # two planes: 1.7A and 2.3A
      z_min = Quantity.angstrom(1.7)
      z_max = Quantity.angstrom(2.3)
      
      for bond in allBondsIndexer:		# a loop over an indexer
      	# compute the z-axis center of the bond 
      	bondCenterZ = (bond.leftAtom.getZ() + bond.rightAtom.getZ()) / 2.0
      	# check whether the bond lies in between of desired planes
      	if bondCenterZ >= z_min and bondCenterZ <= z_max:
      		# select the bond by setting the selectionFlag to True
      		bond.selectionFlag = True
      
      allBondsIndexer.clear()		# clear an indexer
      

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

      1 Reply Last reply
      1

      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