# Constraining a set of atoms in the MM region using pDynamo (CHARMM/ORCA interface)

I am trying to perform a QM/MM optimization in which my substrate is in the MM region. However when this happens there are significant changes to the geometry (undesired). I want to avoid fixing all atoms in place and having to constrain all distances/angles/diehedrals. Does anyone know how to select an index of atoms to constrain and which constraint might be best (using pDynamo)?

• would this not be the same as one specifies geometrical constraints in ORCA? I'm not sure how one would describe that through pDynamo however. If no answer is available I can describe how to do it through my third party API called pyGSM which can do constrained optimization with pDynamo May 18 '20 at 1:01
• A geometrical constraint is fine, but I’m not sure how to do it for an index of atoms or fragment. May 18 '20 at 1:18

To tether a set of atoms (index or fragment) in pDynamo, the below lines are needed (energy model can vary):

tethers = pM.SoftConstraintContainer ()
system.DefineSoftConstraints ( tethers )

reference         = Clone ( system.coordinates3 )
tetherEnergyModel = SoftConstraintEnergyModelHarmonic ( 0.1 , 500.0 )

NAME1 = "IronOH"
sele1          = Selection.FromIterable ( range(5024,5027) )
tethers[NAME1] = SoftConstraintMultipleTether ( sele1 , reference , tetherEnergyModel )


This particular constraint tethers the atoms in range 5024-5027 to 0.1 Å from the reference with a force constant of 500.0 kJ/mol.

To have multiple ranges the below can be used:

sele = Selection.FromIterable ( range(0,2878) + range(2896,3191) )

• +1. I'm glad to see you found the answer, and then did us the courtesy of sharing it so that if someone else has the problem they can get the solution much faster! There's benefits to "accepting" an answer when it comes from a different user, but if you "accept" and answer to your own question, the only thing it does is discourage others from answering (which may or may not be what you want). Jun 19 '20 at 21:46
• I only accepted the answer due to inactivity (more than 30 days), as I found the solution weeks ago but wanted to give others a chance. I was thinking it would encourage those who have the same problem to look at an post, since it is accepted as an answer. I would be happy to accept another persons answer. Jun 19 '20 at 21:53
• I appreciate that. If you want to encourage more people to give their own versions of answers, then the green checkmark often indicates that the asker is not looking for anything new. I personally can't remember the last time I tried to answer something (anywhere in the SE network) that already had the green checkmark if there was no bounty. If you want to discourage people from trying to add another answer, the green checkmark often does the job. In terms of attracting people to look at the post, having an "accepted" answer usually doesnt make much difference. Google brings them in either way Jun 19 '20 at 22:01
• Great point. I’ve removed the check mark. Jun 19 '20 at 22:03
• Very cool, reminds me of custom forces in OpenMm Jun 19 '20 at 22:41