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)
for(k=3;k<order;k++)
{
div=1.0/(k-1.0);
div=(RealOpenMM) (1.0/(k-1.0));
data[k-1]=0;
for(l=1;l<(k-1);l++)
{
......@@ -141,7 +141,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
ddata[k]=data[k-1]-data[k];
}
div=1.0/(order-1);
div=(RealOpenMM) (1.0/(order-1));
data[order-1]=0;
for(l=1;l<(order-1);l++)
......@@ -168,7 +168,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
sc=ss=0;
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);
ss+=bsplines_data[j]*sin(arg);
}
......@@ -178,7 +178,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
{
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,
* numerical problems, so this shouldnt cause any problems.
* (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;
pme->particlefraction[i][d] = t - ti;
......@@ -282,7 +282,7 @@ pme_update_bsplines(pme_t pme)
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];
for(l=1; l<(k-1); l++)
{
......@@ -299,7 +299,7 @@ pme_update_bsplines(pme_t pme)
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];
for(l=1; l<(order-1); l++)
......@@ -420,9 +420,9 @@ pme_reciprocal_convolution(pme_t pme,
ny = pme->ngrid[1];
nz = pme->ngrid[2];
one_4pi_eps=ONE_4PI_EPS0/pme->epsilon_r;
factor=M_PI*M_PI/(pme->ewaldcoeff*pme->ewaldcoeff);
boxfactor = M_PI*periodicBoxSize[0]*periodicBoxSize[1]*periodicBoxSize[2];
one_4pi_eps = (RealOpenMM) (ONE_4PI_EPS0/pme->epsilon_r);
factor = (RealOpenMM) (M_PI*M_PI/(pme->ewaldcoeff*pme->ewaldcoeff));
boxfactor = (RealOpenMM) (M_PI*periodicBoxSize[0]*periodicBoxSize[1]*periodicBoxSize[2]);
esum = 0;
virxx = 0;
......@@ -432,21 +432,21 @@ pme_reciprocal_convolution(pme_t pme,
viryz = 0;
virzz = 0;
maxkx = (nx+1)/2;
maxky = (ny+1)/2;
maxkz = (nz+1)/2;
maxkx = (RealOpenMM) ((nx+1)/2);
maxky = (RealOpenMM) ((ny+1)/2);
maxkz = (RealOpenMM) ((nz+1)/2);
for(kx=0;kx<nx;kx++)
{
/* 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];
bx = boxfactor*pme->bsplines_moduli[0][kx];
for(ky=0;ky<ny;ky++)
{
/* 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];
by = pme->bsplines_moduli[1][ky];
......@@ -466,7 +466,7 @@ pme_reciprocal_convolution(pme_t pme,
}
/* 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];
/* Pointer to the grid cell in question */
......@@ -494,22 +494,22 @@ pme_reciprocal_convolution(pme_t pme,
esum += ets2;
/* 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;
virxx += ets2*(vfactor*mhx*mhx-1.0);
vfactor = (factor*m2+1)*2/m2;
virxx += ets2*(vfactor*mhx*mhx-1);
virxy += ets2*vfactor*mhx*mhy;
virxz += ets2*vfactor*mhx*mhz;
viryy += ets2*(vfactor*mhy*mhy-1.0);
viryy += ets2*(vfactor*mhy*mhy-1);
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[1][1] = 0.25*viryy;
pme_virial[2][2] = 0.25*virzz;
pme_virial[0][1] = pme_virial[1][0] = 0.25*virxy;
pme_virial[0][2] = pme_virial[2][0] = 0.25*virxz;
pme_virial[1][2] = pme_virial[2][1] = 0.25*viryz;
pme_virial[0][0] = (RealOpenMM) (0.25*virxx);
pme_virial[1][1] = (RealOpenMM) (0.25*viryy);
pme_virial[2][2] = (RealOpenMM) (0.25*virzz);
pme_virial[0][1] = pme_virial[1][0] = (RealOpenMM) (0.25*virxy);
pme_virial[0][2] = pme_virial[2][0] = (RealOpenMM) (0.25*virxz);
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 :-) */
*energy = 0.5*esum;
......
......@@ -116,7 +116,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR );
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;
forces[atomAIndex][0] += dEdR*deltaR[ReferenceForce::XIndex];
......@@ -127,7 +127,7 @@ int ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
forces[atomBIndex][1] -= dEdR*deltaR[ReferenceForce::YIndex];
forces[atomBIndex][2] -= dEdR*deltaR[ReferenceForce::ZIndex];
RealOpenMM energy = energyExpression.evaluate(variables);
RealOpenMM energy = (RealOpenMM) energyExpression.evaluate(variables);
updateEnergy( energy, energiesByBond, twoI, atomIndices, energiesByAtom );
return ReferenceForce::DefaultReturn;
......
......@@ -106,11 +106,11 @@ int ReferenceCustomExternalIxn::calculateForce( int atomIndex,
// ---------------------------------------------------------------------------------------
forces[atomIndex][0] -= forceExpressionX.evaluate(variables);
forces[atomIndex][1] -= forceExpressionY.evaluate(variables);
forces[atomIndex][2] -= forceExpressionZ.evaluate(variables);
forces[atomIndex][0] -= (RealOpenMM) forceExpressionX.evaluate(variables);
forces[atomIndex][1] -= (RealOpenMM) forceExpressionY.evaluate(variables);
forces[atomIndex][2] -= (RealOpenMM) forceExpressionZ.evaluate(variables);
if (energy != NULL)
*energy += energyExpression.evaluate(variables);
*energy += (RealOpenMM) energyExpression.evaluate(variables);
return ReferenceForce::DefaultReturn;
}
......@@ -157,9 +157,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC
RealOpenMM dEdR = parameters[1]*( twelve*sig6 - six )*sig6;
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
dEdR += ONE_4PI_EPS0*parameters[2]*inverseR;
dEdR += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR);
dEdR *= inverseR*inverseR;
// accumulate forces
......@@ -172,9 +172,9 @@ int ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, RealOpenMM** atomC
RealOpenMM energy = parameters[1]*( sig6 - one )*sig6;
if (cutoff)
energy += ONE_4PI_EPS0*parameters[2]*(inverseR+krf*r2-crf);
energy += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*(inverseR+krf*r2-crf));
else
energy += ONE_4PI_EPS0*parameters[2]*inverseR;
energy += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR);
// accumulate energies
......
......@@ -206,7 +206,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
// **************************************************************************************
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;
if( energyByAtom ){
......@@ -373,8 +373,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
RealOpenMM alphaR = alphaEwald * r;
RealOpenMM dEdR = ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR;
dEdR = (RealOpenMM)(dEdR * (erfc(alphaR) + 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI ));
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 ));
RealOpenMM sig = atomParameters[ii][SigIndex] + atomParameters[jj][SigIndex];
RealOpenMM sig2 = inverseR*sig;
......@@ -423,8 +423,8 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
RealOpenMM r = deltaR[0][ReferenceForce::RIndex];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
RealOpenMM alphaR = alphaEwald * r;
RealOpenMM dEdR = ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR;
dEdR = (RealOpenMM)(dEdR * (erf(alphaR) - 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI ));
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 ));
// accumulate forces
......@@ -582,9 +582,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo
RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex];
RealOpenMM dEdR = eps*( twelve*sig6 - six )*sig6;
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
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;
// accumulate forces
......@@ -601,9 +601,9 @@ int ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoo
if( totalEnergy || energyByAtom ) {
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
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;
if( totalEnergy )
*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