diff --git a/doc/src/Section_start.txt b/doc/src/Section_start.txt index 53a36b8c22..6eef155be2 100644 --- a/doc/src/Section_start.txt +++ b/doc/src/Section_start.txt @@ -587,8 +587,7 @@ Typing "make clean-all" or "make clean-machine" will delete *.o object files created when LAMMPS is built, for either all builds or for a particular machine. -Changing the LAMMPS size limits via -DLAMMPS_SMALLBIG or --DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL :h6 +Changing the LAMMPS size limits via -DLAMMPS_SMALLBIG or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL :h6 As explained above, any of these 3 settings can be specified on the LMP_INC line in your low-level src/MAKE/Makefile.foo. @@ -659,7 +658,16 @@ utilities. For Cygwin and the MinGW cross-compilers, suitable makefiles are provided in src/MAKE/MACHINES. When using other compilers, like Visual C++ or Intel compilers for Windows, you may have to implement -your own build system. Since none of the current LAMMPS core developers +your own build system. Due to differences between the Windows OS +and Windows system libraries to Unix-like environments like Linux +or MacOS, when compiling for Windows a few adjustments may be needed: + +Do not set the -DLAMMPS_MEMALIGN define (see LMP_INC makefile variable) +Add -lwsock32 -lpsapi to the linker flags (see LIB makefile variable) +Try adding -static-libgcc or -static or both to the linker flags when your +LAMMPS executable complains about missing .dll files :ul + +Since none of the current LAMMPS core developers has significant experience building executables on Windows, we are happy to distribute contributed instructions and modifications, but we cannot provide support for those. diff --git a/lib/kim/Install.py b/lib/kim/Install.py index 06479d2d4d..21ea859852 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -60,8 +60,29 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) + if which('curl') != None: + cmd = 'curl -L -o "%s" %s' % (fname,url) + elif which('wget') != None: + cmd = 'wget -O "%s" %s' % (fname,url) + else: error("cannot find 'wget' or 'curl' to download source code") txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) return txt diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index e4e5ec5613..154f5aa522 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -47,8 +47,29 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) + if which('curl') != None: + cmd = 'curl -L -o "%s" %s' % (fname,url) + elif which('wget') != None: + cmd = 'wget -O "%s" %s' % (fname,url) + else: error("cannot find 'wget' or 'curl' to download source code") txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) return txt diff --git a/lib/poems/poemsobject.cpp b/lib/poems/poemsobject.cpp index 4a5f903fca..7c3f1ca872 100644 --- a/lib/poems/poemsobject.cpp +++ b/lib/poems/poemsobject.cpp @@ -21,7 +21,7 @@ POEMSObject::POEMSObject(){ name = 0; - ChangeName("unnamed"); + ChangeName((const char*)"unnamed"); ID = -1; } @@ -29,7 +29,7 @@ POEMSObject::~POEMSObject(){ delete [] name; } -void POEMSObject::ChangeName(char* newname){ +void POEMSObject::ChangeName(const char* newname){ delete [] name; name = new char[strlen(newname)+1]; strcpy(name,newname); diff --git a/lib/poems/poemsobject.h b/lib/poems/poemsobject.h index d898ab3c66..63b2915638 100644 --- a/lib/poems/poemsobject.h +++ b/lib/poems/poemsobject.h @@ -26,7 +26,7 @@ class POEMSObject { public: POEMSObject(); virtual ~POEMSObject(); - void ChangeName(char* newname); + void ChangeName(const char* newname); char* GetName(); int GetID(); void SetID(int id); diff --git a/lib/smd/Install.py b/lib/smd/Install.py index 1c270bea5e..00891339d0 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -47,8 +47,29 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) + if which('curl') != None: + cmd = 'curl -L -o "%s" %s' % (fname,url) + elif which('wget') != None: + cmd = 'wget -O "%s" %s' % (fname,url) + else: error("cannot find 'wget' or 'curl' to download source code") txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) return txt diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 5a246bbeb1..4998358d27 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -46,8 +46,29 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) + if which('curl') != None: + cmd = 'curl -L -o "%s" %s' % (fname,url) + elif which('wget') != None: + cmd = 'wget -O "%s" %s' % (fname,url) + else: error("cannot find 'wget' or 'curl' to download source code") txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) return txt @@ -116,7 +137,7 @@ if buildflag: if buildflag: print("Building Voro++ ...") - cmd = 'cd "%s"; make' % homedir + cmd = 'cd "%s"; make CXX=g++ CFLAGS="-fPIC -O3"' % homedir txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) print(txt.decode('UTF-8')) diff --git a/src/special.cpp b/src/special.cpp index 4697fc40a6..381a763dd2 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -561,7 +561,13 @@ void Special::combine() for (j = 0; j < nspecial[i][2]; j++) atom->map_one(onefour[i][j],-1); } - // compute global maxspecial, must be at least 1 + // if atom->maxspecial has been updated before, make certain + // we do not reset it to a smaller value. Since atom->maxspecial + // is initialized to 1, this ensures that it is larger than zero. + + maxspecial = MAX(atom->maxspecial,maxspecial); + + // compute global maxspecial // add in extra factor from special_bonds command // allocate correct special array with same nmax, new maxspecial // previously allocated one must be destroyed @@ -569,7 +575,10 @@ void Special::combine() MPI_Allreduce(&maxspecial,&atom->maxspecial,1,MPI_INT,MPI_MAX,world); atom->maxspecial += force->special_extra; - atom->maxspecial = MAX(atom->maxspecial,1); + + // add force->special_extra only once + + force->special_extra = 0; if (me == 0) { if (screen)