Torsion restraint

Provide workshop materials to introduce programmers and scientists to OpenMM and features in version 4.0 (AMOEBA, Python-based application layer,...)
POST REPLY
User avatar
Geoffrey Gray
Posts: 1
Joined: Fri Mar 21, 2014 9:46 am

Torsion restraint

Post by Geoffrey Gray » Tue Apr 08, 2014 9:59 am

I am trying to add an additional harmonic restraint to a system to calculate the free energy of rotation. I am using the following approach:

( where kx and x0 are set to numerical values previously )

torsion = CustomTorsionForce('kx*(x - x0)^2')
torsion.addPerTorsionParameter('x0')
torsion.addPerTorsionParameter('kx')

system.addForce(torsion)

torsion.addTorsion(1106,1108,1111,1112,[])

However, when I try to setup a simulation using the following:

simulation = Simulation(pdb.topology,system,integrator,platform,properties)

I receive an error message:

Traceback (most recent call last):
File "smd.py", line 42, in <module>
simulation = Simulation(pdb.topology,system,integrator,platform,properties)
File "/home/g/gmgray2/.local/lib/python2.7/site-packages/simtk/openmm/app/simulation.py", line 79, in __init__
self.context = mm.Context(system, integrator, platform, platformProperties)
File "/home/g/gmgray2/.local/lib/python2.7/site-packages/simtk/openmm/openmm.py", line 4870, in __init__
this = _openmm.new_Context(*args)
Exception: CustomTorsionForce: Wrong number of parameters for torsion 0
[504313 refs]


How can I fix this? Thanks in advance

Geoffrey

POST REPLY