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
d7b3a3c2
Commit
d7b3a3c2
authored
Jul 22, 2013
by
Lee-Ping Wang
Browse files
Merge branch 'master' of github.com:SimTk/openmm
parents
7bb2bb89
99df6758
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
25 deletions
+104
-25
plugins/drude/platforms/opencl/src/OpenCLDrudeKernelFactory.cpp
...s/drude/platforms/opencl/src/OpenCLDrudeKernelFactory.cpp
+2
-2
plugins/rpmd/platforms/cuda/src/CudaRpmdKernelFactory.cpp
plugins/rpmd/platforms/cuda/src/CudaRpmdKernelFactory.cpp
+2
-2
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
+16
-3
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernelFactory.cpp
...ins/rpmd/platforms/opencl/src/OpenCLRpmdKernelFactory.cpp
+3
-3
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
+16
-3
wrappers/python/simtk/openmm/app/amberprmtopfile.py
wrappers/python/simtk/openmm/app/amberprmtopfile.py
+19
-4
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+38
-8
wrappers/python/simtk/openmm/vec3.py
wrappers/python/simtk/openmm/vec3.py
+4
-0
wrappers/python/src/swig_doxygen/swigInputBuilder.py
wrappers/python/src/swig_doxygen/swigInputBuilder.py
+4
-0
No files found.
plugins/drude/platforms/opencl/src/OpenCLDrudeKernelFactory.cpp
View file @
d7b3a3c2
...
@@ -34,10 +34,10 @@
...
@@ -34,10 +34,10 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
OpenCLDrudeKernelFactory
*
factory
=
new
OpenCLDrudeKernelFactory
();
OpenCLDrudeKernelFactory
*
factory
=
new
OpenCLDrudeKernelFactory
();
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernelFactory.cpp
View file @
d7b3a3c2
...
@@ -34,10 +34,10 @@
...
@@ -34,10 +34,10 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CUDA"
);
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CUDA"
);
CudaRpmdKernelFactory
*
factory
=
new
CudaRpmdKernelFactory
();
CudaRpmdKernelFactory
*
factory
=
new
CudaRpmdKernelFactory
();
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
View file @
d7b3a3c2
...
@@ -296,12 +296,25 @@ void CudaIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& pos
...
@@ -296,12 +296,25 @@ void CudaIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& pos
throw
OpenMMException
(
"RPMDIntegrator: Cannot set positions before the integrator is added to a Context"
);
throw
OpenMMException
(
"RPMDIntegrator: Cannot set positions before the integrator is added to a Context"
);
if
(
pos
.
size
()
!=
numParticles
)
if
(
pos
.
size
()
!=
numParticles
)
throw
OpenMMException
(
"RPMDIntegrator: wrong number of values passed to setPositions()"
);
throw
OpenMMException
(
"RPMDIntegrator: wrong number of values passed to setPositions()"
);
// Adjust the positions based on the current cell offsets.
const
vector
<
int
>&
order
=
cu
.
getAtomIndex
();
double4
periodicBoxSize
=
cu
.
getPeriodicBoxSize
();
vector
<
Vec3
>
offsetPos
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
int4
offset
=
cu
.
getPosCellOffsets
()[
i
];
offsetPos
[
order
[
i
]]
=
pos
[
order
[
i
]]
+
Vec3
(
offset
.
x
*
periodicBoxSize
.
x
,
offset
.
y
*
periodicBoxSize
.
y
,
offset
.
z
*
periodicBoxSize
.
z
);
}
// Record the positions.
CUresult
result
;
CUresult
result
;
if
(
cu
.
getUseDoublePrecision
())
{
if
(
cu
.
getUseDoublePrecision
())
{
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
cu
.
getPosq
().
download
(
posq
);
cu
.
getPosq
().
download
(
posq
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
make_double4
(
p
os
[
i
][
0
],
p
os
[
i
][
1
],
p
os
[
i
][
2
],
posq
[
i
].
w
);
posq
[
i
]
=
make_double4
(
offsetP
os
[
i
][
0
],
offsetP
os
[
i
][
1
],
offsetP
os
[
i
][
2
],
posq
[
i
].
w
);
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
double4
),
&
posq
[
0
],
numParticles
*
sizeof
(
double4
));
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
double4
),
&
posq
[
0
],
numParticles
*
sizeof
(
double4
));
}
}
else
if
(
cu
.
getUseMixedPrecision
())
{
else
if
(
cu
.
getUseMixedPrecision
())
{
...
@@ -309,14 +322,14 @@ void CudaIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& pos
...
@@ -309,14 +322,14 @@ void CudaIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& pos
cu
.
getPosq
().
download
(
posqf
);
cu
.
getPosq
().
download
(
posqf
);
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
make_double4
(
p
os
[
i
][
0
],
p
os
[
i
][
1
],
p
os
[
i
][
2
],
posqf
[
i
].
w
);
posq
[
i
]
=
make_double4
(
offsetP
os
[
i
][
0
],
offsetP
os
[
i
][
1
],
offsetP
os
[
i
][
2
],
posqf
[
i
].
w
);
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
double4
),
&
posq
[
0
],
numParticles
*
sizeof
(
double4
));
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
double4
),
&
posq
[
0
],
numParticles
*
sizeof
(
double4
));
}
}
else
{
else
{
vector
<
float4
>
posq
(
cu
.
getPaddedNumAtoms
());
vector
<
float4
>
posq
(
cu
.
getPaddedNumAtoms
());
cu
.
getPosq
().
download
(
posq
);
cu
.
getPosq
().
download
(
posq
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
make_float4
((
float
)
p
os
[
i
][
0
],
(
float
)
p
os
[
i
][
1
],
(
float
)
p
os
[
i
][
2
],
posq
[
i
].
w
);
posq
[
i
]
=
make_float4
((
float
)
offsetP
os
[
i
][
0
],
(
float
)
offsetP
os
[
i
][
1
],
(
float
)
offsetP
os
[
i
][
2
],
posq
[
i
].
w
);
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
float4
),
&
posq
[
0
],
numParticles
*
sizeof
(
float4
));
result
=
cuMemcpyHtoD
(
positions
->
getDevicePointer
()
+
copy
*
cu
.
getPaddedNumAtoms
()
*
sizeof
(
float4
),
&
posq
[
0
],
numParticles
*
sizeof
(
float4
));
}
}
if
(
result
!=
CUDA_SUCCESS
)
{
if
(
result
!=
CUDA_SUCCESS
)
{
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernelFactory.cpp
View file @
d7b3a3c2
...
@@ -28,16 +28,16 @@
...
@@ -28,16 +28,16 @@
#include "OpenCLRpmdKernelFactory.h"
#include "OpenCLRpmdKernelFactory.h"
#include "OpenCLRpmdKernels.h"
#include "OpenCLRpmdKernels.h"
#include "openmm/internal/windowsExport.h"
#include "openmm/internal/windowsExport
Rpmd
.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/OpenMMException.h"
#include "openmm/OpenMMException.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
OpenCLRpmdKernelFactory
*
factory
=
new
OpenCLRpmdKernelFactory
();
OpenCLRpmdKernelFactory
*
factory
=
new
OpenCLRpmdKernelFactory
();
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
View file @
d7b3a3c2
...
@@ -312,11 +312,24 @@ void OpenCLIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& p
...
@@ -312,11 +312,24 @@ void OpenCLIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& p
throw
OpenMMException
(
"RPMDIntegrator: Cannot set positions before the integrator is added to a Context"
);
throw
OpenMMException
(
"RPMDIntegrator: Cannot set positions before the integrator is added to a Context"
);
if
(
pos
.
size
()
!=
numParticles
)
if
(
pos
.
size
()
!=
numParticles
)
throw
OpenMMException
(
"RPMDIntegrator: wrong number of values passed to setPositions()"
);
throw
OpenMMException
(
"RPMDIntegrator: wrong number of values passed to setPositions()"
);
// Adjust the positions based on the current cell offsets.
const
vector
<
int
>&
order
=
cl
.
getAtomIndex
();
mm_double4
periodicBoxSize
=
cl
.
getPeriodicBoxSizeDouble
();
vector
<
Vec3
>
offsetPos
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
mm_int4
offset
=
cl
.
getPosCellOffsets
()[
i
];
offsetPos
[
order
[
i
]]
=
pos
[
order
[
i
]]
+
Vec3
(
offset
.
x
*
periodicBoxSize
.
x
,
offset
.
y
*
periodicBoxSize
.
y
,
offset
.
z
*
periodicBoxSize
.
z
);
}
// Record the positions.
if
(
cl
.
getUseDoublePrecision
())
{
if
(
cl
.
getUseDoublePrecision
())
{
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
cl
.
getPosq
().
download
(
posq
);
cl
.
getPosq
().
download
(
posq
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
mm_double4
(
p
os
[
i
][
0
],
p
os
[
i
][
1
],
p
os
[
i
][
2
],
posq
[
i
].
w
);
posq
[
i
]
=
mm_double4
(
offsetP
os
[
i
][
0
],
offsetP
os
[
i
][
1
],
offsetP
os
[
i
][
2
],
posq
[
i
].
w
);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_double4
),
numParticles
*
sizeof
(
mm_double4
),
&
posq
[
0
]);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_double4
),
numParticles
*
sizeof
(
mm_double4
),
&
posq
[
0
]);
}
}
else
if
(
cl
.
getUseMixedPrecision
())
{
else
if
(
cl
.
getUseMixedPrecision
())
{
...
@@ -324,14 +337,14 @@ void OpenCLIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& p
...
@@ -324,14 +337,14 @@ void OpenCLIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& p
cl
.
getPosq
().
download
(
posqf
);
cl
.
getPosq
().
download
(
posqf
);
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
mm_double4
(
p
os
[
i
][
0
],
p
os
[
i
][
1
],
p
os
[
i
][
2
],
posqf
[
i
].
w
);
posq
[
i
]
=
mm_double4
(
offsetP
os
[
i
][
0
],
offsetP
os
[
i
][
1
],
offsetP
os
[
i
][
2
],
posqf
[
i
].
w
);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_double4
),
numParticles
*
sizeof
(
mm_double4
),
&
posq
[
0
]);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_double4
),
numParticles
*
sizeof
(
mm_double4
),
&
posq
[
0
]);
}
}
else
{
else
{
vector
<
mm_float4
>
posq
(
cl
.
getPaddedNumAtoms
());
vector
<
mm_float4
>
posq
(
cl
.
getPaddedNumAtoms
());
cl
.
getPosq
().
download
(
posq
);
cl
.
getPosq
().
download
(
posq
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
posq
[
i
]
=
mm_float4
((
cl_float
)
p
os
[
i
][
0
],
(
cl_float
)
p
os
[
i
][
1
],
(
cl_float
)
p
os
[
i
][
2
],
posq
[
i
].
w
);
posq
[
i
]
=
mm_float4
((
cl_float
)
offsetP
os
[
i
][
0
],
(
cl_float
)
offsetP
os
[
i
][
1
],
(
cl_float
)
offsetP
os
[
i
][
2
],
posq
[
i
].
w
);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_float4
),
numParticles
*
sizeof
(
mm_float4
),
&
posq
[
0
]);
cl
.
getQueue
().
enqueueWriteBuffer
(
positions
->
getDeviceBuffer
(),
CL_TRUE
,
copy
*
cl
.
getPaddedNumAtoms
()
*
sizeof
(
mm_float4
),
numParticles
*
sizeof
(
mm_float4
),
&
posq
[
0
]);
}
}
}
}
...
...
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
d7b3a3c2
...
@@ -41,10 +41,25 @@ import simtk.openmm as mm
...
@@ -41,10 +41,25 @@ import simtk.openmm as mm
# Enumerated values for implicit solvent model
# Enumerated values for implicit solvent model
HCT
=
object
()
class
HCT
(
object
):
OBC1
=
object
()
def
__repr__
(
self
):
OBC2
=
object
()
return
'HCT'
GBn
=
object
()
HCT
=
HCT
()
class
OBC1
(
object
):
def
__repr__
(
self
):
return
'OBC1'
OBC1
=
OBC1
()
class
OBC2
(
object
):
def
__repr__
(
self
):
return
'OBC2'
OBC2
=
OBC2
()
class
GBn
(
object
):
def
__repr__
(
self
):
return
'GBn'
GBn
=
GBn
()
class
AmberPrmtopFile
(
object
):
class
AmberPrmtopFile
(
object
):
"""AmberPrmtopFile parses an AMBER prmtop file and constructs a Topology and (optionally) an OpenMM System from it."""
"""AmberPrmtopFile parses an AMBER prmtop file and constructs a Topology and (optionally) an OpenMM System from it."""
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
d7b3a3c2
...
@@ -42,17 +42,47 @@ from simtk.openmm.app import Topology
...
@@ -42,17 +42,47 @@ from simtk.openmm.app import Topology
# Enumerated values for nonbonded method
# Enumerated values for nonbonded method
NoCutoff
=
object
()
class
NoCutoff
(
object
):
CutoffNonPeriodic
=
object
()
def
__repr__
(
self
):
CutoffPeriodic
=
object
()
return
'NoCutoff'
Ewald
=
object
()
NoCutoff
=
NoCutoff
()
PME
=
object
()
class
CutoffNonPeriodic
(
object
):
def
__repr__
(
self
):
return
'CutoffNonPeriodic'
CutoffNonPeriodic
=
CutoffNonPeriodic
()
class
CutoffPeriodic
(
object
):
def
__repr__
(
self
):
return
'CutoffPeriodic'
CutoffPeriodic
=
CutoffPeriodic
()
class
Ewald
(
object
):
def
__repr__
(
self
):
return
'Ewald'
Ewald
=
Ewald
()
class
PME
(
object
):
def
__repr__
(
self
):
return
'PME'
PME
=
PME
()
# Enumerated values for constraint type
# Enumerated values for constraint type
HBonds
=
object
()
class
HBonds
(
object
):
AllBonds
=
object
()
def
__repr__
(
self
):
HAngles
=
object
()
return
'HBonds'
HBonds
=
HBonds
()
class
AllBonds
(
object
):
def
__repr__
(
self
):
return
'AllBonds'
AllBonds
=
AllBonds
()
class
HAngles
(
object
):
def
__repr__
(
self
):
return
'HAngles'
HAngles
=
HAngles
()
# A map of functions to parse elements of the XML file.
# A map of functions to parse elements of the XML file.
...
...
wrappers/python/simtk/openmm/vec3.py
View file @
d7b3a3c2
...
@@ -40,6 +40,10 @@ class Vec3(tuple):
...
@@ -40,6 +40,10 @@ class Vec3(tuple):
"""Create a new Vec3."""
"""Create a new Vec3."""
return
tuple
.
__new__
(
cls
,
(
x
,
y
,
z
))
return
tuple
.
__new__
(
cls
,
(
x
,
y
,
z
))
def
__getnewargs__
(
self
):
"Support for pickle protocol 2: http://docs.python.org/2/library/pickle.html#pickling-and-unpickling-normal-class-instances"
return
self
[
0
],
self
[
1
],
self
[
2
]
def
__add__
(
self
,
other
):
def
__add__
(
self
,
other
):
"""Add two Vec3s."""
"""Add two Vec3s."""
return
Vec3
(
self
[
0
]
+
other
[
0
],
self
[
1
]
+
other
[
1
],
self
[
2
]
+
other
[
2
])
return
Vec3
(
self
[
0
]
+
other
[
0
],
self
[
1
]
+
other
[
1
],
self
[
2
]
+
other
[
2
])
...
...
wrappers/python/src/swig_doxygen/swigInputBuilder.py
View file @
d7b3a3c2
...
@@ -218,6 +218,10 @@ class SwigInputBuilder:
...
@@ -218,6 +218,10 @@ class SwigInputBuilder:
for
name
in
sorted
(
integratorSubclassList
):
for
name
in
sorted
(
integratorSubclassList
):
self
.
fOut
.
write
(
",
\n
OpenMM::%s"
%
name
)
self
.
fOut
.
write
(
",
\n
OpenMM::%s"
%
name
)
self
.
fOut
.
write
(
");
\n\n
"
)
self
.
fOut
.
write
(
");
\n\n
"
)
self
.
fOut
.
write
(
"%factory(OpenMM::Integrator& OpenMM::Context::getIntegrator"
)
for
name
in
sorted
(
integratorSubclassList
):
self
.
fOut
.
write
(
",
\n
OpenMM::%s"
%
name
)
self
.
fOut
.
write
(
");
\n\n
"
)
self
.
fOut
.
write
(
"%factory(OpenMM::VirtualSite& OpenMM::System::getVirtualSite, OpenMM::TwoParticleAverageSite, OpenMM::ThreeParticleAverageSite, OpenMM::OutOfPlaneSite);
\n\n
"
)
self
.
fOut
.
write
(
"%factory(OpenMM::VirtualSite& OpenMM::System::getVirtualSite, OpenMM::TwoParticleAverageSite, OpenMM::ThreeParticleAverageSite, OpenMM::OutOfPlaneSite);
\n\n
"
)
self
.
fOut
.
write
(
"
\n
"
)
self
.
fOut
.
write
(
"
\n
"
)
...
...
Prev
1
2
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