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
e19d9e71
Commit
e19d9e71
authored
Jun 11, 2009
by
Christopher Bruns
Browse files
More tweaking HelloArgon.cpp
parent
5454955a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
examples/HelloArgon.cpp
examples/HelloArgon.cpp
+15
-2
No files found.
examples/HelloArgon.cpp
View file @
e19d9e71
// -----------------------------------------------------------------------------
// OpenMM(tm) HelloArgon example in C++ (June 2009)
// -----------------------------------------------------------------------------
// This program demonstrates a simple molecular simulation using the OpenMM
// API for GPU-accelerated molecular dynamics simulation. The system
// represents a small collection of argon atoms in a vaccuum.
// A multi-frame PDB file is written to stdout which can be read by VMD or
// other visualization tool to produce an animation of the resulting trajectory.
// -----------------------------------------------------------------------------
#include "OpenMM.h"
#include "OpenMM.h"
#include <cstdio>
#include <cstdio>
// forward declaration of subroutine defined later in this file.
// Forward declaration of subroutine for printing atomic coordinates,
// defined later in this source file.
void
writePdb
(
const
OpenMM
::
OpenMMContext
&
context
);
void
writePdb
(
const
OpenMM
::
OpenMMContext
&
context
);
// simulation is performed within simulateArgon() subroutine
void
simulateArgon
()
void
simulateArgon
()
{
{
// Load any shared libraries containing GPU implementations
// Load any shared libraries containing GPU implementations
OpenMM
::
Platform
::
loadPluginsFromDirectory
(
OpenMM
::
Platform
::
loadPluginsFromDirectory
(
OpenMM
::
Platform
::
getDefaultPluginsDirectory
());
OpenMM
::
Platform
::
getDefaultPluginsDirectory
());
// Create a system with nonbonded forces
OpenMM
::
System
system
;
OpenMM
::
System
system
;
OpenMM
::
NonbondedForce
*
nonbond
=
new
OpenMM
::
NonbondedForce
();
OpenMM
::
NonbondedForce
*
nonbond
=
new
OpenMM
::
NonbondedForce
();
system
.
addForce
(
nonbond
);
system
.
addForce
(
nonbond
);
...
@@ -74,7 +87,7 @@ void writePdb(const OpenMM::OpenMMContext& context)
...
@@ -74,7 +87,7 @@ void writePdb(const OpenMM::OpenMMContext& context)
for
(
int
a
=
0
;
a
<
context
.
getSystem
().
getNumParticles
();
++
a
)
for
(
int
a
=
0
;
a
<
context
.
getSystem
().
getNumParticles
();
++
a
)
{
{
printf
(
"ATOM %5d AR AR 1 "
,
a
+
1
);
// atom number
printf
(
"ATOM %5d AR AR 1 "
,
a
+
1
);
// atom number
printf
(
"%8.3f%8.3f%8.3f 1.00 0.00 AR
\n
"
,
printf
(
"%8.3f%8.3f%8.3f 1.00 0.00 AR
\n
"
,
// coordinates
// notice "*10" converts nanometers to Angstroms
// notice "*10" converts nanometers to Angstroms
pos
[
a
][
0
]
*
10
,
pos
[
a
][
1
]
*
10
,
pos
[
a
][
2
]
*
10
);
pos
[
a
][
0
]
*
10
,
pos
[
a
][
1
]
*
10
,
pos
[
a
][
2
]
*
10
);
}
}
...
...
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