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
9aaeed29
Commit
9aaeed29
authored
Jun 17, 2009
by
Michael Sherman
Browse files
Fix Ethane test to use *either* harmonic bond force *or* constraint, not both.
parent
a8783de3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
examples/HelloEthane.cpp
examples/HelloEthane.cpp
+17
-13
No files found.
examples/HelloEthane.cpp
View file @
9aaeed29
...
...
@@ -290,26 +290,30 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
}
// Process the bonds:
// (1) HarmonicBondForce needs bond stretch parameters (in MD units!).
// (2) If we're using constraints, tell System about constrainable bonds.
// (3) Create a list of bonds for generating nonbond exclusions.
// (1) If we're using constraints, tell System about constrainable bonds;
// otherwise, tell HarmonicBondForce the bond stretch parameters
// (tricky units!).
// (2) Create a list of bonds for generating nonbond exclusions.
std
::
vector
<
std
::
pair
<
int
,
int
>
>
bondPairs
;
for
(
int
i
=
0
;
bonds
[
i
].
type
!=
EndOfList
;
++
i
)
{
const
int
*
atom
=
bonds
[
i
].
atoms
;
const
BondType
&
bond
=
bondType
[
bonds
[
i
].
type
];
// Note factor of 2 for stiffness below because Amber specifies the constant
// as it is used in the harmonic energy term kx^2 with force 2kx; OpenMM wants
// it as used in the force term kx, with energy kx^2/2.
bondStretch
.
addBond
(
atom
[
0
],
atom
[
1
],
bond
.
nominalLengthInAngstroms
*
OpenMM
::
NmPerAngstrom
,
bond
.
stiffnessInKcalPerAngstrom2
*
2
*
OpenMM
::
KJPerKcal
*
OpenMM
::
AngstromsPerNm
*
OpenMM
::
AngstromsPerNm
);
if
(
UseConstraints
&&
bond
.
canConstrain
)
if
(
UseConstraints
&&
bond
.
canConstrain
)
{
system
.
addConstraint
(
atom
[
0
],
atom
[
1
],
bond
.
nominalLengthInAngstroms
*
OpenMM
::
NmPerAngstrom
);
}
else
{
// Note factor of 2 for stiffness below because Amber specifies the constant
// as it is used in the harmonic energy term kx^2 with force 2kx; OpenMM wants
// it as used in the force term kx, with energy kx^2/2.
bondStretch
.
addBond
(
atom
[
0
],
atom
[
1
],
bond
.
nominalLengthInAngstroms
*
OpenMM
::
NmPerAngstrom
,
bond
.
stiffnessInKcalPerAngstrom2
*
2
*
OpenMM
::
KJPerKcal
*
OpenMM
::
AngstromsPerNm
*
OpenMM
::
AngstromsPerNm
);
}
bondPairs
.
push_back
(
std
::
make_pair
(
atom
[
0
],
atom
[
1
]));
}
// Exclude 1-2, 1-3 bonded atoms from nonbonded forces, and scale down 1-4 bonded atoms.
...
...
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