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
b86e12ce
Commit
b86e12ce
authored
Nov 12, 2008
by
Peter Eastman
Browse files
Fixed several bugs in OpenMM
parent
d2638082
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
15 deletions
+29
-15
openmmapi/src/NonbondedForceImpl.cpp
openmmapi/src/NonbondedForceImpl.cpp
+21
-7
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+2
-3
platforms/cuda/src/CudaPlatform.cpp
platforms/cuda/src/CudaPlatform.cpp
+2
-1
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+2
-2
No files found.
openmmapi/src/NonbondedForceImpl.cpp
View file @
b86e12ce
...
@@ -51,21 +51,35 @@ void NonbondedForceImpl::initialize(OpenMMContextImpl& context) {
...
@@ -51,21 +51,35 @@ void NonbondedForceImpl::initialize(OpenMMContextImpl& context) {
System
&
system
=
context
.
getSystem
();
System
&
system
=
context
.
getSystem
();
vector
<
set
<
int
>
>
exclusions
(
owner
.
getNumParticles
());
vector
<
set
<
int
>
>
exclusions
(
owner
.
getNumParticles
());
vector
<
vector
<
int
>
>
bondIndices
;
set
<
pair
<
int
,
int
>
>
bonded14set
;
for
(
int
i
=
0
;
i
<
system
.
getNumForces
();
i
++
)
{
for
(
int
i
=
0
;
i
<
system
.
getNumForces
();
i
++
)
{
if
(
dynamic_cast
<
HarmonicBondForce
*>
(
&
system
.
getForce
(
i
))
!=
NULL
)
{
if
(
dynamic_cast
<
HarmonicBondForce
*>
(
&
system
.
getForce
(
i
))
!=
NULL
)
{
const
HarmonicBondForce
&
force
=
dynamic_cast
<
const
HarmonicBondForce
&>
(
system
.
getForce
(
i
));
const
HarmonicBondForce
&
force
=
dynamic_cast
<
const
HarmonicBondForce
&>
(
system
.
getForce
(
i
));
vector
<
vector
<
int
>
>
bondIndices
(
force
.
getNumBonds
());
bondIndices
.
resize
(
force
.
getNumBonds
());
set
<
pair
<
int
,
int
>
>
bonded14set
;
for
(
int
j
=
0
;
j
<
force
.
getNumBonds
();
++
j
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
++
i
)
{
int
particle1
,
particle2
;
int
particle1
,
particle2
;
double
length
,
k
;
double
length
,
k
;
force
.
getBondParameters
(
i
,
particle1
,
particle2
,
length
,
k
);
force
.
getBondParameters
(
j
,
particle1
,
particle2
,
length
,
k
);
bondIndices
[
i
].
push_back
(
particle1
);
bondIndices
[
j
].
push_back
(
particle1
);
bondIndices
[
i
].
push_back
(
particle2
);
bondIndices
[
j
].
push_back
(
particle2
);
}
}
findExclusions
(
bondIndices
,
exclusions
,
bonded14set
)
;
break
;
}
}
}
}
// Also treat constrained distances as bonds.
int
numBonds
=
bondIndices
.
size
();
bondIndices
.
resize
(
numBonds
+
system
.
getNumConstraints
());
for
(
int
j
=
0
;
j
<
system
.
getNumConstraints
();
j
++
)
{
int
particle1
,
particle2
;
double
distance
;
system
.
getConstraintParameters
(
j
,
particle1
,
particle2
,
distance
);
bondIndices
[
j
+
numBonds
].
push_back
(
particle1
);
bondIndices
[
j
+
numBonds
].
push_back
(
particle2
);
}
findExclusions
(
bondIndices
,
exclusions
,
bonded14set
);
dynamic_cast
<
CalcNonbondedForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
,
exclusions
);
dynamic_cast
<
CalcNonbondedForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
,
exclusions
);
}
}
...
...
platforms/cuda/src/CudaKernels.cpp
View file @
b86e12ce
...
@@ -269,9 +269,8 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
...
@@ -269,9 +269,8 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
force
.
getNonbonded14Parameters
(
i
,
particle1
[
i
],
particle2
[
i
],
charge
,
sig
,
eps
);
force
.
getNonbonded14Parameters
(
i
,
particle1
[
i
],
particle2
[
i
],
charge
,
sig
,
eps
);
c6
[
i
]
=
(
float
)
(
4
*
eps
*
pow
(
sig
,
6.0
));
c6
[
i
]
=
(
float
)
(
4
*
eps
*
pow
(
sig
,
6.0
));
c12
[
i
]
=
(
float
)
(
4
*
eps
*
pow
(
sig
,
12.0
));
c12
[
i
]
=
(
float
)
(
4
*
eps
*
pow
(
sig
,
12.0
));
float
q
=
(
float
)
std
::
sqrt
(
charge
);
q1
[
i
]
=
(
float
)
charge
;
q1
[
i
]
=
q
;
q2
[
i
]
=
1.0
f
;
q2
[
i
]
=
q
;
}
}
gpuSetLJ14Parameters
(
gpu
,
138.935485
f
,
1.0
f
,
particle1
,
particle2
,
c6
,
c12
,
q1
,
q2
);
gpuSetLJ14Parameters
(
gpu
,
138.935485
f
,
1.0
f
,
particle1
,
particle2
,
c6
,
c12
,
q1
,
q2
);
}
}
...
...
platforms/cuda/src/CudaPlatform.cpp
View file @
b86e12ce
...
@@ -40,7 +40,8 @@
...
@@ -40,7 +40,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
extern
"C"
void
initOpenMMPlugin
()
{
extern
"C"
void
initOpenMMPlugin
()
{
Platform
::
registerPlatform
(
new
CudaPlatform
());
if
(
gpuIsAvailable
())
Platform
::
registerPlatform
(
new
CudaPlatform
());
}
}
CudaPlatform
::
CudaPlatform
()
{
CudaPlatform
::
CudaPlatform
()
{
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
b86e12ce
...
@@ -378,8 +378,8 @@ double ReferenceCalcNonbondedForceKernel::executeEnergy(OpenMMContextImpl& conte
...
@@ -378,8 +378,8 @@ double ReferenceCalcNonbondedForceKernel::executeEnergy(OpenMMContextImpl& conte
ReferenceLJCoulomb14
nonbonded14
;
ReferenceLJCoulomb14
nonbonded14
;
if
(
nonbondedMethod
!=
NoCutoff
)
if
(
nonbondedMethod
!=
NoCutoff
)
nonbonded14
.
setUseCutoff
(
nonbondedCutoff
,
78.3
f
);
nonbonded14
.
setUseCutoff
(
nonbondedCutoff
,
78.3
f
);
RealOpenMM
*
energyArray
=
new
RealOpenMM
[
num
Particles
];
RealOpenMM
*
energyArray
=
new
RealOpenMM
[
num
14
];
for
(
int
i
=
0
;
i
<
num
Particles
;
++
i
)
for
(
int
i
=
0
;
i
<
num
14
;
++
i
)
energyArray
[
i
]
=
0
;
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
nonbonded14
);
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
nonbonded14
);
disposeRealArray
(
forceData
,
numParticles
);
disposeRealArray
(
forceData
,
numParticles
);
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
b86e12ce
...
@@ -243,7 +243,7 @@ int ReferenceLJCoulombIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** ato
...
@@ -243,7 +243,7 @@ int ReferenceLJCoulombIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** ato
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
ReferenceLJCoulombIxn
::
calculateOneIxn
(
int
ii
,
int
jj
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceLJCoulombIxn
::
calculateOneIxn
(
int
ii
,
int
jj
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
forces
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
{
...
@@ -294,7 +294,7 @@ int ReferenceLJCoulombIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** ato
...
@@ -294,7 +294,7 @@ int ReferenceLJCoulombIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** ato
else
else
dEdR
+=
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
;
dEdR
+=
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
;
dEdR
*=
inverseR
*
inverseR
;
dEdR
*=
inverseR
*
inverseR
;
// accumulate forces
// accumulate forces
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
...
...
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