"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "bab9765573e65dd9ec46408a480ef5b4874be512"
Commit 6d356ddc authored by peastman's avatar peastman
Browse files

Merge pull request #277 from peastman/winvec

Fixed lots of compilation errors on Windows
parents a4f7ac48 72e81e04
...@@ -299,6 +299,8 @@ IF(DL_LIBRARY) ...@@ -299,6 +299,8 @@ IF(DL_LIBRARY)
IF(OPENMM_BUILD_STATIC_LIB) IF(OPENMM_BUILD_STATIC_LIB)
TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${DL_LIBRARY} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${DL_LIBRARY} ${PTHREADS_LIB})
ENDIF(OPENMM_BUILD_STATIC_LIB) ENDIF(OPENMM_BUILD_STATIC_LIB)
ELSE(DL_LIBRARY)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${PTHREADS_LIB})
ENDIF(DL_LIBRARY) ENDIF(DL_LIBRARY)
IF(WIN32) IF(WIN32)
MARK_AS_ADVANCED(DL_LIBRARY) MARK_AS_ADVANCED(DL_LIBRARY)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#define NOMINMAX
#include "windowsExport.h" #include "windowsExport.h"
#include <pthread.h> #include <pthread.h>
#include <vector> #include <vector>
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#else #else
#ifdef WIN32 #ifdef WIN32
#define NOMINMAX
#include <windows.h> #include <windows.h>
#else #else
#include <dlfcn.h> #include <dlfcn.h>
......
...@@ -62,55 +62,55 @@ public: ...@@ -62,55 +62,55 @@ public:
void store(float* v) const { void store(float* v) const {
_mm_storeu_ps(v, val); _mm_storeu_ps(v, val);
} }
fvec4 operator+(fvec4 other) const { fvec4 operator+(const fvec4& other) const {
return _mm_add_ps(val, other); return _mm_add_ps(val, other);
} }
fvec4 operator-(fvec4 other) const { fvec4 operator-(const fvec4& other) const {
return _mm_sub_ps(val, other); return _mm_sub_ps(val, other);
} }
fvec4 operator*(fvec4 other) const { fvec4 operator*(const fvec4& other) const {
return _mm_mul_ps(val, other); return _mm_mul_ps(val, other);
} }
fvec4 operator/(fvec4 other) const { fvec4 operator/(const fvec4& other) const {
return _mm_div_ps(val, other); return _mm_div_ps(val, other);
} }
void operator+=(fvec4 other) { void operator+=(const fvec4& other) {
val = _mm_add_ps(val, other); val = _mm_add_ps(val, other);
} }
void operator-=(fvec4 other) { void operator-=(const fvec4& other) {
val = _mm_sub_ps(val, other); val = _mm_sub_ps(val, other);
} }
void operator*=(fvec4 other) { void operator*=(const fvec4& other) {
val = _mm_mul_ps(val, other); val = _mm_mul_ps(val, other);
} }
void operator/=(fvec4 other) { void operator/=(const fvec4& other) {
val = _mm_div_ps(val, other); val = _mm_div_ps(val, other);
} }
fvec4 operator-() const { fvec4 operator-() const {
return _mm_sub_ps(_mm_set1_ps(0.0f), val); return _mm_sub_ps(_mm_set1_ps(0.0f), val);
} }
fvec4 operator&(fvec4 other) const { fvec4 operator&(const fvec4& other) const {
return _mm_and_ps(val, other); return _mm_and_ps(val, other);
} }
fvec4 operator|(fvec4 other) const { fvec4 operator|(const fvec4& other) const {
return _mm_or_ps(val, other); return _mm_or_ps(val, other);
} }
fvec4 operator==(fvec4 other) const { fvec4 operator==(const fvec4& other) const {
return _mm_cmpeq_ps(val, other); return _mm_cmpeq_ps(val, other);
} }
fvec4 operator!=(fvec4 other) const { fvec4 operator!=(const fvec4& other) const {
return _mm_cmpneq_ps(val, other); return _mm_cmpneq_ps(val, other);
} }
fvec4 operator>(fvec4 other) const { fvec4 operator>(const fvec4& other) const {
return _mm_cmpgt_ps(val, other); return _mm_cmpgt_ps(val, other);
} }
fvec4 operator<(fvec4 other) const { fvec4 operator<(const fvec4& other) const {
return _mm_cmplt_ps(val, other); return _mm_cmplt_ps(val, other);
} }
fvec4 operator>=(fvec4 other) const { fvec4 operator>=(const fvec4& other) const {
return _mm_cmpge_ps(val, other); return _mm_cmpge_ps(val, other);
} }
fvec4 operator<=(fvec4 other) const { fvec4 operator<=(const fvec4& other) const {
return _mm_cmple_ps(val, other); return _mm_cmple_ps(val, other);
} }
operator ivec4() const; operator ivec4() const;
...@@ -139,49 +139,49 @@ public: ...@@ -139,49 +139,49 @@ public:
void store(int* v) const { void store(int* v) const {
_mm_storeu_si128((__m128i*) v, val); _mm_storeu_si128((__m128i*) v, val);
} }
ivec4 operator+(ivec4 other) const { ivec4 operator+(const ivec4& other) const {
return _mm_add_epi32(val, other); return _mm_add_epi32(val, other);
} }
ivec4 operator-(ivec4 other) const { ivec4 operator-(const ivec4& other) const {
return _mm_sub_epi32(val, other); return _mm_sub_epi32(val, other);
} }
ivec4 operator*(ivec4 other) const { ivec4 operator*(const ivec4& other) const {
return _mm_mul_epi32(val, other); return _mm_mul_epi32(val, other);
} }
void operator+=(ivec4 other) { void operator+=(const ivec4& other) {
val = _mm_add_epi32(val, other); val = _mm_add_epi32(val, other);
} }
void operator-=(ivec4 other) { void operator-=(const ivec4& other) {
val = _mm_sub_epi32(val, other); val = _mm_sub_epi32(val, other);
} }
void operator*=(ivec4 other) { void operator*=(const ivec4& other) {
val = _mm_mul_epi32(val, other); val = _mm_mul_epi32(val, other);
} }
ivec4 operator-() const { ivec4 operator-() const {
return _mm_sub_epi32(_mm_set1_epi32(0), val); return _mm_sub_epi32(_mm_set1_epi32(0), val);
} }
ivec4 operator&(ivec4 other) const { ivec4 operator&(const ivec4& other) const {
return _mm_and_si128(val, other); return _mm_and_si128(val, other);
} }
ivec4 operator|(ivec4 other) const { ivec4 operator|(const ivec4& other) const {
return _mm_or_si128(val, other); return _mm_or_si128(val, other);
} }
ivec4 operator==(ivec4 other) const { ivec4 operator==(const ivec4& other) const {
return _mm_cmpeq_epi32(val, other); return _mm_cmpeq_epi32(val, other);
} }
ivec4 operator!=(ivec4 other) const { ivec4 operator!=(const ivec4& other) const {
return _mm_xor_si128(*this==other, _mm_set1_epi32(0xFFFFFFFF)); return _mm_xor_si128(*this==other, _mm_set1_epi32(0xFFFFFFFF));
} }
ivec4 operator>(ivec4 other) const { ivec4 operator>(const ivec4& other) const {
return _mm_cmpgt_epi32(val, other); return _mm_cmpgt_epi32(val, other);
} }
ivec4 operator<(ivec4 other) const { ivec4 operator<(const ivec4& other) const {
return _mm_cmplt_epi32(val, other); return _mm_cmplt_epi32(val, other);
} }
ivec4 operator>=(ivec4 other) const { ivec4 operator>=(const ivec4& other) const {
return _mm_xor_si128(_mm_cmplt_epi32(val, other), _mm_set1_epi32(0xFFFFFFFF)); return _mm_xor_si128(_mm_cmplt_epi32(val, other), _mm_set1_epi32(0xFFFFFFFF));
} }
ivec4 operator<=(ivec4 other) const { ivec4 operator<=(const ivec4& other) const {
return _mm_xor_si128(_mm_cmpgt_epi32(val, other), _mm_set1_epi32(0xFFFFFFFF)); return _mm_xor_si128(_mm_cmpgt_epi32(val, other), _mm_set1_epi32(0xFFFFFFFF));
} }
operator fvec4() const; operator fvec4() const;
...@@ -199,40 +199,40 @@ inline ivec4::operator fvec4() const { ...@@ -199,40 +199,40 @@ inline ivec4::operator fvec4() const {
// Functions that operate on fvec4s. // Functions that operate on fvec4s.
static inline fvec4 floor(fvec4 v) { static inline fvec4 floor(const fvec4& v) {
return fvec4(_mm_floor_ps(v.val)); return fvec4(_mm_floor_ps(v.val));
} }
static inline fvec4 ceil(fvec4 v) { static inline fvec4 ceil(const fvec4& v) {
return fvec4(_mm_ceil_ps(v.val)); return fvec4(_mm_ceil_ps(v.val));
} }
static inline fvec4 round(fvec4 v) { static inline fvec4 round(const fvec4& v) {
return fvec4(_mm_round_ps(v.val, _MM_FROUND_TO_NEAREST_INT)); return fvec4(_mm_round_ps(v.val, _MM_FROUND_TO_NEAREST_INT));
} }
static inline fvec4 min(fvec4 v1, fvec4 v2) { static inline fvec4 min(const fvec4& v1, const fvec4& v2) {
return fvec4(_mm_min_ps(v1.val, v2.val)); return fvec4(_mm_min_ps(v1.val, v2.val));
} }
static inline fvec4 max(fvec4 v1, fvec4 v2) { static inline fvec4 max(const fvec4& v1, const fvec4& v2) {
return fvec4(_mm_max_ps(v1.val, v2.val)); return fvec4(_mm_max_ps(v1.val, v2.val));
} }
static inline fvec4 abs(fvec4 v) { static inline fvec4 abs(const fvec4& v) {
static const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)); static const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
return fvec4(_mm_and_ps(v.val, mask)); return fvec4(_mm_and_ps(v.val, mask));
} }
static inline fvec4 sqrt(fvec4 v) { static inline fvec4 sqrt(const fvec4& v) {
return fvec4(_mm_sqrt_ps(v.val)); return fvec4(_mm_sqrt_ps(v.val));
} }
static inline float dot3(fvec4 v1, fvec4 v2) { static inline float dot3(const fvec4& v1, const fvec4& v2) {
return _mm_cvtss_f32(_mm_dp_ps(v1, v2, 0x71)); return _mm_cvtss_f32(_mm_dp_ps(v1, v2, 0x71));
} }
static inline float dot4(fvec4 v1, fvec4 v2) { static inline float dot4(const fvec4& v1, const fvec4& v2) {
return _mm_cvtss_f32(_mm_dp_ps(v1, v2, 0xF1)); return _mm_cvtss_f32(_mm_dp_ps(v1, v2, 0xF1));
} }
...@@ -242,43 +242,43 @@ static inline void transpose(fvec4& v1, fvec4& v2, fvec4& v3, fvec4& v4) { ...@@ -242,43 +242,43 @@ static inline void transpose(fvec4& v1, fvec4& v2, fvec4& v3, fvec4& v4) {
// Functions that operate on ivec4s. // Functions that operate on ivec4s.
static inline ivec4 min(ivec4 v1, ivec4 v2) { static inline ivec4 min(const ivec4& v1, const ivec4& v2) {
return ivec4(_mm_min_epi32(v1.val, v2.val)); return ivec4(_mm_min_epi32(v1.val, v2.val));
} }
static inline ivec4 max(ivec4 v1, ivec4 v2) { static inline ivec4 max(const ivec4& v1, const ivec4& v2) {
return ivec4(_mm_max_epi32(v1.val, v2.val)); return ivec4(_mm_max_epi32(v1.val, v2.val));
} }
static inline ivec4 abs(ivec4 v) { static inline ivec4 abs(const ivec4& v) {
return ivec4(_mm_abs_epi32(v.val)); return ivec4(_mm_abs_epi32(v.val));
} }
static inline bool any(ivec4 v) { static inline bool any(const ivec4& v) {
return !_mm_test_all_zeros(v, _mm_set1_epi32(0xFFFFFFFF)); return !_mm_test_all_zeros(v, _mm_set1_epi32(0xFFFFFFFF));
} }
// Mathematical operators involving a scalar and a vector. // Mathematical operators involving a scalar and a vector.
static inline fvec4 operator+(float v1, fvec4 v2) { static inline fvec4 operator+(float v1, const fvec4& v2) {
return fvec4(v1)+v2; return fvec4(v1)+v2;
} }
static inline fvec4 operator-(float v1, fvec4 v2) { static inline fvec4 operator-(float v1, const fvec4& v2) {
return fvec4(v1)-v2; return fvec4(v1)-v2;
} }
static inline fvec4 operator*(float v1, fvec4 v2) { static inline fvec4 operator*(float v1, const fvec4& v2) {
return fvec4(v1)*v2; return fvec4(v1)*v2;
} }
static inline fvec4 operator/(float v1, fvec4 v2) { static inline fvec4 operator/(float v1, const fvec4& v2) {
return fvec4(v1)/v2; return fvec4(v1)/v2;
} }
// Operations for blending fvec4s based on an ivec4. // Operations for blending fvec4s based on an ivec4.
static inline fvec4 blend(fvec4 v1, fvec4 v2, ivec4 mask) { static inline fvec4 blend(const fvec4& v1, const fvec4& v2, const ivec4& mask) {
return fvec4(_mm_blendv_ps(v1.val, v2.val, _mm_castsi128_ps(mask.val))); return fvec4(_mm_blendv_ps(v1.val, v2.val, _mm_castsi128_ps(mask.val)));
} }
......
...@@ -123,7 +123,7 @@ private: ...@@ -123,7 +123,7 @@ private:
/** /**
* Evaluate log(x) using a lookup table for speed. * Evaluate log(x) using a lookup table for speed.
*/ */
fvec4 fastLog(fvec4 x); fvec4 fastLog(const fvec4& x);
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -74,12 +74,12 @@ protected: ...@@ -74,12 +74,12 @@ protected:
/** /**
* Compute a fast approximation to erfc(x). * Compute a fast approximation to erfc(x).
*/ */
static fvec4 erfcApprox(fvec4 x); static fvec4 erfcApprox(const fvec4& x);
/** /**
* Evaluate the scale factor used with Ewald and PME: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI) * Evaluate the scale factor used with Ewald and PME: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI)
*/ */
fvec4 ewaldScaleFunction(fvec4 x); fvec4 ewaldScaleFunction(const fvec4& x);
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
#ifndef OPENMM_CPU_NONBONDED_FORCE_VEC8_H__ #ifndef OPENMM_CPU_NONBONDED_FORCE_VEC8_H__
#define OPENMM_CPU_NONBONDED_FORCE_VEC8_H__ #define OPENMM_CPU_NONBONDED_FORCE_VEC8_H__
#include "CpuNonbondedForce.h"
#ifdef __AVX__ #ifdef __AVX__
#include "CpuNonbondedForce.h"
#include "openmm/internal/vectorize8.h" #include "openmm/internal/vectorize8.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -72,12 +73,12 @@ protected: ...@@ -72,12 +73,12 @@ protected:
/** /**
* Compute a fast approximation to erfc(x). * Compute a fast approximation to erfc(x).
*/ */
static fvec8 erfcApprox(fvec8 x); static fvec8 erfcApprox(const fvec8& x);
/** /**
* Evaluate the scale factor used with Ewald and PME: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI) * Evaluate the scale factor used with Ewald and PME: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI)
*/ */
fvec8 ewaldScaleFunction(fvec8 x); fvec8 ewaldScaleFunction(const fvec8& x);
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "sfmt/SFMT.h" #include "sfmt/SFMT.h"
#include "windowsExportCpu.h"
#include <vector> #include <vector>
namespace OpenMM { namespace OpenMM {
...@@ -40,7 +41,7 @@ namespace OpenMM { ...@@ -40,7 +41,7 @@ namespace OpenMM {
/** /**
* This class provides a multithreaded random number generator. * This class provides a multithreaded random number generator.
*/ */
class OPENMM_EXPORT CpuRandom { class OPENMM_EXPORT_CPU CpuRandom {
public: public:
CpuRandom(); CpuRandom();
~CpuRandom(); ~CpuRandom();
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "ReferenceSETTLEAlgorithm.h" #include "ReferenceSETTLEAlgorithm.h"
#include "windowsExportCpu.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/internal/ThreadPool.h" #include "openmm/internal/ThreadPool.h"
#include <vector> #include <vector>
...@@ -42,7 +43,7 @@ namespace OpenMM { ...@@ -42,7 +43,7 @@ namespace OpenMM {
/** /**
* This class uses multiple ReferenceSETTLEAlgorithm objects to execute the algorithm in parallel. * This class uses multiple ReferenceSETTLEAlgorithm objects to execute the algorithm in parallel.
*/ */
class OPENMM_EXPORT CpuSETTLE : public ReferenceConstraintAlgorithm { class OPENMM_EXPORT_CPU CpuSETTLE : public ReferenceConstraintAlgorithm {
public: public:
class ApplyToPositionsTask; class ApplyToPositionsTask;
class ApplyToVelocitiesTask; class ApplyToVelocitiesTask;
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
#include "SimTKOpenMMRealType.h" #include "SimTKOpenMMRealType.h"
#include "openmm/internal/vectorize.h" #include "openmm/internal/vectorize.h"
#include "gmx_atomic.h" #include "gmx_atomic.h"
#include <algorithm>
#include <cmath> #include <cmath>
#include <cstdlib>
using namespace std; using namespace std;
using namespace OpenMM; using namespace OpenMM;
...@@ -391,7 +393,7 @@ void CpuGBSAOBCForce::getDeltaR(const fvec4& posI, const fvec4& x, const fvec4& ...@@ -391,7 +393,7 @@ void CpuGBSAOBCForce::getDeltaR(const fvec4& posI, const fvec4& x, const fvec4&
r2 = dx*dx + dy*dy + dz*dz; r2 = dx*dx + dy*dy + dz*dz;
} }
fvec4 CpuGBSAOBCForce::fastLog(fvec4 x) { fvec4 CpuGBSAOBCForce::fastLog(const fvec4& x) {
// Evaluate log(x) using a lookup table for speed. // Evaluate log(x) using a lookup table for speed.
if (any((x < TABLE_MIN) | (x >= TABLE_MAX))) if (any((x < TABLE_MIN) | (x >= TABLE_MAX)))
......
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
return VoxelIndex(x, y); return VoxelIndex(x, y);
} }
void getNeighbors(vector<int>& neighbors, int blockIndex, fvec4 blockCenter, fvec4 blockWidth, const vector<int>& sortedAtoms, vector<char>& exclusions, float maxDistance, const vector<int>& blockAtoms, const float* atomLocations, const vector<VoxelIndex>& atomVoxelIndex) const { void getNeighbors(vector<int>& neighbors, int blockIndex, const fvec4& blockCenter, const fvec4& blockWidth, const vector<int>& sortedAtoms, vector<char>& exclusions, float maxDistance, const vector<int>& blockAtoms, const float* atomLocations, const vector<VoxelIndex>& atomVoxelIndex) const {
neighbors.resize(0); neighbors.resize(0);
exclusions.resize(0); exclusions.resize(0);
fvec4 boxSize(periodicBoxSize[0], periodicBoxSize[1], periodicBoxSize[2], 0); fvec4 boxSize(periodicBoxSize[0], periodicBoxSize[1], periodicBoxSize[2], 0);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferencePME.h" #include "ReferencePME.h"
#include "gmx_atomic.h" #include "gmx_atomic.h"
#include <algorithm>
// In case we're using some primitive version of Visual Studio this will // In case we're using some primitive version of Visual Studio this will
// make sure that erf() and erfc() are defined. // make sure that erf() and erfc() are defined.
...@@ -182,7 +183,7 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c ...@@ -182,7 +183,7 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c
static const float epsilon = 1.0; static const float epsilon = 1.0;
int kmax = (ewald ? std::max(numRx, std::max(numRy,numRz)) : 0); int kmax = (ewald ? max(numRx, max(numRy,numRz)) : 0);
float factorEwald = -1 / (4*alphaEwald*alphaEwald); float factorEwald = -1 / (4*alphaEwald*alphaEwald);
float TWO_PI = 2.0 * PI_M; float TWO_PI = 2.0 * PI_M;
float recipCoeff = (float)(ONE_4PI_EPS0*4*PI_M/(periodicBoxSize[0] * periodicBoxSize[1] * periodicBoxSize[2]) /epsilon); float recipCoeff = (float)(ONE_4PI_EPS0*4*PI_M/(periodicBoxSize[0] * periodicBoxSize[1] * periodicBoxSize[2]) /epsilon);
......
...@@ -273,7 +273,7 @@ void CpuNonbondedForceVec4::getDeltaR(const float* posI, const fvec4& x, const f ...@@ -273,7 +273,7 @@ void CpuNonbondedForceVec4::getDeltaR(const float* posI, const fvec4& x, const f
r2 = dx*dx + dy*dy + dz*dz; r2 = dx*dx + dy*dy + dz*dz;
} }
fvec4 CpuNonbondedForceVec4::erfcApprox(fvec4 x) { fvec4 CpuNonbondedForceVec4::erfcApprox(const fvec4& x) {
// This approximation for erfc is from Abramowitz and Stegun (1964) p. 299. They cite the following as // This approximation for erfc is from Abramowitz and Stegun (1964) p. 299. They cite the following as
// the original source: C. Hastings, Jr., Approximations for Digital Computers (1955). It has a maximum // the original source: C. Hastings, Jr., Approximations for Digital Computers (1955). It has a maximum
// error of 3e-7. // error of 3e-7.
...@@ -285,7 +285,7 @@ fvec4 CpuNonbondedForceVec4::erfcApprox(fvec4 x) { ...@@ -285,7 +285,7 @@ fvec4 CpuNonbondedForceVec4::erfcApprox(fvec4 x) {
return 1.0f/(t*t); return 1.0f/(t*t);
} }
fvec4 CpuNonbondedForceVec4::ewaldScaleFunction(fvec4 x) { fvec4 CpuNonbondedForceVec4::ewaldScaleFunction(const fvec4& x) {
// Compute the tabulated Ewald scale factor: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI) // Compute the tabulated Ewald scale factor: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI)
fvec4 x1 = x*ewaldDXInv; fvec4 x1 = x*ewaldDXInv;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "SimTKOpenMMCommon.h" #include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "CpuNonbondedForceVec8.h" #include "CpuNonbondedForceVec8.h"
#include "openmm/OpenMMException.h"
#include "openmm/internal/hardware.h" #include "openmm/internal/hardware.h"
using namespace std; using namespace std;
...@@ -296,7 +297,7 @@ void CpuNonbondedForceVec8::getDeltaR(const float* posI, const fvec8& x, const f ...@@ -296,7 +297,7 @@ void CpuNonbondedForceVec8::getDeltaR(const float* posI, const fvec8& x, const f
r2 = dx*dx + dy*dy + dz*dz; r2 = dx*dx + dy*dy + dz*dz;
} }
fvec8 CpuNonbondedForceVec8::erfcApprox(fvec8 x) { fvec8 CpuNonbondedForceVec8::erfcApprox(const fvec8& x) {
// This approximation for erfc is from Abramowitz and Stegun (1964) p. 299. They cite the following as // This approximation for erfc is from Abramowitz and Stegun (1964) p. 299. They cite the following as
// the original source: C. Hastings, Jr., Approximations for Digital Computers (1955). It has a maximum // the original source: C. Hastings, Jr., Approximations for Digital Computers (1955). It has a maximum
// error of 3e-7. // error of 3e-7.
...@@ -308,7 +309,7 @@ fvec8 CpuNonbondedForceVec8::erfcApprox(fvec8 x) { ...@@ -308,7 +309,7 @@ fvec8 CpuNonbondedForceVec8::erfcApprox(fvec8 x) {
return 1.0f/(t*t); return 1.0f/(t*t);
} }
fvec8 CpuNonbondedForceVec8::ewaldScaleFunction(fvec8 x) { fvec8 CpuNonbondedForceVec8::ewaldScaleFunction(const fvec8& x) {
// Compute the tabulated Ewald scale factor: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI) // Compute the tabulated Ewald scale factor: erfc(alpha*r) + 2*alpha*r*exp(-alpha*alpha*r*r)/sqrt(PI)
fvec8 x1 = x*ewaldDXInv; fvec8 x1 = x*ewaldDXInv;
......
...@@ -40,7 +40,7 @@ namespace OpenMM { ...@@ -40,7 +40,7 @@ namespace OpenMM {
* This KernelFactory creates all kernels for ReferencePlatform. * This KernelFactory creates all kernels for ReferencePlatform.
*/ */
class ReferenceKernelFactory : public KernelFactory { class OPENMM_EXPORT ReferenceKernelFactory : public KernelFactory {
public: public:
KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const; KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const;
}; };
......
...@@ -26,10 +26,11 @@ ...@@ -26,10 +26,11 @@
#define __ReferenceLJCoulomb14_H__ #define __ReferenceLJCoulomb14_H__
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
#include "openmm/internal/windowsExport.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
class ReferenceLJCoulomb14 : public ReferenceBondIxn { class OPENMM_EXPORT ReferenceLJCoulomb14 : public ReferenceBondIxn {
public: public:
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
*/ */
#include "SimTKOpenMMCommon.h" #include "SimTKOpenMMCommon.h"
#include "openmm/internal/windowsExport.h"
#include <vector> #include <vector>
typedef RealOpenMM rvec[3]; typedef RealOpenMM rvec[3];
...@@ -52,7 +53,7 @@ pme_t; ...@@ -52,7 +53,7 @@ pme_t;
* pme_order Interpolation order, almost always 4 * pme_order Interpolation order, almost always 4
* epsilon_r Dielectric coefficient, typically 1.0. * epsilon_r Dielectric coefficient, typically 1.0.
*/ */
int int OPENMM_EXPORT
pme_init(pme_t * ppme, pme_init(pme_t * ppme,
RealOpenMM ewaldcoeff, RealOpenMM ewaldcoeff,
int natoms, int natoms,
...@@ -73,7 +74,7 @@ pme_init(pme_t * ppme, ...@@ -73,7 +74,7 @@ pme_init(pme_t * ppme,
* energy Total energy (will be written in units of kJ/mol) * energy Total energy (will be written in units of kJ/mol)
* pme_virial Long-range part of the virial, output. * pme_virial Long-range part of the virial, output.
*/ */
int int OPENMM_EXPORT
pme_exec(pme_t pme, pme_exec(pme_t pme,
const std::vector<OpenMM::RealVec>& atomCoordinates, const std::vector<OpenMM::RealVec>& atomCoordinates,
std::vector<OpenMM::RealVec>& forces, std::vector<OpenMM::RealVec>& forces,
...@@ -85,5 +86,5 @@ pme_exec(pme_t pme, ...@@ -85,5 +86,5 @@ pme_exec(pme_t pme,
/* Release all memory in pme structure */ /* Release all memory in pme structure */
int int OPENMM_EXPORT
pme_destroy(pme_t pme); pme_destroy(pme_t pme);
...@@ -26,10 +26,11 @@ ...@@ -26,10 +26,11 @@
#define __ReferenceStochasticDynamics_H__ #define __ReferenceStochasticDynamics_H__
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
#include "openmm/internal/windowsExport.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
class ReferenceStochasticDynamics : public ReferenceDynamics { class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
protected: protected:
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "openmm/serialization/internal/windowsExportAmoebaSerialization.h" #include "openmm/internal/windowsExportAmoeba.h"
#include "openmm/serialization/SerializationProxy.h" #include "openmm/serialization/SerializationProxy.h"
namespace OpenMM { namespace OpenMM {
...@@ -41,7 +41,7 @@ namespace OpenMM { ...@@ -41,7 +41,7 @@ namespace OpenMM {
* This is a proxy for serializing AmoebaAngleForce objects. * This is a proxy for serializing AmoebaAngleForce objects.
*/ */
class OPENMM_EXPORT_AMOEBA_SERIALIZATION AmoebaAngleForceProxy : public SerializationProxy { class OPENMM_EXPORT_AMOEBA AmoebaAngleForceProxy : public SerializationProxy {
public: public:
AmoebaAngleForceProxy(); AmoebaAngleForceProxy();
void serialize(const void* object, SerializationNode& node) const; void serialize(const void* object, SerializationNode& node) const;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "openmm/serialization/internal/windowsExportAmoebaSerialization.h" #include "openmm/internal/windowsExportAmoeba.h"
#include "openmm/serialization/SerializationProxy.h" #include "openmm/serialization/SerializationProxy.h"
namespace OpenMM { namespace OpenMM {
...@@ -41,7 +41,7 @@ namespace OpenMM { ...@@ -41,7 +41,7 @@ namespace OpenMM {
* This is a proxy for serializing AmoebaBondForce objects. * This is a proxy for serializing AmoebaBondForce objects.
*/ */
class OPENMM_EXPORT_AMOEBA_SERIALIZATION AmoebaBondForceProxy : public SerializationProxy { class OPENMM_EXPORT_AMOEBA AmoebaBondForceProxy : public SerializationProxy {
public: public:
AmoebaBondForceProxy(); AmoebaBondForceProxy();
void serialize(const void* object, SerializationNode& node) const; void serialize(const void* object, SerializationNode& node) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment