Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
7b2086c0
Commit
7b2086c0
authored
Apr 14, 2017
by
jchodera
Browse files
Use simpler form of harmonic torsion restraint that respects boundary conditions
parent
6c571b43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
openmmapi/include/openmm/CustomTorsionForce.h
openmmapi/include/openmm/CustomTorsionForce.h
+4
-0
wrappers/python/simtk/openmm/app/charmmpsffile.py
wrappers/python/simtk/openmm/app/charmmpsffile.py
+1
-3
No files found.
openmmapi/include/openmm/CustomTorsionForce.h
View file @
7b2086c0
...
@@ -65,6 +65,10 @@ namespace OpenMM {
...
@@ -65,6 +65,10 @@ namespace OpenMM {
* force->addPerTorsionParameter("theta0");
* force->addPerTorsionParameter("theta0");
* </pre></tt>
* </pre></tt>
*
*
* If a harmonic restraint is desired, it is important to be careful of the domain for theta, using an idiom like this:
*
* <tt>CustomTorsionForce* force = new CustomTorsionForce("0.5*k*min(dtheta, 2*pi-dtheta)^2; dtheta = abs(theta-theta0); pi = 3.1415926535");</tt>
*
* This class also has the ability to compute derivatives of the potential energy with respect to global parameters.
* This class also has the ability to compute derivatives of the potential energy with respect to global parameters.
* Call addEnergyParameterDerivative() to request that the derivative with respect to a particular parameter be
* Call addEnergyParameterDerivative() to request that the derivative with respect to a particular parameter be
* computed. You can then query its value in a Context by calling getState() on it.
* computed. You can then query its value in a Context by calling getState() on it.
...
...
wrappers/python/simtk/openmm/app/charmmpsffile.py
View file @
7b2086c0
...
@@ -907,9 +907,7 @@ class CharmmPsfFile(object):
...
@@ -907,9 +907,7 @@ class CharmmPsfFile(object):
if
verbose
:
print
(
'Adding impropers...'
)
if
verbose
:
print
(
'Adding impropers...'
)
# Ick. OpenMM does not have an improper torsion class. Need to
# Ick. OpenMM does not have an improper torsion class. Need to
# construct one from CustomTorsionForce that respects toroidal boundaries
# construct one from CustomTorsionForce that respects toroidal boundaries
energy_function
=
'k*dtheta_torus^2;'
energy_function
=
'k*min(dtheta, 2*pi-dtheta)^2; dtheta = abs(theta-theta0);'
energy_function
+=
'dtheta_torus = dtheta - floor(dtheta/(2*pi)+0.5)*(2*pi);'
energy_function
+=
'dtheta = theta - theta0;'
energy_function
+=
'pi = %f;'
%
pi
energy_function
+=
'pi = %f;'
%
pi
force
=
mm
.
CustomTorsionForce
(
energy_function
)
force
=
mm
.
CustomTorsionForce
(
energy_function
)
force
.
addPerTorsionParameter
(
'k'
)
force
.
addPerTorsionParameter
(
'k'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment