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
5454955a
Commit
5454955a
authored
Jun 11, 2009
by
Christopher Bruns
Browse files
More refactoring of HelloArgon.cpp
parent
403686a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
examples/HelloArgon.cpp
examples/HelloArgon.cpp
+16
-15
No files found.
examples/HelloArgon.cpp
View file @
5454955a
#include "OpenMM.h"
#include "OpenMM.h"
#include <cstdio>
#include <cstdio>
using
namespace
OpenMM
;
// forward declaration of subroutine defined later in this file.
// forward declaration of subroutine defined later in this file.
void
writePdb
(
const
OpenMMContext
&
context
);
void
writePdb
(
const
OpenMM
::
OpenMMContext
&
context
);
void
simulateArgon
()
void
simulateArgon
()
{
{
// Load any shared libraries containing GPU implementations
// Load any shared libraries containing GPU implementations
Platform
::
loadPluginsFromDirectory
(
OpenMM
::
Platform
::
loadPluginsFromDirectory
(
Platform
::
getDefaultPluginsDirectory
());
OpenMM
::
Platform
::
getDefaultPluginsDirectory
());
System
system
;
OpenMM
::
System
system
;
NonbondedForce
*
nonbond
=
new
NonbondedForce
();
OpenMM
::
NonbondedForce
*
nonbond
=
new
OpenMM
::
NonbondedForce
();
system
.
addForce
(
nonbond
);
system
.
addForce
(
nonbond
);
// Create three atoms
// Create three atoms
std
::
vector
<
Vec3
>
initialPositions
(
3
);
std
::
vector
<
OpenMM
::
Vec3
>
initialPositions
(
3
);
for
(
int
a
=
0
;
a
<
3
;
++
a
)
for
(
int
a
=
0
;
a
<
3
;
++
a
)
{
{
system
.
addParticle
(
39.95
);
// mass
system
.
addParticle
(
39.95
);
// mass
nonbond
->
addParticle
(
0.0
,
0.3350
,
0.001603
);
// charge, sigma, well depth
initialPositions
[
a
]
=
Vec3
(
0.5
*
a
,
0
,
0
);
// location
// charge, sigma, well depth
nonbond
->
addParticle
(
0.0
,
0.3350
,
0.001603
);
initialPositions
[
a
]
=
OpenMM
::
Vec3
(
0.5
*
a
,
0
,
0
);
// location
}
}
VerletIntegrator
integrator
(
0.020
);
// step size in picoseconds
OpenMM
::
VerletIntegrator
integrator
(
0.020
);
// step size in picoseconds
// Let OpenMM Context choose best platform.
// Let OpenMM Context choose best platform.
OpenMMContext
context
(
system
,
integrator
);
OpenMM
::
OpenMMContext
context
(
system
,
integrator
);
printf
(
"REMARK Using OpenMM platform %s
\n
"
,
printf
(
"REMARK Using OpenMM platform %s
\n
"
,
context
.
getPlatform
().
getName
().
c_str
()
);
context
.
getPlatform
().
getName
().
c_str
()
);
...
@@ -58,11 +59,11 @@ int main()
...
@@ -58,11 +59,11 @@ int main()
}
}
// writePdb() subroutine for quick-and-dirty trajectory output.
// writePdb() subroutine for quick-and-dirty trajectory output.
void
writePdb
(
const
OpenMMContext
&
context
)
void
writePdb
(
const
OpenMM
::
OpenMMContext
&
context
)
{
{
// Request atomic positions from OpenMM
// Request atomic positions from OpenMM
const
State
state
=
context
.
getState
(
State
::
Positions
);
const
OpenMM
::
State
state
=
context
.
getState
(
OpenMM
::
State
::
Positions
);
const
std
::
vector
<
Vec3
>&
pos
=
state
.
getPositions
();
const
std
::
vector
<
OpenMM
::
Vec3
>&
pos
=
state
.
getPositions
();
// write out in PDB format
// write out in PDB format
...
...
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