diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt index afb7cb84cd..a957470735 100644 --- a/doc/src/Manual.txt +++ b/doc/src/Manual.txt @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -21,7 +21,7 @@

LAMMPS Documentation :c,h3 -18 Oct 2016 version :c,h4 +19 Oct 2016 version :c,h4 Version info: :h4 diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index 820fa828c5..f44f61362d 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -528,6 +528,8 @@ These are additional commands in USER packages, which can be used if package"_Section_start.html#start_3. "dump custom/vtk"_dump_custom_vtk.html, +"dump nc"_dump_nc.html, +"dump nc/mpiio"_dump_nc.html, "group2ndx"_group2ndx.html, "ndx2group"_group2ndx.html :tb(c=3,ea=c) diff --git a/doc/src/Section_howto.txt b/doc/src/Section_howto.txt index 8dbec55e77..7b8ed2d9a6 100644 --- a/doc/src/Section_howto.txt +++ b/doc/src/Section_howto.txt @@ -1854,13 +1854,19 @@ internal LAMMPS operations. Note that LAMMPS classes are defined within a LAMMPS namespace (LAMMPS_NS) if you use them from another C++ application. -Library.cpp contains these 5 basic functions: +Library.cpp contains these functions for creating and destroying an +instance of LAMMPS and sending it commands to execute. See the +documentation in the src/library.cpp file for details: void lammps_open(int, char **, MPI_Comm, void **) +void lammps_open_no_mpi(int, char **, void **) void lammps_close(void *) int lammps_version(void *) void lammps_file(void *, char *) -char *lammps_command(void *, char *) :pre +char *lammps_command(void *, char *) +char *lammps_commands_list(void *, int, char **) +char *lammps_commands_concatenated(void *, char *) +void lammps_free(void *) :pre The lammps_open() function is used to initialize LAMMPS, passing in a list of strings as if they were "command-line @@ -1880,6 +1886,10 @@ half to the other code and run both codes simultaneously before syncing them up periodically. Or it might instantiate multiple instances of LAMMPS to perform different calculations. +The lammps_open_no_mpi() function is similar except that no MPI +communicator is passed from the caller. Instead, MPI_COMM_WORLD is +used to instantiate LAMMPS, and MPI is initialzed if necessary. + The lammps_close() function is used to shut down an instance of LAMMPS and free all its memory. @@ -1891,16 +1901,33 @@ changes to the LAMMPS command syntax between versions. The returned LAMMPS version code is an integer (e.g. 2 Sep 2015 results in 20150902) that grows with every new LAMMPS version. -The lammps_file() and lammps_command() functions are used to pass a -file or string to LAMMPS as if it were an input script or single -command in an input script. Thus the calling code can read or -generate a series of LAMMPS commands one line at a time and pass it -thru the library interface to setup a problem and then run it, -interleaving the lammps_command() calls with other calls to extract -information from LAMMPS, perform its own operations, or call another +The lammps_file(), lammps_command(), lammps_commands_list(), +lammps_commands_concatenated() functions are used to pass one or more +commands to LAMMPS to execute as if they were coming from an input +script. + +The lammps_file() function passes the filename of an input script. +The lammps_command() function passes a single command as a string. +The lammps_commands_multiple() function passes multiple commands in a +char** list. The lammps_commands_concatentaed() function passes +multiple commands concatenated into one long string, separated by +newline characters. A single command can be spread across multiple +lines, if the last printable character of all but the last line is +"&", the same as if the lines appeared in an input script. + +Via these library functions, the calling code can read or generate a +series of LAMMPS commands one or multiple at a time and pass it thru +the library interface to setup a problem and then run it, interleaving +the command function calls with operations performed within the +faller, calls to extract information from LAMMPS, or calls to another code's library. -Other useful functions are also included in library.cpp. For example: +The lammps_free() is a clean-up function to free memory that the library +allocated previously. + +Library.cpp also contains these functions for extracting information +from LAMMPS and setting value within LAMMPS. Again, see the +documentation in the src/library.cpp file for details: void *lammps_extract_global(void *, char *) void *lammps_extract_atom(void *, char *) @@ -1908,27 +1935,37 @@ void *lammps_extract_compute(void *, char *, int, int) void *lammps_extract_fix(void *, char *, int, int, int, int) void *lammps_extract_variable(void *, char *, char *) int lammps_set_variable(void *, char *, char *) +double lammps_get_thermo(void *, char *) int lammps_get_natoms(void *) -void lammps_get_coords(void *, double *) -void lammps_put_coords(void *, double *) :pre +void lammps_gather_atoms(void *, double *) +void lammps_scatter_atoms(void *, double *) :pre -These can extract various global or per-atom quantities from LAMMPS as -well as values calculated by a compute, fix, or variable. The -"set_variable" function can set an existing string-style variable to a -new value, so that subsequent LAMMPS commands can access the variable. -The "get" and "put" operations can retrieve and reset atom -coordinates. See the library.cpp file and its associated header file -library.h for details. +These functions can extract various global or per-atom quantities from +LAMMPS as well as values calculated by a compute, fix, or variable. +The lammps_set_variable() function can set an existing string-style variable +to a new value, so that subsequent LAMMPS commands can access the +variable. The lammps_get_thermo() function returns the current +value of a thermo keyword. -The key idea of the library interface is that you can write any -functions you wish to define how your code talks to LAMMPS and add -them to src/library.cpp and src/library.h, as well as to the "Python +The lammps_get_natoms() function returns the total number of atoms in +the system and can be used by the caller to allocate space for the +lammps_gather_atoms() and lammps_scatter_atoms() functions. The +gather function collects atom info of the requested type (atom coords, +types, forces, etc) from all procsesors, orders them by atom ID, and +returns a full list to each calling processor. The scatter function +does the inverse. It distributes the same kinds of values, +passed by the caller, to each atom owned by individual processors. + +The examples/COUPLE and python directories have example C++ and C and +Python codes which show how a driver code can link to LAMMPS as a +library, run LAMMPS on a subset of processors, grab data from LAMMPS, +change it, and put it back into LAMMPS. + +NOTE: You can write your own additional functions as needed to define +how your code talks to LAMMPS and add them to src/library.cpp and +src/library.h, as well as to the "Python interface"_Section_python.html. The routines you add can access or -change any LAMMPS data you wish. The examples/COUPLE and python -directories have example C++ and C and Python codes which show how a -driver code can link to LAMMPS as a library, run LAMMPS on a subset of -processors, grab data from LAMMPS, change it, and put it back into -LAMMPS. +change any LAMMPS data you wish. :line diff --git a/doc/src/Section_python.txt b/doc/src/Section_python.txt index 64fa119706..352c1fa592 100644 --- a/doc/src/Section_python.txt +++ b/doc/src/Section_python.txt @@ -534,10 +534,11 @@ from lammps import lammps :pre These are the methods defined by the lammps module. If you look at the files src/library.cpp and src/library.h you will see that they correspond one-to-one with calls you can make to the LAMMPS library -from a C++ or C or Fortran program. +from a C++ or C or Fortran program, and which are described in +"Section 6.19"_Section_howto.html#howto_19 of the manual. lmp = lammps() # create a LAMMPS object using the default liblammps.so library - 4 optional args are allowed: name, cmdargs, ptr, comm + # 4 optional args are allowed: name, cmdargs, ptr, comm lmp = lammps(ptr=lmpptr) # use lmpptr as previously created LAMMPS object lmp = lammps(comm=split) # create a LAMMPS object with a custom communicator, requires mpi4py 2.0.0 or later lmp = lammps(name="g++") # create a LAMMPS object using the liblammps_g++.so library @@ -549,6 +550,7 @@ version = lmp.version() # return the numerical version id, e.g. LAMMPS 2 Sep 20 lmp.file(file) # run an entire input script, file = "in.lj" lmp.command(cmd) # invoke a single LAMMPS command, cmd = "run 100" :pre +lmp.commands_list(cmdlist) # invoke commands in cmdlist xlo = lmp.extract_global(name,type) # extract a global quantity # name = "boxxlo", "nlocal", etc @@ -580,6 +582,8 @@ var = lmp.extract_variable(name,group,flag) # extract value(s) from a variable # 1 = atom-style variable :pre flag = lmp.set_variable(name,value) # set existing named string-style variable to value, flag = 0 if successful +value = lmp.get_thermo(name) # return current value of a thermo keyword + natoms = lmp.get_natoms() # total # of atoms as int data = lmp.gather_atoms(name,type,count) # return atom attribute of all atoms gathered into data, ordered by atom ID # name = "x", "charge", "type", etc @@ -599,9 +603,10 @@ create an instance of LAMMPS, wrapped in a Python class by the lammps Python module, and return an instance of the Python class as lmp. It is used to make all subequent calls to the LAMMPS library. -Additional arguments can be used to tell Python the name of the shared -library to load or to pass arguments to the LAMMPS instance, the same -as if LAMMPS were launched from a command-line prompt. +Additional arguments to lammps() can be used to tell Python the name +of the shared library to load or to pass arguments to the LAMMPS +instance, the same as if LAMMPS were launched from a command-line +prompt. If the ptr argument is set like this: diff --git a/doc/src/dump.txt b/doc/src/dump.txt index 767e791d71..5f8ee1ee88 100644 --- a/doc/src/dump.txt +++ b/doc/src/dump.txt @@ -12,6 +12,7 @@ dump command :h3 "dump image"_dump_image.html command :h3 "dump movie"_dump_image.html command :h3 "dump molfile"_dump_molfile.html command :h3 +"dump nc"_dump_nc.html command :h3 [Syntax:] @@ -43,7 +44,9 @@ args = list of arguments for a particular style :l {movie} args = discussed on "dump image"_dump_image.html doc page :pre - {molfile} args = discussed on "dump molfile"_dump_molfile.html doc page :pre + {molfile} args = discussed on "dump molfile"_dump_molfile.html doc page + + {nc} args = discussed on "dump nc"_dump_nc.html doc page :pre {local} args = list of local attributes possible attributes = index, c_ID, c_ID\[I\], f_ID, f_ID\[I\] diff --git a/doc/src/dump_nc.txt b/doc/src/dump_nc.txt index a2be836773..0b81ee6a32 100644 --- a/doc/src/dump_nc.txt +++ b/doc/src/dump_nc.txt @@ -31,30 +31,32 @@ dump 1 all nc/mpiio 1000 traj.nc id type x y z :pre [Description:] Dump a snapshot of atom coordinates every N timesteps in Amber-style -NetCDF file format. NetCDF files are binary, portable and self-describing. -This dump style will write only one file on the root node. The dump -style {nc} uses the "standard NetCDF library"_netcdf-home all data is -collected on one processor and then written to the dump file. Dump style -{nc/mpiio} used the "parallel NetCDF library"_pnetcdf-home and MPI-IO; -it has better performance on a larger number of processors. Note that -'nc' outputs all atoms sorted by atom tag while 'nc/mpiio' outputs in -order of the MPI rank. +NetCDF file format. NetCDF files are binary, portable and +self-describing. This dump style will write only one file on the root +node. The dump style {nc} uses the "standard NetCDF +library"_netcdf-home all data is collected on one processor and then +written to the dump file. Dump style {nc/mpiio} used the "parallel +NetCDF library"_pnetcdf-home and MPI-IO; it has better performance on +a larger number of processors. Note that 'nc' outputs all atoms sorted +by atom tag while 'nc/mpiio' outputs in order of the MPI rank. -In addition to per-atom data, also global (i.e. not per atom, but per frame) -quantities can be included in the dump file. This can be variables, output -from computes or fixes data prefixed with v_, c_ and f_, respectively. -These properties are included via "dump_modify"_dump_modify.html {global}. +In addition to per-atom data, also global (i.e. not per atom, but per +frame) quantities can be included in the dump file. This can be +variables, output from computes or fixes data prefixed with v_, c_ and +f_, respectively. These properties are included via +"dump_modify"_dump_modify.html {global}. + +:link(netcdf-home,http://www.unidata.ucar.edu/software/netcdf/) +:link(pnetcdf-home,http://trac.mcs.anl.gov/projects/parallel-netcdf/) :line [Restrictions:] -The {nc} and {nc/mpiio} dump styles are part of the USER-NC-DUMP package. -It is only enabled if LAMMPS was built with that package. See the "Making -LAMMPS"_Section_start.html#start_3 section for more info. - -:link(netcdf-home,http://www.unidata.ucar.edu/software/netcdf/) -:link(pnetcdf-home,http://trac.mcs.anl.gov/projects/parallel-netcdf/) +The {nc} and {nc/mpiio} dump styles are part of the USER-NC-DUMP +package. It is only enabled if LAMMPS was built with that +package. See the "Making LAMMPS"_Section_start.html#start_3 section +for more info. :line diff --git a/doc/src/fix.txt b/doc/src/fix.txt index d84ec2aad9..464eab3169 100644 --- a/doc/src/fix.txt +++ b/doc/src/fix.txt @@ -190,6 +190,7 @@ of "this page"_Section_commands.html#cmd_5. "gcmc"_fix_gcmc.html - grand canonical insertions/deletions "gld"_fix_gcmc.html - generalized Langevin dynamics integrator "gravity"_fix_gravity.html - add gravity to atoms in a granular simulation +"halt"_fix_halt.html - terminate a dynamics run or minimization "heat"_fix_heat.html - add/subtract momentum-conserving heat "indent"_fix_indent.html - impose force due to an indenter "langevin"_fix_langevin.html - Langevin temperature control diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 06afdff78f..f83e499a23 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -554,7 +554,7 @@ void PairTable::spline_table(Table *tb) /* ---------------------------------------------------------------------- extract attributes from parameter line in table section - format of line: N value R/RSQ/BITMAP lo hi FP fplo fphi + format of line: N value R/RSQ/BITMAP lo hi FPRIME fplo fphi N is required, other params are optional ------------------------------------------------------------------------- */ @@ -578,7 +578,7 @@ void PairTable::param_extract(Table *tb, char *line) tb->rlo = atof(word); word = strtok(NULL," \t\n\r\f"); tb->rhi = atof(word); - } else if (strcmp(word,"FP") == 0) { + } else if (strcmp(word,"FPRIME") == 0) { tb->fpflag = 1; word = strtok(NULL," \t\n\r\f"); tb->fplo = atof(word); diff --git a/src/version.h b/src/version.h index 244c8c4da8..3cdddc4efd 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "18 Oct 2016" +#define LAMMPS_VERSION "19 Oct 2016"