diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index f29b8c0c59..b452be0fa9 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -57,7 +57,7 @@ void PairTersoffMOD::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = fopen(file,"r"); + fp = open_potential(file); if (fp == NULL) { char str[128]; sprintf(str,"Cannot open Tersoff potential file %s",file); diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index bdfc9ea159..291af44d8f 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -460,7 +460,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile) FILE *fp; if (comm->me == 0) { - fp = fopen(globalfile,"r"); + fp = open_potential(globalfile); if (fp == NULL) { char str[128]; sprintf(str,"Cannot open MEAM potential file %s",globalfile); @@ -641,7 +641,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile) // open user param file on proc 0 if (comm->me == 0) { - fp = fopen(userfile,"r"); + fp = open_potential(userfile); if (fp == NULL) { char str[128]; sprintf(str,"Cannot open MEAM potential file %s",userfile); diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 65993c6789..390e21d331 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -105,10 +105,10 @@ void PairLJCharmmCoulCharmm::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - jtype = type[j]; factor_lj = special_lj[sbmask(j)]; factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; + jtype = type[j]; delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index e78b5cd444..060d8c0276 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -546,7 +546,7 @@ int DumpAtomMPIIO::convert_string_omp(int n, double *mybuf) int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) { - MPI_Status mpiStatus; + double *localbuf = mybuf; char **mpifh_buffer_line_per_thread; int mpifhStringCount; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; @@ -581,7 +581,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i][0] = '\0'; -#pragma omp parallel default(none) +#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread) { int tid = omp_get_thread_num(); int m=0; @@ -593,7 +593,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); } - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast (mybuf[bufOffset[tid]+m]),static_cast (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4],static_cast (mybuf[bufOffset[tid]+m+5]),static_cast (mybuf[bufOffset[tid]+m+6]),static_cast (mybuf[bufOffset[tid]+m+7])); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast (localbuf[bufOffset[tid]+m]),static_cast (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4],static_cast (localbuf[bufOffset[tid]+m+5]),static_cast (localbuf[bufOffset[tid]+m+6]),static_cast (localbuf[bufOffset[tid]+m+7])); m += size_one; } } @@ -637,7 +637,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf) { - MPI_Status mpiStatus; + double *localbuf = mybuf; char **mpifh_buffer_line_per_thread; int mpifhStringCount; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; @@ -672,7 +672,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i][0] = '\0'; -#pragma omp parallel default(none) +#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread) { int tid = omp_get_thread_num(); int m=0; @@ -684,7 +684,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf) bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); } - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast (mybuf[bufOffset[tid]+m]),static_cast (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4]); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast (localbuf[bufOffset[tid]+m]),static_cast (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4]); m += size_one; } } diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 7d17f4ed9f..461421253e 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -566,7 +566,7 @@ void DumpCustomMPIIO::write_string(int n, double *mybuf) int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf) { - MPI_Status mpiStatus; + double *localbuf = mybuf; char **mpifh_buffer_line_per_thread; int mpifhStringCount; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; @@ -601,7 +601,7 @@ int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i][0] = '\0'; -#pragma omp parallel default(none) +#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread) { int tid = omp_get_thread_num(); int m=0; @@ -615,11 +615,11 @@ int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf) for (int j = 0; j < size_one; j++) { if (vtype[j] == INT) - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast (mybuf[bufOffset[tid]+m])); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast (localbuf[bufOffset[tid]+m])); else if (vtype[j] == DOUBLE) - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],mybuf[bufOffset[tid]+m]); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],localbuf[bufOffset[tid]+m]); else if (vtype[j] == STRING) - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) mybuf[bufOffset[tid]+m]]); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) localbuf[bufOffset[tid]+m]]); m ++; } mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index 4457260989..fe1f65fc3c 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -308,7 +308,7 @@ void DumpXYZMPIIO::write_string(int n, double *mybuf) int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf) { - MPI_Status mpiStatus; + double *localbuf = mybuf; char **mpifh_buffer_line_per_thread; int mpifhStringCount; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; @@ -343,7 +343,7 @@ int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i][0] = '\0'; -#pragma omp parallel default(none) +#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread) { int tid = omp_get_thread_num(); int m=0; @@ -355,7 +355,7 @@ int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf) bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); } - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,typenames[static_cast (mybuf[bufOffset[tid]+m+1])],mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4]); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,typenames[static_cast (localbuf[bufOffset[tid]+m+1])],localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4]); m += size_one; } diff --git a/src/Package.sh b/src/Package.sh index 839481c1b5..80677665eb 100644 --- a/src/Package.sh +++ b/src/Package.sh @@ -78,9 +78,9 @@ elif (test $2 = "diff") then echo " src/$file does not exist" elif (! cmp -s $file ../$file) then echo "************************************************" - echo "diff $1/$file src/$file " + echo "diff -u $1/$file src/$file " echo "************************************************" - diff $file ../$file + diff -u $file ../$file fi done fi diff --git a/src/Purge.list b/src/Purge.list index 7f53e9c67a..992f1719ae 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -24,6 +24,8 @@ pair_dipole_sf.h pair_dipole_sf.cpp pair_dipole_sf_omp.h pair_dipole_sf_omp.cpp +pair_dipole_sf_gpu.h +pair_dipole_sf_gpu.cpp # deleted on Wed May 8 15:24:36 2013 +0000 compute_spec_atom.cpp compute_spec_atom.h diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 2c6ca9f7b1..8741cf464a 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -649,8 +649,6 @@ void FixShake::find_clusters() tagint tagprev; double massone; tagint *buf; - MPI_Request request; - MPI_Status status; if (me == 0 && screen) fprintf(screen,"Finding SHAKE clusters ...\n"); diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 295337e6f0..5e7af01f6e 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -315,7 +315,8 @@ int FixAppendAtoms::get_spatial() if (domain->boxhi[2] - shockfront_loc < spatlead) advance = 1; - delete [] pos,val; + delete [] pos; + delete [] val; } advance_sum = 0; @@ -453,7 +454,6 @@ void FixAppendAtoms::pre_exchange() double x[3]; double *sublo = domain->sublo; double *subhi = domain->subhi; - double *mass = atom->mass; int i,j,k,m; for (k = klo; k <= khi; k++) { diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index 2092340677..7e873b64d5 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -38,6 +38,7 @@ #include "stdio.h" #include "string.h" #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -288,7 +289,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), int me = ATC::LammpsInterface::instance()->comm_rank(); - string groupName(arg[1]); + std::string groupName(arg[1]); int igroup = group->find(groupName.c_str()); int atomCount = group->count(igroup); diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index 8031bbbf98..abc104cb1f 100755 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -1332,7 +1332,7 @@ void FixLbRigidPCSphere::set_xv() void FixLbRigidPCSphere::pre_neighbor() { - int original,oldimage,newimage; + imageint original,oldimage,newimage; for (int ibody = 0; ibody < nbody; ibody++) { original = imagebody[ibody]; @@ -1355,10 +1355,11 @@ void FixLbRigidPCSphere::pre_neighbor() // adjust image flags of any atom in a rigid body whose xcm was remapped - int *atomimage = atom->image; + imageint *atomimage = atom->image; int nlocal = atom->nlocal; - int ibody,idim,otherdims; + int ibody; + imageint idim,otherdims; for (int i = 0; i < nlocal; i++) { if (body[i] == -1) continue; diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.h b/src/USER-LB/fix_lb_rigid_pc_sphere.h index 069f38c35d..90ed979e28 100755 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.h +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.h @@ -78,7 +78,7 @@ class FixLbRigidPCSphere : public Fix { double **torque_fluid; double **torque_fluid_old; double **rotate; - int *imagebody; // image flags of xcm of each rigid body + imageint *imagebody; // image flags of xcm of each rigid body double **fflag; // flag for on/off of center-of-mass force double **tflag; // flag for on/off of center-of-mass torque diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index ee4c014b10..2941293be7 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -303,7 +303,6 @@ double AngleCosineShiftExp::single(int type, int i1, int i2, int i3) double s=sqrt(1.0-c*c); double cccpsss=c*cost[type]+s*sint[type]; - double cssmscc=c*sint[type]-s*cost[type]; if (doExpansion[type]) { diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 7d587ddb27..a0a23777e5 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -52,7 +52,7 @@ char Read_Force_Field( char *ffield_file, reax_interaction *reax, /* open force field file */ if ( (fp = fopen( ffield_file, "r" ) ) == NULL ) { - fprintf( stderr, "error opening the force filed file! terminating...\n" ); + fprintf( stderr, "error opening the force field file! terminating...\n" ); MPI_Abort( comm, FILE_NOT_FOUND ); } diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index bee7bb6efe..5f18a9800c 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -388,7 +388,7 @@ int Allocate_Tokenizer_Space( char **line, char **backup, char ***tokens ) int Tokenize( char* s, char*** tok ) { char test[MAX_LINE]; - char *sep = "\t \n!="; + const char *sep = (const char *)"\t \n!="; char *word; int count=0; @@ -405,7 +405,7 @@ int Tokenize( char* s, char*** tok ) /***************** taken from lammps ************************/ /* safe malloc */ -void *smalloc( long n, char *name, MPI_Comm comm ) +void *smalloc( long n, const char *name, MPI_Comm comm ) { void *ptr; @@ -428,7 +428,7 @@ void *smalloc( long n, char *name, MPI_Comm comm ) /* safe calloc */ -void *scalloc( int n, int size, char *name, MPI_Comm comm ) +void *scalloc( int n, int size, const char *name, MPI_Comm comm ) { void *ptr; @@ -458,7 +458,7 @@ void *scalloc( int n, int size, char *name, MPI_Comm comm ) /* safe free */ -void sfree( void *ptr, char *name ) +void sfree( void *ptr, const char *name ) { if( ptr == NULL ) { fprintf( stderr, "WARNING: trying to free the already NULL pointer %s!\n", diff --git a/src/USER-REAXC/reaxc_tool_box.h b/src/USER-REAXC/reaxc_tool_box.h index b9e1f4a8db..2ef27dd6da 100644 --- a/src/USER-REAXC/reaxc_tool_box.h +++ b/src/USER-REAXC/reaxc_tool_box.h @@ -67,8 +67,8 @@ int Allocate_Tokenizer_Space( char**, char**, char*** ); int Tokenize( char*, char*** ); /* from lammps */ -void *smalloc( long, char*, MPI_Comm ); -void *scalloc( int, int, char*, MPI_Comm ); -void sfree( void*, char* ); +void *smalloc( long, const char*, MPI_Comm ); +void *scalloc( int, int, const char*, MPI_Comm ); +void sfree( void*, const char* ); #endif diff --git a/src/balance.cpp b/src/balance.cpp index b315a4454b..e1bcf36924 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -721,116 +721,6 @@ int Balance::adjust(int n, double *split) return change; } -/* ---------------------------------------------------------------------- - OLD code: for local diffusion method that didn't work as well as RCB - adjust cuts between N slices in a dim via diffusive method - count = atoms per slice - split = current N+1 cuts, with 0.0 and 1.0 at end points - overwrite split with new cuts - diffusion means slices with more atoms than their neighbors "send" atoms, - by moving cut closer to sender, further from receiver -------------------------------------------------------------------------- */ - -void Balance::old_adjust(int iter, int n, bigint *count, double *split) -{ - // need to allocate this if start using it again - - double *cuts; - - // damping factor - - double damp = 0.5; - - // loop over slices - // cut I is between 2 slices (I-1 and I) with counts - // cut I+1 is between 2 slices (I and I+1) with counts - // for a cut between 2 slices, only slice with larger count adjusts it - // special treatment of end slices with only 1 neighbor - - bigint leftcount,mycount,rightcount; - double rho,target,targetleft,targetright; - - for (int i = 0; i < n; i++) { - if (i == 0) leftcount = MAXBIGINT; - else leftcount = count[i-1]; - mycount = count[i]; - if (i == n-1) rightcount = MAXBIGINT; - else rightcount = count[i+1]; - - // middle slice is <= both left and right, so do nothing - // special case if 2 slices both have count = 0 -> no change in cut - - if (mycount <= leftcount && mycount <= rightcount) { - if (leftcount == 0) cuts[i] = split[i]; - if (rightcount == 0) cuts[i+1] = split[i+1]; - continue; - } - - // rho = density of atoms in the slice - - rho = mycount / (split[i+1] - split[i]); - - // middle slice has more atoms than left or right slice - // send atoms in that dir - - if (mycount > leftcount) { - target = damp * 0.5*(mycount-leftcount); - cuts[i] = split[i] + target/rho; - } - if (mycount > rightcount) { - target = damp * 0.5*(mycount-rightcount); - cuts[i+1] = split[i+1] - target/rho; - } - - /* - // middle slice has more atoms then left or right slice - // if delta from middle to top slice > delta between top and bottom slice - // then send atoms both dirs to bring all 3 slices to same count - // else bottom slice is very low, so send atoms only in that dir - - if (mycount > leftcount && mycount > rightcount) { - if (mycount-MAX(leftcount,rightcount) >= fabs(leftcount-rightcount)) { - if (leftcount <= rightcount) { - targetleft = damp * - (rightcount-leftcount + (mycount-rightcount)/3.0); - targetright = damp * (mycount-rightcount)/3.0; - cuts[i] = split[i] + targetleft/rho; - cuts[i+1] = split[i+1] - targetright/rho; - } else { - targetleft = damp * (mycount-leftcount)/3.0; - targetright = damp * - (leftcount-rightcount + (mycount-leftcount)/3.0); - cuts[i] = split[i] + targetleft/rho; - cuts[i+1] = split[i+1] - targetright/rho; - } - } else if (leftcount < rightcount) { - target = damp * 0.5*(mycount-leftcount); - cuts[i] = split[i] + target/rho; - cuts[i+1] = split[i+1]; - } else if (rightcount < leftcount) { - target = damp * 0.5*(mycount-rightcount); - cuts[i+1] = split[i+1] - target/rho; - cuts[i] = split[i]; - } - - // middle slice has more atoms than only left or right slice - // send atoms only in that dir - - } else if (mycount > leftcount) { - target = damp * 0.5*(mycount-leftcount); - cuts[i] = split[i] + target/rho; - } else if (mycount > rightcount) { - target = damp * 0.5*(mycount-rightcount); - cuts[i+1] = split[i+1] - target/rho; - } - */ - } - - // overwrite adjustable splits with new cuts - - for (int i = 1; i < n; i++) split[i] = cuts[i]; -} - /* ---------------------------------------------------------------------- binary search for where value falls in N-length vec note that vec actually has N+1 values, but ignore last one diff --git a/src/balance.h b/src/balance.h index fda682cc98..ee1d171546 100644 --- a/src/balance.h +++ b/src/balance.h @@ -68,7 +68,6 @@ class Balance : protected Pointers { double imbalance_splits(int &); void tally(int, int, double *); int adjust(int, double *); - void old_adjust(int, int, bigint *, double *); int binary(double, int, double *); void debug_output(int, int, int, double *); }; diff --git a/src/body.h b/src/body.h index 606615e56e..4e36a86155 100644 --- a/src/body.h +++ b/src/body.h @@ -35,10 +35,10 @@ class Body : protected Pointers { // methods implemented by child classes - virtual int pack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int unpack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int pack_border_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int unpack_border_body(class AtomVecBody::Bonus *, + virtual int pack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int unpack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int pack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int unpack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} virtual void data_body(int, int, int, char **, char **) = 0; diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index a6f05dcfcf..558512ace7 100755 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -273,9 +273,9 @@ void DumpCFG::write_lines(int n, double *mybuf) for (i = 0; i < n; i++) { for (j = 0; j < size_one; j++) { if (j == 0) { - fprintf(fp,"%f \n",mybuf[m]); + fprintf(fp,"%f \n",mybuf[m]); } else if (j == 1) { - fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); + fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2) { if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast (mybuf[m])); @@ -296,9 +296,9 @@ void DumpCFG::write_lines(int n, double *mybuf) for (i = 0; i < n; i++) { for (j = 0; j < size_one; j++) { if (j == 0) { - fprintf(fp,"%f \n",mybuf[m]); + fprintf(fp,"%f \n",mybuf[m]); } else if (j == 1) { - fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); + fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2 && j <= 4) { unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; fprintf(fp,vformat[j],unwrap_coord); diff --git a/src/dump_dcd.h b/src/dump_dcd.h index 47b6afe0be..c04c760a01 100644 --- a/src/dump_dcd.h +++ b/src/dump_dcd.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpDCD : public Dump { public: DumpDCD(LAMMPS *, int, char**); - ~DumpDCD(); + virtual ~DumpDCD(); private: int natoms,ntotal; diff --git a/src/dump_local.h b/src/dump_local.h index dec5e27834..3e06906e9a 100644 --- a/src/dump_local.h +++ b/src/dump_local.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpLocal : public Dump { public: DumpLocal(LAMMPS *, int, char **); - ~DumpLocal(); + virtual ~DumpLocal(); private: int nevery; // dump frequency to check Fix against diff --git a/src/dump_xyz.h b/src/dump_xyz.h index 879b46e051..17503d53f1 100644 --- a/src/dump_xyz.h +++ b/src/dump_xyz.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class DumpXYZ : public Dump { public: DumpXYZ(class LAMMPS *, int, char**); - ~DumpXYZ(); + virtual ~DumpXYZ(); protected: int ntypes; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 2f1793dfba..3f04cb8254 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -200,8 +200,16 @@ void FixAdapt::init() if (ad->which == PAIR) { anypair = 1; + Pair *pair = NULL; - Pair *pair = force->pair_match(ad->pstyle,1); + if (lmp->suffix_enable) { + char psuffix[128]; + strcpy(psuffix,ad->pstyle); + strcat(psuffix,"/"); + strcat(psuffix,lmp->suffix); + pair = force->pair_match(psuffix,1); + } + if (pair == NULL) pair = force->pair_match(ad->pstyle,1); if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); if (ptr == NULL) diff --git a/src/fix_wall_harmonic.h b/src/fix_wall_harmonic.h index d8d7b309d6..b9efea7400 100644 --- a/src/fix_wall_harmonic.h +++ b/src/fix_wall_harmonic.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 @@ -29,9 +29,6 @@ class FixWallHarmonic : public FixWall { FixWallHarmonic(class LAMMPS *, int, char **); void precompute(int) {} void wall_particle(int, int, double); - - private: - double offset[6]; }; } diff --git a/src/lmpwindows.h b/src/lmpwindows.h index 9d3cbc6151..50f64eafb2 100644 --- a/src/lmpwindows.h +++ b/src/lmpwindows.h @@ -37,9 +37,16 @@ inline double trunc(double x) { } // Windows version of mkdir function does not have permission flags +#ifndef S_IRWXU # define S_IRWXU 0 +#endif +#ifndef S_IRGRP # define S_IRGRP 0 +#endif +#ifndef S_IXGRP # define S_IXGRP 0 +#endif inline int mkdir(const char *path, int){ return _mkdir(path); } + diff --git a/src/main.cpp b/src/main.cpp index 471be9aa46..fd8a4ebe3f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,8 +27,10 @@ int main(int argc, char **argv) MPI_Init(&argc,&argv); LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD); + lammps->input->file(); delete lammps; + MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); } diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 3a05f7e85b..731278a87e 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -320,7 +320,9 @@ void Neighbor::init() special_flag[3] = 1; else special_flag[3] = 2; - if (force->kspace) special_flag[1] = special_flag[2] = special_flag[3] = 2; + if (force->kspace || force->pair_match("coul/wolf",0) + || force->pair_match("coul/dsf",0)) + special_flag[1] = special_flag[2] = special_flag[3] = 2; // maxwt = max multiplicative factor on atom indices stored in neigh list diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index fc2feeaa56..4ecaa88340 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -37,6 +37,7 @@ using namespace MathConst; PairBornCoulWolf::PairBornCoulWolf(LAMMPS *lmp) : Pair(lmp) { writedata = 1; + single_enable = 0; } /* ---------------------------------------------------------------------- */ diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 12c3f58ea5..09550cae11 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -43,7 +43,10 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp) {} +PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 0; +} /* ---------------------------------------------------------------------- */ @@ -59,7 +62,7 @@ PairCoulDSF::~PairCoulDSF() void PairCoulDSF::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j,ii,jj,inum,jnum; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair; double r,rsq,r2inv,forcecoul,factor_coul; double prefactor,erfcc,erfcd,e_self,t; @@ -72,7 +75,6 @@ void PairCoulDSF::compute(int eflag, int vflag) double **x = atom->x; double **f = atom->f; double *q = atom->q; - int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; int newton_pair = force->newton_pair; @@ -91,11 +93,10 @@ void PairCoulDSF::compute(int eflag, int vflag) xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; - itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; - if (evflag) { + if (eflag) { e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); } @@ -109,20 +110,17 @@ void PairCoulDSF::compute(int eflag, int vflag) dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - jtype = type[j]; - if (rsq < cutsq[itype][jtype]) { + if (rsq < cut_coulsq) { r2inv = 1.0/rsq; - if (rsq < cut_coulsq) { - r = sqrt(rsq); - prefactor = factor_coul * qqrd2e*qtmp*q[j]/r; - erfcd = exp(-alpha*alpha*rsq); - t = 1.0 / (1.0 + EWALD_P*alpha*r); - erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + - r*f_shift) * r; - } + r = sqrt(rsq); + prefactor = factor_coul * qqrd2e*qtmp*q[j]/r; + erfcd = exp(-alpha*alpha*rsq); + t = 1.0 / (1.0 + EWALD_P*alpha*r); + erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + r*f_shift) * r; fpair = forcecoul * r2inv; f[i][0] += delx*fpair; @@ -135,10 +133,8 @@ void PairCoulDSF::compute(int eflag, int vflag) } if (eflag) { - if (rsq < cut_coulsq) { - ecoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); - } else ecoul = 0.0; - } + ecoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); + } else ecoul = 0.0; if (evflag) ev_tally(i,j,nlocal,newton_pair, 0.0,ecoul,fpair,delx,dely,delz); diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index 5c6b32013c..973d1e2c2d 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -34,7 +34,10 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairCoulWolf::PairCoulWolf(LAMMPS *lmp) : Pair(lmp) {} +PairCoulWolf::PairCoulWolf(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 0; +} /* ---------------------------------------------------------------------- */ diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 63ec7b002b..a18e9ccf6b 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -43,7 +43,10 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp) {} +PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 0; +} /* ---------------------------------------------------------------------- */ @@ -72,7 +75,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) int i,j,ii,jj,inum,jnum,itype,jtype; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; double r,rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj; - double prefactor,erfcc,erfcd,e_self,t; + double prefactor,erfcc,erfcd,t; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; @@ -84,8 +87,8 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) double *q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; - double *special_coul = force->special_coul; double *special_lj = force->special_lj; + double *special_coul = force->special_coul; int newton_pair = force->newton_pair; double qqrd2e = force->qqrd2e; @@ -106,8 +109,8 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) jlist = firstneigh[i]; jnum = numneigh[i]; - if (evflag) { - e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; + if (eflag) { + double e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); } @@ -139,7 +142,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; - } + } else forcecoul = 0.0; fpair = (forcecoul + factor_lj*forcelj) * r2inv; f[i][0] += delx*fpair;