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
480c695c
Commit
480c695c
authored
Feb 07, 2015
by
Jason Swails
Browse files
A few fixes.
parent
99628218
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
11 deletions
+35
-11
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
.../amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
+18
-0
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+9
-6
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
...ce/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
+6
-4
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.h
...ence/src/SimTKReference/AmoebaReferenceStretchBendForce.h
+2
-1
No files found.
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
View file @
480c695c
...
@@ -94,6 +94,24 @@ public:
...
@@ -94,6 +94,24 @@ public:
void
getStretchBendParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
double
&
lengthAB
,
void
getStretchBendParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
double
&
lengthAB
,
double
&
lengthCB
,
double
&
angle
,
double
&
k1
,
double
&
k2
)
const
;
double
&
lengthCB
,
double
&
angle
,
double
&
k1
,
double
&
k2
)
const
;
/**
* Get the force field parameters for a stretch-bend term, provided for
* backwards-compatibility. Since the two force constants may be different,
* you are recommended to call the other version of getStretchBendParameters
* with both a k1 and k2
*
* @param index the index of the stretch-bend for which to get parameters
* @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param angle the equilibrium angle in radians
* @param k1 the force constant
*/
void
getStretchBendParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
double
&
lengthAB
,
double
&
lengthCB
,
double
&
angle
,
double
&
k1
)
const
;
/**
/**
* Set the force field parameters for a stretch-bend term.
* Set the force field parameters for a stretch-bend term.
*
*
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
480c695c
...
@@ -483,7 +483,7 @@ private:
...
@@ -483,7 +483,7 @@ private:
};
};
CudaCalcAmoebaStretchBendForceKernel
::
CudaCalcAmoebaStretchBendForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CudaCalcAmoebaStretchBendForceKernel
::
CudaCalcAmoebaStretchBendForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcAmoebaStretchBendForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
CalcAmoebaStretchBendForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
1
(
NULL
),
params2
(
NULL
)
{
}
}
CudaCalcAmoebaStretchBendForceKernel
::~
CudaCalcAmoebaStretchBendForceKernel
()
{
CudaCalcAmoebaStretchBendForceKernel
::~
CudaCalcAmoebaStretchBendForceKernel
()
{
...
@@ -539,14 +539,17 @@ void CudaCalcAmoebaStretchBendForceKernel::copyParametersToContext(ContextImpl&
...
@@ -539,14 +539,17 @@ void CudaCalcAmoebaStretchBendForceKernel::copyParametersToContext(ContextImpl&
// Record the per-stretch-bend parameters.
// Record the per-stretch-bend parameters.
vector
<
float4
>
paramVector
(
numStretchBends
);
vector
<
float3
>
paramVector
(
numStretchBends
);
vector
<
float2
>
paramVector1
(
numStretchBends
);
for
(
int
i
=
0
;
i
<
numStretchBends
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numStretchBends
;
i
++
)
{
int
atom1
,
atom2
,
atom3
;
int
atom1
,
atom2
,
atom3
;
double
lengthAB
,
lengthCB
,
angle
,
k
;
double
lengthAB
,
lengthCB
,
angle
,
k1
,
k2
;
force
.
getStretchBendParameters
(
startIndex
+
i
,
atom1
,
atom2
,
atom3
,
lengthAB
,
lengthCB
,
angle
,
k
);
force
.
getStretchBendParameters
(
startIndex
+
i
,
atom1
,
atom2
,
atom3
,
lengthAB
,
lengthCB
,
angle
,
k1
,
k2
);
paramVector
[
i
]
=
make_float4
((
float
)
lengthAB
,
(
float
)
lengthCB
,
(
float
)
angle
,
(
float
)
k
);
paramVector
[
i
]
=
make_float3
((
float
)
lengthAB
,
(
float
)
lengthCB
,
(
float
)
angle
);
paramVector1
[
i
]
=
make_flaot2
((
float
)
k1
,
(
float
)
k2
);
}
}
params
->
upload
(
paramVector
);
params1
->
upload
(
paramVector
);
params2
->
upload
(
paramVector1
);
// Mark that the current reordering may be invalid.
// Mark that the current reordering may be invalid.
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
View file @
480c695c
...
@@ -52,7 +52,7 @@ using OpenMM::RealVec;
...
@@ -52,7 +52,7 @@ using OpenMM::RealVec;
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateStretchBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateStretchBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
const
RealVec
&
positionAtomC
,
RealOpenMM
lengthAB
,
RealOpenMM
lengthCB
,
RealOpenMM
lengthAB
,
RealOpenMM
lengthCB
,
RealOpenMM
idealAngle
,
RealOpenMM
kParameter
,
RealOpenMM
idealAngle
,
RealOpenMM
k
1
Parameter
,
RealOpenMM
k2Parameter
,
RealVec
*
forces
)
const
{
RealOpenMM
k2Parameter
,
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -156,7 +156,8 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
...
@@ -156,7 +156,8 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
const
std
::
vector
<
RealOpenMM
>&
lengthABParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthABParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthCBParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthCBParameters
,
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
kQuadratic
,
const
std
::
vector
<
RealOpenMM
>&
k1Quadratic
,
const
std
::
vector
<
RealOpenMM
>&
k2Quadratic
,
vector
<
RealVec
>&
forceData
)
const
{
vector
<
RealVec
>&
forceData
)
const
{
RealOpenMM
energy
=
0.0
;
RealOpenMM
energy
=
0.0
;
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
numStretchBends
);
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
numStretchBends
);
ii
++
)
{
...
@@ -166,10 +167,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
...
@@ -166,10 +167,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
RealOpenMM
abLength
=
lengthABParameters
[
ii
];
RealOpenMM
abLength
=
lengthABParameters
[
ii
];
RealOpenMM
cbLength
=
lengthCBParameters
[
ii
];
RealOpenMM
cbLength
=
lengthCBParameters
[
ii
];
RealOpenMM
idealAngle
=
angle
[
ii
];
RealOpenMM
idealAngle
=
angle
[
ii
];
RealOpenMM
angleK
=
kQuadratic
[
ii
];
RealOpenMM
angleK1
=
k1Quadratic
[
ii
];
RealOpenMM
angleK2
=
k2Quadratic
[
ii
];
RealVec
forces
[
3
];
RealVec
forces
[
3
];
energy
+=
calculateStretchBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
energy
+=
calculateStretchBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
abLength
,
cbLength
,
idealAngle
,
angleK
,
forces
);
abLength
,
cbLength
,
idealAngle
,
angleK
1
,
anglek2
,
forces
);
// accumulate forces
// accumulate forces
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.h
View file @
480c695c
...
@@ -77,7 +77,8 @@ public:
...
@@ -77,7 +77,8 @@ public:
const
std
::
vector
<
RealOpenMM
>&
lengthABParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthABParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthCBParameters
,
const
std
::
vector
<
RealOpenMM
>&
lengthCBParameters
,
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
kQuadratic
,
const
std
::
vector
<
RealOpenMM
>&
k1Quadratic
,
const
std
::
vector
<
RealOpenMM
>&
k2Quadratic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
...
...
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