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
35a4b156
Commit
35a4b156
authored
Jun 03, 2011
by
Peter Eastman
Browse files
Created default constructor for State
parent
18a837c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
openmmapi/include/openmm/State.h
openmmapi/include/openmm/State.h
+6
-2
openmmapi/src/Context.cpp
openmmapi/src/Context.cpp
+1
-1
openmmapi/src/State.cpp
openmmapi/src/State.cpp
+3
-1
No files found.
openmmapi/include/openmm/State.h
View file @
35a4b156
...
@@ -57,6 +57,10 @@ public:
...
@@ -57,6 +57,10 @@ public:
* a State, use these values to specify which data types it should contain.
* a State, use these values to specify which data types it should contain.
*/
*/
enum
DataType
{
Positions
=
1
,
Velocities
=
2
,
Forces
=
4
,
Energy
=
8
,
Parameters
=
16
};
enum
DataType
{
Positions
=
1
,
Velocities
=
2
,
Forces
=
4
,
Energy
=
8
,
Parameters
=
16
};
/**
* Construct an empty State containing no data. This exists so State objects can be used in STL containers.
*/
State
();
/**
/**
* Get the time for which this State was created.
* Get the time for which this State was created.
*/
*/
...
@@ -95,14 +99,14 @@ public:
...
@@ -95,14 +99,14 @@ public:
const
std
::
map
<
std
::
string
,
double
>&
getParameters
()
const
;
const
std
::
map
<
std
::
string
,
double
>&
getParameters
()
const
;
private:
private:
friend
class
Context
;
friend
class
Context
;
State
(
double
time
,
int
numParticles
,
DataType
types
);
State
(
double
time
,
int
numParticles
,
int
types
);
std
::
vector
<
Vec3
>&
updPositions
();
std
::
vector
<
Vec3
>&
updPositions
();
std
::
vector
<
Vec3
>&
updVelocities
();
std
::
vector
<
Vec3
>&
updVelocities
();
std
::
vector
<
Vec3
>&
updForces
();
std
::
vector
<
Vec3
>&
updForces
();
std
::
map
<
std
::
string
,
double
>&
updParameters
();
std
::
map
<
std
::
string
,
double
>&
updParameters
();
void
setEnergy
(
double
ke
,
double
pe
);
void
setEnergy
(
double
ke
,
double
pe
);
void
setPeriodicBoxVectors
(
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
);
void
setPeriodicBoxVectors
(
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
);
DataType
types
;
int
types
;
double
time
,
ke
,
pe
;
double
time
,
ke
,
pe
;
std
::
vector
<
Vec3
>
positions
;
std
::
vector
<
Vec3
>
positions
;
std
::
vector
<
Vec3
>
velocities
;
std
::
vector
<
Vec3
>
velocities
;
...
...
openmmapi/src/Context.cpp
View file @
35a4b156
...
@@ -78,7 +78,7 @@ Platform& Context::getPlatform() {
...
@@ -78,7 +78,7 @@ Platform& Context::getPlatform() {
}
}
State
Context
::
getState
(
int
types
)
const
{
State
Context
::
getState
(
int
types
)
const
{
State
state
(
impl
->
getTime
(),
impl
->
getSystem
().
getNumParticles
(),
State
::
DataType
(
types
)
)
;
State
state
(
impl
->
getTime
(),
impl
->
getSystem
().
getNumParticles
(),
types
);
Vec3
periodicBoxSize
[
3
];
Vec3
periodicBoxSize
[
3
];
impl
->
getPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
impl
->
getPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
state
.
setPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
state
.
setPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
...
...
openmmapi/src/State.cpp
View file @
35a4b156
...
@@ -73,10 +73,12 @@ const map<string, double>& State::getParameters() const {
...
@@ -73,10 +73,12 @@ const map<string, double>& State::getParameters() const {
throw
OpenMMException
(
"Invoked getParameters() on a State which does not contain parameters."
);
throw
OpenMMException
(
"Invoked getParameters() on a State which does not contain parameters."
);
return
parameters
;
return
parameters
;
}
}
State
::
State
(
double
time
,
int
numParticles
,
DataType
types
)
:
types
(
types
),
time
(
time
),
ke
(
0
),
pe
(
0
),
State
::
State
(
double
time
,
int
numParticles
,
int
types
)
:
types
(
types
),
time
(
time
),
ke
(
0
),
pe
(
0
),
positions
(
(
types
&
Positions
)
==
0
?
0
:
numParticles
),
velocities
(
(
types
&
Velocities
)
==
0
?
0
:
numParticles
),
positions
(
(
types
&
Positions
)
==
0
?
0
:
numParticles
),
velocities
(
(
types
&
Velocities
)
==
0
?
0
:
numParticles
),
forces
(
(
types
&
Forces
)
==
0
?
0
:
numParticles
)
{
forces
(
(
types
&
Forces
)
==
0
?
0
:
numParticles
)
{
}
}
State
::
State
()
:
types
(
0
),
time
(
0.0
),
ke
(
0
),
pe
(
0
),
positions
(
0
),
velocities
(
0
),
forces
(
0
)
{
}
vector
<
Vec3
>&
State
::
updPositions
()
{
vector
<
Vec3
>&
State
::
updPositions
()
{
return
positions
;
return
positions
;
}
}
...
...
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