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
29647750
Commit
29647750
authored
Jun 18, 2009
by
Michael Sherman
Browse files
Fix, but this is going away.
parent
0accdd2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
examples/HelloWorld.cpp
examples/HelloWorld.cpp
+13
-5
No files found.
examples/HelloWorld.cpp
View file @
29647750
// Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#include "OpenMM.h"
#include <iostream>
...
...
@@ -40,7 +46,7 @@ static const double SimulationTimePs = 1000; // total simulation time (ps)
static
const
double
SigmaPerVdwRadius
=
2
*
std
::
pow
(
2.
,
-
1.
/
6.
);
static
void
showState
(
const
OpenMMContext
&
);
static
double
showState
(
const
OpenMMContext
&
);
int
main
()
{
try
{
...
...
@@ -80,13 +86,13 @@ try {
context
.
setPositions
(
positions
);
// Output the initial state.
showState
(
context
);
double
time
=
showState
(
context
);
const
int
NumSilentSteps
=
(
int
)(
ReportIntervalFs
/
StepSizeFs
+
0.5
);
do
{
integrator
.
step
(
NumSilentSteps
);
showState
(
context
);
}
while
(
context
.
getT
ime
()
<
SimulationTimePs
);
time
=
showState
(
context
);
}
while
(
t
ime
<
SimulationTimePs
);
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"EXCEPTION: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
@@ -96,7 +102,7 @@ try {
return
0
;
}
static
void
static
double
showState
(
const
OpenMMContext
&
context
)
{
// Caution: at the moment asking for energy requires use of slow reference calculation.
const
State
state
=
context
.
getState
(
State
::
Positions
|
State
::
Velocities
...
...
@@ -112,5 +118,7 @@ showState(const OpenMMContext& context) {
std
::
cout
<<
i
<<
" "
<<
positions
[
i
]
*
AngstromsPerNm
<<
std
::
endl
;
std
::
cout
<<
"f="
<<
forces
[
i
]
<<
" dq="
<<
dq
<<
std
::
endl
;
}
return
state
.
getTime
();
}
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