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
309008f7
"wrappers/python/vscode:/vscode.git/clone" did not exist on "3e84be612077c4c4a82779aecb47bec2129ef39a"
Commit
309008f7
authored
Dec 12, 2008
by
Mark Friedrichs
Browse files
Mods
parent
cdee990d
Changes
62
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1632 additions
and
1224 deletions
+1632
-1224
platforms/brook/src/BrookBondParameters.cpp
platforms/brook/src/BrookBondParameters.cpp
+325
-0
platforms/brook/src/BrookBondParameters.h
platforms/brook/src/BrookBondParameters.h
+96
-71
platforms/brook/src/BrookBonded.cpp
platforms/brook/src/BrookBonded.cpp
+452
-196
platforms/brook/src/BrookBonded.h
platforms/brook/src/BrookBonded.h
+64
-57
platforms/brook/src/BrookBrownianDynamics.cpp
platforms/brook/src/BrookBrownianDynamics.cpp
+95
-54
platforms/brook/src/BrookBrownianDynamics.h
platforms/brook/src/BrookBrownianDynamics.h
+23
-23
platforms/brook/src/BrookCalcGBSAOBCForceFieldKernel.cpp
platforms/brook/src/BrookCalcGBSAOBCForceFieldKernel.cpp
+0
-432
platforms/brook/src/BrookCalcGBSAOBCForceKernel.cpp
platforms/brook/src/BrookCalcGBSAOBCForceKernel.cpp
+56
-57
platforms/brook/src/BrookCalcGBSAOBCForceKernel.h
platforms/brook/src/BrookCalcGBSAOBCForceKernel.h
+24
-15
platforms/brook/src/BrookCalcHarmonicAngleForceKernel.cpp
platforms/brook/src/BrookCalcHarmonicAngleForceKernel.cpp
+25
-25
platforms/brook/src/BrookCalcHarmonicAngleForceKernel.h
platforms/brook/src/BrookCalcHarmonicAngleForceKernel.h
+13
-13
platforms/brook/src/BrookCalcHarmonicBondForceKernel.cpp
platforms/brook/src/BrookCalcHarmonicBondForceKernel.cpp
+29
-30
platforms/brook/src/BrookCalcHarmonicBondForceKernel.h
platforms/brook/src/BrookCalcHarmonicBondForceKernel.h
+13
-14
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
+2
-2
platforms/brook/src/BrookCalcKineticEnergyKernel.h
platforms/brook/src/BrookCalcKineticEnergyKernel.h
+2
-2
platforms/brook/src/BrookCalcLJ14ForceKernel.h
platforms/brook/src/BrookCalcLJ14ForceKernel.h
+0
-172
platforms/brook/src/BrookCalcNonbondedForceKernel.cpp
platforms/brook/src/BrookCalcNonbondedForceKernel.cpp
+343
-0
platforms/brook/src/BrookCalcNonbondedForceKernel.h
platforms/brook/src/BrookCalcNonbondedForceKernel.h
+60
-51
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.cpp
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.cpp
+4
-4
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.h
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.h
+6
-6
No files found.
platforms/brook/src/BrookBondParameters.cpp
0 → 100644
View file @
309008f7
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include <sstream>
#include "BrookBondParameters.h"
#include "OpenMMException.h"
using
namespace
OpenMM
;
using
namespace
std
;
/**
* BrookBondParameters constructor
*
* @param numberOfParticlesInBond no. of particles in each bond
* @param numberOfParametersInBond no. of parameters in each bond
* @param numberOfBonds no. of bonds
* @param log optional log reference
*
*/
BrookBondParameters
::
BrookBondParameters
(
std
::
string
bondName
,
int
numberOfParticlesInBond
,
int
numberOfParametersInBond
,
int
numberOfBonds
,
FILE
*
log
=
NULL
)
:
_bondName
(
bondName
),
_numberOfParticlesInBond
(
numberOfParticlesInBond
),
_numberOfParametersInBond
(
numberOfParametersInBond
),
_numberOfBonds
(
numberOfBonds
),
_log
(
log
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookBondParameters::BrookBondParameters";
// ---------------------------------------------------------------------------------------
// allocate memory for particle indices/parameters
int
*
particleIndicesBlock
=
new
int
[
numberOfParticlesInBond
*
numberOfBonds
];
double
*
parametersBlock
=
new
double
[
numberOfParametersInBond
*
numberOfBonds
];
_particleIndices
=
new
int
*
[
numberOfBonds
];
_bondParameters
=
new
double
*
[
numberOfBonds
];
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
_particleIndices
[
ii
]
=
particleIndicesBlock
;
particleIndicesBlock
+=
numberOfParticlesInBond
;
_bondParameters
[
ii
]
=
parametersBlock
;
parametersBlock
+=
numberOfParametersInBond
;
}
}
/**
* BrookBondParameters destructor
*
*/
BrookBondParameters
::~
BrookBondParameters
(
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookBondParameters::BrookBondParameters";
// ---------------------------------------------------------------------------------------
delete
[]
_particleIndices
[
0
];
delete
[]
_particleIndices
;
delete
[]
_bondParameters
[
0
];
delete
[]
_bondParameters
;
}
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE
*
BrookBondParameters
::
getLog
(
void
)
const
{
return
_log
;
}
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int
BrookBondParameters
::
setLog
(
FILE
*
log
){
_log
=
log
;
return
DefaultReturnValue
;
}
/**
* Get number of bonds
*
* @return numberOfBonds
*
*/
int
BrookBondParameters
::
getNumberOfBonds
(
void
)
const
{
return
_numberOfBonds
;
}
/**
* Get number of particles in bond
*
* @return numberOfParticlesInBond
*
*/
int
BrookBondParameters
::
getNumberOfParticlesInBond
(
void
)
const
{
return
_numberOfParticlesInBond
;
}
/**
* Get number of parameters in bond
*
* @return numberOfParametersInBond
*
*/
int
BrookBondParameters
::
getNumberOfParametersInBond
(
void
)
const
{
return
_numberOfParametersInBond
;
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bondIndex bond index to be set
* @param particleIndices indices of particles (dimension=numberOfParticlesInBond)
* @param bondParameters bond parameters (dimension=numberOfParametersInBond)
*
* @return DefaultReturnValue
*
* @throw OpenMMException exeception if bond index is invalid
*
*/
int
BrookBondParameters
::
setBond
(
int
bondIndex
,
int
*
particleIndices
,
double
*
bondParameters
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookBondParameters::setBond"
;
// ---------------------------------------------------------------------------------------
FILE
*
log
=
getLog
();
// ---------------------------------------------------------------------------------------
// validate bond index
if
(
bondIndex
<
0
){
std
::
stringstream
message
;
message
<<
methodName
<<
"BondIndex="
<<
bondIndex
<<
" is < 0."
;
throw
OpenMMException
(
message
.
str
()
);
}
if
(
bondIndex
>=
getNumberOfBonds
()
){
std
::
stringstream
message
;
message
<<
methodName
<<
"BondIndex="
<<
bondIndex
<<
" is >= "
<<
getNumberOfBonds
()
<<
"."
;
throw
OpenMMException
(
message
.
str
()
);
}
// load'em up
int
numberOfParticlesInBond
=
getNumberOfParticlesInBond
();
for
(
int
ii
=
0
;
ii
<
numberOfParticlesInBond
;
ii
++
){
_particleIndices
[
bondIndex
][
ii
]
=
particleIndices
[
ii
];
}
int
numberOfParametersInBond
=
getNumberOfParametersInBond
();
for
(
int
ii
=
0
;
ii
<
numberOfParametersInBond
;
ii
++
){
_bondParameters
[
bondIndex
][
ii
]
=
bondParameters
[
ii
];
}
// ---------------------------------------------------------------------------------------
return
DefaultReturnValue
;
}
/*
* Get contents of object
*
* @param tab tab
* @param description description
* @param value value
*
* @return string containing contents
*
* */
std
::
string
BrookBondParameters
::
_getLine
(
const
std
::
string
&
tab
,
const
std
::
string
&
description
,
const
std
::
string
&
value
)
const
{
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookStreamInternal::_getLine"
;
static
const
unsigned
int
MAX_LINE_CHARS
=
256
;
char
line
[
MAX_LINE_CHARS
];
// ---------------------------------------------------------------------------------------
std
::
stringstream
message
;
memset
(
line
,
' '
,
MAX_LINE_CHARS
);
#ifdef WIN32
(
void
)
sprintf_s
(
line
,
MAX_LINE_CHARS
,
"%s %-40s %s"
,
tab
.
c_str
(),
description
.
c_str
(),
value
.
c_str
()
);
#else
(
void
)
sprintf
(
line
,
"%s %-40s %s"
,
tab
.
c_str
(),
description
.
c_str
(),
value
.
c_str
()
);
#endif
message
<<
std
::
string
(
line
)
<<
std
::
endl
;
return
message
.
str
();
}
/*
* Get contents of object
*
*
* @param level level of dump
*
* @return string containing contents
*
* */
std
::
string
BrookBondParameters
::
getContentsString
(
int
level
)
const
{
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookBondParameters::getContentsString"
;
static
const
unsigned
int
MAX_LINE_CHARS
=
1024
;
char
value
[
MAX_LINE_CHARS
];
static
const
char
*
Set
=
"Set"
;
static
const
char
*
NotSet
=
"Not set"
;
// ---------------------------------------------------------------------------------------
std
::
stringstream
message
;
std
::
string
tab
=
" "
;
#ifdef WIN32
#define LOCAL_SPRINTF(a,b,c) sprintf_s( (a), MAX_LINE_CHARS, (b), (c) );
#define LOCAL_2_SPRINTF(a,b,c,d) sprintf_s( (a), MAX_LINE_CHARS, (b), (c), (d) );
#else
#define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) );
#define LOCAL_2_SPRINTF(a,b,c,d) sprintf( (a), (b), (c), (d) );
#endif
(
void
)
LOCAL_SPRINTF
(
value
,
"%s"
,
getBondName
()
);
message
<<
_getLine
(
tab
,
"Bond name:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOfBonds
()
);
message
<<
_getLine
(
tab
,
"Number of bonds:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOfParticlesInBond
()
);
message
<<
_getLine
(
tab
,
"Particles/bond:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOfParametersInBond
()
);
message
<<
_getLine
(
tab
,
"Parameters/bond:"
,
value
);
message
<<
"Bonds:"
<<
std
::
endl
;
for
(
int
ii
=
0
;
ii
<
getNumberOfBonds
();
ii
++
){
char
description
[
256
];
char
buffer
[
256
];
(
void
)
LOCAL_SPRINTF
(
description
,
"%6d ["
,
ii
);
// particle indices
for
(
int
jj
=
0
;
jj
<
getNumberOfParticlesInBond
();
jj
++
){
(
void
)
LOCAL_SPRINTF
(
buffer
,
"%6d "
,
_particleIndices
[
ii
][
jj
]
);
(
void
)
strcat
(
description
,
buffer
);
}
(
void
)
strcat
(
description
,
"] ["
);
// parameters
for
(
int
jj
=
0
;
jj
<
getNumberOfParametersInBond
();
jj
++
){
(
void
)
LOCAL_SPRINTF
(
buffer
,
"%18.10e "
,
_bondParameters
[
ii
][
jj
]
);
(
void
)
strcat
(
description
,
buffer
);
}
(
void
)
strcat
(
description
,
"]"
);
message
<<
_getLine
(
tab
,
""
,
description
);
}
#undef LOCAL_SPRINTF
#undef LOCAL_2_SPRINTF
return
message
.
str
();
}
platforms/brook/src/Brook
CalcProperDihedralBondForceKernel
.h
→
platforms/brook/src/Brook
BondParameters
.h
View file @
309008f7
#ifndef OPENMM_BROOK_
CALC_PROPER_DIHEDRAL_FORCE_KERNEL
_H_
#ifndef OPENMM_BROOK_
BOND_PARAMETERS
_H_
#define OPENMM_BROOK_
CALC_PROPER_DIHEDRAL_FORCE_KERNEL
_H_
#define OPENMM_BROOK_
BOND_PARAMETERS
_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -32,64 +32,24 @@
...
@@ -32,64 +32,24 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include "kernels.h"
#include "BrookPlatform.h"
#include "BrookBondParameters.h"
#include "OpenMMBrookInterface.h"
namespace
OpenMM
{
namespace
OpenMM
{
/**
/**
*
This kernel is invoked to calculate the harmonic angle forces acting on the system.
*
Container for bond parameters
*/
*/
class
BrookBondParameters
{
class
BrookCalcProperDihedralForceKernel
:
public
CalcProperDihedralForceKernel
{
public:
public:
/**
// return values
* BrookCalcProperDihedralForceKernel constructor
*/
BrookCalcProperDihedralForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
static
const
int
DefaultReturnValue
=
0
;
static
const
int
ErrorReturnValue
=
-
1
;
/**
* BrookCalcProperDihedralForceKernel destructor
*/
~
Brook
CalcProperDihedralForceKernel
(
);
Brook
BondParameters
(
std
::
string
bondName
,
int
numberOfParticlesInBond
,
int
numberOfParametersInBond
,
int
numberOfBonds
,
FILE
*
log
);
/**
~
BrookBondParameters
();
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
*
* @param system System reference
* @param force ProperDihedralForce reference
*
*/
void
initialize
(
const
System
&
system
,
const
ProperDihedralForce
&
force
);
/**
* Execute the kernel to calculate the forces.
*
* @param positions atom coordiantes
* @param forces output forces
*
*/
void
executeForces
(
OpenMMContextImpl
&
context
);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
*
* @return potential energy associated with the harmonic angle force
*
*/
double
executeEnergy
(
OpenMMContextImpl
&
context
);
/**
/**
* Set log file reference
* Set log file reference
*
*
...
@@ -122,51 +82,116 @@ class BrookCalcProperDihedralForceKernel : public CalcProperDihedralForceKernel
...
@@ -122,51 +82,116 @@ class BrookCalcProperDihedralForceKernel : public CalcProperDihedralForceKernel
FILE
*
getLog
(
void
)
const
;
FILE
*
getLog
(
void
)
const
;
/**
/**
*
G
et
number of bonds
*
S
et
bond info
*
*
* @return number of bonds
* @param bondIndex index of bond
* @param particleIndices array of particle indices
* @param bondParameters array of bond parameters
*
* @return DefaultReturnValue
*
* @throw OpenMMException exeception if bond index is invalid
*
*
*/
*/
int
getNumberOfBonds
(
void
)
const
;
int
setBond
(
int
bondIndex
,
int
*
particleIndices
,
double
*
bondParameters
);
/**
* Get bond name
*
* @return bond name
*
*/
std
::
string
getBondName
(
void
)
const
;
/**
* Set bond name
*
* @param bondName bond name
*
* @return DefaultReturnValue
*
*/
//int setBondName( std::string bondName );
/**
* Get NumberOfParticlesInBond
*
* @return NumberOfParticlesInBond
*
*/
int
getNumberOfParticlesInBond
(
void
)
const
;
/**
/**
* Get
indices/p
arameters
* Get
NumberOfP
arameters
InBond
*
*
* @return
BrookBondParameters containing atom indices/parameters
* @return
NumberOfParametersInBond
*
*
*/
*/
BrookBondParameters
*
getBrookBondParameters
(
void
)
const
;
int
getNumberOfParametersInBond
(
void
)
const
;
/**
* Get NumberOfBonds
*
* @return NumberOfBonds
*
*/
int
getNumberOfBonds
(
void
)
const
;
/*
* Get contents of object
*
*
* @param level level of dump
*
* @return string containing contents
*
* */
std
::
string
getContentsString
(
int
level
=
0
)
const
;
private:
private:
static
const
int
NumberOfAtomsInBond
=
3
;
static
const
int
NumberOfParametersInBond
=
2
;
// bond name
static
const
std
::
string
BondName
;
// log file reference
// log file reference
FILE
*
_log
;
FILE
*
_log
;
// bond name
// Brook bond parameters
std
::
string
_bondName
;
BrookBondParameters
*
_brookBondParameters
;
// interface
OpenMMBrookInterface
&
_openMMBrookInterface
;
// number of bonds
// System reference
int
_numberOfBonds
;
int
_numberOfParticlesInBond
;
int
_numberOfParametersInBond
;
// particle indices and parameters
System
&
_system
;
int
**
_particleIndices
;
double
**
_bondParameters
;
/*
* Get contents of object
*
* @param tab tab
* @param description description
* @param value value
*
* @return string containing contents
*
* */
std
::
string
_getLine
(
const
std
::
string
&
tab
,
const
std
::
string
&
description
,
const
std
::
string
&
value
)
const
;
};
};
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_
CALC_PROPER_DIHEDRAL_FORCE_KERNEL
_H_ */
#endif
/* OPENMM_BROOK_
BOND_PARAMETERS
_H_ */
platforms/brook/src/BrookBonded.cpp
View file @
309008f7
This diff is collapsed.
Click to expand it.
platforms/brook/src/BrookBonded.h
View file @
309008f7
...
@@ -34,8 +34,7 @@
...
@@ -34,8 +34,7 @@
#include <vector>
#include <vector>
#include "BrookFloatStreamInternal.h"
#include "BrookStreamImpl.h"
#include "BrookIntStreamInternal.h"
#include "BrookPlatform.h"
#include "BrookPlatform.h"
#include "BrookCommon.h"
#include "BrookCommon.h"
#include "OpenMMContext.h"
#include "OpenMMContext.h"
...
@@ -68,17 +67,17 @@ class BrookBonded : public BrookCommon {
...
@@ -68,17 +67,17 @@ class BrookBonded : public BrookCommon {
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param bondIndices the two
atom
s connected by each bond term
* @param bondIndices the two
particle
s connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three
atom
s connected by each angle term
* @param angleIndices the three
particle
s connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four
atom
s connected by each periodic torsion term
* @param periodicTorsionIndices the four
particle
s connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param rbTorsionIndices the four
atom
s connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionIndices the four
particle
s connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two
atom
s whose nonbonded interactions should be reduced since
* @param bonded14Indices each element contains the indices of two
particle
s whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* they form a bonded 1-4 pair
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each
atom
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each
particle
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param log log reference
* @param log log reference
...
@@ -87,7 +86,7 @@ class BrookBonded : public BrookCommon {
...
@@ -87,7 +86,7 @@ class BrookBonded : public BrookCommon {
*
*
*/
*/
int
setup
(
int
numberOf
Atom
s
,
int
setup
(
int
numberOf
Particle
s
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
...
@@ -157,7 +156,7 @@ class BrookBonded : public BrookCommon {
...
@@ -157,7 +156,7 @@ class BrookBonded : public BrookCommon {
* @return
* @return
*/
*/
BrookFloatStreamInternal
*
getBrook
Atom
Indices
(
void
)
const
;
BrookFloatStreamInternal
*
getBrook
Particle
Indices
(
void
)
const
;
/**
/**
* Get LJ 14 scale factor
* Get LJ 14 scale factor
...
@@ -178,13 +177,13 @@ class BrookBonded : public BrookCommon {
...
@@ -178,13 +177,13 @@ class BrookBonded : public BrookCommon {
BrookOpenMMFloat
getCoulombFactor
(
void
)
const
;
BrookOpenMMFloat
getCoulombFactor
(
void
)
const
;
/**
/**
* Get bonded
atom
indices stream
* Get bonded
particle
indices stream
*
*
* @return
atom
indices stream
* @return
particle
indices stream
*
*
*/
*/
BrookFloatStreamInternal
*
get
Atom
IndicesStream
(
void
)
const
;
BrookFloatStreamInternal
*
get
Particle
IndicesStream
(
void
)
const
;
/**
/**
* Get bonded charge stream
* Get bonded charge stream
...
@@ -268,6 +267,14 @@ class BrookBonded : public BrookCommon {
...
@@ -268,6 +267,14 @@ class BrookBonded : public BrookCommon {
std
::
string
getContentsString
(
int
level
=
0
)
const
;
std
::
string
getContentsString
(
int
level
=
0
)
const
;
/**
* Compute forces
*
*/
void
computeForces
(
BrookStreamImpl
&
positionStream
,
BrookStreamImpl
&
forceStream
);
private:
private:
static
const
int
NumberOfParameterStreams
=
5
;
static
const
int
NumberOfParameterStreams
=
5
;
...
@@ -291,7 +298,7 @@ class BrookBonded : public BrookCommon {
...
@@ -291,7 +298,7 @@ class BrookBonded : public BrookCommon {
// streams
// streams
BrookFloatStreamInternal
*
_
atom
IndicesStream
;
BrookFloatStreamInternal
*
_
particle
IndicesStream
;
BrookFloatStreamInternal
*
_bondedParameters
[
NumberOfParameterStreams
];
BrookFloatStreamInternal
*
_bondedParameters
[
NumberOfParameterStreams
];
BrookFloatStreamInternal
*
_bondedForceStreams
[
NumberOfForceStreams
];
BrookFloatStreamInternal
*
_bondedForceStreams
[
NumberOfForceStreams
];
BrookFloatStreamInternal
*
_chargeStream
;
BrookFloatStreamInternal
*
_chargeStream
;
...
@@ -302,93 +309,93 @@ class BrookBonded : public BrookCommon {
...
@@ -302,93 +309,93 @@ class BrookBonded : public BrookCommon {
// helper methods in setup of parameters
// helper methods in setup of parameters
void
flipQuartet
(
int
ibonded
,
int
*
atom
s
);
void
flipQuartet
(
int
ibonded
,
int
*
particle
s
);
int
matchTorsion
(
int
i
,
int
j
,
int
k
,
int
l
,
int
nbondeds
,
int
*
atom
s
);
int
matchTorsion
(
int
i
,
int
j
,
int
k
,
int
l
,
int
nbondeds
,
int
*
particle
s
);
int
matchAngle
(
int
i
,
int
j
,
int
k
,
int
nbondeds
,
int
*
atom
s
,
int
*
flag
);
int
matchAngle
(
int
i
,
int
j
,
int
k
,
int
nbondeds
,
int
*
particle
s
,
int
*
flag
);
int
matchBond
(
int
i
,
int
j
,
int
nbondeds
,
int
*
atom
s
,
int
*
flag
);
int
matchBond
(
int
i
,
int
j
,
int
nbondeds
,
int
*
particle
s
,
int
*
flag
);
int
matchPair
(
int
i
,
int
j
,
int
nbondeds
,
int
*
atom
s
);
int
matchPair
(
int
i
,
int
j
,
int
nbondeds
,
int
*
particle
s
);
/**
/**
* Setup Ryckaert-Bellemans parameters/
atom
indices
* Setup Ryckaert-Bellemans parameters/
particle
indices
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param
atom
s array of
atom
indices
* @param
particle
s array of
particle
indices
* @param params arrays of bond parameters
* @param params arrays of bond parameters
* @param rbTorsionIndices the four
atom
s connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionIndices the four
particle
s connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
*
*
* @return nonzero value if error
* @return nonzero value if error
*
*
*/
*/
int
addRBDihedrals
(
int
*
nbondeds
,
int
*
atom
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
int
addRBDihedrals
(
int
*
nbondeds
,
int
*
particle
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
);
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
);
/**
/**
* Setup periodic torsion parameters/
atom
indices
* Setup periodic torsion parameters/
particle
indices
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param
atom
s array of
atom
indices
* @param
particle
s array of
particle
indices
* @param params arrays of bond parameters
* @param params arrays of bond parameters
* @param periodicTorsionIndices the four
atom
s connected by each periodic torsion term
* @param periodicTorsionIndices the four
particle
s connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
*
*
* @return nonzero value if error
* @return nonzero value if error
*
*
*/
*/
int
addPDihedrals
(
int
*
nbondeds
,
int
*
atom
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
int
addPDihedrals
(
int
*
nbondeds
,
int
*
particle
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
);
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
);
/**
/**
* Setup angle bond parameters/
atom
indices
* Setup angle bond parameters/
particle
indices
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param
atom
s array of
atom
indices
* @param
particle
s array of
particle
indices
* @param params arrays of bond parameters
* @param params arrays of bond parameters
* @param angleIndices the angle bond
atom
indices
* @param angleIndices the angle bond
particle
indices
* @param angleParameters the angle parameters (angle in radians, force constant)
* @param angleParameters the angle parameters (angle in radians, force constant)
*
*
* @return nonzero value if error
* @return nonzero value if error
*
*
*/
*/
int
addAngles
(
int
*
nbondeds
,
int
*
atom
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
int
addAngles
(
int
*
nbondeds
,
int
*
particle
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
);
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
);
/**
/**
* Setup harmonic bond parameters/
atom
indices
* Setup harmonic bond parameters/
particle
indices
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param
atom
s array of
atom
indices
* @param
particle
s array of
particle
indices
* @param params arrays of bond parameters
* @param params arrays of bond parameters
* @param bondIndices two harmonic bond
atom
indices
* @param bondIndices two harmonic bond
particle
indices
* @param bondParameters the force parameters (distance, k)
* @param bondParameters the force parameters (distance, k)
*
*
* @return nonzero value if error
* @return nonzero value if error
*
*
*/
*/
int
addBonds
(
int
*
nbondeds
,
int
*
atom
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
int
addBonds
(
int
*
nbondeds
,
int
*
particle
s
,
BrookOpenMMFloat
*
params
[],
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
);
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
);
/**
/**
* Setup LJ/Coulomb 1-4 parameters/
atom
indices
* Setup LJ/Coulomb 1-4 parameters/
particle
indices
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param
atom
s array of
atom
indices
* @param
particle
s array of
particle
indices
* @param params arrays of bond parameters
* @param params arrays of bond parameters
* @param charges array of charges
* @param charges array of charges
* @param bonded14Indices each element contains the indices of two
atom
s whose nonbonded interactions should be reduced since
* @param bonded14Indices each element contains the indices of two
particle
s whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* they form a bonded 1-4 pair
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each
atom
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each
particle
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
*
*
* @return nonzero value if error
* @return nonzero value if error
*
*
*/
*/
int
addPairs
(
int
*
nbondeds
,
int
*
atom
s
,
BrookOpenMMFloat
*
params
[],
BrookOpenMMFloat
*
charges
,
int
addPairs
(
int
*
nbondeds
,
int
*
particle
s
,
BrookOpenMMFloat
*
params
[],
BrookOpenMMFloat
*
charges
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
,
double
lj14Scale
,
double
coulombScale
);
double
lj14Scale
,
double
coulombScale
);
...
@@ -396,8 +403,8 @@ class BrookBonded : public BrookCommon {
...
@@ -396,8 +403,8 @@ class BrookBonded : public BrookCommon {
* Create and load inverse maps for bonded ixns
* Create and load inverse maps for bonded ixns
*
*
* @param nbondeds number of bonded entries
* @param nbondeds number of bonded entries
* @param n
atom
s number of
atom
s
* @param n
particle
s number of
particle
s
* @param
atom
s arrays of
atom
indices (
atom
s[numberOfBonds][4])
* @param
particle
s arrays of
particle
indices (
particle
s[numberOfBonds][4])
* @param platform BrookPlatform reference
* @param platform BrookPlatform reference
* @param log log file reference (optional)
* @param log log file reference (optional)
*
*
...
@@ -405,7 +412,7 @@ class BrookBonded : public BrookCommon {
...
@@ -405,7 +412,7 @@ class BrookBonded : public BrookCommon {
*
*
*/
*/
int
loadInvMaps
(
int
nbondeds
,
int
n
atoms
,
int
*
atom
s
,
const
BrookPlatform
&
platform
);
int
loadInvMaps
(
int
nbondeds
,
int
n
particles
,
int
*
particle
s
,
const
BrookPlatform
&
platform
);
/**
/**
* Validate inverse map count
* Validate inverse map count
...
@@ -425,23 +432,23 @@ class BrookBonded : public BrookCommon {
...
@@ -425,23 +432,23 @@ class BrookBonded : public BrookCommon {
* Helper functions for building inverse maps for
* Helper functions for building inverse maps for
* torsions, impropers and angles.
* torsions, impropers and angles.
*
*
* For each
atom
, calculates the positions at which it's
* For each
particle
, calculates the positions at which it's
* forces are to be picked up from and stores the position
* forces are to be picked up from and stores the position
* in the appropriate index.
* in the appropriate index.
*
*
* Input: number of dihedrals, the
atom
indices, and a flag indicating
* Input: number of dihedrals, the
particle
indices, and a flag indicating
* whether we're doing i(0), j(1), k(2) or l(3)
* whether we're doing i(0), j(1), k(2) or l(3)
* Output: an array of counts per
atom
* Output: an array of counts per
particle
* arrays of inversemaps
* arrays of inversemaps
* nimaps - the number of invmaps actually used.
* nimaps - the number of invmaps actually used.
*
*
* @param posflag 0-ni
atom
s-1
* @param posflag 0-ni
particle
s-1
* @param ni
atom
s 3 for angles, 4 for torsions, impropers
* @param ni
particle
s 3 for angles, 4 for torsions, impropers
* @param nints number of interactions
* @param nints number of interactions
* @param n
atom
s number of
atom
s
* @param n
particle
s number of
particle
s
* @param *
atom
s gromacs interaction list
* @param *
particle
s gromacs interaction list
* @param nmaps maximum number of inverse maps
* @param nmaps maximum number of inverse maps
* @param counts[] output counts of how many places each
atom
occurs
* @param counts[] output counts of how many places each
particle
occurs
* @param *invmaps[] output array of nmaps inverse maps
* @param *invmaps[] output array of nmaps inverse maps
* @param *nimaps, output max number of inverse maps actually used
* @param *nimaps, output max number of inverse maps actually used
*
*
...
@@ -449,11 +456,11 @@ class BrookBonded : public BrookCommon {
...
@@ -449,11 +456,11 @@ class BrookBonded : public BrookCommon {
*
*
**/
**/
int
gpuCalcInvMap
(
int
posflag
,
int
ni
atom
s
,
int
nints
,
int
n
atom
s
,
int
gpuCalcInvMap
(
int
posflag
,
int
ni
particle
s
,
int
nints
,
int
n
particle
s
,
int
*
atom
s
,
int
nmaps
,
int
counts
[],
float4
*
invmaps
[],
int
*
particle
s
,
int
nmaps
,
int
counts
[],
float4
*
invmaps
[],
int
*
nimaps
);
int
*
nimaps
);
void
gpuPrintInvMaps
(
int
nmaps
,
int
n
atom
s
,
int
counts
[],
float4
*
invmap
[],
FILE
*
logFile
);
void
gpuPrintInvMaps
(
int
nmaps
,
int
n
particle
s
,
int
counts
[],
float4
*
invmap
[],
FILE
*
logFile
);
/* We are still plagued by kernel call overheads. This is for a big fat
/* We are still plagued by kernel call overheads. This is for a big fat
* merged inverse gather kernel:
* merged inverse gather kernel:
...
@@ -463,14 +470,14 @@ class BrookBonded : public BrookCommon {
...
@@ -463,14 +470,14 @@ class BrookBonded : public BrookCommon {
* lookup. This assumes that nints < 100000, preferably nints << 100000
* lookup. This assumes that nints < 100000, preferably nints << 100000
* which should always be true
* which should always be true
* */
* */
int
gpuCalcInvMap_merged
(
int
nints
,
int
n
atoms
,
int
*
atom
s
,
int
nmaps
,
int
counts
[],
float4
*
invmaps
[],
int
*
nimaps
);
int
gpuCalcInvMap_merged
(
int
nints
,
int
n
particles
,
int
*
particle
s
,
int
nmaps
,
int
counts
[],
float4
*
invmaps
[],
int
*
nimaps
);
/* Repacks the invmap streams for more efficient access in the
/* Repacks the invmap streams for more efficient access in the
* merged inverse gather kernel
* merged inverse gather kernel
*
*
* buf should be nimaps * n
atom
s large.
* buf should be nimaps * n
particle
s large.
* */
* */
int
gpuRepackInvMap_merged
(
int
n
atom
s
,
int
nmaps
,
int
*
counts
,
float4
*
invmaps
[],
float4
*
buf
);
int
gpuRepackInvMap_merged
(
int
n
particle
s
,
int
nmaps
,
int
*
counts
,
float4
*
invmaps
[],
float4
*
buf
);
};
};
...
...
platforms/brook/src/BrookBrownianDynamics.cpp
View file @
309008f7
...
@@ -64,13 +64,13 @@ BrookBrownianDynamics::BrookBrownianDynamics( ){
...
@@ -64,13 +64,13 @@ BrookBrownianDynamics::BrookBrownianDynamics( ){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
_numberOf
Atom
s
=
-
1
;
_numberOf
Particle
s
=
-
1
;
// mark stream dimension variables as unset
// mark stream dimension variables as unset
_bd
Atom
StreamWidth
=
-
1
;
_bd
Particle
StreamWidth
=
-
1
;
_bd
Atom
StreamHeight
=
-
1
;
_bd
Particle
StreamHeight
=
-
1
;
_bd
Atom
StreamSize
=
-
1
;
_bd
Particle
StreamSize
=
-
1
;
for
(
int
ii
=
0
;
ii
<
LastStreamIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastStreamIndex
;
ii
++
){
_streams
[
ii
]
=
NULL
;
_streams
[
ii
]
=
NULL
;
...
@@ -376,9 +376,9 @@ int BrookBrownianDynamics::updateParameters( double temperature, double friction
...
@@ -376,9 +376,9 @@ int BrookBrownianDynamics::updateParameters( double temperature, double friction
/**
/**
* Update
* Update
*
*
* @param positions
atom
positions
* @param positions
particle
positions
* @param velocities
atom
velocities
* @param velocities
particle
velocities
* @param forces
atom
forces
* @param forces
particle
forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
*
*
...
@@ -413,7 +413,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -413,7 +413,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
static
int
showAux
=
1
;
static
int
showAux
=
1
;
if
(
PrintOn
){
if
(
showAux
){
(
void
)
fprintf
(
getLog
(),
"%s shake=%d
\n
"
,
methodName
,
brookShakeAlgorithm
.
getNumberOfConstraints
()
);
(
void
)
fprintf
(
getLog
(),
"%s shake=%d
\n
"
,
methodName
,
brookShakeAlgorithm
.
getNumberOfConstraints
()
);
(
void
)
fflush
(
getLog
()
);
(
void
)
fflush
(
getLog
()
);
}
}
...
@@ -434,10 +434,51 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -434,10 +434,51 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
}
}
}
}
// diagnostics
if
(
(
1
||
PrintOn
)
){
(
void
)
fprintf
(
getLog
(),
"
\n
Pre kintegrate_bd: %d rngStrW=%3d rngOff=%5d "
"ForceScale=%12.5e NoiseAmplitude=%12.5e
\n
"
,
getBrownianDynamicsParticleStreamWidth
(),
brookRandomNumberGenerator
.
getRandomNumberStreamWidth
(),
brookRandomNumberGenerator
.
getRvStreamOffset
(),
getForceScale
(),
getNoiseAmplitude
()
);
// (void) fprintf( getLog(), "\nInverseMassStream\n" );
//getInverseMassStream()->printToFile( getLog() );
//StreamImpl& positionStreamImpl = positionStream.getImpl();
//const BrookStreamImpl brookPositions = dynamic_cast<BrookStreamImpl&> (positionStreamImpl);
/*
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
*/
double
forceSum
[
3
];
BrookStreamInternal
*
brookStreamInternalFF
=
forceStream
.
getBrookStreamImpl
();
BrookFloatStreamInternal
*
brookStreamInternalF
=
dynamic_cast
<
BrookFloatStreamInternal
*>
(
brookStreamInternalFF
);
brookStreamInternalF
->
sumByDimension
(
getNumberOfParticles
(),
forceSum
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStream [%18.10e %18.10e %18.10e]
\n
"
,
forceSum
[
0
],
forceSum
[
1
],
forceSum
[
2
]
);
brookStreamInternalF
->
printToFile
(
getLog
()
);
/*
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nRvStreamIndex=%d\n", brookRandomNumberGenerator.getRvStreamIndex() );
*/
// brookRandomNumberGenerator.getRandomNumberStream( brookRandomNumberGenerator.getRvStreamIndex() )->printToFile( getLog() );
BrookStreamInternal
*
brookStreamInternalVel
=
velocityStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
VelocityStream
\n
"
);
brookStreamInternalVel
->
printToFile
(
getLog
()
);
}
// integration step -- deltas returned in XPrime
// integration step -- deltas returned in XPrime
kintegrate_bd
(
kintegrate_bd
(
(
float
)
getBrownianDynamics
Atom
StreamWidth
(),
(
float
)
getBrownianDynamics
Particle
StreamWidth
(),
(
float
)
brookRandomNumberGenerator
.
getRandomNumberStreamWidth
(),
(
float
)
brookRandomNumberGenerator
.
getRandomNumberStreamWidth
(),
(
float
)
brookRandomNumberGenerator
.
getRvStreamOffset
(),
(
float
)
brookRandomNumberGenerator
.
getRvStreamOffset
(),
getForceScale
(),
getNoiseAmplitude
(),
getForceScale
(),
getNoiseAmplitude
(),
...
@@ -450,7 +491,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -450,7 +491,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
if
(
PrintOn
){
if
(
PrintOn
){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kintegrate_bd: %d rngStrW=%3d rngOff=%5d "
(
void
)
fprintf
(
getLog
(),
"
\n
Post kintegrate_bd: %d rngStrW=%3d rngOff=%5d "
"ForceScale=%12.5e NoiseAmplitude=%12.5e
\n
"
,
"ForceScale=%12.5e NoiseAmplitude=%12.5e
\n
"
,
getBrownianDynamics
Atom
StreamWidth
(),
getBrownianDynamics
Particle
StreamWidth
(),
brookRandomNumberGenerator
.
getRandomNumberStreamWidth
(),
brookRandomNumberGenerator
.
getRandomNumberStreamWidth
(),
brookRandomNumberGenerator
.
getRvStreamOffset
(),
brookRandomNumberGenerator
.
getRvStreamOffset
(),
getForceScale
(),
getNoiseAmplitude
()
);
getForceScale
(),
getNoiseAmplitude
()
);
...
@@ -477,20 +518,20 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -477,20 +518,20 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// advance random number cursor
// advance random number cursor
brookRandomNumberGenerator
.
advanceGVCursor
(
getNumberOf
Atom
s
()
);
brookRandomNumberGenerator
.
advanceGVCursor
(
getNumberOf
Particle
s
()
);
// Shake
// Shake
if
(
brookShakeAlgorithm
.
getNumberOfConstraints
()
>
0
){
if
(
brookShakeAlgorithm
.
getNumberOfConstraints
()
>
0
){
kshakeh_fix1
(
kshakeh_fix1
(
10.0
f
,
10.0
f
,
(
float
)
getBrownianDynamics
Atom
StreamWidth
(),
(
float
)
getBrownianDynamics
Particle
StreamWidth
(),
brookShakeAlgorithm
.
getInverseHydrogenMass
(),
brookShakeAlgorithm
.
getInverseHydrogenMass
(),
omega
,
omega
,
brookShakeAlgorithm
.
getShake
Atom
IndicesStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShake
Particle
IndicesStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
positionStream
.
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShake
Atom
ParameterStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShake
Particle
ParameterStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
...
@@ -499,7 +540,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -499,7 +540,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// second Shake gather
// second Shake gather
kshakeh_update2_fix1
(
kshakeh_update2_fix1
(
(
float
)
getBrownianDynamics
Atom
StreamWidth
(),
(
float
)
getBrownianDynamics
Particle
StreamWidth
(),
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
positionStream
.
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
...
@@ -539,10 +580,10 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -539,10 +580,10 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// diagnostics
// diagnostics
if
(
PrintOn
){
if
(
(
1
||
PrintOn
)
){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kupdate_bd2: velocityScale=%12.5e
\n
"
,
velocityScale
);
(
void
)
fprintf
(
getLog
(),
"
\n
Post kupdate_bd2: velocityScale=%12.5e
\n
"
,
velocityScale
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
...
@@ -563,35 +604,35 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
...
@@ -563,35 +604,35 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
};
};
/**
/**
* Get
Atom
stream size
* Get
Particle
stream size
*
*
* @return
Atom
stream size
* @return
Particle
stream size
*
*
*/
*/
int
BrookBrownianDynamics
::
getBrownianDynamics
Atom
StreamSize
(
void
)
const
{
int
BrookBrownianDynamics
::
getBrownianDynamics
Particle
StreamSize
(
void
)
const
{
return
_bd
Atom
StreamSize
;
return
_bd
Particle
StreamSize
;
}
}
/**
/**
* Get
atom
stream width
* Get
particle
stream width
*
*
* @return
atom
stream width
* @return
particle
stream width
*
*
*/
*/
int
BrookBrownianDynamics
::
getBrownianDynamics
Atom
StreamWidth
(
void
)
const
{
int
BrookBrownianDynamics
::
getBrownianDynamics
Particle
StreamWidth
(
void
)
const
{
return
_bd
Atom
StreamWidth
;
return
_bd
Particle
StreamWidth
;
}
}
/**
/**
* Get
atom
stream height
* Get
particle
stream height
*
*
* @return
atom
stream height
* @return
particle
stream height
*/
*/
int
BrookBrownianDynamics
::
getBrownianDynamics
Atom
StreamHeight
(
void
)
const
{
int
BrookBrownianDynamics
::
getBrownianDynamics
Particle
StreamHeight
(
void
)
const
{
return
_bd
Atom
StreamHeight
;
return
_bd
Particle
StreamHeight
;
}
}
/**
/**
...
@@ -619,14 +660,14 @@ BrookFloatStreamInternal* BrookBrownianDynamics::getInverseMassStream( void ) co
...
@@ -619,14 +660,14 @@ BrookFloatStreamInternal* BrookBrownianDynamics::getInverseMassStream( void ) co
/**
/**
* Initialize stream dimensions
* Initialize stream dimensions
*
*
* @param numberOf
Atom
s number of
atom
s
* @param numberOf
Particle
s number of
particle
s
* @param platform platform
* @param platform platform
*
*
* @return ErrorReturnValue if error, else DefaultReturnValue
* @return ErrorReturnValue if error, else DefaultReturnValue
*
*
*/
*/
int
BrookBrownianDynamics
::
_initializeStreamSizes
(
int
numberOf
Atom
s
,
const
Platform
&
platform
){
int
BrookBrownianDynamics
::
_initializeStreamSizes
(
int
numberOf
Particle
s
,
const
Platform
&
platform
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -634,9 +675,9 @@ int BrookBrownianDynamics::_initializeStreamSizes( int numberOfAtoms, const Plat
...
@@ -634,9 +675,9 @@ int BrookBrownianDynamics::_initializeStreamSizes( int numberOfAtoms, const Plat
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
_bd
Atom
StreamSize
=
get
Atom
StreamSize
(
platform
);
_bd
Particle
StreamSize
=
get
Particle
StreamSize
(
platform
);
_bd
Atom
StreamWidth
=
get
Atom
StreamWidth
(
platform
);
_bd
Particle
StreamWidth
=
get
Particle
StreamWidth
(
platform
);
_bd
Atom
StreamHeight
=
get
Atom
StreamHeight
(
platform
);
_bd
Particle
StreamHeight
=
get
Particle
StreamHeight
(
platform
);
return
DefaultReturnValue
;
return
DefaultReturnValue
;
}
}
...
@@ -660,19 +701,19 @@ int BrookBrownianDynamics::_initializeStreams( const Platform& platform ){
...
@@ -660,19 +701,19 @@ int BrookBrownianDynamics::_initializeStreams( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
int
sd
Atom
StreamSize
=
getBrownianDynamics
Atom
StreamSize
();
int
sd
Particle
StreamSize
=
getBrownianDynamics
Particle
StreamSize
();
int
sd
Atom
StreamWidth
=
getBrownianDynamics
Atom
StreamWidth
();
int
sd
Particle
StreamWidth
=
getBrownianDynamics
Particle
StreamWidth
();
_streams
[
VPrimeStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
VPrimeStream
,
_streams
[
VPrimeStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
VPrimeStream
,
sd
Atom
StreamSize
,
sd
Atom
StreamWidth
,
sd
Particle
StreamSize
,
sd
Particle
StreamWidth
,
BrookStreamInternal
::
Float3
,
dangleValue
);
BrookStreamInternal
::
Float3
,
dangleValue
);
_streams
[
XPrimeStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
XPrimeStream
,
_streams
[
XPrimeStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
XPrimeStream
,
sd
Atom
StreamSize
,
sd
Atom
StreamWidth
,
sd
Particle
StreamSize
,
sd
Particle
StreamWidth
,
BrookStreamInternal
::
Float3
,
dangleValue
);
BrookStreamInternal
::
Float3
,
dangleValue
);
_streams
[
InverseMassStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
InverseMassStream
,
_streams
[
InverseMassStream
]
=
new
BrookFloatStreamInternal
(
BrookCommon
::
InverseMassStream
,
sd
Atom
StreamSize
,
sd
Atom
StreamWidth
,
sd
Particle
StreamSize
,
sd
Particle
StreamWidth
,
BrookStreamInternal
::
Float
,
dangleValue
);
BrookStreamInternal
::
Float
,
dangleValue
);
return
DefaultReturnValue
;
return
DefaultReturnValue
;
...
@@ -693,7 +734,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
...
@@ -693,7 +734,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//int
atom
StreamSize = getBrownianDynamics
Atom
StreamSize();
//int
particle
StreamSize = getBrownianDynamics
Particle
StreamSize();
return
DefaultReturnValue
;
return
DefaultReturnValue
;
...
@@ -702,7 +743,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
...
@@ -702,7 +743,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
/**
/**
* Set masses
* Set masses
*
*
* @param masses
atomic
masses
* @param masses
particle
masses
*
*
*/
*/
...
@@ -754,12 +795,12 @@ int BrookBrownianDynamics::setup( const std::vector<double>& masses, const Platf
...
@@ -754,12 +795,12 @@ int BrookBrownianDynamics::setup( const std::vector<double>& masses, const Platf
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
setLog
(
brookPlatform
.
getLog
()
);
setLog
(
brookPlatform
.
getLog
()
);
int
numberOf
Atom
s
=
(
int
)
masses
.
size
();
int
numberOf
Particle
s
=
(
int
)
masses
.
size
();
setNumberOf
Atom
s
(
numberOf
Atom
s
);
setNumberOf
Particle
s
(
numberOf
Particle
s
);
// set stream sizes and then create streams
// set stream sizes and then create streams
_initializeStreamSizes
(
numberOf
Atom
s
,
platform
);
_initializeStreamSizes
(
numberOf
Particle
s
,
platform
);
_initializeStreams
(
platform
);
_initializeStreams
(
platform
);
_setInverseSqrtMasses
(
masses
);
_setInverseSqrtMasses
(
masses
);
...
@@ -798,17 +839,17 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
...
@@ -798,17 +839,17 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
#define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) );
#define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) );
#endif
#endif
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOf
Atom
s
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
getNumberOf
Particle
s
()
);
message
<<
_getLine
(
tab
,
"Number of
atom
s:"
,
value
);
message
<<
_getLine
(
tab
,
"Number of
particle
s:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Atom
StreamWidth
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Particle
StreamWidth
()
);
message
<<
_getLine
(
tab
,
"
Atom
stream width:"
,
value
);
message
<<
_getLine
(
tab
,
"
Particle
stream width:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Atom
StreamHeight
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Particle
StreamHeight
()
);
message
<<
_getLine
(
tab
,
"
Atom
stream height:"
,
value
);
message
<<
_getLine
(
tab
,
"
Particle
stream height:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Atom
StreamSize
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%d"
,
get
Particle
StreamSize
()
);
message
<<
_getLine
(
tab
,
"
Atom
stream size:"
,
value
);
message
<<
_getLine
(
tab
,
"
Particle
stream size:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getTau
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getTau
()
);
message
<<
_getLine
(
tab
,
"Tau:"
,
value
);
message
<<
_getLine
(
tab
,
"Tau:"
,
value
);
...
@@ -819,10 +860,10 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
...
@@ -819,10 +860,10 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getStepSize
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getStepSize
()
);
message
<<
_getLine
(
tab
,
"Step size:"
,
value
);
message
<<
_getLine
(
tab
,
"Step size:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5
f
"
,
getForceScale
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5
e
"
,
getForceScale
()
);
message
<<
_getLine
(
tab
,
"Force scale:"
,
value
);
message
<<
_getLine
(
tab
,
"Force scale:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5
f
"
,
getNoiseAmplitude
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5
e
"
,
getNoiseAmplitude
()
);
message
<<
_getLine
(
tab
,
"Noise amplitude:"
,
value
);
message
<<
_getLine
(
tab
,
"Noise amplitude:"
,
value
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getTemperature
()
);
(
void
)
LOCAL_SPRINTF
(
value
,
"%.5f"
,
getTemperature
()
);
...
...
platforms/brook/src/BrookBrownianDynamics.h
View file @
309008f7
...
@@ -116,28 +116,28 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -116,28 +116,28 @@ class BrookBrownianDynamics : public BrookCommon {
BrookOpenMMFloat
getForceScale
(
void
)
const
;
BrookOpenMMFloat
getForceScale
(
void
)
const
;
/**
/**
* Get BrownianDynamics
atom
stream width
* Get BrownianDynamics
particle
stream width
*
*
* @return
atom
stream width
* @return
particle
stream width
*/
*/
int
getBrownianDynamics
Atom
StreamWidth
(
void
)
const
;
int
getBrownianDynamics
Particle
StreamWidth
(
void
)
const
;
/**
/**
* Get BrownianDynamics
atom
stream height
* Get BrownianDynamics
particle
stream height
*
*
* @return
atom
stream height
* @return
particle
stream height
*/
*/
int
getBrownianDynamics
Atom
StreamHeight
(
void
)
const
;
int
getBrownianDynamics
Particle
StreamHeight
(
void
)
const
;
/**
/**
* Get BrownianDynamics
atom
stream size
* Get BrownianDynamics
particle
stream size
*
*
* @return
atom
stream size
* @return
particle
stream size
*/
*/
int
getBrownianDynamics
Atom
StreamSize
(
void
)
const
;
int
getBrownianDynamics
Particle
StreamSize
(
void
)
const
;
/**
/**
* Update parameters
* Update parameters
...
@@ -155,9 +155,9 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -155,9 +155,9 @@ class BrookBrownianDynamics : public BrookCommon {
/**
/**
* Update
* Update
*
*
* @param positions
atom
positions
* @param positions
particle
positions
* @param velocities
atom
velocities
* @param velocities
particle
velocities
* @param forces
atom
forces
* @param forces
particle
forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
*
*
...
@@ -181,7 +181,7 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -181,7 +181,7 @@ class BrookBrownianDynamics : public BrookCommon {
/*
/*
* Setup of BrownianDynamics parameters
* Setup of BrownianDynamics parameters
*
*
* @param masses
atom
masses
* @param masses
particle
masses
* @param platform Brook platform
* @param platform Brook platform
*
*
* @return ErrorReturnValue value if error, else DefaultReturnValue
* @return ErrorReturnValue value if error, else DefaultReturnValue
...
@@ -240,11 +240,11 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -240,11 +240,11 @@ class BrookBrownianDynamics : public BrookCommon {
BrookOpenMMFloat
_forceScale
;
BrookOpenMMFloat
_forceScale
;
BrookOpenMMFloat
_noiseAmplitude
;
BrookOpenMMFloat
_noiseAmplitude
;
//
Atom
stream dimensions
//
Particle
stream dimensions
int
_bd
Atom
StreamWidth
;
int
_bd
Particle
StreamWidth
;
int
_bd
Atom
StreamHeight
;
int
_bd
Particle
StreamHeight
;
int
_bd
Atom
StreamSize
;
int
_bd
Particle
StreamSize
;
/*
/*
* Update streams
* Update streams
...
@@ -328,26 +328,26 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -328,26 +328,26 @@ class BrookBrownianDynamics : public BrookCommon {
/*
/*
* Setup of stream dimensions
* Setup of stream dimensions
*
*
* @param
atom
StreamSize
atom
stream size
* @param
particle
StreamSize
particle
stream size
* @param
atom
StreamWidth
atom
stream width
* @param
particle
StreamWidth
particle
stream width
*
*
* @return ErrorReturnValue if error, else DefaultReturnValue
* @return ErrorReturnValue if error, else DefaultReturnValue
*
*
* */
* */
int
_initializeStreamSizes
(
int
atom
StreamSize
,
int
atom
StreamWidth
);
int
_initializeStreamSizes
(
int
particle
StreamSize
,
int
particle
StreamWidth
);
/**
/**
* Initialize stream dimensions
* Initialize stream dimensions
*
*
* @param numberOf
Atom
s number of
atom
s
* @param numberOf
Particle
s number of
particle
s
* @param platform platform
* @param platform platform
*
*
* @return ErrorReturnValue if error, else DefaultReturnValue
* @return ErrorReturnValue if error, else DefaultReturnValue
*
*
*/
*/
int
_initializeStreamSizes
(
int
numberOf
Atom
s
,
const
Platform
&
platform
);
int
_initializeStreamSizes
(
int
numberOf
Particle
s
,
const
Platform
&
platform
);
/**
/**
* Initialize stream dimensions and streams
* Initialize stream dimensions and streams
...
@@ -363,7 +363,7 @@ class BrookBrownianDynamics : public BrookCommon {
...
@@ -363,7 +363,7 @@ class BrookBrownianDynamics : public BrookCommon {
/**
/**
* Set masses
* Set masses
*
*
* @param masses
atom
ic masses
* @param masses
particle
ic masses
*
*
*/
*/
...
...
platforms/brook/src/BrookCalcGBSAOBCForceFieldKernel.cpp
deleted
100644 → 0
View file @
cdee990d
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h"
#include <sstream>
#include "BrookStreamImpl.h"
#include "BrookCalcGBSAOBCForceKernel.h"
#include "gpu/kgbsa.h"
#include "gpu/kforce.h"
#include "math.h"
using
namespace
OpenMM
;
using
namespace
std
;
/**
* BrookCalcGBSAOBCForceKernel constructor
*
* @param name kernel name
* @param platform platform
*
*/
BrookCalcGBSAOBCForceKernel
::
BrookCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
CalcGBSAOBCForceKernel
(
name
,
platform
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
_numberOfAtoms
=
0
;
_brookGbsa
=
NULL
;
_log
=
NULL
;
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
if
(
brookPlatform
.
getLog
()
!=
NULL
){
setLog
(
brookPlatform
.
getLog
()
);
}
}
/**
* BrookCalcGBSAOBCForceKernel destructor
*
*/
BrookCalcGBSAOBCForceKernel
::~
BrookCalcGBSAOBCForceKernel
(
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
delete
_brookGbsa
;
}
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE
*
BrookCalcGBSAOBCForceKernel
::
getLog
(
void
)
const
{
return
_log
;
}
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int
BrookCalcGBSAOBCForceKernel
::
setLog
(
FILE
*
log
){
_log
=
log
;
return
BrookCommon
::
DefaultReturnValue
;
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param atomParameters vector containing atom index, charge, radius, scalingFactor
* @param solventDielectric solvent dielectric
* @param soluteDielectric solute dielectric
*
*/
void
BrookCalcGBSAOBCForceKernel
::
initialize
(
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalcGBSAOBCForceKernel::initialize"
;
// ---------------------------------------------------------------------------------------
FILE
*
log
=
getLog
();
_numberOfAtoms
=
(
int
)
atomParameters
.
size
();
// ---------------------------------------------------------------------------------------
// bonded
if
(
_brookGbsa
){
delete
_brookGbsa
;
}
_brookGbsa
=
new
BrookGbsa
();
_brookGbsa
->
setLog
(
log
);
_brookGbsa
->
setup
(
atomParameters
,
solventDielectric
,
soluteDielectric
,
getPlatform
()
);
if
(
log
){
std
::
string
contents
=
_brookGbsa
->
getContentsString
(
);
(
void
)
fprintf
(
log
,
"%s brookGbsa::contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fflush
(
log
);
}
// ---------------------------------------------------------------------------------------
}
/**
* Compute forces given atom coordinates
*
* @param positions atom coordinates
* @param forces output forces
*
*/
void
BrookCalcGBSAOBCForceKernel
::
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalcGBSAOBCForceKernel::executeForces"
;
static
const
int
PrintOn
=
0
;
// ---------------------------------------------------------------------------------------
// OBC
const
BrookStreamImpl
&
positionStreamC
=
dynamic_cast
<
const
BrookStreamImpl
&>
(
positions
.
getImpl
());
BrookStreamImpl
&
positionStream
=
const_cast
<
BrookStreamImpl
&>
(
positionStreamC
);
BrookStreamImpl
&
forceStream
=
dynamic_cast
<
BrookStreamImpl
&>
(
forces
.
getImpl
());
float
includeAce
=
(
float
)
(
_brookGbsa
->
includeAce
());
BrookFloatStreamInternal
**
gbsaForceStreams
=
_brookGbsa
->
getForceStreams
();
// calculate Born radii first time thru and initialize on board
if
(
!
_brookGbsa
->
haveBornRadiiBeenInitialized
()
){
_brookGbsa
->
calculateBornRadii
(
positions
);
}
// first major loop
kObcLoop1
(
(
float
)
_brookGbsa
->
getNumberOfAtoms
(),
(
float
)
_brookGbsa
->
getAtomSizeCeiling
(),
(
float
)
_brookGbsa
->
getDuplicationFactor
(),
(
float
)
_brookGbsa
->
getAtomStreamWidth
(
),
(
float
)
_brookGbsa
->
getPartialForceStreamWidth
(
),
_brookGbsa
->
getSoluteDielectric
(),
_brookGbsa
->
getSolventDielectric
(),
includeAce
,
positionStream
.
getBrookStream
(),
_brookGbsa
->
getObcBornRadii
()
->
getBrookStream
(),
_brookGbsa
->
getObcAtomicRadii
()
->
getBrookStream
(),
gbsaForceStreams
[
0
]
->
getBrookStream
(),
gbsaForceStreams
[
1
]
->
getBrookStream
(),
gbsaForceStreams
[
2
]
->
getBrookStream
(),
gbsaForceStreams
[
3
]
->
getBrookStream
()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if
(
1
&&
PrintOn
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kObcLoop1: atms=%d ceil=%d dup=%d atomStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f
\n
"
,
_brookGbsa
->
getNumberOfAtoms
(),
_brookGbsa
->
getAtomSizeCeiling
(),
_brookGbsa
->
getDuplicationFactor
(),
_brookGbsa
->
getAtomStreamWidth
(
),
_brookGbsa
->
getPartialForceStreamWidth
(
),
_brookGbsa
->
getSoluteDielectric
(),
_brookGbsa
->
getSolventDielectric
(),
includeAce
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
BornR
\n
"
);
_brookGbsa
->
getObcBornRadii
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
AtomR
\n
"
);
_brookGbsa
->
getObcAtomicRadii
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStreams output
\n
"
);
for
(
int
ii
=
0
;
ii
<
4
;
ii
++
){
gbsaForceStreams
[
ii
]
->
printToFile
(
getLog
()
);
}
}
// ---------------------------------------------------------------------------------------
// gather for first loop
kPostObcLoop1_nobranch
(
(
float
)
_brookGbsa
->
getDuplicationFactor
(),
(
float
)
_brookGbsa
->
getAtomStreamWidth
(
),
(
float
)
_brookGbsa
->
getPartialForceStreamWidth
(
),
(
float
)
_brookGbsa
->
getNumberOfAtoms
(),
(
float
)
_brookGbsa
->
getAtomSizeCeiling
(),
(
float
)
_brookGbsa
->
getInnerLoopUnroll
(),
gbsaForceStreams
[
0
]
->
getBrookStream
(),
gbsaForceStreams
[
1
]
->
getBrookStream
(),
gbsaForceStreams
[
2
]
->
getBrookStream
(),
gbsaForceStreams
[
3
]
->
getBrookStream
(),
_brookGbsa
->
getObcChain
()
->
getBrookStream
(),
_brookGbsa
->
getObcBornRadii
()
->
getBrookStream
(),
_brookGbsa
->
getObcIntermediateForce
()
->
getBrookStream
(),
_brookGbsa
->
getObcBornRadii2
()
->
getBrookStream
()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if
(
PrintOn
&&
getLog
()){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kPostObcLoop1_nobranch: dup=%d aStrW=%d pStrW=%d no.atms=%3d ceil=%3d Unroll=%1d
\n
"
,
_brookGbsa
->
getDuplicationFactor
(),
_brookGbsa
->
getAtomStreamWidth
(
),
_brookGbsa
->
getPartialForceStreamWidth
(
),
_brookGbsa
->
getNumberOfAtoms
(),
_brookGbsa
->
getAtomSizeCeiling
(),
_brookGbsa
->
getInnerLoopUnroll
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStreams
\n
"
);
for
(
int
ii
=
0
;
ii
<
4
;
ii
++
){
gbsaForceStreams
[
ii
]
->
printToFile
(
getLog
()
);
}
(
void
)
fprintf
(
getLog
(),
"
\n
ObcChain
\n
"
);
_brookGbsa
->
getObcChain
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
BornR
\n
"
);
_brookGbsa
->
getObcBornRadii
()
->
printToFile
(
getLog
()
);
// output
(
void
)
fprintf
(
getLog
(),
"
\n
ObcIntermediateForce output
\n
"
);
_brookGbsa
->
getObcIntermediateForce
()
->
printToFile
(
getLog
()
);
// output
(
void
)
fprintf
(
getLog
(),
"
\n
ObcBornRadii2 output
\n
"
);
_brookGbsa
->
getObcBornRadii2
()
->
printToFile
(
getLog
()
);
}
// ---------------------------------------------------------------------------------------
// second major loop
kObcLoop2
(
(
float
)
_brookGbsa
->
getNumberOfAtoms
(),
(
float
)
_brookGbsa
->
getAtomSizeCeiling
(),
(
float
)
_brookGbsa
->
getDuplicationFactor
(),
(
float
)
_brookGbsa
->
getAtomStreamWidth
(
),
(
float
)
_brookGbsa
->
getPartialForceStreamWidth
(
),
positionStream
.
getBrookStream
(),
_brookGbsa
->
getObcScaledAtomicRadii
()
->
getBrookStream
(),
_brookGbsa
->
getObcBornRadii2
()
->
getBrookStream
(),
gbsaForceStreams
[
0
]
->
getBrookStream
(),
gbsaForceStreams
[
1
]
->
getBrookStream
(),
gbsaForceStreams
[
2
]
->
getBrookStream
(),
gbsaForceStreams
[
3
]
->
getBrookStream
()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if
(
PrintOn
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kObcLoop2: no.atms=%5d ceil=%3d dup=%3d strW=%3d pStrW=%3d
\n
"
,
_brookGbsa
->
getNumberOfAtoms
(),
_brookGbsa
->
getAtomSizeCeiling
(),
_brookGbsa
->
getDuplicationFactor
(),
_brookGbsa
->
getAtomStreamWidth
(
),
_brookGbsa
->
getPartialForceStreamWidth
(
)
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ObcScaledAtomicRadii
\n
"
);
_brookGbsa
->
getObcScaledAtomicRadii
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
getObcBornRadii2
\n
"
);
_brookGbsa
->
getObcBornRadii2
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStreams
\n
"
);
for
(
int
ii
=
0
;
ii
<
4
;
ii
++
){
gbsaForceStreams
[
ii
]
->
printToFile
(
getLog
()
);
}
}
// ---------------------------------------------------------------------------------------
// gather for second loop
float
mergeNonObcForces
=
1.0
f
;
float
kcalMolTokJNM
=
-
0.4184
f
;
kPostObcLoop2_nobranch
(
(
float
)
_brookGbsa
->
getDuplicationFactor
(),
(
float
)
_brookGbsa
->
getAtomStreamWidth
(
),
(
float
)
_brookGbsa
->
getPartialForceStreamWidth
(
),
(
float
)
_brookGbsa
->
getNumberOfAtoms
(),
(
float
)
_brookGbsa
->
getAtomSizeCeiling
(),
(
float
)
_brookGbsa
->
getInnerLoopUnroll
(),
kcalMolTokJNM
,
mergeNonObcForces
,
_brookGbsa
->
getObcIntermediateForce
()
->
getBrookStream
(),
forceStream
.
getBrookStream
(),
gbsaForceStreams
[
0
]
->
getBrookStream
(),
gbsaForceStreams
[
1
]
->
getBrookStream
(),
gbsaForceStreams
[
2
]
->
getBrookStream
(),
gbsaForceStreams
[
3
]
->
getBrookStream
(),
_brookGbsa
->
getObcAtomicRadii
()
->
getBrookStream
(),
_brookGbsa
->
getObcBornRadii
()
->
getBrookStream
(),
_brookGbsa
->
getObcChain
()
->
getBrookStream
(),
forceStream
.
getBrookStream
()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if
(
PrintOn
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
Post kPostObcLoop2_nobranch: atms=%d ceil=%d dup=%d atomStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f
\n
"
,
_brookGbsa
->
getNumberOfAtoms
(),
_brookGbsa
->
getAtomSizeCeiling
(),
_brookGbsa
->
getDuplicationFactor
(),
_brookGbsa
->
getAtomStreamWidth
(
),
_brookGbsa
->
getPartialForceStreamWidth
(
),
_brookGbsa
->
getSoluteDielectric
(),
_brookGbsa
->
getSolventDielectric
(),
includeAce
);
(
void
)
fprintf
(
getLog
(),
"
\n
PartialForceStreams
\n
"
);
for
(
int
ii
=
0
;
ii
<
4
;
ii
++
){
gbsaForceStreams
[
ii
]
->
printToFile
(
getLog
()
);
}
BrookStreamInternal
*
brookStreamInternalF
=
forceStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStream
\n
"
);
brookStreamInternalF
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
Chain
\n
"
);
_brookGbsa
->
getObcChain
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
BornR
\n
"
);
_brookGbsa
->
getObcBornRadii
()
->
printToFile
(
getLog
()
);
}
// ---------------------------------------------------------------------------------------
}
/**
* Execute the kernel to calculate the OBC energy
*
* @param positions atom positions
*
* @return potential energy due to the OBC forces
*
*/
double
BrookCalcGBSAOBCForceKernel
::
executeEnergy
(
const
Stream
&
positions
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcGBSAOBCForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
return
(
double
)
_brookGbsa
->
getEnergy
(
positions
);
}
platforms/brook/src/Brook
Nonbonded14
ForceKernel.cpp
→
platforms/brook/src/Brook
CalcGBSAOBC
ForceKernel.cpp
View file @
309008f7
...
@@ -29,17 +29,22 @@
...
@@ -29,17 +29,22 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h"
#include "OpenMMException.h"
#include <sstream>
#include <sstream>
#include "BrookNonbonded14ForceKernel.h"
#include "BrookStreamImpl.h"
#include "BrookCalcGBSAOBCForceKernel.h"
#include "gpu/kgbsa.h"
#include "gpu/kforce.h"
#include "math.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
const
std
::
string
BrookNonbonded14ForceKernel
::
BondName
=
"HarmonicLJ14"
;
/**
/**
* Brook
Nonbonded14
ForceKernel constructor
* Brook
CalcGBSAOBC
ForceKernel constructor
*
*
* @param name kernel name
* @param name kernel name
* @param platform platform
* @param platform platform
...
@@ -48,18 +53,18 @@ const std::string BrookNonbonded14ForceKernel::BondName = "HarmonicLJ14";
...
@@ -48,18 +53,18 @@ const std::string BrookNonbonded14ForceKernel::BondName = "HarmonicLJ14";
*
*
*/
*/
BrookNonbonded14ForceKernel
::
BrookNonbonded14ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
BrookCalcGBSAOBCForceKernel
::
BrookCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
CalcGBSAOBCForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
CalcHarmonicLJ14ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "Brook
Nonbonded14
ForceKernel::Brook
Nonbonded14
ForceKernel";
// static const std::string methodName = "Brook
CalcGBSAOBC
ForceKernel::Brook
CalcGBSAOBC
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
_brookBondParameters
=
NULL
;
_numberOfParticles
=
0
;
_brookGbsa
=
NULL
;
_log
=
NULL
;
_log
=
NULL
;
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
...
@@ -70,20 +75,20 @@ BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel( std::string name, cons
...
@@ -70,20 +75,20 @@ BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel( std::string name, cons
}
}
/**
/**
* Brook
Nonbonded14
ForceKernel destructor
* Brook
CalcGBSAOBC
ForceKernel destructor
*
*
*/
*/
Brook
Nonbonded14
ForceKernel
::~
Brook
Nonbonded14
ForceKernel
(
){
Brook
CalcGBSAOBC
ForceKernel
::~
Brook
CalcGBSAOBC
ForceKernel
(
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "Brook
Nonbonded14
ForceKernel::Brook
Nonbonded14
ForceKernel";
// static const std::string methodName = "Brook
CalcGBSAOBC
ForceKernel::Brook
CalcGBSAOBC
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
delete
_brook
BondParameters
;
delete
_brook
Gbsa
;
}
}
/**
/**
...
@@ -93,7 +98,7 @@ BrookNonbonded14ForceKernel::~BrookNonbonded14ForceKernel( ){
...
@@ -93,7 +98,7 @@ BrookNonbonded14ForceKernel::~BrookNonbonded14ForceKernel( ){
*
*
*/
*/
FILE
*
Brook
Nonbonded14
ForceKernel
::
getLog
(
void
)
const
{
FILE
*
Brook
CalcGBSAOBC
ForceKernel
::
getLog
(
void
)
const
{
return
_log
;
return
_log
;
}
}
...
@@ -106,7 +111,7 @@ FILE* BrookNonbonded14ForceKernel::getLog( void ) const {
...
@@ -106,7 +111,7 @@ FILE* BrookNonbonded14ForceKernel::getLog( void ) const {
*
*
*/
*/
int
Brook
Nonbonded14
ForceKernel
::
setLog
(
FILE
*
log
){
int
Brook
CalcGBSAOBC
ForceKernel
::
setLog
(
FILE
*
log
){
_log
=
log
;
_log
=
log
;
return
BrookCommon
::
DefaultReturnValue
;
return
BrookCommon
::
DefaultReturnValue
;
}
}
...
@@ -114,16 +119,16 @@ int BrookNonbonded14ForceKernel::setLog( FILE* log ){
...
@@ -114,16 +119,16 @@ int BrookNonbonded14ForceKernel::setLog( FILE* log ){
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param system
System reference
* @param system
system this kernel will be applied to
* @param force
HarmonicLJ14Force reference
* @param force
GBSAOBCForce this kernel will be used for
*
*
*/
*/
void
Brook
Nonbonded14
ForceKernel
::
initialize
(
const
System
&
system
,
const
HarmonicLJ14
Force
&
force
){
void
Brook
CalcGBSAOBC
ForceKernel
::
initialize
(
const
System
&
system
,
const
GBSAOBC
Force
&
force
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"Brook
Nonbonded14
ForceKernel::initialize"
;
static
const
std
::
string
methodName
=
"Brook
CalcGBSAOBC
ForceKernel::initialize"
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -131,39 +136,36 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
...
@@ -131,39 +136,36 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters
if
(
_brookGbsa
){
delete
_brookGbsa
;
int
numberOfBonds
=
force
.
getNumLJ14s
();
if
(
_brookBondParameters
){
delete
_brookBondParameters
;
}
}
_brook
BondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOfAtomsInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
_brook
Gbsa
=
new
BrookGbsa
(
);
_brookGbsa
->
setLog
(
log
);
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
// get parameters from force object
int
particle1
,
particle2
,
particle3
;
// and initialize brookGbsa
double
angle
,
k
;
_numberOfParticles
=
system
.
getNumParticles
();
int
particles
[
NumberOfAtomsInBond
]
;
std
::
vector
<
std
::
vector
<
double
>
>
particleParameters
;
double
parameters
[
NumberOfParametersInBond
];
for
(
int
ii
=
0
;
ii
<
_numberOfParticles
;
ii
++
){
force
.
getLJ14Parameters
(
ii
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
double
charge
,
radius
,
scalingFactor
;
particles
[
0
]
=
particle1
;
force
.
getParticleParameters
(
ii
,
charge
,
radius
,
scalingFactor
)
;
particles
[
1
]
=
particle2
;
particles
[
2
]
=
particle3
;
std
::
vector
<
double
>
parameters
;
particleParameters
[
ii
]
=
parameters
;
parameters
[
0
]
=
angle
;
parameters
[
1
]
=
k
;
parameters
[
0
]
=
charge
;
parameters
[
1
]
=
radius
;
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
)
;
parameters
[
2
]
=
scalingFactor
;
}
}
_openMMBrookInterface
.
setHarmonicLJ14ForceParameters
(
_brookBondParameters
);
_brookGbsa
->
setup
(
particleParameters
,
force
.
getSolventDielectric
(),
force
.
getSoluteDielectric
(),
getPlatform
()
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
if
(
log
){
if
(
log
){
std
::
string
contents
=
_brook
BondParameters
->
getContentsString
(
);
std
::
string
contents
=
_brook
Gbsa
->
getContentsString
(
);
(
void
)
fprintf
(
log
,
"%s brookGbsa::contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s brookGbsa::contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
}
}
...
@@ -173,43 +175,40 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
...
@@ -173,43 +175,40 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
}
}
/**
/**
* Compute forces given
atom
coordinates
* Compute forces given
particle
coordinates
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
*/
*/
void
Brook
Nonbonded14
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
void
Brook
CalcGBSAOBC
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "Brook
Nonbonded14
ForceKernel::executeForces";
//static const std::string methodName = "Brook
CalcGBSAOBC
ForceKernel::executeForces";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
if
(
_openMMBrookInterface
.
getTriggerForceKernel
()
==
this
){
if
(
_openMMBrookInterface
.
getTriggerForceKernel
()
==
this
){
_openMMBrookInterface
.
computeForces
(
context
);
_openMMBrookInterface
.
computeForces
(
context
);
}
}
return
;
// ---------------------------------------------------------------------------------------
}
}
/**
/**
* Execute the kernel to calculate the energy
* Execute the kernel to calculate the
OBC
energy
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
* @return
potential
energy
* @return energy
*
*
*/
*/
double
Brook
Nonbonded14
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
double
Brook
CalcGBSAOBC
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "Brook
Nonbonded14
ForceKernel::executeEnergy";
//static const std::string methodName = "Brook
CalcGBSAOBC
ForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/brook/src/BrookCalcGBSAOBCForce
Field
Kernel.h
→
platforms/brook/src/BrookCalcGBSAOBCForceKernel.h
View file @
309008f7
#ifndef OPENMM_BROOK_
_
CALC
L
_GBSAOBC_FORCE
FIELD
_KERNEL_H_
#ifndef OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_
#define OPENMM_BROOK_
_
CALC
L
_GBSAOBC_FORCE
FIELD
_KERNEL_H_
#define OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -35,12 +35,14 @@
...
@@ -35,12 +35,14 @@
#include "kernels.h"
#include "kernels.h"
#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "BrookGbsa.h"
#include "BrookGbsa.h"
#include "OpenMMBrookInterface.h"
namespace
OpenMM
{
namespace
OpenMM
{
/**
/**
* This kernel is invoked
by NonbondedForce
to calculate the forces acting on the system.
* This kernel is invoked to calculate the
OBC
forces acting on the system.
*/
*/
class
BrookCalcGBSAOBCForceKernel
:
public
CalcGBSAOBCForceKernel
{
class
BrookCalcGBSAOBCForceKernel
:
public
CalcGBSAOBCForceKernel
{
public:
public:
...
@@ -49,7 +51,7 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
...
@@ -49,7 +51,7 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
* BrookCalcGBSAOBCForceKernel constructor
* BrookCalcGBSAOBCForceKernel constructor
*/
*/
BrookCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
);
BrookCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
/**
/**
* BrookCalcGBSAOBCForceKernel destructor
* BrookCalcGBSAOBCForceKernel destructor
...
@@ -60,35 +62,34 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
...
@@ -60,35 +62,34 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param atomParameters vector containing atom index, charge, radius, scalingFactor
* @param system system this kernel will be applied to
* @param solventDielectric solvent dielectric
* @param force GBSAOBCForce this kernel will be used for
* @param soluteDielectric solute dielectric
*
*
*/
*/
void
initialize
(
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
);
void
initialize
(
const
System
&
system
,
const
GBSAOBCForce
&
force
);
/**
/**
* Execute the kernel to calculate the forces.
* Execute the kernel to calculate the forces.
*
*
* @param positions
atom
coordiantes
* @param positions
particle
coordiantes
* @param forces output forces
* @param forces output forces
*
*
*/
*/
void
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
);
void
executeForces
(
OpenMMContextImpl
&
context
);
/**
/**
* Execute the kernel to calculate the energy.
* Execute the kernel to calculate the energy.
*
*
* @param positions
atom
positions
* @param positions
particle
positions
*
*
* @return potential energy due to the NonbondedForce
* @return potential energy due to the NonbondedForce
* Currently always return 0.0 since energies not calculated on gpu
* Currently always return 0.0 since energies not calculated on gpu
*
*
*/
*/
double
executeEnergy
(
const
Stream
&
positions
);
double
executeEnergy
(
OpenMMContextImpl
&
context
);
/**
/**
* Set log file reference
* Set log file reference
...
@@ -127,16 +128,24 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
...
@@ -127,16 +128,24 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
FILE
*
_log
;
FILE
*
_log
;
// number of
atom
s
// number of
particle
s
int
_numberOf
Atom
s
;
int
_numberOf
Particle
s
;
// Brook Gbsa
// Brook Gbsa
BrookGbsa
*
_brookGbsa
;
BrookGbsa
*
_brookGbsa
;
// interface
OpenMMBrookInterface
&
_openMMBrookInterface
;
// System reference
System
&
_system
;
};
};
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_
_
CALC
L
_GBSAOBC_FORCE
FIELD
_KERNEL_H_ */
#endif
/* OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_ */
platforms/brook/src/BrookCalc
LJ14
ForceKernel.cpp
→
platforms/brook/src/BrookCalc
HarmonicAngle
ForceKernel.cpp
View file @
309008f7
...
@@ -31,15 +31,15 @@
...
@@ -31,15 +31,15 @@
#include "OpenMMException.h"
#include "OpenMMException.h"
#include <sstream>
#include <sstream>
#include "BrookCalcHarmonic
LJ14
ForceKernel.h"
#include "BrookCalcHarmonic
Angle
ForceKernel.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
const
std
::
string
BrookCalcHarmonic
LJ14
ForceKernel
::
BondName
=
"Harmonic
LJ14
"
;
const
std
::
string
BrookCalcHarmonic
Angle
ForceKernel
::
BondName
=
"Harmonic
Angle
"
;
/**
/**
* BrookCalcHarmonic
LJ14
ForceKernel constructor
* BrookCalcHarmonic
Angle
ForceKernel constructor
*
*
* @param name kernel name
* @param name kernel name
* @param platform platform
* @param platform platform
...
@@ -48,13 +48,13 @@ const std::string BrookCalcHarmonicLJ14ForceKernel::BondName = "HarmonicLJ14";
...
@@ -48,13 +48,13 @@ const std::string BrookCalcHarmonicLJ14ForceKernel::BondName = "HarmonicLJ14";
*
*
*/
*/
BrookCalcHarmonic
LJ14
ForceKernel
::
BrookCalcHarmonic
LJ14
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
BrookCalcHarmonic
Angle
ForceKernel
::
BrookCalcHarmonic
Angle
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
CalcHarmonic
LJ14
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
CalcHarmonic
Angle
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcHarmonic
LJ14
ForceKernel::BrookCalcHarmonic
LJ14
ForceKernel";
// static const std::string methodName = "BrookCalcHarmonic
Angle
ForceKernel::BrookCalcHarmonic
Angle
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -70,15 +70,15 @@ BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel( std::string
...
@@ -70,15 +70,15 @@ BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel( std::string
}
}
/**
/**
* BrookCalcHarmonic
LJ14
ForceKernel destructor
* BrookCalcHarmonic
Angle
ForceKernel destructor
*
*
*/
*/
BrookCalcHarmonic
LJ14
ForceKernel
::~
BrookCalcHarmonic
LJ14
ForceKernel
(
){
BrookCalcHarmonic
Angle
ForceKernel
::~
BrookCalcHarmonic
Angle
ForceKernel
(
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcHarmonic
LJ14
ForceKernel::BrookCalcHarmonic
LJ14
ForceKernel";
// static const std::string methodName = "BrookCalcHarmonic
Angle
ForceKernel::BrookCalcHarmonic
Angle
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -93,7 +93,7 @@ BrookCalcHarmonicLJ14ForceKernel::~BrookCalcHarmonicLJ14ForceKernel( ){
...
@@ -93,7 +93,7 @@ BrookCalcHarmonicLJ14ForceKernel::~BrookCalcHarmonicLJ14ForceKernel( ){
*
*
*/
*/
FILE
*
BrookCalcHarmonic
LJ14
ForceKernel
::
getLog
(
void
)
const
{
FILE
*
BrookCalcHarmonic
Angle
ForceKernel
::
getLog
(
void
)
const
{
return
_log
;
return
_log
;
}
}
...
@@ -106,7 +106,7 @@ FILE* BrookCalcHarmonicLJ14ForceKernel::getLog( void ) const {
...
@@ -106,7 +106,7 @@ FILE* BrookCalcHarmonicLJ14ForceKernel::getLog( void ) const {
*
*
*/
*/
int
BrookCalcHarmonic
LJ14
ForceKernel
::
setLog
(
FILE
*
log
){
int
BrookCalcHarmonic
Angle
ForceKernel
::
setLog
(
FILE
*
log
){
_log
=
log
;
_log
=
log
;
return
BrookCommon
::
DefaultReturnValue
;
return
BrookCommon
::
DefaultReturnValue
;
}
}
...
@@ -115,15 +115,15 @@ int BrookCalcHarmonicLJ14ForceKernel::setLog( FILE* log ){
...
@@ -115,15 +115,15 @@ int BrookCalcHarmonicLJ14ForceKernel::setLog( FILE* log ){
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param system System reference
* @param system System reference
* @param force Harmonic
LJ14
Force reference
* @param force Harmonic
Angle
Force reference
*
*
*/
*/
void
BrookCalcHarmonic
LJ14
ForceKernel
::
initialize
(
const
System
&
system
,
const
Harmonic
LJ14
Force
&
force
){
void
BrookCalcHarmonic
Angle
ForceKernel
::
initialize
(
const
System
&
system
,
const
Harmonic
Angle
Force
&
force
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalcHarmonic
LJ14
ForceKernel::initialize"
;
static
const
std
::
string
methodName
=
"BrookCalcHarmonic
Angle
ForceKernel::initialize"
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -131,24 +131,24 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
...
@@ -131,24 +131,24 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing
atom
indices/parameters
// create _brookBondParameters object containing
particle
indices/parameters
int
numberOfBonds
=
force
.
getNum
LJ14
s
();
int
numberOfBonds
=
force
.
getNum
Angle
s
();
if
(
_brookBondParameters
){
if
(
_brookBondParameters
){
delete
_brookBondParameters
;
delete
_brookBondParameters
;
}
}
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Atom
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Particle
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
,
particle3
;
double
angle
,
k
;
double
angle
,
k
;
int
particles
[
NumberOf
Atom
sInBond
];
int
particles
[
NumberOf
Particle
sInBond
];
double
parameters
[
NumberOfParametersInBond
];
double
parameters
[
NumberOfParametersInBond
];
force
.
get
LJ14
Parameters
(
ii
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
force
.
get
Angle
Parameters
(
ii
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
particles
[
0
]
=
particle1
;
particles
[
0
]
=
particle1
;
particles
[
1
]
=
particle2
;
particles
[
1
]
=
particle2
;
particles
[
2
]
=
particle3
;
particles
[
2
]
=
particle3
;
...
@@ -158,7 +158,7 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
...
@@ -158,7 +158,7 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
}
}
_openMMBrookInterface
.
setHarmonic
LJ14
ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setHarmonic
Angle
ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
...
@@ -173,17 +173,17 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
...
@@ -173,17 +173,17 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
}
}
/**
/**
* Compute forces given
atom
coordinates
* Compute forces given
particle
coordinates
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
*/
*/
void
BrookCalcHarmonic
LJ14
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
void
BrookCalcHarmonic
Angle
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcHarmonic
LJ14
ForceKernel::executeForces";
//static const std::string methodName = "BrookCalcHarmonic
Angle
ForceKernel::executeForces";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -205,11 +205,11 @@ void BrookCalcHarmonicLJ14ForceKernel::executeForces( OpenMMContextImpl& context
...
@@ -205,11 +205,11 @@ void BrookCalcHarmonicLJ14ForceKernel::executeForces( OpenMMContextImpl& context
*
*
*/
*/
double
BrookCalcHarmonic
LJ14
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
double
BrookCalcHarmonic
Angle
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcHarmonic
LJ14
ForceKernel::executeEnergy";
//static const std::string methodName = "BrookCalcHarmonic
Angle
ForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/brook/src/BrookCalc
RBDihedralBond
ForceKernel.h
→
platforms/brook/src/BrookCalc
HarmonicAngle
ForceKernel.h
View file @
309008f7
#ifndef OPENMM_BROOK_CALC_
RB_DIHEDRAL
_FORCE_KERNEL_H_
#ifndef OPENMM_BROOK_CALC_
HARMONIC_ANGLE
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_
RB_DIHEDRAL
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_
HARMONIC_ANGLE
_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -43,36 +43,36 @@ namespace OpenMM {
...
@@ -43,36 +43,36 @@ namespace OpenMM {
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/
*/
class
BrookCalc
RbDihedral
ForceKernel
:
public
Calc
RBTorsion
ForceKernel
{
class
BrookCalc
HarmonicAngle
ForceKernel
:
public
Calc
HarmonicAngle
ForceKernel
{
public:
public:
/**
/**
* BrookCalc
RbDihedral
ForceKernel constructor
* BrookCalc
HarmonicAngle
ForceKernel constructor
*/
*/
BrookCalc
RbDihedral
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
BrookCalc
HarmonicAngle
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
/**
/**
* BrookCalc
RbDihedral
ForceKernel destructor
* BrookCalc
HarmonicAngle
ForceKernel destructor
*/
*/
~
BrookCalc
RbDihedral
ForceKernel
();
~
BrookCalc
HarmonicAngle
ForceKernel
();
/**
/**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
*
*
* @param system System reference
* @param system System reference
* @param force
RbDihedral
Force reference
* @param force
HarmonicAngle
Force reference
*
*
*/
*/
void
initialize
(
const
System
&
system
,
const
RBTorsion
Force
&
force
);
void
initialize
(
const
System
&
system
,
const
HarmonicAngle
Force
&
force
);
/**
/**
* Execute the kernel to calculate the forces.
* Execute the kernel to calculate the forces.
*
*
* @param positions
atom
coordiantes
* @param positions
particle
coordiantes
* @param forces output forces
* @param forces output forces
*
*
*/
*/
...
@@ -133,7 +133,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
...
@@ -133,7 +133,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
/**
/**
* Get indices/parameters
* Get indices/parameters
*
*
* @return BrookBondParameters containing
atom
indices/parameters
* @return BrookBondParameters containing
particle
indices/parameters
*
*
*/
*/
...
@@ -141,7 +141,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
...
@@ -141,7 +141,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
private:
private:
static
const
int
NumberOf
Atom
sInBond
=
3
;
static
const
int
NumberOf
Particle
sInBond
=
3
;
static
const
int
NumberOfParametersInBond
=
2
;
static
const
int
NumberOfParametersInBond
=
2
;
// bond name
// bond name
...
@@ -169,4 +169,4 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
...
@@ -169,4 +169,4 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_CALC_
RB_DIHEDRAL
_FORCE_KERNEL_H_ */
#endif
/* OPENMM_BROOK_CALC_
HARMONIC_ANGLE
_FORCE_KERNEL_H_ */
platforms/brook/src/BrookCalc
RBDihedral
BondForceKernel.cpp
→
platforms/brook/src/BrookCalc
Harmonic
BondForceKernel.cpp
View file @
309008f7
...
@@ -31,15 +31,15 @@
...
@@ -31,15 +31,15 @@
#include "OpenMMException.h"
#include "OpenMMException.h"
#include <sstream>
#include <sstream>
#include "BrookCalc
RBDihedral
BondForceKernel.h"
#include "BrookCalc
Harmonic
BondForceKernel.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
const
std
::
string
BrookCalc
RbDihedral
ForceKernel
::
BondName
=
"
RbDihedral
"
;
const
std
::
string
BrookCalc
HarmonicBond
ForceKernel
::
BondName
=
"
HarmonicBond
"
;
/**
/**
* BrookCalc
RbDihedral
ForceKernel constructor
* BrookCalc
HarmonicBond
ForceKernel constructor
*
*
* @param name kernel name
* @param name kernel name
* @param platform platform
* @param platform platform
...
@@ -48,13 +48,13 @@ const std::string BrookCalcRbDihedralForceKernel::BondName = "RbDihedral";
...
@@ -48,13 +48,13 @@ const std::string BrookCalcRbDihedralForceKernel::BondName = "RbDihedral";
*
*
*/
*/
BrookCalc
RbDihedral
ForceKernel
::
BrookCalc
RbDihedral
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
BrookCalc
HarmonicBond
ForceKernel
::
BrookCalc
HarmonicBond
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
Calc
RbDihedral
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
Calc
HarmonicBond
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalc
RbDihedral
ForceKernel::BrookCalc
RbDihedral
ForceKernel";
// static const std::string methodName = "BrookCalc
HarmonicBond
ForceKernel::BrookCalc
HarmonicBond
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -70,15 +70,15 @@ BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel( std::string name
...
@@ -70,15 +70,15 @@ BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel( std::string name
}
}
/**
/**
* BrookCalc
RbDihedral
ForceKernel destructor
* BrookCalc
HarmonicBond
ForceKernel destructor
*
*
*/
*/
BrookCalc
RbDihedral
ForceKernel
::~
BrookCalc
RbDihedral
ForceKernel
(
){
BrookCalc
HarmonicBond
ForceKernel
::~
BrookCalc
HarmonicBond
ForceKernel
(
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalc
RbDihedral
ForceKernel::BrookCalc
RbDihedral
ForceKernel";
// static const std::string methodName = "BrookCalc
HarmonicBond
ForceKernel::BrookCalc
HarmonicBond
ForceKernel";
// static const int debug = 1;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -93,7 +93,7 @@ BrookCalcRbDihedralForceKernel::~BrookCalcRbDihedralForceKernel( ){
...
@@ -93,7 +93,7 @@ BrookCalcRbDihedralForceKernel::~BrookCalcRbDihedralForceKernel( ){
*
*
*/
*/
FILE
*
BrookCalc
RbDihedral
ForceKernel
::
getLog
(
void
)
const
{
FILE
*
BrookCalc
HarmonicBond
ForceKernel
::
getLog
(
void
)
const
{
return
_log
;
return
_log
;
}
}
...
@@ -106,7 +106,7 @@ FILE* BrookCalcRbDihedralForceKernel::getLog( void ) const {
...
@@ -106,7 +106,7 @@ FILE* BrookCalcRbDihedralForceKernel::getLog( void ) const {
*
*
*/
*/
int
BrookCalc
RbDihedral
ForceKernel
::
setLog
(
FILE
*
log
){
int
BrookCalc
HarmonicBond
ForceKernel
::
setLog
(
FILE
*
log
){
_log
=
log
;
_log
=
log
;
return
BrookCommon
::
DefaultReturnValue
;
return
BrookCommon
::
DefaultReturnValue
;
}
}
...
@@ -115,15 +115,15 @@ int BrookCalcRbDihedralForceKernel::setLog( FILE* log ){
...
@@ -115,15 +115,15 @@ int BrookCalcRbDihedralForceKernel::setLog( FILE* log ){
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param system System reference
* @param system System reference
* @param force
RbDihedral
Force reference
* @param force
HarmonicBond
Force reference
*
*
*/
*/
void
BrookCalc
RbDihedral
ForceKernel
::
initialize
(
const
System
&
system
,
const
RbDihedral
Force
&
force
){
void
BrookCalc
HarmonicBond
ForceKernel
::
initialize
(
const
System
&
system
,
const
HarmonicBond
Force
&
force
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalc
RbDihedral
ForceKernel::initialize"
;
static
const
std
::
string
methodName
=
"BrookCalc
HarmonicBond
ForceKernel::initialize"
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -131,40 +131,39 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
...
@@ -131,40 +131,39 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing
atom
indices/parameters
// create _brookBondParameters object containing
particle
indices/parameters
int
numberOfBonds
=
force
.
getNum
Angle
s
();
int
numberOfBonds
=
force
.
getNum
Bond
s
();
if
(
_brookBondParameters
){
if
(
_brookBondParameters
){
delete
_brookBondParameters
;
delete
_brookBondParameters
;
}
}
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Atom
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Particle
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
;
double
angle
,
k
;
double
length
,
k
;
int
particles
[
NumberOf
Atom
sInBond
];
int
particles
[
NumberOf
Particle
sInBond
];
double
parameters
[
NumberOfParametersInBond
];
double
parameters
[
NumberOfParametersInBond
];
force
.
get
Angle
Parameters
(
ii
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
force
.
get
Bond
Parameters
(
ii
,
particle1
,
particle2
,
length
,
k
);
particles
[
0
]
=
particle1
;
particles
[
0
]
=
particle1
;
particles
[
1
]
=
particle2
;
particles
[
1
]
=
particle2
;
particles
[
2
]
=
particle3
;
parameters
[
0
]
=
angle
;
parameters
[
0
]
=
length
;
parameters
[
1
]
=
k
;
parameters
[
1
]
=
k
;
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
}
}
_openMMBrookInterface
.
set
RbDihedral
ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
set
HarmonicBond
ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
if
(
log
){
if
(
log
){
std
::
string
contents
=
_brookBondParameters
->
getContentsString
(
);
std
::
string
contents
=
_brookBondParameters
->
getContentsString
(
);
(
void
)
fprintf
(
log
,
"%s
brookGbsa::
contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
}
}
...
@@ -173,17 +172,17 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
...
@@ -173,17 +172,17 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
}
}
/**
/**
* Compute forces given
atom
coordinates
* Compute forces given
particle
coordinates
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
*/
*/
void
BrookCalc
RbDihedral
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
void
BrookCalc
HarmonicBond
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalc
RbDihedral
ForceKernel::executeForces";
//static const std::string methodName = "BrookCalc
HarmonicBond
ForceKernel::executeForces";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -205,11 +204,11 @@ void BrookCalcRbDihedralForceKernel::executeForces( OpenMMContextImpl& context )
...
@@ -205,11 +204,11 @@ void BrookCalcRbDihedralForceKernel::executeForces( OpenMMContextImpl& context )
*
*
*/
*/
double
BrookCalc
RbDihedral
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
double
BrookCalc
HarmonicBond
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalc
RbDihedral
ForceKernel::executeEnergy";
//static const std::string methodName = "BrookCalc
HarmonicBond
ForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/brook/src/Brook
Nonbonded14
ForceKernel.h
→
platforms/brook/src/Brook
CalcHarmonicBond
ForceKernel.h
View file @
309008f7
#ifndef OPENMM_BROOK_CALC_
LJ14
_FORCE_KERNEL_H_
#ifndef OPENMM_BROOK_CALC_
HARMONIC_BOND
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_
LJ14
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_
HARMONIC_BOND
_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -43,36 +43,36 @@ namespace OpenMM {
...
@@ -43,36 +43,36 @@ namespace OpenMM {
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/
*/
class
BrookCalcHarmonic
LJ14
ForceKernel
:
public
CalcHarmonic
LJ14
ForceKernel
{
class
BrookCalcHarmonic
Bond
ForceKernel
:
public
CalcHarmonic
Bond
ForceKernel
{
public:
public:
/**
/**
* BrookCalcHarmonic
LJ14
ForceKernel constructor
* BrookCalcHarmonic
Bond
ForceKernel constructor
*/
*/
BrookCalcHarmonic
LJ14
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
BrookCalcHarmonic
Bond
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
/**
/**
* BrookCalcHarmonic
LJ14
ForceKernel destructor
* BrookCalcHarmonic
Bond
ForceKernel destructor
*/
*/
~
BrookCalcHarmonic
LJ14
ForceKernel
();
~
BrookCalcHarmonic
Bond
ForceKernel
();
/**
/**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
*
*
* @param system System reference
* @param system System reference
* @param force Harmonic
LJ14
Force reference
* @param force Harmonic
Bond
Force reference
*
*
*/
*/
void
initialize
(
const
System
&
system
,
const
Harmonic
LJ14
Force
&
force
);
void
initialize
(
const
System
&
system
,
const
Harmonic
Bond
Force
&
force
);
/**
/**
* Execute the kernel to calculate the forces.
* Execute the kernel to calculate the forces.
*
*
* @param positions
atom
coordiantes
* @param positions
particle
coordiantes
* @param forces output forces
* @param forces output forces
*
*
*/
*/
...
@@ -133,7 +133,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
...
@@ -133,7 +133,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
/**
/**
* Get indices/parameters
* Get indices/parameters
*
*
* @return BrookBondParameters containing
atom
indices/parameters
* @return BrookBondParameters containing
particle
indices/parameters
*
*
*/
*/
...
@@ -141,7 +141,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
...
@@ -141,7 +141,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
private:
private:
static
const
int
NumberOf
Atom
sInBond
=
3
;
static
const
int
NumberOf
Particle
sInBond
=
2
;
static
const
int
NumberOfParametersInBond
=
2
;
static
const
int
NumberOfParametersInBond
=
2
;
// bond name
// bond name
...
@@ -152,7 +152,6 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
...
@@ -152,7 +152,6 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
FILE
*
_log
;
FILE
*
_log
;
// Brook bond parameters
// Brook bond parameters
BrookBondParameters
*
_brookBondParameters
;
BrookBondParameters
*
_brookBondParameters
;
...
@@ -169,4 +168,4 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
...
@@ -169,4 +168,4 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_CALC_
LJ14
_FORCE_KERNEL_H_ */
#endif
/* OPENMM_BROOK_CALC_
HARMONIC_BOND
_FORCE_KERNEL_H_ */
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
View file @
309008f7
...
@@ -77,7 +77,7 @@ BrookCalcKineticEnergyKernel::~BrookCalcKineticEnergyKernel( ){
...
@@ -77,7 +77,7 @@ BrookCalcKineticEnergyKernel::~BrookCalcKineticEnergyKernel( ){
/**
/**
* Initialize the kernel
* Initialize the kernel
*
*
* @param masses mass of each
atom
* @param masses mass of each
particle
*
*
*/
*/
...
@@ -107,7 +107,7 @@ void BrookCalcKineticEnergyKernel::initialize( const vector<double>& masses ){
...
@@ -107,7 +107,7 @@ void BrookCalcKineticEnergyKernel::initialize( const vector<double>& masses ){
/**
/**
* Execute kernel
* Execute kernel
*
*
* @param velocities stream of
atom
velocities
* @param velocities stream of
particle
velocities
*
*
* @return kinetic energy of the system
* @return kinetic energy of the system
*
*
...
...
platforms/brook/src/BrookCalcKineticEnergyKernel.h
View file @
309008f7
...
@@ -65,7 +65,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
...
@@ -65,7 +65,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
/**
/**
* Initialize the kernel
* Initialize the kernel
*
*
* @param masses mass of each
atom
* @param masses mass of each
particle
*
*
*/
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
);
void
initialize
(
const
std
::
vector
<
double
>&
masses
);
...
@@ -73,7 +73,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
...
@@ -73,7 +73,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
/**
/**
* Execute the kernel.
* Execute the kernel.
*
*
* @param velocities stream of
atom
velocities
* @param velocities stream of
particle
velocities
*
*
*/
*/
...
...
platforms/brook/src/BrookCalcLJ14ForceKernel.h
deleted
100644 → 0
View file @
cdee990d
#ifndef OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "kernels.h"
#include "BrookPlatform.h"
#include "BrookBondParameters.h"
#include "OpenMMBrookInterface.h"
namespace
OpenMM
{
/**
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/
class
BrookCalcHarmonicLJ14ForceKernel
:
public
CalcHarmonicLJ14ForceKernel
{
public:
/**
* BrookCalcHarmonicLJ14ForceKernel constructor
*/
BrookCalcHarmonicLJ14ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
/**
* BrookCalcHarmonicLJ14ForceKernel destructor
*/
~
BrookCalcHarmonicLJ14ForceKernel
();
/**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
*
* @param system System reference
* @param force HarmonicLJ14Force reference
*
*/
void
initialize
(
const
System
&
system
,
const
HarmonicLJ14Force
&
force
);
/**
* Execute the kernel to calculate the forces.
*
* @param positions atom coordiantes
* @param forces output forces
*
*/
void
executeForces
(
OpenMMContextImpl
&
context
);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
*
* @return potential energy associated with the harmonic angle force
*
*/
double
executeEnergy
(
OpenMMContextImpl
&
context
);
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int
setLog
(
FILE
*
log
);
/*
* Get contents of object
*
* @param level of dump
*
* @return string containing contents
*
* */
std
::
string
getContents
(
int
level
)
const
;
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE
*
getLog
(
void
)
const
;
/**
* Get number of bonds
*
* @return number of bonds
*
*/
int
getNumberOfBonds
(
void
)
const
;
/**
* Get indices/parameters
*
* @return BrookBondParameters containing atom indices/parameters
*
*/
BrookBondParameters
*
getBrookBondParameters
(
void
)
const
;
private:
static
const
int
NumberOfAtomsInBond
=
3
;
static
const
int
NumberOfParametersInBond
=
2
;
// bond name
static
const
std
::
string
BondName
;
// log file reference
FILE
*
_log
;
// Brook bond parameters
BrookBondParameters
*
_brookBondParameters
;
// interface
OpenMMBrookInterface
&
_openMMBrookInterface
;
// System reference
System
&
_system
;
};
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_ */
platforms/brook/src/BrookCalc
ProperDihedralBon
dForceKernel.cpp
→
platforms/brook/src/BrookCalc
Nonbonde
dForceKernel.cpp
View file @
309008f7
...
@@ -29,40 +29,51 @@
...
@@ -29,40 +29,51 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h"
#include "OpenMMException.h"
#include <sstream>
#include <sstream>
#include "BrookCalcProperDihedralForceKernel.h"
#include "BrookStreamImpl.h"
#include "BrookCalcNonbondedForceKernel.h"
#include "NonbondedForce.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
const
std
::
string
BrookCalc
ProperDihedral
ForceKernel
::
BondName
=
"
ProperDihedral
"
;
const
std
::
string
BrookCalc
Nonbonded
ForceKernel
::
BondName
=
"
LJ14
"
;
/**
/**
* BrookCalc
ProperDihedral
ForceKernel constructor
* BrookCalc
Nonbonded
ForceKernel constructor
*
*
* @param name kernel name
* @param name kernel name
* @param platform platform
* @param platform platform
* @param OpenMMBrookInterface OpenMM-Brook interface
* @param System System reference
*
*
*/
*/
BrookCalc
ProperDihedral
ForceKernel
::
BrookCalc
ProperDihedral
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
BrookCalc
Nonbonded
ForceKernel
::
BrookCalc
Nonbonded
ForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
)
:
Calc
ProperDihedral
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
Calc
Nonbonded
ForceKernel
(
name
,
platform
),
_openMMBrookInterface
(
openMMBrookInterface
),
_system
(
system
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel";
// static const std::string methodName = "BrookCalcNonbondedForceKernel::BrookCalcNonbondedForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
_brookBondParameters
=
NULL
;
_numberOfParticles
=
0
;
_log
=
NULL
;
_brookNonBonded
=
NULL
;
_brookBondParameters
=
NULL
;
_log
=
NULL
;
_refForceField
=
NULL
;
_refSystem
=
NULL
;
_refOpenMMContext
=
NULL
;
_referencePlatform
=
NULL
;
_refVerletIntegrator
=
NULL
;
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
const
BrookPlatform
brookPlatform
=
dynamic_cast
<
const
BrookPlatform
&>
(
platform
);
if
(
brookPlatform
.
getLog
()
!=
NULL
){
if
(
brookPlatform
.
getLog
()
!=
NULL
){
setLog
(
brookPlatform
.
getLog
()
);
setLog
(
brookPlatform
.
getLog
()
);
}
}
...
@@ -70,20 +81,30 @@ BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel( std::str
...
@@ -70,20 +81,30 @@ BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel( std::str
}
}
/**
/**
* BrookCalc
ProperDihedral
ForceKernel destructor
* BrookCalc
Nonbonded
ForceKernel destructor
*
*
*/
*/
BrookCalc
ProperDihedral
ForceKernel
::~
BrookCalc
ProperDihedral
ForceKernel
(
){
BrookCalc
Nonbonded
ForceKernel
::~
BrookCalc
Nonbonded
ForceKernel
(
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel";
// static const std::string methodName = "BrookCalcNonbondedForceKernel::BrookCalcNonbondedForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
delete
_brookBondParameters
;
//delete _brookBondParameters;
delete
_brookNonBonded
;
// deleted w/ kernel delete? If activated, program crashes
//delete _refForceField;
/*
delete _refSystem;
delete _refOpenMMContext;
delete _referencePlatform;
delete _refVerletIntegrator;
*/
}
}
/**
/**
...
@@ -93,7 +114,7 @@ BrookCalcProperDihedralForceKernel::~BrookCalcProperDihedralForceKernel( ){
...
@@ -93,7 +114,7 @@ BrookCalcProperDihedralForceKernel::~BrookCalcProperDihedralForceKernel( ){
*
*
*/
*/
FILE
*
BrookCalc
ProperDihedral
ForceKernel
::
getLog
(
void
)
const
{
FILE
*
BrookCalc
Nonbonded
ForceKernel
::
getLog
(
void
)
const
{
return
_log
;
return
_log
;
}
}
...
@@ -106,24 +127,98 @@ FILE* BrookCalcProperDihedralForceKernel::getLog( void ) const {
...
@@ -106,24 +127,98 @@ FILE* BrookCalcProperDihedralForceKernel::getLog( void ) const {
*
*
*/
*/
int
BrookCalc
ProperDihedral
ForceKernel
::
setLog
(
FILE
*
log
){
int
BrookCalc
Nonbonded
ForceKernel
::
setLog
(
FILE
*
log
){
_log
=
log
;
_log
=
log
;
return
BrookCommon
::
DefaultReturnValue
;
return
BrookCommon
::
DefaultReturnValue
;
}
}
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
void
BrookCalcNonbondedForceKernel
::
initialize
(
const
System
&
system
,
const
NonbondedForce
&
force
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalcNonbondedForceKernel::initialize"
;
// ---------------------------------------------------------------------------------------
FILE
*
log
=
getLog
();
_numberOfParticles
=
force
.
getNumParticles
();
/*
nonbondedMethod = CalcNonbondedForceKernel::NonbondedMethod(force.getNonbondedMethod());
nonbondedCutoff = (RealOpenMM) force.getCutoffDistance();
Vec3 boxVectors[3];
force.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
periodicBoxSize[0] = (RealOpenMM) boxVectors[0][0];
periodicBoxSize[1] = (RealOpenMM) boxVectors[1][1];
periodicBoxSize[2] = (RealOpenMM) boxVectors[2][2];
if (nonbondedMethod == NoCutoff)
neighborList = NULL;
else
neighborList = new NeighborList();
*/
// ---------------------------------------------------------------------------------------
// nonbonded
if
(
_brookNonBonded
){
delete
_brookNonBonded
;
}
_brookNonBonded
=
new
BrookNonBonded
();
_brookNonBonded
->
setLog
(
log
);
// charge & LJ parameters
std
::
vector
<
std
::
vector
<
double
>
>
nonbondedParameters
;
for
(
int
ii
=
0
;
ii
<
_numberOfParticles
;
ii
++
){
double
charge
,
radius
,
depth
;
force
.
getParticleParameters
(
ii
,
charge
,
radius
,
depth
);
std
::
vector
<
double
>
particleParamArray
;
nonbondedParameters
[
ii
]
=
particleParamArray
;
particleParamArray
[
0
]
=
radius
;
particleParamArray
[
1
]
=
depth
;
particleParamArray
[
2
]
=
charge
;
}
_brookNonBonded
->
setup
(
_numberOfParticles
,
nonbondedParameters
,
exclusions
,
getPlatform
()
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
// echo contents
if
(
log
){
std
::
string
contents
=
_brookNonBonded
->
getContentsString
(
);
(
void
)
fprintf
(
log
,
"%s brookNonBonded::contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fflush
(
log
);
}
// nonbonded 14 ixns
initialize14Interactions
(
system
,
force
);
}
/**
/**
* Initialize the kernel, setting up the values of all the force field parameters.
* Initialize the kernel, setting up the values of all the force field parameters.
*
*
* @param system System reference
* @param system System reference
* @param force
ProperDihedral
Force reference
* @param force
HarmonicLJ14
Force reference
*
*
*/
*/
void
BrookCalc
ProperDihedral
ForceKernel
::
initialize
(
const
System
&
system
,
const
ProperDihedral
Force
&
force
){
void
BrookCalc
Nonbonded
ForceKernel
::
initialize
14Interactions
(
const
System
&
system
,
const
Nonbonded
Force
&
force
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"BrookCalc
ProperDihedral
ForceKernel::initialize"
;
static
const
std
::
string
methodName
=
"BrookCalc
Nonbonded
ForceKernel::initialize
14Interactions
"
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -131,85 +226,79 @@ void BrookCalcProperDihedralForceKernel::initialize( const System& system, const
...
@@ -131,85 +226,79 @@ void BrookCalcProperDihedralForceKernel::initialize( const System& system, const
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing
atom
indices/parameters
// create _brookBondParameters object containing
particle
indices/parameters
int
numberOf
Bond
s
=
force
.
getNum
Angles
();
int
numberOf
14Force
s
=
force
.
getNum
Nonbonded14
();
if
(
_brookBondParameters
){
//delete _brookBondParameters;
delete
_brookBondParameters
;
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOfParticlesInBond
,
NumberOfParametersInBond
,
numberOf14Forces
,
getLog
()
);
}
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOfAtomsInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
for
(
int
ii
=
0
;
ii
<
numberOf
Bond
s
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numberOf
14Force
s
;
ii
++
){
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
;
double
angle
,
k
;
double
charge
,
radius
,
depth
;
int
particles
[
NumberOf
Atom
sInBond
];
int
particles
[
NumberOf
Particle
sInBond
];
double
parameters
[
NumberOfParametersInBond
];
double
parameters
[
NumberOfParametersInBond
];
force
.
get
Angle
Parameters
(
ii
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
force
.
get
Nonbonded14
Parameters
(
ii
,
particle1
,
particle2
,
charge
,
radius
,
depth
);
particles
[
0
]
=
particle1
;
particles
[
0
]
=
particle1
;
particles
[
1
]
=
particle2
;
particles
[
1
]
=
particle2
;
particles
[
2
]
=
particle3
;
parameters
[
0
]
=
angle
;
parameters
[
0
]
=
charge
;
parameters
[
1
]
=
k
;
parameters
[
1
]
=
radius
;
parameters
[
2
]
=
depth
;
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
_brookBondParameters
->
setBond
(
ii
,
particles
,
parameters
);
}
}
_openMMBrookInterface
.
setProperDihedralForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setNonBonded14ForceParameters
(
_brookBondParameters
);
_openMMBrookInterface
.
setTriggerForceKernel
(
this
);
_openMMBrookInterface
.
setTriggerEnergyKernel
(
this
);
if
(
log
){
if
(
log
){
std
::
string
contents
=
_brookBondParameters
->
getContentsString
(
);
std
::
string
contents
=
_brookBondParameters
->
getContentsString
(
);
(
void
)
fprintf
(
log
,
"%s
brookGbsa::
contents
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s contents
:
\n
%s"
,
methodName
.
c_str
(),
contents
.
c_str
()
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
}
}
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
}
}
/**
/**
*
Compute forces given a
to
m
c
oordinat
es
*
Execute the kernel
to c
alculate the nonbonded forc
es
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
*/
*/
void
BrookCalc
ProperDihedral
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
void
BrookCalc
Nonbonded
ForceKernel
::
executeForces
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//
static const std::string methodName = "BrookCalc
ProperDihedral
ForceKernel::executeForces";
static
const
std
::
string
methodName
=
"BrookCalc
Nonbonded
ForceKernel::executeForces"
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
if
(
_openMMBrookInterface
.
getTriggerForceKernel
()
==
this
){
if
(
_openMMBrookInterface
.
getTriggerForceKernel
()
==
this
){
_openMMBrookInterface
.
computeForces
(
context
);
_openMMBrookInterface
.
computeForces
(
context
);
}
}
return
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
}
}
/**
/**
* Execute the kernel to calculate the energy
* Execute the kernel to calculate the energy
.
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
* @return potential energy
* @return potential energy due to the NonbondedForce
* Currently always return 0.0 since energies not calculated on gpu
*
*
*/
*/
double
BrookCalc
ProperDihedral
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
double
BrookCalc
Nonbonded
ForceKernel
::
executeEnergy
(
OpenMMContextImpl
&
context
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalc
ProperDihedral
ForceKernel::executeEnergy";
//static const std::string methodName = "BrookCalc
Nonbonded
ForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -217,6 +306,38 @@ double BrookCalcProperDihedralForceKernel::executeEnergy( OpenMMContextImpl& con
...
@@ -217,6 +306,38 @@ double BrookCalcProperDihedralForceKernel::executeEnergy( OpenMMContextImpl& con
return
(
double
)
_openMMBrookInterface
.
computeEnergy
(
context
);
return
(
double
)
_openMMBrookInterface
.
computeEnergy
(
context
);
}
else
{
}
else
{
return
0.0
;
return
0.0
;
}
}
/**
* Get reference Context
*
* @param numberOfParticles number of particles
*
* @return OpenMMContext
*
*/
OpenMMContext
*
BrookCalcNonbondedForceKernel
::
getReferenceOpenMMContext
(
int
numberOfParticles
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcNonbondedForceKernel::getReferenceOpenMMContext";
// ---------------------------------------------------------------------------------------
if
(
_refOpenMMContext
==
NULL
){
_referencePlatform
=
new
ReferencePlatform
();
_refSystem
=
new
System
(
numberOfParticles
,
0
);
_refVerletIntegrator
=
new
VerletIntegrator
(
0.01
);
_refSystem
->
addForce
(
_refForceField
);
_refOpenMMContext
=
new
OpenMMContext
(
*
_refSystem
,
*
_refVerletIntegrator
,
*
_referencePlatform
);
}
}
return
_refOpenMMContext
;
}
}
platforms/brook/src/BrookCalc
StandardMMForceField
Kernel.h
→
platforms/brook/src/BrookCalc
NonbondedForce
Kernel.h
View file @
309008f7
#ifndef OPENMM_BROOK_CALC_
STANDARD_MM
_FORCE
FIELD
_KERNEL_H_
#ifndef OPENMM_BROOK_CALC_
NONBONDED
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_
STANDARD_MM
_FORCE
FIELD
_KERNEL_H_
#define OPENMM_BROOK_CALC_
NONBONDED
_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -33,14 +33,9 @@
...
@@ -33,14 +33,9 @@
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include "kernels.h"
#include "kernels.h"
#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
//#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "BrookBonded.h"
#include "OpenMMBrookInterface.h"
#include "BrookNonBonded.h"
#include "NonbondedForce.h"
#include "NonbondedForce.h"
#include "OpenMMContext.h"
#include "System.h"
#include "ReferencePlatform.h"
#include "VerletIntegrator.h"
namespace
OpenMM
{
namespace
OpenMM
{
...
@@ -51,57 +46,53 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
...
@@ -51,57 +46,53 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
public:
public:
BrookCalcNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
);
BrookCalcNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
OpenMMBrookInterface
&
openMMBrookInterface
,
System
&
system
);
~
BrookCalcNonbondedForceKernel
();
~
BrookCalcNonbondedForceKernel
();
/**
/**
* Initialize the kernel
, setting up the values of all the force field parameters.
* Initialize the kernel
*
*
* @param bondIndices the two atoms connected by each bond term
* @param system the System this kernel will be applied to
* @param bondParameters the force parameters (length, k) for each bond term
* @param force the NonbondedForce this kernel will be used for
* @param angleIndices the three atoms connected by each angle term
* @param exclusions the i'th element lists the indices of all particles with which the i'th particle should not interact through
* @param angleParameters the force parameters (angle, k) for each angle term
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* the standard nonbonded calculation.
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
*/
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
void
initialize
(
const
System
&
system
,
const
NonbondedForce
&
force
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
);
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
/**
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* Initialize the 14 ixns
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
*
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* @param system the System this kernel will be applied to
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* @param force the NonbondedForce this kernel will be used for
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each atom
* @param nonbondedMethod the method to use for handling long range nonbonded interactions
* @param nonbondedCutoff the cutoff distance for nonbonded interactions (if nonbondedMethod involves a cutoff)
* @param periodicBoxSize the size of the periodic box (if nonbondedMethod involves a periodic boundary conditions)
*
*/
*/
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
void
initialize14Interactions
(
const
System
&
system
,
const
NonbondedForce
&
force
);
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
double
lj14Scale
,
double
coulomb14Scale
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
,
NonbondedMethod
nonbondedMethod
,
double
nonbondedCutoff
,
double
periodicBoxSize
[
3
]
);
/**
/**
* Execute the kernel to calculate the forces.
* Execute the kernel to calculate the forces.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each
atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each
particle
* @param forces a Stream of type Double3 containing the force (x, y, z) on each
atom
. On entry, this contains the forces that
* @param forces a Stream of type Double3 containing the force (x, y, z) on each
particle
. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/
*/
void
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
);
void
executeForces
(
const
Stream
&
positions
,
Stream
&
forces
);
/**
* Execute the kernel to calculate the forces.
*
* @param context the context in which to execute this kernel
*/
void
executeForces
(
OpenMMContextImpl
&
context
);
/**
/**
* Execute the kernel to calculate the energy.
* Execute the kernel to calculate the energy.
*
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each
atom
* @param positions a Stream of type Double3 containing the position (x, y, z) of each
particle
*
*
* @return the potential energy due to the NonbondedForce
* @return the potential energy due to the NonbondedForce
*
*
...
@@ -109,19 +100,26 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
...
@@ -109,19 +100,26 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
*/
*/
double
executeEnergy
(
const
Stream
&
positions
);
double
executeEnergy
(
const
Stream
&
positions
);
double
executeEnergyOld
(
const
Stream
&
positions
);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedForce
*/
double
executeEnergy
(
OpenMMContextImpl
&
context
);
/**
/**
* Get reference Context
* Get reference Context
*
*
* @param numberOf
Atom
s number of
atom
s
* @param numberOf
Particle
s number of
particle
s
*
*
* @return OpenMMContext
* @return OpenMMContext
*
*
*/
*/
OpenMMContext
*
getReferenceOpenMMContext
(
int
numberOfAtoms
);
OpenMMContext
*
getReferenceOpenMMContext
(
int
numberOfParticles
);
/**
/**
* Set log file reference
* Set log file reference
...
@@ -156,19 +154,30 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
...
@@ -156,19 +154,30 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
private:
private:
// LJ14 'bond' name
static
const
std
::
string
BondName
;
static
const
int
NumberOfParticlesInBond
=
2
;
static
const
int
NumberOfParametersInBond
=
3
;
// log file reference
// log file reference
FILE
*
_log
;
FILE
*
_log
;
// number of
atom
s
// number of
particle
s
int
_numberOf
Atom
s
;
int
_numberOf
Particle
s
;
// Brook
bonded &
nonbonded
// Brook nonbonded
BrookBonded
*
_brookBonded
;
BrookNonBonded
*
_brookNonBonded
;
BrookNonBonded
*
_brookNonBonded
;
OpenMMBrookInterface
&
_openMMBrookInterface
;
System
&
_system
;
BrookBondParameters
*
_brookBondParameters
;
// used to calculate energy
// used to calculate energy
NonbondedForce
*
_refForceField
;
NonbondedForce
*
_refForceField
;
...
@@ -181,4 +190,4 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
...
@@ -181,4 +190,4 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_CALC_
STANDARD_MM
_FORCE
FIELD
_KERNEL_H_ */
#endif
/* OPENMM_BROOK_CALC_
NONBONDED
_FORCE_KERNEL_H_ */
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.cpp
View file @
309008f7
...
@@ -131,21 +131,21 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
...
@@ -131,21 +131,21 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing
atom
indices/parameters
// create _brookBondParameters object containing
particle
indices/parameters
int
numberOfBonds
=
force
.
getNumTorsions
();
int
numberOfBonds
=
force
.
getNumTorsions
();
if
(
_brookBondParameters
){
if
(
_brookBondParameters
){
delete
_brookBondParameters
;
delete
_brookBondParameters
;
}
}
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Atom
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
_brookBondParameters
=
new
BrookBondParameters
(
BondName
,
NumberOf
Particle
sInBond
,
NumberOfParametersInBond
,
numberOfBonds
,
getLog
()
);
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numberOfBonds
;
ii
++
){
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
double
phase
,
k
;
double
phase
,
k
;
int
particles
[
NumberOf
Atom
sInBond
];
int
particles
[
NumberOf
Particle
sInBond
];
double
parameters
[
NumberOfParametersInBond
];
double
parameters
[
NumberOfParametersInBond
];
force
.
getTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
,
phase
,
k
);
force
.
getTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
,
phase
,
k
);
...
@@ -175,7 +175,7 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
...
@@ -175,7 +175,7 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
}
}
/**
/**
* Compute forces given
atom
coordinates
* Compute forces given
particle
coordinates
*
*
* @param context OpenMMContextImpl context
* @param context OpenMMContextImpl context
*
*
...
...
platforms/brook/src/BrookCalcPeriodicTorsionForceKernel.h
View file @
309008f7
#ifndef OPENMM_BROOK_CALC_P
ROPER_DIHEDRAL
_FORCE_KERNEL_H_
#ifndef OPENMM_BROOK_CALC_P
ERIODIC_TORSION
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_P
ROPER_DIHEDRAL
_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_P
ERIODIC_TORSION
_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
/* -------------------------------------------------------------------------- *
* OpenMM *
* OpenMM *
...
@@ -72,7 +72,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
...
@@ -72,7 +72,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
/**
/**
* Execute the kernel to calculate the forces.
* Execute the kernel to calculate the forces.
*
*
* @param positions
atom
coordiantes
* @param positions
particle
coordiantes
* @param forces output forces
* @param forces output forces
*
*
*/
*/
...
@@ -133,7 +133,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
...
@@ -133,7 +133,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
/**
/**
* Get indices/parameters
* Get indices/parameters
*
*
* @return BrookBondParameters containing
atom
indices/parameters
* @return BrookBondParameters containing
particle
indices/parameters
*
*
*/
*/
...
@@ -141,7 +141,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
...
@@ -141,7 +141,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
private:
private:
static
const
int
NumberOf
Atom
sInBond
=
4
;
static
const
int
NumberOf
Particle
sInBond
=
4
;
static
const
int
NumberOfParametersInBond
=
3
;
static
const
int
NumberOfParametersInBond
=
3
;
// bond name
// bond name
...
@@ -169,4 +169,4 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
...
@@ -169,4 +169,4 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
}
// namespace OpenMM
}
// namespace OpenMM
#endif
/* OPENMM_BROOK_CALC_P
ROPER_DIHEDRAL
_FORCE_KERNEL_H_ */
#endif
/* OPENMM_BROOK_CALC_P
ERIODIC_TORSION
_FORCE_KERNEL_H_ */
Prev
1
2
3
4
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