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
bcc6216d
Commit
bcc6216d
authored
May 07, 2010
by
Peter Eastman
Browse files
Periodic box dimensions can be changed in the middle of a simulation
parent
149c6ec6
Changes
48
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
63 deletions
+121
-63
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+102
-47
platforms/reference/src/ReferenceKernels.h
platforms/reference/src/ReferenceKernels.h
+7
-3
platforms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
...rms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
+0
-1
platforms/reference/tests/TestReferenceCustomGBForce.cpp
platforms/reference/tests/TestReferenceCustomGBForce.cpp
+4
-4
platforms/reference/tests/TestReferenceCustomNonbondedForce.cpp
...rms/reference/tests/TestReferenceCustomNonbondedForce.cpp
+1
-1
platforms/reference/tests/TestReferenceEwald.cpp
platforms/reference/tests/TestReferenceEwald.cpp
+5
-5
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
+1
-1
platforms/reference/tests/TestReferenceNonbondedForce.cpp
platforms/reference/tests/TestReferenceNonbondedForce.cpp
+1
-1
No files found.
platforms/reference/src/ReferenceKernels.cpp
View file @
bcc6216d
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
#include "SimTKReference/ReferenceVariableVerletDynamics.h"
#include "SimTKReference/ReferenceVariableVerletDynamics.h"
#include "SimTKReference/ReferenceVerletDynamics.h"
#include "SimTKReference/ReferenceVerletDynamics.h"
#include "openmm/CMMotionRemover.h"
#include "openmm/CMMotionRemover.h"
#include "openmm/Context.h"
#include "openmm/System.h"
#include "openmm/System.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/CustomHbondForceImpl.h"
#include "openmm/internal/CustomHbondForceImpl.h"
...
@@ -661,11 +662,6 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N
...
@@ -661,11 +662,6 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N
}
}
nonbondedMethod
=
CalcNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedMethod
=
CalcNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
if
(
nonbondedMethod
==
NoCutoff
)
if
(
nonbondedMethod
==
NoCutoff
)
neighborList
=
NULL
;
neighborList
=
NULL
;
else
else
...
@@ -690,7 +686,13 @@ void ReferenceCalcNonbondedForceKernel::executeForces(ContextImpl& context) {
...
@@ -690,7 +686,13 @@ void ReferenceCalcNonbondedForceKernel::executeForces(ContextImpl& context) {
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
ewald
=
(
nonbondedMethod
==
Ewald
);
bool
ewald
=
(
nonbondedMethod
==
Ewald
);
bool
pme
=
(
nonbondedMethod
==
PME
);
bool
pme
=
(
nonbondedMethod
==
PME
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
(
periodic
||
ewald
||
pme
)
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
(
periodic
||
ewald
||
pme
)
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
clj
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
,
rfDielectric
);
clj
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
,
rfDielectric
);
}
}
...
@@ -714,7 +716,13 @@ double ReferenceCalcNonbondedForceKernel::executeEnergy(ContextImpl& context) {
...
@@ -714,7 +716,13 @@ double ReferenceCalcNonbondedForceKernel::executeEnergy(ContextImpl& context) {
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
ewald
=
(
nonbondedMethod
==
Ewald
);
bool
ewald
=
(
nonbondedMethod
==
Ewald
);
bool
pme
=
(
nonbondedMethod
==
PME
);
bool
pme
=
(
nonbondedMethod
==
PME
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
(
periodic
||
ewald
||
pme
)
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
(
periodic
||
ewald
||
pme
)
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
clj
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
,
rfDielectric
);
clj
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
,
rfDielectric
);
}
}
...
@@ -835,11 +843,6 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c
...
@@ -835,11 +843,6 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c
}
}
nonbondedMethod
=
CalcCustomNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedMethod
=
CalcCustomNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
if
(
nonbondedMethod
==
NoCutoff
)
if
(
nonbondedMethod
==
NoCutoff
)
neighborList
=
NULL
;
neighborList
=
NULL
;
else
else
...
@@ -878,7 +881,13 @@ void ReferenceCalcCustomNonbondedForceKernel::executeForces(ContextImpl& context
...
@@ -878,7 +881,13 @@ void ReferenceCalcCustomNonbondedForceKernel::executeForces(ContextImpl& context
RealOpenMM
**
forceData
=
extractForces
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
}
}
...
@@ -896,7 +905,13 @@ double ReferenceCalcCustomNonbondedForceKernel::executeEnergy(ContextImpl& conte
...
@@ -896,7 +905,13 @@ double ReferenceCalcCustomNonbondedForceKernel::executeEnergy(ContextImpl& conte
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
}
}
...
@@ -936,15 +951,7 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
...
@@ -936,15 +951,7 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
obcParameters
->
setSoluteDielectric
(
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
())
);
obcParameters
->
setSoluteDielectric
(
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
())
);
if
(
force
.
getNonbondedMethod
()
!=
GBSAOBCForce
::
NoCutoff
)
if
(
force
.
getNonbondedMethod
()
!=
GBSAOBCForce
::
NoCutoff
)
obcParameters
->
setUseCutoff
(
static_cast
<
RealOpenMM
>
(
force
.
getCutoffDistance
()));
obcParameters
->
setUseCutoff
(
static_cast
<
RealOpenMM
>
(
force
.
getCutoffDistance
()));
if
(
force
.
getNonbondedMethod
()
==
GBSAOBCForce
::
CutoffPeriodic
)
{
isPeriodic
=
(
force
.
getNonbondedMethod
()
==
GBSAOBCForce
::
CutoffPeriodic
);
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
obcParameters
->
setPeriodic
(
periodicBoxSize
);
}
obc
=
new
CpuObc
(
obcParameters
);
obc
=
new
CpuObc
(
obcParameters
);
obc
->
setIncludeAceApproximation
(
true
);
obc
->
setIncludeAceApproximation
(
true
);
}
}
...
@@ -952,12 +959,30 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
...
@@ -952,12 +959,30 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
void
ReferenceCalcGBSAOBCForceKernel
::
executeForces
(
ContextImpl
&
context
)
{
void
ReferenceCalcGBSAOBCForceKernel
::
executeForces
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
if
(
isPeriodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
obc
->
getObcParameters
()
->
setPeriodic
(
periodicBoxSize
);
}
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
}
}
double
ReferenceCalcGBSAOBCForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
double
ReferenceCalcGBSAOBCForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
allocateRealArray
(
context
.
getSystem
().
getNumParticles
(),
3
);
RealOpenMM
**
forceData
=
allocateRealArray
(
context
.
getSystem
().
getNumParticles
(),
3
);
if
(
isPeriodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
obc
->
getObcParameters
()
->
setPeriodic
(
periodicBoxSize
);
}
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
disposeRealArray
(
forceData
,
context
.
getSystem
().
getNumParticles
());
disposeRealArray
(
forceData
,
context
.
getSystem
().
getNumParticles
());
return
obc
->
getEnergy
();
return
obc
->
getEnergy
();
...
@@ -991,15 +1016,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
...
@@ -991,15 +1016,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
gBVIParameters
->
setSoluteDielectric
(
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
()));
gBVIParameters
->
setSoluteDielectric
(
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
()));
if
(
force
.
getNonbondedMethod
()
!=
GBVIForce
::
NoCutoff
)
if
(
force
.
getNonbondedMethod
()
!=
GBVIForce
::
NoCutoff
)
gBVIParameters
->
setUseCutoff
(
static_cast
<
RealOpenMM
>
(
force
.
getCutoffDistance
()));
gBVIParameters
->
setUseCutoff
(
static_cast
<
RealOpenMM
>
(
force
.
getCutoffDistance
()));
if
(
force
.
getNonbondedMethod
()
==
GBVIForce
::
CutoffPeriodic
)
{
isPeriodic
=
(
force
.
getNonbondedMethod
()
==
GBVIForce
::
CutoffPeriodic
);
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
gBVIParameters
->
setPeriodic
(
periodicBoxSize
);
}
gbvi
=
new
CpuGBVI
(
gBVIParameters
);
gbvi
=
new
CpuGBVI
(
gBVIParameters
);
}
}
...
@@ -1008,6 +1025,15 @@ void ReferenceCalcGBVIForceKernel::executeForces(ContextImpl& context) {
...
@@ -1008,6 +1025,15 @@ void ReferenceCalcGBVIForceKernel::executeForces(ContextImpl& context) {
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
if
(
isPeriodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
gbvi
->
getGBVIParameters
()
->
setPeriodic
(
periodicBoxSize
);
}
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
gbvi
->
computeBornForces
(
bornRadii
,
posData
,
&
charges
[
0
],
forceData
);
gbvi
->
computeBornForces
(
bornRadii
,
posData
,
&
charges
[
0
],
forceData
);
delete
[]
bornRadii
;
delete
[]
bornRadii
;
...
@@ -1016,6 +1042,15 @@ void ReferenceCalcGBVIForceKernel::executeForces(ContextImpl& context) {
...
@@ -1016,6 +1042,15 @@ void ReferenceCalcGBVIForceKernel::executeForces(ContextImpl& context) {
double
ReferenceCalcGBVIForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
double
ReferenceCalcGBVIForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
if
(
isPeriodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
RealOpenMM
periodicBoxSize
[
3
];
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
gbvi
->
getGBVIParameters
()
->
setPeriodic
(
periodicBoxSize
);
}
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
RealOpenMM
energy
=
gbvi
->
computeBornEnergy
(
bornRadii
,
posData
,
&
charges
[
0
]);
RealOpenMM
energy
=
gbvi
->
computeBornEnergy
(
bornRadii
,
posData
,
&
charges
[
0
]);
delete
[]
bornRadii
;
delete
[]
bornRadii
;
...
@@ -1069,11 +1104,6 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
...
@@ -1069,11 +1104,6 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
nonbondedMethod
=
CalcCustomGBForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedMethod
=
CalcCustomGBForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
if
(
nonbondedMethod
==
NoCutoff
)
if
(
nonbondedMethod
==
NoCutoff
)
neighborList
=
NULL
;
neighborList
=
NULL
;
else
else
...
@@ -1153,12 +1183,19 @@ void ReferenceCalcCustomGBForceKernel::executeForces(ContextImpl& context) {
...
@@ -1153,12 +1183,19 @@ void ReferenceCalcCustomGBForceKernel::executeForces(ContextImpl& context) {
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
periodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
ixn
.
setPeriodic
(
periodicBoxSize
);
}
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
}
}
if
(
periodic
)
ixn
.
setPeriodic
(
periodicBoxSize
);
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
...
@@ -1172,12 +1209,19 @@ double ReferenceCalcCustomGBForceKernel::executeEnergy(ContextImpl& context) {
...
@@ -1172,12 +1209,19 @@ double ReferenceCalcCustomGBForceKernel::executeEnergy(ContextImpl& context) {
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
RealOpenMM
periodicBoxSize
[
3
];
if
(
periodic
)
{
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
ixn
.
setPeriodic
(
periodicBoxSize
);
}
if
(
nonbondedMethod
!=
NoCutoff
)
{
if
(
nonbondedMethod
!=
NoCutoff
)
{
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
exclusions
,
periodic
?
periodicBoxSize
:
NULL
,
nonbondedCutoff
,
0.0
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
ixn
.
setUseCutoff
(
nonbondedCutoff
,
*
neighborList
);
}
}
if
(
periodic
)
ixn
.
setPeriodic
(
periodicBoxSize
);
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
...
@@ -1303,11 +1347,6 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
...
@@ -1303,11 +1347,6 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
}
}
NonbondedMethod
nonbondedMethod
=
CalcCustomHbondForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
NonbondedMethod
nonbondedMethod
=
CalcCustomHbondForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
nonbondedCutoff
=
(
RealOpenMM
)
force
.
getCutoffDistance
();
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
// Create custom functions for the tabulated functions.
// Create custom functions for the tabulated functions.
...
@@ -1336,11 +1375,9 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
...
@@ -1336,11 +1375,9 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
ixn
=
new
ReferenceCustomHbondIxn
(
donorParticles
,
acceptorParticles
,
energyExpression
,
donorParameterNames
,
acceptorParameterNames
,
distances
,
angles
,
dihedrals
);
ixn
=
new
ReferenceCustomHbondIxn
(
donorParticles
,
acceptorParticles
,
energyExpression
,
donorParameterNames
,
acceptorParameterNames
,
distances
,
angles
,
dihedrals
);
bool
p
eriodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
isP
eriodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
if
(
nonbondedMethod
!=
NoCutoff
)
if
(
nonbondedMethod
!=
NoCutoff
)
ixn
->
setUseCutoff
(
nonbondedCutoff
);
ixn
->
setUseCutoff
(
nonbondedCutoff
);
if
(
periodic
)
ixn
->
setPeriodic
(
periodicBoxSize
);
// Delete the custom functions.
// Delete the custom functions.
...
@@ -1351,6 +1388,15 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
...
@@ -1351,6 +1388,15 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
void
ReferenceCalcCustomHbondForceKernel
::
executeForces
(
ContextImpl
&
context
)
{
void
ReferenceCalcCustomHbondForceKernel
::
executeForces
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
if
(
isPeriodic
)
{
RealOpenMM
periodicBoxSize
[
3
];
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
ixn
->
setPeriodic
(
periodicBoxSize
);
}
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
...
@@ -1360,6 +1406,15 @@ void ReferenceCalcCustomHbondForceKernel::executeForces(ContextImpl& context) {
...
@@ -1360,6 +1406,15 @@ void ReferenceCalcCustomHbondForceKernel::executeForces(ContextImpl& context) {
double
ReferenceCalcCustomHbondForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
double
ReferenceCalcCustomHbondForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
allocateRealArray
(
numParticles
,
3
);
RealOpenMM
**
forceData
=
allocateRealArray
(
numParticles
,
3
);
if
(
isPeriodic
)
{
RealOpenMM
periodicBoxSize
[
3
];
Vec3
boxVectors
[
3
];
context
.
getOwner
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
[
0
]
=
(
RealOpenMM
)
boxVectors
[
0
][
0
];
periodicBoxSize
[
1
]
=
(
RealOpenMM
)
boxVectors
[
1
][
1
];
periodicBoxSize
[
2
]
=
(
RealOpenMM
)
boxVectors
[
2
][
2
];
ixn
->
setPeriodic
(
periodicBoxSize
);
}
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
...
...
platforms/reference/src/ReferenceKernels.h
View file @
bcc6216d
...
@@ -435,7 +435,7 @@ private:
...
@@ -435,7 +435,7 @@ private:
int
numParticles
,
num14
;
int
numParticles
,
num14
;
int
**
exclusionArray
,
**
bonded14IndexArray
;
int
**
exclusionArray
,
**
bonded14IndexArray
;
RealOpenMM
**
particleParamArray
,
**
bonded14ParamArray
;
RealOpenMM
**
particleParamArray
,
**
bonded14ParamArray
;
RealOpenMM
nonbondedCutoff
,
periodicBoxSize
[
3
],
rfDielectric
,
ewaldAlpha
;
RealOpenMM
nonbondedCutoff
,
rfDielectric
,
ewaldAlpha
;
int
kmax
[
3
],
gridSize
[
3
];
int
kmax
[
3
],
gridSize
[
3
];
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
NonbondedMethod
nonbondedMethod
;
NonbondedMethod
nonbondedMethod
;
...
@@ -513,6 +513,7 @@ public:
...
@@ -513,6 +513,7 @@ public:
private:
private:
CpuObc
*
obc
;
CpuObc
*
obc
;
std
::
vector
<
RealOpenMM
>
charges
;
std
::
vector
<
RealOpenMM
>
charges
;
bool
isPeriodic
;
};
};
/**
/**
...
@@ -547,6 +548,7 @@ public:
...
@@ -547,6 +548,7 @@ public:
private:
private:
CpuGBVI
*
gbvi
;
CpuGBVI
*
gbvi
;
std
::
vector
<
RealOpenMM
>
charges
;
std
::
vector
<
RealOpenMM
>
charges
;
bool
isPeriodic
;
};
};
/**
/**
...
@@ -579,8 +581,9 @@ public:
...
@@ -579,8 +581,9 @@ public:
double
executeEnergy
(
ContextImpl
&
context
);
double
executeEnergy
(
ContextImpl
&
context
);
private:
private:
int
numParticles
;
int
numParticles
;
bool
isPeriodic
;
RealOpenMM
**
particleParamArray
;
RealOpenMM
**
particleParamArray
;
RealOpenMM
nonbondedCutoff
,
periodicBoxSize
[
3
]
;
RealOpenMM
nonbondedCutoff
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
string
>
particleParameterNames
,
globalParameterNames
,
valueNames
;
std
::
vector
<
std
::
string
>
particleParameterNames
,
globalParameterNames
,
valueNames
;
std
::
vector
<
Lepton
::
ExpressionProgram
>
valueExpressions
;
std
::
vector
<
Lepton
::
ExpressionProgram
>
valueExpressions
;
...
@@ -661,9 +664,10 @@ public:
...
@@ -661,9 +664,10 @@ public:
double
executeEnergy
(
ContextImpl
&
context
);
double
executeEnergy
(
ContextImpl
&
context
);
private:
private:
int
numDonors
,
numAcceptors
,
numParticles
;
int
numDonors
,
numAcceptors
,
numParticles
;
bool
isPeriodic
;
int
**
exclusionArray
;
int
**
exclusionArray
;
RealOpenMM
**
donorParamArray
,
**
acceptorParamArray
;
RealOpenMM
**
donorParamArray
,
**
acceptorParamArray
;
RealOpenMM
nonbondedCutoff
,
periodicBoxSize
[
3
]
;
RealOpenMM
nonbondedCutoff
;
ReferenceCustomHbondIxn
*
ixn
;
ReferenceCustomHbondIxn
*
ixn
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
...
...
platforms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
View file @
bcc6216d
...
@@ -123,7 +123,6 @@ ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){
...
@@ -123,7 +123,6 @@ ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){
void
ReferenceCustomGBIxn
::
setPeriodic
(
RealOpenMM
*
boxSize
)
{
void
ReferenceCustomGBIxn
::
setPeriodic
(
RealOpenMM
*
boxSize
)
{
assert
(
cutoff
);
assert
(
boxSize
[
0
]
>=
2.0
*
cutoffDistance
);
assert
(
boxSize
[
0
]
>=
2.0
*
cutoffDistance
);
assert
(
boxSize
[
1
]
>=
2.0
*
cutoffDistance
);
assert
(
boxSize
[
1
]
>=
2.0
*
cutoffDistance
);
assert
(
boxSize
[
2
]
>=
2.0
*
cutoffDistance
);
assert
(
boxSize
[
2
]
>=
2.0
*
cutoffDistance
);
...
...
platforms/reference/tests/TestReferenceCustomGBForce.cpp
View file @
bcc6216d
...
@@ -66,8 +66,8 @@ void testOBC(GBSAOBCForce::NonbondedMethod obcMethod, CustomGBForce::NonbondedMe
...
@@ -66,8 +66,8 @@ void testOBC(GBSAOBCForce::NonbondedMethod obcMethod, CustomGBForce::NonbondedMe
standardSystem
.
addParticle
(
1.0
);
standardSystem
.
addParticle
(
1.0
);
customSystem
.
addParticle
(
1.0
);
customSystem
.
addParticle
(
1.0
);
}
}
standardSystem
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
standardSystem
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
customSystem
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
customSystem
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
GBSAOBCForce
*
obc
=
new
GBSAOBCForce
();
GBSAOBCForce
*
obc
=
new
GBSAOBCForce
();
CustomGBForce
*
custom
=
new
CustomGBForce
();
CustomGBForce
*
custom
=
new
CustomGBForce
();
obc
->
setCutoffDistance
(
2.0
);
obc
->
setCutoffDistance
(
2.0
);
...
@@ -747,8 +747,8 @@ void testGBVI(GBVIForce::NonbondedMethod gbviMethod, CustomGBForce::NonbondedMet
...
@@ -747,8 +747,8 @@ void testGBVI(GBVIForce::NonbondedMethod gbviMethod, CustomGBForce::NonbondedMet
standardSystem
.
addParticle
(
1.0
);
standardSystem
.
addParticle
(
1.0
);
customGbviSystem
.
addParticle
(
1.0
);
customGbviSystem
.
addParticle
(
1.0
);
}
}
standardSystem
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
standardSystem
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
customGbviSystem
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
customGbviSystem
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0.0
,
0.0
),
Vec3
(
0.0
,
boxSize
,
0.0
),
Vec3
(
0.0
,
0.0
,
boxSize
));
gbvi
->
setCutoffDistance
(
2.0
);
gbvi
->
setCutoffDistance
(
2.0
);
// create customGbviForce GBVI force
// create customGbviForce GBVI force
...
...
platforms/reference/tests/TestReferenceCustomNonbondedForce.cpp
View file @
bcc6216d
...
@@ -187,7 +187,7 @@ void testPeriodic() {
...
@@ -187,7 +187,7 @@ void testPeriodic() {
forceField
->
addParticle
(
vector
<
double
>
());
forceField
->
addParticle
(
vector
<
double
>
());
forceField
->
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
forceField
->
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
forceField
->
setCutoffDistance
(
2.0
);
forceField
->
setCutoffDistance
(
2.0
);
system
.
setPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
addForce
(
forceField
);
system
.
addForce
(
forceField
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
vector
<
Vec3
>
positions
(
3
);
...
...
platforms/reference/tests/TestReferenceEwald.cpp
View file @
bcc6216d
...
@@ -74,7 +74,7 @@ void testEwaldExact() {
...
@@ -74,7 +74,7 @@ void testEwaldExact() {
nonbonded
->
addParticle
(
-
1.0
,
1.0
,
0.0
);
nonbonded
->
addParticle
(
-
1.0
,
1.0
,
0.0
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
...
@@ -126,7 +126,7 @@ void testEwaldPME() {
...
@@ -126,7 +126,7 @@ void testEwaldPME() {
nonbonded
->
addParticle
(
-
1.0
,
1.0
,
0.0
);
nonbonded
->
addParticle
(
-
1.0
,
1.0
,
0.0
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
...
@@ -228,7 +228,7 @@ void testEwald2Ions() {
...
@@ -228,7 +228,7 @@ void testEwald2Ions() {
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
Ewald
);
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setPeriodicBoxVectors
(
Vec3
(
6
,
0
,
0
),
Vec3
(
0
,
6
,
0
),
Vec3
(
0
,
0
,
6
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
6
,
0
,
0
),
Vec3
(
0
,
6
,
0
),
Vec3
(
0
,
0
,
6
));
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
...
@@ -264,7 +264,7 @@ void testWaterSystem() {
...
@@ -264,7 +264,7 @@ void testWaterSystem() {
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
const
double
cutoff
=
0.8
;
const
double
cutoff
=
0.8
;
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
nonbonded
->
setEwaldErrorTolerance
(
EWALD_TOL
);
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
...
@@ -308,7 +308,7 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
...
@@ -308,7 +308,7 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
const
int
numParticles
=
51
;
const
int
numParticles
=
51
;
const
double
boxWidth
=
5.0
;
const
double
boxWidth
=
5.0
;
System
system
;
System
system
;
system
.
setPeriodicBoxVectors
(
Vec3
(
boxWidth
,
0
,
0
),
Vec3
(
0
,
boxWidth
,
0
),
Vec3
(
0
,
0
,
boxWidth
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxWidth
,
0
,
0
),
Vec3
(
0
,
boxWidth
,
0
),
Vec3
(
0
,
0
,
boxWidth
));
NonbondedForce
*
force
=
new
NonbondedForce
();
NonbondedForce
*
force
=
new
NonbondedForce
();
system
.
addForce
(
force
);
system
.
addForce
(
force
);
vector
<
Vec3
>
positions
(
numParticles
);
vector
<
Vec3
>
positions
(
numParticles
);
...
...
platforms/reference/tests/TestReferenceGBSAOBCForce.cpp
View file @
bcc6216d
...
@@ -87,7 +87,7 @@ void testCutoffAndPeriodic() {
...
@@ -87,7 +87,7 @@ void testCutoffAndPeriodic() {
const
double
boxSize
=
10.0
;
const
double
boxSize
=
10.0
;
nonbonded
->
setCutoffDistance
(
cutoffDistance
);
nonbonded
->
setCutoffDistance
(
cutoffDistance
);
gbsa
->
setCutoffDistance
(
cutoffDistance
);
gbsa
->
setCutoffDistance
(
cutoffDistance
);
system
.
setPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
addForce
(
gbsa
);
system
.
addForce
(
gbsa
);
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
vector
<
Vec3
>
positions
(
2
);
vector
<
Vec3
>
positions
(
2
);
...
...
platforms/reference/tests/TestReferenceNonbondedForce.cpp
View file @
bcc6216d
...
@@ -333,7 +333,7 @@ void testPeriodic() {
...
@@ -333,7 +333,7 @@ void testPeriodic() {
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
nonbonded
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
set
Default
PeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
4
,
0
),
Vec3
(
0
,
0
,
4
));
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
3
);
vector
<
Vec3
>
positions
(
3
);
...
...
Prev
1
2
3
Next
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