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
c4933b5e
Commit
c4933b5e
authored
Nov 18, 2008
by
Peter Eastman
Browse files
Constraint tolerance is now adjustable
parent
0107f59f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
23 deletions
+27
-23
openmmapi/include/Integrator.h
openmmapi/include/Integrator.h
+13
-1
openmmapi/include/System.h
openmmapi/include/System.h
+1
-1
openmmapi/include/VerletIntegrator.h
openmmapi/include/VerletIntegrator.h
+1
-1
openmmapi/src/BrownianIntegrator.cpp
openmmapi/src/BrownianIntegrator.cpp
+2
-15
openmmapi/src/LangevinIntegrator.cpp
openmmapi/src/LangevinIntegrator.cpp
+1
-0
openmmapi/src/VerletIntegrator.cpp
openmmapi/src/VerletIntegrator.cpp
+1
-0
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+5
-5
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+3
-0
No files found.
openmmapi/include/Integrator.h
View file @
c4933b5e
...
@@ -66,6 +66,18 @@ public:
...
@@ -66,6 +66,18 @@ public:
void
setStepSize
(
double
size
)
{
void
setStepSize
(
double
size
)
{
stepSize
=
size
;
stepSize
=
size
;
}
}
/**
* Get the distance tolerance within which constraints are maintained, measured in nm.
*/
double
getConstraintTolerance
()
const
{
return
constraintTol
;
}
/**
* Set the distance tolerance within which constraints are maintained, measured in nm.
*/
void
setConstraintTolerance
(
double
tol
)
{
constraintTol
=
tol
;
}
/**
/**
* Advance a simulation through time by taking a series of time steps.
* Advance a simulation through time by taking a series of time steps.
*
*
...
@@ -85,7 +97,7 @@ protected:
...
@@ -85,7 +97,7 @@ protected:
*/
*/
virtual
std
::
vector
<
std
::
string
>
getKernelNames
()
=
0
;
virtual
std
::
vector
<
std
::
string
>
getKernelNames
()
=
0
;
private:
private:
double
stepSize
;
double
stepSize
,
constraintTol
;
};
};
}
// namespace OpenMM
}
// namespace OpenMM
...
...
openmmapi/include/System.h
View file @
c4933b5e
...
@@ -46,7 +46,7 @@ class OPENMM_EXPORT Force;
...
@@ -46,7 +46,7 @@ class OPENMM_EXPORT Force;
* <ol>
* <ol>
* <li>The set of particles in the system</li>
* <li>The set of particles in the system</li>
* <li>The forces acting on them</li>
* <li>The forces acting on them</li>
* <li>Pairs of particles whose separation should be con
n
strained to a fixed value</li>
* <li>Pairs of particles whose separation should be constrained to a fixed value</li>
* </ol>
* </ol>
*
*
* The particles and constraints are defined directly by the System object.
* The particles and constraints are defined directly by the System object.
...
...
openmmapi/include/VerletIntegrator.h
View file @
c4933b5e
openmmapi/src/BrownianIntegrator.cpp
View file @
c4933b5e
...
@@ -43,26 +43,13 @@ BrownianIntegrator::BrownianIntegrator(double temperature, double frictionCoeff,
...
@@ -43,26 +43,13 @@ BrownianIntegrator::BrownianIntegrator(double temperature, double frictionCoeff,
setTemperature
(
temperature
);
setTemperature
(
temperature
);
setFriction
(
frictionCoeff
);
setFriction
(
frictionCoeff
);
setStepSize
(
stepSize
);
setStepSize
(
stepSize
);
setConstraintTolerance
(
1e-4
);
}
}
void
BrownianIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
void
BrownianIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
context
=
&
contextRef
;
context
=
&
contextRef
;
kernel
=
context
->
getPlatform
().
createKernel
(
IntegrateBrownianStepKernel
::
Name
(),
contextRef
);
kernel
=
context
->
getPlatform
().
createKernel
(
IntegrateBrownianStepKernel
::
Name
(),
contextRef
);
const
System
&
system
=
context
->
getSystem
();
dynamic_cast
<
IntegrateBrownianStepKernel
&>
(
kernel
.
getImpl
()).
initialize
(
contextRef
.
getSystem
(),
*
this
);
vector
<
double
>
masses
(
system
.
getNumParticles
());
vector
<
std
::
vector
<
int
>
>
constraintIndices
(
system
.
getNumConstraints
());
vector
<
double
>
constraintLengths
(
system
.
getNumConstraints
());
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
++
i
)
masses
[
i
]
=
system
.
getParticleMass
(
i
);
for
(
int
i
=
0
;
i
<
system
.
getNumConstraints
();
++
i
)
{
int
particle1
,
particle2
;
double
distance
;
system
.
getConstraintParameters
(
i
,
particle1
,
particle2
,
distance
);
constraintIndices
[
i
].
push_back
(
particle1
);
constraintIndices
[
i
].
push_back
(
particle2
);
constraintLengths
[
i
]
=
distance
;
}
dynamic_cast
<
IntegrateBrownianStepKernel
&>
(
kernel
.
getImpl
()).
initialize
(
system
,
*
this
);
}
}
vector
<
string
>
BrownianIntegrator
::
getKernelNames
()
{
vector
<
string
>
BrownianIntegrator
::
getKernelNames
()
{
...
...
openmmapi/src/LangevinIntegrator.cpp
View file @
c4933b5e
...
@@ -43,6 +43,7 @@ LangevinIntegrator::LangevinIntegrator(double temperature, double frictionCoeff,
...
@@ -43,6 +43,7 @@ LangevinIntegrator::LangevinIntegrator(double temperature, double frictionCoeff,
setTemperature
(
temperature
);
setTemperature
(
temperature
);
setFriction
(
frictionCoeff
);
setFriction
(
frictionCoeff
);
setStepSize
(
stepSize
);
setStepSize
(
stepSize
);
setConstraintTolerance
(
1e-4
);
}
}
void
LangevinIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
void
LangevinIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
...
...
openmmapi/src/VerletIntegrator.cpp
View file @
c4933b5e
...
@@ -41,6 +41,7 @@ using std::vector;
...
@@ -41,6 +41,7 @@ using std::vector;
VerletIntegrator
::
VerletIntegrator
(
double
stepSize
)
{
VerletIntegrator
::
VerletIntegrator
(
double
stepSize
)
{
setStepSize
(
stepSize
);
setStepSize
(
stepSize
);
setConstraintTolerance
(
1e-4
);
}
}
void
VerletIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
void
VerletIntegrator
::
initialize
(
OpenMMContextImpl
&
contextRef
)
{
...
...
platforms/cuda/src/CudaKernels.cpp
View file @
c4933b5e
...
@@ -311,7 +311,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
...
@@ -311,7 +311,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
void
CudaCalcGBSAOBCForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
)
{
void
CudaCalcGBSAOBCForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
)
{
}
}
static
void
initializeIntegration
(
const
System
&
system
,
CudaPlatform
::
PlatformData
&
data
)
{
static
void
initializeIntegration
(
const
System
&
system
,
CudaPlatform
::
PlatformData
&
data
,
const
Integrator
&
integrator
)
{
// Set masses.
// Set masses.
...
@@ -340,7 +340,7 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa
...
@@ -340,7 +340,7 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa
invMass1
[
i
]
=
1.0
f
/
mass
[
particle1Index
];
invMass1
[
i
]
=
1.0
f
/
mass
[
particle1Index
];
invMass2
[
i
]
=
1.0
f
/
mass
[
particle2Index
];
invMass2
[
i
]
=
1.0
f
/
mass
[
particle2Index
];
}
}
gpuSetShakeParameters
(
gpu
,
particle1
,
particle2
,
distance
,
invMass1
,
invMass2
);
gpuSetShakeParameters
(
gpu
,
particle1
,
particle2
,
distance
,
invMass1
,
invMass2
,
integrator
.
getConstraintTolerance
()
);
// Initialize any terms that haven't already been handled by a Force.
// Initialize any terms that haven't already been handled by a Force.
...
@@ -377,7 +377,7 @@ CudaIntegrateVerletStepKernel::~CudaIntegrateVerletStepKernel() {
...
@@ -377,7 +377,7 @@ CudaIntegrateVerletStepKernel::~CudaIntegrateVerletStepKernel() {
}
}
void
CudaIntegrateVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VerletIntegrator
&
integrator
)
{
void
CudaIntegrateVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VerletIntegrator
&
integrator
)
{
initializeIntegration
(
system
,
data
);
initializeIntegration
(
system
,
data
,
integrator
);
prevStepSize
=
-
1.0
;
prevStepSize
=
-
1.0
;
}
}
...
@@ -406,7 +406,7 @@ CudaIntegrateLangevinStepKernel::~CudaIntegrateLangevinStepKernel() {
...
@@ -406,7 +406,7 @@ CudaIntegrateLangevinStepKernel::~CudaIntegrateLangevinStepKernel() {
}
}
void
CudaIntegrateLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
LangevinIntegrator
&
integrator
)
{
void
CudaIntegrateLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
LangevinIntegrator
&
integrator
)
{
initializeIntegration
(
system
,
data
);
initializeIntegration
(
system
,
data
,
integrator
);
prevStepSize
=
-
1.0
;
prevStepSize
=
-
1.0
;
}
}
...
@@ -441,7 +441,7 @@ CudaIntegrateBrownianStepKernel::~CudaIntegrateBrownianStepKernel() {
...
@@ -441,7 +441,7 @@ CudaIntegrateBrownianStepKernel::~CudaIntegrateBrownianStepKernel() {
}
}
void
CudaIntegrateBrownianStepKernel
::
initialize
(
const
System
&
system
,
const
BrownianIntegrator
&
integrator
)
{
void
CudaIntegrateBrownianStepKernel
::
initialize
(
const
System
&
system
,
const
BrownianIntegrator
&
integrator
)
{
initializeIntegration
(
system
,
data
);
initializeIntegration
(
system
,
data
,
integrator
);
prevStepSize
=
-
1.0
;
prevStepSize
=
-
1.0
;
}
}
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
c4933b5e
...
@@ -477,6 +477,7 @@ void ReferenceIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, con
...
@@ -477,6 +477,7 @@ void ReferenceIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, con
dynamics
->
setReferenceShakeAlgorithm
(
shake
);
dynamics
->
setReferenceShakeAlgorithm
(
shake
);
prevStepSize
=
stepSize
;
prevStepSize
=
stepSize
;
}
}
shake
->
setTolerance
(
integrator
.
getConstraintTolerance
());
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
}
}
...
@@ -537,6 +538,7 @@ void ReferenceIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, c
...
@@ -537,6 +538,7 @@ void ReferenceIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, c
prevFriction
=
friction
;
prevFriction
=
friction
;
prevStepSize
=
stepSize
;
prevStepSize
=
stepSize
;
}
}
shake
->
setTolerance
(
integrator
.
getConstraintTolerance
());
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
}
}
...
@@ -596,6 +598,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, c
...
@@ -596,6 +598,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, c
prevFriction
=
friction
;
prevFriction
=
friction
;
prevStepSize
=
stepSize
;
prevStepSize
=
stepSize
;
}
}
shake
->
setTolerance
(
integrator
.
getConstraintTolerance
());
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
}
}
...
...
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