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
08c2e027
Commit
08c2e027
authored
Dec 16, 2008
by
Mark Friedrichs
Browse files
Mods
parent
9936ec46
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
265 additions
and
33 deletions
+265
-33
platforms/brook/src/BrookBondParameters.cpp
platforms/brook/src/BrookBondParameters.cpp
+14
-14
platforms/brook/src/BrookCalcHarmonicBondForceKernel.cpp
platforms/brook/src/BrookCalcHarmonicBondForceKernel.cpp
+3
-1
platforms/brook/src/BrookCalcNonbondedForceKernel.cpp
platforms/brook/src/BrookCalcNonbondedForceKernel.cpp
+1
-1
platforms/brook/src/BrookPlatform.cpp
platforms/brook/src/BrookPlatform.cpp
+12
-2
platforms/brook/src/OpenMMBrookInterface.cpp
platforms/brook/src/OpenMMBrookInterface.cpp
+164
-8
platforms/brook/src/OpenMMBrookInterface.h
platforms/brook/src/OpenMMBrookInterface.h
+71
-7
No files found.
platforms/brook/src/BrookBondParameters.cpp
View file @
08c2e027
...
...
@@ -48,6 +48,7 @@ using namespace std;
BrookBondParameters
::
BrookBondParameters
(
std
::
string
bondName
,
int
numberOfParticlesInBond
,
int
numberOfParametersInBond
,
int
numberOfBonds
,
FILE
*
log
=
NULL
)
:
_bondName
(
bondName
),
_numberOfParticlesInBond
(
numberOfParticlesInBond
),
_numberOfParametersInBond
(
numberOfParametersInBond
),
_numberOfBonds
(
numberOfBonds
),
_log
(
log
){
...
...
@@ -212,21 +213,13 @@ int BrookBondParameters::setBond( int bondIndex, int* particleIndices, double* b
// load'em up
int
numberOfParticlesInBond
=
getNumberOfParticlesInBond
();
std
::
vector
<
int
>
indices
;
_particleIndices
[
bondIndex
]
=
indices
;
indices
.
resize
(
numberOfParticlesInBond
);
for
(
int
ii
=
0
;
ii
<
numberOfParticlesInBond
;
ii
++
){
indices
[
ii
]
=
particleIndices
[
ii
];
_particleIndices
[
bondIndex
].
push_back
(
particleIndices
[
ii
]
)
;
}
int
numberOfParametersInBond
=
getNumberOfParametersInBond
();
std
::
vector
<
double
>
parameters
;
_bondParameters
[
bondIndex
]
=
parameters
;
parameters
.
resize
(
numberOfParametersInBond
);
for
(
int
ii
=
0
;
ii
<
numberOfParametersInBond
;
ii
++
){
p
arameters
[
ii
]
=
bondParameters
[
ii
];
_bondP
arameters
[
bondIndex
].
push_back
(
bondParameters
[
ii
]
)
;
}
// ---------------------------------------------------------------------------------------
...
...
@@ -317,16 +310,19 @@ std::string BrookBondParameters::getContentsString( int level ) const {
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOfParametersInBond
()
);
message
<<
_getLine
(
tab
,
"Parameters/bond:"
,
value
);
//(void) fprintf( getLog(), "%s %s QQQ1\n", methodName.c_str(), message.str().c_str() ); (void) fflush( getLog() );
message
<<
"Bonds:"
<<
std
::
endl
;
for
(
int
ii
=
0
;
ii
<
getNumberOfBonds
();
ii
++
){
const
static
size_t
descriptionSz
=
256
;
char
description
[
256
];
char
buffer
[
256
];
const
static
size_t
descriptionSz
=
1024
;
char
description
[
1024
];
char
buffer
[
1024
];
(
void
)
LOCAL_SPRINTF
(
description
,
"%6d ["
,
ii
);
#ifdef WIN32
// particle indices
#ifdef WIN32
for
(
int
jj
=
0
;
jj
<
getNumberOfParticlesInBond
();
jj
++
){
(
void
)
LOCAL_SPRINTF
(
buffer
,
"%6d "
,
_particleIndices
[
ii
][
jj
]
);
(
void
)
strcat_s
(
description
,
descriptionSz
,
buffer
);
...
...
@@ -339,8 +335,12 @@ std::string BrookBondParameters::getContentsString( int level ) const {
(
void
)
LOCAL_SPRINTF
(
buffer
,
"%18.10e "
,
_bondParameters
[
ii
][
jj
]
);
(
void
)
strcat_s
(
description
,
descriptionSz
,
buffer
);
}
(
void
)
strcat_s
(
description
,
descriptionSz
,
"]"
);
#else
// particle indices
for
(
int
jj
=
0
;
jj
<
getNumberOfParticlesInBond
();
jj
++
){
(
void
)
LOCAL_SPRINTF
(
buffer
,
"%6d "
,
_particleIndices
[
ii
][
jj
]
);
(
void
)
strcat
(
description
,
buffer
);
...
...
platforms/brook/src/BrookCalcHarmonicBondForceKernel.cpp
View file @
08c2e027
...
...
@@ -131,6 +131,8 @@ void BrookCalcHarmonicBondForceKernel::initialize( const System& system, const H
// ---------------------------------------------------------------------------------------
//(void) fprintf( getLog(), "%s\n", methodName.c_str() ); (void) fflush( getLog() );
// create _brookBondParameters object containing particle indices/parameters
int
numberOfBonds
=
force
.
getNumBonds
();
...
...
@@ -182,7 +184,7 @@ void BrookCalcHarmonicBondForceKernel::executeForces( OpenMMContextImpl& context
// ---------------------------------------------------------------------------------------
//
static const std::string methodName = "BrookCalcHarmonicBondForceKernel::executeForces";
static
const
std
::
string
methodName
=
"BrookCalcHarmonicBondForceKernel::executeForces"
;
// ---------------------------------------------------------------------------------------
...
...
platforms/brook/src/BrookCalcNonbondedForceKernel.cpp
View file @
08c2e027
...
...
@@ -251,7 +251,7 @@ void BrookCalcNonbondedForceKernel::initialize14Interactions( const System& syst
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
}
_openMMBrookInterface
.
setNonBonded14ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setNonBonded14ForceParameters
(
_brookBondParameters
,
1.0
,
1.0
);
if
(
log
){
std
::
string
contents
=
_brookBondParameters
->
getContentsString
(
);
...
...
platforms/brook/src/BrookPlatform.cpp
View file @
08c2e027
...
...
@@ -345,6 +345,16 @@ double BrookPlatform::getSpeed() const {
return
10.0
;
}
/**
* Return particle stream width
*
* @return particle stream width
*/
int
BrookPlatform
::
getParticleStreamWidth
()
const
{
return
_particleStreamWidth
;
}
/**
* Return true if BrookPlatform supports double precison
*
...
...
@@ -393,7 +403,7 @@ int BrookPlatform::getStreamSize( int size, int streamWidth, int* outputHeight )
// ---------------------------------------------------------------------------------------
if
(
streamWidth
<
1
||
size
<
1
){
if
(
streamWidth
<
1
||
size
<
1
){
return
-
1
;
}
...
...
@@ -446,7 +456,7 @@ void BrookPlatform::contextCreated( OpenMMContextImpl& context ) const {
// ---------------------------------------------------------------------------------------
context
.
setPlatformData
(
new
OpenMMBrookInterface
()
);
context
.
setPlatformData
(
new
OpenMMBrookInterface
(
getParticleStreamWidth
()
)
);
}
/**
...
...
platforms/brook/src/OpenMMBrookInterface.cpp
View file @
08c2e027
...
...
@@ -46,7 +46,7 @@ using namespace std;
*
*/
OpenMMBrookInterface
::
OpenMMBrookInterface
(
void
){
OpenMMBrookInterface
::
OpenMMBrookInterface
(
int
streamWidth
)
:
_particleStreamWidth
(
streamWidth
){
// ---------------------------------------------------------------------------------------
...
...
@@ -76,6 +76,14 @@ OpenMMBrookInterface::OpenMMBrookInterface( void ){
_referencePlatform
=
NULL
;
_refVerletIntegrator
=
NULL
;
_lj14Scale
=
1.0
;
_coulomb14Scale
=
1.0
;
_particleStreamSize
=
-
1
;
for
(
int
ii
=
0
;
ii
<
LastBondForce
;
ii
++
){
_bondParameters
[
ii
]
=
NULL
;
}
}
/**
...
...
@@ -93,6 +101,10 @@ OpenMMBrookInterface::~OpenMMBrookInterface( ){
delete
_brookBonded
;
delete
_brookNonBonded
;
delete
_brookGbsa
;
for
(
int
ii
=
0
;
ii
<
LastBondForce
;
ii
++
){
delete
_bondParameters
[
ii
];
}
// deleted w/ kernel delete? If activated, program crashes
...
...
@@ -105,6 +117,65 @@ OpenMMBrookInterface::~OpenMMBrookInterface( ){
*/
}
/**
* Get number of particles
*
* @return number of particles
*
*/
int
OpenMMBrookInterface
::
getNumberOfParticles
(
void
)
const
{
return
_numberOfParticles
;
}
/**
* Get particle stream width
*
* @return particle stream width
*
*/
int
OpenMMBrookInterface
::
getParticleStreamWidth
(
void
)
const
{
return
_particleStreamWidth
;
}
/**
* Get particle stream size
*
* @return particle stream size
*
*/
int
OpenMMBrookInterface
::
getParticleStreamSize
(
void
)
const
{
if
(
_particleStreamSize
<
0
&&
_numberOfParticles
>
0
){
OpenMMBrookInterface
*
localThis
=
const_cast
<
OpenMMBrookInterface
*
const
>
(
this
);
localThis
->
_particleStreamSize
=
BrookPlatform
::
getStreamSize
(
_numberOfParticles
,
_particleStreamWidth
,
NULL
);
}
return
_particleStreamSize
;
}
/**
* Get LJ-14 scale factor
*
* @return LJ-14 scale factor
*
*/
double
OpenMMBrookInterface
::
getLj14Scale
(
void
)
const
{
return
_lj14Scale
;
}
/**
* Get Coulomb scale factor
*
* @return Coulomb scale factor
*
*/
double
OpenMMBrookInterface
::
getCoulomb14Scale
(
void
)
const
{
return
_coulomb14Scale
;
}
/**
* Get log file reference
*
...
...
@@ -130,6 +201,19 @@ int OpenMMBrookInterface::setLog( FILE* log ){
return
BrookCommon
::
DefaultReturnValue
;
}
/**
* Get BrookBondParameters at specified index
*
* @param index
*
* @return BrookBondParameters* object
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
_getBondParameters
(
BondParameterIndices
index
)
const
{
return
_bondParameters
[
index
];
}
/**
* Set BrookBondParameters at specified index
*
...
...
@@ -145,6 +229,17 @@ int OpenMMBrookInterface::_setBondParameters( BondParameterIndices index, BrookB
return
BrookCommon
::
DefaultReturnValue
;
}
/**
* Get BrookBondParameters for harmonic bond force
*
* @return brookBondParameters for harmonic bond force
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
getHarmonicBondForceParameters
(
void
)
const
{
return
_getBondParameters
(
HarmonicBondIndex
);
}
/**
* Set BrookBondParameters for harmonic bond force
*
...
...
@@ -155,7 +250,18 @@ int OpenMMBrookInterface::_setBondParameters( BondParameterIndices index, BrookB
*/
int
OpenMMBrookInterface
::
setHarmonicBondForceParameters
(
BrookBondParameters
*
brookBondParameters
){
return
_setBondParameters
(
HarmonicAngleIndex
,
brookBondParameters
);
return
_setBondParameters
(
HarmonicBondIndex
,
brookBondParameters
);
}
/**
* Get BrookBondParameters for harmonic angle force
*
* @return brookBondParameters for harmonic angle force
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
getHarmonicAngleForceParameters
(
void
)
const
{
return
_getBondParameters
(
HarmonicAngleIndex
);
}
/**
...
...
@@ -172,9 +278,20 @@ int OpenMMBrookInterface::setHarmonicAngleForceParameters( BrookBondParameters*
}
/**
* Set BrookBondParameters for proper dihedral force
* Get BrookBondParameters for periodic torsion force
*
* @return brookBondParameters for periodic torsion force
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
getPeriodicTorsionForceParameters
(
void
)
const
{
return
_getBondParameters
(
PeriodicTorsionForceIndex
);
}
/**
* Set BrookBondParameters for periodic torsion force
*
* @param brookBondParameters brookBondParameters for p
roper dihedral
force
* @param brookBondParameters brookBondParameters for p
eriodic torsion
force
*
* @return DefaultReturnValue
*
...
...
@@ -185,9 +302,20 @@ int OpenMMBrookInterface::setPeriodicTorsionForceParameters( BrookBondParameters
}
/**
* Set BrookBondParameters for RB dihedral force
* Get BrookBondParameters for rb torsion force
*
* @return brookBondParameters for rb torsion force
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
getRBTorsionForceParameters
(
void
)
const
{
return
_getBondParameters
(
RbTorsionForceIndex
);
}
/**
* Set BrookBondParameters for RB torsion force
*
* @param brookBondParameters brookBondParameters for RB force
* @param brookBondParameters brookBondParameters for RB
torsion
force
*
* @return DefaultReturnValue
*
...
...
@@ -197,16 +325,32 @@ int OpenMMBrookInterface::setRBTorsionForceParameters( BrookBondParameters* broo
return
_setBondParameters
(
RbTorsionForceIndex
,
brookBondParameters
);
}
/**
* Get BrookBondParameters for LJ 14 force
*
* @return brookBondParameters for LJ 14 force
*
*/
BrookBondParameters
*
OpenMMBrookInterface
::
getNonBonded14ForceParameters
(
void
)
const
{
return
_getBondParameters
(
LJ14Index
);
}
/**
* Set BrookBondParameters for LJ 14 force
*
* @param brookBondParameters brookBondParameters for LJ 14 force
* @param lj14Scale LJ 14 scale factor
* @param coulomb14Scale Coulomb 14 scale factor
*
* @return DefaultReturnValue
*
*/
int
OpenMMBrookInterface
::
setNonBonded14ForceParameters
(
BrookBondParameters
*
brookBondParameters
){
int
OpenMMBrookInterface
::
setNonBonded14ForceParameters
(
BrookBondParameters
*
brookBondParameters
,
double
lj14Scale
,
double
coulomb14Scale
){
_lj14Scale
=
lj14Scale
;
_coulomb14Scale
=
coulomb14Scale
;
return
_setBondParameters
(
LJ14Index
,
brookBondParameters
);
}
...
...
@@ -373,6 +517,8 @@ void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){
// static const int debug = 1;
(
void
)
fprintf
(
stderr
,
"%s "
,
methodName
.
c_str
()
);
(
void
)
fflush
(
stderr
);
// ---------------------------------------------------------------------------------------
// nonbonded forces
...
...
@@ -390,6 +536,16 @@ void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){
if
(
_brookBonded
){
(
void
)
fprintf
(
stderr
,
"%s Bonded"
,
methodName
.
c_str
()
);
(
void
)
fflush
(
stderr
);
// perform setup first time through
if
(
_brookBonded
->
isSetupCompleted
()
==
0
){
_brookBonded
->
setup
(
getNumberOfParticles
(),
getHarmonicBondForceParameters
(),
getHarmonicAngleForceParameters
(),
getPeriodicTorsionForceParameters
(),
getRBTorsionForceParameters
(),
getNonBonded14ForceParameters
(),
getLj14Scale
(),
getCoulomb14Scale
(),
getParticleStreamWidth
(),
getParticleStreamSize
()
);
}
_brookBonded
->
computeForces
(
*
positions
,
*
forces
);
// diagnostics
...
...
platforms/brook/src/OpenMMBrookInterface.h
View file @
08c2e027
...
...
@@ -53,7 +53,7 @@ class OpenMMBrookInterface {
public:
OpenMMBrookInterface
(
void
);
OpenMMBrookInterface
(
int
streamWidth
);
~
OpenMMBrookInterface
();
...
...
@@ -90,6 +90,51 @@ class OpenMMBrookInterface {
std
::
string
getContents
(
int
level
)
const
;
/**
* Get number of particles
*
* @return number of particles
*
*/
int
getNumberOfParticles
(
void
)
const
;
/**
* Get particle stream width
*
* @return particle stream width
*
*/
int
getParticleStreamWidth
(
void
)
const
;
/**
* Get particle stream size
*
* @return particle stream size
*
*/
int
getParticleStreamSize
(
void
)
const
;
/**
* Get LJ-14 scale factor
*
* @return LJ-14 scale factor
*
*/
double
getLj14Scale
(
void
)
const
;
/**
* Get Coulomb scale factor
*
* @return Coulomb scale factor
*
*/
double
getCoulomb14Scale
(
void
)
const
;
/**
* Get log file reference
*
...
...
@@ -169,7 +214,7 @@ class OpenMMBrookInterface {
*
*/
BrookBondParameters
*
getHarmonicBondForceParameters
(
void
);
BrookBondParameters
*
getHarmonicBondForceParameters
(
void
)
const
;
/**
* Set BrookBondParameters for harmonic bond force
...
...
@@ -189,7 +234,7 @@ class OpenMMBrookInterface {
*
*/
BrookBondParameters
*
getHarmonicAngleForceParameters
(
void
);
BrookBondParameters
*
getHarmonicAngleForceParameters
(
void
)
const
;
/**
* Set BrookBondParameters for harmonic angle force
...
...
@@ -209,7 +254,7 @@ class OpenMMBrookInterface {
*
*/
BrookBondParameters
*
getPeriodicTorsionForceParameters
(
void
);
BrookBondParameters
*
getPeriodicTorsionForceParameters
(
void
)
const
;
/**
* Set BrookBondParameters for periodic torsion force
...
...
@@ -229,7 +274,7 @@ class OpenMMBrookInterface {
*
*/
BrookBondParameters
*
getRBTorsionForceParameters
(
void
);
BrookBondParameters
*
getRBTorsionForceParameters
(
void
)
const
;
/**
* Set BrookBondParameters for RB torsion force
...
...
@@ -249,18 +294,20 @@ class OpenMMBrookInterface {
*
*/
BrookBondParameters
*
getNonBonded14ForceParameters
(
void
);
BrookBondParameters
*
getNonBonded14ForceParameters
(
void
)
const
;
/**
* Set BrookBondParameters for LJ 14 force
*
* @param brookBondParameters brookBondParameters for LJ 14 force
* @param lj14Scale LJ 14 scale factor
* @param coulomb14Scale Coulomb 14 scale factor
*
* @return DefaultReturnValue
*
*/
int
setNonBonded14ForceParameters
(
BrookBondParameters
*
brookBondParameters
);
int
setNonBonded14ForceParameters
(
BrookBondParameters
*
brookBondParameters
,
double
lj14Scale
,
double
coulomb14Scale
);
/**
* Get positions stream
...
...
@@ -333,10 +380,16 @@ class OpenMMBrookInterface {
FILE
*
_log
;
int
_particleStreamWidth
;
int
_particleStreamSize
;
// number of particles
int
_numberOfParticles
;
double
_lj14Scale
;
double
_coulomb14Scale
;
// Brook bonded, nonbonded, Gbsa
BrookBonded
*
_brookBonded
;
...
...
@@ -374,6 +427,17 @@ class OpenMMBrookInterface {
int
_setBondParameters
(
BondParameterIndices
index
,
BrookBondParameters
*
brookBondParameters
);
/**
* Get BrookBondParameters at specified index
*
* @param index
*
* @return BrookBondParameters* object
*
*/
BrookBondParameters
*
_getBondParameters
(
BondParameterIndices
index
)
const
;
};
}
// namespace OpenMM
...
...
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