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
7bfb75c7
Commit
7bfb75c7
authored
Jul 20, 2013
by
Lee-Ping Wang
Browse files
Merge branch 'master' of github.com:SimTk/openmm
parents
a85d163b
49cb91c5
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
25 deletions
+96
-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
No files found.
plugins/drude/platforms/opencl/src/OpenCLDrudeKernelFactory.cpp
View file @
7bfb75c7
...
...
@@ -34,10 +34,10 @@
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
OpenCLDrudeKernelFactory
*
factory
=
new
OpenCLDrudeKernelFactory
();
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernelFactory.cpp
View file @
7bfb75c7
...
...
@@ -34,10 +34,10 @@
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CUDA"
);
CudaRpmdKernelFactory
*
factory
=
new
CudaRpmdKernelFactory
();
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
View file @
7bfb75c7
...
...
@@ -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"
);
if
(
pos
.
size
()
!=
numParticles
)
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
;
if
(
cu
.
getUseDoublePrecision
())
{
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
cu
.
getPosq
().
download
(
posq
);
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
));
}
else
if
(
cu
.
getUseMixedPrecision
())
{
...
...
@@ -309,14 +322,14 @@ void CudaIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& pos
cu
.
getPosq
().
download
(
posqf
);
vector
<
double4
>
posq
(
cu
.
getPaddedNumAtoms
());
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
));
}
else
{
vector
<
float4
>
posq
(
cu
.
getPaddedNumAtoms
());
cu
.
getPosq
().
download
(
posq
);
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
));
}
if
(
result
!=
CUDA_SUCCESS
)
{
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernelFactory.cpp
View file @
7bfb75c7
...
...
@@ -28,16 +28,16 @@
#include "OpenCLRpmdKernelFactory.h"
#include "OpenCLRpmdKernels.h"
#include "openmm/internal/windowsExport.h"
#include "openmm/internal/windowsExport
Rpmd
.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/OpenMMException.h"
using
namespace
OpenMM
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"OpenCL"
);
OpenCLRpmdKernelFactory
*
factory
=
new
OpenCLRpmdKernelFactory
();
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
View file @
7bfb75c7
...
...
@@ -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"
);
if
(
pos
.
size
()
!=
numParticles
)
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
())
{
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
cl
.
getPosq
().
download
(
posq
);
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
]);
}
else
if
(
cl
.
getUseMixedPrecision
())
{
...
...
@@ -324,14 +337,14 @@ void OpenCLIntegrateRPMDStepKernel::setPositions(int copy, const vector<Vec3>& p
cl
.
getPosq
().
download
(
posqf
);
vector
<
mm_double4
>
posq
(
cl
.
getPaddedNumAtoms
());
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
]);
}
else
{
vector
<
mm_float4
>
posq
(
cl
.
getPaddedNumAtoms
());
cl
.
getPosq
().
download
(
posq
);
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
]);
}
}
...
...
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
7bfb75c7
...
...
@@ -41,10 +41,25 @@ import simtk.openmm as mm
# Enumerated values for implicit solvent model
HCT
=
object
()
OBC1
=
object
()
OBC2
=
object
()
GBn
=
object
()
class
HCT
(
object
):
def
__repr__
(
self
):
return
'HCT'
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
):
"""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 @
7bfb75c7
...
...
@@ -42,17 +42,47 @@ from simtk.openmm.app import Topology
# Enumerated values for nonbonded method
NoCutoff
=
object
()
CutoffNonPeriodic
=
object
()
CutoffPeriodic
=
object
()
Ewald
=
object
()
PME
=
object
()
class
NoCutoff
(
object
):
def
__repr__
(
self
):
return
'NoCutoff'
NoCutoff
=
NoCutoff
()
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
HBonds
=
object
()
AllBonds
=
object
()
HAngles
=
object
()
class
HBonds
(
object
):
def
__repr__
(
self
):
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.
...
...
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