diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d4dcdcff88..aaa0885072 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -135,13 +135,11 @@ set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions") # ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro # and prints lots of pointless warnings about "unsafe" functions if(MSVC) - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")) add_compile_options(/Zc:__cplusplus) add_compile_options(/wd4244) add_compile_options(/wd4267) - if(LAMMPS_EXCEPTIONS) - add_compile_options(/EHsc) - endif() + add_compile_options(/EHsc) endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() diff --git a/doc/src/Developer_utils.rst b/doc/src/Developer_utils.rst index 43f12ef377..e1a5f7741d 100644 --- a/doc/src/Developer_utils.rst +++ b/doc/src/Developer_utils.rst @@ -208,7 +208,7 @@ Argument processing Convenience functions ^^^^^^^^^^^^^^^^^^^^^ -.. doxygenfunction:: logmesg(LAMMPS *lmp, const S &format, Args&&... args) +.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &format, Args&&... args) :project: progguide .. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg) diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index fef2ec8def..dd848a812e 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -38,11 +38,11 @@ found together with equivalent examples in C and C++ in the .. note:: - A contributed (and complete!) Fortran interface that more - closely resembles the C-library interface is available - in the ``examples/COUPLE/fortran2`` folder. Please see the - ``README`` file in that folder for more information about it - and how to contact its author and maintainer. + A contributed (and more complete!) Fortran interface that more + closely resembles the C-library interface is available in the + ``examples/COUPLE/fortran2`` folder. Please see the ``README`` file + in that folder for more information about it and how to contact its + author and maintainer. ---------- @@ -65,8 +65,9 @@ the optional logical argument set to ``.true.``. Here is a simple example: PROGRAM testlib USE LIBLAMMPS ! include the LAMMPS library interface + IMPLICIT NONE TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance - CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = & + CHARACTER(len=*), PARAMETER :: args(3) = & [ CHARACTER(len=12) :: 'liblammps', '-log', 'none' ] ! create a LAMMPS instance (and initialize MPI) @@ -78,6 +79,41 @@ the optional logical argument set to ``.true.``. Here is a simple example: END PROGRAM testlib +It is also possible to pass command line flags from Fortran to C/C++ and +thus make the resulting executable behave similar to the standalone +executable (it will ignore the `-in/-i` flag, though). This allows to +use the command line to configure accelerator and suffix settings, +configure screen and logfile output, or to set index style variables +from the command line and more. Here is a correspondingly adapted +version of the previous example: + +.. code-block:: fortran + + PROGRAM testlib2 + USE LIBLAMMPS ! include the LAMMPS library interface + IMPLICIT NONE + TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance + CHARACTER(len=128), ALLOCATABLE :: command_args(:) + INTEGER :: i, argc + + ! copy command line flags to `command_args()` + argc = COMMAND_ARGUMENT_COUNT() + ALLOCATE(command_args(0:argc)) + DO i=0, argc + CALL GET_COMMAND_ARGUMENT(i, command_args(i)) + END DO + + ! create a LAMMPS instance (and initialize MPI) + lmp = lammps(command_args) + ! get and print numerical version code + PRINT*, 'Program name: ', command_args(0) + PRINT*, 'LAMMPS Version: ', lmp%version() + ! delete LAMMPS instance (and shuts down MPI) + CALL lmp%close(.TRUE.) + DEALLOCATE(command_args) + + END PROGRAM testlib2 + -------------------- Executing LAMMPS commands @@ -102,7 +138,7 @@ Below is a small demonstration of the uses of the different functions: USE LIBLAMMPS TYPE(lammps) :: lmp CHARACTER(len=512) :: cmds - CHARACTER(len=40),ALLOCATABLE :: cmdlist(:) + CHARACTER(len=40), ALLOCATABLE :: cmdlist(:) CHARACTER(len=10) :: trimmed INTEGER :: i @@ -111,10 +147,10 @@ Below is a small demonstration of the uses of the different functions: CALL lmp%command('variable zpos index 1.0') ! define 10 groups of 10 atoms each ALLOCATE(cmdlist(10)) - DO i=1,10 + DO i=1, 10 WRITE(trimmed,'(I10)') 10*i WRITE(cmdlist(i),'(A,I1,A,I10,A,A)') & - 'group g',i-1,' id ',10*(i-1)+1,':',ADJUSTL(trimmed) + 'group g', i-1, ' id ', 10*(i-1)+1, ':', ADJUSTL(trimmed) END DO CALL lmp%commands_list(cmdlist) ! run multiple commands from multi-line string @@ -123,7 +159,7 @@ Below is a small demonstration of the uses of the different functions: 'create_box 1 box' // NEW_LINE('A') // & 'create_atoms 1 single 1.0 1.0 ${zpos}' CALL lmp%commands_string(cmds) - CALL lmp%close() + CALL lmp%close(.TRUE.) END PROGRAM testcmd @@ -137,9 +173,9 @@ of the contents of the ``LIBLAMMPS`` Fortran interface to LAMMPS. .. f:type:: lammps - Derived type that is the general class of the Fortran interface. - It holds a reference to the :cpp:class:`LAMMPS ` class instance - that any of the included calls are forwarded to. + Derived type that is the general class of the Fortran interface. It + holds a reference to the :cpp:class:`LAMMPS ` + class instance that any of the included calls are forwarded to. :f c_ptr handle: reference to the LAMMPS class :f close: :f:func:`close` @@ -202,7 +238,7 @@ of the contents of the ``LIBLAMMPS`` Fortran interface to LAMMPS. This method will call :cpp:func:`lammps_commands_list` to have LAMMPS execute a list of input lines. - :p character(len=*) cmd(*): list of LAMMPS input lines + :p character(len=*) cmd(:): list of LAMMPS input lines .. f:subroutine:: commands_string(str) @@ -210,4 +246,3 @@ of the contents of the ``LIBLAMMPS`` Fortran interface to LAMMPS. execute a block of commands from a string. :p character(len=*) str: LAMMPS input in string - diff --git a/doc/src/Manual.rst b/doc/src/Manual.rst index 962810181f..14d4862c40 100644 --- a/doc/src/Manual.rst +++ b/doc/src/Manual.rst @@ -49,12 +49,12 @@ descriptions of all commands included in the LAMMPS code. ---------- +.. _user_documentation: ************ User Guide ************ -.. _user_documentation: .. toctree:: :maxdepth: 2 :numbered: 3 @@ -75,11 +75,12 @@ User Guide Errors +.. _programmer_documentation: + ****************** Programmer Guide ****************** -.. _programmer_documentation: .. toctree:: :maxdepth: 2 :numbered: 3 diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 5b309f9f53..1da162a3c1 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -158,7 +158,7 @@ AMOEBA package **Contents:** Implementation of the AMOEBA and HIPPO polarized force fields -orginally developed by Jay Ponder's group at the U Washington at St +originally developed by Jay Ponder's group at the U Washington at St Louis. The LAMMPS implementation is based on Fortran 90 code provided by the Ponder group in their `Tinker MD software `_. diff --git a/doc/src/Run_options.rst b/doc/src/Run_options.rst index ceae464a59..d2d7f8c155 100644 --- a/doc/src/Run_options.rst +++ b/doc/src/Run_options.rst @@ -14,6 +14,7 @@ letter abbreviation can be used: * :ref:`-m or -mpicolor ` * :ref:`-c or -cite ` * :ref:`-nc or -nocite ` +* :ref:`-nb or -nonbuf ` * :ref:`-pk or -package ` * :ref:`-p or -partition ` * :ref:`-pl or -plog ` @@ -257,6 +258,24 @@ Disable generating a citation reminder (see above) at all. ---------- +.. _nonbuf: + +**-nonbuf** + +Turn off buffering for screen and logfile output. For performance +reasons, output to the screen and logfile is usually buffered, i.e. +output is only written to a file if its buffer - typically 4096 bytes - +has been filled. When LAMMPS crashes for some reason, however, that can +mean that there is important output missing. With this flag the +buffering can be turned off (only for screen and logfile output) and any +output will be committed immediately. Note that when running in +parallel with MPI, the screen output may still be buffered by the MPI +library and this cannot be changed by LAMMPS. This flag should only be +used for debugging and not for production simulations as the performance +impact can be significant, especially for large parallel runs. + +---------- + .. _package: **-package style args ....** diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index 74ae16820c..b753fdbe5f 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -10,7 +10,7 @@ Syntax atom_style style args -* style = *amoeba* or *angle* or *atomic* or *body* or *bond* or *charge* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or or *bpm/sphere* or *spin* or *tdpd* or *tri* or *template* or *hybrid* +* style = *amoeba* or *angle* or *atomic* or *body* or *bond* or *charge* or *dielectric* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *mesont* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or *bpm/sphere* or *spin* or *tdpd* or *tri* or *template* or *wavepacket* or *hybrid* .. parsed-literal:: diff --git a/doc/src/compute_chunk_atom.rst b/doc/src/compute_chunk_atom.rst index 42a5ca9301..9d36827c25 100644 --- a/doc/src/compute_chunk_atom.rst +++ b/doc/src/compute_chunk_atom.rst @@ -15,7 +15,7 @@ Syntax .. parsed-literal:: - style = *bin/1d* or *bin/2d* or *bin/3d* or *bin/sphere* or *type* or *molecule* or c_ID, c_ID[I], f_ID, f_ID[I], v_name + style = *bin/1d* or *bin/2d* or *bin/3d* or *bin/sphere* or *bin/cylinder* or *type* or *molecule* or c_ID, c_ID[I], f_ID, f_ID[I], v_name *bin/1d* args = dim origin delta dim = *x* or *y* or *z* origin = *lower* or *center* or *upper* or coordinate value (distance units) @@ -49,7 +49,7 @@ Syntax v_name = per-atom vector calculated by an atom-style variable with name * zero or more keyword/values pairs may be appended -* keyword = *region* or *nchunk* or *static* or *compress* or *bound* or *discard* or *pbc* or *units* +* keyword = *region* or *nchunk* or *limit* or *ids* or *compress* or *discard* or *bound* or *pbc* or *units* .. parsed-literal:: @@ -74,7 +74,7 @@ Syntax no = keep atoms with out-of-range chunk IDs by assigning a valid chunk ID mixed = keep or discard such atoms according to spatial binning rule *bound* values = x/y/z lo hi - x/y/z = *x* or *y* or *z* to bound sptial bins in this dimension + x/y/z = *x* or *y* or *z* to bound spatial bins in this dimension lo = *lower* or coordinate value (distance units) hi = *upper* or coordinate value (distance units) *pbc* value = *no* or *yes* diff --git a/doc/src/compute_orientorder_atom.rst b/doc/src/compute_orientorder_atom.rst index bc608e21d7..82c7c57495 100644 --- a/doc/src/compute_orientorder_atom.rst +++ b/doc/src/compute_orientorder_atom.rst @@ -19,12 +19,12 @@ Syntax .. parsed-literal:: - keyword = *cutoff* or *nnn* or *degrees* or *components* or *chunksize* + keyword = *cutoff* or *nnn* or *degrees* or *wl* or *wl/hat* or *components* or *chunksize* *cutoff* value = distance cutoff *nnn* value = number of nearest neighbors *degrees* values = nlvalues, l1, l2,... - *wl* value = yes or no - *wl/hat* value = yes or no + *wl* value = *yes* or *no* + *wl/hat* value = *yes* or *no* *components* value = ldegree *chunksize* value = number of atoms in each pass diff --git a/doc/src/compute_saed.rst b/doc/src/compute_saed.rst index 37ee302f8f..6704d8f0d6 100644 --- a/doc/src/compute_saed.rst +++ b/doc/src/compute_saed.rst @@ -41,8 +41,8 @@ Examples compute 1 all saed 0.0251 Al O Kmax 1.70 Zone 0 0 1 dR_Ewald 0.01 c 0.5 0.5 0.5 compute 2 all saed 0.0251 Ni Kmax 1.70 Zone 0 0 0 c 0.05 0.05 0.05 manual echo - fix saed/vtk 1 1 1 c_1 file Al2O3_001.saed - fix saed/vtk 1 1 1 c_2 file Ni_000.saed + fix 1 all saed/vtk 1 1 1 c_1 file Al2O3_001.saed + fix 2 all saed/vtk 1 1 1 c_2 file Ni_000.saed Description """"""""""" diff --git a/doc/src/compute_smd_triangle_vertices.rst b/doc/src/compute_smd_triangle_vertices.rst index 9f478b7262..d1aebfb29e 100644 --- a/doc/src/compute_smd_triangle_vertices.rst +++ b/doc/src/compute_smd_triangle_vertices.rst @@ -18,7 +18,7 @@ Examples .. code-block:: LAMMPS - compute 1 all smd/triangle/mesh/vertices + compute 1 all smd/triangle/vertices Description """"""""""" diff --git a/doc/src/create_bonds.rst b/doc/src/create_bonds.rst index 664d870cb0..1f468dd42a 100644 --- a/doc/src/create_bonds.rst +++ b/doc/src/create_bonds.rst @@ -10,7 +10,7 @@ Syntax create_bonds style args ... keyword value ... -* style = *many* or *single/bond* or *single/angle* or *single/dihedral* +* style = *many* or *single/bond* or *single/angle* or *single/dihedral* or *single/improper* .. parsed-literal:: diff --git a/doc/src/delete_atoms.rst b/doc/src/delete_atoms.rst index 9777f16cc9..f70570c040 100644 --- a/doc/src/delete_atoms.rst +++ b/doc/src/delete_atoms.rst @@ -55,7 +55,7 @@ Examples delete_atoms random fraction 0.1 yes all cube 482793 bond yes delete_atoms random fraction 0.3 no polymer NULL 482793 bond yes delete_atoms random count 500 no ions NULL 482793 - detele_atoms variable checkers + delete_atoms variable checkers Description """"""""""" diff --git a/doc/src/dihedral_zero.rst b/doc/src/dihedral_zero.rst index 0f481f917d..8c741faaf3 100644 --- a/doc/src/dihedral_zero.rst +++ b/doc/src/dihedral_zero.rst @@ -8,7 +8,10 @@ Syntax .. code-block:: LAMMPS - dihedral_style zero [nocoeff] + dihedral_style zero keyword + +* zero or more keywords may be appended +* keyword = *nocoeff* Examples """""""" diff --git a/doc/src/displace_atoms.rst b/doc/src/displace_atoms.rst index 9916126dad..fb9239d9de 100644 --- a/doc/src/displace_atoms.rst +++ b/doc/src/displace_atoms.rst @@ -36,7 +36,7 @@ Syntax .. parsed-literal:: keyword = *units* - value = *box* or *lattice* + *units* value = *box* or *lattice* Examples """""""" diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 778b6f6682..b0b7b7abae 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -61,7 +61,7 @@ Syntax * ID = user-assigned name for the dump * group-ID = ID of the group of atoms to be dumped -* style = *atom* or *atom/gz* or *atom/zstd or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml* +* style = *atom* or *atom/gz* or *atom/zstd* or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml* * N = dump every this many timesteps * file = name of file to write dump info to * args = list of arguments for a particular style @@ -96,7 +96,7 @@ Syntax *xyz/mpiio* args = none *yaml* args = same as *custom* args, see below -* *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *netcdf* or *netcdf/mpiio* or *yaml* args = list of atom attributes +* *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *netcdf* or *netcdf/mpiio* or *yaml* args = list of atom attributes .. parsed-literal:: diff --git a/doc/src/dump_h5md.rst b/doc/src/dump_h5md.rst index 202d5fb89d..37fc7ad600 100644 --- a/doc/src/dump_h5md.rst +++ b/doc/src/dump_h5md.rst @@ -6,31 +6,31 @@ dump h5md command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump ID group-ID h5md N file.h5 args * ID = user-assigned name for the dump * group-ID = ID of the group of atoms to be imaged -* h5md = style of dump command (other styles *atom* or *cfg* or *dcd* or *xtc* or *xyz* or *local* or *custom* are discussed on the :doc:`dump ` doc page) +* *h5md* = style of dump command (other styles *atom* or *cfg* or *dcd* or *xtc* or *xyz* or *local* or *custom* are discussed on the :doc:`dump ` doc page) * N = dump every this many timesteps * file.h5 = name of file to write to +* args = *position* options or *image* or *velocity* options or *force* options or *species* options or *file_from* ID or *box* value or *create_group* value or *author* value = list of data elements to dump, with their dump "sub-intervals" -.. parsed-literal:: + .. parsed-literal:: - args = list of data elements to dump, with their dump "sub-intervals" - position options - image - velocity options - force options - species options - file_from ID: do not open a new file, re-use the already opened file from dump ID - box value = *yes* or *no* - create_group value = *yes* or *no* - author value = quoted string + *position* options + *image* + *velocity* options + *force* options + *species* options + *file_from* ID = do not open a new file, re-use the already opened file from dump ID + *box* value = *yes* or *no* + *create_group* value = *yes* or *no* + *author* value = quoted string -Note that at least one element must be specified and image may only be -present if position is specified first. +Note that at least one element must be specified and that *image* may only be +present if *position* is specified first. For the elements *position*, *velocity*, *force* and *species*, a sub-interval may be specified to write the data only every N_element @@ -39,7 +39,7 @@ specified by this option directly following the element declaration: .. parsed-literal:: - every N_element + options = *every* N_element Examples """""""" diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst index 9b16a7c133..a243b0b839 100644 --- a/doc/src/dump_image.rst +++ b/doc/src/dump_image.rst @@ -56,7 +56,7 @@ Syntax phi = azimuthal view angle (degrees) theta or phi can be a variable (see below) *center* values = flag Cx Cy Cz = center point of image - flag = "s" for static, "d" for dynamic + flag = *s* for static, *d* for dynamic Cx,Cy,Cz = center point of image as fraction of box dimension (0.5 = center of box) Cx,Cy,Cz can be variables (see below) *up* values = Ux Uy Uz = direction that is "up" in image @@ -110,13 +110,13 @@ Syntax *amap* args = lo hi style delta N entry1 entry2 ... entryN lo = number or *min* = lower bound of range of color map hi = number or *max* = upper bound of range of color map - style = 2 letters = "c" or "d" or "s" plus "a" or "f" - "c" for continuous - "d" for discrete - "s" for sequential - "a" for absolute - "f" for fractional - delta = binsize (only used for style "s", otherwise ignored) + style = 2 letters = *c* or *d* or *s* plus *a* or *f* + *c* for continuous + *d* for discrete + *s* for sequential + *a* for absolute + *f* for fractional + delta = binsize (only used for style *s*, otherwise ignored) binsize = range is divided into bins of this width N = # of subsequent entries entry = value color (for continuous style) diff --git a/doc/src/fix_electrode_conp.rst b/doc/src/fix_electrode_conp.rst index 75b099995f..e070433c07 100644 --- a/doc/src/fix_electrode_conp.rst +++ b/doc/src/fix_electrode_conp.rst @@ -25,38 +25,47 @@ Syntax .. parsed-literal:: - fix ID group-ID electrode/conp potential eta keyword values ... - fix ID group-ID electrode/conq charge eta keyword values ... - fix ID group-ID electrode/thermo potential eta temp T_v tau_v rng_v keyword values ... + fix ID group-ID style args keyword value ... -* ID, group-ID are documented in fix command -* mode = electrode/conp or electrode/conq or electrode/thermo -* potential = electrode potential -* charge = electrode charge -* eta = reciprocal width of electrode charge smearing -* T_v = temperature of thermo-potentiostat -* tau_v = time constant of thermo-potentiostat -* rng_v = integer used to initialize random number generator +* ID, group-ID are documented in :doc:`fix ` command +* style = *electrode/conp* or *electrode/conq* or *electrode/thermo* +* args = arguments used by a particular style + + .. parsed-literal:: + + *electrode/conp* args = potential eta + *electrode/conq* args = charge eta + *electrode/thermo* args = potential eta *temp* values + potential = electrode potential + charge = electrode charge + eta = reciprocal width of electrode charge smearing + *temp* values = T_v tau_v rng_v + T_v = temperature of thermo-potentiostat + tau_v = time constant of thermo-potentiostat + rng_v = integer used to initialize random number generator + +* zero or more keyword/value pairs may be appended +* keyword = *symm* or *couple* or *etypes* or *ffield* or *write_mat* or *write_inv* or *read_mat* or *read_inv* .. parsed-literal:: - *symm(etry) on/off* + *symm* value = *on* or *off* turn on/off charge neutrality constraint for the electrodes - *couple group-ID value* + *couple* values = group-ID val group-ID = group of atoms treated as additional electrode - value = electric potential or charge on this electrode - *etypes values = atom types* - specify atom types exclusive to the electrode for optimized neighbor lists - *ffield on/off* + val = electric potential or charge on this electrode + *etypes* values = type + type = atom type (can be a range) exclusive to the electrode for optimized neighbor lists + *ffield* value = *on* or *off* turn on/off finite-field implementation - *write_mat filename* - write elastance matrix to file - *write_inv filename* - write inverted matrix to file - *read_mat filename* - read elastance matrix from file - *read_inv filename* - read inverted matrix from file + *write_mat* value = filename + filename = file to which to write elastance matrix + *write_inv* value = filename + filename = file to which to write inverted matrix + *read_mat* value = filename + filename = file from which to read elastance matrix + *read_inv* value = filename + filename = file from which to read inverted matrix Examples """""""" diff --git a/doc/src/fix_flow_gauss.rst b/doc/src/fix_flow_gauss.rst index 3697142a37..87ab283923 100644 --- a/doc/src/fix_flow_gauss.rst +++ b/doc/src/fix_flow_gauss.rst @@ -24,9 +24,9 @@ Syntax .. parsed-literal:: - *energy* value = no or yes - no = do not compute work done by this fix - yes = compute work done by this fix + *energy* value = *no* or *yes* + *no* = do not compute work done by this fix + *yes* = compute work done by this fix Examples """""""" diff --git a/doc/src/fix_ipi.rst b/doc/src/fix_ipi.rst index bd4b4d84e8..6ddd6976a2 100644 --- a/doc/src/fix_ipi.rst +++ b/doc/src/fix_ipi.rst @@ -14,8 +14,14 @@ Syntax * ipi = style name of this fix command * address = internet address (FQDN or IP), or UNIX socket name * port = port number (ignored for UNIX sockets) -* optional keyword = *unix*, if present uses a unix socket -* optional keyword = *reset*, if present reset electrostatics at each call + +* zero or more keywords may be appended +* keyword = *unix* or *reset* + + .. parsed-literal:: + + *unix* args = none = use a unix socket + *reset* args = none = reset electrostatics at each call Examples """""""" diff --git a/doc/src/fix_nh_uef.rst b/doc/src/fix_nh_uef.rst index b51e232a3c..64d406ee64 100644 --- a/doc/src/fix_nh_uef.rst +++ b/doc/src/fix_nh_uef.rst @@ -22,13 +22,14 @@ Syntax .. parsed-literal:: - keyword = *ext* or *strain* or *iso* or *x* or *y* or *z* or *tchain* or *pchain* or *tloop* or *ploop* or *mtk* + keyword = *erate* or *ext* or *strain* or *temp* or *iso* or *x* or *y* or *z* or *tchain* or *pchain* or *tloop* or *ploop* or *mtk* + *erate* values = e_x e_y = engineering strain rates (required) *ext* value = *x* or *y* or *z* or *xy* or *yz* or *xz* = external dimensions sets the external dimensions used to calculate the scalar pressure *strain* values = e_x e_y = initial strain usually not needed, but may be needed to resume a run with a data file. - *iso*, *x*, *y*, *z*, *tchain*, *pchain*, *tloop*, *ploop*, *mtk* keywords - documented by the :doc:`fix npt ` command + *temp*, *iso*, *x*, *y*, *z*, *tchain*, *pchain*, *tloop*, *ploop*, *mtk* + keywords documented by the :doc:`fix npt ` command Examples """""""" diff --git a/doc/src/fix_oneway.rst b/doc/src/fix_oneway.rst index 4c5afb29cf..272797fa17 100644 --- a/doc/src/fix_oneway.rst +++ b/doc/src/fix_oneway.rst @@ -21,9 +21,9 @@ Examples .. code-block:: LAMMPS - fix ions oneway 10 semi -x - fix all oneway 1 left -z - fix all oneway 1 right z + fix 1 ions oneway 10 semi -x + fix 2 all oneway 1 left -z + fix 3 all oneway 1 right z Description """"""""""" diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index 09286cca38..3eb9365f57 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -15,18 +15,18 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * property/atom = style name of this fix command -* name1,name2,... = *mol* or *q* or *rmass* or *i_name* or *d_name* or *i2_name* or *d2_name* +* name1,name2,... = *mol* or *q* or *rmass* or i_name or d_name or i2_name or d2_name .. parsed-literal:: *mol* = molecule IDs *q* = charge *rmass* = per-atom mass - *i_name* = new integer vector referenced by name - *d_name* = new floating-point vector referenced by name - *i2_name* = new integer array referenced by name + i_name = new integer vector referenced by name + d_name = new floating-point vector referenced by name + i2_name = new integer array referenced by name i2_name arg = N = number of columns in the array - *d2_name* = new floating-point array referenced by name + d2_name = new floating-point array referenced by name d2_name arg = N = number of columns in the array * zero of more keyword/value pairs may be appended diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 1f722aff7b..445b86466c 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -88,7 +88,7 @@ Syntax Tstart,Tstop = desired temperature at start/stop of run (temperature units) Tdamp = temperature damping parameter (time units) seed = random number seed to use for white noise (positive integer) - *reinit* = *yes* or *no* + *reinit* value = *yes* or *no* *temp* values = Tstart Tstop Tdamp Tstart,Tstop = desired temperature at start/stop of run (temperature units) Tdamp = temperature damping parameter (time units) @@ -98,7 +98,7 @@ Syntax *x* or *y* or *z* values = Pstart Pstop Pdamp Pstart,Pstop = external stress tensor component at start/end of run (pressure units) Pdamp = stress damping parameter (time units) - *couple* = *none* or *xyz* or *xy* or *yz* or *xz* + *couple* value = *none* or *xyz* or *xy* or *yz* or *xz* *tparam* values = Tchain Titer Torder Tchain = length of Nose/Hoover thermostat chain Titer = number of thermostat iterations performed diff --git a/doc/src/group2ndx.rst b/doc/src/group2ndx.rst index 7d66db367b..e465c4629f 100644 --- a/doc/src/group2ndx.rst +++ b/doc/src/group2ndx.rst @@ -1,4 +1,5 @@ .. index:: group2ndx +.. index:: ndx2group group2ndx command ================= diff --git a/doc/src/if.rst b/doc/src/if.rst index 91b001fbdc..d40eca0ba8 100644 --- a/doc/src/if.rst +++ b/doc/src/if.rst @@ -25,7 +25,7 @@ Examples if "${steps} > 1000" then quit if "${myString} == a10" then quit - if "$x <= $y" then "print X is smaller = $x" else "print Y is smaller = $y" + if "$x <= $y" then "print 'X is smaller = $x'" else "print 'Y is smaller = $y'" if "(${eng} > 0.0) || ($n < 1000)" then & "timestep 0.005" & elif $n<10000 & diff --git a/doc/src/improper_hybrid.rst b/doc/src/improper_hybrid.rst index 7c070d2e9c..a829d9989c 100644 --- a/doc/src/improper_hybrid.rst +++ b/doc/src/improper_hybrid.rst @@ -17,7 +17,7 @@ Examples .. code-block:: LAMMPS - improper_style hybrid harmonic helix + improper_style hybrid harmonic cvff improper_coeff 1 harmonic 120.0 30 improper_coeff 2 cvff 20.0 -1 2 diff --git a/doc/src/neigh_modify.rst b/doc/src/neigh_modify.rst index d6fa12f713..d99a3187aa 100644 --- a/doc/src/neigh_modify.rst +++ b/doc/src/neigh_modify.rst @@ -22,24 +22,24 @@ Syntax *check* value = *yes* or *no* *yes* = only build if some atom has moved half the skin distance or more *no* = always build on 1st step that *every* and *delay* are satisfied - *once* + *once* value = *yes* or *no* *yes* = only build neighbor list once at start of run and never rebuild *no* = rebuild neighbor list according to other settings - *cluster* + *cluster* value = *yes* or *no* *yes* = check bond,angle,etc neighbor list for nearby clusters *no* = do not check bond,angle,etc neighbor list for nearby clusters *include* value = group-ID group-ID = only build pair neighbor lists for atoms in this group *exclude* values: - type M N + *type* M N M,N = exclude if one atom in pair is type M, other is type N - group group1-ID group2-ID + *group* group1-ID group2-ID group1-ID,group2-ID = exclude if one atom is in 1st group, other in 2nd - molecule/intra group-ID + *molecule/intra* group-ID group-ID = exclude if both atoms are in the same molecule and in group - molecule/inter group-ID + *molecule/inter* group-ID group-ID = exclude if both atoms are in different molecules and in group - none + *none* delete all exclude settings *page* value = N N = number of pairs stored in a single neighbor page diff --git a/doc/src/package.rst b/doc/src/package.rst index 0810bd5b6b..84dab41ab3 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -18,16 +18,16 @@ Syntax *gpu* args = Ngpu keyword value ... Ngpu = # of GPUs per node zero or more keyword/value pairs may be appended - keywords = *neigh* or *newton* or *pair/only* or *binsize* or *split* or *gpuID* or *tpa* or *blocksize* or *platform* or *device_type* or *ocl_args* + keywords = *neigh* or *newton* or *pair/only* or *binsize* or *split* or *gpuID* or *tpa* or *blocksize* or *omp* or *platform* or *device_type* or *ocl_args* *neigh* value = *yes* or *no* - yes = neighbor list build on GPU (default) - no = neighbor list build on CPU + *yes* = neighbor list build on GPU (default) + *no* = neighbor list build on CPU *newton* = *off* or *on* - off = set Newton pairwise flag off (default and required) - on = set Newton pairwise flag on (currently not allowed) + *off* = set Newton pairwise flag off (default and required) + *on* = set Newton pairwise flag on (currently not allowed) *pair/only* = *off* or *on* - off = apply "gpu" suffix to all available styles in the GPU package (default) - on = apply "gpu" suffix only pair styles + *off* = apply "gpu" suffix to all available styles in the GPU package (default) + *on* = apply "gpu" suffix only pair styles *binsize* value = size size = bin size for neighbor list construction (distance units) *split* = fraction @@ -42,7 +42,7 @@ Syntax id = For OpenCL, platform ID for the GPU or accelerator *gpuID* values = id id = ID of first GPU to be used on each node - *device_type* value = *intelgpu* or *nvidiagpu* or *amdgpu* or *applegpu* or *generic* or *custom,val1,val2,...* + *device_type* value = *intelgpu* or *nvidiagpu* or *amdgpu* or *applegpu* or *generic* or *custom*,val1,val2,... val1,val2,... = custom OpenCL accelerator configuration parameters (see below for details) *ocl_args* value = args args = List of additional OpenCL compiler arguments delimited by colons @@ -57,13 +57,13 @@ Syntax *omp* value = Nthreads Nthreads = number of OpenMP threads to use on CPU (default = 0) *lrt* value = *yes* or *no* - yes = use additional thread dedicated for some PPPM calculations - no = do not dedicate an extra thread for some PPPM calculations + *yes* = use additional thread dedicated for some PPPM calculations + *no* = do not dedicate an extra thread for some PPPM calculations *balance* value = split split = fraction of work to offload to co-processor, -1 for dynamic *ghost* value = *yes* or *no* - yes = include ghost atoms for offload - no = do not include ghost atoms for offload + *yes* = include ghost atoms for offload + *no* = do not include ghost atoms for offload *tpc* value = Ntpc Ntpc = max number of co-processor threads per co-processor core (default = 4) *tptask* value = Ntptask @@ -71,7 +71,7 @@ Syntax *no_affinity* values = none *kokkos* args = keyword value ... zero or more keyword/value pairs may be appended - keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* *comm/pair/forward* *comm/fix/forward* or *comm/reverse* or *comm/pair/reverse* or *gpu/aware* or *pair/only* + keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *neigh/transpose* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* or *comm/pair/forward* or *comm/fix/forward* or *comm/reverse* or *comm/pair/reverse* or *gpu/aware* or *pair/only* *neigh* value = *full* or *half* full = full neighbor list half = half neighbor list built in thread-safe manner @@ -79,14 +79,14 @@ Syntax full = full neighbor list half = half neighbor list built in thread-safe manner *neigh/thread* value = *off* or *on* - off = thread only over atoms - on = thread over both atoms and neighbors + *off* = thread only over atoms + *on* = thread over both atoms and neighbors *neigh/transpose* value = *off* or *on* - off = use same memory layout for GPU neigh list build as pair style - on = use transposed memory layout for GPU neigh list build + *off* = use same memory layout for GPU neigh list build as pair style + *on* = use transposed memory layout for GPU neigh list build *newton* = *off* or *on* - off = set Newton pairwise and bonded flags off - on = set Newton pairwise and bonded flags on + *off* = set Newton pairwise and bonded flags off + *on* = set Newton pairwise and bonded flags on *binsize* value = size size = bin size for neighbor list construction (distance units) *comm* value = *no* or *host* or *device* @@ -96,23 +96,25 @@ Syntax *comm/pair/forward* value = *no* or *device* *comm/fix/forward* value = *no* or *device* *comm/reverse* value = *no* or *host* or *device* + *no* = perform communication pack/unpack in non-KOKKOS mode + *host* = perform pack/unpack on host (e.g. with OpenMP threading) + *device* = perform pack/unpack on device (e.g. on GPU) *comm/pair/reverse* value = *no* or *device* - no = perform communication pack/unpack in non-KOKKOS mode - host = perform pack/unpack on host (e.g. with OpenMP threading) - device = perform pack/unpack on device (e.g. on GPU) + *no* = perform communication pack/unpack in non-KOKKOS mode + *device* = perform pack/unpack on device (e.g. on GPU) *gpu/aware* = *off* or *on* - off = do not use GPU-aware MPI - on = use GPU-aware MPI (default) + *off* = do not use GPU-aware MPI + *on* = use GPU-aware MPI (default) *pair/only* = *off* or *on* - off = use device acceleration (e.g. GPU) for all available styles in the KOKKOS package (default) - on = use device acceleration only for pair styles (and host acceleration for others) + *off* = use device acceleration (e.g. GPU) for all available styles in the KOKKOS package (default) + *on* = use device acceleration only for pair styles (and host acceleration for others) *omp* args = Nthreads keyword value ... Nthreads = # of OpenMP threads to associate with each MPI process zero or more keyword/value pairs may be appended keywords = *neigh* *neigh* value = *yes* or *no* - yes = threaded neighbor list build (default) - no = non-threaded neighbor list build + *yes* = threaded neighbor list build (default) + *no* = non-threaded neighbor list build Examples """""""" diff --git a/doc/src/pair_brownian.rst b/doc/src/pair_brownian.rst index 780a181a69..162187210d 100644 --- a/doc/src/pair_brownian.rst +++ b/doc/src/pair_brownian.rst @@ -36,7 +36,7 @@ Examples .. code-block:: LAMMPS - pair_style brownian 1.5 1 1 2.01 2.5 2.0 5878567 (assuming radius = 1) + pair_style brownian 1.5 1 1 2.01 2.5 2.0 5878567 # (assuming radius = 1) pair_coeff 1 1 2.05 2.8 pair_coeff * * diff --git a/doc/src/pair_coeff.rst b/doc/src/pair_coeff.rst index 147b9177ec..9b9bedd63d 100644 --- a/doc/src/pair_coeff.rst +++ b/doc/src/pair_coeff.rst @@ -24,7 +24,7 @@ Examples pair_coeff * * 1.0 1.0 pair_coeff * * nialhjea 1 1 2 pair_coeff * 3 morse.table ENTRY1 - pair_coeff 1 2 lj/cut 1.0 1.0 2.5 (for pair_style hybrid) + pair_coeff 1 2 lj/cut 1.0 1.0 2.5 # (for pair_style hybrid) Description """"""""""" diff --git a/doc/src/pair_rann.rst b/doc/src/pair_rann.rst index a9ad5d9236..5bfac561ba 100644 --- a/doc/src/pair_rann.rst +++ b/doc/src/pair_rann.rst @@ -17,8 +17,8 @@ Examples .. code-block:: LAMMPS pair_style rann - pair_coeff ** Mg.rann Mg - pair_coeff ** MgAlalloy.rann Mg Mg Al Mg + pair_coeff * * Mg.rann Mg + pair_coeff * * MgAlalloy.rann Mg Mg Al Mg Description """"""""""" diff --git a/doc/src/thermo_modify.rst b/doc/src/thermo_modify.rst index 10b3a44f4f..2600b337bc 100644 --- a/doc/src/thermo_modify.rst +++ b/doc/src/thermo_modify.rst @@ -11,7 +11,7 @@ Syntax thermo_modify keyword value ... * one or more keyword/value pairs may be listed -* keyword = *lost* or *lost/bond* or *warn* or *norm* or *flush* or *line* or *format* or *temp* or *press* +* keyword = *lost* or *lost/bond* or *warn* or *norm* or *flush* or *line* or *colname* or *format* or *temp* or *press* .. parsed-literal:: diff --git a/doc/src/variable.rst b/doc/src/variable.rst index d5c05a205e..3986624c3b 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -66,7 +66,7 @@ Syntax bound(group,dir,region), gyration(group,region), ke(group,reigon), angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) - special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), extract_setting(name) + special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name) feature functions = is_active(category,feature), is_available(category,feature), is_defined(category,id) atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q @@ -939,6 +939,20 @@ The is_file(name) function is a test whether *name* is a (readable) file and returns 1 in this case, otherwise it returns 0. For that *name* is taken as a literal string and must not have any blanks in it. +The is_os(name) function is a test whether *name* is part of the OS +information that LAMMPS collects and provides in the +:cpp:func:`platform::os_info() ` function. +The argument *name* is interpreted as a regular expression as documented +for the :cpp:func:`utils::strmatch() ` +function. This allows to adapt LAMMPS inputs to the OS it runs on: + +.. code-block:: LAMMPS + + if $(is_os(^Windows)) then & + "shell copy ${input_dir}\some_file.txt ." & + else & + "shell cp ${input_dir}/some_file.txt ." + The extract_setting(name) function enables access to basic settings for the LAMMPS executable and the running simulation via calling the :cpp:func:`lammps_extract_setting` library function. For example, the @@ -1002,7 +1016,7 @@ step .. code-block:: LAMMPS - timestep $(2.0*(1.0+2.0*is_active(pair,respa)) + timestep $(2.0*(1.0+2.0*is_active(pair,respa))) if $(is_active(pair,respa)) then "run_style respa 4 3 2 2 improper 1 inner 2 5.5 7.0 outer 3 kspace 4" else "run_style respa 3 3 2 improper 1 pair 2 kspace 3" The *is_available(category,name)* function allows to query whether diff --git a/doc/utils/sphinx-config/_static/css/lammps.css b/doc/utils/sphinx-config/_static/css/lammps.css index 900054eeeb..cbf08c3da1 100644 --- a/doc/utils/sphinx-config/_static/css/lammps.css +++ b/doc/utils/sphinx-config/_static/css/lammps.css @@ -39,6 +39,18 @@ hr { display: none; } +#userdoc.toctree-wrapper.compound p { + display: none; +} + +#progdoc.toctree-wrapper.compound p { + display: none; +} + +#reference.toctree-wrapper.compound p { + display: none; +} + .ui.tabular.menu .item { padding-right: 1em; padding-left: 1em; diff --git a/examples/COUPLE/fortran2/LAMMPS.F90 b/examples/COUPLE/fortran2/LAMMPS.F90 index 251b56f48f..86e5a4ba2d 100644 --- a/examples/COUPLE/fortran2/LAMMPS.F90 +++ b/examples/COUPLE/fortran2/LAMMPS.F90 @@ -1105,7 +1105,7 @@ contains !! Wrapper functions local to this module {{{1 C_xy = xy C_xz = xz C_yz = yz - call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_xz, C_yz) + call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, C_xz) end subroutine lammps_reset_box ! lammps_gather_atoms {{{2 diff --git a/examples/COUPLE/fortran2/README b/examples/COUPLE/fortran2/README index 0a7b862d86..3f88d60750 100644 --- a/examples/COUPLE/fortran2/README +++ b/examples/COUPLE/fortran2/README @@ -40,7 +40,7 @@ the dynamically-linkable library (liblammps_fortran.so). (2) Copy said library to your Fortran program's source directory or replace ${LAMMPS_LIB} with its full path in the instructions below. (3) Compile (but don't link!) LAMMPS.F90. Example: - mpif90 -c LAMMPS.f90 + mpifort -c LAMMPS.f90 OR gfortran -c LAMMPS.F90 NOTE: you may get a warning such as, @@ -72,8 +72,8 @@ the dynamically-linkable library (liblammps_fortran.so). were part of the usual LAMMPS library interface (if you have the module file visible to the compiler, that is). (6) Compile (but don't link) your Fortran program. Example: - mpif90 -c myfreeformatfile.f90 - mpif90 -c myfixedformatfile.f + mpifort -c myfreeformatfile.f90 + mpifort -c myfixedformatfile.f OR gfortran -c myfreeformatfile.f90 gfortran -c myfixedformatfile.f @@ -83,12 +83,12 @@ the dynamically-linkable library (liblammps_fortran.so). IMPORTANT: If the Fortran module from part (3) is not in the current directory or in one searched by the compiler for module files, you will need to include that location via the -I flag to the compiler, like so: - mpif90 -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 + mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 (7) Link everything together, including any libraries needed by LAMMPS (such as the C++ standard library, the C math library, the JPEG library, fftw, etc.) For example, - mpif90 LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ + mpifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ ${LAMMPS_LIB} -lmpi_cxx -lstdc++ -lm OR gfortran LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ @@ -105,17 +105,17 @@ You should now have a working executable. (1) Compile LAMMPS as a dynamic library (make makeshlib && make -f Makefile.shlib [targetname]). (2) Compile, but don't link, LAMMPS.F90 using the -fPIC flag, such as - mpif90 -fPIC -c LAMMPS.f90 + mpifort -fPIC -c LAMMPS.f90 (3) Compile, but don't link, LAMMPS-wrapper.cpp in the same manner, e.g. mpicxx -fPIC -c LAMMPS-wrapper.cpp (4) Make the dynamic library, like so: - mpif90 -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o + mpifort -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o (5) Compile your program, such as, - mpif90 -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 + mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 where ${LAMMPS_SRC}/examples/COUPLE/fortran2 contains the .mod file from step (3) (6) Link everything together, such as - mpif90 ${my_object_files} -L${LAMMPS_SRC} \ + mpifort ${my_object_files} -L${LAMMPS_SRC} \ -L${LAMMPS_SRC}/examples/COUPLE/fortran2 -llammps_fortran \ -llammps_openmpi -lmpi_cxx -lstdc++ -lm diff --git a/examples/neb/in.neb.hop1 b/examples/neb/in.neb.hop1 index f26b52a28a..54a22a5b87 100644 --- a/examples/neb/in.neb.hop1 +++ b/examples/neb/in.neb.hop1 @@ -1,66 +1,66 @@ # 2d NEB surface simulation, hop from surface to become adatom -dimension 2 -boundary p s p +dimension 2 +boundary p s p -atom_style atomic -neighbor 0.3 bin -neigh_modify delay 5 -atom_modify map array sort 0 0.0 +atom_style atomic +neighbor 0.3 bin +neigh_modify delay 5 +atom_modify map array sort 0 0.0 -variable u uloop 20 +variable u uloop 20 # create geometry with flat surface -lattice hex 0.9 -region box block 0 20 0 10 -0.25 0.25 +lattice hex 0.9 +region box block 0 20 0 10 -0.25 0.25 -#create_box 3 box -#create_atoms 1 box -#mass * 1.0 +#create_box 3 box +#create_atoms 1 box +#mass * 1.0 #write_data initial.hop1 read_data initial.hop1 # LJ potentials -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 -pair_modify shift yes +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 +pair_modify shift yes # initial minimization to relax surface -minimize 1.0e-6 1.0e-4 1000 10000 -reset_timestep 0 +minimize 1.0e-6 1.0e-4 1000 10000 +reset_timestep 0 # define groups -region 1 block INF INF INF 1.25 INF INF -group lower region 1 -group mobile subtract all lower -set group lower type 2 +region 1 block INF INF INF 1.25 INF INF +group lower region 1 +group mobile subtract all lower +set group lower type 2 -timestep 0.05 +timestep 0.05 # group of NEB atoms - either block or single atom ID 412 -region surround block 10 18 17 20 0 0 units box -group nebatoms region surround -#group nebatoms id 412 -set group nebatoms type 3 -group nonneb subtract all nebatoms +region surround block 10 18 17 20 0 0 units box +group nebatoms region surround +#group nebatoms id 412 +set group nebatoms type 3 +group nonneb subtract all nebatoms -fix 1 lower setforce 0.0 0.0 0.0 -fix 2 nebatoms neb 1.0 parallel ideal -fix 3 all enforce2d +fix 1 lower setforce 0.0 0.0 0.0 +fix 2 nebatoms neb 1.0 parallel ideal +fix 3 all enforce2d -thermo 100 +thermo 100 -#dump 1 nebatoms atom 10 dump.neb.$u -#dump 2 nonneb atom 10 dump.nonneb.$u +#dump 1 nebatoms atom 10 dump.neb.$u +#dump 2 nonneb atom 10 dump.nonneb.$u # run NEB for 2000 steps or to force tolerance -min_style quickmin +min_style quickmin -neb 0.0 0.1 1000 1000 100 final final.hop1 +neb 0.0 0.1 1000 1000 100 final final.hop1 diff --git a/examples/neb/in.neb.hop1.end b/examples/neb/in.neb.hop1.end index 81e5315306..c5e08b40f1 100644 --- a/examples/neb/in.neb.hop1.end +++ b/examples/neb/in.neb.hop1.end @@ -1,56 +1,56 @@ # 2d NEB surface simulation, hop from surface to become adatom -dimension 2 -boundary p s p +dimension 2 +boundary p s p -atom_style atomic -neighbor 0.3 bin -neigh_modify delay 5 -atom_modify map array sort 0 0.0 +atom_style atomic +neighbor 0.3 bin +neigh_modify delay 5 +atom_modify map array sort 0 0.0 -variable u uloop 20 +variable u uloop 20 # create geometry with flat surface -lattice hex 0.9 -region box block 0 20 0 10 -0.25 0.25 +lattice hex 0.9 +region box block 0 20 0 10 -0.25 0.25 read_data initial.hop1.end # LJ potentials -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 -pair_modify shift yes +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 +pair_modify shift yes # define groups -region 1 block INF INF INF 1.25 INF INF -group lower region 1 -group mobile subtract all lower -set group lower type 2 +region 1 block INF INF INF 1.25 INF INF +group lower region 1 +group mobile subtract all lower +set group lower type 2 -timestep 0.05 +timestep 0.05 # group of NEB atoms - either block or single atom ID 412 -region surround block 10 18 17 20 0 0 units box -group nebatoms region surround -#group nebatoms id 412 -set group nebatoms type 3 -group nonneb subtract all nebatoms +region surround block 10 18 17 20 0 0 units box +group nebatoms region surround +#group nebatoms id 412 +set group nebatoms type 3 +group nonneb subtract all nebatoms -fix 1 lower setforce 0.0 0.0 0.0 -fix 2 nebatoms neb 1.0 parallel ideal end first 1.0 -fix 3 all enforce2d +fix 1 lower setforce 0.0 0.0 0.0 +fix 2 nebatoms neb 1.0 parallel ideal end first 1.0 +fix 3 all enforce2d -thermo 100 +thermo 100 -#dump 1 nebatoms atom 10 dump.neb.$u -#dump 2 nonneb atom 10 dump.nonneb.$u +#dump 1 nebatoms atom 10 dump.neb.$u +#dump 2 nonneb atom 10 dump.nonneb.$u # run NEB for 2000 steps or to force tolerance -min_style quickmin +min_style quickmin -neb 0.0 0.1 1000 1000 100 final final.hop1 +neb 0.0 0.1 1000 1000 100 final final.hop1 diff --git a/examples/neb/in.neb.hop2 b/examples/neb/in.neb.hop2 index e69fb338cd..97512dbbf9 100644 --- a/examples/neb/in.neb.hop2 +++ b/examples/neb/in.neb.hop2 @@ -1,68 +1,68 @@ # 2d NEB surface simulation, hop of adatom on surface -dimension 2 -boundary p s p +dimension 2 +boundary p s p -atom_style atomic -neighbor 0.3 bin -neigh_modify delay 5 -atom_modify map array sort 0 0.0 +atom_style atomic +neighbor 0.3 bin +neigh_modify delay 5 +atom_modify map array sort 0 0.0 -variable u uloop 20 +variable u uloop 20 # create geometry with adatom -lattice hex 0.9 -region box block 0 20 0 11 -0.25 0.25 -region box1 block 0 20 0 10 -0.25 0.25 +lattice hex 0.9 +region box block 0 20 0 11 -0.25 0.25 +region box1 block 0 20 0 10 -0.25 0.25 -#create_box 3 box -#create_atoms 1 region box1 -#create_atoms 1 single 11.5 10.5 0 -#mass * 1.0 +#create_box 3 box +#create_atoms 1 region box1 +#create_atoms 1 single 11.5 10.5 0 +#mass * 1.0 #write_data initial.hop2 read_data initial.hop2 # LJ potentials -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 -pair_modify shift yes +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 +pair_modify shift yes # initial minimization to relax surface -minimize 1.0e-6 1.0e-4 1000 10000 -reset_timestep 0 +minimize 1.0e-6 1.0e-4 1000 10000 +reset_timestep 0 # define groups -region 1 block INF INF INF 1.25 INF INF -group lower region 1 -group mobile subtract all lower -set group lower type 2 +region 1 block INF INF INF 1.25 INF INF +group lower region 1 +group mobile subtract all lower +set group lower type 2 -timestep 0.05 +timestep 0.05 # group of NEB atoms - either block or single atom ID 421 -region surround block 10 18 17 21 0 0 units box -group nebatoms region surround -#group nebatoms id 421 -set group nebatoms type 3 -group nonneb subtract all nebatoms +region surround block 10 18 17 21 0 0 units box +group nebatoms region surround +#group nebatoms id 421 +set group nebatoms type 3 +group nonneb subtract all nebatoms -fix 1 lower setforce 0.0 0.0 0.0 -fix 2 nebatoms neb 1.0 -fix 3 all enforce2d +fix 1 lower setforce 0.0 0.0 0.0 +fix 2 nebatoms neb 1.0 +fix 3 all enforce2d -thermo 100 +thermo 100 -#dump 1 nebatoms atom 10 dump.neb.$u -#dump 2 nonneb atom 10 dump.nonneb.$u +#dump 1 nebatoms atom 10 dump.neb.$u +#dump 2 nonneb atom 10 dump.nonneb.$u # run NEB for 2000 steps or to force tolerance -min_style fire +min_style fire -neb 0.0 0.05 1000 1000 100 final final.hop2 +neb 0.0 0.05 1000 1000 100 final final.hop2 diff --git a/examples/neb/in.neb.sivac b/examples/neb/in.neb.sivac index 941d063b90..22492328c6 100644 --- a/examples/neb/in.neb.sivac +++ b/examples/neb/in.neb.sivac @@ -5,7 +5,7 @@ units metal atom_style atomic atom_modify map array boundary p p p -atom_modify sort 0 0.0 +atom_modify sort 0 0.0 # coordination number cutoff @@ -45,7 +45,7 @@ group Si type 1 group del id 300 delete_atoms group del compress no group vacneigh id 174 175 301 304 306 331 337 - + # choose potential pair_style sw @@ -53,26 +53,26 @@ pair_coeff * * Si.sw Si # set up neb run -variable u uloop 20 +variable u uloop 20 + +# initial minimization to relax vacancy + +displace_atoms all random 0.1 0.1 0.1 123456 +minimize 1.0e-6 1.0e-4 1000 10000 + +reset_timestep 0 # only output atoms near vacancy #dump events vacneigh custom 1000 dump.neb.sivac.$u id type x y z -# initial minimization to relax vacancy +fix 1 all neb 1.0 -displace_atoms all random 0.1 0.1 0.1 123456 -minimize 1.0e-6 1.0e-4 1000 10000 - -reset_timestep 0 - -fix 1 all neb 1.0 - -thermo 100 +thermo 100 # run NEB for 2000 steps or to force tolerance timestep 0.01 -min_style quickmin +min_style quickmin -neb 0.0 0.01 100 100 10 final final.sivac +neb 0.0 0.01 100 100 10 final final.sivac diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index 2e78cdd00b..144fd15652 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -54,20 +54,18 @@ MODULE LIBLAMMPS ! interface definitions for calling functions in library.cpp INTERFACE - FUNCTION lammps_open(argc,argv,comm) & - BIND(C, name='lammps_open_fortran') + FUNCTION lammps_open(argc, argv, comm) BIND(C, name='lammps_open_fortran') IMPORT :: c_ptr, c_int INTEGER(c_int), VALUE, INTENT(in) :: argc, comm TYPE(c_ptr), DIMENSION(*), INTENT(in) :: argv TYPE(c_ptr) :: lammps_open END FUNCTION lammps_open - FUNCTION lammps_open_no_mpi(argc,argv,handle) & - BIND(C, name='lammps_open_no_mpi') + FUNCTION lammps_open_no_mpi(argc, argv, handle) BIND(C, name='lammps_open_no_mpi') IMPORT :: c_ptr, c_int INTEGER(c_int), VALUE, INTENT(in) :: argc TYPE(c_ptr), DIMENSION(*), INTENT(in) :: argv - TYPE(c_ptr), INTENT(out) :: handle + TYPE(c_ptr), VALUE, INTENT(in) :: handle TYPE(c_ptr) :: lammps_open_no_mpi END FUNCTION lammps_open_no_mpi @@ -85,28 +83,26 @@ MODULE LIBLAMMPS SUBROUTINE lammps_kokkos_finalize() BIND(C, name='lammps_kokkos_finalize') END SUBROUTINE lammps_kokkos_finalize - SUBROUTINE lammps_file(handle,filename) BIND(C, name='lammps_file') + SUBROUTINE lammps_file(handle, filename) BIND(C, name='lammps_file') IMPORT :: c_ptr TYPE(c_ptr), VALUE :: handle TYPE(c_ptr), VALUE :: filename END SUBROUTINE lammps_file - SUBROUTINE lammps_command(handle,cmd) BIND(C, name='lammps_command') + SUBROUTINE lammps_command(handle, cmd) BIND(C, name='lammps_command') IMPORT :: c_ptr TYPE(c_ptr), VALUE :: handle TYPE(c_ptr), VALUE :: cmd END SUBROUTINE lammps_command - SUBROUTINE lammps_commands_list(handle,ncmd,cmds) & - BIND(C, name='lammps_commands_list') + SUBROUTINE lammps_commands_list(handle, ncmd, cmds) BIND(C, name='lammps_commands_list') IMPORT :: c_ptr, c_int TYPE(c_ptr), VALUE :: handle INTEGER(c_int), VALUE, INTENT(in) :: ncmd TYPE(c_ptr), DIMENSION(*), INTENT(in) :: cmds END SUBROUTINE lammps_commands_list - SUBROUTINE lammps_commands_string(handle,str) & - BIND(C, name='lammps_commands_string') + SUBROUTINE lammps_commands_string(handle, str) BIND(C, name='lammps_commands_string') IMPORT :: c_ptr TYPE(c_ptr), VALUE :: handle TYPE(c_ptr), VALUE :: str @@ -137,24 +133,22 @@ MODULE LIBLAMMPS END INTERFACE CONTAINS - ! Fortran wrappers and helper functions. ! Constructor for the LAMMPS class. ! Combined wrapper around lammps_open_fortran() and lammps_open_no_mpi() - TYPE(lammps) FUNCTION lmp_open(args,comm) + TYPE(lammps) FUNCTION lmp_open(args, comm) IMPLICIT NONE - INTEGER,INTENT(in), OPTIONAL :: comm + INTEGER, INTENT(in), OPTIONAL :: comm CHARACTER(len=*), INTENT(in), OPTIONAL :: args(:) TYPE(c_ptr), ALLOCATABLE :: argv(:) - TYPE(c_ptr) :: dummy=c_null_ptr - INTEGER :: i,argc + INTEGER(c_int) :: i, c_comm, argc IF (PRESENT(args)) THEN - ! convert argument list to c style + ! convert fortran argument list to c style argc = SIZE(args) ALLOCATE(argv(argc)) - DO i=1,argc + DO i=1, argc argv(i) = f2c_string(args(i)) END DO ELSE @@ -164,23 +158,24 @@ CONTAINS ENDIF IF (PRESENT(comm)) THEN - lmp_open%handle = lammps_open(argc,argv,comm) + c_comm = comm + lmp_open%handle = lammps_open(argc, argv, c_comm) ELSE - lmp_open%handle = lammps_open_no_mpi(argc,argv,dummy) + lmp_open%handle = lammps_open_no_mpi(argc, argv, c_null_ptr) END IF ! Clean up allocated memory - DO i=1,argc + DO i=1, argc CALL lammps_free(argv(i)) END DO DEALLOCATE(argv) END FUNCTION lmp_open ! Combined Fortran wrapper around lammps_close() and lammps_mpi_finalize() - SUBROUTINE lmp_close(self,finalize) + SUBROUTINE lmp_close(self, finalize) IMPLICIT NONE CLASS(lammps) :: self - LOGICAL,INTENT(in),OPTIONAL :: finalize + LOGICAL, INTENT(in), OPTIONAL :: finalize CALL lammps_close(self%handle) @@ -206,68 +201,69 @@ CONTAINS lmp_get_natoms = lammps_get_natoms(self%handle) END FUNCTION lmp_get_natoms - SUBROUTINE lmp_file(self,filename) + SUBROUTINE lmp_file(self, filename) IMPLICIT NONE CLASS(lammps) :: self CHARACTER(len=*) :: filename TYPE(c_ptr) :: str str = f2c_string(filename) - CALL lammps_file(self%handle,str) + CALL lammps_file(self%handle, str) CALL lammps_free(str) END SUBROUTINE lmp_file ! equivalent function to lammps_command() - SUBROUTINE lmp_command(self,cmd) + SUBROUTINE lmp_command(self, cmd) IMPLICIT NONE CLASS(lammps) :: self CHARACTER(len=*) :: cmd TYPE(c_ptr) :: str str = f2c_string(cmd) - CALL lammps_command(self%handle,str) + CALL lammps_command(self%handle, str) CALL lammps_free(str) END SUBROUTINE lmp_command ! equivalent function to lammps_commands_list() - SUBROUTINE lmp_commands_list(self,cmds) + SUBROUTINE lmp_commands_list(self, cmds) IMPLICIT NONE CLASS(lammps) :: self CHARACTER(len=*), INTENT(in), OPTIONAL :: cmds(:) TYPE(c_ptr), ALLOCATABLE :: cmdv(:) - INTEGER :: i,ncmd + INTEGER :: i, ncmd ! convert command list to c style ncmd = SIZE(cmds) ALLOCATE(cmdv(ncmd)) - DO i=1,ncmd + DO i=1, ncmd cmdv(i) = f2c_string(cmds(i)) END DO - CALL lammps_commands_list(self%handle,ncmd,cmdv) + CALL lammps_commands_list(self%handle, ncmd, cmdv) ! Clean up allocated memory - DO i=1,ncmd + DO i=1, ncmd CALL lammps_free(cmdv(i)) END DO DEALLOCATE(cmdv) END SUBROUTINE lmp_commands_list ! equivalent function to lammps_commands_string() - SUBROUTINE lmp_commands_string(self,str) + SUBROUTINE lmp_commands_string(self, str) IMPLICIT NONE CLASS(lammps) :: self CHARACTER(len=*) :: str TYPE(c_ptr) :: tmp tmp = f2c_string(str) - CALL lammps_commands_string(self%handle,tmp) + CALL lammps_commands_string(self%handle, tmp) CALL lammps_free(tmp) END SUBROUTINE lmp_commands_string ! ---------------------------------------------------------------------- ! local helper functions ! copy fortran string to zero terminated c string + ! ---------------------------------------------------------------------- FUNCTION f2c_string(f_string) RESULT(ptr) CHARACTER (len=*), INTENT(in) :: f_string CHARACTER (len=1, kind=c_char), POINTER :: c_string(:) @@ -276,8 +272,8 @@ CONTAINS n = LEN_TRIM(f_string) ptr = lammps_malloc(n+1) - CALL C_F_POINTER(ptr,c_string,[1]) - DO i=1,n + CALL C_F_POINTER(ptr, c_string, [1]) + DO i=1, n c_string(i) = f_string(i:i) END DO c_string(n+1) = c_null_char diff --git a/python/lammps/mliap/__init__.py b/python/lammps/mliap/__init__.py index 57fe97d803..cfe3fb6b38 100644 --- a/python/lammps/mliap/__init__.py +++ b/python/lammps/mliap/__init__.py @@ -4,17 +4,29 @@ # try to improperly start up a new interpreter. import sysconfig import ctypes -library = sysconfig.get_config_vars('INSTSONAME')[0] +import platform + +py_ver = sysconfig.get_config_vars('VERSION')[0] +OS_name = platform.system() + +if OS_name == "Linux": + SHLIB_SUFFIX = '.so' + library = 'libpython' + py_ver + SHLIB_SUFFIX +elif OS_name == "Darwin": + SHLIB_SUFFIX = '.dylib' + library = 'libpython' + py_ver + SHLIB_SUFFIX +elif OS_name == "Windows": + SHLIB_SUFFIX = '.dll' + library = 'python' + py_ver + SHLIB_SUFFIX + try: pylib = ctypes.CDLL(library) -except OSError as e: - if pylib.endswith(".a"): - pylib.strip(".a") + ".so" - pylib = ctypes.CDLL(library) - else: - raise e +except Exception as e: + raise OSError("Unable to locate python shared library") from e + if not pylib.Py_IsInitialized(): raise RuntimeError("This interpreter is not compatible with python-based mliap for LAMMPS.") + del sysconfig, ctypes, library, pylib from .loader import load_model, activate_mliappy diff --git a/src/AMOEBA/amoeba_induce.cpp b/src/AMOEBA/amoeba_induce.cpp index c1c2cb1d51..7434c57e27 100644 --- a/src/AMOEBA/amoeba_induce.cpp +++ b/src/AMOEBA/amoeba_induce.cpp @@ -369,7 +369,8 @@ void PairAmoeba::induce() eps = DEBYE * sqrt(eps/atom->natoms); if (eps < poleps) done = true; - if (eps > epsold) done = true; + // also commented out in induce.f of Tinker + // if (eps > epsold) done = true; if (iter >= politer) done = true; // apply a "peek" iteration to the mutual induced dipoles @@ -390,7 +391,7 @@ void PairAmoeba::induce() // terminate the calculation if dipoles failed to converge // NOTE: could make this an error - if (iter >= maxiter || eps > epsold) + if (iter >= politer || eps > epsold) if (comm->me == 0) error->warning(FLERR,"AMOEBA induced dipoles did not converge"); } diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index cc53ff72e6..7e637788ec 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -116,7 +116,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) while (iarg < narg) { if (strcmp(arg[iarg],"d") == 0 || strcmp(arg[iarg],"device") == 0) { if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args"); - device = atoi(arg[iarg+1]); + device = utils::inumeric(FLERR, arg[iarg+1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg],"g") == 0 || @@ -125,11 +125,11 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) error->all(FLERR,"GPUs are requested but Kokkos has not been compiled using a GPU-enabled backend"); #endif if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args"); - ngpus = atoi(arg[iarg+1]); + ngpus = utils::inumeric(FLERR, arg[iarg+1], false, lmp); int skip_gpu = 9999; if (iarg+2 < narg && isdigit(arg[iarg+2][0])) { - skip_gpu = atoi(arg[iarg+2]); + skip_gpu = utils::inumeric(FLERR, arg[iarg+2], false, lmp); iarg++; } iarg += 2; @@ -160,6 +160,12 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (device >= skip_gpu) device++; set_flag = 1; } + if ((str = getenv("PMI_LOCAL_RANK"))) { + int local_rank = atoi(str); + device = local_rank % ngpus; + if (device >= skip_gpu) device++; + set_flag = 1; + } if (ngpus > 1 && !set_flag) error->all(FLERR,"Could not determine local MPI rank for multiple " @@ -167,7 +173,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) } else if (strcmp(arg[iarg],"t") == 0 || strcmp(arg[iarg],"threads") == 0) { - nthreads = atoi(arg[iarg+1]); + nthreads = utils::inumeric(FLERR, arg[iarg+1], false, lmp); if (nthreads <= 0) error->all(FLERR,"Invalid number of threads requested for Kokkos: must be 1 or greater"); @@ -176,19 +182,20 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) } else if (strcmp(arg[iarg],"n") == 0 || strcmp(arg[iarg],"numa") == 0) { - numa = atoi(arg[iarg+1]); + numa = utils::inumeric(FLERR, arg[iarg+1], false, lmp); iarg += 2; - } else error->all(FLERR,"Invalid Kokkos command-line args"); + } else error->all(FLERR,"Invalid Kokkos command-line arg: {}", arg[iarg]); } // Initialize Kokkos. However, we cannot change any // Kokkos library parameters after the first initalization if (args.num_threads != -1) { - if (args.num_threads != nthreads || args.num_numa != numa || args.device_id != device) + if ((args.num_threads != nthreads) || (args.num_numa != numa) || (args.device_id != device)) if (me == 0) - error->warning(FLERR,"Kokkos package already initalized, cannot reinitialize with different parameters"); + error->warning(FLERR,"Kokkos package already initalized, " + "cannot reinitialize with different parameters"); nthreads = args.num_threads; numa = args.num_numa; device = args.device_id; @@ -200,8 +207,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) init_ngpus = ngpus; } - if (me == 0) - utils::logmesg(lmp, " will use up to {} GPU(s) per node\n",ngpus); + if (me == 0) utils::logmesg(lmp, " will use up to {} GPU(s) per node\n", ngpus); #ifdef LMP_KOKKOS_GPU if (ngpus <= 0) diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index e1342adc17..720c960252 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -121,7 +121,7 @@ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : } if (!erate_flag) - error->all(FLERR,"Keyword erate must be set for fix npt/npt/uef command"); + error->all(FLERR,"Keyword erate must be set for fix nvt/npt/uef command"); if (mtchain_default_flag) mtchain=1; diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index 708b31c370..3176bb667b 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -68,7 +68,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : pstyle[nvalues++] = DZ; else if (arg[iarg][0] == 'p') { int n = atoi(&arg[iarg][1]); - if (n <= 0) error->all(FLERR, "Invalid keyword in compute pair/local command"); + if (n <= 0) error->all(FLERR, "Invalid keyword {} in compute pair/local command", arg[iarg]); pstyle[nvalues] = PN; pindex[nvalues++] = n - 1; diff --git a/src/fix_store_peratom.h b/src/fix_store_peratom.h index 7e288a6c54..fcabae75b7 100644 --- a/src/fix_store_peratom.h +++ b/src/fix_store_peratom.h @@ -54,8 +54,6 @@ class FixStorePeratom : public Fix { int n2, n3; // size of 3d dims of per-atom data struct int nvalues; // number of per-atom values int nbytes; // number of per-atom bytes - - double *rbuf; // restart buffer for GLOBAL vec/array/tensor }; } // namespace LAMMPS_NS diff --git a/src/fmt/format.h b/src/fmt/format.h index 0bd2fdb182..5483e00676 100644 --- a/src/fmt/format.h +++ b/src/fmt/format.h @@ -389,11 +389,11 @@ class uint128_fallback { hi_ += (lo_ < n ? 1 : 0); return *this; } -#if FMT_HAS_BUILTIN(__builtin_addcll) +#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) unsigned long long carry; lo_ = __builtin_addcll(lo_, n, 0, &carry); hi_ += carry; -#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) +#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__) unsigned long long result; auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result); lo_ = result; diff --git a/src/lammps.cpp b/src/lammps.cpp index e78f9e2019..b7318b9b55 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -196,6 +196,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : int citelogfile = CiteMe::VERBOSE; char *citefile = nullptr; int helpflag = 0; + int nonbufflag = 0; suffix = suffix2 = suffixp = nullptr; suffix_enable = 0; @@ -298,6 +299,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : citeflag = 0; iarg++; + } else if (strcmp(arg[iarg],"-nonbuf") == 0 || + strcmp(arg[iarg],"-nb") == 0) { + nonbufflag = 1; + iarg++; + } else if (strcmp(arg[iarg],"-package") == 0 || strcmp(arg[iarg],"-pk") == 0) { if (iarg+2 > narg) @@ -520,7 +526,6 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : utils::flush_buffers(this); } - // universe is one or more worlds, as setup by partition switch // split universe communicator into separate world communicators // set world screen, logfile, communicator, infile @@ -587,6 +592,15 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : } } + // make all screen and logfile output unbuffered for debugging crashes + + if (nonbufflag) { + if (universe->uscreen) setbuf(universe->uscreen, nullptr); + if (universe->ulogfile) setbuf(universe->ulogfile, nullptr); + if (screen) setbuf(screen, nullptr); + if (logfile) setbuf(logfile, nullptr); + } + // screen and logfile messages for universe and world if ((universe->me == 0) && (!helpflag)) { diff --git a/src/library.cpp b/src/library.cpp index cdc0a812c5..584504599e 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -234,7 +234,7 @@ fails a null pointer is returned. void *lammps_open_no_mpi(int argc, char **argv, void **ptr) { - return lammps_open(argc,argv,MPI_COMM_WORLD,ptr); + return lammps_open(argc, argv, MPI_COMM_WORLD, ptr); } /* ---------------------------------------------------------------------- */ diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 03e22f46c5..b6b095ddf4 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1354,7 +1354,7 @@ void Neighbor::morph_granular() void Neighbor::morph_halffull() { - int i,j,jj,jmin; + int i,j,jj; NeighRequest *irq,*jrq; double icut,jcut; @@ -1438,7 +1438,7 @@ void Neighbor::morph_halffull() void Neighbor::morph_copy_trim() { - int i,j,jj,jmin,inewton,jnewton; + int i,j,jj,inewton,jnewton; NeighRequest *irq,*jrq; double icut,jcut; diff --git a/src/npair_trim.cpp b/src/npair_trim.cpp index 5d854b745e..01abeed636 100644 --- a/src/npair_trim.cpp +++ b/src/npair_trim.cpp @@ -33,7 +33,7 @@ void NPairTrim::build(NeighList *list) double cutsq_custom = cutoff_custom * cutoff_custom; - int i,j,ii,jj,n,jnum,joriginal; + int ii,jj,n,jnum,joriginal; int *neighptr,*jlist; double xtmp,ytmp,ztmp; double delx,dely,delz,rsq; @@ -71,7 +71,7 @@ void NPairTrim::build(NeighList *list) for (jj = 0; jj < jnum; jj++) { joriginal = jlist[jj]; - j = joriginal & NEIGHMASK; + const int j = joriginal & NEIGHMASK; delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index 1f379bc0dd..7add54fdb9 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -179,8 +179,7 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) ++nid; rv = sscanf(line,"%*s%lg%lg%lg", &myx, &myy, &myz); - if (rv != 3) - error->one(FLERR,"Dump file is incorrectly formatted"); + if (rv != 3) error->one(FLERR,"Dump file is incorrectly formatted"); // XXX: we could insert an element2type translation here // XXX: for now we flag unrecognized types as type 0, diff --git a/src/variable.cpp b/src/variable.cpp index 168ccfa1cd..a564847b68 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -3942,7 +3942,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t strcmp(word,"trap") != 0 && strcmp(word,"slope") != 0 && strcmp(word,"gmask") != 0 && strcmp(word,"rmask") != 0 && strcmp(word,"grmask") != 0 && strcmp(word,"next") != 0 && strcmp(word,"is_active") != 0 && strcmp(word,"is_defined") != 0 && strcmp(word,"is_available") != 0 && strcmp(word,"is_file") != 0 && - strcmp(word,"extract_setting") != 0) + strcmp(word,"is_os") != 0 && strcmp(word,"extract_setting") != 0) return 0; // parse contents for comma-separated args @@ -4340,6 +4340,19 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; + } else if (strcmp(word,"is_os") == 0) { + if (narg != 1) print_var_error(FLERR,"Invalid is_os() function in variable formula",ivar); + value = utils::strmatch(platform::os_info(), args[0]) ? 1.0 : 0.0; + + // save value in tree or on argstack + + if (tree) { + auto newtree = new Tree(); + newtree->type = VALUE; + newtree->value = value; + treestack[ntreestack++] = newtree; + } else argstack[nargstack++] = value; + } else if (strcmp(word,"extract_setting") == 0) { if (narg != 1) print_var_error(FLERR,"Invalid extract_setting() function in variable formula",ivar); diff --git a/tools/python/pizza/dump.py b/tools/python/pizza/dump.py index 6224192093..01685cf582 100644 --- a/tools/python/pizza/dump.py +++ b/tools/python/pizza/dump.py @@ -189,16 +189,26 @@ import sys, re, glob, types from os import popen from math import * # any function could be used by set() -try: - import numpy as np - oldnumeric = False -except: - import Numeric as np - oldnumeric = True +import numpy as np try: from DEFAULTS import PIZZA_GUNZIP except: PIZZA_GUNZIP = "gunzip" +# -------------------------------------------------------------------- +# wrapper to convert old style comparision function to key function + +def cmp2key(oldcmp): + class keycmp: + def __init__(self, obj, *args): + self.obj = obj + def __lt__(self, other): + return oldcmp(self.obj,other.obj) < 0 + def __gt__(self, other): + return oldcmp(self.obj,other.obj) > 0 + def __eq__(self, other): + return oldcmp(self.obj,other.obj) == 0 + return keycmp + # Class definition class dump: @@ -260,7 +270,7 @@ class dump: # sort entries by timestep, cull duplicates - self.snaps.sort(self.compare_time) + self.snaps.sort(key=cmp2key(self.compare_time)) self.cull() self.nsnaps = len(self.snaps) print("read %d snapshots" % self.nsnaps) @@ -379,10 +389,7 @@ class dump: for i in range(1,snap.natoms): words += f.readline().decode().split() floats = map(float,words) - if oldnumeric: - atom_data = np.array(list(floats),np.Float) - else: - atom_data = np.array(list(floats),np.float) + atom_data = np.array(list(floats),np.float) snap.atoms = atom_data.reshape((snap.natoms, ncol)) else: @@ -858,8 +865,7 @@ class dump: self.map(ncol+1,str) for snap in self.snaps: atoms = snap.atoms - if oldnumeric: newatoms = np.zeros((snap.natoms,ncol+1),np.Float) - else: newatoms = np.zeros((snap.natoms,ncol+1),np.float) + newatoms = np.zeros((snap.natoms,ncol+1),np.float) newatoms[:,0:ncol] = snap.atoms snap.atoms = newatoms @@ -1018,8 +1024,7 @@ class dump: # convert values to int and absolute value since can be negative types - if oldnumeric: bondlist = np.zeros((nbonds,4),np.Int) - else: bondlist = np.zeros((nbonds,4),np.int) + bondlist = np.zeros((nbonds,4),np.int) ints = [abs(int(value)) for value in words] start = 0 stop = 4 diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 29b985927d..cf124eeafd 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -144,12 +144,14 @@ TEST_F(VariableTest, CreateDelete) command("variable ten3 uloop 4 pad"); command("variable dummy index 0"); command("variable file equal is_file(MYFILE)"); + command("variable iswin equal is_os(^Windows)"); + command("variable islin equal is_os(^Linux)"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 18); + ASSERT_EQ(variable->nvar, 20); BEGIN_HIDE_OUTPUT(); command("variable dummy delete"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 17); + ASSERT_EQ(variable->nvar, 19); ASSERT_THAT(variable->retrieve("three"), StrEq("three")); variable->set_string("three", "four"); ASSERT_THAT(variable->retrieve("three"), StrEq("four")); @@ -168,6 +170,17 @@ TEST_F(VariableTest, CreateDelete) platform::unlink("MYFILE"); ASSERT_THAT(variable->retrieve("file"), StrEq("0")); +#if defined(_WIN32) + ASSERT_THAT(variable->retrieve("iswin"), StrEq("1")); + ASSERT_THAT(variable->retrieve("islin"), StrEq("0")); +#elif defined(__linux__) + ASSERT_THAT(variable->retrieve("iswin"), StrEq("0")); + ASSERT_THAT(variable->retrieve("islin"), StrEq("1")); +#else + ASSERT_THAT(variable->retrieve("iswin"), StrEq("0")); + ASSERT_THAT(variable->retrieve("islin"), StrEq("0")); +#endif + BEGIN_HIDE_OUTPUT(); command("variable seven delete"); command("variable seven getenv TEST_VARIABLE"); diff --git a/unittest/force-styles/CMakeLists.txt b/unittest/force-styles/CMakeLists.txt index 85546c1510..d2345ceaa7 100644 --- a/unittest/force-styles/CMakeLists.txt +++ b/unittest/force-styles/CMakeLists.txt @@ -36,7 +36,11 @@ if(Python_EXECUTABLE) COMMENT "Check completeness of force style tests") endif() -set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests) +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + string(REPLACE "/" "\\\\" TEST_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/tests") +else() + set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests) +endif() add_library(style_tests STATIC yaml_writer.cpp error_stats.cpp test_config_reader.cpp test_main.cpp) if(YAML_FOUND) target_compile_definitions(style_tests PRIVATE TEST_INPUT_FOLDER=${TEST_INPUT_FOLDER}) diff --git a/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml b/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml index 7229a3cd26..0f8ca18eec 100644 --- a/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml +++ b/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml @@ -10,7 +10,7 @@ pre_commands: ! | variable units index real variable newton_pair delete variable newton_pair index on - shell cp ${input_dir}/table_CG_CG_CG.txt . + if $(is_os(^Windows)) then "shell copy ${input_dir}\table_CG_CG_CG.txt ." else "shell cp ${input_dir}/table_CG_CG_CG.txt ." post_commands: ! "" input_file: in.metal pair_style: hybrid/overlay table linear 1200 sw/angle/table diff --git a/unittest/force-styles/tests/atomic-pair-threebody_table.yaml b/unittest/force-styles/tests/atomic-pair-threebody_table.yaml index bb3c8c1c1b..cf3566490e 100644 --- a/unittest/force-styles/tests/atomic-pair-threebody_table.yaml +++ b/unittest/force-styles/tests/atomic-pair-threebody_table.yaml @@ -10,8 +10,8 @@ pre_commands: ! | variable units index real variable newton_pair delete variable newton_pair index on - shell cp ${input_dir}/1-1-1.table . - shell cp ${input_dir}/1-1-2.table . + if $(is_os(^Windows)) then "shell copy ${input_dir}\1-1-1.table ." else "shell cp ${input_dir}/1-1-1.table ." + if $(is_os(^Windows)) then "shell copy ${input_dir}\1-1-2.table ." else "shell cp ${input_dir}/1-1-2.table ." post_commands: ! "" input_file: in.metal pair_style: hybrid/overlay table linear 1200 threebody/table diff --git a/unittest/fortran/CMakeLists.txt b/unittest/fortran/CMakeLists.txt index 047dcf3207..1062766e43 100644 --- a/unittest/fortran/CMakeLists.txt +++ b/unittest/fortran/CMakeLists.txt @@ -17,7 +17,7 @@ if(CMAKE_Fortran_COMPILER) get_filename_component(LAMMPS_FORTRAN_MODULE ${LAMMPS_SOURCE_DIR}/../fortran/lammps.f90 ABSOLUTE) if(BUILD_MPI) find_package(MPI REQUIRED) - if((NOT MPI_Fortran) OR (NOT MPI_Fortran_HAVE_F77_HEADER) OR (NOT MPI_Fortran_HAVE_F90_MODULE)) + if((NOT MPI_Fortran_FOUND) OR (NOT MPI_Fortran_HAVE_F77_HEADER)) message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran") return() endif() @@ -29,7 +29,8 @@ if(CMAKE_Fortran_COMPILER) add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE}) add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90) - target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_create PRIVATE lammps MPI::MPI_Fortran GTest::GTestMain) + target_include_directories(test_fortran_create PRIVATE "${LAMMPS_SOURCE_DIR}/../fortran") add_test(NAME FortranOpen COMMAND test_fortran_create) add_executable(test_fortran_commands wrap_commands.cpp test_fortran_commands.f90) diff --git a/unittest/fortran/test_fortran_create.f90 b/unittest/fortran/test_fortran_create.f90 index e1df7502cb..73fc83aef4 100644 --- a/unittest/fortran/test_fortran_create.f90 +++ b/unittest/fortran/test_fortran_create.f90 @@ -1,3 +1,5 @@ +include 'lammps.f90' + MODULE keepcreate USE liblammps TYPE(LAMMPS) :: lmp @@ -75,10 +77,11 @@ SUBROUTINE f_lammps_close() BIND(C, name="f_lammps_close") END SUBROUTINE f_lammps_close FUNCTION f_lammps_get_comm() BIND(C, name="f_lammps_get_comm") + USE ISO_C_BINDING, ONLY: c_int USE liblammps USE keepcreate, ONLY: mycomm IMPLICIT NONE - INTEGER :: f_lammps_get_comm + INTEGER(c_int) :: f_lammps_get_comm f_lammps_get_comm = mycomm END FUNCTION f_lammps_get_comm