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
Hide 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 @@
...
@@ -23,15 +23,13 @@
*/
*/
#include <string.h>
#include <string.h>
#include <math.h>
#include <sstream>
#include <sstream>
#include <vector>
#include <vector>
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "../SimTKUtilities/SimTKOpenMMLog.h"
#include "../SimTKUtilities/SimTKOpenMMUtilities.h"
#include "CpuGBVISoftcore.h"
#include "../SimTKReference/ReferenceForce.h"
#include "../SimTKReference/ReferenceForce.h"
#include
<math
.h
>
#include
"CpuGBVISoftcore
.h
"
using
std
::
vector
;
using
std
::
vector
;
using
OpenMM
::
RealVec
;
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 @@
...
@@ -30,7 +30,7 @@
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
class
CpuObcSoftcore
:
public
CpuImplicitSolvent
{
class
CpuObcSoftcore
{
private:
private:
...
@@ -40,13 +40,12 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
...
@@ -40,13 +40,12 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
// arrays containing OBC chain derivative
// arrays containing OBC chain derivative
std
::
vector
<
RealOpenMM
>
_obcChain
;
RealOpenMMVector
_obcChain
;
std
::
vector
<
RealOpenMM
>
_obcChainTemp
;
//
initialize data members (more tha
n
//
flag to signal whether ACE approximatio
n
//
one constructor, so centralize intialization here)
//
is to be included
void
_initializeObcDataMembers
(
void
)
;
int
_includeAceApproximation
;
public:
public:
...
@@ -60,7 +59,7 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
...
@@ -60,7 +59,7 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
CpuObcSoftcore
(
ImplicitSolvent
Parameters
*
obcSoftcoreParameters
);
CpuObcSoftcore
(
ObcSoftcore
Parameters
*
obcSoftcoreParameters
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -92,26 +91,45 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
...
@@ -92,26 +91,45 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms()
Return flag signalling whether AceApproximation for nonpolar term is to be included
On first call, memory for array is allocated if not set
@return array
@return flag
--------------------------------------------------------------------------------------- */
int
includeAceApproximation
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set flag indicating whether AceApproximation is to be included
@param includeAceApproximation new includeAceApproximation value
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
setIncludeAceApproximation
(
int
includeAceApproximation
);
/**---------------------------------------------------------------------------------------
Get energy
std
::
vector
<
RealOpenMM
>&
getObcChain
(
void
);
@return energy
const
std
::
vector
<
RealOpenMM
>&
getObcChainConst
(
void
)
const
;
--------------------------------------------------------------------------------------- */
RealOpenMM
getEnergy
(
void
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Return OBC chain
temp work array of
size
=
_implicitSolventParameters->getNumberOfAtoms()
Return OBC chain
derivative:
size
=
_implicitSolventParameters->getNumberOfAtoms()
On first call, memory for array is allocated if not set
On first call, memory for array is allocated if not set
@return array
@return array
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
std
::
vector
<
RealOpenMM
>
&
getObcChain
Temp
(
void
);
RealOpenMM
Vector
&
getObcChain
(
void
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -124,7 +142,7 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
...
@@ -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 {
...
@@ -139,22 +157,23 @@ class CpuObcSoftcore : public CpuImplicitSolvent {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
computeAceNonPolarForce
(
const
ObcSoftcoreParameters
*
obcSoftcoreParameters
,
void
computeAceNonPolarForce
(
const
ObcSoftcoreParameters
*
obcSoftcoreParameters
,
const
std
::
vector
<
RealOpenMM
>
&
bornRadii
,
RealOpenMM
*
energy
,
const
RealOpenMM
Vector
&
bornRadii
,
RealOpenMM
*
energy
,
std
::
vector
<
RealOpenMM
>
&
forces
)
const
;
RealOpenMM
Vector
&
forces
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get Born energy and forces based on OBC
Get Born energy and forces based on OBC
@param bornRadii Born radii
@param atomCoordinates atomic coordinates
@param atomCoordinates atomic coordinates
@param partialCharges partial charges
@param partialCharges partial charges
@param forces forces
@param forces forces
@return energy
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
computeBornEnergyForces
(
std
::
vector
<
RealOpenMM
>&
bornRadii
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
computeBornEnergyForces
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
RealOpenMM
*
partialCharges
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
);
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.
/* Portions copyright (c) 2006-2009 Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
...
@@ -26,11 +25,10 @@
...
@@ -26,11 +25,10 @@
#define __ObcSoftcoreParameters_H__
#define __ObcSoftcoreParameters_H__
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "gbsa/ImplicitSolventParameters.h"
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
class
ObcSoftcoreParameters
:
public
ImplicitSolventParameters
{
class
ObcSoftcoreParameters
{
public:
public:
...
@@ -38,37 +36,42 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -38,37 +36,42 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
enum
ObcType
{
ObcTypeI
,
ObcTypeII
};
enum
ObcType
{
ObcTypeI
,
ObcTypeII
};
static
const
std
::
string
ParameterFileName
;
private:
private:
int
_numberOfAtoms
;
// OBC constants & parameters
// OBC constants & parameters
RealOpenMM
_dielectricOffset
;
RealOpenMM
_dielectricOffset
;
RealOpenMM
_alphaObc
;
RealOpenMM
_alphaObc
;
RealOpenMM
_betaObc
;
RealOpenMM
_betaObc
;
RealOpenMM
_gammaObc
;
RealOpenMM
_gammaObc
;
RealOpenMM
_probeRadius
;
RealOpenMM
_pi4Asolv
;
ObcType
_obcType
;
ObcType
_obcType
;
RealOpenMM
_nonPolarPreFactor
;
RealOpenMM
_nonPolarPreFactor
;
RealOpenMM
_solventDielectric
;
RealOpenMM
_soluteDielectric
;
RealOpenMM
_electricConstant
;
// scaling factors for nonpolar term
// scaling factors for nonpolar term
int
_ownNonPolarScaleFactors
;
RealOpenMMVector
_atomicRadii
;
RealOpenMM
*
_nonPolarScaleFactors
;
RealOpenMM
Vector
_nonPolarScaleFactors
;
// scaled radius factors (S_kk in HCT paper)
// scaled radius factors (S_kk in HCT paper)
int
_ownScaledRadiusFactors
;
RealOpenMMVector
_scaledRadiusFactors
;
RealOpenMM
*
_scaledRadiusFactors
;
// cutoff and periodic boundary conditions
// cutoff and periodic boundary conditions
bool
cutoff
;
bool
_
cutoff
;
bool
periodic
;
bool
_
periodic
;
RealOpenMM
periodicBoxSize
[
3
];
RealOpenMM
_
periodicBoxSize
[
3
];
RealOpenMM
cutoffDistance
;
RealOpenMM
_
cutoffDistance
;
public:
public:
...
@@ -90,6 +93,97 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -90,6 +93,97 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
~
ObcSoftcoreParameters
(
);
~
ObcSoftcoreParameters
(
);
/**---------------------------------------------------------------------------------------
Get number of atoms
@return number of atoms
--------------------------------------------------------------------------------------- */
int
getNumberOfAtoms
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get electric constant
@return electric constant
--------------------------------------------------------------------------------------- */
RealOpenMM
getElectricConstant
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get probe radius (Simbios)
@return probeRadius
--------------------------------------------------------------------------------------- */
RealOpenMM
getProbeRadius
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set probe radius (Simbios)
@param probeRadius probe radius
--------------------------------------------------------------------------------------- */
void
setProbeRadius
(
RealOpenMM
probeRadius
);
/**---------------------------------------------------------------------------------------
Get pi4Asolv: used in ACE approximation for nonpolar term
((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f; (Simbios)
@return pi4Asolv
--------------------------------------------------------------------------------------- */
RealOpenMM
getPi4Asolv
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get solvent dielectric
@return solvent dielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
getSolventDielectric
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set solvent dielectric
@param solventDielectric solvent dielectric
--------------------------------------------------------------------------------------- */
void
setSolventDielectric
(
RealOpenMM
solventDielectric
);
/**---------------------------------------------------------------------------------------
Get solute dielectric
@return soluteDielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
getSoluteDielectric
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set solute dielectric
@param soluteDielectric solute dielectric
--------------------------------------------------------------------------------------- */
void
setSoluteDielectric
(
RealOpenMM
soluteDielectric
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get OBC type
Get OBC type
...
@@ -158,33 +252,18 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -158,33 +252,18 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getScaledRadiusFactors
(
void
)
const
;
const
RealOpenMM
Vector
&
getScaledRadiusFactors
(
void
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
R
et
urn
OBC scale factors
S
et OBC scale factors
@
return array
@
param input vector of radius factors
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
setScaledRadiusFactors
(
RealOpenMM
*
scaledRadiusFactors
);
#if RealOpenMMType == 0
void
setScaledRadiusFactors
(
float
*
scaledRadiusFactors
);
#endif
void
setScaledRadiusFactors
(
const
RealOpenMMVector
&
scaledRadiusFactors
);
void
setScaledRadiusFactors
(
const
RealOpenMMVector
&
scaledRadiusFactors
);
/**---------------------------------------------------------------------------------------
Set flag indicating whether scale factors arra should be deleted
@param ownScaledRadiusFactors flag indicating whether scale factors
array should be deleted
--------------------------------------------------------------------------------------- */
void
setOwnScaleFactors
(
int
ownScaledRadiusFactors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get AtomicRadii array w/ dielectric offset applied
Get AtomicRadii array w/ dielectric offset applied
...
@@ -193,17 +272,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -193,17 +272,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
RealOpenMM
*
getAtomicRadii
(
void
)
const
;
const
RealOpenMMVector
&
getAtomicRadii
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set AtomicRadii array
@param atomicRadii array of atomic radii
--------------------------------------------------------------------------------------- */
void
setAtomicRadii
(
RealOpenMM
*
atomicRadii
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -215,31 +284,6 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -215,31 +284,6 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
void
setAtomicRadii
(
const
RealOpenMMVector
&
atomicRadii
);
void
setAtomicRadii
(
const
RealOpenMMVector
&
atomicRadii
);
/**---------------------------------------------------------------------------------------
Map Gmx atom name to Tinker atom number (Simbios)
@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 Tinker atom number if atom name is valid; else return -1
--------------------------------------------------------------------------------------- */
int
mapGmxAtomNameToTinkerAtomNumber
(
const
char
*
atomName
,
FILE
*
log
)
const
;
/**---------------------------------------------------------------------------------------
Get string w/ state
@param title title (optional)
@return string
--------------------------------------------------------------------------------------- */
std
::
string
getStateString
(
const
char
*
title
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Set the force to use a cutoff.
Set the force to use a cutoff.
...
@@ -256,7 +300,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -256,7 +300,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
bool
getUseCutoff
();
bool
getUseCutoff
(
void
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -264,7 +308,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -264,7 +308,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
RealOpenMM
getCutoffDistance
();
RealOpenMM
getCutoffDistance
(
void
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -284,7 +328,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -284,7 +328,7 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
bool
getPeriodic
();
bool
getPeriodic
(
void
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -292,29 +336,17 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -292,29 +336,17 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getPeriodicBox
();
const
RealOpenMM
*
getPeriodicBox
(
void
);
/**---------------------------------------------------------------------------------------
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
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Return non-polar scale factors
Return non-polar scale factors
If not previously set, allocate space
@return array
@return array
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
const
RealOpenMM
*
getNonPolarScaleFactors
(
void
)
const
;
const
RealOpenMM
Vector
&
getNonPolarScaleFactors
(
void
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -338,19 +370,6 @@ class ObcSoftcoreParameters : public ImplicitSolventParameters {
...
@@ -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__
#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