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
740ab642
Commit
740ab642
authored
Jun 10, 2009
by
Michael Sherman
Browse files
Minor updates to NaCl example in C++.
parent
346b910b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
examples/HelloSodiumChloride.cpp
examples/HelloSodiumChloride.cpp
+7
-6
No files found.
examples/HelloSodiumChloride.cpp
View file @
740ab642
...
@@ -97,10 +97,10 @@ myWritePDBFrame(int frameNum, double timeInPs, double energyInKcal,
...
@@ -97,10 +97,10 @@ myWritePDBFrame(int frameNum, double timeInPs, double energyInKcal,
printf
(
"MODEL %d
\n
"
,
frameNum
);
printf
(
"MODEL %d
\n
"
,
frameNum
);
printf
(
"REMARK 250 time=%.3f ps; energy=%.3f kcal/mole
\n
"
,
printf
(
"REMARK 250 time=%.3f ps; energy=%.3f kcal/mole
\n
"
,
timeInPs
,
energyInKcal
);
timeInPs
,
energyInKcal
);
for
(
int
i
=
0
;
*
atoms
[
i
].
pdb
;
++
i
)
for
(
int
n
=
0
;
*
atoms
[
n
].
pdb
;
++
n
)
printf
(
"ATOM %5d %4s SLT 1 %8.3f%8.3f%8.3f 1.00 0.00
\n
"
,
printf
(
"ATOM %5d %4s SLT 1 %8.3f%8.3f%8.3f 1.00 0.00
\n
"
,
i
+
1
,
atoms
[
i
].
pdb
,
n
+
1
,
atoms
[
n
].
pdb
,
atoms
[
i
].
posInAng
[
0
],
atoms
[
i
].
posInAng
[
1
],
atoms
[
i
].
posInAng
[
2
]);
atoms
[
n
].
posInAng
[
0
],
atoms
[
n
].
posInAng
[
1
],
atoms
[
n
].
posInAng
[
2
]);
printf
(
"ENDMDL
\n
"
);
printf
(
"ENDMDL
\n
"
);
}
}
...
@@ -248,6 +248,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
...
@@ -248,6 +248,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
atom
.
gbsaRadiusInAng
*
OpenMM
::
NmPerAngstrom
,
atom
.
gbsaRadiusInAng
*
OpenMM
::
NmPerAngstrom
,
atom
.
gbsaScaleFactor
);
atom
.
gbsaScaleFactor
);
// Convert the initial position to nm and append to the array.
const
Vec3
posInNm
(
atom
.
initPosInAng
[
0
]
*
OpenMM
::
NmPerAngstrom
,
const
Vec3
posInNm
(
atom
.
initPosInAng
[
0
]
*
OpenMM
::
NmPerAngstrom
,
atom
.
initPosInAng
[
1
]
*
OpenMM
::
NmPerAngstrom
,
atom
.
initPosInAng
[
1
]
*
OpenMM
::
NmPerAngstrom
,
atom
.
initPosInAng
[
2
]
*
OpenMM
::
NmPerAngstrom
);
atom
.
initPosInAng
[
2
]
*
OpenMM
::
NmPerAngstrom
);
...
@@ -280,10 +281,10 @@ myGetOpenMMState(MyOpenMMData* omm, bool wantEnergy,
...
@@ -280,10 +281,10 @@ myGetOpenMMState(MyOpenMMData* omm, bool wantEnergy,
int
infoMask
=
0
;
int
infoMask
=
0
;
infoMask
=
OpenMM
::
State
::
Positions
;
infoMask
=
OpenMM
::
State
::
Positions
;
if
(
wantEnergy
)
{
if
(
wantEnergy
)
{
infoMask
+=
OpenMM
::
State
::
Velocities
;
// for kinetic energy
infoMask
+=
OpenMM
::
State
::
Velocities
;
// for kinetic energy
(cheap)
infoMask
+=
OpenMM
::
State
::
Energy
;
// for pot
ential
energy (expensive)
infoMask
+=
OpenMM
::
State
::
Energy
;
// for pot
.
energy (expensive)
}
}
// Forces are also available (and
NOT expensive
).
// Forces are also available (and
cheap
).
const
OpenMM
::
State
state
=
omm
->
context
->
getState
(
infoMask
);
const
OpenMM
::
State
state
=
omm
->
context
->
getState
(
infoMask
);
timeInPs
=
state
.
getTime
();
// OpenMM time is in ps already
timeInPs
=
state
.
getTime
();
// OpenMM time is in ps already
...
...
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