undo cosmetic differences between LAMMPS-ICMS and LAMMPS

This commit is contained in:
Axel Kohlmeyer
2015-09-03 06:51:55 -04:00
parent 31a8e6220b
commit c503b8736d
42 changed files with 268 additions and 288 deletions

View File

@ -16,7 +16,6 @@
------------------------------------------------------------------------- */
#include "mpi.h"
#include "mpiio.h"
#include "restart_mpiio.h"
#include "error.h"
#include "limits.h"

View File

@ -194,7 +194,7 @@ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) :
// f_kspace = Rspace copy of Kspace forces
// allocate dummy version for Kspace partition
maxatom = -1;
maxatom = 0;
f_kspace = NULL;
if (!master) memory->create(f_kspace,1,1,"verlet/split:f_kspace");
}

View File

@ -72,7 +72,7 @@ class FixRigidNH : public FixRigid {
int tcomputeflag,pcomputeflag;
void couple();
virtual void remap();
void remap();
void nhc_temp_integrate();
void nhc_press_integrate();

View File

@ -204,10 +204,8 @@ void ComputeBasalAtom::compute_peratom()
double bond_angle;
double norm_j, norm_k;
chi[0] = chi[1] = chi[2] = chi[3] = chi[4] = chi[5] = chi[6] = chi[7] = 0;
double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik,
double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik,x3[n0],y3[n0],z3[n0],
xmean5, ymean5, zmean5, xmean6, ymean6, zmean6, xmean7, ymean7, zmean7;
double *x3,*y3,*z3;
x3 = new double[n0]; y3 = new double[n0]; z3 = new double[n0];
for (j = 0; j < n0; j++) {
x_ij = x[i][0]-x[nearest_n0[j]][0];
y_ij = x[i][1]-x[nearest_n0[j]][1];
@ -415,7 +413,6 @@ void ComputeBasalAtom::compute_peratom()
//if there are less than two ~180 degree bond angles, the algorithm returns null
else BPV[i][0] = BPV[i][1] = BPV[i][2] = 0.0;
delete[] x3; delete[] y3; delete[] z3;
//normalize BPV:
double Mag = sqrt(BPV[i][0]*BPV[i][0] +
BPV[i][1]*BPV[i][1] + BPV[i][2]*BPV[i][2]);

View File

@ -380,8 +380,7 @@ void FixIPI::final_integrate()
int nat=bsize/3;
double **f= atom->f;
double *lbuf;
lbuf = new double[bsize];
double lbuf[bsize];
// reassembles the force vector from the local arrays
int nlocal = atom->nlocal;
@ -393,7 +392,6 @@ void FixIPI::final_integrate()
lbuf[3*(atom->tag[i]-1)+2]=f[i][2]*forceconv;
}
MPI_Allreduce(lbuf,buffer,bsize,MPI_DOUBLE,MPI_SUM,world);
delete[] lbuf;
for (int i = 0; i < 9; ++i) vir[i]=0.0;

View File

@ -155,7 +155,7 @@ void FixRigidOMP::final_integrate()
} else if (rstyle == GROUP) {
// we likely have only a rather number of groups so we loop
// we likely have only a rather number of groups so we loops
// over bodies and thread over all atoms for each of them.
for (int ib = 0; ib < nbody; ++ib) {

View File

@ -22,7 +22,6 @@
#include "force.h"
#include "memory.h"
#include "modify.h"
#include "compute.h"
#include "neighbor.h"
#include "timer.h"

View File

@ -666,10 +666,9 @@ void FixPhonon::postprocess( )
}
// to get Phi = KT.G^-1; normalization of FFTW data is done here
double boltz = force->boltz, *kbtsqrt, TempAve = 0.;
double boltz = force->boltz, kbtsqrt[sysdim], TempAve = 0.;
double TempFac = inv_neval*inv_nTemp;
double NormFac = TempFac*double(ntotal);
kbtsqrt = new double[sysdim];
for (idim = 0; idim < sysdim; ++idim){
kbtsqrt[idim] = sqrt(TempSum[idim]*NormFac);
@ -683,7 +682,6 @@ void FixPhonon::postprocess( )
for (idim = 0; idim < fft_dim; ++idim)
for (jdim = 0; jdim < fft_dim; ++jdim) Phi_q[idq][ndim++] *= kbtsqrt[idim%sysdim]*kbtsqrt[jdim%sysdim];
}
delete[] kbtsqrt;
// to collect all local Phi_q to root
displs[0]=0;
@ -692,8 +690,7 @@ void FixPhonon::postprocess( )
MPI_Gatherv(Phi_q[0],mynq*fft_dim2*2,MPI_DOUBLE,Phi_all[0],recvcnts,displs,MPI_DOUBLE,0,world);
// to collect all basis info and averaged it on root
double *basis_root;
basis_root = new double[fft_dim];
double basis_root[fft_dim];
if (fft_dim > sysdim) MPI_Reduce(&basis[1][0], &basis_root[sysdim], fft_dim-sysdim, MPI_DOUBLE, MPI_SUM, 0, world);
if (me == 0){ // output dynamic matrix by root
@ -733,7 +730,6 @@ void FixPhonon::postprocess( )
fwrite(M_inv_sqrt, sizeof(double),nucell, fp_bin);
fclose(fp_bin);
delete[] basis_root;
// write log file, here however, it is the dynamical matrix that is written
for (int i = 0; i < 60; ++i) fprintf(flog,"#"); fprintf(flog,"\n");

View File

@ -65,8 +65,8 @@ AtomVecBody::~AtomVecBody()
{
int nall = nlocal_bonus + nghost_bonus;
for (int i = 0; i < nall; i++) {
bptr->icp->put(bonus[i].iindex);
bptr->dcp->put(bonus[i].dindex);
icp->put(bonus[i].iindex);
dcp->put(bonus[i].dindex);
}
memory->sfree(bonus);
@ -95,6 +95,8 @@ void AtomVecBody::process_args(int narg, char **arg)
else error->all(FLERR,"Unknown body style");
bptr->avec = this;
icp = bptr->icp;
dcp = bptr->dcp;
// max size of forward/border comm
// 7,16 are packed in pack_comm/pack_border
@ -189,8 +191,8 @@ void AtomVecBody::copy(int i, int j, int delflag)
// if deleting atom J via delflag and J has bonus data, then delete it
if (delflag && body[j] >= 0) {
bptr->icp->put(bonus[body[j]].iindex);
bptr->dcp->put(bonus[body[j]].dindex);
icp->put(bonus[body[j]].iindex);
dcp->put(bonus[body[j]].dindex);
copy_bonus(nlocal_bonus-1,body[j]);
nlocal_bonus--;
}
@ -226,8 +228,8 @@ void AtomVecBody::clear_bonus()
{
int nall = nlocal_bonus + nghost_bonus;
for (int i = nlocal_bonus; i < nall; i++) {
bptr->icp->put(bonus[i].iindex);
bptr->dcp->put(bonus[i].dindex);
icp->put(bonus[i].iindex);
dcp->put(bonus[i].dindex);
}
nghost_bonus = 0;
}
@ -828,8 +830,8 @@ void AtomVecBody::unpack_border(int n, int first, double *buf)
inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i;
bonus[j].ivalue = bptr->icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = bptr->dcp->get(bonus[j].ndouble,bonus[j].dindex);
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]);
bonus[j].ilocal = i;
body[i] = j;
@ -876,8 +878,8 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf)
inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i;
bonus[j].ivalue = bptr->icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = bptr->dcp->get(bonus[j].ndouble,bonus[j].dindex);
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]);
bonus[j].ilocal = i;
body[i] = j;
@ -923,8 +925,8 @@ int AtomVecBody::unpack_border_hybrid(int n, int first, double *buf)
inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i;
bonus[j].ivalue = bptr->icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = bptr->dcp->get(bonus[j].ndouble,bonus[j].dindex);
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]);
bonus[j].ilocal = i;
body[i] = j;
@ -1027,9 +1029,9 @@ int AtomVecBody::unpack_exchange(double *buf)
inertia[2] = buf[m++];
bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i;
bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i;
bonus[nlocal_bonus].ivalue = bptr->icp->get(bonus[nlocal_bonus].ninteger,
bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger,
bonus[nlocal_bonus].iindex);
bonus[nlocal_bonus].dvalue = bptr->dcp->get(bonus[nlocal_bonus].ndouble,
bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble,
bonus[nlocal_bonus].dindex);
memcpy(bonus[nlocal_bonus].ivalue,&buf[m],
bonus[nlocal_bonus].ninteger*sizeof(int));
@ -1179,9 +1181,9 @@ int AtomVecBody::unpack_restart(double *buf)
inertia[2] = buf[m++];
bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i;
bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i;
bonus[nlocal_bonus].ivalue = bptr->icp->get(bonus[nlocal_bonus].ninteger,
bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger,
bonus[nlocal_bonus].iindex);
bonus[nlocal_bonus].dvalue = bptr->dcp->get(bonus[nlocal_bonus].ndouble,
bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble,
bonus[nlocal_bonus].dindex);
memcpy(bonus[nlocal_bonus].ivalue,&buf[m],
bonus[nlocal_bonus].ninteger*sizeof(int));
@ -1469,7 +1471,7 @@ bigint AtomVecBody::memory_usage()
if (atom->memcheck("body")) bytes += memory->usage(body,nmax);
bytes += nmax_bonus*sizeof(Bonus);
bytes += bptr->icp->size + bptr->dcp->size;
bytes += icp->size + dcp->size;
int nall = nlocal_bonus + nghost_bonus;
for (int i = 0; i < nall; i++) {

View File

@ -25,8 +25,6 @@
#include "special.h"
#include "error.h"
#include <stdlib.h>
using namespace LAMMPS_NS;
enum{MULTI,ATOM,BOND,ANGLE,DIHEDRAL,IMPROPER,STATS};

View File

@ -21,7 +21,6 @@ namespace LAMMPS_NS {
class Error : protected Pointers {
public:
Error(class LAMMPS *);
virtual ~Error() {}
void universe_all(const char *, int, const char *);
void universe_one(const char *, int, const char *);

View File

@ -413,7 +413,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
maxvar = 0;
varatom = NULL;
maxatom = -1;
maxatom = 0;
bin = NULL;
nbins = maxbin = 0;

View File

@ -81,7 +81,7 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
scale = 1.0;
maxatom = -1;
maxatom = 0;
vheat = NULL;
vscale = NULL;
}

View File

@ -120,11 +120,10 @@ class FixNH : public Fix {
double fixedpoint[3]; // location of dilation fixed-point
void couple();
void remap();
void nhc_temp_integrate();
void nhc_press_integrate();
virtual void remap();
virtual void nve_x(); // may be overwritten by child classes
virtual void nve_v();
virtual void nh_v_press();

View File

@ -75,7 +75,7 @@ class Force : protected Pointers {
int special_extra; // extra space for added bonds
Force(class LAMMPS *);
virtual ~Force();
~Force();
void init();
void create_pair(const char *, int);

View File

@ -1065,8 +1065,7 @@ void Image::write_PNG(FILE *fp)
png_set_text(png_ptr,info_ptr,text_ptr,1);
png_write_info(png_ptr,info_ptr);
png_bytep *row_pointers;
row_pointers = new png_bytep[height];
png_bytep row_pointers[height];
for (int i=0; i < height; ++i)
row_pointers[i] = (png_bytep) &writeBuffer[(height-i-1)*3*width];
@ -1074,7 +1073,6 @@ void Image::write_PNG(FILE *fp)
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
delete[] row_pointers;
#endif
}

View File

@ -18,8 +18,8 @@
#include "update.h"
#include "domain.h"
#include "comm.h"
#include "memory.h"
#include "force.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;

View File

@ -25,7 +25,6 @@ namespace LAMMPS_NS {
class Memory : protected Pointers {
public:
Memory(class LAMMPS *);
virtual ~Memory() {}
void *smalloc(bigint n, const char *);
void *srealloc(void *, bigint n, const char *);

View File

@ -223,10 +223,10 @@ void Pair::init()
// I,I coeffs must be set
// init_one() will check if I,J is set explicitly or inferred by mixing
if (!allocated) error->all(FLERR,"Not all pair coeffs are set");
if (!allocated) error->all(FLERR,"All pair coeffs are not set");
for (i = 1; i <= atom->ntypes; i++)
if (setflag[i][i] == 0) error->all(FLERR,"Not all pair coeffs are set");
if (setflag[i][i] == 0) error->all(FLERR,"All pair coeffs are not set");
// style-specific initialization

View File

@ -277,10 +277,10 @@ This is likely not what you want to do. The exclusion settings will
eliminate neighbors in the neighbor list, which the manybody potential
needs to calculated its terms correctly.
E: Not all pair coeffs are set
E: All pair coeffs are not set
Pair coefficients must be set for all pairs of atom types in either the
data file or by the pair_coeff command before running a simulation.
All pair coefficients must be set in the data file or by the
pair_coeff command before running a simulation.
E: Fix adapt interface to this pair style not supported

View File

@ -17,7 +17,6 @@
#include "math.h"
#include "random_mars.h"
#include "error.h"
#include "math_inline.h"
using namespace LAMMPS_NS;
@ -105,8 +104,7 @@ double RanMars::gaussian()
rsq = v1*v1 + v2*v2;
if (rsq < 1.0 && rsq != 0.0) again = 0;
}
// fac = sqrt(-2.0*log(rsq)/rsq);
fac = MathInline::sqrtlgx2byx(rsq);
fac = sqrt(-2.0*log(rsq)/rsq);
second = v1*fac;
first = v2*fac;
save = 1;

View File

@ -15,7 +15,6 @@
#include "math.h"
#include "random_park.h"
#include "math_inline.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -65,8 +64,7 @@ double RanPark::gaussian()
rsq = v1*v1 + v2*v2;
if (rsq < 1.0 && rsq != 0.0) again = 0;
}
// fac = sqrt(-2.0*log(rsq)/rsq);
fac = MathInline::sqrtlgx2byx(rsq);
fac = sqrt(-2.0*log(rsq)/rsq);
second = v1*fac;
first = v2*fac;
save = 1;

View File

@ -42,7 +42,7 @@ class Universe : protected Pointers {
// proc uni2orig[I] in original communicator
Universe(class LAMMPS *, MPI_Comm);
virtual ~Universe();
~Universe();
void reorder(char *, char *);
void add_world(char *);
int consistent();

View File

@ -47,7 +47,7 @@ class Update : protected Pointers {
char *minimize_style;
Update(class LAMMPS *);
virtual ~Update();
~Update();
void init();
void set_units(const char *);
void create_integrate(int, char **, int);