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
e20cc4f2
Commit
e20cc4f2
authored
Sep 30, 2010
by
Mark Friedrichs
Browse files
Initial AmoebaReferenceMultipoleForce
parent
6d91d79d
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2398 additions
and
205 deletions
+2398
-205
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
...amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
+1
-1
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
.../platforms/reference/src/AmoebaReferenceKernelFactory.cpp
+2
-2
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
...amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
+102
-173
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
...s/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
+44
-28
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
...rms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
+129
-0
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.h
...forms/reference/src/SimTKReference/AmoebaReferenceForce.h
+17
-0
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
...ence/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
+1622
-0
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.h
...erence/src/SimTKReference/AmoebaReferenceMultipoleForce.h
+481
-0
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceVdwForce.h
...ms/reference/src/SimTKReference/AmoebaReferenceVdwForce.h
+0
-1
No files found.
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
View file @
e20cc4f2
...
...
@@ -4733,7 +4733,7 @@ void testUsingAmoebaTinkerParameterFile( const std::string& amoebaTinkerParamete
}
}
if
(
gkIsActive
==
false
){
if
(
0
&&
gkIsActive
==
false
){
isPresent
=
forceMap
.
find
(
AMOEBA_MULTIPOLE_FORCE
);
if
(
isPresent
!=
forceMap
.
end
()
&&
isPresent
->
second
!=
0
){
//checkIntermediateMultipoleQuantities( context, supplementary, useOpenMMUnits, log );
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
View file @
e20cc4f2
...
...
@@ -47,8 +47,8 @@ extern "C" void OPENMM_EXPORT registerKernelFactories() {
platform
.
registerKernelFactory
(
CalcAmoebaOutOfPlaneBendForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaTorsionTorsionForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaVdwForceKernel
::
Name
(),
factory
);
/*
platform
.
registerKernelFactory
(
CalcAmoebaMultipoleForceKernel
::
Name
(),
factory
);
/*
platform.registerKernelFactory(CalcAmoebaGeneralizedKirkwoodForceKernel::Name(), factory);
*/
platform
.
registerKernelFactory
(
CalcAmoebaWcaDispersionForceKernel
::
Name
(),
factory
);
...
...
@@ -87,11 +87,11 @@ KernelImpl* AmoebaReferenceKernelFactory::createKernelImpl(std::string name, con
if
(
name
==
CalcAmoebaVdwForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaVdwForceKernel
(
name
,
platform
,
context
.
getSystem
());
/*
if
(
name
==
CalcAmoebaMultipoleForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaMultipoleForceKernel
(
name
,
platform
,
context
.
getSystem
());
/*
if (name == CalcAmoebaGeneralizedKirkwoodForceKernel::Name())
return new ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel(name, platform, context.getSystem());
*/
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
View file @
e20cc4f2
...
...
@@ -33,12 +33,14 @@
#include "AmoebaReferenceStretchBendForce.h"
#include "AmoebaReferenceOutOfPlaneBendForce.h"
#include "AmoebaReferenceTorsionTorsionForce.h"
#include "AmoebaReferenceMultipoleForce.h"
#include "AmoebaReferenceVdwForce.h"
#include "AmoebaReferenceWcaDispersionForce.h"
#include "internal/AmoebaWcaDispersionForceImpl.h"
#include "ReferencePlatform.h"
#include "openmm/internal/ContextImpl.h"
//#include "internal/AmoebaMultipoleForceImpl.h"
#include "AmoebaMultipoleForce.h"
#include "internal/AmoebaMultipoleForceImpl.h"
#include <cmath>
#ifdef _MSC_VER
...
...
@@ -399,178 +401,105 @@ double ReferenceCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& contex
return
static_cast
<
double
>
(
energy
);
}
///* -------------------------------------------------------------------------- *
// * AmoebaMultipole *
// * -------------------------------------------------------------------------- */
//
//static void computeAmoebaMultipoleForce( AmoebaCudaData& data ) {
//
// amoebaGpuContext gpu = data.getAmoebaGpu();
// data.initializeGpu();
//
// if( 0 && data.getLog() ){
// (void) fprintf( data.getLog(), "computeAmoebaMultipoleForce\n" );
// (void) fflush( data.getLog());
// }
//
// // calculate Born radii
//
// if( data.getHasAmoebaGeneralizedKirkwood() ){
// kCalculateObcGbsaBornSum(gpu->gpuContext);
// kReduceObcGbsaBornSum(gpu->gpuContext);
// }
//
// // multipoles
//
// kCalculateAmoebaMultipoleForces(gpu, data.getHasAmoebaGeneralizedKirkwood() );
//
////kClearForces(gpu->gpuContext);
////kClearEnergy(gpu->gpuContext);
////(void) fprintf( data.getLog(), "computeAmoebaMultipoleForce clearing forces/energy after kCalculateAmoebaMultipoleForces()\n" );
//
// // GK
//
// if( data.getHasAmoebaGeneralizedKirkwood() ){
// kCalculateAmoebaKirkwood(gpu);
// }
//
// if( 0 && data.getLog() ){
// (void) fprintf( data.getLog(), "completed computeAmoebaMultipoleForce\n" );
// (void) fflush( data.getLog());
// }
//}
//
//CudaCalcAmoebaMultipoleForceKernel::CudaCalcAmoebaMultipoleForceKernel(std::string name, const Platform& platform, AmoebaCudaData& data, System& system) :
// CalcAmoebaMultipoleForceKernel(name, platform), system(system) {
// data.incrementKernelCount();
//}
//
//CudaCalcAmoebaMultipoleForceKernel::~CudaCalcAmoebaMultipoleForceKernel() {
// data.decrementKernelCount();
//}
//
//void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const AmoebaMultipoleForce& force) {
//
// numMultipoles = force.getNumMultipoles();
//
// data.setHasAmoebaMultipole( true );
//
// std::vector<RealOpenMM> charges(numMultipoles);
// std::vector<RealOpenMM> dipoles(3*numMultipoles);
// std::vector<RealOpenMM> quadrupoles(9*numMultipoles);
// std::vector<RealOpenMM> tholes(numMultipoles);
// std::vector<RealOpenMM> dampingFactors(numMultipoles);
// std::vector<RealOpenMM> polarity(numMultipoles);
// std::vector<int> axisTypes(numMultipoles);
// std::vector<int> multipoleAtomId1s(numMultipoles);
// std::vector<int> multipoleAtomId2s(numMultipoles);
// std::vector< std::vector< std::vector<int> > > multipoleAtomCovalentInfo(numMultipoles);
// std::vector<int> minCovalentIndices(numMultipoles);
// std::vector<int> minCovalentPolarizationIndices(numMultipoles);
//
// RealOpenMM scalingDistanceCutoff = static_cast<RealOpenMM>(force.getScalingDistanceCutoff());
//
// std::vector<AmoebaMultipoleForce::CovalentType> covalentList;
// covalentList.push_back( AmoebaMultipoleForce::Covalent12 );
// covalentList.push_back( AmoebaMultipoleForce::Covalent13 );
// covalentList.push_back( AmoebaMultipoleForce::Covalent14 );
// covalentList.push_back( AmoebaMultipoleForce::Covalent15 );
//
// std::vector<AmoebaMultipoleForce::CovalentType> polarizationCovalentList;
// polarizationCovalentList.push_back( AmoebaMultipoleForce::PolarizationCovalent11 );
// polarizationCovalentList.push_back( AmoebaMultipoleForce::PolarizationCovalent12 );
// polarizationCovalentList.push_back( AmoebaMultipoleForce::PolarizationCovalent13 );
// polarizationCovalentList.push_back( AmoebaMultipoleForce::PolarizationCovalent14 );
//
// std::vector<int> covalentDegree;
// AmoebaMultipoleForceImpl::getCovalentDegree( force, covalentDegree );
// int dipoleIndex = 0;
// int quadrupoleIndex = 0;
// int maxCovalentRange = 0;
// double totalCharge = 0.0;
// for (int i = 0; i < numMultipoles; i++) {
//
// // multipoles
//
// int axisType, multipoleAtomId1, multipoleAtomId2;
// double charge, tholeD, dampingFactorD, polarityD;
// std::vector<double> dipolesD;
// std::vector<double> quadrupolesD;
// force.getMultipoleParameters(i, charge, dipolesD, quadrupolesD, axisType, multipoleAtomId1, multipoleAtomId2,
// tholeD, dampingFactorD, polarityD );
//
// totalCharge += charge;
// axisTypes[i] = axisType;
// multipoleAtomId1s[i] = multipoleAtomId1;
// multipoleAtomId2s[i] = multipoleAtomId2;
//
// charges[i] = static_cast<RealOpenMM>(charge);
// tholes[i] = static_cast<RealOpenMM>(tholeD);
// dampingFactors[i] = static_cast<RealOpenMM>(dampingFactorD);
// polarity[i] = static_cast<RealOpenMM>(polarityD);
//
// dipoles[dipoleIndex++] = static_cast<RealOpenMM>(dipolesD[0]);
// dipoles[dipoleIndex++] = static_cast<RealOpenMM>(dipolesD[1]);
// dipoles[dipoleIndex++] = static_cast<RealOpenMM>(dipolesD[2]);
//
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[0]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[1]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[2]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[3]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[4]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[5]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[6]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[7]);
// quadrupoles[quadrupoleIndex++] = static_cast<RealOpenMM>(quadrupolesD[8]);
//
// // covalent info
//
// std::vector< std::vector<int> > covalentLists;
// force.getCovalentMaps(i, covalentLists );
// multipoleAtomCovalentInfo[i] = covalentLists;
//
// int minCovalentIndex, maxCovalentIndex;
// AmoebaMultipoleForceImpl::getCovalentRange( force, i, covalentList, &minCovalentIndex, &maxCovalentIndex );
// minCovalentIndices[i] = minCovalentIndex;
// if( maxCovalentRange < (maxCovalentIndex - minCovalentIndex) ){
// maxCovalentRange = maxCovalentIndex - minCovalentIndex;
// }
//
// AmoebaMultipoleForceImpl::getCovalentRange( force, i, polarizationCovalentList, &minCovalentIndex, &maxCovalentIndex );
// minCovalentPolarizationIndices[i] = minCovalentIndex;
// if( maxCovalentRange < (maxCovalentIndex - minCovalentIndex) ){
// maxCovalentRange = maxCovalentIndex - minCovalentIndex;
// }
// }
//
// int iterativeMethod = static_cast<int>(force.getMutualInducedIterationMethod());
// if( iterativeMethod != 0 ){
// throw OpenMMException("Iterative method for mutual induced dipoles not recognized.\n");
// }
//
// int nonbondedMethod = static_cast<int>(force.getNonbondedMethod());
// if( nonbondedMethod != 0 && nonbondedMethod != 1 ){
// throw OpenMMException("AmoebaMultipoleForce nonbonded method not recognized.\n");
// }
//
// gpuSetAmoebaMultipoleParameters(data.getAmoebaGpu(), charges, dipoles, quadrupoles, axisTypes, multipoleAtomId1s, multipoleAtomId2s,
// tholes, scalingDistanceCutoff, dampingFactors, polarity,
// multipoleAtomCovalentInfo, covalentDegree, minCovalentIndices, minCovalentPolarizationIndices, (maxCovalentRange+2),
// static_cast<int>(force.getMutualInducedIterationMethod()),
// force.getMutualInducedMaxIterations(),
// static_cast<RealOpenMM>( force.getMutualInducedTargetEpsilon()),
// nonbondedMethod,
// static_cast<RealOpenMM>( force.getCutoffDistance()),
// static_cast<RealOpenMM>( force.getAEwald()),
// static_cast<RealOpenMM>( force.getElectricConstant()) );
//
//}
//
//double ReferenceCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
// computeAmoebaMultipoleForce( data );
// return 0.0;
//}
//
/* -------------------------------------------------------------------------- *
* AmoebaMultipole *
* -------------------------------------------------------------------------- */
ReferenceCalcAmoebaMultipoleForceKernel
::
ReferenceCalcAmoebaMultipoleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoebaMultipoleForceKernel
(
name
,
platform
),
system
(
system
)
{
}
ReferenceCalcAmoebaMultipoleForceKernel
::~
ReferenceCalcAmoebaMultipoleForceKernel
()
{
}
void
ReferenceCalcAmoebaMultipoleForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaMultipoleForce
&
force
)
{
numMultipoles
=
force
.
getNumMultipoles
();
charges
.
resize
(
numMultipoles
);
dipoles
.
resize
(
3
*
numMultipoles
);
quadrupoles
.
resize
(
9
*
numMultipoles
);
tholes
.
resize
(
numMultipoles
);
dampingFactors
.
resize
(
numMultipoles
);
polarity
.
resize
(
numMultipoles
);
axisTypes
.
resize
(
numMultipoles
);
multipoleAtomId1s
.
resize
(
numMultipoles
);
multipoleAtomId2s
.
resize
(
numMultipoles
);
multipoleAtomCovalentInfo
.
resize
(
numMultipoles
);
int
dipoleIndex
=
0
;
int
quadrupoleIndex
=
0
;
int
maxCovalentRange
=
0
;
double
totalCharge
=
0.0
;
for
(
int
ii
=
0
;
ii
<
numMultipoles
;
ii
++
){
// multipoles
int
axisType
,
multipoleAtomId1
,
multipoleAtomId2
;
double
charge
,
tholeD
,
dampingFactorD
,
polarityD
;
std
::
vector
<
double
>
dipolesD
;
std
::
vector
<
double
>
quadrupolesD
;
force
.
getMultipoleParameters
(
ii
,
charge
,
dipolesD
,
quadrupolesD
,
axisType
,
multipoleAtomId1
,
multipoleAtomId2
,
tholeD
,
dampingFactorD
,
polarityD
);
totalCharge
+=
charge
;
axisTypes
[
ii
]
=
axisType
;
multipoleAtomId1s
[
ii
]
=
multipoleAtomId1
;
multipoleAtomId2s
[
ii
]
=
multipoleAtomId2
;
charges
[
ii
]
=
static_cast
<
RealOpenMM
>
(
charge
);
tholes
[
ii
]
=
static_cast
<
RealOpenMM
>
(
tholeD
);
dampingFactors
[
ii
]
=
static_cast
<
RealOpenMM
>
(
dampingFactorD
);
polarity
[
ii
]
=
static_cast
<
RealOpenMM
>
(
polarityD
);
dipoles
[
dipoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
dipolesD
[
0
]);
dipoles
[
dipoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
dipolesD
[
1
]);
dipoles
[
dipoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
dipolesD
[
2
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
0
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
1
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
2
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
3
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
4
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
5
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
6
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
7
]);
quadrupoles
[
quadrupoleIndex
++
]
=
static_cast
<
RealOpenMM
>
(
quadrupolesD
[
8
]);
// covalent info
std
::
vector
<
std
::
vector
<
int
>
>
covalentLists
;
force
.
getCovalentMaps
(
ii
,
covalentLists
);
multipoleAtomCovalentInfo
[
ii
]
=
covalentLists
;
}
mutualInducedMaxIterations
=
force
.
getMutualInducedMaxIterations
();
mutualInducedTargetEpsilon
=
force
.
getMutualInducedTargetEpsilon
();
nonbondedMethod
=
static_cast
<
int
>
(
force
.
getNonbondedMethod
());
if
(
nonbondedMethod
!=
0
&&
nonbondedMethod
!=
1
){
throw
OpenMMException
(
"AmoebaMultipoleForce nonbonded method not recognized.
\n
"
);
}
}
double
ReferenceCalcAmoebaMultipoleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
AmoebaReferenceMultipoleForce
amoebaReferenceMultipoleForce
(
AmoebaReferenceMultipoleForce
::
NoCutoff
);
amoebaReferenceMultipoleForce
.
setMutualInducedDipoleTargetEpsilon
(
mutualInducedTargetEpsilon
);
amoebaReferenceMultipoleForce
.
setMaximumMutualInducedDipoleIterations
(
mutualInducedMaxIterations
);
RealOpenMM
energy
=
amoebaReferenceMultipoleForce
.
calculateForceAndEnergy
(
numMultipoles
,
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
dampingFactors
,
polarity
,
axisTypes
,
multipoleAtomId1s
,
multipoleAtomId2s
,
multipoleAtomCovalentInfo
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
///* -------------------------------------------------------------------------- *
// * AmoebaGeneralizedKirkwood *
// * -------------------------------------------------------------------------- */
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
View file @
e20cc4f2
...
...
@@ -325,34 +325,50 @@ private:
System
&
system
;
};
// /**
// * This kernel is invoked by AmoebaMultipoleForce to calculate the forces acting on the system and the energy of the system.
// */
// class ReferenceCalcAmoebaMultipoleForceKernel : public CalcAmoebaMultipoleForceKernel {
// public:
// ReferenceCalcAmoebaMultipoleForceKernel(std::string name, const Platform& platform, System& system);
// ~ReferenceCalcAmoebaMultipoleForceKernel();
// /**
// * Initialize the kernel.
// *
// * @param system the System this kernel will be applied to
// * @param force the AmoebaMultipoleForce this kernel will be used for
// */
// void initialize(const System& system, const AmoebaMultipoleForce& force);
// /**
// * Execute the kernel to calculate the forces and/or energy.
// *
// * @param context the context in which to execute this kernel
// * @param includeForces true if forces should be calculated
// * @param includeEnergy true if the energy should be calculated
// * @return the potential energy due to the force
// */
// double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
// private:
// int numMultipoles;
// System& system;
// };
//
/**
* This kernel is invoked by AmoebaMultipoleForce to calculate the forces acting on the system and the energy of the system.
*/
class
ReferenceCalcAmoebaMultipoleForceKernel
:
public
CalcAmoebaMultipoleForceKernel
{
public:
ReferenceCalcAmoebaMultipoleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoebaMultipoleForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the AmoebaMultipoleForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
AmoebaMultipoleForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/
double
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
);
private:
int
numMultipoles
;
std
::
vector
<
RealOpenMM
>
charges
;
std
::
vector
<
RealOpenMM
>
dipoles
;
std
::
vector
<
RealOpenMM
>
quadrupoles
;
std
::
vector
<
RealOpenMM
>
tholes
;
std
::
vector
<
RealOpenMM
>
dampingFactors
;
std
::
vector
<
RealOpenMM
>
polarity
;
std
::
vector
<
int
>
axisTypes
;
std
::
vector
<
int
>
multipoleAtomId1s
;
std
::
vector
<
int
>
multipoleAtomId2s
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>
>
>
multipoleAtomCovalentInfo
;
//int iterativeMethod;
int
nonbondedMethod
;
int
mutualInducedMaxIterations
;
RealOpenMM
mutualInducedTargetEpsilon
;
System
&
system
;
};
// /**
// * This kernel is invoked by AmoebaMultipoleForce to calculate the forces acting on the system and the energy of the system.
// */
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
View file @
e20cc4f2
...
...
@@ -74,6 +74,29 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>&
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
}
/**---------------------------------------------------------------------------------------
Calculate norm squared of 3d vector
@param inputVector vector whose norm squared is to be computed
@return norm squared
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getNormSquared3
(
const
RealOpenMM
*
inputVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::getNorm3";
// ---------------------------------------------------------------------------------------
// get 3 norm
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
}
/**---------------------------------------------------------------------------------------
Calculate norm of 3d vector
...
...
@@ -97,6 +120,36 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const std::vector<RealOpenMM>& inputV
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
}
RealOpenMM
AmoebaReferenceForce
::
getNorm3
(
const
RealOpenMM
*
inputVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::getNorm3";
// ---------------------------------------------------------------------------------------
// get 3 norm
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
}
void
AmoebaReferenceForce
::
normalizeVector3
(
RealOpenMM
*
inputVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::normalizeVector3";
// ---------------------------------------------------------------------------------------
RealOpenMM
norm
=
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
if
(
norm
>
0.0
){
norm
=
1.0
/
norm
;
inputVector
[
0
]
*=
norm
;
inputVector
[
1
]
*=
norm
;
inputVector
[
2
]
*=
norm
;
}
}
/**---------------------------------------------------------------------------------------
Calculate dot product of 3d vectors
...
...
@@ -121,6 +174,55 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const std::vector<RealOpenMM>&
return
xVector
[
0
]
*
yVector
[
0
]
+
xVector
[
1
]
*
yVector
[
1
]
+
xVector
[
2
]
*
yVector
[
2
];
}
/**---------------------------------------------------------------------------------------
Calculate dot product of 3d vectors
@param xVector first vector
@param yVector second vector
@return dot product
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::getDotProduct3";
// ---------------------------------------------------------------------------------------
// get dot product
return
xVector
[
0
]
*
yVector
[
0
]
+
xVector
[
1
]
*
yVector
[
1
]
+
xVector
[
2
]
*
yVector
[
2
];
}
/**---------------------------------------------------------------------------------------
Calculate dot product of 3d vectors
@param vectorOffset offset into first first vector
@param xVector first vector
@param yVector second vector
@return dot product
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::getDotProduct3";
// ---------------------------------------------------------------------------------------
// get dot product
return
xVector
[
vectorOffset
+
0
]
*
yVector
[
0
]
+
xVector
[
vectorOffset
+
1
]
*
yVector
[
1
]
+
xVector
[
vectorOffset
+
2
]
*
yVector
[
2
];
}
/**---------------------------------------------------------------------------------------
Calculate z = x X y
...
...
@@ -148,3 +250,30 @@ void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVect
return
;
}
/**---------------------------------------------------------------------------------------
Calculate z = x X y
@param xVector input vector
@param yVector input vector
@param zVector output vector: z = x X y
--------------------------------------------------------------------------------------- */
void
AmoebaReferenceForce
::
getCrossProduct
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
,
RealOpenMM
*
zVector
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReferenceForce::getCrossProduct";
// ---------------------------------------------------------------------------------------
zVector
[
0
]
=
xVector
[
1
]
*
yVector
[
2
]
-
xVector
[
2
]
*
yVector
[
1
];
zVector
[
1
]
=
xVector
[
2
]
*
yVector
[
0
]
-
xVector
[
0
]
*
yVector
[
2
];
zVector
[
2
]
=
xVector
[
0
]
*
yVector
[
1
]
-
xVector
[
1
]
*
yVector
[
0
];
return
;
}
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.h
View file @
e20cc4f2
...
...
@@ -75,6 +75,7 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getNormSquared3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNormSquared3
(
const
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -87,6 +88,17 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getNorm3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNorm3
(
const
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
Normalize 3d vector
@param inputVector vector to normalize
--------------------------------------------------------------------------------------- */
static
void
normalizeVector3
(
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -100,6 +112,8 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getDotProduct3
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
);
static
RealOpenMM
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
);
static
RealOpenMM
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -114,6 +128,9 @@ public:
static
void
getCrossProduct
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
,
std
::
vector
<
RealOpenMM
>&
zVector
);
static
void
getCrossProduct
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
,
RealOpenMM
*
zVector
);
};
// ---------------------------------------------------------------------------------------
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
0 → 100644
View file @
e20cc4f2
This diff is collapsed.
Click to expand it.
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.h
0 → 100644
View file @
e20cc4f2
This diff is collapsed.
Click to expand it.
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceVdwForce.h
View file @
e20cc4f2
...
...
@@ -164,7 +164,6 @@ public:
@param vdwExclusions particle exclusions
@param forces add forces to this vector
@return energy
@return energy
--------------------------------------------------------------------------------------- */
...
...
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