From 8e36364f5ceaa166915ce553aa6b4f8e201fbab8 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 7 Apr 2016 21:04:44 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14805 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/ASPHERE/pair_line_lj.cpp | 4 +- src/DEPEND/fastdep.c | 85 ++++++--- src/GRANULAR/pair_gran_hertz_history.cpp | 2 - src/GRANULAR/pair_gran_hooke.cpp | 2 - src/GRANULAR/pair_gran_hooke_history.cpp | 2 - src/KOKKOS/Install.sh | 8 + src/KOKKOS/fix_nh_kokkos.cpp | 1 - src/MANYBODY/pair_airebo.cpp | 1 - src/MANYBODY/pair_bop.cpp | 8 +- src/MANYBODY/pair_eim.cpp | 54 +++--- src/MANYBODY/pair_polymorphic.cpp | 2 + src/MEAM/pair_meam.cpp | 2 +- src/Make.py | 216 ++++++++++++++++++----- src/Makefile | 4 +- src/QEQ/fix_qeq_fire.cpp | 9 +- src/REPLICA/temper.cpp | 31 +++- src/STUBS/Makefile.mingw32-cross | 2 +- src/STUBS/Makefile.mingw64-cross | 2 +- src/USER-OMP/pair_airebo_omp.cpp | 1 - src/compute_chunk_atom.cpp | 2 +- src/domain.cpp | 13 +- src/dump_image.cpp | 1 - src/fix_ave_time.cpp | 3 +- src/math_const.h | 1 + src/read_data.cpp | 2 +- src/set.cpp | 1 - 26 files changed, 314 insertions(+), 145 deletions(-) diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 737aefa18d..aa3493ef47 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -69,11 +69,11 @@ PairLineLJ::~PairLineLJ() void PairLineLJ::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype,tmp; + int i,j,ii,jj,inum,jnum,itype,jtype; int ni,nj,npi,npj,ifirst,jfirst; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; double rsq,r2inv,r6inv,term1,term2,sig,sig3,forcelj; - double xi[2],xj[2],fi[2],fj[2],dxi,dxj,dyi,dyj; + double xi[2],xj[2],fi[2],dxi,dxj,dyi,dyj; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; diff --git a/src/DEPEND/fastdep.c b/src/DEPEND/fastdep.c index 5400e03034..2f4927abce 100644 --- a/src/DEPEND/fastdep.c +++ b/src/DEPEND/fastdep.c @@ -33,7 +33,24 @@ #include #include -const char version[] = "2.0"; +const char version[] = "2.1"; + +/* store list of accepted extensions for object targets */ +static const char *extensions[] = { ".cpp", ".c", ".cu" }; +static const int numextensions = sizeof(extensions)/sizeof(const char *); + +/* strdup() is not part of ANSI C. provide a replacement for portability */ +static char *my_strdup(const char *src) +{ + int len; + char *ptr; + + if (src == NULL) return NULL; + len = strlen(src); + ptr = (char *)malloc(len+1); + if (ptr) memcpy(ptr,src,len+1); + return ptr; +} /************************************************************************ * utility functions @@ -198,7 +215,7 @@ static void llist_append(llist_t *ll, const char *key) llnode_t *tmp; if ((ll == NULL) || (key == NULL)) return; - ll->tail->key = strdup(key); + ll->tail->key = my_strdup(key); ll->count ++; tmp = (llnode_t *)malloc(sizeof(llnode_t)); tmp->key = NULL; @@ -286,7 +303,7 @@ static void set_add(set_t *s, const char *key) tmp = tmp->next; } s->count ++; - tmp->key = strdup(key); + tmp->key = my_strdup(key); tmp->next = (llnode_t *)malloc(sizeof(llnode_t)); tmp = tmp->next; tmp->key = NULL; @@ -375,7 +392,7 @@ static void map_add(map_t *m, const char *key, const char *val) /* add new entry to map */ if (tmp->next == NULL) { m->count ++; - tmp->key = strdup(key); + tmp->key = my_strdup(key); tmp->val = set_init(50); /* XXX: chosen arbitrarily */ tmp->next = (mapnode_t *)malloc(sizeof(mapnode_t)); tmp->next->key = NULL; @@ -547,42 +564,52 @@ static void do_depend(llnode_t *head, map_t *deps) set_t *incl; const char *source; char *target, *ptr; - int i,num; + int i,num,ext; tmp = head; while (tmp->next != NULL) { source = tmp->key; target = strrchr(source,'/'); if (target == NULL) { - target = strdup(source); + target = my_strdup(source); } else { - target = strdup(target+1); + target = my_strdup(target+1); } + ext = 0; ptr = strrchr(target,'.'); if (ptr != NULL) { - ptr[1] = 'o'; - ptr[2] = '\0'; - } - fputs(target,stdout); - fputs(" : ",stdout); - fputs(source,stdout); - free((void *)target); - - incl = set_init(50); - add_depend(source,incl,deps); - - num = incl->nbuckets; - for (i = 0; i < num; ++i) { - lnk = incl->buckets + i; - while (lnk->next != NULL) { - fputc(' ',stdout); - fputs(lnk->key,stdout); - lnk = lnk->next; + for (i = 0; i < numextensions; ++i) { + if (strcmp(ptr,extensions[i]) == 0) ++ext; + } + if (ext > 0) { + ptr[1] = 'o'; + ptr[2] = '\0'; } } - fputc('\n',stdout); - set_free(incl); + + if (ext > 0) { + fputs(target,stdout); + fputs(" : ",stdout); + fputs(source,stdout); + + incl = set_init(50); + add_depend(source,incl,deps); + + num = incl->nbuckets; + for (i = 0; i < num; ++i) { + lnk = incl->buckets + i; + while (lnk->next != NULL) { + fputc(' ',stdout); + fputs(lnk->key,stdout); + lnk = lnk->next; + } + } + fputc('\n',stdout); + set_free(incl); + } + + free((void *)target); tmp = tmp->next; } } @@ -601,6 +628,8 @@ int main(int argc, char **argv) fprintf(stderr,"FastDep v%s for LAMMPS\n" "Usage: %s [-I ...] -- [ ...]\n", version,argv[0]); + fprintf(stderr,"Supported extensions: %d, %s, %s\n",numextensions, + extensions[0], extensions[1]); return 1; } @@ -631,7 +660,7 @@ int main(int argc, char **argv) } } else if (strcmp(*argv,"--") == 0) { break; - } // ignore all unrecognized arguments before '--'. + } /* ignore all unrecognized arguments before '--'. */ } src = llist_init(); diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index b32f136726..e14dc7110f 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -87,7 +87,6 @@ void PairGranHertzHistory::compute(int eflag, int vflag) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -367,7 +366,6 @@ double PairGranHertzHistory::single(int i, int j, int itype, int jtype, // if I or J is frozen, meff is other particle double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; mi = rmass[i]; diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index b5305c309d..9ff23a7553 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -81,7 +81,6 @@ void PairGranHooke::compute(int eflag, int vflag) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -285,7 +284,6 @@ double PairGranHooke::single(int i, int j, int itype, int jtype, double rsq, // if I or J is frozen, meff is other particle double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; mi = rmass[i]; diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index c5cca38290..b8b0381d58 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -129,7 +129,6 @@ void PairGranHookeHistory::compute(int eflag, int vflag) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -670,7 +669,6 @@ double PairGranHookeHistory::single(int i, int j, int itype, int jtype, // if I or J is frozen, meff is other particle double *rmass = atom->rmass; - int *type = atom->type; int *mask = atom->mask; mi = rmass[i]; diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index ad450592be..af77bcd206 100644 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -189,6 +189,14 @@ if (test $1 = 1) then sed -i -e '5 i \include ..\/..\/lib\/kokkos\/Makefile.kokkos' ../Makefile.package.settings fi + # comb/omp triggers a persistent bug in nvcc. deleting it. + rm -f ../*_comb_omp.* + +elif (test $1 = 2) then + + # comb/omp triggers a persistent bug in nvcc. deleting it. + rm -f ../*_comb_omp.* + elif (test $1 = 0) then if (test -e ../Makefile.package) then diff --git a/src/KOKKOS/fix_nh_kokkos.cpp b/src/KOKKOS/fix_nh_kokkos.cpp index 28b7ff55b6..8cc06fc52c 100755 --- a/src/KOKKOS/fix_nh_kokkos.cpp +++ b/src/KOKKOS/fix_nh_kokkos.cpp @@ -291,7 +291,6 @@ void FixNHKokkos::final_integrate() template void FixNHKokkos::remap() { - int i; double oldlo,oldhi; double expfac; diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 076848ddf0..12f39bf931 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -2251,7 +2251,6 @@ double PairAIREBO::bondorderLJ(int i, int j, double rij[3], double rijmag, ril[1] = rij[1]+rjl[1]; ril[2] = rij[2]+rjl[2]; ril2 = (ril[0]*ril[0])+(ril[1]*ril[1])+(ril[2]*ril[2]); - rijrjl = 2.0*rijmag*rjlmag; rjl2 = rjlmag*rjlmag; costmp = 0.5*(rij2+rjl2-ril2)/rijmag/rjlmag; tspijl = Sp2(costmp,thmin,thmax,dtsijl); diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 037f893ea5..219acc50af 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -993,7 +993,6 @@ void PairBOP::theta() int *ilist; int *iilist; int **firstneigh; - int maxn,maxt; double rj2,rk2,rsq,ps; double rj1k1,rj2k2; double **x = atom->x; @@ -1015,8 +1014,6 @@ void PairBOP::theta() itype = map[type[i]]+1; iilist=firstneigh[i]; - maxt=0; - maxn=0; nlisti=BOP_total[i]; for(jj=0;jjmaxn) maxn=maxt; } for (ii = 0; ii < nall; ii++) { n=0; diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index c25f3d92e6..a2807eb78c 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -921,13 +921,13 @@ int PairEIM::grabsingle(FILE *fptr, int i) pch1 = strstr(pch1,"element:"); if (pch1 != NULL) { pch2 = strtok(NULL, " \t\n\r\f"); - if (pch2 != NULL) data = strtok (NULL, "?"); - if (strcmp(pch2,elements[i]) == 0) { - sscanf(data,"%d %lg %lg %lg %lg %lg %lg",&setfl->ielement[i], - &setfl->mass[i],&setfl->negativity[i],&setfl->ra[i], - &setfl->ri[i],&setfl->Ec[i],&setfl->q0[i]); - } else { - pch2 = NULL; + if (pch2 != NULL) { + data = strtok (NULL, "?"); + if (strcmp(pch2,elements[i]) == 0) { + sscanf(data,"%d %lg %lg %lg %lg %lg %lg",&setfl->ielement[i], + &setfl->mass[i],&setfl->negativity[i],&setfl->ra[i], + &setfl->ri[i],&setfl->Ec[i],&setfl->q0[i]); + } else pch2 = NULL; } } } @@ -960,25 +960,27 @@ int PairEIM::grabpair(FILE *fptr, int i, int j) pch2 = strtok (NULL, " \t\n\r\f"); if (pch2 != NULL) pch3 = strtok (NULL, " \t\n\r\f"); if (pch3 != NULL) data = strtok (NULL, "?"); - if ((strcmp(pch2,elements[i]) == 0 && - strcmp(pch3,elements[j]) == 0) || - (strcmp(pch2,elements[j]) == 0 && - strcmp(pch3,elements[i]) == 0)) { - sscanf(data,"%lg %lg %lg %lg %lg", - &setfl->rcutphiA[ij],&setfl->rcutphiR[ij], - &setfl->Eb[ij],&setfl->r0[ij],&setfl->alpha[ij]); - fgets(line,MAXLINE,fptr); - sscanf(line,"%lg %lg %lg %lg %lg", - &setfl->beta[ij],&setfl->rcutq[ij],&setfl->Asigma[ij], - &setfl->rq[ij],&setfl->rcutsigma[ij]); - fgets(line,MAXLINE,fptr); - sscanf(line,"%lg %lg %lg %d", - &setfl->Ac[ij],&setfl->zeta[ij],&setfl->rs[ij], - &setfl->tp[ij]); - } else { - pch1 = NULL; - pch2 = NULL; - pch3 = NULL; + if ((pch2 != NULL) && (pch3 != NULL)) { + if ((strcmp(pch2,elements[i]) == 0 && + strcmp(pch3,elements[j]) == 0) || + (strcmp(pch2,elements[j]) == 0 && + strcmp(pch3,elements[i]) == 0)) { + sscanf(data,"%lg %lg %lg %lg %lg", + &setfl->rcutphiA[ij],&setfl->rcutphiR[ij], + &setfl->Eb[ij],&setfl->r0[ij],&setfl->alpha[ij]); + fgets(line,MAXLINE,fptr); + sscanf(line,"%lg %lg %lg %lg %lg", + &setfl->beta[ij],&setfl->rcutq[ij],&setfl->Asigma[ij], + &setfl->rq[ij],&setfl->rcutsigma[ij]); + fgets(line,MAXLINE,fptr); + sscanf(line,"%lg %lg %lg %d", + &setfl->Ac[ij],&setfl->zeta[ij],&setfl->rs[ij], + &setfl->tp[ij]); + } else { + pch1 = NULL; + pch2 = NULL; + pch3 = NULL; + } } } } diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index ad53789737..2429dd0638 100755 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -631,6 +631,8 @@ void PairPolymorphic::read_file(char *file) if (ptr) maxX = atof(ptr); if (ptr == NULL) error->all(FLERR,"Potential file incompatible with this pair style version"); + if ((ng == 0) || (nr == 0) || (nx == 0)) + error->all(FLERR,"Error reading potential file header"); npair = nelements*(nelements+1)/2; ntriple = nelements*nelements*nelements; diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index a350c66a96..2d14ffa0cf 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -555,7 +555,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile) for (i = 0; i < nelements; i++) if (strcmp(words[0],elements[i]) == 0) break; - if (i == nelements) continue; + if (i >= nelements) continue; // skip if element already appeared diff --git a/src/Make.py b/src/Make.py index d8be53f13b..6ab41af99a 100755 --- a/src/Make.py +++ b/src/Make.py @@ -15,14 +15,14 @@ import sys,os,commands,re,copy,subprocess # setargs = makefile settings # actionargs = allowed actions (also lib-dir and machine) -abbrevs = "adhjmoprsv" +abbrevs = "adhjmoprsvz" switchclasses = ("actions","dir","help","jmake","makefile", - "output","packages","redo","settings","verbose") + "output","packages","redo","settings","verbose","zoutput") libclasses = ("atc","awpmd","colvars","cuda","gpu","h5md", "meam","poems","python","qmmm","reax","voronoi") buildclasses = ("intel","kokkos") -makeclasses = ("cc","mpi","fft","jpg","png") +makeclasses = ("cc","flags","mpi","fft","jpg","png") setargs = ("gzip","#gzip","ffmpeg","#ffmpeg","smallbig","bigbig","smallsmall") actionargs = ("lib-all","file","clean","exe") @@ -137,27 +137,37 @@ class Actions: lib-all builds all auxiliary libs needed by installed packages lib-dir builds a specific lib whether package installed or not dir is any dir in lib directory (atc, cuda, meam, etc) except linalg - (2) file = create src/MAKE/MINE/Makefile.auto - use -m switch for Makefile.machine to start from, - else use existing Makefile.auto - adds settings needed for installed accelerator packages - existing Makefile.auto is NOT changed unless "file" action is specified + (2) file = create a new src/MAKE/MINE/Makefile.auto + if file not specified, existing Makefile.auto is NOT changed + except by -m switch, which will copy Makefile.machine to Makefile.auto + note that exe action can add an -m switch, as described below + if file is specified, new Makefile.auto is created + if "-m machine" specified (or added by exe), + start with existing Makefile.machine, else existing Makefile.auto + if "-m none" specified, start Makefile.auto from scratch + must use -cc and -mpi switches to specify compiler and MPI + settings for these switches will alter Makefile.auto + -s, -intel, -kokkos, -cc, -mpi, -fft, -jpg, -png + if these accelerator packages are installed, they induce settings + that will alter Makefile.auto: opt, user-omp, user-intel, kokkos + use -z switch to copy final Makefile.auto to new filename (3) clean = invoke "make clean-auto" to insure clean build on current files useful if compiler flags have changed (4) exe or machine = build LAMMPS machine can be any existing Makefile.machine suffix - machine is converted to "exe" action, as well as: + machine is converted to "exe" action, and additionally: "-m machine" is added if -m switch is not specified "-o machine" is added if -o switch is not specified if either "-m" or "-o" are specified, they are not overridden does not invoke any lib builds, since libs could be previously built - exe always builds using src/MAKE/MINE/Makefile.auto - if file action also specified, it creates Makefile.auto + exe ALWAYS builds using src/MAKE/MINE/Makefile.auto + if file action also specified, it creates a new Makefile.auto else if -m switch specified, existing Makefile.machine is copied to create Makefile.auto else Makefile.auto must already exist and is not changed - produces src/lmp_auto, or error message if unsuccessful + build produces src/lmp_auto, or error message if unsuccessful use -o switch to copy src/lmp_auto to new filename + use -z switch to copy src/MAKE/MINE/Makefile.auto to new filename """ def check(self): @@ -177,7 +187,7 @@ class Actions: cleans.append(one) elif one == "exe": exes.append(one) - # one action can be unknown in case is a machine (checked in setup) + # one action can be unknown, must be a machine (checked in setup) else: exes.append(one) if len(set(libs)) != len(libs) or \ @@ -236,9 +246,9 @@ class Actions: def file(self,caller): - # if caller = "file", create from mpi or read from makefile.machine or auto - # if caller = "exe" and "file" action already invoked, read from auto - # if caller = "exe" and no "file" action, read from makefile.machine or auto + # if caller="file", create from mpi or read from Makefile.machine or auto + # if caller="exe" and "file" action already invoked, read from auto + # if caller="exe" and no "file" action, read from Makefile.machine or auto if caller == "file": if makefile and makefile.machine == "none": @@ -279,7 +289,7 @@ class Actions: make.addvar("CC","-cxx=%s" % wrapper) make.addvar("LINK","-cxx=%s" % wrapper) elif "-lmpi" in txt: - make.addvar("OMPI_CXX",wrapper,"cc") + make.addvar("export OMPI_CXX",wrapper,"cc") precompiler = "env OMPI_CXX=%s " % wrapper else: error("Could not add MPI wrapper compiler, " + "did not recognize OpenMPI or MPICH") @@ -287,8 +297,20 @@ class Actions: make.addvar("CCFLAGS","-O3") make.setvar("LINKFLAGS","-g") make.addvar("LINKFLAGS","-O") + + # add CC and LINK flags -# add MPI settings + if flags: + for flag in flags.CC: + flag = "-" + flag + if flag[:2] == "-O": make.delvar("CCFLAGS","-O*") + make.addvar("CCFLAGS",flag) + for flag in flags.LINK: + flag = "-" + flag + if flag[:2] == "-O": make.delvar("LINKFLAGS","-O*") + make.addvar("LINKFLAGS",flag) + + # add MPI settings if mpi: make.delvar("MPI_INC","*") @@ -397,7 +419,7 @@ class Actions: make.addvar("KOKKOS_DEVICES","OpenMP","lmp") make.addvar("KOKKOS_ARCH","KNC","lmp") - # add LMP settings + # add LMP_INC ifdef settings if settings: list = settings.inlist @@ -465,12 +487,13 @@ class Actions: # set self.stubs if Makefile.auto uses STUBS lib in MPI settings - if "-lmpi_stubs" in make.getvar("MPI_LIB"): self.stubs = 1 + if make.getvar("MPI_LIB") and "-lmpi_stubs" in make.getvar("MPI_LIB"): + self.stubs = 1 else: self.stubs = 0 # write out Makefile.auto # unless caller = "exe" and "file" action already invoked - + if caller == "file" or "file" not in self.alist: make.write("%s/MAKE/MINE/Makefile.auto" % dir.src,1) print "Created src/MAKE/MINE/Makefile.auto" @@ -510,13 +533,23 @@ class Actions: print txt error('Unsuccessful "make stubs"') print "Created src/STUBS/libmpi_stubs.a" - if jmake: str = "cd %s; make -j %d auto" % (dir.src,jmake.n) - else: str = "cd %s; make auto" % dir.src + + # special hack for shannon GPU cluster + # must use "srun make" if on it and building w/ GPU package, else just make + # this is b/c Cuda libs are not all available on host + + make = "make" + if "shannon" in os.environ.get("HOST") and packages.final["gpu"]: + make = "srun make" + + if jmake: str = "cd %s; %s -j %d auto" % (dir.src,make,jmake.n) + else: str = "cd %s; %s auto" % (dir.src,make) # if verbose, print output as build proceeds, else only print if fails if verbose: subprocess.call(str,shell=True) else: + print str try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True) except Exception as e: print e.output @@ -574,8 +607,8 @@ Syntax: Make.py switch args ... list one or more actions, in any order machine is a Makefile.machine suffix one-letter switches: - -d (dir), -j (jmake), -m (makefile), -o (output), - -p (packages), -r (redo), -s (settings), -v (verbose) + -d (dir), -j (jmake), -m (makefile), -o (output), -p (packages), + -r (redo), -s (settings), -v (verbose), -z (makefile output) switches for libs: -atc, -awpmd, -colvars, -cuda, -gpu, -h5md, -meam, -poems, -python, -qmmm, -reax, -voronoi @@ -898,9 +931,13 @@ class Settings: def help(self): return """ -s set1 set2 ... - possible settings = gzip smallbig bigbig smallsmall - add each setting as LAMMPS setting to created Makefile.auto - if -s not specified, no settings are changed in Makefile.auto + possible settings = gzip #gzip ffmpeg #ffmpeg smallbig bigbig smallsmall + alter LAMMPS ifdef settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action + gzip and #gzip turn on/off LAMMPS_GZIP setting + ffmpeg and #ffmpeg turn on/off LAMMPS_FFMPEG setting + smallbig, bigbig, smallsmall turn on LAMMPS_SMALLBIG, etc + and turn off other two """ def check(self): @@ -924,6 +961,23 @@ class Verbose: def check(self): if len(self.inlist): error("-v args are invalid") +# zoutput switch for making copy of final Makefile.auto + +class Zoutput: + def __init__(self,list): + self.inlist = copy.copy(list) + + def help(self): + return """ +-z machine + copy created/used src/MAKE/MINE/Makefile.auto to Makefile.machine in same dir + this can be used to preserve the machine makefile +""" + + def check(self): + if len(self.inlist) != 1: error("-z args are invalid") + self.machine = self.inlist[0] + # ---------------------------------------------------------------- # lib classes, one per LAMMPS auxiliary lib # ---------------------------------------------------------------- @@ -1087,15 +1141,15 @@ class CUDA: def __init__(self,list): self.inlist = copy.copy(list) self.mode = "double" - self.arch = "31" + self.arch = "35" def help(self): return """ --cuda mode=double arch=31 +-cuda mode=double arch=35 all args are optional and can be in any order mode = double or mixed or single (def = double) - arch = M (def = 31) - M = 31 for Kepler + arch = M (def = 35) + M = 31,35,37,etc for Kepler M = 20 for CC2.0 (GF100/110, e.g. C2050,GTX580,GTX470) M = 21 for CC2.1 (GF104/114, e.g. GTX560, GTX460, GTX450) M = 13 for CC1.3 (GF200, e.g. C1060, GTX285) @@ -1144,16 +1198,18 @@ class GPU: def __init__(self,list): self.inlist = copy.copy(list) self.make = "linux.double" - self.lammpsflag = self.modeflag = self.archflag = 0 + self.lammpsflag = self.modeflag = self.archflag = self.homeflag = 0 def help(self): return """ --gpu make=suffix lammps=suffix2 mode=double arch=N +-gpu make=suffix lammps=suffix2 mode=double arch=N home=path all args are optional and can be in any order make = use Makefile.suffix (def = linux.double) lammps = use Makefile.lammps.suffix2 (def = EXTRAMAKE in makefile) mode = double or mixed or single (def = CUDA_PREC in makefile) - arch = 31 (Kepler) or 21 (Fermi) (def = CUDA_ARCH in makefile) + arch = 3x (x = digit for Kepler) or 2x (x = digit for Fermi) + (def = CUDA_ARCH in makefile) + home = path to Cuda, e.g. /usr/local/cuda (def = CUDA_HOME in makefile) """ def check(self): @@ -1172,6 +1228,9 @@ class GPU: elif words[0] == "arch": self.arch = words[1] self.archflag = 1 + elif words[0] == "home": + self.home = words[1] + self.homeflag = 1 else: error("-gpu args are invalid") if self.modeflag and (self.mode != "double" and self.mode != "mixed" and @@ -1192,13 +1251,22 @@ class GPU: make.setvar("CUDA_PRECISION","-D_SINGLE_SINGLE") if self.archflag: make.setvar("CUDA_ARCH","-arch=sm_%s" % self.arch) + if self.homeflag: + make.setvar("CUDA_HOME",self.home) if self.lammpsflag: make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps) make.write("%s/Makefile.auto" % libdir) - commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir) - if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n) - else: str = "cd %s; make -f Makefile.auto" % libdir + # special hack for shannon GPU cluster + # must use "srun make" if on it, else just make + # this is b/c Cuda libs are not all available on host + + make = "make" + if "shannon" in os.environ.get("HOST"): make = "srun make" + + commands.getoutput("cd %s; %s -f Makefile.auto clean" % (libdir,make)) + if jmake: str = "cd %s; %s -j %d -f Makefile.auto" % (libdir,make,jmake.n) + else: str = "cd %s; %s -f Makefile.auto" % (libdir,make) # if verbose, print output as build proceeds, else only print if fails @@ -1574,14 +1642,16 @@ class Kokkos: mode is not optional, arch is optional mode = omp or cuda or phi (def = KOKKOS_DEVICES setting in Makefile ) build Kokkos package for omp or cuda or phi - set KOKKOS_DEVICES to "OpenMP" (omp, phi) or "Cuda, OpenMP" (cuda) - arch = 31 (Kepler) or 21 (Fermi) (def = -arch setting in Makefile) + sets KOKKOS_DEVICES to "OpenMP" (omp, phi) or "Cuda, OpenMP" (cuda) + arch = number like 35 (Kepler) or 21 (Fermi) + sets KOKKOS_ARCH to appropriate value """ def check(self): + print self.inlist if self.inlist != None and len(self.inlist) == 0: error("-kokkos args are invalid") - + if self.inlist == None: return if len(self.inlist) < 1: error("-kokkos args are invalid") self.mode = self.inlist[0] @@ -1596,7 +1666,7 @@ class Kokkos: else: error("-kokkos args are invalid") # ---------------------------------------------------------------- -# makefile classes for CC, MPI, JPG, PNG, FFT settings +# makefile classes for CC, FLAGS, MPI, JPG, PNG, FFT settings # ---------------------------------------------------------------- # Cc class @@ -1610,7 +1680,8 @@ class Cc: def help(self): return """ -cc compiler wrap=wcompiler - change CC setting in makefile + alter CC setting in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action compiler is required, all other args are optional compiler = any string with g++ or icc or icpc or mpi (or mpicxx, mpiCC, mpiicpc, etc) @@ -1644,6 +1715,41 @@ class Cc: self.wrap = words[1] else: error("-cc args are invalid") +# Flags class + +class Flags: + def __init__(self,list): + self.inlist = copy.copy(list) + self.CC = [] + self.LINK = [] + + def help(self): + return """ +-flags flag f1 f2 ... flag f1 f2 ... + alter CCFLAGS or LINKFLAGS settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action + flag = CC or LINK + one or both can be specified + f1,f2,etc = flag to add or replace + "-" char will be prepended to each + for example: g, O3, xHost, "fp-model fast=2" + will become: -g, -O3, -xHost, -fp-model fast=2 + for -O,-O2,-O3,etc: existing -O* will first be removed +""" + + def check(self): + if len(self.inlist) < 1: error("-flags args are invalid") + self.CC = [] # necessary? + self.LINK = [] + mode = "" + for one in self.inlist: + if one == "CC": mode = "CC" + elif one == "LINK": mode = "LINK" + else: + if not mode: error("-flags args are invalid") + if mode == "CC": self.CC.append(one) + elif mode == "LINK": self.LINK.append(one) + # Mpi class class Mpi: @@ -1654,7 +1760,8 @@ class Mpi: def help(self): return """ -mpi style dir=path - change MPI settings in makefile + alter MPI settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action style is required, all other args are optional style = mpi or mpich or ompi or serial mpi = no MPI settings (assume compiler is MPI wrapper) @@ -1687,9 +1794,10 @@ class Fft: def help(self): return """ -fft mode lib=libname dir=homedir idir=incdir ldir=libdir - change FFT settings in makefile + alter FFT settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action mode is required, all other args are optional - removes all current FFT variable settings + first removes all current FFT variable settings mode = none or fftw or fftw3 or ... adds -DFFT_MODE setting lib = name of FFT library to link with (def is libname = mode) @@ -1727,6 +1835,8 @@ class Jpg: def help(self): return """ -jpg flag dir=homedir idir=incdir ldir=libdir + alter JPG settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action change JPG settings in makefile all args are optional, flag must come first if specified flag = yes or no (def = yes) @@ -1764,7 +1874,8 @@ class Png: def help(self): return """ -png flag dir=homedir idir=incdir ldir=libdir - change PNG settings in makefile + alter PNG settings in Makefile.auto + only happens if new Makefile.auto is created by use of "file" action all args are optional, flag must come first if specified flag = yes or no (def = yes) include or exclude PNG support @@ -2143,13 +2254,22 @@ while 1: packages.uninstall() - # create output file if requested and exe action performed + # create copy of executable if requested, and exe action performed if output and actions and "exe" in actions.alist: txt = "cp %s/lmp_auto %s/lmp_%s" % (dir.src,dir.cwd,output.machine) commands.getoutput(txt) print "Created lmp_%s in %s" % (output.machine,dir.cwd) + # create copy of Makefile.auto if requested, and file or exe action performed + + if zoutput and actions and \ + ("file" in actions.alist or "exe" in actions.alist): + txt = "cp %s/MAKE/MINE/Makefile.auto %s/MAKE/MINE/Makefile.%s" % \ + (dir.src,dir.src,zoutput.machine) + commands.getoutput(txt) + print "Created Makefile.%s in %s/MAKE/MINE" % (zoutput.machine,dir.src) + # write current Make.py command to src/Make.py.last fp = open("%s/Make.py.last" % dir.src,'w') diff --git a/src/Makefile b/src/Makefile index a0d9cc822d..8938c2e72a 100755 --- a/src/Makefile +++ b/src/Makefile @@ -205,8 +205,8 @@ install-python: tar: @cd STUBS; $(MAKE) clean @cd ..; tar cvzf src/$(ROOT)_src.tar.gz \ - src/Make* src/Package.sh src/Depend.sh \ - src/MAKE src/*.cpp src/*.h src/STUBS \ + src/Make* src/Package.sh src/Depend.sh src/Install.sh \ + src/MAKE src/DEPEND src/*.cpp src/*.h src/STUBS \ $(patsubst %,src/%,$(PACKAGEUC)) $(patsubst %,src/%,$(PACKUSERUC)) \ --exclude=*/.svn @cd STUBS; $(MAKE) diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index af9ca65eef..2404ae536d 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -107,17 +107,16 @@ void FixQEqFire::init() void FixQEqFire::pre_force(int vflag) { int inum, *ilist; - int i,ii,iloop,loopmax; - int *mask = atom->mask; + int i,ii,iloop; double *q = atom->q; double vmax,vdotf,vdotfall,vdotv,vdotvall,fdotf,fdotfall; double scale1,scale2; double dtvone,dtv; - double enegtot,enegchk,enegmax; + double enegtot,enegchk; double alpha = qdamp; double dt, dtmax; - double enegchkall,enegmaxall; + double enegchkall; bigint ntimestep = update->ntimestep; bigint last_negative = 0; @@ -225,7 +224,7 @@ void FixQEqFire::pre_force(int vflag) if (comm->me == 0) { if (iloop == maxiter) { char str[128]; - sprintf(str,"Charges did not converge at step "BIGINT_FORMAT + sprintf(str,"Charges did not converge at step " BIGINT_FORMAT ": %lg",update->ntimestep,enegchk); error->warning(FLERR,str); } diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 17c2c30fca..5b6c310911 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -93,13 +93,38 @@ void Temper::command(int narg, char **arg) if (nswaps*nevery != nsteps) error->universe_all(FLERR,"Non integer # of swaps in temper command"); - // fix style must be appropriate for temperature control + // fix style must be appropriate for temperature control, i.e. it needs + // to provide a working Fix::reset_target() and must not change the volume. if ((strcmp(modify->fix[whichfix]->style,"nvt") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/asphere") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/asphere/omp") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/body") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/eff") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/intel") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/kk") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/kk/host") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/kk/device") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/omp") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/sphere") != 0) && + (strcmp(modify->fix[whichfix]->style,"nvt/sphere/omp") != 0) && (strcmp(modify->fix[whichfix]->style,"langevin") != 0) && + (strcmp(modify->fix[whichfix]->style,"langevin/drude") != 0) && + (strcmp(modify->fix[whichfix]->style,"langevin/eff") != 0) && + (strcmp(modify->fix[whichfix]->style,"gld") != 0) && + (strcmp(modify->fix[whichfix]->style,"gle") != 0) && + (strcmp(modify->fix[whichfix]->style,"rigid/nvt") != 0) && + (strcmp(modify->fix[whichfix]->style,"rigid/nvt/small") != 0) && + (strcmp(modify->fix[whichfix]->style,"rigid/nvt/omp") != 0) && + (strcmp(modify->fix[whichfix]->style,"rigid/nvt/small/omp") != 0) && (strcmp(modify->fix[whichfix]->style,"temp/berendsen") != 0) && - (strcmp(modify->fix[whichfix]->style,"temp/rescale") != 0)) - error->universe_all(FLERR,"Tempering temperature fix is not valid"); + (strcmp(modify->fix[whichfix]->style,"temp/berendsen/cuda") != 0) && + (strcmp(modify->fix[whichfix]->style,"temp/csvr") != 0) && + (strcmp(modify->fix[whichfix]->style,"temp/csld") != 0) && + (strcmp(modify->fix[whichfix]->style,"temp/rescale") != 0) && + (strcmp(modify->fix[whichfix]->style,"temp/rescale/cuda") != 0) && + (strcmp(modify->fix[whichfix]->style,"temp/rescale/eff") != 0)) + error->universe_all(FLERR,"Tempering temperature fix is not supported"); // setup for long tempering run diff --git a/src/STUBS/Makefile.mingw32-cross b/src/STUBS/Makefile.mingw32-cross index 8bc6d62135..4144954ec7 100644 --- a/src/STUBS/Makefile.mingw32-cross +++ b/src/STUBS/Makefile.mingw32-cross @@ -16,7 +16,7 @@ OBJ = $(SRC:%.c=%_mingw32.o) # System-specific settings CC = i686-w64-mingw32-gcc -CCFLAGS = -O2 -Wall -march=i686 -mtune=generic -mfpmath=387 -mpc64 +CCFLAGS = -O2 -Wall -march=i686 -mtune=generic -mfpmath=387 -mpc64 -I. ARCHIVE = i686-w64-mingw32-ar ARCHFLAG = rs diff --git a/src/STUBS/Makefile.mingw64-cross b/src/STUBS/Makefile.mingw64-cross index 2ef8d7fd6e..70b971f262 100644 --- a/src/STUBS/Makefile.mingw64-cross +++ b/src/STUBS/Makefile.mingw64-cross @@ -16,7 +16,7 @@ OBJ = $(SRC:%.c=%_mingw64.o) # System-specific settings CC = x86_64-w64-mingw32-gcc -CCFLAGS = -O2 -Wall -march=core2 -mtune=core2 -msse2 -mpc64 +CCFLAGS = -O2 -Wall -march=core2 -mtune=core2 -msse2 -mpc64 -I. ARCHIVE = x86_64-w64-mingw32-ar ARCHFLAG = rs diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index fc6ba17f1c..eeb3e134f6 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -1097,7 +1097,6 @@ double PairAIREBOOMP::bondorderLJ_thr(int i, int j, double rij[3], double rijmag ril[1] = rij[1]+rjl[1]; ril[2] = rij[2]+rjl[2]; ril2 = (ril[0]*ril[0])+(ril[1]*ril[1])+(ril[2]*ril[2]); - rijrjl = 2.0*rijmag*rjlmag; rjl2 = rjlmag*rjlmag; costmp = 0.5*(rij2+rjl2-ril2)/rijmag/rjlmag; tspijl = Sp2(costmp,thmin,thmax,dtsijl); diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index 3a9f043ed9..5412817d59 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -398,7 +398,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : double scale; if (which == BIN1D || which == BIN2D || which == BIN3D || which == BINCYLINDER) { - if (which == BIN1D || BINCYLINDER) ndim = 1; + if (which == BIN1D || which == BINCYLINDER) ndim = 1; if (which == BIN2D) ndim = 2; if (which == BIN3D) ndim = 3; for (int idim = 0; idim < ndim; idim++) { diff --git a/src/domain.cpp b/src/domain.cpp index ee6d2c1bc5..f47be0c6d5 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -503,13 +503,12 @@ void Domain::pbc() double *coord; int n3 = 3*nlocal; - if (x) { - coord = &x[0][0]; - int flag = 0; - for (i = 0; i < n3; i++) - if (!ISFINITE(*coord++)) flag = 1; - if (flag) error->one(FLERR,"Non-numeric atom coords - simulation unstable"); - } + coord = &x[0][0]; // note: x is always initialzed to at least one element. + int flag = 0; + for (i = 0; i < n3; i++) + if (!ISFINITE(*coord++)) flag = 1; + if (flag) error->one(FLERR,"Non-numeric atom coords - simulation unstable"); + // setup for PBC checks if (triclinic == 0) { diff --git a/src/dump_image.cpp b/src/dump_image.cpp index de0db88777..2ab9e84467 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -850,7 +850,6 @@ void DumpImage::create_image() if (bodyflag) { Body *bptr = avec_body->bptr; - double **x = atom->x; int *body = atom->body; m = 0; diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 3537e36d54..588aca4738 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -23,7 +23,6 @@ #include "force.h" #include "modify.h" #include "compute.h" -#include "group.h" #include "input.h" #include "variable.h" #include "memory.h" @@ -55,6 +54,8 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : global_freq = nfreq; + dynamic_group_allow = 1; + // scan values to count them // then read options so know mode = SCALAR/VECTOR before re-reading values diff --git a/src/math_const.h b/src/math_const.h index c0b81bdf8a..d94f783aa5 100644 --- a/src/math_const.h +++ b/src/math_const.h @@ -25,6 +25,7 @@ namespace MathConst { static const double MY_PI2 = 1.57079632679489661923; // pi/2 static const double MY_PI4 = 0.78539816339744830962; // pi/4 static const double MY_PIS = 1.77245385090551602729; // sqrt(pi) + static const double MY_ISPI4 = 1.12837916709551257389; // 1/sqrt(pi/4) static const double MY_SQRT2 = 1.41421356237309504880; // sqrt(2) static const double MY_CBRT2 = 1.25992104989487316476; // 2*(1/3) } diff --git a/src/read_data.cpp b/src/read_data.cpp index 5a7484dea8..4b790f343c 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1468,7 +1468,7 @@ void ReadData::bonus(bigint nbonus, AtomVec *ptr, const char *type) void ReadData::bodies(int firstpass) { - int i,m,nchunk,nline,nmax,ninteger,ndouble,nword,ncount,onebody,tmp; + int m,nchunk,nline,nmax,ninteger,ndouble,nword,ncount,onebody,tmp; char *eof; int mapflag = 0; diff --git a/src/set.cpp b/src/set.cpp index a0bd6c2b65..37a0e815c4 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -917,7 +917,6 @@ void Set::setrandom(int keyword) } else if (keyword == THETA_RANDOM) { int nlocal = atom->nlocal; - double theta; for (i = 0; i < nlocal; i++) { if (select[i]) { if (atom->line[i] < 0)