"vscode:/vscode.git/clone" did not exist on "ddaa36645c803f794e7283e1d7efd299c77a0a0d"
Commit 9bf57c0b authored by Yutong Zhao's avatar Yutong Zhao
Browse files

Fixes uninitialized bits occurring in the PaddedNumAtoms regions by properly...

Fixes uninitialized bits occurring in the PaddedNumAtoms regions by properly constructing them. This should hopefully get rid of some of the NaN errors we've been seeing.
parent 88812cd1
...@@ -871,9 +871,9 @@ void OpenCLContext::validateMolecules() { ...@@ -871,9 +871,9 @@ void OpenCLContext::validateMolecules() {
vector<mm_int4> newCellOffsets(numAtoms); vector<mm_int4> newCellOffsets(numAtoms);
if (useDoublePrecision) { if (useDoublePrecision) {
vector<mm_double4> oldPosq(paddedNumAtoms); vector<mm_double4> oldPosq(paddedNumAtoms);
vector<mm_double4> newPosq(paddedNumAtoms); vector<mm_double4> newPosq(paddedNumAtoms, mm_double4(0,0,0,0));
vector<mm_double4> oldVelm(paddedNumAtoms); vector<mm_double4> oldVelm(paddedNumAtoms);
vector<mm_double4> newVelm(paddedNumAtoms); vector<mm_double4> newVelm(paddedNumAtoms, mm_double4(0,0,0,0));
posq->download(oldPosq); posq->download(oldPosq);
velm->download(oldVelm); velm->download(oldVelm);
for (int i = 0; i < numAtoms; i++) { for (int i = 0; i < numAtoms; i++) {
...@@ -887,11 +887,11 @@ void OpenCLContext::validateMolecules() { ...@@ -887,11 +887,11 @@ void OpenCLContext::validateMolecules() {
} }
else if (useMixedPrecision) { else if (useMixedPrecision) {
vector<mm_float4> oldPosq(paddedNumAtoms); vector<mm_float4> oldPosq(paddedNumAtoms);
vector<mm_float4> newPosq(paddedNumAtoms); vector<mm_float4> newPosq(paddedNumAtoms, mm_float4(0,0,0,0));
vector<mm_float4> oldPosqCorrection(paddedNumAtoms); vector<mm_float4> oldPosqCorrection(paddedNumAtoms);
vector<mm_float4> newPosqCorrection(paddedNumAtoms); vector<mm_float4> newPosqCorrection(paddedNumAtoms, mm_float4(0,0,0,0));
vector<mm_double4> oldVelm(paddedNumAtoms); vector<mm_double4> oldVelm(paddedNumAtoms);
vector<mm_double4> newVelm(paddedNumAtoms); vector<mm_double4> newVelm(paddedNumAtoms, mm_double4(0,0,0,0));
posq->download(oldPosq); posq->download(oldPosq);
velm->download(oldVelm); velm->download(oldVelm);
for (int i = 0; i < numAtoms; i++) { for (int i = 0; i < numAtoms; i++) {
...@@ -907,9 +907,9 @@ void OpenCLContext::validateMolecules() { ...@@ -907,9 +907,9 @@ void OpenCLContext::validateMolecules() {
} }
else { else {
vector<mm_float4> oldPosq(paddedNumAtoms); vector<mm_float4> oldPosq(paddedNumAtoms);
vector<mm_float4> newPosq(paddedNumAtoms); vector<mm_float4> newPosq(paddedNumAtoms, mm_float4(0,0,0,0));
vector<mm_float4> oldVelm(paddedNumAtoms); vector<mm_float4> oldVelm(paddedNumAtoms);
vector<mm_float4> newVelm(paddedNumAtoms); vector<mm_float4> newVelm(paddedNumAtoms, mm_float4(0,0,0,0));
posq->download(oldPosq); posq->download(oldPosq);
velm->download(oldVelm); velm->download(oldVelm);
for (int i = 0; i < numAtoms; i++) { for (int i = 0; i < numAtoms; i++) {
...@@ -981,9 +981,9 @@ void OpenCLContext::reorderAtomsImpl(bool enforcePeriodic) { ...@@ -981,9 +981,9 @@ void OpenCLContext::reorderAtomsImpl(bool enforcePeriodic) {
// Loop over each group of identical molecules and reorder them. // Loop over each group of identical molecules and reorder them.
vector<int> originalIndex(numAtoms); vector<int> originalIndex(numAtoms);
vector<Real4> newPosq(paddedNumAtoms); vector<Real4> newPosq(paddedNumAtoms, Real4(0,0,0,0));
vector<Real4> newPosqCorrection(paddedNumAtoms); vector<Real4> newPosqCorrection(paddedNumAtoms, Real4(0,0,0,0));
vector<Mixed4> newVelm(paddedNumAtoms); vector<Mixed4> newVelm(paddedNumAtoms, Mixed4(0,0,0,0));
vector<mm_int4> newCellOffsets(numAtoms); vector<mm_int4> newCellOffsets(numAtoms);
for (int group = 0; group < (int) moleculeGroups.size(); group++) { for (int group = 0; group < (int) moleculeGroups.size(); group++) {
// Find the center of each molecule. // Find the center of each molecule.
......
...@@ -1376,9 +1376,9 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb ...@@ -1376,9 +1376,9 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
int numParticles = force.getNumParticles(); int numParticles = force.getNumParticles();
sigmaEpsilon = OpenCLArray::create<mm_float2>(cl, cl.getPaddedNumAtoms(), "sigmaEpsilon"); sigmaEpsilon = OpenCLArray::create<mm_float2>(cl, cl.getPaddedNumAtoms(), "sigmaEpsilon");
vector<mm_float4> posqf(cl.getPaddedNumAtoms()); vector<mm_float4> posqf(cl.getPaddedNumAtoms(), mm_float4(0,0,0,0));
vector<mm_double4> posqd(cl.getPaddedNumAtoms()); vector<mm_double4> posqd(cl.getPaddedNumAtoms(), mm_double4(0,0,0,0));
vector<mm_float2> sigmaEpsilonVector(cl.getPaddedNumAtoms()); vector<mm_float2> sigmaEpsilonVector(cl.getPaddedNumAtoms(), mm_float2(0,0));
vector<vector<int> > exclusionList(numParticles); vector<vector<int> > exclusionList(numParticles);
double sumSquaredCharges = 0.0; double sumSquaredCharges = 0.0;
hasCoulomb = false; hasCoulomb = false;
...@@ -1761,7 +1761,7 @@ void OpenCLCalcNonbondedForceKernel::copyParametersToContext(ContextImpl& contex ...@@ -1761,7 +1761,7 @@ void OpenCLCalcNonbondedForceKernel::copyParametersToContext(ContextImpl& contex
posq.download(cl.getPinnedBuffer()); posq.download(cl.getPinnedBuffer());
mm_float4* posqf = (mm_float4*) cl.getPinnedBuffer(); mm_float4* posqf = (mm_float4*) cl.getPinnedBuffer();
mm_double4* posqd = (mm_double4*) cl.getPinnedBuffer(); mm_double4* posqd = (mm_double4*) cl.getPinnedBuffer();
vector<mm_float2> sigmaEpsilonVector(cl.getPaddedNumAtoms()); vector<mm_float2> sigmaEpsilonVector(cl.getPaddedNumAtoms(), mm_float2(0,0));
double sumSquaredCharges = 0.0; double sumSquaredCharges = 0.0;
const vector<cl_int>& order = cl.getAtomIndex(); const vector<cl_int>& order = cl.getAtomIndex();
for (int i = 0; i < force.getNumParticles(); i++) { for (int i = 0; i < force.getNumParticles(); i++) {
...@@ -2042,7 +2042,7 @@ void OpenCLCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOB ...@@ -2042,7 +2042,7 @@ void OpenCLCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOB
} }
vector<mm_float4> posqf(cl.getPaddedNumAtoms()); vector<mm_float4> posqf(cl.getPaddedNumAtoms());
vector<mm_double4> posqd(cl.getPaddedNumAtoms()); vector<mm_double4> posqd(cl.getPaddedNumAtoms());
vector<mm_float2> paramsVector(cl.getPaddedNumAtoms()); vector<mm_float2> paramsVector(cl.getPaddedNumAtoms(), mm_float2(1,1));
const double dielectricOffset = 0.009; const double dielectricOffset = 0.009;
for (int i = 0; i < force.getNumParticles(); i++) { for (int i = 0; i < force.getNumParticles(); i++) {
double charge, radius, scalingFactor; double charge, radius, scalingFactor;
...@@ -2202,7 +2202,7 @@ void OpenCLCalcGBSAOBCForceKernel::copyParametersToContext(ContextImpl& context, ...@@ -2202,7 +2202,7 @@ void OpenCLCalcGBSAOBCForceKernel::copyParametersToContext(ContextImpl& context,
mm_float4* posqf = (mm_float4*) cl.getPinnedBuffer(); mm_float4* posqf = (mm_float4*) cl.getPinnedBuffer();
mm_double4* posqd = (mm_double4*) cl.getPinnedBuffer(); mm_double4* posqd = (mm_double4*) cl.getPinnedBuffer();
posq.download(cl.getPinnedBuffer()); posq.download(cl.getPinnedBuffer());
vector<mm_float2> paramsVector(cl.getPaddedNumAtoms()); vector<mm_float2> paramsVector(cl.getPaddedNumAtoms(), mm_float2(1,1));
const double dielectricOffset = 0.009; const double dielectricOffset = 0.009;
for (int i = 0; i < numParticles; i++) { for (int i = 0; i < numParticles; i++) {
double charge, radius, scalingFactor; double charge, radius, scalingFactor;
......
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