diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 6bcabe2a7b..5bf931db62 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -612,7 +612,7 @@ void FixRigidNH::final_integrate() // sum over atoms to get force and torque on rigid body - int *image = atom->image; + tagint *image = atom->image; double **x = atom->x; double **f = atom->f; int nlocal = atom->nlocal; diff --git a/src/RIGID/fix_rigid_nh.h b/src/RIGID/fix_rigid_nh.h index 4425de399e..d33541b6f7 100644 --- a/src/RIGID/fix_rigid_nh.h +++ b/src/RIGID/fix_rigid_nh.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -72,7 +72,7 @@ class FixRigidNH : public FixRigid { int tcomputeflag,pcomputeflag; void couple(); - void remap(); + virtual void remap(); void nhc_temp_integrate(); void nhc_press_integrate(); diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index a0e83da2fd..b924673855 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -87,7 +87,7 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,vb2xm,vb2ym,vb2zm; double edihedral,f1[3],f2[3],f3[3],f4[3]; double sb1,sb2,sb3,rb1,rb3,c0,b1mag2,b1mag,b2mag2; - double b2mag,b3mag2,b3mag,ctmp,r12c1,c1mag,r12c2; + double b2mag,b3mag2,b3mag,ctmp,c_,r12c1,c1mag,r12c2; double c2mag,sc1,sc2,s1,s12,c,p,pd,a11,a22; double a33,a12,a13,a23,sx2,sy2,sz2; double s2,sin2; @@ -201,14 +201,15 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // force & energy // p = sum (i=1,n) a_i * c**(i-1) // pd = dp/dc + c_ = c; p = a[type][0]; pd = a[type][1]; for (int i = 1; i < nterms[type]-1; i++) { - p += c * a[type][i]; - pd += c * static_cast(i+1) * a[type][i+1]; - c *= c; + p += c_ * a[type][i]; + pd += c_ * static_cast(i+1) * a[type][i+1]; + c_ *= c; } - p += c * a[type][nterms[type]-1]; + p += c_ * a[type][nterms[type]-1]; if (EFLAG) edihedral = p; diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 13600a047a..f9ec6a3694 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -179,15 +179,15 @@ void PairTable::compute(int eflag, int vflag) void PairTable::allocate() { allocated = 1; - int nt = atom->ntypes; + const int nt = atom->ntypes + 1; - memory->create(setflag,nt+1,nt+1,"pair:setflag"); - for (int i = 1; i <= nt; i++) - for (int j = i; j <= nt; j++) - setflag[i][j] = 0; + memory->create(setflag,nt,nt,"pair:setflag"); + memory->create(cutsq,nt,nt,"pair:cutsq"); + memory->create(tabindex,nt,nt,"pair:tabindex"); - memory->create(cutsq,nt+1,nt+1,"pair:cutsq"); - memory->create(tabindex,nt+1,nt+1,"pair:tabindex"); + memset(&setflag[0][0],0,nt*nt*sizeof(int)); + memset(&cutsq[0][0],0,nt*nt*sizeof(double)); + memset(&tabindex[0][0],0,nt*nt*sizeof(int)); } /* ---------------------------------------------------------------------- diff --git a/src/special.cpp b/src/special.cpp index 16cab3ee83..4ea1056bfe 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -54,11 +54,9 @@ Special::~Special() void Special::build() { - int i,j,k,m,n,size; + int i,j,k,size; int max,maxall,nbuf; int *buf; - MPI_Request request; - MPI_Status status; MPI_Barrier(world); @@ -637,8 +635,6 @@ void Special::combine() void Special::angle_trim() { int i,j,m,n; - MPI_Request request; - MPI_Status status; int *num_angle = atom->num_angle; int *num_dihedral = atom->num_dihedral; @@ -760,8 +756,6 @@ void Special::angle_trim() void Special::dihedral_trim() { int i,j,m,n; - MPI_Request request; - MPI_Status status; int *num_dihedral = atom->num_dihedral; int **dihedral_atom1 = atom->dihedral_atom1; @@ -826,7 +820,6 @@ void Special::dihedral_trim() // delete 1-4 neighbors if they are not flagged in dflag - int offset; for (i = 0; i < nlocal; i++) { m = 0; for (j = 0; j < nspecial[i][2]; j++) diff --git a/src/write_data.cpp b/src/write_data.cpp index c92d8fb8de..29ad151114 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -286,8 +286,8 @@ void WriteData::atoms() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); double **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my atom data into buf @@ -339,8 +339,8 @@ void WriteData::velocities() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); double **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my velocity data into buf @@ -390,8 +390,8 @@ void WriteData::bonds() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); int **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my bond data into buf @@ -443,8 +443,8 @@ void WriteData::angles() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); int **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my angle data into buf @@ -514,8 +514,8 @@ void WriteData::dihedrals() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); int **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my dihedral data into buf @@ -585,8 +585,8 @@ void WriteData::impropers() MPI_Allreduce(&sendrow,&maxrow,1,MPI_INT,MPI_MAX,world); int **buf; - if (me == 0) memory->create(buf,maxrow,ncol,"write_data:buf"); - else memory->create(buf,sendrow,ncol,"write_data:buf"); + if (me == 0) memory->create(buf,MAX(1,maxrow),ncol,"write_data:buf"); + else memory->create(buf,MAX(1,sendrow),ncol,"write_data:buf"); // pack my improper data into buf