Skip to content
Sections
Personal tools
You are here: Home » BALLView » Support » PythonScripts » Scripts » CreateBonds.py

CreateBonds.py

Document Actions
Iterate over all atoms of a molecule and create a bond if the two atoms are closer than 1.5 A.
system = getComposites()[0]
for atom1 in atoms(system):
  for atom2 in atoms(system):
    v = atom1.getPosition() - atom2.getPosition()
    if v.getLength() < 1.5:
      atom1.createBond(atom2)

getMainControl().update(system)
 
 

Powered by Plone

This site conforms to the following standards: