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
c66766a8
Commit
c66766a8
authored
Sep 03, 2014
by
peastman
Browse files
Fixed errors on Windows
parent
6f7dee30
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1049 additions
and
1045 deletions
+1049
-1045
openmmapi/include/openmm/internal/vectorize_sse.h
openmmapi/include/openmm/internal/vectorize_sse.h
+305
-305
platforms/cpu/include/CpuCustomManyParticleForce.h
platforms/cpu/include/CpuCustomManyParticleForce.h
+223
-224
platforms/cpu/src/CpuCustomManyParticleForce.cpp
platforms/cpu/src/CpuCustomManyParticleForce.cpp
+521
-516
No files found.
openmmapi/include/openmm/internal/vectorize_sse.h
View file @
c66766a8
This diff is collapsed.
Click to expand it.
platforms/cpu/include/CpuCustomManyParticleForce.h
View file @
c66766a8
/* Portions copyright (c) 2009-2014 Stanford University and Simbios.
/* Portions copyright (c) 2009-2014 Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
* to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
*/
#ifndef OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
#ifndef OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
#define OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
#define OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
#include "ReferenceForce.h"
#include "ReferenceForce.h"
#include "ReferenceBondIxn.h"
#include "ReferenceBondIxn.h"
#include "CompiledExpressionSet.h"
#include "CompiledExpressionSet.h"
#include "CpuNeighborList.h"
#include "CpuNeighborList.h"
#include "openmm/CustomManyParticleForce.h"
#include "openmm/CustomManyParticleForce.h"
#include "openmm/internal/ThreadPool.h"
#include "openmm/internal/ThreadPool.h"
#include "openmm/internal/vectorize.h"
#include "openmm/internal/vectorize.h"
#include "lepton/CompiledExpression.h"
#include "lepton/CompiledExpression.h"
#include "lepton/ParsedExpression.h"
#include "lepton/ParsedExpression.h"
#include <map>
#include <map>
#include <set>
#include <set>
#include <utility>
#include <utility>
#include <vector>
#include <vector>
namespace
OpenMM
{
namespace
OpenMM
{
class
CpuCustomManyParticleForce
{
class
CpuCustomManyParticleForce
{
private:
private:
class
ParticleTermInfo
;
class
ParticleTermInfo
;
class
DistanceTermInfo
;
class
DistanceTermInfo
;
class
AngleTermInfo
;
class
AngleTermInfo
;
class
DihedralTermInfo
;
class
DihedralTermInfo
;
class
ComputeForceTask
;
class
ComputeForceTask
;
class
ThreadData
;
class
ThreadData
;
int
numParticles
,
numParticlesPerSet
,
numPerParticleParameters
,
numTypes
;
int
numParticles
,
numParticlesPerSet
,
numPerParticleParameters
,
numTypes
;
bool
useCutoff
,
usePeriodic
,
centralParticleMode
;
bool
useCutoff
,
usePeriodic
,
centralParticleMode
;
RealOpenMM
cutoffDistance
;
RealOpenMM
cutoffDistance
;
RealOpenMM
periodicBoxSize
[
3
];
RealOpenMM
periodicBoxSize
[
3
];
CpuNeighborList
*
neighborList
;
CpuNeighborList
*
neighborList
;
ThreadPool
&
threads
;
ThreadPool
&
threads
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
int
>
particleTypes
;
std
::
vector
<
int
>
particleTypes
;
std
::
vector
<
int
>
orderIndex
;
std
::
vector
<
int
>
orderIndex
;
std
::
vector
<
std
::
vector
<
int
>
>
particleOrder
;
std
::
vector
<
std
::
vector
<
int
>
>
particleOrder
;
std
::
vector
<
std
::
vector
<
int
>
>
particleNeighbors
;
std
::
vector
<
std
::
vector
<
int
>
>
particleNeighbors
;
std
::
vector
<
ThreadData
*>
threadData
;
std
::
vector
<
ThreadData
*>
threadData
;
// The following variables are used to make information accessible to the individual threads.
// The following variables are used to make information accessible to the individual threads.
float
*
posq
;
float
*
posq
;
RealOpenMM
**
particleParameters
;
RealOpenMM
**
particleParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
bool
includeForces
,
includeEnergy
;
bool
includeForces
,
includeEnergy
;
void
*
atomicCounter
;
void
*
atomicCounter
;
/**
/**
* This routine contains the code executed by each thread.
* This routine contains the code executed by each thread.
*/
*/
void
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
);
void
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
);
/**
/**
* This is called recursively to loop over all possible combination of a set of particles and evaluate the
* This is called recursively to loop over all possible combination of a set of particles and evaluate the
* interaction for each one.
* interaction for each one.
*/
*/
void
loopOverInteractions
(
std
::
vector
<
int
>&
availableParticles
,
std
::
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
void
loopOverInteractions
(
std
::
vector
<
int
>&
availableParticles
,
std
::
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
RealOpenMM
**
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
RealOpenMM
**
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate custom interaction for one set of particles
Calculate custom interaction for one set of particles
@param particleSet the indices of the particles
@param particleSet the indices of the particles
@param posq atom coordinates in float format
@param posq atom coordinates in float format
@param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
@param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
@param forces force array (forces added)
@param forces force array (forces added)
@param totalEnergy total energy
@param totalEnergy total energy
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
/**
/**
* Calculate the interaction for one set of particles
* Calculate the interaction for one set of particles
*
*
* @param particleSet the indices of the particles
* @param particleSet the indices of the particles
* @param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
* @param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
* @param data information and workspace for the current thread
* @param data information and workspace for the current thread
* @param boxSize the size of the periodic box
* @param boxSize the size of the periodic box
* @param invBoxSize the inverse size of the periodic box
* @param invBoxSize the inverse size of the periodic box
*/
*/
void
calculateOneIxn
(
std
::
vector
<
int
>&
particleSet
,
RealOpenMM
**
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
void
calculateOneIxn
(
std
::
vector
<
int
>&
particleSet
,
RealOpenMM
**
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
* Compute the displacement and squared distance between two points, optionally using
* Compute the displacement and squared distance between two points, optionally using
* periodic boundary conditions.
* periodic boundary conditions.
*/
*/
void
computeDelta
(
const
fvec4
&
posI
,
const
fvec4
&
posJ
,
fvec4
&
deltaR
,
float
&
r2
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
const
;
void
computeDelta
(
const
fvec4
&
posI
,
const
fvec4
&
posJ
,
fvec4
&
deltaR
,
float
&
r2
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
const
;
static
float
computeAngle
(
const
fvec4
&
vi
,
const
fvec4
&
vj
,
float
v2i
,
float
v2j
,
float
sign
);
static
float
computeAngle
(
const
fvec4
&
vi
,
const
fvec4
&
vj
,
float
v2i
,
float
v2j
,
float
sign
);
static
float
getDihedralAngleBetweenThreeVectors
(
const
fvec4
&
v1
,
const
fvec4
&
v2
,
const
fvec4
&
v3
,
fvec4
&
cross1
,
fvec4
&
cross2
,
const
fvec4
&
signVector
);
static
float
getDihedralAngleBetweenThreeVectors
(
const
fvec4
&
v1
,
const
fvec4
&
v2
,
const
fvec4
&
v3
,
fvec4
&
cross1
,
fvec4
&
cross2
,
const
fvec4
&
signVector
);
public:
public:
/**
/**
* Create a new CpuCustomManyParticleForce.
* Create a new CpuCustomManyParticleForce.
*
*
* @param force the CustomManyParticleForce to create it for
* @param force the CustomManyParticleForce to create it for
* @param threads the thread pool to use
* @param threads the thread pool to use
*/
*/
CpuCustomManyParticleForce
(
const
OpenMM
::
CustomManyParticleForce
&
force
,
ThreadPool
&
threads
);
CpuCustomManyParticleForce
(
const
OpenMM
::
CustomManyParticleForce
&
force
,
ThreadPool
&
threads
);
~
CpuCustomManyParticleForce
();
~
CpuCustomManyParticleForce
();
/**
/**
* Set the force to use a cutoff.
* Set the force to use a cutoff.
*
*
* @param distance the cutoff distance
* @param distance the cutoff distance
*/
*/
void
setUseCutoff
(
RealOpenMM
distance
);
void
setUseCutoff
(
RealOpenMM
distance
);
/**
/**
* Set the force to use periodic boundary conditions. This requires that a cutoff has
* Set the force to use periodic boundary conditions. This requires that a cutoff has
* already been set, and the smallest side of the periodic box is at least twice the cutoff
* already been set, and the smallest side of the periodic box is at least twice the cutoff
* distance.
* distance.
*
*
* @param boxSize the X, Y, and Z widths of the periodic box
* @param boxSize the X, Y, and Z widths of the periodic box
*/
*/
void
setPeriodic
(
OpenMM
::
RealVec
&
boxSize
);
void
setPeriodic
(
OpenMM
::
RealVec
&
boxSize
);
/**
/**
* Calculate the interaction.
* Calculate the interaction.
*
*
* @param posq atom coordinates in float format
* @param posq atom coordinates in float format
* @param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
* @param particleParameters particle parameter values (particleParameters[particleIndex][parameterIndex])
* @param globalParameters the values of global parameters
* @param globalParameters the values of global parameters
* @param threadForce the collection of arrays for each thread to add forces to
* @param threadForce the collection of arrays for each thread to add forces to
* @param includeForce whether to compute forces
* @param includeForce whether to compute forces
* @param includeEnergy whether to compute energy
* @param includeEnergy whether to compute energy
* @param energy the total energy is added to this
* @param energy the total energy is added to this
*/
*/
void
calculateIxn
(
AlignedArray
<
float
>&
posq
,
RealOpenMM
**
particleParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
void
calculateIxn
(
AlignedArray
<
float
>&
posq
,
RealOpenMM
**
particleParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
);
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
);
};
};
class
CpuCustomManyParticleForce
::
ParticleTermInfo
{
class
CpuCustomManyParticleForce
::
ParticleTermInfo
{
public:
public:
std
::
string
name
;
std
::
string
name
;
int
atom
,
component
,
variableIndex
;
int
atom
,
component
,
variableIndex
;
Lepton
::
CompiledExpression
forceExpression
;
Lepton
::
CompiledExpression
forceExpression
;
ParticleTermInfo
(
const
std
::
string
&
name
,
int
atom
,
int
component
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
ParticleTermInfo
(
const
std
::
string
&
name
,
int
atom
,
int
component
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
};
};
class
CpuCustomManyParticleForce
::
DistanceTermInfo
{
class
CpuCustomManyParticleForce
::
DistanceTermInfo
{
public:
public:
std
::
string
name
;
std
::
string
name
;
int
p1
,
p2
,
variableIndex
;
int
p1
,
p2
,
variableIndex
;
Lepton
::
CompiledExpression
forceExpression
;
Lepton
::
CompiledExpression
forceExpression
;
int
delta
;
int
delta
;
float
deltaSign
;
float
deltaSign
;
DistanceTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
DistanceTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
};
};
class
CpuCustomManyParticleForce
::
AngleTermInfo
{
class
CpuCustomManyParticleForce
::
AngleTermInfo
{
public:
public:
std
::
string
name
;
std
::
string
name
;
int
p1
,
p2
,
p3
,
variableIndex
;
int
p1
,
p2
,
p3
,
variableIndex
;
Lepton
::
CompiledExpression
forceExpression
;
Lepton
::
CompiledExpression
forceExpression
;
int
delta1
,
delta2
;
int
delta1
,
delta2
;
float
delta1Sign
,
delta2Sign
;
float
delta1Sign
,
delta2Sign
;
AngleTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
AngleTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
};
};
class
CpuCustomManyParticleForce
::
DihedralTermInfo
{
class
CpuCustomManyParticleForce
::
DihedralTermInfo
{
public:
public:
std
::
string
name
;
std
::
string
name
;
int
p1
,
p2
,
p3
,
p4
,
variableIndex
;
int
p1
,
p2
,
p3
,
p4
,
variableIndex
;
Lepton
::
CompiledExpression
forceExpression
;
Lepton
::
CompiledExpression
forceExpression
;
int
delta1
,
delta2
,
delta3
;
int
delta1
,
delta2
,
delta3
;
mutable
fvec4
cross1
,
cross2
;
DihedralTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
DihedralTermInfo
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>&
atoms
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
ThreadData
&
data
);
};
};
class
CpuCustomManyParticleForce
::
ThreadData
{
class
CpuCustomManyParticleForce
::
ThreadData
{
public:
public:
CompiledExpressionSet
expressionSet
;
CompiledExpressionSet
expressionSet
;
Lepton
::
CompiledExpression
energyExpression
;
Lepton
::
CompiledExpression
energyExpression
;
std
::
vector
<
std
::
vector
<
int
>
>
particleParamIndices
;
std
::
vector
<
std
::
vector
<
int
>
>
particleParamIndices
;
std
::
vector
<
int
>
permutedParticles
;
std
::
vector
<
int
>
permutedParticles
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
deltaPairs
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
deltaPairs
;
std
::
vector
<
ParticleTermInfo
>
particleTerms
;
std
::
vector
<
ParticleTermInfo
>
particleTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
AlignedArray
<
fvec4
>
delta
,
cross1
,
cross2
;
AlignedArray
<
fvec4
>
delta
;
std
::
vector
<
float
>
normDelta
;
std
::
vector
<
float
>
normDelta
;
std
::
vector
<
float
>
norm2Delta
;
std
::
vector
<
float
>
norm2Delta
;
AlignedArray
<
fvec4
>
f
;
AlignedArray
<
fvec4
>
f
;
double
energy
;
double
energy
;
ThreadData
(
const
CustomManyParticleForce
&
force
,
Lepton
::
ParsedExpression
&
energyExpr
,
ThreadData
(
const
CustomManyParticleForce
&
force
,
Lepton
::
ParsedExpression
&
energyExpr
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
distances
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
angles
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
dihedrals
);
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
distances
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
angles
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
dihedrals
);
/**
/**
* Request a pair of particles whose distance or displacement vector is needed in the computation.
* Request a pair of particles whose distance or displacement vector is needed in the computation.
*/
*/
void
requestDeltaPair
(
int
p1
,
int
p2
,
int
&
pairIndex
,
float
&
pairSign
,
bool
allowReversed
);
void
requestDeltaPair
(
int
p1
,
int
p2
,
int
&
pairIndex
,
float
&
pairSign
,
bool
allowReversed
);
};
};
}
// namespace OpenMM
}
// namespace OpenMM
#endif // OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
#endif // OPENMM_CPU_CUSTOM_MANY_PARTICLE_FORCE_H__
platforms/cpu/src/CpuCustomManyParticleForce.cpp
View file @
c66766a8
This diff is collapsed.
Click to expand it.
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