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
c24c619e
Unverified
Commit
c24c619e
authored
Nov 06, 2025
by
Peter Eastman
Committed by
GitHub
Nov 06, 2025
Browse files
Code cleanup (#5127)
parent
b1a5324c
Changes
80
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
42 additions
and
139 deletions
+42
-139
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaVdwForceImpl.h
...ba/openmmapi/include/openmm/internal/AmoebaVdwForceImpl.h
+1
-3
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaWcaDispersionForceImpl.h
...pi/include/openmm/internal/AmoebaWcaDispersionForceImpl.h
+1
-1
plugins/amoeba/openmmapi/include/openmm/internal/HippoNonbondedForceImpl.h
...enmmapi/include/openmm/internal/HippoNonbondedForceImpl.h
+1
-1
plugins/amoeba/openmmapi/src/AmoebaGeneralizedKirkwoodForceImpl.cpp
...oeba/openmmapi/src/AmoebaGeneralizedKirkwoodForceImpl.cpp
+1
-3
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
+1
-3
plugins/amoeba/openmmapi/src/AmoebaTorsionTorsionForceImpl.cpp
...ns/amoeba/openmmapi/src/AmoebaTorsionTorsionForceImpl.cpp
+1
-3
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
+7
-15
plugins/amoeba/openmmapi/src/AmoebaWcaDispersionForceImpl.cpp
...ins/amoeba/openmmapi/src/AmoebaWcaDispersionForceImpl.cpp
+1
-3
plugins/amoeba/openmmapi/src/HippoNonbondedForceImpl.cpp
plugins/amoeba/openmmapi/src/HippoNonbondedForceImpl.cpp
+1
-3
plugins/drude/openmmapi/include/openmm/internal/DrudeForceImpl.h
.../drude/openmmapi/include/openmm/internal/DrudeForceImpl.h
+1
-1
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
+1
-3
plugins/drude/openmmapi/src/DrudeLangevinIntegrator.cpp
plugins/drude/openmmapi/src/DrudeLangevinIntegrator.cpp
+1
-3
plugins/drude/openmmapi/src/DrudeSCFIntegrator.cpp
plugins/drude/openmmapi/src/DrudeSCFIntegrator.cpp
+1
-3
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
+1
-3
plugins/rpmd/openmmapi/src/RPMDMonteCarloBarostatImpl.cpp
plugins/rpmd/openmmapi/src/RPMDMonteCarloBarostatImpl.cpp
+2
-6
tests/TestCustomCentroidBondForce.h
tests/TestCustomCentroidBondForce.h
+14
-59
tests/TestCustomCompoundBondForce.h
tests/TestCustomCompoundBondForce.h
+1
-4
tests/TestCustomIntegrator.h
tests/TestCustomIntegrator.h
+1
-3
tests/TestCustomManyParticleForce.h
tests/TestCustomManyParticleForce.h
+2
-9
tests/TestNonbondedForce.h
tests/TestNonbondedForce.h
+2
-10
No files found.
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaVdwForceImpl.h
View file @
c24c619e
...
@@ -58,9 +58,7 @@ public:
...
@@ -58,9 +58,7 @@ public:
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
parameters
;
return
{{
AmoebaVdwForce
::
Lambda
(),
1.0
}};
parameters
[
AmoebaVdwForce
::
Lambda
()]
=
1.0
;
return
parameters
;
}
}
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
string
>
getKernelNames
();
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaWcaDispersionForceImpl.h
View file @
c24c619e
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
return
std
::
map
<
std
::
string
,
double
>
()
;
// This force field doesn't define any parameters.
return
{}
;
// This force field doesn't define any parameters.
}
}
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
string
>
getKernelNames
();
...
...
plugins/amoeba/openmmapi/include/openmm/internal/HippoNonbondedForceImpl.h
View file @
c24c619e
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
return
std
::
map
<
std
::
string
,
double
>
()
;
// This force doesn't define any parameters.
return
{}
;
// This force doesn't define any parameters.
}
}
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
string
>
getKernelNames
();
void
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
void
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
...
...
plugins/amoeba/openmmapi/src/AmoebaGeneralizedKirkwoodForceImpl.cpp
View file @
c24c619e
...
@@ -60,9 +60,7 @@ double AmoebaGeneralizedKirkwoodForceImpl::calcForcesAndEnergy(ContextImpl& cont
...
@@ -60,9 +60,7 @@ double AmoebaGeneralizedKirkwoodForceImpl::calcForcesAndEnergy(ContextImpl& cont
}
}
std
::
vector
<
std
::
string
>
AmoebaGeneralizedKirkwoodForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
AmoebaGeneralizedKirkwoodForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcAmoebaGeneralizedKirkwoodForceKernel
::
Name
()};
names
.
push_back
(
CalcAmoebaGeneralizedKirkwoodForceKernel
::
Name
());
return
names
;
}
}
void
AmoebaGeneralizedKirkwoodForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
void
AmoebaGeneralizedKirkwoodForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
View file @
c24c619e
...
@@ -150,9 +150,7 @@ double AmoebaMultipoleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool
...
@@ -150,9 +150,7 @@ double AmoebaMultipoleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool
}
}
std
::
vector
<
std
::
string
>
AmoebaMultipoleForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
AmoebaMultipoleForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcAmoebaMultipoleForceKernel
::
Name
()};
names
.
push_back
(
CalcAmoebaMultipoleForceKernel
::
Name
());
return
names
;
}
}
const
int
*
AmoebaMultipoleForceImpl
::
getCovalentDegrees
()
{
const
int
*
AmoebaMultipoleForceImpl
::
getCovalentDegrees
()
{
...
...
plugins/amoeba/openmmapi/src/AmoebaTorsionTorsionForceImpl.cpp
View file @
c24c619e
...
@@ -152,8 +152,6 @@ void AmoebaTorsionTorsionForceImpl::reorderGrid(const TorsionTorsionGrid& grid,
...
@@ -152,8 +152,6 @@ void AmoebaTorsionTorsionForceImpl::reorderGrid(const TorsionTorsionGrid& grid,
}
}
std
::
vector
<
std
::
string
>
AmoebaTorsionTorsionForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
AmoebaTorsionTorsionForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcAmoebaTorsionTorsionForceKernel
::
Name
()};
names
.
push_back
(
CalcAmoebaTorsionTorsionForceKernel
::
Name
());
return
names
;
}
}
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
View file @
c24c619e
...
@@ -245,12 +245,6 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
...
@@ -245,12 +245,6 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
// Compute the VdW tapering coefficients. Mostly copied from amoebaCudaGpu.cpp.
// Compute the VdW tapering coefficients. Mostly copied from amoebaCudaGpu.cpp.
double
cutoff
=
force
.
getCutoffDistance
();
double
cutoff
=
force
.
getCutoffDistance
();
double
vdwTaper
=
0.90
;
// vdwTaper is a scaling factor, it is not a distance.
double
vdwTaper
=
0.90
;
// vdwTaper is a scaling factor, it is not a distance.
double
c0
=
0.0
;
double
c1
=
0.0
;
double
c2
=
0.0
;
double
c3
=
0.0
;
double
c4
=
0.0
;
double
c5
=
0.0
;
double
vdwCut
=
cutoff
;
double
vdwCut
=
cutoff
;
double
vdwTaperCut
=
vdwTaper
*
cutoff
;
double
vdwTaperCut
=
vdwTaper
*
cutoff
;
...
@@ -275,12 +269,12 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
...
@@ -275,12 +269,12 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
double
denom2
=
denom
*
denom
;
double
denom2
=
denom
*
denom
;
denom
=
denom
*
denom2
*
denom2
;
denom
=
denom
*
denom2
*
denom2
;
c0
=
vdwCut
*
vdwCut2
*
(
vdwCut2
-
5.0
*
vdwCut
*
vdwTaperCut
+
10.0
*
vdwTaperCut2
)
*
denom
;
double
c0
=
vdwCut
*
vdwCut2
*
(
vdwCut2
-
5.0
*
vdwCut
*
vdwTaperCut
+
10.0
*
vdwTaperCut2
)
*
denom
;
c1
=
-
30.0
*
vdwCut2
*
vdwTaperCut2
*
denom
;
double
c1
=
-
30.0
*
vdwCut2
*
vdwTaperCut2
*
denom
;
c2
=
30.0
*
(
vdwCut2
*
vdwTaperCut
+
vdwCut
*
vdwTaperCut2
)
*
denom
;
double
c2
=
30.0
*
(
vdwCut2
*
vdwTaperCut
+
vdwCut
*
vdwTaperCut2
)
*
denom
;
c3
=
-
10.0
*
(
vdwCut2
+
4.0
*
vdwCut
*
vdwTaperCut
+
vdwTaperCut2
)
*
denom
;
double
c3
=
-
10.0
*
(
vdwCut2
+
4.0
*
vdwCut
*
vdwTaperCut
+
vdwTaperCut2
)
*
denom
;
c4
=
15.0
*
(
vdwCut
+
vdwTaperCut
)
*
denom
;
double
c4
=
15.0
*
(
vdwCut
+
vdwTaperCut
)
*
denom
;
c5
=
-
6.0
*
denom
;
double
c5
=
-
6.0
*
denom
;
// Loop over all pairs of types to compute the coefficient.
// Loop over all pairs of types to compute the coefficient.
// Copied over from TINKER - numerical integration.
// Copied over from TINKER - numerical integration.
...
@@ -347,9 +341,7 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
...
@@ -347,9 +341,7 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
}
}
std
::
vector
<
std
::
string
>
AmoebaVdwForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
AmoebaVdwForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcAmoebaVdwForceKernel
::
Name
()};
names
.
push_back
(
CalcAmoebaVdwForceKernel
::
Name
());
return
names
;
}
}
void
AmoebaVdwForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
void
AmoebaVdwForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
...
...
plugins/amoeba/openmmapi/src/AmoebaWcaDispersionForceImpl.cpp
View file @
c24c619e
...
@@ -133,9 +133,7 @@ double AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy(const Amoeb
...
@@ -133,9 +133,7 @@ double AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy(const Amoeb
}
}
std
::
vector
<
std
::
string
>
AmoebaWcaDispersionForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
AmoebaWcaDispersionForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcAmoebaWcaDispersionForceKernel
::
Name
()};
names
.
push_back
(
CalcAmoebaWcaDispersionForceKernel
::
Name
());
return
names
;
}
}
void
AmoebaWcaDispersionForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
void
AmoebaWcaDispersionForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
...
...
plugins/amoeba/openmmapi/src/HippoNonbondedForceImpl.cpp
View file @
c24c619e
...
@@ -140,9 +140,7 @@ double HippoNonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool i
...
@@ -140,9 +140,7 @@ double HippoNonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool i
}
}
std
::
vector
<
std
::
string
>
HippoNonbondedForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
HippoNonbondedForceImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
CalcHippoNonbondedForceKernel
::
Name
()};
names
.
push_back
(
CalcHippoNonbondedForceKernel
::
Name
());
return
names
;
}
}
void
HippoNonbondedForceImpl
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
void
HippoNonbondedForceImpl
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
...
...
plugins/drude/openmmapi/include/openmm/internal/DrudeForceImpl.h
View file @
c24c619e
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
()
{
return
std
::
map
<
std
::
string
,
double
>
()
;
// This force field doesn't define any parameters.
return
{}
;
// This force field doesn't define any parameters.
}
}
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
string
>
getKernelNames
();
void
updateParametersInContext
(
ContextImpl
&
context
);
void
updateParametersInContext
(
ContextImpl
&
context
);
...
...
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
View file @
c24c619e
...
@@ -120,9 +120,7 @@ double DrudeForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeFor
...
@@ -120,9 +120,7 @@ double DrudeForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeFor
}
}
vector
<
string
>
DrudeForceImpl
::
getKernelNames
()
{
vector
<
string
>
DrudeForceImpl
::
getKernelNames
()
{
vector
<
string
>
names
;
return
{
CalcDrudeForceKernel
::
Name
()};
names
.
push_back
(
CalcDrudeForceKernel
::
Name
());
return
names
;
}
}
void
DrudeForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
void
DrudeForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
...
...
plugins/drude/openmmapi/src/DrudeLangevinIntegrator.cpp
View file @
c24c619e
...
@@ -87,9 +87,7 @@ void DrudeLangevinIntegrator::cleanup() {
...
@@ -87,9 +87,7 @@ void DrudeLangevinIntegrator::cleanup() {
}
}
vector
<
string
>
DrudeLangevinIntegrator
::
getKernelNames
()
{
vector
<
string
>
DrudeLangevinIntegrator
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
IntegrateDrudeLangevinStepKernel
::
Name
()};
names
.
push_back
(
IntegrateDrudeLangevinStepKernel
::
Name
());
return
names
;
}
}
double
DrudeLangevinIntegrator
::
computeKineticEnergy
()
{
double
DrudeLangevinIntegrator
::
computeKineticEnergy
()
{
...
...
plugins/drude/openmmapi/src/DrudeSCFIntegrator.cpp
View file @
c24c619e
...
@@ -73,9 +73,7 @@ void DrudeSCFIntegrator::cleanup() {
...
@@ -73,9 +73,7 @@ void DrudeSCFIntegrator::cleanup() {
}
}
vector
<
string
>
DrudeSCFIntegrator
::
getKernelNames
()
{
vector
<
string
>
DrudeSCFIntegrator
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
IntegrateDrudeSCFStepKernel
::
Name
()};
names
.
push_back
(
IntegrateDrudeSCFStepKernel
::
Name
());
return
names
;
}
}
double
DrudeSCFIntegrator
::
computeKineticEnergy
()
{
double
DrudeSCFIntegrator
::
computeKineticEnergy
()
{
...
...
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
View file @
c24c619e
...
@@ -78,9 +78,7 @@ void RPMDIntegrator::stateChanged(State::DataType changed) {
...
@@ -78,9 +78,7 @@ void RPMDIntegrator::stateChanged(State::DataType changed) {
}
}
vector
<
string
>
RPMDIntegrator
::
getKernelNames
()
{
vector
<
string
>
RPMDIntegrator
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
IntegrateRPMDStepKernel
::
Name
()};
names
.
push_back
(
IntegrateRPMDStepKernel
::
Name
());
return
names
;
}
}
void
RPMDIntegrator
::
setPositions
(
int
copy
,
const
vector
<
Vec3
>&
positions
)
{
void
RPMDIntegrator
::
setPositions
(
int
copy
,
const
vector
<
Vec3
>&
positions
)
{
...
...
plugins/rpmd/openmmapi/src/RPMDMonteCarloBarostatImpl.cpp
View file @
c24c619e
...
@@ -155,13 +155,9 @@ void RPMDMonteCarloBarostatImpl::updateRPMDState(ContextImpl& context) {
...
@@ -155,13 +155,9 @@ void RPMDMonteCarloBarostatImpl::updateRPMDState(ContextImpl& context) {
}
}
std
::
map
<
std
::
string
,
double
>
RPMDMonteCarloBarostatImpl
::
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
RPMDMonteCarloBarostatImpl
::
getDefaultParameters
()
{
std
::
map
<
std
::
string
,
double
>
parameters
;
return
{{
RPMDMonteCarloBarostat
::
Pressure
(),
getOwner
().
getDefaultPressure
()}};
parameters
[
RPMDMonteCarloBarostat
::
Pressure
()]
=
getOwner
().
getDefaultPressure
();
return
parameters
;
}
}
std
::
vector
<
std
::
string
>
RPMDMonteCarloBarostatImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
RPMDMonteCarloBarostatImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
return
{
ApplyMonteCarloBarostatKernel
::
Name
()};
names
.
push_back
(
ApplyMonteCarloBarostatKernel
::
Name
());
return
names
;
}
}
tests/TestCustomCentroidBondForce.h
View file @
c24c619e
...
@@ -52,21 +52,9 @@ void testHarmonicBond() {
...
@@ -52,21 +52,9 @@ void testHarmonicBond() {
system
.
addParticle
(
5.0
);
system
.
addParticle
(
5.0
);
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
"k*distance(g1,g2)^2"
);
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
"k*distance(g1,g2)^2"
);
force
->
addPerBondParameter
(
"k"
);
force
->
addPerBondParameter
(
"k"
);
vector
<
int
>
particles1
;
force
->
addGroup
({
0
,
1
});
particles1
.
push_back
(
0
);
force
->
addGroup
({
2
,
3
,
4
});
particles1
.
push_back
(
1
);
force
->
addBond
({
0
,
1
},
{
1.0
});
vector
<
int
>
particles2
;
particles2
.
push_back
(
2
);
particles2
.
push_back
(
3
);
particles2
.
push_back
(
4
);
force
->
addGroup
(
particles1
);
force
->
addGroup
(
particles2
);
vector
<
int
>
groups
;
groups
.
push_back
(
0
);
groups
.
push_back
(
1
);
vector
<
double
>
parameters
;
parameters
.
push_back
(
1.0
);
force
->
addBond
(
groups
,
parameters
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
ASSERT
(
!
system
.
usesPeriodicBoundaryConditions
());
...
@@ -97,8 +85,7 @@ void testHarmonicBond() {
...
@@ -97,8 +85,7 @@ void testHarmonicBond() {
// Update the per-bond parameter and see if the results change.
// Update the per-bond parameter and see if the results change.
parameters
[
0
]
=
2.0
;
force
->
setBondParameters
(
0
,
{
0
,
1
},
{
2.0
});
force
->
setBondParameters
(
0
,
groups
,
parameters
);
force
->
updateParametersInContext
(
context
);
force
->
updateParametersInContext
(
context
);
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
2
*
2.5
*
2.5
,
state
.
getPotentialEnergy
(),
TOL
);
ASSERT_EQUAL_TOL
(
2
*
2.5
*
2.5
,
state
.
getPotentialEnergy
(),
TOL
);
...
@@ -236,11 +223,7 @@ void testCustomWeights() {
...
@@ -236,11 +223,7 @@ void testCustomWeights() {
weights
[
0
]
=
2.0
;
weights
[
0
]
=
2.0
;
weights
[
1
]
=
1.0
;
weights
[
1
]
=
1.0
;
force
->
addGroup
(
particles
,
weights
);
force
->
addGroup
(
particles
,
weights
);
vector
<
int
>
groups
;
force
->
addBond
({
0
,
1
});
groups
.
push_back
(
0
);
groups
.
push_back
(
1
);
vector
<
double
>
parameters
;
force
->
addBond
(
groups
,
parameters
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
// The center of mass of group 0 is (0, 1, 0).
// The center of mass of group 0 is (0, 1, 0).
...
@@ -272,14 +255,9 @@ void testIllegalVariable() {
...
@@ -272,14 +255,9 @@ void testIllegalVariable() {
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
"1+none"
);
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
"1+none"
);
vector
<
int
>
particles
;
force
->
addGroup
({
0
});
particles
.
push_back
(
0
);
force
->
addGroup
({
0
});
force
->
addGroup
(
particles
);
force
->
addBond
({
0
,
1
});
force
->
addGroup
(
particles
);
vector
<
int
>
groups
;
groups
.
push_back
(
0
);
groups
.
push_back
(
1
);
force
->
addBond
(
groups
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
VerletIntegrator
integrator
(
0.001
);
VerletIntegrator
integrator
(
0.001
);
bool
threwException
=
false
;
bool
threwException
=
false
;
...
@@ -309,21 +287,9 @@ void testPeriodic(bool byGroups) {
...
@@ -309,21 +287,9 @@ void testPeriodic(bool byGroups) {
expression
=
"k*pointdistance(x1,y1,z1,x2,y2,z2)^2"
;
expression
=
"k*pointdistance(x1,y1,z1,x2,y2,z2)^2"
;
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
expression
);
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
2
,
expression
);
force
->
addPerBondParameter
(
"k"
);
force
->
addPerBondParameter
(
"k"
);
vector
<
int
>
particles1
;
force
->
addGroup
({
0
,
1
});
particles1
.
push_back
(
0
);
force
->
addGroup
({
2
,
3
,
4
});
particles1
.
push_back
(
1
);
force
->
addBond
({
0
,
1
},
{
1.0
});
vector
<
int
>
particles2
;
particles2
.
push_back
(
2
);
particles2
.
push_back
(
3
);
particles2
.
push_back
(
4
);
force
->
addGroup
(
particles1
);
force
->
addGroup
(
particles2
);
vector
<
int
>
groups
;
groups
.
push_back
(
0
);
groups
.
push_back
(
1
);
vector
<
double
>
parameters
;
parameters
.
push_back
(
1.0
);
force
->
addBond
(
groups
,
parameters
);
force
->
setUsesPeriodicBoundaryConditions
(
true
);
force
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
...
@@ -365,20 +331,9 @@ void testEnergyParameterDerivatives() {
...
@@ -365,20 +331,9 @@ void testEnergyParameterDerivatives() {
force
->
addGlobalParameter
(
"k"
,
0.0
);
force
->
addGlobalParameter
(
"k"
,
0.0
);
force
->
addEnergyParameterDerivative
(
"r0"
);
force
->
addEnergyParameterDerivative
(
"r0"
);
force
->
addEnergyParameterDerivative
(
"k"
);
force
->
addEnergyParameterDerivative
(
"k"
);
vector
<
int
>
particles1
;
force
->
addGroup
({
0
,
1
});
particles1
.
push_back
(
0
);
force
->
addGroup
({
2
,
3
,
4
});
particles1
.
push_back
(
1
);
force
->
addBond
({
0
,
1
});
vector
<
int
>
particles2
;
particles2
.
push_back
(
2
);
particles2
.
push_back
(
3
);
particles2
.
push_back
(
4
);
force
->
addGroup
(
particles1
);
force
->
addGroup
(
particles2
);
vector
<
int
>
groups
;
groups
.
push_back
(
0
);
groups
.
push_back
(
1
);
vector
<
double
>
parameters
;
force
->
addBond
(
groups
,
parameters
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
// The center of mass of group 0 is (1.5, 0, 0).
// The center of mass of group 0 is (1.5, 0, 0).
...
...
tests/TestCustomCompoundBondForce.h
View file @
c24c619e
...
@@ -342,10 +342,7 @@ void testIllegalVariable() {
...
@@ -342,10 +342,7 @@ void testIllegalVariable() {
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
CustomCompoundBondForce
*
force
=
new
CustomCompoundBondForce
(
2
,
"1+none"
);
CustomCompoundBondForce
*
force
=
new
CustomCompoundBondForce
(
2
,
"1+none"
);
vector
<
int
>
particles
;
force
->
addBond
({
0
,
1
});
particles
.
push_back
(
0
);
particles
.
push_back
(
1
);
force
->
addBond
(
particles
);
system
.
addForce
(
force
);
system
.
addForce
(
force
);
VerletIntegrator
integrator
(
0.001
);
VerletIntegrator
integrator
(
0.001
);
bool
threwException
=
false
;
bool
threwException
=
false
;
...
...
tests/TestCustomIntegrator.h
View file @
c24c619e
...
@@ -930,9 +930,7 @@ void testTabulatedFunction() {
...
@@ -930,9 +930,7 @@ void testTabulatedFunction() {
integrator
.
addPerDofVariable
(
"dof"
,
0.0
);
integrator
.
addPerDofVariable
(
"dof"
,
0.0
);
integrator
.
addComputeGlobal
(
"global"
,
"fn(global)"
);
integrator
.
addComputeGlobal
(
"global"
,
"fn(global)"
);
integrator
.
addComputePerDof
(
"dof"
,
"fn(x)"
);
integrator
.
addComputePerDof
(
"dof"
,
"fn(x)"
);
vector
<
double
>
table
;
vector
<
double
>
table
=
{
10.0
,
20.0
};
table
.
push_back
(
10.0
);
table
.
push_back
(
20.0
);
integrator
.
addTabulatedFunction
(
"fn"
,
new
Continuous1DFunction
(
table
,
1.0
,
2.0
));
integrator
.
addTabulatedFunction
(
"fn"
,
new
Continuous1DFunction
(
table
,
1.0
,
2.0
));
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
1
);
vector
<
Vec3
>
positions
(
1
);
...
...
tests/TestCustomManyParticleForce.h
View file @
c24c619e
...
@@ -358,12 +358,7 @@ void testAllTerms() {
...
@@ -358,12 +358,7 @@ void testAllTerms() {
CustomCompoundBondForce
*
force2
=
new
CustomCompoundBondForce
(
4
,
CustomCompoundBondForce
*
force2
=
new
CustomCompoundBondForce
(
4
,
"distance(p1,p2)+angle(p1,p3,p4)+dihedral(p1,p4,p2,p3)+x1+y3+z4"
);
"distance(p1,p2)+angle(p1,p3,p4)+dihedral(p1,p4,p2,p3)+x1+y3+z4"
);
system2
.
addForce
(
force2
);
system2
.
addForce
(
force2
);
vector
<
int
>
particles
;
force2
->
addBond
({
0
,
1
,
2
,
3
},
params
);
particles
.
push_back
(
0
);
particles
.
push_back
(
1
);
particles
.
push_back
(
2
);
particles
.
push_back
(
3
);
force2
->
addBond
(
particles
,
params
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
system2
.
addParticle
(
1.0
);
system2
.
addParticle
(
1.0
);
...
@@ -462,9 +457,7 @@ void testTabulatedFunctions() {
...
@@ -462,9 +457,7 @@ void testTabulatedFunctions() {
// Create two tabulated functions.
// Create two tabulated functions.
vector
<
double
>
values
;
vector
<
double
>
values
=
{
0.0
,
50.0
};
values
.
push_back
(
0.0
);
values
.
push_back
(
50.0
);
Continuous1DFunction
*
f1
=
new
Continuous1DFunction
(
values
,
0
,
100
);
Continuous1DFunction
*
f1
=
new
Continuous1DFunction
(
values
,
0
,
100
);
OpenMM_SFMT
::
SFMT
sfmt
;
OpenMM_SFMT
::
SFMT
sfmt
;
init_gen_rand
(
0
,
sfmt
);
init_gen_rand
(
0
,
sfmt
);
...
...
tests/TestNonbondedForce.h
View file @
c24c619e
...
@@ -102,11 +102,7 @@ void testExclusionsAnd14() {
...
@@ -102,11 +102,7 @@ void testExclusionsAnd14() {
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
nonbonded
->
addParticle
(
0
,
1.5
,
0
);
nonbonded
->
addParticle
(
0
,
1.5
,
0
);
}
}
vector
<
pair
<
int
,
int
>
>
bonds
;
vector
<
pair
<
int
,
int
>
>
bonds
=
{{
0
,
1
},
{
1
,
2
},
{
2
,
3
},
{
3
,
4
}};
bonds
.
push_back
(
pair
<
int
,
int
>
(
0
,
1
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
1
,
2
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
2
,
3
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
3
,
4
));
nonbonded
->
createExceptionsFromBonds
(
bonds
,
0.0
,
0.0
);
nonbonded
->
createExceptionsFromBonds
(
bonds
,
0.0
,
0.0
);
int
first14
,
second14
;
int
first14
,
second14
;
for
(
int
i
=
0
;
i
<
nonbonded
->
getNumExceptions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
nonbonded
->
getNumExceptions
();
i
++
)
{
...
@@ -233,11 +229,7 @@ void testCutoff14() {
...
@@ -233,11 +229,7 @@ void testCutoff14() {
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
const
double
eps
=
30.0
;
const
double
eps
=
30.0
;
nonbonded
->
setReactionFieldDielectric
(
eps
);
nonbonded
->
setReactionFieldDielectric
(
eps
);
vector
<
pair
<
int
,
int
>
>
bonds
;
vector
<
pair
<
int
,
int
>
>
bonds
=
{{
0
,
1
},
{
1
,
2
},
{
2
,
3
},
{
3
,
4
}};
bonds
.
push_back
(
pair
<
int
,
int
>
(
0
,
1
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
1
,
2
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
2
,
3
));
bonds
.
push_back
(
pair
<
int
,
int
>
(
3
,
4
));
nonbonded
->
createExceptionsFromBonds
(
bonds
,
0.0
,
0.0
);
nonbonded
->
createExceptionsFromBonds
(
bonds
,
0.0
,
0.0
);
int
first14
,
second14
;
int
first14
,
second14
;
for
(
int
i
=
0
;
i
<
nonbonded
->
getNumExceptions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
nonbonded
->
getNumExceptions
();
i
++
)
{
...
...
Prev
1
2
3
4
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