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
2a530882
Commit
2a530882
authored
Apr 22, 2008
by
Peter Eastman
Browse files
Continuing to implement ReferencePlatform (kernels for StandardMMForceField are done).
parent
012b28e6
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
176 additions
and
140 deletions
+176
-140
CMakeLists.txt
CMakeLists.txt
+1
-1
olla/include/Kernel.h
olla/include/Kernel.h
+4
-0
olla/include/Stream.h
olla/include/Stream.h
+4
-0
olla/include/kernels.h
olla/include/kernels.h
+21
-77
olla/src/Kernel.cpp
olla/src/Kernel.cpp
+4
-0
olla/src/Stream.cpp
olla/src/Stream.cpp
+4
-0
openmmapi/include/OpenMMContext.h
openmmapi/include/OpenMMContext.h
+1
-1
openmmapi/include/StandardMMForceField.h
openmmapi/include/StandardMMForceField.h
+2
-2
openmmapi/include/Vec3.h
openmmapi/include/Vec3.h
+7
-0
openmmapi/include/internal/GBSAOBCForceFieldImpl.h
openmmapi/include/internal/GBSAOBCForceFieldImpl.h
+1
-1
openmmapi/include/internal/StandardMMForceFieldImpl.h
openmmapi/include/internal/StandardMMForceFieldImpl.h
+1
-1
openmmapi/src/GBSAOBCForceFieldImpl.cpp
openmmapi/src/GBSAOBCForceFieldImpl.cpp
+5
-9
openmmapi/src/OpenMMContext.cpp
openmmapi/src/OpenMMContext.cpp
+5
-3
openmmapi/src/StandardMMForceFieldImpl.cpp
openmmapi/src/StandardMMForceFieldImpl.cpp
+8
-12
platforms/reference/src/ReferenceFloatStreamImpl.cpp
platforms/reference/src/ReferenceFloatStreamImpl.cpp
+4
-0
platforms/reference/src/ReferenceFloatStreamImpl.h
platforms/reference/src/ReferenceFloatStreamImpl.h
+1
-0
platforms/reference/src/ReferenceIntStreamImpl.cpp
platforms/reference/src/ReferenceIntStreamImpl.cpp
+4
-0
platforms/reference/src/ReferenceIntStreamImpl.h
platforms/reference/src/ReferenceIntStreamImpl.h
+1
-0
platforms/reference/src/ReferenceKernelFactory.cpp
platforms/reference/src/ReferenceKernelFactory.cpp
+4
-8
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+94
-25
No files found.
CMakeLists.txt
View file @
2a530882
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
PROJECT
(
OpenMM
)
PROJECT
(
OpenMM
)
SUBDIRS
(
tests
)
SUBDIRS
(
tests
platforms/reference/tests
)
ADD_DEFINITIONS
(
-DOPENMM_BUILDING_SHARED_LIBRARY
)
ADD_DEFINITIONS
(
-DOPENMM_BUILDING_SHARED_LIBRARY
)
...
...
olla/include/Kernel.h
View file @
2a530882
...
@@ -64,6 +64,10 @@ public:
...
@@ -64,6 +64,10 @@ public:
* Get the name of this Kernel.
* Get the name of this Kernel.
*/
*/
std
::
string
getName
()
const
;
std
::
string
getName
()
const
;
/**
* Get the object which implements this Kernel.
*/
const
KernelImpl
&
getImpl
()
const
;
/**
/**
* Get the object which implements this Kernel.
* Get the object which implements this Kernel.
*/
*/
...
...
olla/include/Stream.h
View file @
2a530882
...
@@ -113,6 +113,10 @@ public:
...
@@ -113,6 +113,10 @@ public:
* @param a pointer to the value. It is assumed to be of the correct data type for this stream.
* @param a pointer to the value. It is assumed to be of the correct data type for this stream.
*/
*/
void
fillWithValue
(
void
*
value
);
void
fillWithValue
(
void
*
value
);
/**
* Get the object which implements this Stream.
*/
const
StreamImpl
&
getImpl
()
const
;
/**
/**
* Get the object which implements this Stream.
* Get the object which implements this Stream.
*/
*/
...
...
olla/include/kernels.h
View file @
2a530882
...
@@ -41,14 +41,14 @@
...
@@ -41,14 +41,14 @@
namespace
OpenMM
{
namespace
OpenMM
{
/**
/**
* This kernel is invoked by StandardMMForceField to calculate the forces acting on the system.
* This kernel is invoked by StandardMMForceField to calculate the forces acting on the
system and the energy of the
system.
*/
*/
class
CalcStandardMMForce
s
Kernel
:
public
KernelImpl
{
class
CalcStandardMMForce
Field
Kernel
:
public
KernelImpl
{
public:
public:
static
std
::
string
Name
()
{
static
std
::
string
Name
()
{
return
"CalcStandardMMForce
s
"
;
return
"CalcStandardMMForce
Field
"
;
}
}
CalcStandardMMForce
s
Kernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
CalcStandardMMForce
Field
Kernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
}
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
...
@@ -58,84 +58,50 @@ public:
...
@@ -58,84 +58,50 @@ public:
* @param angleIndices the three atoms connected by each angle term
* @param angleIndices the three atoms connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (periodicity
, phase, k
) for each periodic torsion term
* @param periodicTorsionParameters the force parameters (
k, phase,
periodicity) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* they form a bonded 1-4 pair
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge,
van der Waals radius, van der Waals depth
) for each atom
* @param nonbondedParameters the nonbonded force parameters (charge,
sigma, epsilon
) for each atom
*/
*/
virtual
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
virtual
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
double
lj14Scale
,
double
coulomb14Scale
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
)
=
0
;
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
)
=
0
;
/**
/**
* Execute the kernel.
* Execute the kernel
to calculate the forces
.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/
*/
virtual
void
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
=
0
;
virtual
void
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
)
=
0
;
};
/**
* This kernel is invoked by StandardMMForceField to calculate the energy of the system.
*/
class
CalcStandardMMEnergyKernel
:
public
KernelImpl
{
public:
static
std
::
string
Name
()
{
return
"CalcStandardMMEnergy"
;
}
CalcStandardMMEnergyKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bondIndices the two atoms connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three atoms connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (periodicity, phase, k) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, van der Waals radius, van der Waals depth) for each atom
*/
virtual
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
)
=
0
;
/**
/**
* Execute the kernel.
* Execute the kernel
to calculate the energy
.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @return the potential energy due to the StandardMMForceField
* @return the potential energy due to the StandardMMForceField
*/
*/
virtual
double
execute
(
const
Stream
&
positions
)
=
0
;
virtual
double
execute
Energy
(
const
Stream
&
positions
)
=
0
;
};
};
/**
/**
* This kernel is invoked by GBSAOBCForceField to calculate the forces acting on the system.
* This kernel is invoked by GBSAOBCForceField to calculate the forces acting on the
system and the energy of the
system.
*/
*/
class
CalcGBSAOBCForce
s
Kernel
:
public
KernelImpl
{
class
CalcGBSAOBCForce
Field
Kernel
:
public
KernelImpl
{
public:
public:
static
std
::
string
Name
()
{
static
std
::
string
Name
()
{
return
"CalcGBSAOBCForces"
;
return
"CalcGBSAOBCForces"
;
}
}
CalcGBSAOBCForce
s
Kernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
CalcGBSAOBCForce
Field
Kernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
}
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
...
@@ -148,42 +114,20 @@ public:
...
@@ -148,42 +114,20 @@ public:
virtual
void
initialize
(
const
std
::
vector
<
double
>&
bornRadii
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
virtual
void
initialize
(
const
std
::
vector
<
double
>&
bornRadii
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
=
0
;
double
solventDielectric
,
double
soluteDielectric
)
=
0
;
/**
/**
* Execute the kernel.
* Execute the kernel
to calculate the forces
.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/
*/
virtual
void
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
=
0
;
virtual
void
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
)
=
0
;
};
/**
* This kernel is invoked by GBSAOBCForceField to calculate the energy of the system.
*/
class
CalcGBSAOBCEnergyKernel
:
public
KernelImpl
{
public:
static
std
::
string
Name
()
{
return
"CalcGBSAOBCEnergy"
;
}
CalcGBSAOBCEnergyKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bornRadii the initial value of the Born radius for each atom
* @param atomParameters the force parameters (charge, atomic radius, scaling factor) for each atom
* @param solventDielectric the dielectric constant of the solvent
* @param soluteDielectric the dielectric constant of the solute
*/
virtual
void
initialize
(
const
std
::
vector
<
double
>&
bornRadii
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
=
0
;
/**
/**
* Execute the kernel.
* Execute the kernel
to calculate the energy
.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @return the potential energy due to the GBSAOBCForceField
* @return the potential energy due to the GBSAOBCForceField
*/
*/
virtual
double
execute
(
const
Stream
&
positions
)
=
0
;
virtual
double
execute
Energy
(
const
Stream
&
positions
)
=
0
;
};
};
/**
/**
...
...
olla/src/Kernel.cpp
View file @
2a530882
...
@@ -62,6 +62,10 @@ string Kernel::Kernel::getName() const {
...
@@ -62,6 +62,10 @@ string Kernel::Kernel::getName() const {
return
impl
->
getName
();
return
impl
->
getName
();
}
}
const
KernelImpl
&
Kernel
::
getImpl
()
const
{
return
*
impl
;
}
KernelImpl
&
Kernel
::
getImpl
()
{
KernelImpl
&
Kernel
::
getImpl
()
{
return
*
impl
;
return
*
impl
;
}
}
olla/src/Stream.cpp
View file @
2a530882
...
@@ -83,6 +83,10 @@ void Stream::fillWithValue(void* value) {
...
@@ -83,6 +83,10 @@ void Stream::fillWithValue(void* value) {
impl
->
fillWithValue
(
value
);
impl
->
fillWithValue
(
value
);
}
}
const
StreamImpl
&
Stream
::
getImpl
()
const
{
return
*
impl
;
}
StreamImpl
&
Stream
::
getImpl
()
{
StreamImpl
&
Stream
::
getImpl
()
{
return
*
impl
;
return
*
impl
;
}
}
openmmapi/include/OpenMMContext.h
View file @
2a530882
...
@@ -100,7 +100,7 @@ public:
...
@@ -100,7 +100,7 @@ public:
* @param types the set of data types which should be stored in the State object. This
* @param types the set of data types which should be stored in the State object. This
* should be a union of DataType values, e.g. (State::Positions | State::Velocities).
* should be a union of DataType values, e.g. (State::Positions | State::Velocities).
*/
*/
State
getState
(
State
::
DataType
types
)
const
;
State
getState
(
int
types
)
const
;
/**
/**
* Get the current time of the simulation (in picoseconds).
* Get the current time of the simulation (in picoseconds).
*/
*/
...
...
openmmapi/include/StandardMMForceField.h
View file @
2a530882
...
@@ -104,8 +104,8 @@ public:
...
@@ -104,8 +104,8 @@ public:
*
*
* @param index the index of the atom for which to set parameters
* @param index the index of the atom for which to set parameters
* @param charge the charge of the atom, measured in units of the proton charge
* @param charge the charge of the atom, measured in units of the proton charge
* @param radius the van der Waals radius of the atom, measured in angstroms
* @param radius the van der Waals radius of the atom
(sigma in the Lennard Jones potential)
, measured in angstroms
* @param depth the well depth of the van der Waals interaction, measured in kcal/mol
* @param depth the well depth of the van der Waals interaction
(epsilon in the Lennard Jones potential)
, measured in kcal/mol
*/
*/
void
setAtomParameters
(
int
index
,
double
charge
,
double
radius
,
double
depth
);
void
setAtomParameters
(
int
index
,
double
charge
,
double
radius
,
double
depth
);
/**
/**
...
...
openmmapi/include/Vec3.h
View file @
2a530882
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include <cassert>
#include <cassert>
#include <iosfwd>
namespace
OpenMM
{
namespace
OpenMM
{
...
@@ -69,6 +70,12 @@ private:
...
@@ -69,6 +70,12 @@ private:
double
data
[
3
];
double
data
[
3
];
};
};
template
<
class
CHAR
,
class
TRAITS
>
std
::
basic_ostream
<
CHAR
,
TRAITS
>&
operator
<<
(
std
::
basic_ostream
<
CHAR
,
TRAITS
>&
o
,
const
Vec3
&
v
)
{
o
<<
'['
<<
v
[
0
]
<<
", "
<<
v
[
1
]
<<
", "
<<
v
[
2
]
<<
']'
;
return
o
;
}
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/*OPENMM_VEC3_H_*/
#endif
/*OPENMM_VEC3_H_*/
openmmapi/include/internal/GBSAOBCForceFieldImpl.h
View file @
2a530882
...
@@ -61,7 +61,7 @@ public:
...
@@ -61,7 +61,7 @@ public:
private:
private:
void
initialize
(
OpenMMContextImpl
&
context
);
void
initialize
(
OpenMMContextImpl
&
context
);
GBSAOBCForceField
&
owner
;
GBSAOBCForceField
&
owner
;
Kernel
forceKernel
,
energyK
ernel
;
Kernel
k
ernel
;
bool
hasInitialized
;
bool
hasInitialized
;
};
};
...
...
openmmapi/include/internal/StandardMMForceFieldImpl.h
View file @
2a530882
...
@@ -65,7 +65,7 @@ private:
...
@@ -65,7 +65,7 @@ private:
void
findExclusions
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
set
<
std
::
pair
<
int
,
int
>
>&
bonded14Indices
)
const
;
void
findExclusions
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
set
<
std
::
pair
<
int
,
int
>
>&
bonded14Indices
)
const
;
void
addExclusionsToSet
(
const
std
::
vector
<
std
::
set
<
int
>
>&
bonded12
,
std
::
set
<
int
>&
exclusions
,
int
baseAtom
,
int
fromAtom
,
int
currentLevel
)
const
;
void
addExclusionsToSet
(
const
std
::
vector
<
std
::
set
<
int
>
>&
bonded12
,
std
::
set
<
int
>&
exclusions
,
int
baseAtom
,
int
fromAtom
,
int
currentLevel
)
const
;
StandardMMForceField
&
owner
;
StandardMMForceField
&
owner
;
Kernel
forceKernel
,
energyK
ernel
;
Kernel
k
ernel
;
};
};
}
// namespace OpenMM
}
// namespace OpenMM
...
...
openmmapi/src/GBSAOBCForceFieldImpl.cpp
View file @
2a530882
...
@@ -42,8 +42,7 @@ GBSAOBCForceFieldImpl::GBSAOBCForceFieldImpl(GBSAOBCForceField& owner, OpenMMCon
...
@@ -42,8 +42,7 @@ GBSAOBCForceFieldImpl::GBSAOBCForceFieldImpl(GBSAOBCForceField& owner, OpenMMCon
void
GBSAOBCForceFieldImpl
::
initialize
(
OpenMMContextImpl
&
context
)
{
void
GBSAOBCForceFieldImpl
::
initialize
(
OpenMMContextImpl
&
context
)
{
hasInitialized
=
true
;
hasInitialized
=
true
;
forceKernel
=
context
.
getPlatform
().
createKernel
(
CalcStandardMMForcesKernel
::
Name
());
kernel
=
context
.
getPlatform
().
createKernel
(
CalcGBSAOBCForceFieldKernel
::
Name
());
energyKernel
=
context
.
getPlatform
().
createKernel
(
CalcStandardMMEnergyKernel
::
Name
());
std
::
vector
<
double
>
bornRadii
;
std
::
vector
<
double
>
bornRadii
;
// TODO calculate the initial Born radii.
// TODO calculate the initial Born radii.
vector
<
vector
<
double
>
>
atomParameters
;
vector
<
vector
<
double
>
>
atomParameters
;
...
@@ -54,27 +53,24 @@ void GBSAOBCForceFieldImpl::initialize(OpenMMContextImpl& context) {
...
@@ -54,27 +53,24 @@ void GBSAOBCForceFieldImpl::initialize(OpenMMContextImpl& context) {
atomParameters
[
i
].
push_back
(
radius
);
atomParameters
[
i
].
push_back
(
radius
);
atomParameters
[
i
].
push_back
(
scalingFactor
);
atomParameters
[
i
].
push_back
(
scalingFactor
);
}
}
dynamic_cast
<
CalcGBSAOBCForcesKernel
&>
(
forceKernel
.
getImpl
()).
initialize
(
bornRadii
,
atomParameters
,
dynamic_cast
<
CalcGBSAOBCForceFieldKernel
&>
(
kernel
.
getImpl
()).
initialize
(
bornRadii
,
atomParameters
,
owner
.
getSolventDielectric
(),
owner
.
getSoluteDielectric
());
dynamic_cast
<
CalcGBSAOBCEnergyKernel
&>
(
forceKernel
.
getImpl
()).
initialize
(
bornRadii
,
atomParameters
,
owner
.
getSolventDielectric
(),
owner
.
getSoluteDielectric
());
owner
.
getSolventDielectric
(),
owner
.
getSoluteDielectric
());
}
}
void
GBSAOBCForceFieldImpl
::
calcForces
(
OpenMMContextImpl
&
context
,
Stream
&
forces
)
{
void
GBSAOBCForceFieldImpl
::
calcForces
(
OpenMMContextImpl
&
context
,
Stream
&
forces
)
{
if
(
!
hasInitialized
)
if
(
!
hasInitialized
)
initialize
(
context
);
initialize
(
context
);
dynamic_cast
<
CalcGBSAOBCForce
s
Kernel
&>
(
forceK
ernel
.
getImpl
()).
execute
(
context
.
getPositions
(),
forces
);
dynamic_cast
<
CalcGBSAOBCForce
Field
Kernel
&>
(
k
ernel
.
getImpl
()).
execute
Forces
(
context
.
getPositions
(),
forces
);
}
}
double
GBSAOBCForceFieldImpl
::
calcEnergy
(
OpenMMContextImpl
&
context
)
{
double
GBSAOBCForceFieldImpl
::
calcEnergy
(
OpenMMContextImpl
&
context
)
{
if
(
!
hasInitialized
)
if
(
!
hasInitialized
)
initialize
(
context
);
initialize
(
context
);
return
dynamic_cast
<
CalcGBSAOBC
Energy
Kernel
&>
(
energyK
ernel
.
getImpl
()).
execute
(
context
.
getPositions
());
return
dynamic_cast
<
CalcGBSAOBC
ForceField
Kernel
&>
(
k
ernel
.
getImpl
()).
execute
Energy
(
context
.
getPositions
());
}
}
std
::
vector
<
std
::
string
>
GBSAOBCForceFieldImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
GBSAOBCForceFieldImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
names
;
names
.
push_back
(
CalcGBSAOBCForcesKernel
::
Name
());
names
.
push_back
(
CalcGBSAOBCForceFieldKernel
::
Name
());
names
.
push_back
(
CalcGBSAOBCEnergyKernel
::
Name
());
return
names
;
return
names
;
}
}
openmmapi/src/OpenMMContext.cpp
View file @
2a530882
...
@@ -61,12 +61,14 @@ Integrator& OpenMMContext::getIntegrator() {
...
@@ -61,12 +61,14 @@ Integrator& OpenMMContext::getIntegrator() {
}
}
State
OpenMMContext
::
getState
(
State
::
DataType
types
)
const
{
State
OpenMMContext
::
getState
(
int
types
)
const
{
State
state
(
impl
->
getTime
(),
impl
->
getSystem
().
getNumAtoms
(),
types
);
State
state
(
impl
->
getTime
(),
impl
->
getSystem
().
getNumAtoms
(),
State
::
DataType
(
types
)
)
;
if
(
types
&
State
::
Energy
)
if
(
types
&
State
::
Energy
)
state
.
setEnergy
(
impl
->
calcKineticEnergy
(),
impl
->
calcPotentialEnergy
());
state
.
setEnergy
(
impl
->
calcKineticEnergy
(),
impl
->
calcPotentialEnergy
());
if
(
types
&
State
::
Forces
)
if
(
types
&
State
::
Forces
)
{
impl
->
calcForces
();
impl
->
getForces
().
saveToArray
(
&
state
.
updForces
()[
0
]);
impl
->
getForces
().
saveToArray
(
&
state
.
updForces
()[
0
]);
}
if
(
types
&
State
::
Parameters
)
{
if
(
types
&
State
::
Parameters
)
{
for
(
map
<
string
,
double
>::
const_iterator
iter
=
impl
->
parameters
.
begin
();
iter
!=
impl
->
parameters
.
end
();
iter
++
)
for
(
map
<
string
,
double
>::
const_iterator
iter
=
impl
->
parameters
.
begin
();
iter
!=
impl
->
parameters
.
end
();
iter
++
)
state
.
updParameters
()[
iter
->
first
]
=
iter
->
second
;
state
.
updParameters
()[
iter
->
first
]
=
iter
->
second
;
...
...
openmmapi/src/StandardMMForceFieldImpl.cpp
View file @
2a530882
...
@@ -39,8 +39,7 @@ using std::vector;
...
@@ -39,8 +39,7 @@ using std::vector;
using
std
::
set
;
using
std
::
set
;
StandardMMForceFieldImpl
::
StandardMMForceFieldImpl
(
StandardMMForceField
&
owner
,
OpenMMContextImpl
&
context
)
:
owner
(
owner
)
{
StandardMMForceFieldImpl
::
StandardMMForceFieldImpl
(
StandardMMForceField
&
owner
,
OpenMMContextImpl
&
context
)
:
owner
(
owner
)
{
forceKernel
=
context
.
getPlatform
().
createKernel
(
CalcStandardMMForcesKernel
::
Name
());
kernel
=
context
.
getPlatform
().
createKernel
(
CalcStandardMMForceFieldKernel
::
Name
());
energyKernel
=
context
.
getPlatform
().
createKernel
(
CalcStandardMMEnergyKernel
::
Name
());
vector
<
vector
<
int
>
>
bondIndices
(
owner
.
getNumBonds
());
vector
<
vector
<
int
>
>
bondIndices
(
owner
.
getNumBonds
());
vector
<
vector
<
double
>
>
bondParameters
(
owner
.
getNumBonds
());
vector
<
vector
<
double
>
>
bondParameters
(
owner
.
getNumBonds
());
vector
<
vector
<
int
>
>
angleIndices
(
owner
.
getNumAngles
());
vector
<
vector
<
int
>
>
angleIndices
(
owner
.
getNumAngles
());
...
@@ -79,9 +78,9 @@ StandardMMForceFieldImpl::StandardMMForceFieldImpl(StandardMMForceField& owner,
...
@@ -79,9 +78,9 @@ StandardMMForceFieldImpl::StandardMMForceFieldImpl(StandardMMForceField& owner,
periodicTorsionIndices
[
i
].
push_back
(
atom2
);
periodicTorsionIndices
[
i
].
push_back
(
atom2
);
periodicTorsionIndices
[
i
].
push_back
(
atom3
);
periodicTorsionIndices
[
i
].
push_back
(
atom3
);
periodicTorsionIndices
[
i
].
push_back
(
atom4
);
periodicTorsionIndices
[
i
].
push_back
(
atom4
);
periodicTorsionParameters
[
i
].
push_back
(
periodicity
);
periodicTorsionParameters
[
i
].
push_back
(
phase
);
periodicTorsionParameters
[
i
].
push_back
(
k
);
periodicTorsionParameters
[
i
].
push_back
(
k
);
periodicTorsionParameters
[
i
].
push_back
(
phase
);
periodicTorsionParameters
[
i
].
push_back
(
periodicity
);
}
}
for
(
int
i
=
0
;
i
<
owner
.
getNumRBTorsions
();
++
i
)
{
for
(
int
i
=
0
;
i
<
owner
.
getNumRBTorsions
();
++
i
)
{
int
atom1
,
atom2
,
atom3
,
atom4
;
int
atom1
,
atom2
,
atom3
,
atom4
;
...
@@ -113,27 +112,24 @@ StandardMMForceFieldImpl::StandardMMForceFieldImpl(StandardMMForceField& owner,
...
@@ -113,27 +112,24 @@ StandardMMForceFieldImpl::StandardMMForceFieldImpl(StandardMMForceField& owner,
bonded14Indices
[
index
].
push_back
(
iter
->
first
);
bonded14Indices
[
index
].
push_back
(
iter
->
first
);
bonded14Indices
[
index
++
].
push_back
(
iter
->
second
);
bonded14Indices
[
index
++
].
push_back
(
iter
->
second
);
}
}
dynamic_cast
<
CalcStandardMMForcesKernel
&>
(
forceKernel
.
getImpl
()).
initialize
(
bondIndices
,
bondParameters
,
angleIndices
,
angleParameters
,
dynamic_cast
<
CalcStandardMMForceFieldKernel
&>
(
kernel
.
getImpl
()).
initialize
(
bondIndices
,
bondParameters
,
angleIndices
,
angleParameters
,
periodicTorsionIndices
,
periodicTorsionParameters
,
rbTorsionIndices
,
rbTorsionParameters
,
bonded14Indices
,
exclusions
,
nonbondedParameters
);
periodicTorsionIndices
,
periodicTorsionParameters
,
rbTorsionIndices
,
rbTorsionParameters
,
bonded14Indices
,
0.5
,
1.0
/
1.2
,
exclusions
,
nonbondedParameters
);
dynamic_cast
<
CalcStandardMMEnergyKernel
&>
(
energyKernel
.
getImpl
()).
initialize
(
bondIndices
,
bondParameters
,
angleIndices
,
angleParameters
,
periodicTorsionIndices
,
periodicTorsionParameters
,
rbTorsionIndices
,
rbTorsionParameters
,
bonded14Indices
,
exclusions
,
nonbondedParameters
);
}
}
StandardMMForceFieldImpl
::~
StandardMMForceFieldImpl
()
{
StandardMMForceFieldImpl
::~
StandardMMForceFieldImpl
()
{
}
}
void
StandardMMForceFieldImpl
::
calcForces
(
OpenMMContextImpl
&
context
,
Stream
&
forces
)
{
void
StandardMMForceFieldImpl
::
calcForces
(
OpenMMContextImpl
&
context
,
Stream
&
forces
)
{
dynamic_cast
<
CalcStandardMMForce
s
Kernel
&>
(
forceK
ernel
.
getImpl
()).
execute
(
context
.
getPositions
(),
forces
);
dynamic_cast
<
CalcStandardMMForce
Field
Kernel
&>
(
k
ernel
.
getImpl
()).
execute
Forces
(
context
.
getPositions
(),
forces
);
}
}
double
StandardMMForceFieldImpl
::
calcEnergy
(
OpenMMContextImpl
&
context
)
{
double
StandardMMForceFieldImpl
::
calcEnergy
(
OpenMMContextImpl
&
context
)
{
return
dynamic_cast
<
CalcStandardMM
Energy
Kernel
&>
(
energyK
ernel
.
getImpl
()).
execute
(
context
.
getPositions
());
return
dynamic_cast
<
CalcStandardMM
ForceField
Kernel
&>
(
k
ernel
.
getImpl
()).
execute
Energy
(
context
.
getPositions
());
}
}
std
::
vector
<
std
::
string
>
StandardMMForceFieldImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
StandardMMForceFieldImpl
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
names
;
names
.
push_back
(
CalcStandardMMForcesKernel
::
Name
());
names
.
push_back
(
CalcStandardMMForceFieldKernel
::
Name
());
names
.
push_back
(
CalcStandardMMEnergyKernel
::
Name
());
return
names
;
return
names
;
}
}
...
...
platforms/reference/src/ReferenceFloatStreamImpl.cpp
View file @
2a530882
...
@@ -121,6 +121,10 @@ void ReferenceFloatStreamImpl::fillWithValue(void* value) {
...
@@ -121,6 +121,10 @@ void ReferenceFloatStreamImpl::fillWithValue(void* value) {
}
}
const
RealOpenMM
*
const
*
ReferenceFloatStreamImpl
::
getData
()
const
{
return
data
;
}
RealOpenMM
**
ReferenceFloatStreamImpl
::
getData
()
{
RealOpenMM
**
ReferenceFloatStreamImpl
::
getData
()
{
return
data
;
return
data
;
}
}
...
...
platforms/reference/src/ReferenceFloatStreamImpl.h
View file @
2a530882
...
@@ -48,6 +48,7 @@ public:
...
@@ -48,6 +48,7 @@ public:
void
loadFromArray
(
const
void
*
array
);
void
loadFromArray
(
const
void
*
array
);
void
saveToArray
(
void
*
array
);
void
saveToArray
(
void
*
array
);
void
fillWithValue
(
void
*
value
);
void
fillWithValue
(
void
*
value
);
const
RealOpenMM
*
const
*
getData
()
const
;
RealOpenMM
**
getData
();
RealOpenMM
**
getData
();
private:
private:
int
width
;
int
width
;
...
...
platforms/reference/src/ReferenceIntStreamImpl.cpp
View file @
2a530882
...
@@ -78,6 +78,10 @@ void ReferenceIntStreamImpl::fillWithValue(void* value) {
...
@@ -78,6 +78,10 @@ void ReferenceIntStreamImpl::fillWithValue(void* value) {
data
[
i
][
j
]
=
valueData
;
data
[
i
][
j
]
=
valueData
;
}
}
const
int
*
const
*
ReferenceIntStreamImpl
::
getData
()
const
{
return
data
;
}
int
**
ReferenceIntStreamImpl
::
getData
()
{
int
**
ReferenceIntStreamImpl
::
getData
()
{
return
data
;
return
data
;
}
}
...
...
platforms/reference/src/ReferenceIntStreamImpl.h
View file @
2a530882
...
@@ -47,6 +47,7 @@ public:
...
@@ -47,6 +47,7 @@ public:
void
loadFromArray
(
const
void
*
array
);
void
loadFromArray
(
const
void
*
array
);
void
saveToArray
(
void
*
array
);
void
saveToArray
(
void
*
array
);
void
fillWithValue
(
void
*
value
);
void
fillWithValue
(
void
*
value
);
const
int
*
const
*
getData
()
const
;
int
**
getData
();
int
**
getData
();
private:
private:
int
width
;
int
width
;
...
...
platforms/reference/src/ReferenceKernelFactory.cpp
View file @
2a530882
...
@@ -35,14 +35,10 @@
...
@@ -35,14 +35,10 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
KernelImpl
*
ReferenceKernelFactory
::
createKernelImpl
(
std
::
string
name
,
const
Platform
&
platform
)
const
{
KernelImpl
*
ReferenceKernelFactory
::
createKernelImpl
(
std
::
string
name
,
const
Platform
&
platform
)
const
{
if
(
name
==
CalcStandardMMForcesKernel
::
Name
())
if
(
name
==
CalcStandardMMForceFieldKernel
::
Name
())
return
new
ReferenceCalcStandardMMForcesKernel
(
name
,
platform
);
return
new
ReferenceCalcStandardMMForceFieldKernel
(
name
,
platform
);
if
(
name
==
CalcStandardMMEnergyKernel
::
Name
())
if
(
name
==
CalcGBSAOBCForceFieldKernel
::
Name
())
return
new
ReferenceCalcStandardMMEnergyKernel
(
name
,
platform
);
return
new
ReferenceCalcGBSAOBCForceFieldKernel
(
name
,
platform
);
if
(
name
==
CalcGBSAOBCForcesKernel
::
Name
())
return
new
ReferenceCalcGBSAOBCForcesKernel
(
name
,
platform
);
if
(
name
==
CalcGBSAOBCEnergyKernel
::
Name
())
return
new
ReferenceCalcGBSAOBCEnergyKernel
(
name
,
platform
);
if
(
name
==
IntegrateVerletStepKernel
::
Name
())
if
(
name
==
IntegrateVerletStepKernel
::
Name
())
return
new
ReferenceIntegrateVerletStepKernel
(
name
,
platform
);
return
new
ReferenceIntegrateVerletStepKernel
(
name
,
platform
);
if
(
name
==
IntegrateLangevinStepKernel
::
Name
())
if
(
name
==
IntegrateLangevinStepKernel
::
Name
())
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
2a530882
...
@@ -30,6 +30,15 @@
...
@@ -30,6 +30,15 @@
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include "ReferenceKernels.h"
#include "ReferenceKernels.h"
#include "ReferenceFloatStreamImpl.h"
#include "SimTKReference/ReferenceAngleBondIxn.h"
#include "SimTKReference/ReferenceBondForce.h"
#include "SimTKReference/ReferenceHarmonicBondIxn.h"
#include "SimTKReference/ReferenceLJCoulomb14.h"
#include "SimTKReference/ReferenceLJCoulombIxn.h"
#include "SimTKReference/ReferenceProperDihedralBond.h"
#include "SimTKReference/ReferenceRbDihedralBond.h"
#include <cmath>
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
...
@@ -84,7 +93,7 @@ void disposeRealArray(RealOpenMM** array, int size) {
...
@@ -84,7 +93,7 @@ void disposeRealArray(RealOpenMM** array, int size) {
}
}
}
}
ReferenceCalcStandardMMForce
s
Kernel
::~
ReferenceCalcStandardMMForce
s
Kernel
()
{
ReferenceCalcStandardMMForce
Field
Kernel
::~
ReferenceCalcStandardMMForce
Field
Kernel
()
{
disposeIntArray
(
bondIndexArray
,
numBonds
);
disposeIntArray
(
bondIndexArray
,
numBonds
);
disposeRealArray
(
bondParamArray
,
numBonds
);
disposeRealArray
(
bondParamArray
,
numBonds
);
disposeIntArray
(
angleIndexArray
,
numAngles
);
disposeIntArray
(
angleIndexArray
,
numAngles
);
...
@@ -93,18 +102,24 @@ ReferenceCalcStandardMMForcesKernel::~ReferenceCalcStandardMMForcesKernel() {
...
@@ -93,18 +102,24 @@ ReferenceCalcStandardMMForcesKernel::~ReferenceCalcStandardMMForcesKernel() {
disposeRealArray
(
periodicTorsionParamArray
,
numPeriodicTorsions
);
disposeRealArray
(
periodicTorsionParamArray
,
numPeriodicTorsions
);
disposeIntArray
(
rbTorsionIndexArray
,
numRBTorsions
);
disposeIntArray
(
rbTorsionIndexArray
,
numRBTorsions
);
disposeRealArray
(
rbTorsionParamArray
,
numRBTorsions
);
disposeRealArray
(
rbTorsionParamArray
,
numRBTorsions
);
disposeRealArray
(
atomParamArray
,
numAtoms
);
disposeIntArray
(
exclusionArray
,
numAtoms
);
disposeIntArray
(
bonded14IndexArray
,
num14
);
disposeRealArray
(
bonded14ParamArray
,
num14
);
}
}
void
ReferenceCalcStandardMMForce
s
Kernel
::
initialize
(
const
vector
<
vector
<
int
>
>&
bondIndices
,
const
vector
<
vector
<
double
>
>&
bondParameters
,
void
ReferenceCalcStandardMMForce
Field
Kernel
::
initialize
(
const
vector
<
vector
<
int
>
>&
bondIndices
,
const
vector
<
vector
<
double
>
>&
bondParameters
,
const
vector
<
vector
<
int
>
>&
angleIndices
,
const
vector
<
vector
<
double
>
>&
angleParameters
,
const
vector
<
vector
<
int
>
>&
angleIndices
,
const
vector
<
vector
<
double
>
>&
angleParameters
,
const
vector
<
vector
<
int
>
>&
periodicTorsionIndices
,
const
vector
<
vector
<
double
>
>&
periodicTorsionParameters
,
const
vector
<
vector
<
int
>
>&
periodicTorsionIndices
,
const
vector
<
vector
<
double
>
>&
periodicTorsionParameters
,
const
vector
<
vector
<
int
>
>&
rbTorsionIndices
,
const
vector
<
vector
<
double
>
>&
rbTorsionParameters
,
const
vector
<
vector
<
int
>
>&
rbTorsionIndices
,
const
vector
<
vector
<
double
>
>&
rbTorsionParameters
,
const
vector
<
vector
<
int
>
>&
bonded14Indices
,
const
vector
<
set
<
int
>
>&
exclusions
,
const
vector
<
vector
<
int
>
>&
bonded14Indices
,
double
lj14Scale
,
double
coulomb14Scale
,
const
vector
<
vector
<
double
>
>&
nonbondedParameters
)
{
const
vector
<
set
<
int
>
>&
exclusions
,
const
vector
<
vector
<
double
>
>&
nonbondedParameters
)
{
numAtoms
=
nonbondedParameters
.
size
();
numBonds
=
bondIndices
.
size
();
numBonds
=
bondIndices
.
size
();
numAngles
=
angleIndices
.
size
();
numAngles
=
angleIndices
.
size
();
numPeriodicTorsions
=
periodicTorsionIndices
.
size
();
numPeriodicTorsions
=
periodicTorsionIndices
.
size
();
numRBTorsions
=
rbTorsionIndices
.
size
();
numRBTorsions
=
rbTorsionIndices
.
size
();
num14
=
bonded14Indices
.
size
();
bondIndexArray
=
copyToArray
(
bondIndices
);
bondIndexArray
=
copyToArray
(
bondIndices
);
bondParamArray
=
copyToArray
(
bondParameters
);
bondParamArray
=
copyToArray
(
bondParameters
);
angleIndexArray
=
copyToArray
(
angleIndices
);
angleIndexArray
=
copyToArray
(
angleIndices
);
...
@@ -113,40 +128,94 @@ void ReferenceCalcStandardMMForcesKernel::initialize(const vector<vector<int> >&
...
@@ -113,40 +128,94 @@ void ReferenceCalcStandardMMForcesKernel::initialize(const vector<vector<int> >&
periodicTorsionParamArray
=
copyToArray
(
periodicTorsionParameters
);
periodicTorsionParamArray
=
copyToArray
(
periodicTorsionParameters
);
rbTorsionIndexArray
=
copyToArray
(
rbTorsionIndices
);
rbTorsionIndexArray
=
copyToArray
(
rbTorsionIndices
);
rbTorsionParamArray
=
copyToArray
(
rbTorsionParameters
);
rbTorsionParamArray
=
copyToArray
(
rbTorsionParameters
);
atomParamArray
=
allocateRealArray
(
numAtoms
,
3
);
RealOpenMM
sqrtEps
=
std
::
sqrt
(
138.935485
);
for
(
int
i
=
0
;
i
<
numAtoms
;
++
i
)
{
atomParamArray
[
i
][
0
]
=
0.5
*
nonbondedParameters
[
i
][
1
];
atomParamArray
[
i
][
1
]
=
2.0
*
sqrt
(
nonbondedParameters
[
i
][
2
]);
atomParamArray
[
i
][
2
]
=
nonbondedParameters
[
i
][
0
]
*
sqrtEps
;
}
exclusionArray
=
new
int
*
[
numAtoms
];
for
(
int
i
=
0
;
i
<
numAtoms
;
++
i
)
{
exclusionArray
[
i
]
=
new
int
[
exclusions
[
i
].
size
()
+
1
];
exclusionArray
[
i
][
0
]
=
exclusions
[
i
].
size
();
int
index
=
0
;
for
(
set
<
int
>::
const_iterator
iter
=
exclusions
[
i
].
begin
();
iter
!=
exclusions
[
i
].
end
();
++
iter
)
exclusionArray
[
i
][
++
index
]
=
*
iter
;
}
bonded14IndexArray
=
copyToArray
(
bonded14Indices
);
bonded14ParamArray
=
allocateRealArray
(
num14
,
3
);
for
(
int
i
=
0
;
i
<
num14
;
++
i
)
{
int
atom1
=
bonded14Indices
[
i
][
0
];
int
atom2
=
bonded14Indices
[
i
][
1
];
bonded14ParamArray
[
i
][
0
]
=
atomParamArray
[
atom1
][
0
]
+
atomParamArray
[
atom2
][
0
];
bonded14ParamArray
[
i
][
1
]
=
lj14Scale
*
(
atomParamArray
[
atom1
][
1
]
*
atomParamArray
[
atom2
][
1
]);
bonded14ParamArray
[
i
][
2
]
=
coulomb14Scale
*
(
atomParamArray
[
atom1
][
2
]
*
atomParamArray
[
atom2
][
2
]);
}
}
}
void
ReferenceCalcStandardMMForcesKernel
::
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
{
void
ReferenceCalcStandardMMForceFieldKernel
::
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
)
{
RealOpenMM
**
posData
=
const_cast
<
RealOpenMM
**>
(((
ReferenceFloatStreamImpl
&
)
positions
.
getImpl
()).
getData
());
RealOpenMM
**
forceData
=
((
ReferenceFloatStreamImpl
&
)
forces
.
getImpl
()).
getData
();
ReferenceBondForce
refBondForce
;
ReferenceHarmonicBondIxn
harmonicBond
;
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
0
,
0
,
0
,
harmonicBond
);
ReferenceAngleBondIxn
angleBond
;
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
0
,
0
,
0
,
angleBond
);
ReferenceProperDihedralBond
periodicTorsionBond
;
refBondForce
.
calculateForce
(
numPeriodicTorsions
,
periodicTorsionIndexArray
,
posData
,
periodicTorsionParamArray
,
forceData
,
0
,
0
,
0
,
periodicTorsionBond
);
ReferenceRbDihedralBond
rbTorsionBond
;
refBondForce
.
calculateForce
(
numRBTorsions
,
rbTorsionIndexArray
,
posData
,
rbTorsionParamArray
,
forceData
,
0
,
0
,
0
,
rbTorsionBond
);
ReferenceLJCoulombIxn
clj
;
clj
.
calculatePairIxn
(
numAtoms
,
posData
,
atomParamArray
,
exclusionArray
,
0
,
forceData
,
0
,
0
);
ReferenceLJCoulomb14
nonbonded14
;
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
0
,
0
,
0
,
nonbonded14
);
}
}
void
ReferenceCalcStandardMMEnergyKernel
::
initialize
(
const
vector
<
vector
<
int
>
>&
bondIndices
,
const
vector
<
vector
<
double
>
>&
bondParameters
,
double
ReferenceCalcStandardMMForceFieldKernel
::
executeEnergy
(
const
Stream
&
positions
)
{
const
vector
<
vector
<
int
>
>&
angleIndices
,
const
vector
<
vector
<
double
>
>&
angleParameters
,
RealOpenMM
**
posData
=
const_cast
<
RealOpenMM
**>
(((
ReferenceFloatStreamImpl
&
)
positions
.
getImpl
()).
getData
());
const
vector
<
vector
<
int
>
>&
periodicTorsionIndices
,
const
vector
<
vector
<
double
>
>&
periodicTorsionParameters
,
RealOpenMM
**
forceData
=
allocateRealArray
(
numAtoms
,
3
);
const
vector
<
vector
<
int
>
>&
rbTorsionIndices
,
const
vector
<
vector
<
double
>
>&
rbTorsionParameters
,
int
arraySize
=
max
(
max
(
max
(
max
(
numAtoms
,
numBonds
),
numAngles
),
numPeriodicTorsions
),
numRBTorsions
);
const
vector
<
vector
<
int
>
>&
bonded14Indices
,
const
vector
<
set
<
int
>
>&
exclusions
,
RealOpenMM
*
energyArray
=
new
RealOpenMM
[
arraySize
];
const
vector
<
vector
<
double
>
>&
nonbondedParameters
)
{
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceHarmonicBondIxn
harmonicBond
;
for
(
int
i
=
0
;
i
<
arraySize
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
harmonicBond
);
ReferenceAngleBondIxn
angleBond
;
for
(
int
i
=
0
;
i
<
arraySize
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
angleBond
);
ReferenceProperDihedralBond
periodicTorsionBond
;
for
(
int
i
=
0
;
i
<
arraySize
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
numPeriodicTorsions
,
periodicTorsionIndexArray
,
posData
,
periodicTorsionParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
periodicTorsionBond
);
ReferenceRbDihedralBond
rbTorsionBond
;
for
(
int
i
=
0
;
i
<
arraySize
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
numRBTorsions
,
rbTorsionIndexArray
,
posData
,
rbTorsionParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
rbTorsionBond
);
ReferenceLJCoulombIxn
clj
;
clj
.
calculatePairIxn
(
numAtoms
,
posData
,
atomParamArray
,
exclusionArray
,
0
,
forceData
,
0
,
&
energy
);
ReferenceLJCoulomb14
nonbonded14
;
for
(
int
i
=
0
;
i
<
arraySize
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
nonbonded14
);
disposeRealArray
(
forceData
,
numAtoms
);
delete
[]
energyArray
;
return
energy
;
}
}
double
ReferenceCalcStandardMMEnergyKernel
::
execute
(
const
Stream
&
positions
)
{
void
ReferenceCalcGBSAOBCForceFieldKernel
::
initialize
(
const
vector
<
double
>&
bornRadii
,
const
vector
<
vector
<
double
>
>&
atomParameters
,
return
0.0
;
// TODO implement correctly
}
void
ReferenceCalcGBSAOBCForcesKernel
::
initialize
(
const
vector
<
double
>&
bornRadii
,
const
vector
<
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
{
double
solventDielectric
,
double
soluteDielectric
)
{
}
}
void
ReferenceCalcGBSAOBCForcesKernel
::
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
{
void
ReferenceCalcGBSAOBCForceFieldKernel
::
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
)
{
}
void
ReferenceCalcGBSAOBCEnergyKernel
::
initialize
(
const
vector
<
double
>&
bornRadii
,
const
vector
<
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
{
}
}
double
ReferenceCalcGBSAOBC
Energy
Kernel
::
execute
(
const
Stream
&
positions
)
{
double
ReferenceCalcGBSAOBC
ForceField
Kernel
::
execute
Energy
(
const
Stream
&
positions
)
{
return
0.0
;
// TODO implement correctly
return
0.0
;
// TODO implement correctly
}
}
...
...
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