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
95584c96
Commit
95584c96
authored
Apr 21, 2016
by
peastman
Browse files
Merge pull request #1468 from peastman/mctemperature
Changed mechanism for setting barostat temperature
parents
8190f243
50fe7be0
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
102 additions
and
72 deletions
+102
-72
openmmapi/include/openmm/MonteCarloAnisotropicBarostat.h
openmmapi/include/openmm/MonteCarloAnisotropicBarostat.h
+24
-15
openmmapi/include/openmm/MonteCarloBarostat.h
openmmapi/include/openmm/MonteCarloBarostat.h
+21
-12
openmmapi/include/openmm/MonteCarloMembraneBarostat.h
openmmapi/include/openmm/MonteCarloMembraneBarostat.h
+19
-10
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
+3
-3
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
+3
-2
openmmapi/src/MonteCarloBarostat.cpp
openmmapi/src/MonteCarloBarostat.cpp
+3
-3
openmmapi/src/MonteCarloBarostatImpl.cpp
openmmapi/src/MonteCarloBarostatImpl.cpp
+2
-1
openmmapi/src/MonteCarloMembraneBarostat.cpp
openmmapi/src/MonteCarloMembraneBarostat.cpp
+3
-3
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
+3
-2
platforms/reference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
...ference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
+2
-2
serialization/src/MonteCarloAnisotropicBarostatProxy.cpp
serialization/src/MonteCarloAnisotropicBarostatProxy.cpp
+2
-2
serialization/src/MonteCarloBarostatProxy.cpp
serialization/src/MonteCarloBarostatProxy.cpp
+2
-2
serialization/src/MonteCarloMembraneBarostatProxy.cpp
serialization/src/MonteCarloMembraneBarostatProxy.cpp
+2
-2
serialization/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
...tion/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
+2
-2
serialization/tests/TestSerializeMonteCarloBarostat.cpp
serialization/tests/TestSerializeMonteCarloBarostat.cpp
+2
-2
serialization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
...ization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
+2
-2
tests/TestMonteCarloAnisotropicBarostat.h
tests/TestMonteCarloAnisotropicBarostat.h
+5
-5
tests/TestMonteCarloBarostat.h
tests/TestMonteCarloBarostat.h
+2
-2
No files found.
openmmapi/include/openmm/MonteCarloAnisotropicBarostat.h
View file @
95584c96
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -81,17 +81,25 @@ public:
static
const
std
::
string
key
=
"MonteCarloPressureZ"
;
return
key
;
}
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static
const
std
::
string
&
Temperature
()
{
static
const
std
::
string
key
=
"AnisotropicMonteCarloTemperature"
;
return
key
;
}
/**
* Create a MonteCarloAnisotropicBarostat.
*
* @param defaultPressure The default pressure acting on each axis (in bar)
* @param
t
emperature
the
temperature at which the system is being maintained (in Kelvin)
* @param scaleX whether to allow the X dimension of the periodic box to change size
* @param scaleY whether to allow the Y dimension of the periodic box to change size
* @param scaleZ whether to allow the Z dimension of the periodic box to change size
* @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
* @param defaultPressure
The default pressure acting on each axis (in bar)
* @param
defaultT
emperature
the default
temperature at which the system is being maintained (in Kelvin)
* @param scaleX
whether to allow the X dimension of the periodic box to change size
* @param scaleY
whether to allow the Y dimension of the periodic box to change size
* @param scaleZ
whether to allow the Z dimension of the periodic box to change size
* @param frequency
the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
*/
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
t
emperature
,
bool
scaleX
=
true
,
bool
scaleY
=
true
,
bool
scaleZ
=
true
,
int
frequency
=
25
);
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
defaultT
emperature
,
bool
scaleX
=
true
,
bool
scaleY
=
true
,
bool
scaleZ
=
true
,
int
frequency
=
25
);
/**
* Get the default pressure (in bar).
*
...
...
@@ -142,18 +150,19 @@ public:
frequency
=
freq
;
}
/**
* Get the temperature at which the system is being maintained, measured in Kelvin.
* Get the
default
temperature at which the system is being maintained, measured in Kelvin.
*/
double
getTemperature
()
const
{
return
t
emperature
;
double
get
Default
Temperature
()
const
{
return
defaultT
emperature
;
}
/**
* Set the temperature at which the system is being maintained.
* Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
*
* @param temp the system temperature, measured in Kelvin.
*/
void
setTemperature
(
double
temp
)
{
t
emperature
=
temp
;
void
set
Default
Temperature
(
double
temp
)
{
defaultT
emperature
=
temp
;
}
/**
* Get the random number seed. See setRandomNumberSeed() for details.
...
...
@@ -188,7 +197,7 @@ protected:
ForceImpl
*
createImpl
()
const
;
private:
Vec3
defaultPressure
;
double
t
emperature
;
double
defaultT
emperature
;
bool
scaleX
,
scaleY
,
scaleZ
;
int
frequency
,
randomNumberSeed
;
};
...
...
openmmapi/include/openmm/MonteCarloBarostat.h
View file @
95584c96
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -58,14 +58,22 @@ public:
static
const
std
::
string
key
=
"MonteCarloPressure"
;
return
key
;
}
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static
const
std
::
string
&
Temperature
()
{
static
const
std
::
string
key
=
"MonteCarloTemperature"
;
return
key
;
}
/**
* Create a MonteCarloBarostat.
*
* @param defaultPressure the default pressure acting on the system (in bar)
* @param
t
emperature
the
temperature at which the system is being maintained (in Kelvin)
* @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
* @param defaultPressure
the default pressure acting on the system (in bar)
* @param
defaultT
emperature
the default
temperature at which the system is being maintained (in Kelvin)
* @param frequency
the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
*/
MonteCarloBarostat
(
double
defaultPressure
,
double
t
emperature
,
int
frequency
=
25
);
MonteCarloBarostat
(
double
defaultPressure
,
double
defaultT
emperature
,
int
frequency
=
25
);
/**
* Get the default pressure acting on the system (in bar).
*
...
...
@@ -98,18 +106,19 @@ public:
frequency
=
freq
;
}
/**
* Get the temperature at which the system is being maintained, measured in Kelvin.
* Get the
default
temperature at which the system is being maintained, measured in Kelvin.
*/
double
getTemperature
()
const
{
return
t
emperature
;
double
get
Default
Temperature
()
const
{
return
defaultT
emperature
;
}
/**
* Set the temperature at which the system is being maintained.
* Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
*
* @param temp the system temperature, measured in Kelvin.
*/
void
setTemperature
(
double
temp
)
{
t
emperature
=
temp
;
void
set
Default
Temperature
(
double
temp
)
{
defaultT
emperature
=
temp
;
}
/**
* Get the random number seed. See setRandomNumberSeed() for details.
...
...
@@ -143,7 +152,7 @@ public:
protected:
ForceImpl
*
createImpl
()
const
;
private:
double
defaultPressure
,
t
emperature
;
double
defaultPressure
,
defaultT
emperature
;
int
frequency
,
randomNumberSeed
;
};
...
...
openmmapi/include/openmm/MonteCarloMembraneBarostat.h
View file @
95584c96
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -111,17 +111,25 @@ public:
static
const
std
::
string
key
=
"MembraneMonteCarloSurfaceTension"
;
return
key
;
}
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static
const
std
::
string
&
Temperature
()
{
static
const
std
::
string
key
=
"MembraneMonteCarloTemperature"
;
return
key
;
}
/**
* Create a MonteCarloMembraneBarostat.
*
* @param defaultPressure the default pressure acting on the system (in bar)
* @param defaultSurfaceTension the default surface tension acting on the system (in bar*nm)
* @param
t
emperature
the temperature at which the system is being maintained (in Kelvin)
* @param
defaultT
emperature the
default
temperature at which the system is being maintained (in Kelvin)
* @param xymode the mode specifying the behavior of the X and Y axes
* @param zmode the mode specifying the behavior of the Z axis
* @param frequency the frequency at which Monte Carlo volume changes should be attempted (in time steps)
*/
MonteCarloMembraneBarostat
(
double
defaultPressure
,
double
defaultSurfaceTension
,
double
t
emperature
,
XYMode
xymode
,
ZMode
zmode
,
int
frequency
=
25
);
MonteCarloMembraneBarostat
(
double
defaultPressure
,
double
defaultSurfaceTension
,
double
defaultT
emperature
,
XYMode
xymode
,
ZMode
zmode
,
int
frequency
=
25
);
/**
* Get the default pressure acting on the system (in bar).
*
...
...
@@ -171,18 +179,19 @@ public:
frequency
=
freq
;
}
/**
* Get the temperature at which the system is being maintained, measured in Kelvin.
* Get the
default
temperature at which the system is being maintained, measured in Kelvin.
*/
double
getTemperature
()
const
{
return
t
emperature
;
double
get
Default
Temperature
()
const
{
return
defaultT
emperature
;
}
/**
* Set the temperature at which the system is being maintained.
* Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
*
* @param temp the system temperature, measured in Kelvin.
*/
void
setTemperature
(
double
temp
)
{
t
emperature
=
temp
;
void
set
Default
Temperature
(
double
temp
)
{
defaultT
emperature
=
temp
;
}
/**
* Get the mode specifying the behavior of the X and Y axes.
...
...
@@ -240,7 +249,7 @@ public:
protected:
ForceImpl
*
createImpl
()
const
;
private:
double
defaultPressure
,
defaultSurfaceTension
,
t
emperature
;
double
defaultPressure
,
defaultSurfaceTension
,
defaultT
emperature
;
XYMode
xymode
;
ZMode
zmode
;
int
frequency
,
randomNumberSeed
;
...
...
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,8 +34,8 @@
using
namespace
OpenMM
;
MonteCarloAnisotropicBarostat
::
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
t
emperature
,
bool
scaleX
,
bool
scaleY
,
bool
scaleZ
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
t
emperature
(
t
emperature
),
scaleX
(
scaleX
),
scaleY
(
scaleY
),
scaleZ
(
scaleZ
),
frequency
(
frequency
)
{
MonteCarloAnisotropicBarostat
::
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
defaultT
emperature
,
bool
scaleX
,
bool
scaleY
,
bool
scaleZ
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
defaultT
emperature
(
defaultT
emperature
),
scaleX
(
scaleX
),
scaleY
(
scaleY
),
scaleZ
(
scaleZ
),
frequency
(
frequency
)
{
setRandomNumberSeed
(
0
);
}
...
...
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -119,7 +119,7 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
kT
=
BOLTZ
*
owner
.
get
Temperature
();
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloAnisotropicBarostat
::
Temperature
()
)
;
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
if
(
w
>
0
&&
genrand_real2
(
random
)
>
std
::
exp
(
-
w
/
kT
))
{
// Reject the step.
...
...
@@ -150,6 +150,7 @@ std::map<std::string, double> MonteCarloAnisotropicBarostatImpl::getDefaultParam
parameters
[
MonteCarloAnisotropicBarostat
::
PressureX
()]
=
getOwner
().
getDefaultPressure
()[
0
];
parameters
[
MonteCarloAnisotropicBarostat
::
PressureY
()]
=
getOwner
().
getDefaultPressure
()[
1
];
parameters
[
MonteCarloAnisotropicBarostat
::
PressureZ
()]
=
getOwner
().
getDefaultPressure
()[
2
];
parameters
[
MonteCarloAnisotropicBarostat
::
Temperature
()]
=
getOwner
().
getDefaultTemperature
();
return
parameters
;
}
...
...
openmmapi/src/MonteCarloBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,8 +34,8 @@
using
namespace
OpenMM
;
MonteCarloBarostat
::
MonteCarloBarostat
(
double
defaultPressure
,
double
t
emperature
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
t
emperature
(
t
emperature
),
frequency
(
frequency
)
{
MonteCarloBarostat
::
MonteCarloBarostat
(
double
defaultPressure
,
double
defaultT
emperature
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
defaultT
emperature
(
defaultT
emperature
),
frequency
(
frequency
)
{
setRandomNumberSeed
(
0
);
}
...
...
openmmapi/src/MonteCarloBarostatImpl.cpp
View file @
95584c96
...
...
@@ -89,7 +89,7 @@ void MonteCarloBarostatImpl::updateContextState(ContextImpl& context) {
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
pressure
=
context
.
getParameter
(
MonteCarloBarostat
::
Pressure
())
*
(
AVOGADRO
*
1e-25
);
double
kT
=
BOLTZ
*
owner
.
get
Temperature
();
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloBarostat
::
Temperature
()
)
;
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
if
(
w
>
0
&&
genrand_real2
(
random
)
>
std
::
exp
(
-
w
/
kT
))
{
// Reject the step.
...
...
@@ -118,6 +118,7 @@ void MonteCarloBarostatImpl::updateContextState(ContextImpl& context) {
std
::
map
<
std
::
string
,
double
>
MonteCarloBarostatImpl
::
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
parameters
;
parameters
[
MonteCarloBarostat
::
Pressure
()]
=
getOwner
().
getDefaultPressure
();
parameters
[
MonteCarloBarostat
::
Temperature
()]
=
getOwner
().
getDefaultTemperature
();
return
parameters
;
}
...
...
openmmapi/src/MonteCarloMembraneBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,8 +34,8 @@
using
namespace
OpenMM
;
MonteCarloMembraneBarostat
::
MonteCarloMembraneBarostat
(
double
defaultPressure
,
double
defaultSurfaceTension
,
double
t
emperature
,
XYMode
xymode
,
ZMode
zmode
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
defaultSurfaceTension
(
defaultSurfaceTension
),
t
emperature
(
t
emperature
),
MonteCarloMembraneBarostat
::
MonteCarloMembraneBarostat
(
double
defaultPressure
,
double
defaultSurfaceTension
,
double
defaultT
emperature
,
XYMode
xymode
,
ZMode
zmode
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
defaultSurfaceTension
(
defaultSurfaceTension
),
defaultT
emperature
(
defaultT
emperature
),
xymode
(
xymode
),
zmode
(
zmode
),
frequency
(
frequency
)
{
setRandomNumberSeed
(
0
);
}
...
...
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -120,7 +120,7 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
kT
=
BOLTZ
*
owner
.
get
Temperature
();
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloMembraneBarostat
::
Temperature
()
)
;
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
tension
*
deltaArea
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
if
(
w
>
0
&&
genrand_real2
(
random
)
>
std
::
exp
(
-
w
/
kT
))
{
// Reject the step.
...
...
@@ -150,6 +150,7 @@ std::map<std::string, double> MonteCarloMembraneBarostatImpl::getDefaultParamete
std
::
map
<
std
::
string
,
double
>
parameters
;
parameters
[
MonteCarloMembraneBarostat
::
Pressure
()]
=
getOwner
().
getDefaultPressure
();
parameters
[
MonteCarloMembraneBarostat
::
SurfaceTension
()]
=
getOwner
().
getDefaultSurfaceTension
();
parameters
[
MonteCarloMembraneBarostat
::
Temperature
()]
=
getOwner
().
getDefaultTemperature
();
return
parameters
;
}
...
...
platforms/reference/tests/TestReferenceMonteCarloMembraneBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -82,7 +82,7 @@ void testIdealGas(MonteCarloMembraneBarostat::XYMode xymode, MonteCarloMembraneB
// Test it for three different temperatures.
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
barostat
->
setTemperature
(
temp
[
i
]);
barostat
->
set
Default
Temperature
(
temp
[
i
]);
LangevinIntegrator
integrator
(
temp
[
i
],
0.1
,
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
serialization/src/MonteCarloAnisotropicBarostatProxy.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -52,7 +52,7 @@ void MonteCarloAnisotropicBarostatProxy::serialize(const void* object, Serializa
node
.
setBoolProperty
(
"scalex"
,
force
.
getScaleX
());
node
.
setBoolProperty
(
"scaley"
,
force
.
getScaleY
());
node
.
setBoolProperty
(
"scalez"
,
force
.
getScaleZ
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
getTemperature
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
get
Default
Temperature
());
node
.
setIntProperty
(
"frequency"
,
force
.
getFrequency
());
node
.
setIntProperty
(
"randomSeed"
,
force
.
getRandomNumberSeed
());
}
...
...
serialization/src/MonteCarloBarostatProxy.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -46,7 +46,7 @@ void MonteCarloBarostatProxy::serialize(const void* object, SerializationNode& n
const
MonteCarloBarostat
&
force
=
*
reinterpret_cast
<
const
MonteCarloBarostat
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setDoubleProperty
(
"pressure"
,
force
.
getDefaultPressure
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
getTemperature
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
get
Default
Temperature
());
node
.
setIntProperty
(
"frequency"
,
force
.
getFrequency
());
node
.
setIntProperty
(
"randomSeed"
,
force
.
getRandomNumberSeed
());
}
...
...
serialization/src/MonteCarloMembraneBarostatProxy.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -47,7 +47,7 @@ void MonteCarloMembraneBarostatProxy::serialize(const void* object, Serializatio
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setDoubleProperty
(
"pressure"
,
force
.
getDefaultPressure
());
node
.
setDoubleProperty
(
"surfaceTension"
,
force
.
getDefaultSurfaceTension
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
getTemperature
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
get
Default
Temperature
());
node
.
setIntProperty
(
"xymode"
,
force
.
getXYMode
());
node
.
setIntProperty
(
"zmode"
,
force
.
getZMode
());
node
.
setIntProperty
(
"frequency"
,
force
.
getFrequency
());
...
...
serialization/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -56,7 +56,7 @@ void testSerialization() {
MonteCarloAnisotropicBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL_VEC
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
(),
0.0
);
ASSERT_EQUAL
(
force
.
getTemperature
(),
force2
.
getTemperature
());
ASSERT_EQUAL
(
force
.
get
Default
Temperature
(),
force2
.
get
Default
Temperature
());
ASSERT_EQUAL
(
force
.
getScaleX
(),
force2
.
getScaleX
());
ASSERT_EQUAL
(
force
.
getScaleY
(),
force2
.
getScaleY
());
ASSERT_EQUAL
(
force
.
getScaleZ
(),
force2
.
getScaleZ
());
...
...
serialization/tests/TestSerializeMonteCarloBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -56,7 +56,7 @@ void testSerialization() {
MonteCarloBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getTemperature
(),
force2
.
getTemperature
());
ASSERT_EQUAL
(
force
.
get
Default
Temperature
(),
force2
.
get
Default
Temperature
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
ASSERT_EQUAL
(
force
.
getRandomNumberSeed
(),
force2
.
getRandomNumberSeed
());
}
...
...
serialization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -57,7 +57,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getDefaultSurfaceTension
(),
force2
.
getDefaultSurfaceTension
());
ASSERT_EQUAL
(
force
.
getTemperature
(),
force2
.
getTemperature
());
ASSERT_EQUAL
(
force
.
get
Default
Temperature
(),
force2
.
get
Default
Temperature
());
ASSERT_EQUAL
(
force
.
getXYMode
(),
force2
.
getXYMode
());
ASSERT_EQUAL
(
force
.
getZMode
(),
force2
.
getZMode
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
...
...
tests/TestMonteCarloAnisotropicBarostat.h
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -75,7 +75,7 @@ void testIdealGas() {
// Test it for three different temperatures.
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
barostat
->
setTemperature
(
temp
[
i
]);
barostat
->
set
Default
Temperature
(
temp
[
i
]);
LangevinIntegrator
integrator
(
temp
[
i
],
0.1
,
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
@@ -135,7 +135,7 @@ void testIdealGasAxis(int axis) {
// Test it for three different temperatures.
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
barostat
->
setTemperature
(
temp
[
i
]);
barostat
->
set
Default
Temperature
(
temp
[
i
]);
LangevinIntegrator
integrator
(
temp
[
i
],
0.1
,
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
@@ -371,7 +371,7 @@ void testEinsteinCrystal() {
// Create the barostat.
MonteCarloAnisotropicBarostat
*
barostat
=
new
MonteCarloAnisotropicBarostat
(
Vec3
(
pres3
[
p
],
pres3
[
p
],
pres3
[
p
]),
temp
,
(
a
==
0
||
a
==
3
),
(
a
==
1
||
a
==
3
),
(
a
==
2
||
a
==
3
),
frequency
);
system
.
addForce
(
barostat
);
barostat
->
setTemperature
(
temp
);
barostat
->
set
Default
Temperature
(
temp
);
LangevinIntegrator
integrator
(
temp
,
0.1
,
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
@@ -417,7 +417,7 @@ void testEinsteinCrystal() {
// Create the barostat.
MonteCarloBarostat
*
barostat
=
new
MonteCarloBarostat
(
pres3
[
p
],
temp
,
frequency
);
system
.
addForce
(
barostat
);
barostat
->
setTemperature
(
temp
);
barostat
->
set
Default
Temperature
(
temp
);
LangevinIntegrator
integrator
(
temp
,
0.1
,
0.001
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
...
...
tests/TestMonteCarloBarostat.h
View file @
95584c96
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -111,7 +111,7 @@ void testIdealGas() {
// Test it for three different temperatures.
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
barostat
->
setTemperature
(
temp
[
i
]);
barostat
->
set
Default
Temperature
(
temp
[
i
]);
LangevinIntegrator
integrator
(
temp
[
i
],
0.1
,
0.01
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
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