reduce compiler warnings. adapt LAMMPS programming style

This commit is contained in:
Axel Kohlmeyer
2022-04-28 20:04:25 -04:00
parent 723bf202c0
commit c086c20238
6 changed files with 27 additions and 55 deletions

View File

@ -29,18 +29,14 @@ enum{VDWL,REPULSE,QFER,DISP,MPOLE,POLAR,USOLV,DISP_LONG,MPOLE_LONG,POLAR_LONG};
void PairAmoeba::charge_transfer()
{
int i,j,ii,jj,itype,jtype,iclass,jclass;
int special_flag;
double e,de,felec,fgrp;
double rr1,r,r2;
double r3,r4,r5;
double xi,yi,zi;
double xr,yr,zr;
double chgi,chgj;
double chgij;
double alphai,alphaj;
double alphaij;
double expi,expj;
double expij;
double frcx,frcy,frcz;
double vxx,vyy,vzz;
double vxy,vxz,vyz;
@ -58,7 +54,6 @@ void PairAmoeba::charge_transfer()
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
// neigh list

View File

@ -12,18 +12,24 @@
------------------------------------------------------------------------- */
#include "pair_amoeba.h"
#include <cmath>
#include "amoeba_convolution.h"
#include "atom.h"
#include "domain.h"
#include "neigh_list.h"
#include "fft3d_wrap.h"
#include "math_const.h"
#include "math_special.h"
#include "memory.h"
#include <cmath>
using namespace LAMMPS_NS;
using namespace MathConst;
using MathSpecial::cube;
using MathSpecial::powint;
enum{VDWL,REPULSE,QFER,DISP,MPOLE,POLAR,USOLV,DISP_LONG,MPOLE_LONG,POLAR_LONG};
/* ----------------------------------------------------------------------
@ -58,7 +64,7 @@ void PairAmoeba::dispersion()
for (int i = 0; i < nlocal; i++) {
itype = amtype[i];
iclass = amtype2class[itype];
term = pow(aewald,6) / 12.0;
term = powint(aewald,6) / 12.0;
edisp += term*csix[iclass]*csix[iclass];
}
}
@ -73,7 +79,7 @@ void PairAmoeba::dispersion_real()
int i,j,ii,jj,itype,jtype,iclass,jclass;
double xi,yi,zi;
double xr,yr,zr;
double e,de,fgrp;
double e,de;
double ci,ck;
double r,r2,r6,r7;
double ai,ai2;
@ -100,7 +106,6 @@ void PairAmoeba::dispersion_real()
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
// neigh list
@ -193,7 +198,7 @@ void PairAmoeba::dispersion_real()
scale = factor_disp * damp*damp;
scale = scale - 1.0;
e = -ci * ck * (expa+scale) / r6;
rterm = -pow(ralpha2,3) * expterm / r;
rterm = -cube(ralpha2) * expterm / r;
de = -6.0*e/r2 - ci*ck*rterm/r7 - 2.0*ci*ck*factor_disp*damp*ddamp/r7;
edisp += e;
@ -243,13 +248,9 @@ void PairAmoeba::dispersion_real()
void PairAmoeba::dispersion_kspace()
{
int i,j,k,m,n,ix,iy,iz,ib,jb,kb,itype,iclass;
int i,j,k,m,n,ib,jb,kb,itype,iclass;
int nhalf1,nhalf2,nhalf3;
int nxlo,nxhi,nylo,nyhi,nzlo,nzhi;
int i0,iatm,igrd0;
int it1,it2,it3;
int j0,jgrd0;
int k0,kgrd0;
double e,fi,denom;
double r1,r2,r3;
double h1,h2,h3;
@ -270,7 +271,6 @@ void PairAmoeba::dispersion_kspace()
// owned atoms
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
@ -318,7 +318,7 @@ void PairAmoeba::dispersion_kspace()
bfac = MY_PI / aewald;
fac1 = 2.0*pow(MY_PI,3.5);
fac2 = pow(aewald,3.0);
fac2 = cube(aewald);
fac3 = -2.0*aewald*MY_PI*MY_PI;
denom0 = (6.0*volbox)/pow(MY_PI,1.5);

View File

@ -259,14 +259,11 @@ void PairAmoeba::read_keyfile(char *filename)
int me = comm->me;
FILE *fptr;
char line[MAXLINE],next[MAXLINE];
char line[MAXLINE];
if (me == 0) {
fptr = utils::open_potential(filename,lmp,nullptr);
if (fptr == NULL) {
char str[128];
snprintf(str,128,"Cannot open AMOEBA key file %s",filename);
error->one(FLERR,str);
}
if (fptr == NULL)
error->one(FLERR,"Cannot open AMOEBA key file {}: {}",filename, utils::getsyserror());
}
// read lines, one at a time
@ -597,7 +594,7 @@ int PairAmoeba::read_section_line(FILE *fp, char *line,
char *ptr,*copy,*copy_next;
char **words,**words_next;
int nwords,nwords_next;
int nwords_next;
copy = copy_next = NULL;
words = words_next = NULL;

View File

@ -30,17 +30,14 @@ void PairAmoeba::hal()
{
int i,j,ii,jj,itype,jtype,iclass,jclass,iv,jv;
int special_which;
double e,de,eps,rdn;
double fgrp,rv,rv7;
double e,de,eps;
double rv,rv7;
double xi,yi,zi;
double xr,yr,zr;
double redi,rediv;
double redj,redjv;
double dedx,dedy,dedz;
double rho,rho6,rho7;
double tau,tau7,scal;
double s1,s2,t1,t2;
double dt1drho,dt2drho;
double rho,tau,tau7;
double dtau,gtau;
double taper,dtaper;
double rik,rik2,rik3;
@ -49,7 +46,6 @@ void PairAmoeba::hal()
double vxx,vyy,vzz;
double vyx,vzx,vzy;
double factor_hal;
double vir[6];
int inum,jnum;
int *ilist,*jlist,*numneigh,**firstneigh;
@ -60,9 +56,7 @@ void PairAmoeba::hal()
// owned atoms
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
// neigh list

View File

@ -193,8 +193,7 @@ void PairAmoeba::dftmod(double *bsmod, double *bsarray, int nfft, int order)
void PairAmoeba::bspline_fill()
{
int i,ifr;
double xi,yi,zi;
int ifr;
double w,fr,eps;
double lamda[3];
@ -525,7 +524,6 @@ void PairAmoeba::grid_mpole(double **fmp, double ***grid)
double term0,term1,term2;
int nlpts = (bsorder-1) / 2;
int nrpts = bsorder - nlpts - 1;
// spread the permanent multipole moments onto the grid
@ -605,7 +603,6 @@ void PairAmoeba::fphi_mpole(double ***grid, double **fphi)
double tuv021,tuv102,tuv012,tuv111;
int nlpts = (bsorder-1) / 2;
int nrpts = bsorder - nlpts - 1;
// extract the permanent multipole field at each site
@ -744,7 +741,6 @@ void PairAmoeba::grid_uind(double **fuind, double **fuinp, double ****grid)
double term02,term12;
int nlpts = (bsorder-1) / 2;
int nrpts = bsorder - nlpts - 1;
// put the induced dipole moments onto the grid
@ -815,7 +811,6 @@ void PairAmoeba::fphi_uind(double ****grid, double **fdip_phi1,
double tuv021,tuv102,tuv012,tuv111;
int nlpts = (bsorder-1) / 2;
int nrpts = bsorder - nlpts - 1;
// extract the permanent multipole field at each site
@ -1044,7 +1039,6 @@ void PairAmoeba::grid_disp(double ***grid)
double term;
int nlpts = (bsorder-1) / 2;
int nrpts = bsorder - nlpts - 1;
// put the dispersion sites onto the grid
@ -1083,10 +1077,8 @@ void PairAmoeba::grid_disp(double ***grid)
void PairAmoeba::kewald()
{
int i,k,next;
int nbig,minfft;
int nfft1,nfft2,nfft3;
double delta,rmax;
double delta;
double edens,ddens;
double size,slope;

View File

@ -12,8 +12,7 @@
------------------------------------------------------------------------- */
#include "pair_amoeba.h"
#include <cmath>
#include <cstring>
#include "amoeba_convolution.h"
#include "atom.h"
#include "domain.h"
@ -23,6 +22,9 @@
#include "math_const.h"
#include "memory.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -44,20 +46,13 @@ enum{VDWL,REPULSE,QFER,DISP,MPOLE,POLAR,USOLV,DISP_LONG,MPOLE_LONG,POLAR_LONG};
void PairAmoeba::multipole()
{
int i,j,ii,itype;
double e,em;
double e;
double felec;
double term,fterm,vterm;
double term,fterm;
double ci;
double dix,diy,diz;
double qixx,qixy,qixz,qiyy,qiyz,qizz;
double xq,yq,zq;
double xv,yv,zv;
double xd,yd,zd;
double cii,dii,qii;
double xdfield,ydfield,zdfield;
double tem[3];
double frcx[3],frcy[3],frcz[3];
// set cutoffs, taper coeffs, and PME params
@ -66,7 +61,6 @@ void PairAmoeba::multipole()
// owned atoms
double **x = atom->x;
int nlocal = atom->nlocal;
// zero repulsion torque on owned + ghost atoms