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
6718e0cc
Commit
6718e0cc
authored
Oct 05, 2011
by
Mark Friedrichs
Browse files
Code cleanup
parent
1079a319
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
654 additions
and
1154 deletions
+654
-1154
plugins/freeEnergy/platforms/reference/src/gbsa/CpuGBVISoftcore.cpp
...eeEnergy/platforms/reference/src/gbsa/CpuGBVISoftcore.cpp
+2
-4
plugins/freeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.cpp
...reeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.cpp
+307
-504
plugins/freeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.h
.../freeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.h
+39
-20
plugins/freeEnergy/platforms/reference/src/gbsa/ObcSoftcoreParameters.cpp
...gy/platforms/reference/src/gbsa/ObcSoftcoreParameters.cpp
+190
-529
plugins/freeEnergy/platforms/reference/src/gbsa/ObcSoftcoreParameters.h
...ergy/platforms/reference/src/gbsa/ObcSoftcoreParameters.h
+116
-97
No files found.
plugins/freeEnergy/platforms/reference/src/gbsa/CpuGBVISoftcore.cpp
View file @
6718e0cc
...
...
@@ -23,15 +23,13 @@
*/
#include <string.h>
#include <math.h>
#include <sstream>
#include <vector>
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "../SimTKUtilities/SimTKOpenMMLog.h"
#include "../SimTKUtilities/SimTKOpenMMUtilities.h"
#include "CpuGBVISoftcore.h"
#include "../SimTKReference/ReferenceForce.h"
#include
<math
.h
>
#include
"CpuGBVISoftcore
.h
"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
...
...
plugins/freeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.cpp
View file @
6718e0cc
This diff is collapsed.
Click to expand it.
plugins/freeEnergy/platforms/reference/src/gbsa/CpuObcSoftcore.h
View file @
6718e0cc
...
...
@@ -30,7 +30,7 @@
// ---------------------------------------------------------------------------------------
class
CpuObcSoftcore
:
public
CpuImplicitSolvent
{
class
CpuObcSoftcore
{
private:
...
...
@@ -40,13 +40,12 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
// arrays containing OBC chain derivative
std
::
vector
<
RealOpenMM
>
_obcChain
;
std
::
vector
<
RealOpenMM
>
_obcChainTemp
;
RealOpenMMVector
_obcChain
;
//
initialize data members (more tha
n
//
one constructor, so centralize intialization here)
//
flag to signal whether ACE approximatio
n
//
is to be included
void
_initializeObcDataMembers
(
void
)
;
int
_includeAceApproximation
;
public:
...
...
@@ -60,7 +59,7 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
--------------------------------------------------------------------------------------- */
CpuObcSoftcore
(
ImplicitSolvent
Parameters
*
obcSoftcoreParameters
);
CpuObcSoftcore
(
ObcSoftcore
Parameters
*
obcSoftcoreParameters
);
/**---------------------------------------------------------------------------------------
...
...
@@ -92,26 +91,45 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
/**---------------------------------------------------------------------------------------
Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms()
On first call, memory for array is allocated if not set
Return flag signalling whether AceApproximation for nonpolar term is to be included
@return
array
@return
flag
--------------------------------------------------------------------------------------- */
std
::
vector
<
RealOpenMM
>&
getObcChain
(
void
);
const
std
::
vector
<
RealOpenMM
>&
getObcChainConst
(
void
)
const
;
int
includeAceApproximation
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set flag indicating whether AceApproximation is to be included
@param includeAceApproximation new includeAceApproximation value
--------------------------------------------------------------------------------------- */
void
setIncludeAceApproximation
(
int
includeAceApproximation
);
/**---------------------------------------------------------------------------------------
Return OBC chain temp work array of size=_implicitSolventParameters->getNumberOfAtoms()
Get energy
@return energy
--------------------------------------------------------------------------------------- */
RealOpenMM
getEnergy
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms()
On first call, memory for array is allocated if not set
@return array
--------------------------------------------------------------------------------------- */
std
::
vector
<
RealOpenMM
>
&
getObcChain
Temp
(
void
);
RealOpenMM
Vector
&
getObcChain
(
void
);
/**---------------------------------------------------------------------------------------
...
...
@@ -124,7 +142,7 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
--------------------------------------------------------------------------------------- */
void
computeBornRadii
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
RealOpenMM
>
&
bornRadii
);
void
computeBornRadii
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
Vector
&
bornRadii
);
/**---------------------------------------------------------------------------------------
...
...
@@ -139,22 +157,23 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
--------------------------------------------------------------------------------------- */
void
computeAceNonPolarForce
(
const
ObcSoftcoreParameters
*
obcSoftcoreParameters
,
const
std
::
vector
<
RealOpenMM
>
&
bornRadii
,
RealOpenMM
*
energy
,
std
::
vector
<
RealOpenMM
>
&
forces
)
const
;
const
RealOpenMM
Vector
&
bornRadii
,
RealOpenMM
*
energy
,
RealOpenMM
Vector
&
forces
)
const
;
/**---------------------------------------------------------------------------------------
Get Born energy and forces based on OBC
@param bornRadii Born radii
@param atomCoordinates atomic coordinates
@param partialCharges partial charges
@param forces forces
@return energy
--------------------------------------------------------------------------------------- */
void
computeBornEnergyForces
(
std
::
vector
<
RealOpenMM
>&
bornRadii
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
RealOpenMM
*
partialCharges
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
);
RealOpenMM
computeBornEnergyForces
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
RealOpenMM
Vector
&
partialCharges
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
);
};
// ---------------------------------------------------------------------------------------
...
...
plugins/freeEnergy/platforms/reference/src/gbsa/ObcSoftcoreParameters.cpp
View file @
6718e0cc
This diff is collapsed.
Click to expand it.
plugins/freeEnergy/platforms/reference/src/gbsa/ObcSoftcoreParameters.h
View file @
6718e0cc
/* Portions copyright (c) 2006-2009 Stanford University and Simbios.
* Contributors: Pande Group
*
...
...
@@ -26,11 +25,10 @@
#define __ObcSoftcoreParameters_H__
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "gbsa/ImplicitSolventParameters.h"
// ---------------------------------------------------------------------------------------
class
ObcSoftcoreParameters
:
public
ImplicitSolventParameters
{
class
ObcSoftcoreParameters
{
public:
...
...
@@ -38,37 +36,42 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
enum
ObcType
{
ObcTypeI
,
ObcTypeII
};
static
const
std
::
string
ParameterFileName
;
private:
int
_numberOfAtoms
;
// OBC constants & parameters
RealOpenMM
_dielectricOffset
;
RealOpenMM
_alphaObc
;
RealOpenMM
_betaObc
;
RealOpenMM
_gammaObc
;
RealOpenMM
_probeRadius
;
RealOpenMM
_pi4Asolv
;
ObcType
_obcType
;
RealOpenMM
_nonPolarPreFactor
;
RealOpenMM
_solventDielectric
;
RealOpenMM
_soluteDielectric
;
RealOpenMM
_electricConstant
;
// scaling factors for nonpolar term
int
_ownNonPolarScaleFactors
;
RealOpenMM
*
_nonPolarScaleFactors
;
RealOpenMMVector
_atomicRadii
;
RealOpenMM
Vector
_nonPolarScaleFactors
;
// scaled radius factors (S_kk in HCT paper)
int
_ownScaledRadiusFactors
;
RealOpenMM
*
_scaledRadiusFactors
;
RealOpenMMVector
_scaledRadiusFactors
;
// cutoff and periodic boundary conditions
bool
cutoff
;
bool
periodic
;
RealOpenMM
periodicBoxSize
[
3
];
RealOpenMM
cutoffDistance
;
bool
_
cutoff
;
bool
_
periodic
;
RealOpenMM
_
periodicBoxSize
[
3
];
RealOpenMM
_
cutoffDistance
;
public:
...
...
@@ -92,153 +95,194 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
/**---------------------------------------------------------------------------------------
Get
OBC type
Get
number of atoms
@return
OBC type
@return
number of atoms
--------------------------------------------------------------------------------------- */
ObcSoftcoreParameters
::
ObcType
getObcType
(
void
)
const
;
int
getNumberOfAtoms
(
void
)
const
;
/**---------------------------------------------------------------------------------------
S
et
OBC type specific parameters
G
et
electric constant
@
param obcType OBC type (ObcTypeI or ObcTypeII -- Eq. 7 or 8)
@
return electric constant
--------------------------------------------------------------------------------------- */
void
setObcTypeParameters
(
ObcSoftcoreParameters
::
ObcType
obcType
)
;
RealOpenMM
getElectricConstant
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get
alpha OBC (Eqs. 6 & 7) in Proteins paper
Get
probe radius (Simbios)
@return
alphaObc
@return
probeRadius
--------------------------------------------------------------------------------------- */
RealOpenMM
get
AlphaObc
(
void
)
const
;
RealOpenMM
get
ProbeRadius
(
void
)
const
;
/**---------------------------------------------------------------------------------------
G
et
beta OBC (Eqs. 6 & 7) in Proteins paper
S
et
probe radius (Simbios)
@
return betaObc
@
param probeRadius probe radius
--------------------------------------------------------------------------------------- */
RealOpenMM
getBetaObc
(
void
)
const
;
void
setProbeRadius
(
RealOpenMM
probeRadius
)
;
/**---------------------------------------------------------------------------------------
Get gamma OBC (Eqs. 6 & 7) in Proteins paper
Get pi4Asolv: used in ACE approximation for nonpolar term
((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f; (Simbios)
@return
gammaObc
@return
pi4Asolv
--------------------------------------------------------------------------------------- */
RealOpenMM
get
GammaObc
(
void
)
const
;
RealOpenMM
get
Pi4Asolv
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get solvent dielectric
(Simbios)
Get solvent dielectric
@return
dielectricOffse
t dielectric
offset
@return
solven
t dielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
getDielectric
Offset
(
void
)
const
;
RealOpenMM
get
Solvent
Dielectric
(
void
)
const
;
/**---------------------------------------------------------------------------------------
R
et
urn OBC scale factors
S
et
solvent dielectric
@
return array
@
param solventDielectric solvent dielectric
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getScaledRadiusFactors
(
void
)
const
;
void
setSolventDielectric
(
RealOpenMM
solventDielectric
)
;
/**---------------------------------------------------------------------------------------
R
et
urn OBC scale factors
G
et
solute dielectric
@return
array
@return
soluteDielectric
--------------------------------------------------------------------------------------- */
void
setScaledRadiusFactors
(
RealOpenMM
*
scaledRadiusFactors
);
#if RealOpenMMType == 0
void
setScaledRadiusFactors
(
float
*
scaledRadiusFactors
);
#endif
void
setScaledRadiusFactors
(
const
RealOpenMMVector
&
scaledRadiusFactors
);
RealOpenMM
getSoluteDielectric
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set
flag indicating whether scale factors arra should be deleted
Set
solute dielectric
@param ownScaledRadiusFactors flag indicating whether scale factors
array should be deleted
@param soluteDielectric solute dielectric
--------------------------------------------------------------------------------------- */
void
set
OwnScaleFactors
(
int
ownScaledRadiusFactors
);
void
set
SoluteDielectric
(
RealOpenMM
soluteDielectric
);
/**---------------------------------------------------------------------------------------
Get
AtomicRadii array w/ dielectric offset applied
Get
OBC type
@return
array of atom volumes
@return
OBC type
--------------------------------------------------------------------------------------- */
RealOpenMM
*
getAtomicRadii
(
void
)
const
;
ObcSoftcoreParameters
::
ObcType
getObcType
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set
AtomicRadii array
Set
OBC type specific parameters
@param
atomicRadii array of atomic radii
@param
obcType OBC type (ObcTypeI or ObcTypeII -- Eq. 7 or 8)
--------------------------------------------------------------------------------------- */
void
set
AtomicRadii
(
RealOpenMM
*
atomicRadii
);
void
set
ObcTypeParameters
(
ObcSoftcoreParameters
::
ObcType
obcType
);
/**---------------------------------------------------------------------------------------
S
et
AtomicRadii array
G
et
alpha OBC (Eqs. 6 & 7) in Proteins paper
@
param atomicRadii vector of atomic radii
@
return alphaObc
--------------------------------------------------------------------------------------- */
void
setAtomicRadii
(
const
RealOpenMMVector
&
atomicRadii
)
;
RealOpenMM
getAlphaObc
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Map Gmx atom name to Tinker atom number (Simbios)
Get beta OBC (Eqs. 6 & 7) in Proteins paper
@param atomName atom name (CA, HA, ...); upper and lower case should both work
@param log if set, then print error messages to log file
@return betaObc
return Tinker atom number if atom name is valid; else return -1
--------------------------------------------------------------------------------------- */
RealOpenMM
getBetaObc
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get gamma OBC (Eqs. 6 & 7) in Proteins paper
@return gammaObc
--------------------------------------------------------------------------------------- */
int
mapGmxAtomNameToTinkerAtomNumber
(
const
char
*
atomName
,
FILE
*
log
)
const
;
RealOpenMM
getGammaObc
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get solvent dielectric (Simbios)
@return dielectricOffset dielectric offset
--------------------------------------------------------------------------------------- */
RealOpenMM
getDielectricOffset
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Return OBC scale factors
@return array
--------------------------------------------------------------------------------------- */
const
RealOpenMMVector
&
getScaledRadiusFactors
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set OBC scale factors
@param input vector of radius factors
--------------------------------------------------------------------------------------- */
void
setScaledRadiusFactors
(
const
RealOpenMMVector
&
scaledRadiusFactors
);
/**---------------------------------------------------------------------------------------
Get
string w/ state
Get
AtomicRadii array w/ dielectric offset applied
@
param title title (optional)
@
return array of atom volumes
@return string
--------------------------------------------------------------------------------------- */
const
RealOpenMMVector
&
getAtomicRadii
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set AtomicRadii array
@param atomicRadii vector of atomic radii
--------------------------------------------------------------------------------------- */
std
::
string
getStateString
(
const
char
*
title
)
const
;
void
setAtomicRadii
(
const
RealOpenMMVector
&
atomicRadii
)
;
/**---------------------------------------------------------------------------------------
...
...
@@ -256,7 +300,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
bool
getUseCutoff
();
bool
getUseCutoff
(
void
);
/**---------------------------------------------------------------------------------------
...
...
@@ -264,7 +308,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getCutoffDistance
();
RealOpenMM
getCutoffDistance
(
void
);
/**---------------------------------------------------------------------------------------
...
...
@@ -284,7 +328,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
bool
getPeriodic
();
bool
getPeriodic
(
void
);
/**---------------------------------------------------------------------------------------
...
...
@@ -292,29 +336,17 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getPeriodicBox
();
/**---------------------------------------------------------------------------------------
Set flag indicating whether scale factors array should be deleted
@param ownNonPolarScaleFactors flag indicating whether scale factors
array should be deleted
--------------------------------------------------------------------------------------- */
void
setOwnNonPolarScaleFactors
(
int
ownNonPolarScaleFactors
);
const
RealOpenMM
*
getPeriodicBox
(
void
);
/**---------------------------------------------------------------------------------------
Return non-polar scale factors
If not previously set, allocate space
@return array
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getNonPolarScaleFactors
(
void
)
const
;
const
RealOpenMM
Vector
&
getNonPolarScaleFactors
(
void
)
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -338,19 +370,6 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
};
/**---------------------------------------------------------------------------------------
Qsort/heapsort integer comparison (Simbios)
@parma a first value to compare
@param b second value to compare
@return -1, 0, 1
--------------------------------------------------------------------------------------- */
int
integerComparison
(
const
void
*
a
,
const
void
*
b
);
// ---------------------------------------------------------------------------------------
#endif // __ObcSoftcoreParameters_H__
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