Commit 6186c067 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed compiler warnings

parent cd418100
...@@ -125,7 +125,7 @@ pme_calculate_bsplines_moduli(pme_t pme) ...@@ -125,7 +125,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
for(k=3;k<order;k++) for(k=3;k<order;k++)
{ {
div=1.0/(k-1.0); div=(RealOpenMM) (1.0/(k-1.0));
data[k-1]=0; data[k-1]=0;
for(l=1;l<(k-1);l++) for(l=1;l<(k-1);l++)
{ {
...@@ -141,7 +141,7 @@ pme_calculate_bsplines_moduli(pme_t pme) ...@@ -141,7 +141,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
ddata[k]=data[k-1]-data[k]; ddata[k]=data[k-1]-data[k];
} }
div=1.0/(order-1); div=(RealOpenMM) (1.0/(order-1));
data[order-1]=0; data[order-1]=0;
for(l=1;l<(order-1);l++) for(l=1;l<(order-1);l++)
...@@ -168,7 +168,7 @@ pme_calculate_bsplines_moduli(pme_t pme) ...@@ -168,7 +168,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
sc=ss=0; sc=ss=0;
for(j=0;j<ndata;j++) for(j=0;j<ndata;j++)
{ {
arg=(2.0*M_PI*i*j)/ndata; arg=(RealOpenMM) ((2.0*M_PI*i*j)/ndata);
sc+=bsplines_data[j]*cos(arg); sc+=bsplines_data[j]*cos(arg);
ss+=bsplines_data[j]*sin(arg); ss+=bsplines_data[j]*sin(arg);
} }
...@@ -178,7 +178,7 @@ pme_calculate_bsplines_moduli(pme_t pme) ...@@ -178,7 +178,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
{ {
if(pme->bsplines_moduli[d][i]<1.0e-7) if(pme->bsplines_moduli[d][i]<1.0e-7)
{ {
pme->bsplines_moduli[d][i]=(pme->bsplines_moduli[d][i-1]+pme->bsplines_moduli[d][i+1])*0.5; pme->bsplines_moduli[d][i]=(pme->bsplines_moduli[d][i-1]+pme->bsplines_moduli[d][i+1])/2;
} }
} }
} }
...@@ -241,7 +241,7 @@ pme_update_grid_index_and_fraction(pme_t pme, ...@@ -241,7 +241,7 @@ pme_update_grid_index_and_fraction(pme_t pme,
* numerical problems, so this shouldnt cause any problems. * numerical problems, so this shouldnt cause any problems.
* (And, by adding 100.0 box lengths, we would lose a bit of numerical accuracy here!) * (And, by adding 100.0 box lengths, we would lose a bit of numerical accuracy here!)
*/ */
t = (atomCoordinates[i][d] / periodicBoxSize[d] + 1.0)*pme->ngrid[d]; t = (atomCoordinates[i][d] / periodicBoxSize[d] + 1)*pme->ngrid[d];
ti = (int) t; ti = (int) t;
pme->particlefraction[i][d] = t - ti; pme->particlefraction[i][d] = t - ti;
...@@ -282,7 +282,7 @@ pme_update_bsplines(pme_t pme) ...@@ -282,7 +282,7 @@ pme_update_bsplines(pme_t pme)
for(k=3; k<order; k++) for(k=3; k<order; k++)
{ {
div = 1.0/(k-1.0); div = (RealOpenMM) (1.0/(k-1.0));
data[k-1] = div*dr*data[k-2]; data[k-1] = div*dr*data[k-2];
for(l=1; l<(k-1); l++) for(l=1; l<(k-1); l++)
{ {
...@@ -299,7 +299,7 @@ pme_update_bsplines(pme_t pme) ...@@ -299,7 +299,7 @@ pme_update_bsplines(pme_t pme)
ddata[k] = data[k-1]-data[k]; ddata[k] = data[k-1]-data[k];
} }
div = 1.0/(order-1); div = (RealOpenMM) (1.0/(order-1));
data[order-1] = div*dr*data[order-2]; data[order-1] = div*dr*data[order-2];
for(l=1; l<(order-1); l++) for(l=1; l<(order-1); l++)
...@@ -420,9 +420,9 @@ pme_reciprocal_convolution(pme_t pme, ...@@ -420,9 +420,9 @@ pme_reciprocal_convolution(pme_t pme,
ny = pme->ngrid[1]; ny = pme->ngrid[1];
nz = pme->ngrid[2]; nz = pme->ngrid[2];
one_4pi_eps=ONE_4PI_EPS0/pme->epsilon_r; one_4pi_eps = (RealOpenMM) (ONE_4PI_EPS0/pme->epsilon_r);
factor=M_PI*M_PI/(pme->ewaldcoeff*pme->ewaldcoeff); factor = (RealOpenMM) (M_PI*M_PI/(pme->ewaldcoeff*pme->ewaldcoeff));
boxfactor = M_PI*periodicBoxSize[0]*periodicBoxSize[1]*periodicBoxSize[2]; boxfactor = (RealOpenMM) (M_PI*periodicBoxSize[0]*periodicBoxSize[1]*periodicBoxSize[2]);
esum = 0; esum = 0;
virxx = 0; virxx = 0;
...@@ -432,21 +432,21 @@ pme_reciprocal_convolution(pme_t pme, ...@@ -432,21 +432,21 @@ pme_reciprocal_convolution(pme_t pme,
viryz = 0; viryz = 0;
virzz = 0; virzz = 0;
maxkx = (nx+1)/2; maxkx = (RealOpenMM) ((nx+1)/2);
maxky = (ny+1)/2; maxky = (RealOpenMM) ((ny+1)/2);
maxkz = (nz+1)/2; maxkz = (RealOpenMM) ((nz+1)/2);
for(kx=0;kx<nx;kx++) for(kx=0;kx<nx;kx++)
{ {
/* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */ /* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */
mx = (kx<maxkx) ? kx : (kx-nx); mx = (RealOpenMM) ((kx<maxkx) ? kx : (kx-nx));
mhx = mx/periodicBoxSize[0]; mhx = mx/periodicBoxSize[0];
bx = boxfactor*pme->bsplines_moduli[0][kx]; bx = boxfactor*pme->bsplines_moduli[0][kx];
for(ky=0;ky<ny;ky++) for(ky=0;ky<ny;ky++)
{ {
/* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */ /* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */
my = (ky<maxky) ? ky : (ky-ny); my = (RealOpenMM) ((ky<maxky) ? ky : (ky-ny));
mhy = my/periodicBoxSize[1]; mhy = my/periodicBoxSize[1];
by = pme->bsplines_moduli[1][ky]; by = pme->bsplines_moduli[1][ky];
...@@ -466,7 +466,7 @@ pme_reciprocal_convolution(pme_t pme, ...@@ -466,7 +466,7 @@ pme_reciprocal_convolution(pme_t pme,
} }
/* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */ /* Calculate frequency. Grid indices in the upper half correspond to negative frequencies! */
mz = (kz<maxkz) ? kz : (kz-nz); mz = (RealOpenMM) ((kz<maxkz) ? kz : (kz-nz));
mhz = mz/periodicBoxSize[2]; mhz = mz/periodicBoxSize[2];
/* Pointer to the grid cell in question */ /* Pointer to the grid cell in question */
...@@ -494,22 +494,22 @@ pme_reciprocal_convolution(pme_t pme, ...@@ -494,22 +494,22 @@ pme_reciprocal_convolution(pme_t pme,
esum += ets2; esum += ets2;
/* PME long-range contribution to atomic virial. Since it is symmetric, we only calculate half the matrix inside this loop. */ /* PME long-range contribution to atomic virial. Since it is symmetric, we only calculate half the matrix inside this loop. */
vfactor = (factor*m2+1.0)*2.0/m2; vfactor = (factor*m2+1)*2/m2;
virxx += ets2*(vfactor*mhx*mhx-1.0); virxx += ets2*(vfactor*mhx*mhx-1);
virxy += ets2*vfactor*mhx*mhy; virxy += ets2*vfactor*mhx*mhy;
virxz += ets2*vfactor*mhx*mhz; virxz += ets2*vfactor*mhx*mhz;
viryy += ets2*(vfactor*mhy*mhy-1.0); viryy += ets2*(vfactor*mhy*mhy-1);
viryz += ets2*vfactor*mhy*mhz; viryz += ets2*vfactor*mhy*mhz;
virzz += ets2*(vfactor*mhz*mhz-1.0); virzz += ets2*(vfactor*mhz*mhz-1);
} }
} }
} }
pme_virial[0][0] = 0.25*virxx; pme_virial[0][0] = (RealOpenMM) (0.25*virxx);
pme_virial[1][1] = 0.25*viryy; pme_virial[1][1] = (RealOpenMM) (0.25*viryy);
pme_virial[2][2] = 0.25*virzz; pme_virial[2][2] = (RealOpenMM) (0.25*virzz);
pme_virial[0][1] = pme_virial[1][0] = 0.25*virxy; pme_virial[0][1] = pme_virial[1][0] = (RealOpenMM) (0.25*virxy);
pme_virial[0][2] = pme_virial[2][0] = 0.25*virxz; pme_virial[0][2] = pme_virial[2][0] = (RealOpenMM) (0.25*virxz);
pme_virial[1][2] = pme_virial[2][1] = 0.25*viryz; pme_virial[1][2] = pme_virial[2][1] = (RealOpenMM) (0.25*viryz);
/* The factor 0.5 is nothing special, but it is better to have it here than inside the loop :-) */ /* The factor 0.5 is nothing special, but it is better to have it here than inside the loop :-) */
*energy = 0.5*esum; *energy = 0.5*esum;
......
...@@ -116,7 +116,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices, ...@@ -116,7 +116,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
int atomBIndex = atomIndices[1]; int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR ); ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR );
variables["r"] = deltaR[ReferenceForce::RIndex]; variables["r"] = deltaR[ReferenceForce::RIndex];
RealOpenMM dEdR = forceExpression.evaluate(variables); RealOpenMM dEdR = (RealOpenMM) forceExpression.evaluate(variables);
dEdR = deltaR[ReferenceForce::RIndex] > zero ? (dEdR/deltaR[ReferenceForce::RIndex]) : zero; dEdR = deltaR[ReferenceForce::RIndex] > zero ? (dEdR/deltaR[ReferenceForce::RIndex]) : zero;
forces[atomAIndex][0] += dEdR*deltaR[ReferenceForce::XIndex]; forces[atomAIndex][0] += dEdR*deltaR[ReferenceForce::XIndex];
...@@ -127,7 +127,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices, ...@@ -127,7 +127,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
forces[atomBIndex][1] -= dEdR*deltaR[ReferenceForce::YIndex]; forces[atomBIndex][1] -= dEdR*deltaR[ReferenceForce::YIndex];
forces[atomBIndex][2] -= dEdR*deltaR[ReferenceForce::ZIndex]; forces[atomBIndex][2] -= dEdR*deltaR[ReferenceForce::ZIndex];
RealOpenMM energy = energyExpression.evaluate(variables); RealOpenMM energy = (RealOpenMM) energyExpression.evaluate(variables);
updateEnergy( energy, energiesByBond, twoI, atomIndices, energiesByAtom ); updateEnergy( energy, energiesByBond, twoI, atomIndices, energiesByAtom );
return ReferenceForce::DefaultReturn; return ReferenceForce::DefaultReturn;
......
...@@ -106,11 +106,11 @@ int ReferenceCustomExternalIxn::calculateForce( int atomIndex, ...@@ -106,11 +106,11 @@ int ReferenceCustomExternalIxn::calculateForce( int atomIndex,
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
forces[atomIndex][0] -= forceExpressionX.evaluate(variables); forces[atomIndex][0] -= (RealOpenMM) forceExpressionX.evaluate(variables);
forces[atomIndex][1] -= forceExpressionY.evaluate(variables); forces[atomIndex][1] -= (RealOpenMM) forceExpressionY.evaluate(variables);
forces[atomIndex][2] -= forceExpressionZ.evaluate(variables); forces[atomIndex][2] -= (RealOpenMM) forceExpressionZ.evaluate(variables);
if (energy != NULL) if (energy != NULL)
*energy += energyExpression.evaluate(variables); *energy += (RealOpenMM) energyExpression.evaluate(variables);
return ReferenceForce::DefaultReturn; return ReferenceForce::DefaultReturn;
} }
...@@ -157,9 +157,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC ...@@ -157,9 +157,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC
RealOpenMM dEdR = parameters[1]*( twelve*sig6 - six )*sig6; RealOpenMM dEdR = parameters[1]*( twelve*sig6 - six )*sig6;
if (cutoff) if (cutoff)
dEdR += ONE_4PI_EPS0*parameters[2]*(inverseR-2.0f*krf*r2); dEdR += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*(inverseR-2.0f*krf*r2));
else else
dEdR += ONE_4PI_EPS0*parameters[2]*inverseR; dEdR += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR);
dEdR *= inverseR*inverseR; dEdR *= inverseR*inverseR;
// accumulate forces // accumulate forces
...@@ -172,9 +172,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC ...@@ -172,9 +172,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC
RealOpenMM energy = parameters[1]*( sig6 - one )*sig6; RealOpenMM energy = parameters[1]*( sig6 - one )*sig6;
if (cutoff) if (cutoff)
energy += ONE_4PI_EPS0*parameters[2]*(inverseR+krf*r2-crf); energy += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*(inverseR+krf*r2-crf));
else else
energy += ONE_4PI_EPS0*parameters[2]*inverseR; energy += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR);
// accumulate energies // accumulate energies
......
...@@ -206,7 +206,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at ...@@ -206,7 +206,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
// ************************************************************************************** // **************************************************************************************
for( int atomID = 0; atomID < numberOfAtoms; atomID++ ){ for( int atomID = 0; atomID < numberOfAtoms; atomID++ ){
RealOpenMM selfEwaldEnergy = ONE_4PI_EPS0*atomParameters[atomID][QIndex]*atomParameters[atomID][QIndex] * alphaEwald/SQRT_PI; RealOpenMM selfEwaldEnergy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[atomID][QIndex]*atomParameters[atomID][QIndex] * alphaEwald/SQRT_PI);
totalSelfEwaldEnergy -= selfEwaldEnergy; totalSelfEwaldEnergy -= selfEwaldEnergy;
if( energyByAtom ){ if( energyByAtom ){
...@@ -373,8 +373,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at ...@@ -373,8 +373,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
RealOpenMM alphaR = alphaEwald * r; RealOpenMM alphaR = alphaEwald * r;
RealOpenMM dEdR = ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR; RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR);
dEdR = (RealOpenMM)(dEdR * (erfc(alphaR) + 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI )); dEdR = (RealOpenMM) (dEdR * (erfc(alphaR) + 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI ));
RealOpenMM sig = atomParameters[ii][SigIndex] + atomParameters[jj][SigIndex]; RealOpenMM sig = atomParameters[ii][SigIndex] + atomParameters[jj][SigIndex];
RealOpenMM sig2 = inverseR*sig; RealOpenMM sig2 = inverseR*sig;
...@@ -423,8 +423,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at ...@@ -423,8 +423,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
RealOpenMM r = deltaR[0][ReferenceForce::RIndex]; RealOpenMM r = deltaR[0][ReferenceForce::RIndex];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]); RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
RealOpenMM alphaR = alphaEwald * r; RealOpenMM alphaR = alphaEwald * r;
RealOpenMM dEdR = ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR; RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR);
dEdR = (RealOpenMM)(dEdR * (erf(alphaR) - 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI )); dEdR = (RealOpenMM) (dEdR * (erf(alphaR) - 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI ));
// accumulate forces // accumulate forces
...@@ -582,9 +582,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo ...@@ -582,9 +582,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo
RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex]; RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex];
RealOpenMM dEdR = eps*( twelve*sig6 - six )*sig6; RealOpenMM dEdR = eps*( twelve*sig6 - six )*sig6;
if (cutoff) if (cutoff)
dEdR += ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR-2.0f*krf*r2); dEdR += (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR-2.0f*krf*r2));
else else
dEdR += ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR; dEdR += (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR);
dEdR *= inverseR*inverseR; dEdR *= inverseR*inverseR;
// accumulate forces // accumulate forces
...@@ -601,9 +601,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo ...@@ -601,9 +601,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo
if( totalEnergy || energyByAtom ) { if( totalEnergy || energyByAtom ) {
if (cutoff) if (cutoff)
energy = ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR+krf*r2-crf); energy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR+krf*r2-crf));
else else
energy = ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR; energy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR);
energy += eps*(sig6-one)*sig6; energy += eps*(sig6-one)*sig6;
if( totalEnergy ) if( totalEnergy )
*totalEnergy += energy; *totalEnergy += energy;
......
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