diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 8e103b089a..e95c5b97d9 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -153,7 +153,12 @@ development headers to compile (if those are not found locally a recent version of that library will be downloaded and compiled along with LAMMPS and the test programs) and will download and compile a specific version of the `GoogleTest `_ C++ -test framework that is used to implement the tests. +test framework that is used to implement the tests. Those unit tests +may be combined with memory access and leak checking with valgrind +(see below for how to enable it). In that case, running so-called +death tests will create a lot of false positives and thus they can be +disabled by configuring compilation with the additional setting +``-D SKIP_DEATH_TESTS=on``. .. admonition:: Software version and LAMMPS configuration requirements :class: note diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst index 1283bcfa5a..85f0210f99 100644 --- a/doc/src/Howto_lammps_gui.rst +++ b/doc/src/Howto_lammps_gui.rst @@ -98,10 +98,26 @@ get access to the other included executables. Linux on x86\_64 ^^^^^^^^^^^^^^^^ -After downloading and unpacking the +For Linux with x86\_64 CPU there are currently two variants. The first +is compiled on Ubuntu 20.04LTS, is using some wrapper scripts, and +should be compatible with more recent Linux distributions. After +downloading and unpacking the ``LAMMPS-Linux-x86_64-GUI-.tar.gz`` package. You can switch into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly. +The second variant uses `flatpak `_ and +requires the flatpak management and runtime software to be installed. +After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-.tar.gz`` +flatpak bundle, you can install it with ``flatpak install --user +LAMMPS-GUI-Linux-x86_64-GUI-.tar.gz``. After installation, +LAMMPS-GUI should be integrated into your desktop environment under +"Applications > Science" but also can be launched from the console with +``flatpak run org.lammps.lammps-gui``. The flatpak bundle also includes +the console LAMMPS executable ``lmp`` which can be launched to run +simulations with, for example: ``flatpak run --command=lmp +org.lammps.lammps-gui -in in.melt``. + + Compiling from Source ^^^^^^^^^^^^^^^^^^^^^ @@ -400,10 +416,16 @@ Otherwise the default sequence of colors of the :doc:`dump image ` command is assigned to the different atom types and the diameters are all the same. -.. image:: JPG/lammps-gui-image.png +.. figure:: JPG/lammps-gui-image.png :align: center :scale: 50% + Visualization of LAMMPS "peptide" example + +.. versionchanged:: 1.6 + + Buttons for toggling shininess and re-centering were added. + The default image size, some default image quality settings, the view style and some colors can be changed in the ``Preferences`` dialog window. From the image viewer window further adjustments can be made: @@ -442,6 +464,12 @@ Paste (`Ctrl-V`), Undo (`Ctrl-Z`), Redo (`Ctrl-Shift-Z`), Select All dialog will pop up asking whether to cancel the exit operation, or to save or not save the buffer contents to a file. +.. versionadded:: 1.6 + +The editor has an auto-save mode that can be enabled or disabled in the +``Preferences`` dialog. In auto-save mode, the editor buffer is +automatically saved before running LAMMPS or before exiting LAMMPS-GUI. + Context Specific Word Completion ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -471,11 +499,12 @@ Line Reformatting The editor supports reformatting lines according to the syntax in order to have consistently aligned lines. This primarily means adding whitespace padding to commands, type specifiers, IDs and names. This -reformatting is performed by default when hitting the 'Enter' key to -start a new line. This feature can be turned on or off in the -``Preferences`` dialog, but it can still be manually performed by -hitting the 'TAB' key. The amount of padding can be adjusted in the -``Preferences`` dialog for the *Editor*. +reformatting is performed manually by hitting the 'Tab' key. It is +also possible to have this done automatically when hitting the 'Enter' +key to start a new line. This feature can be turned on or off in the +``Preferences`` dialog for ``Editor Settings`` with the +"Reformat with 'Enter'" checkbox. The amount of padding for multiple +categories can be adjusted in the same dialog. Internally this functionality is achieved by splitting the line into "words" and then putting it back together with padding added where the @@ -696,13 +725,15 @@ General Settings: log) of the application can be set. - *Select Text Font:* Opens a font selection dialog where the type and size for the text editor and log font of the application can be set. -- *GUI update interval:* Allows to set the time interval between GUI - and data updates during a LAMMPS run in milliseconds. The default is - to update the GUI every 10 milliseconds. This is good for most cases. - For LAMMPS runs that run *very* fast, however, data may be missed and - through lowering this interval, this can be corrected. However, this - will make the GUI use more resources, which may be a problem on some - computers with slower CPUs and a small number of CPU cores. This +- *GUI update interval:* Allows to set the time interval between GUI and + data updates during a LAMMPS run in milliseconds. The default is to + update the GUI every 10 milliseconds. This is good for many cases. + Set this to 100 milliseconds or more if LAMMPS-GUI consumes too many + resources during a run. For LAMMPS runs that run *very* fast (for + example in tutorial examples), however, data may be missed and through + lowering this interval, this can be corrected. However, this will + make the GUI use more resources, which may be a problem on some + computers with slower CPUs and a small number of CPU cores. This setting may be changed to a value between 1 and 1000 milliseconds. Accelerators: @@ -719,18 +750,23 @@ Snapshot Image: ^^^^^^^^^^^^^^^ This tab allows setting defaults for the snapshot images displayed in -the ``Image Viewer`` window, such as its dimensions and the zoom -factor applied. The *Antialias* switch will render images with twice -the number of pixels for width and height and then smoothly scale the -image back to the requested size. This produces higher quality images -with smoother edges at the expense of requiring more CPU time to -render the image. The *HQ Image mode* option turns on screen space -ambient occlusion (SSAO) mode when rendering images. This is also -more time consuming, but produces a more 'spatial' representation of -the system shading of atoms by their depth. The *VDW Style* checkbox -selects whether atoms are represented by space filling spheres when -checked or by smaller spheres and sticks. Finally there are a couple -of drop down lists to select the background and box colors. +the ``Image Viewer`` window, such as its dimensions and the zoom factor +applied. The *Antialias* switch will render images with twice the +number of pixels for width and height and then smoothly scale the image +back to the requested size. This produces higher quality images with +smoother edges at the expense of requiring more CPU time to render the +image. The *HQ Image mode* option turns on screen space ambient +occlusion (SSAO) mode when rendering images. This is also more time +consuming, but produces a more 'spatial' representation of the system +shading of atoms by their depth. The *Shiny Image mode* option will +render objects with a shiny surface when enabled. Otherwise the +surfaces will be matted. The *Show Box* option selects whether the +system box is drawn as a colored set of sticks. Similarly, the *Show +Axes* option selects whether a representation of the three system axes +will be drawn as colored sticks. The *VDW Style* checkbox selects +whether atoms are represented by space filling spheres when checked or +by smaller spheres and sticks. Finally there are a couple of drop down +lists to select the background and box colors. Editor Settings: ^^^^^^^^^^^^^^^^ @@ -741,9 +777,11 @@ ranges, IDs (e.g. for fixes), and names (e.g. for groups). The value set is the minimum width for the text element and it can be chosen in the range between 1 and 32. -The two settings which follow enable or disable the automatic -reformatting when hitting the 'Enter' key and the automatic display of -the completion pop-up window. +The three settings which follow enable or disable the automatic +reformatting when hitting the 'Enter' key, the automatic display of +the completion pop-up window, and whether auto-save mode is enabled. +In auto-save mode the editor buffer is saved before a run or before +exiting LAMMPS-GUI. ----------- diff --git a/doc/src/JPG/lammps-gui-image.png b/doc/src/JPG/lammps-gui-image.png index 48b9fd1ce3..969aadce0b 100644 Binary files a/doc/src/JPG/lammps-gui-image.png and b/doc/src/JPG/lammps-gui-image.png differ diff --git a/doc/src/JPG/lammps-gui-prefs-accel.png b/doc/src/JPG/lammps-gui-prefs-accel.png index 3cab94136a..25820c8d44 100644 Binary files a/doc/src/JPG/lammps-gui-prefs-accel.png and b/doc/src/JPG/lammps-gui-prefs-accel.png differ diff --git a/doc/src/JPG/lammps-gui-prefs-editor.png b/doc/src/JPG/lammps-gui-prefs-editor.png index 5d2fe50380..5b5cffe209 100644 Binary files a/doc/src/JPG/lammps-gui-prefs-editor.png and b/doc/src/JPG/lammps-gui-prefs-editor.png differ diff --git a/doc/src/JPG/lammps-gui-prefs-general.png b/doc/src/JPG/lammps-gui-prefs-general.png index 765ba8f84d..bfc9556995 100644 Binary files a/doc/src/JPG/lammps-gui-prefs-general.png and b/doc/src/JPG/lammps-gui-prefs-general.png differ diff --git a/doc/src/JPG/lammps-gui-prefs-image.png b/doc/src/JPG/lammps-gui-prefs-image.png index b87e8f2d20..7dd9e06653 100644 Binary files a/doc/src/JPG/lammps-gui-prefs-image.png and b/doc/src/JPG/lammps-gui-prefs-image.png differ diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 060fd9f89d..1c16d370b9 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -92,7 +92,7 @@ Miscellaneous tools * :ref:`emacs ` * :ref:`i-PI ` * :ref:`kate ` - * :ref:`LAMMPS GUI ` + * :ref:`LAMMPS-GUI ` * :ref:`LAMMPS magic patterns for file(1) ` * :ref:`Offline build tool ` * :ref:`singularity/apptainer ` @@ -524,6 +524,7 @@ The LAMMPS-GUI has been successfully compiled and tested on: - Fedora Linux 40 x86\_64 using GCC 14, Qt version 6.7 - Apple macOS 12 (Monterey) and macOS 13 (Ventura) with Xcode on arm64 and x86\_64, Qt version 5.15LTS - Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.36, Qt version 5.15LTS +- Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.40, Qt version 6.7 - Windows 10 and 11 x86_64 with MinGW / GCC 10.0 cross-compiler on Fedora 38, Qt version 5.15LTS .. _lammps_gui_install: @@ -532,14 +533,28 @@ The LAMMPS-GUI has been successfully compiled and tested on: Pre-compiled executables ^^^^^^^^^^^^^^^^^^^^^^^^ -Pre-compiled LAMMPS executable packages that include the GUI are currently -available from https://download.lammps.org/static or -https://github.com/lammps/lammps/releases. You can unpack the archives -(or mount the macOS disk image) and run the GUI directly in place. The -folder may also be moved around and added to the ``PATH`` environment -variable so the executables will be found automatically. The LAMMPS-GUI -executable is called ``lammps-gui`` and either takes no arguments or -attempts to load the first argument as LAMMPS input file. +Pre-compiled LAMMPS executable packages that include the GUI are +currently available from https://download.lammps.org/static or +https://github.com/lammps/lammps/releases. For Windows, you need to +download and then run the application installer. For macOS you download +and mount the disk image and then drag the application bundle to the +Applications folder. For Linux (x86_64) you currently have two +options: 1) you can download the tar.gz archive, unpack it and run the +GUI directly in place. The ``LAMMPS_GUI`` folder may also be moved +around and added to the ``PATH`` environment variable so the executables +will be found automatically. 2) you can download the `Flatpak file +`_ and then install it locally with the +*flatpak* command: ``flatpak install --user +LAMMPS-Linux-x86_64-GUI-.flatpak`` and run it with ``flatpak +run org.lammps.lammps-gui``. The flatpak bundle also includes the +command line version of LAMMPS and some LAMMPS tools like msi2lmp. The +can be launched by using the ``--command`` flag. For example to run +LAMMPS directly on the ``in.lj`` benchmark input you would type in the +``bench`` folder: ``flatpak run --command=lmp -in in.lj`` The flatpak +version should also appear in the applications menu of standard desktop +environments. The LAMMPS-GUI executable is called ``lammps-gui`` and +either takes no arguments or attempts to load the first argument as +LAMMPS input file. .. _lammps_gui_compilation: @@ -1107,13 +1122,13 @@ necessary development headers and libraries are present. .. code-block:: bash - -D WITH_SWIG=on # to enable building any SWIG wrapper - -D BUILD_SWIG_JAVA=on # to enable building the Java wrapper - -D BUILD_SWIG_LUA=on # to enable building the Lua wrapper - -D BUILD_SWIG_PERL5=on # to enable building the Perl 5.x wrapper - -D BUILD_SWIG_PYTHON=on # to enable building the Python wrapper - -D BUILD_SWIG_RUBY=on # to enable building the Ruby wrapper - -D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper + -D WITH_SWIG=on # to enable building any SWIG wrapper + -D BUILD_SWIG_JAVA=on # to enable building the Java wrapper + -D BUILD_SWIG_LUA=on # to enable building the Lua wrapper + -D BUILD_SWIG_PERL5=on # to enable building the Perl 5.x wrapper + -D BUILD_SWIG_PYTHON=on # to enable building the Python wrapper + -D BUILD_SWIG_RUBY=on # to enable building the Ruby wrapper + -D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper Manual building allows a little more flexibility. E.g. one can choose diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst index 3102caaa97..d7350c4e9b 100644 --- a/doc/src/dump_image.rst +++ b/doc/src/dump_image.rst @@ -111,10 +111,10 @@ Syntax .. parsed-literal:: *acolor* args = type color - type = atom type or range of types (see below) + type = atom type (numeric or type label) or range of numeric types (see below) color = name of color or color1/color2/... *adiam* args = type diam - type = atom type or range of types (see below) + type = atom type (numeric or type label) or range of numeric types (see below) diam = diameter of atoms of that type (distance units) *amap* args = lo hi style delta N entry1 entry2 ... entryN lo = number or *min* = lower bound of range of color map @@ -139,10 +139,10 @@ Syntax *backcolor* arg = color color = name of color for background *bcolor* args = type color - type = bond type or range of types (see below) + type = bond type (numeric or type label) or range of numeric types (see below) color = name of color or color1/color2/... *bdiam* args = type diam - type = bond type or range of types (see below) + type = bond type (numeric or type label) or range of numeric types (see below) diam = diameter of bonds of that type (distance units) *bitrate* arg = rate rate = target bitrate for movie in kbps @@ -169,6 +169,9 @@ Examples dump_modify 1 amap min max cf 0.0 3 min green 0.5 yellow max blue boxcolor red + labelmap atom 1 C 2 H 3 O 4 N + dump_modify 1 acolor C gray acolor H white acolor O red acolor N blue + Description """"""""""" @@ -739,15 +742,15 @@ The *acolor* keyword can be used with the dump image command, when its atom color setting is *type*, to set the color that atoms of each type will be drawn in the image. -The specified *type* should be an integer from 1 to Ntypes = the -number of atom types. A wildcard asterisk can be used in place of or -in conjunction with the *type* argument to specify a range of atom -types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = -the number of atom types, then an asterisk with no numeric values -means all types from 1 to N. A leading asterisk means all types from -1 to n (inclusive). A trailing asterisk means all types from n to N -(inclusive). A middle asterisk means all types from m to n -(inclusive). +The specified *type* should be a type label or integer from 1 to Ntypes += the number of atom types. For numeric types, a wildcard asterisk can +be used in place of or in conjunction with the *type* argument to +specify a range of atom types. This takes the form "\*" or "\*n" or +"n\*" or "m\*n". If N = the number of atom types, then an asterisk with +no numeric values means all types from 1 to N. A leading asterisk +means all types from 1 to n (inclusive). A trailing asterisk means all +types from n to N (inclusive). A middle asterisk means all types from +m to n (inclusive). The specified *color* can be a single color which is any of the 140 pre-defined colors (see below) or a color name defined by the @@ -761,11 +764,12 @@ fashion to each of the specified atom types. The *adiam* keyword can be used with the dump image command, when its atom diameter setting is *type*, to set the size that atoms of each -type will be drawn in the image. The specified *type* should be an -integer from 1 to Ntypes. As with the *acolor* keyword, a wildcard -asterisk can be used as part of the *type* argument to specify a range -of atom types. The specified *diam* is the size in whatever distance -:doc:`units ` the input script is using, e.g. Angstroms. +type will be drawn in the image. The specified *type* should be a type +label or integer from 1 to Ntypes. As with the *acolor* keyword, a +wildcard asterisk can be used as part of the *type* argument to specify +a range of numeric atom types. The specified *diam* is the size in +whatever distance :doc:`units ` the input script is using, e.g. +Angstroms. ---------- @@ -908,14 +912,15 @@ The *bcolor* keyword can be used with the dump image command, with its *bond* keyword, when its color setting is *type*, to set the color that bonds of each type will be drawn in the image. -The specified *type* should be an integer from 1 to :math:`N`, where :math:`N` -is the number of bond types. A wildcard asterisk can be used in place of or -in conjunction with the *type* argument to specify a range of bond -types. This takes the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` -is the number of bond types, then an asterisk with no numerical values -means all types from 1 to :math:`N`. A leading asterisk means all types from -1 to n (inclusive). A trailing asterisk means all types from m to :math:`N` -(inclusive). A middle asterisk means all types from m to n +The specified *type* should be a type label or integer from 1 to +:math:`N`, where :math:`N` is the number of bond types. For numeric +types, a wildcard asterisk can be used in place of or in conjunction +with the *type* argument to specify a range of bond types. This takes +the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is the number +of bond types, then an asterisk with no numerical values means all +types from 1 to :math:`N`. A leading asterisk means all types from 1 +to n (inclusive). A trailing asterisk means all types from m to +:math:`N` (inclusive). A middle asterisk means all types from m to n (inclusive). The specified *color* can be a single color which is any of the 140 @@ -931,11 +936,11 @@ of the specified bond types. The *bdiam* keyword can be used with the dump image command, with its *bond* keyword, when its *diam* setting is *type*, to set the diameter that bonds of each type will be drawn in the image. The specified -*type* should be an integer from 1 to Nbondtypes. As with the -*bcolor* keyword, a wildcard asterisk can be used as part of the -*type* argument to specify a range of bond types. The specified -*diam* is the size in whatever distance :doc:`units ` you are -using (e.g., Angstroms). +*type* should be a type label or integer from 1 to Nbondtypes. As with +the *bcolor* keyword, a wildcard asterisk can be used as part of the +*type* argument to specify a range of numeric bond types. The +specified *diam* is the size in whatever distance :doc:`units ` +you are using (e.g., Angstroms). ---------- diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 002e861dc7..5406c3ac79 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1186,6 +1186,7 @@ flaglog flagN flagVF flang +flatpak fld floralwhite Florez diff --git a/python/lammps/core.py b/python/lammps/core.py index 97bcb5157d..42e8652fef 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -342,8 +342,8 @@ class lammps(object): if self.has_mpi_support: try: from mpi4py import __version__ as mpi4py_version - # tested to work with mpi4py versions 2 and 3 - self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3'] + # tested to work with mpi4py versions 2, 3, and 4 + self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3','4'] except ImportError: # ignore failing import pass @@ -369,7 +369,7 @@ class lammps(object): if not self.has_mpi_support: raise Exception('LAMMPS not compiled with real MPI library') if not self.has_mpi4py: - raise Exception('Python mpi4py version is not 2 or 3') + raise Exception('Python mpi4py version is not 2, 3, or 4') if self.MPI._sizeof(self.MPI.Comm) == sizeof(c_int): MPI_Comm = c_int else: diff --git a/src/GRANULAR/fix_add_heat.cpp b/src/GRANULAR/fix_add_heat.cpp index 01bc22cdf4..642ea806e8 100644 --- a/src/GRANULAR/fix_add_heat.cpp +++ b/src/GRANULAR/fix_add_heat.cpp @@ -142,7 +142,7 @@ void FixAddHeat::post_force(int /*vflag*/) if (mask[i] & groupbit) heatflow[i] = 0.0; - double vtmp, dt; + double vtmp = 0.0; if (vstyle == CONSTANT) vtmp = value; if (vstyle == EQUAL) vtmp = input->variable->compute_equal(var); for (int i = 0; i < atom->nlocal; i++) { diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 99a0efd75e..a0676cc56e 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -613,8 +613,7 @@ void PPPMDipole::allocate() memory->create2d_offset(rho1d,3,-order/2,order/2,"pppm_dipole:rho1d"); memory->create2d_offset(drho1d,3,-order/2,order/2,"pppm_dipole:drho1d"); memory->create2d_offset(rho_coeff,order,(1-order)/2,order/2,"pppm_dipole:rho_coeff"); - memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2, - "pppm_dipole:drho_coeff"); + memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2,"pppm_dipole:drho_coeff"); // create 2 FFTs and a Remap // 1st FFT keeps data in FFT decomposition @@ -669,8 +668,23 @@ void PPPMDipole::deallocate() memory->destroy(densityy_fft_dipole); memory->destroy(densityz_fft_dipole); + memory->destroy(density_fft); + memory->destroy(greensfn); + memory->destroy(work1); + memory->destroy(work2); memory->destroy(work3); memory->destroy(work4); + memory->destroy(vg); + + memory->destroy1d_offset(fkx,nxlo_fft); + memory->destroy1d_offset(fky,nylo_fft); + memory->destroy1d_offset(fkz,nzlo_fft); + + memory->destroy(gf_b); + memory->destroy2d_offset(rho1d,-order_allocated/2); + memory->destroy2d_offset(drho1d,-order_allocated/2); + memory->destroy2d_offset(rho_coeff,(1-order_allocated)/2); + memory->destroy2d_offset(drho_coeff,(1-order_allocated)/2); delete fft1; delete fft2; @@ -678,6 +692,7 @@ void PPPMDipole::deallocate() fft1 = fft2 = nullptr; remap = nullptr; + gf_b = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/ML-POD/fitpod_command.cpp b/src/ML-POD/fitpod_command.cpp index ba7ffeba3a..fbe9ecd396 100644 --- a/src/ML-POD/fitpod_command.cpp +++ b/src/ML-POD/fitpod_command.cpp @@ -1492,8 +1492,6 @@ void FitPOD::environment_cluster_calculation(const datastruct &data) &beta, A, &Mdesc); MPI_Allreduce(MPI_IN_PLACE, A, Mdesc * Mdesc, MPI_DOUBLE, MPI_SUM, world); - //if (comm->me == 0) print_matrix("A", Mdesc, Mdesc, A, Mdesc); - if ((comm->me == 0) && (save == 1)) savematrix2binfile(data.filenametag + "_covariance_matrix_elem" + std::to_string(elem + 1) + ".bin", diff --git a/src/ML-POD/pair_pod.cpp b/src/ML-POD/pair_pod.cpp index ee70d39df4..f76191328f 100644 --- a/src/ML-POD/pair_pod.cpp +++ b/src/ML-POD/pair_pod.cpp @@ -77,6 +77,7 @@ PairPOD::PairPOD(LAMMPS *lmp) : Pair(lmp), fastpodptr(nullptr) abfx = nullptr; abfy = nullptr; abfz = nullptr; + abftm = nullptr; sumU = nullptr; forcecoeff = nullptr; Centroids = nullptr; @@ -88,6 +89,7 @@ PairPOD::PairPOD(LAMMPS *lmp) : Pair(lmp), fastpodptr(nullptr) pdd = nullptr; coefficients = nullptr; pn3 = nullptr; + pq3 = nullptr; pc3 = nullptr; pa4 = nullptr; pb4 = nullptr; @@ -124,6 +126,7 @@ PairPOD::~PairPOD() memory->destroy(abfx); memory->destroy(abfy); memory->destroy(abfz); + memory->destroy(abftm); memory->destroy(sumU); memory->destroy(forcecoeff); memory->destroy(Centroids); @@ -135,6 +138,7 @@ PairPOD::~PairPOD() memory->destroy(pdd); memory->destroy(coefficients); memory->destroy(pn3); + memory->destroy(pq3); memory->destroy(pc3); memory->destroy(pa4); memory->destroy(pb4); @@ -568,14 +572,18 @@ void PairPOD::copy_data_from_pod_class() besselparams[1] = fastpodptr->besselparams[1]; besselparams[2] = fastpodptr->besselparams[2]; + memory->destroy(abftm); memory->create(abftm, 4*K3, "abftm"); + memory->destroy(elemindex); memory->create(elemindex, nelements*nelements, "elemindex"); for (int i=0; ielemindex[i]; + memory->destroy(Phi); memory->create(Phi, ns * ns, "pair_pod:Phi"); for (int i=0; iPhi[i]; + memory->destroy(coefficients); memory->create(coefficients, nCoeffPerElement * nelements, "pair_pod:coefficients"); for (int i=0; icoeff[i]; @@ -590,11 +598,17 @@ void PairPOD::copy_data_from_pod_class() Centroids[i] = fastpodptr->Centroids[i]; } + memory->destroy(pn3); memory->create(pn3, nabf3+1, "pn3"); // array stores the number of monomials for each degree + memory->destroy(pq3); memory->create(pq3, K3*2, "pq3"); // array needed for the recursive computation of the angular basis functions + memory->destroy(pc3); memory->create(pc3, K3, "pc3"); // array needed for the computation of the three-body descriptors + memory->destroy(pa4); memory->create(pa4, nabf4+1, "pa4"); // this array is a subset of the array {0, 1, 4, 10, 19, 29, 47, 74, 89, 119, 155, 209, 230, 275, 335, 425, 533, 561, 624, 714, 849, 949, 1129, 1345} + memory->destroy(pb4); memory->create(pb4, Q4*3, "pb4"); // array stores the indices of the monomials needed for the computation of the angular basis functions + memory->destroy(pc4); memory->create(pc4, Q4, "pc4"); // array of monomial coefficients needed for the computation of the four-body descriptors for (int i=0; ipn3[i]; for (int i=0; ipc3[i]; @@ -890,7 +904,7 @@ void PairPOD::angularbasis(double *tm, double *tmu, double *tmv, double *tmw, in double tmvm = abfy[mj]; double tmwm = abfz[mj]; - double tmn, tmun, tmvn, tmwn; + double tmn = 0.0, tmun = 0.0, tmvn = 0.0, tmwn = 0.0; // Calculate angular basis function and its derivatives using recursion relation if (d==1) { tmn = tmm*u; diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index bc220da30e..631dfe7b4b 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -593,7 +593,6 @@ void FixCMAP::post_force(int vflag) vcmap[5] = (vb12y*f1[2])+(vb32y*f3[2])+((vb43y+vb32y)*f4[2])+ ((vb54y+vb43y+vb32y)*f5[2]); ev_tally(nlist,list,5.0,E,vcmap); - //ev_tally(5,list,nlocal,newton_bond,E,vcmap); } } } diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 5be1de82a9..124e7e4ed8 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -38,14 +38,18 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairLJCutTIP4PCut::PairLJCutTIP4PCut(LAMMPS *lmp) : Pair(lmp) +PairLJCutTIP4PCut::PairLJCutTIP4PCut(LAMMPS *lmp) : + Pair(lmp), cut_lj(nullptr), cut_ljsq(nullptr), epsilon(nullptr), sigma(nullptr), lj1(nullptr), + lj2(nullptr), lj3(nullptr), lj4(nullptr), offset(nullptr), hneigh(nullptr), newsite(nullptr) + { single_enable = 0; writedata = 1; nmax = 0; - hneigh = nullptr; - newsite = nullptr; + + typeH = typeO = typeA = typeB = -1; + alpha = qdist = 0.0; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 47ad3d260f..0e1335282c 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -763,11 +763,12 @@ void FixQEq::read_file(char *file) chi[n] = eta[n] = gamma[n] = zeta[n] = zcore[n] = 0.0; } + FILE *fp = nullptr; try { int nlo,nhi; double val; - FILE *fp = utils::open_potential(file,lmp,nullptr); + fp = utils::open_potential(file,lmp,nullptr); if (fp == nullptr) throw qeq_parser_error(fmt::format("Cannot open fix qeq parameter file {}: {}", file,utils::getsyserror())); @@ -798,7 +799,7 @@ void FixQEq::read_file(char *file) for (int n=nlo; n <= nhi; ++n) setflag[n] = 1; } } catch (EOFException &) { - ; // catch and ignore to exit loop + fclose(fp); } catch (std::exception &e) { error->one(FLERR,e.what()); } diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 3eb150559c..9ad580544e 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -54,6 +54,7 @@ void FixQEqPoint::init() neighbor->add_request(this, NeighConst::REQ_FULL); int ntypes = atom->ntypes; + memory->destroy(shld); memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); } diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 2e653b9226..b4827d8694 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -56,6 +56,7 @@ void FixQEqShielded::init() neighbor->add_request(this, NeighConst::REQ_FULL); const int ntypes = atom->ntypes; + memory->destroy(shld); memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); init_shielding(); diff --git a/src/bond.cpp b/src/bond.cpp index b414ddbdca..e0ca37aa73 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -36,12 +36,13 @@ int Bond::instance_total = 0; a particular bond style can override this ------------------------------------------------------------------------- */ -Bond::Bond(LAMMPS *_lmp) : Pointers(_lmp) +Bond::Bond(LAMMPS *_lmp) : + Pointers(_lmp), setflag(nullptr), virial{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, eatom(nullptr), + vatom(nullptr), svector(nullptr) { instance_me = instance_total++; energy = 0.0; - virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0; writedata = 1; reinitflag = 1; @@ -53,12 +54,8 @@ Bond::Bond(LAMMPS *_lmp) : Pointers(_lmp) partial_flag = 0; single_extra = 0; - svector = nullptr; maxeatom = maxvatom = 0; - eatom = nullptr; - vatom = nullptr; - setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index ed4fc8dff4..03ae914682 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1536,7 +1536,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"acolor") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); + utils::bounds_typelabel(FLERR,arg[1],1,atom->ntypes,nlo,nhi,lmp,Atom::ATOM); // get list of colors // assign colors in round-robin fashion to types @@ -1557,7 +1557,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"adiam") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); + utils::bounds_typelabel(FLERR,arg[1],1,atom->ntypes,nlo,nhi,lmp,Atom::ATOM); double diam = utils::numeric(FLERR,arg[2],false,lmp); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) diamtype[i] = diam; @@ -1588,7 +1588,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bcolor not allowed with no bond types"); int nlo,nhi; - utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); + utils::bounds_typelabel(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,lmp,Atom::BOND); // process list of ncount colornames separated by '/' // assign colors in round-robin fashion to bond types @@ -1611,7 +1611,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); int nlo,nhi; - utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); + utils::bounds_typelabel(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,lmp,Atom::BOND); double diam = utils::numeric(FLERR,arg[2],false,lmp); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam; diff --git a/src/library.cpp b/src/library.cpp index 32577e47b4..b7a2113de8 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -54,6 +54,7 @@ #include "universe.h" #include "update.h" #include "variable.h" +#include "version.h" #include @@ -1391,6 +1392,11 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name) if (strcmp(name,"respa_levels") == 0) return LAMMPS_INT; if (strcmp(name,"respa_dt") == 0) return LAMMPS_DOUBLE; + if (strcmp(name,"git_commit") == 0) return LAMMPS_STRING; + if (strcmp(name,"git_branch") == 0) return LAMMPS_STRING; + if (strcmp(name,"git_descriptor") == 0) return LAMMPS_STRING; + if (strcmp(name,"lammps_version") == 0) return LAMMPS_STRING; + if (strcmp(name,"boxlo") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"boxhi") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"sublo") == 0) return LAMMPS_DOUBLE; @@ -1547,6 +1553,56 @@ report the "native" data type. The following tables are provided: .. _extract_box_settings: +**Timestep settings** + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Type + - Length + - Description + * - dt + - double + - 1 + - length of the time step. See :doc:`timestep`. + * - ntimestep + - bigint + - 1 + - current time step number. See :doc:`reset_timestep`. + * - atime + - double + - 1 + - accumulated simulation time in time units. + +**Git revision and version settings** + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Type + - Length + - Description + * - git_commit + - const char \* + - 1 + - Git commit hash for the LAMMPS version. + * - git_branch + - const char \* + - 1 + - Git branch for the LAMMPS version. + * - git_descriptor + - const char \* + - 1 + - Combined descriptor for the git revision + * - lammps_version + - const char \* + - 1 + - LAMMPS version string. + **Simulation box settings** .. list-table:: @@ -1557,18 +1613,6 @@ report the "native" data type. The following tables are provided: - Type - Length - Description - * - boxlo - - double - - 3 - - lower box boundaries. See :doc:`create_box`. - * - boxhi - - double - - 3 - - upper box boundaries. See :doc:`create_box`. - * - boxxlo - - double - - 1 - - lower box boundary in x-direction. See :doc:`create_box`. * - boxxhi - double - 1 @@ -1866,6 +1910,12 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"respa_levels") == 0) return (void *) &respa->nlevels; if (strcmp(name,"respa_dt") == 0) return (void *) respa->step; } + + if (strcmp(name,"git_commit") == 0) return (void *)LAMMPS::git_commit; + if (strcmp(name,"git_branch") == 0) return (void *)LAMMPS::git_branch; + if (strcmp(name,"git_descriptor") == 0) return (void *)LAMMPS::git_descriptor; + if (strcmp(name,"lammps_version") == 0) return (void *)LAMMPS_VERSION; + if (strcmp(name,"boxlo") == 0) return (void *) lmp->domain->boxlo; if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi; if (strcmp(name,"sublo") == 0) return (void *) lmp->domain->sublo; @@ -1877,6 +1927,7 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"subhi_lambda") == 0) return (void *) lmp->domain->subhi_lamda; } + if (strcmp(name,"boxxlo") == 0) return (void *) &lmp->domain->boxlo[0]; if (strcmp(name,"boxxhi") == 0) return (void *) &lmp->domain->boxhi[0]; if (strcmp(name,"boxylo") == 0) return (void *) &lmp->domain->boxlo[1]; diff --git a/src/pair.cpp b/src/pair.cpp index 34c8e4978e..036e21ec28 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -53,14 +53,15 @@ int Pair::instance_total = 0; /* ---------------------------------------------------------------------- */ Pair::Pair(LAMMPS *lmp) : - Pointers(lmp), eatom(nullptr), vatom(nullptr), cvatom(nullptr), cutsq(nullptr), - setflag(nullptr), cutghost(nullptr), rtable(nullptr), drtable(nullptr), ftable(nullptr), - dftable(nullptr), ctable(nullptr), dctable(nullptr), etable(nullptr), detable(nullptr), - ptable(nullptr), dptable(nullptr), vtable(nullptr), dvtable(nullptr), rdisptable(nullptr), - drdisptable(nullptr), fdisptable(nullptr), dfdisptable(nullptr), edisptable(nullptr), - dedisptable(nullptr), pvector(nullptr), svector(nullptr), list(nullptr), listhalf(nullptr), - listfull(nullptr), list_tally_compute(nullptr), elements(nullptr), elem1param(nullptr), - elem2param(nullptr), elem3param(nullptr), map(nullptr) + Pointers(lmp), virial{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, eatom(nullptr), vatom(nullptr), + cvatom(nullptr), cutsq(nullptr), setflag(nullptr), cutghost(nullptr), rtable(nullptr), + drtable(nullptr), ftable(nullptr), dftable(nullptr), ctable(nullptr), dctable(nullptr), + etable(nullptr), detable(nullptr), ptable(nullptr), dptable(nullptr), vtable(nullptr), + dvtable(nullptr), rdisptable(nullptr), drdisptable(nullptr), fdisptable(nullptr), + dfdisptable(nullptr), edisptable(nullptr), dedisptable(nullptr), pvector(nullptr), + svector(nullptr), list(nullptr), listhalf(nullptr), listfull(nullptr), + list_tally_compute(nullptr), elements(nullptr), elem1param(nullptr), elem2param(nullptr), + elem3param(nullptr), map(nullptr) { instance_me = instance_total++; diff --git a/src/update.cpp b/src/update.cpp index 9494629221..08f9147b5d 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -63,6 +63,7 @@ Update::Update(LAMMPS *lmp) : restrict_output = 0; setupflag = 0; multireplica = 0; + nsteps = 0; eflag_global = vflag_global = -1; eflag_atom = vflag_atom = 0; diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 8cd7dec88e..6c932735eb 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -50,16 +50,25 @@ void WriteDump::command(int narg, char **arg) int dumpfreq = MAX(1, update->nsteps); dumpfreq += update->ntimestep % dumpfreq; + std::string dump_id = "WRITE_DUMP"; auto dumpargs = new char *[modindex + 2]; - dumpargs[0] = (char *) "WRITE_DUMP"; // dump id + dumpargs[0] = (char *) dump_id.c_str(); // dump id dumpargs[1] = arg[0]; // group dumpargs[2] = arg[1]; // dump style dumpargs[3] = utils::strdup(std::to_string(dumpfreq)); // dump frequency for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i]; - Dump *dump = output->add_dump(modindex + 2, dumpargs); - if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]); + auto *dump = output->add_dump(modindex + 2, dumpargs); + + try { + if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]); + } catch (LAMMPSException &e) { + // delete dump after error and then rethrow the exception to avoid re-use of dump-ID error + dump = output->get_dump_by_id(dump_id); + if (dump) output->delete_dump(dump_id); + throw e; + } // write out one frame and then delete the dump again // set multifile_override for DumpImage so that filename needs no "*" @@ -74,7 +83,7 @@ void WriteDump::command(int narg, char **arg) // delete the Dump instance and local storage - output->delete_dump(dumpargs[0]); + output->delete_dump(dump_id); delete[] dumpargs[3]; delete[] dumpargs; } diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index 7abf8f1e67..92cdb39afd 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -project(lammps-gui VERSION 1.6.5 LANGUAGES CXX) +project(lammps-gui VERSION 1.6.6 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) @@ -198,6 +198,27 @@ if(BUILD_OMP) target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX) endif() +# build LAMMPS-GUI and LAMMPS as flatpak, if tools are installed +find_program(FLATPAK_COMMAND flatpak DOC "Path to flatpak command") +find_program(FLATPAK_BUILDER flatpak-builder DOC "Path to flatpak-builder command") +if(FLATPAK_COMMAND AND FLATPAK_BUILDER) + file(STRINGS ${LAMMPS_DIR}/src/version.h line REGEX LAMMPS_VERSION) + string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z][A-Za-z][A-Za-z])[A-Za-z]* ([0-9]+)\"" + "\\1\\2\\3" LAMMPS_RELEASE "${line}") + add_custom_target(flatpak + COMMAND ${FLATPAK_BUILDER} --force-clean --verbose --ccache --repo=repo --user --default-branch=${LAMMPS_RELEASE} + --install-deps-from=flathub flatpak-build ${LAMMPS_DIR}/tools/lammps-gui/org.lammps.lammps-gui.yml + COMMAND ${FLATPAK_COMMAND} build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo --verbose + repo LAMMPS_GUI-Linux-amd64.flatpak org.lammps.lammps-gui ${LAMMPS_RELEASE} + COMMENT "Create Flatpak bundle file of LAMMPS-GUI and LAMMPS" + BYPRODUCT LAMMPS-Linux-amd64.flatpak + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +else() + add_custom_target(flatpak + COMMAND ${CMAKE_COMMAND} -E echo "The flatpak and flatpak-builder commands required to build a LAMMPS-GUI flatpak bundle were not found. Skipping.") +endif() + # when compiling on macOS, create an "app bundle" if(APPLE) set_target_properties(lammps-gui PROPERTIES @@ -284,6 +305,7 @@ elseif((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND NOT LAMMPS_GUI_USE_PLUGIN) install(TARGETS lammps-gui DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-gui.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-gui.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-input.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-input.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/text/x-application-lammps.xml) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/icons/hicolor DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/) @@ -307,10 +329,11 @@ elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND NOT LAMMPS_GUI_USE_PLUGIN) message(WARNING "Unresolved dependencies detected: ${_u_deps}") endif() ]] ) + add_custom_target(tgz COMMAND ${LAMMPS_DIR}/cmake/packaging/build_linux_tgz.sh DEPENDS lammps-gui - COMMENT "Create compressed tar file of LAMMPS with dependent libraries and wrapper" + COMMENT "Create compressed tar file of LAMMPS-GUI with dependent libraries and wrapper" BYPRODUCT LAMMPS-Linux-amd64.tar.gz WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) diff --git a/tools/lammps-gui/TODO.md b/tools/lammps-gui/TODO.md index bef30c1309..40788f0e8e 100644 --- a/tools/lammps-gui/TODO.md +++ b/tools/lammps-gui/TODO.md @@ -4,7 +4,12 @@ LAMMPS-GUI TODO list: - figure out how widgets can be resized to fraction of available screen size. - figure out stacking order of frames and whether it can be more flexible -- bundle LAMMPS tutorial input files +- figure out how to avoid corrupted cached thermo data while reading it. +- implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences. +- bundle or download? LAMMPS tutorial input files +- add a "Colors" menu to the image viewer to adjust color settings for the + current image (unlike the defaults in the perferences). Support color by + property (e.g. scan computes or fixes with per-atom data), define colormaps etc. - implement indenting regions for (nested) loops? - implement data file manager GUI with the following features: diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index 36a811b92d..10d829d34c 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -14,6 +14,7 @@ #include "codeeditor.h" #include "fileviewer.h" #include "lammpsgui.h" +#include "lammpswrapper.h" #include "linenumberarea.h" #include @@ -146,6 +147,7 @@ CodeEditor::CodeEditor(QWidget *parent) : { help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent); connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help); + docver = ""; // set up completer class (without a model currently) #define COMPLETER_SETUP(completer) \ @@ -1159,12 +1161,30 @@ void CodeEditor::insertCompletedCommand(const QString &completion) setTextCursor(cursor); } +void CodeEditor::setDocver() +{ + LammpsWrapper *lammps = &qobject_cast(parent())->lammps; + docver = "/"; + if (lammps) { + QString git_branch = (const char *)lammps->extract_global("git_branch"); + if ((git_branch == "stable") || (git_branch == "maintenance")) { + docver = "/stable/"; + } else if (git_branch == "release") { + docver = "/"; + } else { + docver = "/latest/"; + } + } +} + void CodeEditor::get_help() { QString page, help; find_help(page, help); + if (docver.isEmpty()) setDocver(); if (!page.isEmpty()) - QDesktopServices::openUrl(QUrl(QString("https://docs.lammps.org/%1").arg(page))); + QDesktopServices::openUrl( + QUrl(QString("https://docs.lammps.org%1%2").arg(docver).arg(page))); } void CodeEditor::find_help(QString &page, QString &help) @@ -1215,8 +1235,9 @@ void CodeEditor::find_help(QString &page, QString &help) void CodeEditor::open_help() { auto *act = qobject_cast(sender()); + if (docver.isEmpty()) setDocver(); QDesktopServices::openUrl( - QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString()))); + QUrl(QString("https://docs.lammps.org%1%2").arg(docver).arg(act->data().toString()))); } void CodeEditor::open_url() diff --git a/tools/lammps-gui/codeeditor.h b/tools/lammps-gui/codeeditor.h index 873b13e302..17236e3252 100644 --- a/tools/lammps-gui/codeeditor.h +++ b/tools/lammps-gui/codeeditor.h @@ -79,6 +79,7 @@ protected: void dropEvent(QDropEvent *event) override; void contextMenuEvent(QContextMenuEvent *event) override; void keyPressEvent(QKeyEvent *event) override; + void setDocver(); private slots: void updateLineNumberAreaWidth(int newBlockCount); @@ -107,6 +108,7 @@ private: int highlight; bool reformat_on_return; bool automatic_completion; + QString docver; QMap cmd_map; QMap fix_map; diff --git a/tools/lammps-gui/fileviewer.cpp b/tools/lammps-gui/fileviewer.cpp index 69bda7d91b..acd966329a 100644 --- a/tools/lammps-gui/fileviewer.cpp +++ b/tools/lammps-gui/fileviewer.cpp @@ -16,6 +16,7 @@ #include "lammpsgui.h" #include +#include #include #include #include diff --git a/tools/lammps-gui/help_index.table b/tools/lammps-gui/help_index.table index 5aa9e13dda..a17b24fef5 100644 --- a/tools/lammps-gui/help_index.table +++ b/tools/lammps-gui/help_index.table @@ -20,6 +20,8 @@ angle_cosine_shift_exp.html angle_style cosine/shift/exp angle_cosine_shift_exp.html angle_style cosine/shift/exp/omp angle_cosine_shift.html angle_style cosine/shift angle_cosine_shift.html angle_style cosine/shift/omp +angle_cosine_squared_restricted.html angle_style cosine/squared/restricted +angle_cosine_squared_restricted.html angle_style cosine/squared/restricted/omp angle_cosine_squared.html angle_style cosine/squared angle_cosine_squared.html angle_style cosine/squared/omp angle_cross.html angle_style cross @@ -35,6 +37,7 @@ angle_harmonic.html angle_style harmonic/intel angle_harmonic.html angle_style harmonic/kk angle_harmonic.html angle_style harmonic/omp angle_hybrid.html angle_style hybrid +angle_hybrid.html angle_style hybrid/kk angle_lepton.html angle_style lepton angle_lepton.html angle_style lepton/omp angle_mesocnt.html angle_style mesocnt @@ -43,6 +46,7 @@ angle_none.html angle_style none angle_quartic.html angle_style quartic angle_quartic.html angle_style quartic/omp angle_spica.html angle_style spica +angle_spica.html angle_style spica/kk angle_spica.html angle_style spica/omp angle_style.html angle_style angle_table.html angle_style table @@ -150,6 +154,7 @@ bond_harmonic_shift_cut.html bond_style harmonic/shift/cut/omp bond_harmonic_shift.html bond_style harmonic/shift bond_harmonic_shift.html bond_style harmonic/shift/omp bond_hybrid.html bond_style hybrid +bond_hybrid.html bond_style hybrid/kk bond_lepton.html bond_style lepton bond_lepton.html bond_style lepton/omp bond_mesocnt.html bond_style mesocnt @@ -164,6 +169,7 @@ bond_oxdna.html bond_style oxdna/fene bond_oxdna.html bond_style oxrna2/fene bond_quartic.html bond_style quartic bond_quartic.html bond_style quartic/omp +bond_rheo_shell.html bond_style rheo/shell bond_special.html bond_style special bond_style.html bond_style bond_table.html bond_style table @@ -260,6 +266,10 @@ compute_pair.html compute pair compute_pe_atom.html compute pe/atom compute_pe.html compute pe compute_plasticity_atom.html compute plasticity/atom +compute_pod_atom.html compute pod/atom +compute_pod_atom.html compute podd/atom +compute_pod_atom.html compute pod/global +compute_pod_atom.html compute pod/local compute_pressure_alchemy.html compute pressure/alchemy compute_pressure.html compute pressure compute_pressure_uef.html compute pressure/uef @@ -275,6 +285,7 @@ compute_reaxff_atom.html compute reaxff/atom/kk compute_reduce_chunk.html compute reduce/chunk compute_reduce.html compute reduce compute_reduce.html compute reduce/region +compute_rheo_property_atom.html compute rheo/property/atom compute_rigid_local.html compute rigid/local compute.html compute compute_saed.html compute saed @@ -360,6 +371,7 @@ delete_bonds.html delete_bonds dielectric.html dielectric dihedral_charmm.html dihedral_style charmm dihedral_charmm.html dihedral_style charmmfsw +dihedral_charmm.html dihedral_style charmmfsw/kk dihedral_charmm.html dihedral_style charmm/intel dihedral_charmm.html dihedral_style charmm/kk dihedral_charmm.html dihedral_style charmm/omp @@ -369,6 +381,7 @@ dihedral_class2.html dihedral_style class2/omp dihedral_coeff.html dihedral_coeff dihedral_cosine_shift_exp.html dihedral_style cosine/shift/exp dihedral_cosine_shift_exp.html dihedral_style cosine/shift/exp/omp +dihedral_cosine_squared_restricted.html dihedral_style cosine/squared/restricted dihedral_fourier.html dihedral_style fourier dihedral_fourier.html dihedral_style fourier/intel dihedral_fourier.html dihedral_style fourier/omp @@ -379,6 +392,7 @@ dihedral_harmonic.html dihedral_style harmonic/omp dihedral_helix.html dihedral_style helix dihedral_helix.html dihedral_style helix/omp dihedral_hybrid.html dihedral_style hybrid +dihedral_hybrid.html dihedral_style hybrid/kk dihedral_lepton.html dihedral_style lepton dihedral_lepton.html dihedral_style lepton/omp dihedral_multi_harmonic.html dihedral_style multi/harmonic @@ -443,6 +457,7 @@ fix_acks2_reaxff.html fix acks2/reaxff/kk fix_adapt_fep.html fix adapt/fep fix_adapt.html fix adapt fix_addforce.html fix addforce +fix_add_heat.html fix add/heat fix_addtorque.html fix addtorque fix_alchemy.html fix alchemy fix_amoeba_bitorsion.html fix amoeba/bitorsion @@ -475,6 +490,7 @@ fix_cmap.html fix cmap fix_colvars.html fix colvars fix_controller.html fix controller fix_damping_cundall.html fix damping/cundall +fix_deform_pressure.html fix deform/pressure fix_deform.html fix deform fix_deform.html fix deform/kk fix_deposit.html fix deposit @@ -667,6 +683,11 @@ fix_reaxff_species.html fix reaxff/species fix_reaxff_species.html fix reaxff/species/kk fix_recenter.html fix recenter fix_restrain.html fix restrain +fix_rheo_oxidation.html fix rheo/oxidation +fix_rheo_pressure.html fix rheo/pressure +fix_rheo.html fix rheo +fix_rheo_thermal.html fix rheo/thermal +fix_rheo_viscosity.html fix rheo/viscosity fix_rhok.html fix rhok fix_rigid_meso.html fix rigid/meso fix_rigid.html fix rigid @@ -741,6 +762,8 @@ fix_wall_body_polygon.html fix wall/body/polygon fix_wall_body_polyhedron.html fix wall/body/polyhedron fix_wall_ees.html fix wall/ees fix_wall_ees.html fix wall/region/ees +fix_wall_flow.html fix wall/flow +fix_wall_flow.html fix wall/flow/kk fix_wall_gran_region.html fix wall/gran/region fix_wall_gran.html fix wall/gran fix_wall_gran.html fix wall/gran/kk @@ -784,6 +807,7 @@ improper_harmonic.html improper_style harmonic/intel improper_harmonic.html improper_style harmonic/kk improper_harmonic.html improper_style harmonic/omp improper_hybrid.html improper_style hybrid +improper_hybrid.html improper_style hybrid/kk improper_inversion_harmonic.html improper_style inversion/harmonic improper_none.html improper_style none improper_ring.html improper_style ring @@ -937,6 +961,7 @@ pair_charmm.html pair_style lj/charmm/coul/msm pair_charmm.html pair_style lj/charmm/coul/msm/omp pair_charmm.html pair_style lj/charmmfsw/coul/charmmfsh pair_charmm.html pair_style lj/charmmfsw/coul/long +pair_charmm.html pair_style lj/charmmfsw/coul/long/kk pair_class2.html pair_style lj/class2 pair_class2.html pair_style lj/class2/coul/cut pair_class2.html pair_style lj/class2/coul/cut/kk @@ -1024,6 +1049,8 @@ pair_dipole.html pair_style lj/long/dipole/long pair_dipole.html pair_style lj/sf/dipole/sf pair_dipole.html pair_style lj/sf/dipole/sf/gpu pair_dipole.html pair_style lj/sf/dipole/sf/omp +pair_dpd_coul_slater_long.html pair_style dpd/coul/slater/long +pair_dpd_coul_slater_long.html pair_style dpd/coul/slater/long/gpu pair_dpd_ext.html pair_style dpd/ext pair_dpd_ext.html pair_style dpd/ext/kk pair_dpd_ext.html pair_style dpd/ext/omp @@ -1132,9 +1159,14 @@ pair_hbond_dreiding.html pair_style hbond/dreiding/morse/omp pair_hdnnp.html pair_style hdnnp pair_hybrid.html pair_style hybrid pair_hybrid.html pair_style hybrid/kk +pair_hybrid.html pair_style hybrid/molecular +pair_hybrid.html pair_style hybrid/molecular/omp +pair_hybrid.html pair_style hybrid/omp pair_hybrid.html pair_style hybrid/overlay pair_hybrid.html pair_style hybrid/overlay/kk +pair_hybrid.html pair_style hybrid/overlay/omp pair_hybrid.html pair_style hybrid/scaled +pair_hybrid.html pair_style hybrid/scaled/omp pair_ilp_graphene_hbn.html pair_style ilp/graphene/hbn pair_ilp_graphene_hbn.html pair_style ilp/graphene/hbn/opt pair_ilp_tmd.html pair_style ilp/tmd @@ -1292,6 +1324,8 @@ pair_pace.html pair_style pace pair_pace.html pair_style pace/extrapolation pair_pace.html pair_style pace/extrapolation/kk pair_pace.html pair_style pace/kk +pair_pedone.html pair_style pedone +pair_pedone.html pair_style pedone/omp pair_peri.html pair_style peri/eps pair_peri.html pair_style peri/lps pair_peri.html pair_style peri/lps/omp @@ -1299,6 +1333,7 @@ pair_peri.html pair_style peri/pmb pair_peri.html pair_style peri/pmb/omp pair_peri.html pair_style peri/ves pair_pod.html pair_style pod +pair_pod.html pair_style pod/kk pair_polymorphic.html pair_style polymorphic pair_python.html pair_style python pair_quip.html pair_style quip @@ -1306,9 +1341,13 @@ pair_rann.html pair_style rann pair_reaxff.html pair_style reaxff pair_reaxff.html pair_style reaxff/kk pair_reaxff.html pair_style reaxff/omp +pair_rebomos.html pair_style rebomos +pair_rebomos.html pair_style rebomos/omp pair_resquared.html pair_style resquared pair_resquared.html pair_style resquared/gpu pair_resquared.html pair_style resquared/omp +pair_rheo.html pair_style rheo +pair_rheo_solid.html pair_style rheo/solid pair_saip_metal.html pair_style saip/metal pair_saip_metal.html pair_style saip/metal/opt pair_sdpd_taitwater_isothermal.html pair_style sdpd/taitwater/isothermal @@ -1324,6 +1363,7 @@ pair_snap.html pair_style snap/intel pair_snap.html pair_style snap/kk pair_soft.html pair_style soft pair_soft.html pair_style soft/gpu +pair_soft.html pair_style soft/kk pair_soft.html pair_style soft/omp pair_sph_heatconduction.html pair_style sph/heatconduction pair_sph_heatconduction.html pair_style sph/heatconduction/gpu @@ -1337,6 +1377,7 @@ pair_sph_taitwater.html pair_style sph/taitwater/gpu pair_spica.html pair_style lj/spica pair_spica.html pair_style lj/spica/coul/long pair_spica.html pair_style lj/spica/coul/long/gpu +pair_spica.html pair_style lj/spica/coul/long/kk pair_spica.html pair_style lj/spica/coul/long/omp pair_spica.html pair_style lj/spica/coul/msm pair_spica.html pair_style lj/spica/coul/msm/omp @@ -1390,6 +1431,8 @@ pair_thole.html pair_style thole pair_threebody_table.html pair_style threebody/table pair_tracker.html pair_style tracker pair_tri_lj.html pair_style tri/lj +pair_uf3.html pair_style uf3 +pair_uf3.html pair_style uf3/kk pair_ufm.html pair_style ufm pair_ufm.html pair_style ufm/gpu pair_ufm.html pair_style ufm/omp diff --git a/tools/lammps-gui/icons/image-shiny.png b/tools/lammps-gui/icons/image-shiny.png new file mode 100644 index 0000000000..33cd7502b3 Binary files /dev/null and b/tools/lammps-gui/icons/image-shiny.png differ diff --git a/tools/lammps-gui/imageviewer.cpp b/tools/lammps-gui/imageviewer.cpp index 0894855a02..4841d651d0 100644 --- a/tools/lammps-gui/imageviewer.cpp +++ b/tools/lammps-gui/imageviewer.cpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -150,9 +152,11 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge QSettings settings; - vdwfactor = 0.5; - auto pix = QPixmap(":/icons/emblem-photos.png"); + vdwfactor = 0.5; + shinyfactor = 0.6; + auto pix = QPixmap(":/icons/emblem-photos.png"); xcenter = ycenter = zcenter = 0.5; + auto bsize = QFontMetrics(QApplication::font()).size(Qt::TextSingleLine, "Height: 200"); auto *renderstatus = new QLabel(QString()); renderstatus->setPixmap(pix.scaled(22, 22, Qt::KeepAspectRatio)); @@ -166,19 +170,23 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge xval->setValue(settings.value("xsize", "800").toInt()); xval->setObjectName("xsize"); xval->setToolTip("Set rendered image width"); + xval->setMinimumSize(bsize); auto *yval = new QSpinBox; yval->setRange(100, 10000); yval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType); yval->setValue(settings.value("ysize", "600").toInt()); yval->setObjectName("ysize"); yval->setToolTip("Set rendered image height"); + yval->setMinimumSize(bsize); settings.endGroup(); connect(xval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size); connect(yval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size); // workaround for incorrect highlight bug on macOS - auto *dummy = new QPushButton(QIcon(), ""); - dummy->hide(); + auto *dummy1 = new QPushButton(QIcon(), ""); + dummy1->hide(); + auto *dummy2 = new QPushButton(QIcon(), ""); + dummy2->hide(); auto *dossao = new QPushButton(QIcon(":/icons/hd-img.png"), ""); dossao->setCheckable(true); @@ -188,6 +196,10 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge doanti->setCheckable(true); doanti->setToolTip("Toggle anti-aliasing"); doanti->setObjectName("antialias"); + auto *doshiny = new QPushButton(QIcon(":/icons/image-shiny.png"), ""); + doshiny->setCheckable(true); + doshiny->setToolTip("Toggle shininess"); + doshiny->setObjectName("shiny"); auto *dovdw = new QPushButton(QIcon(":/icons/vdw-style.png"), ""); dovdw->setCheckable(true); dovdw->setToolTip("Toggle VDW style representation"); @@ -229,32 +241,41 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge combo->addItem(gname); } - auto *menuLayout = new QHBoxLayout; + auto *menuLayout = new QHBoxLayout; + auto *buttonLayout = new QHBoxLayout; + auto *topLayout = new QVBoxLayout; + topLayout->addLayout(menuLayout); + topLayout->addLayout(buttonLayout); + menuLayout->addWidget(menuBar); menuLayout->addWidget(renderstatus); menuLayout->addWidget(new QLabel(" Width: ")); menuLayout->addWidget(xval); menuLayout->addWidget(new QLabel(" Height: ")); menuLayout->addWidget(yval); - menuLayout->addWidget(dummy); - menuLayout->addWidget(dossao); - menuLayout->addWidget(doanti); - menuLayout->addWidget(dovdw); - menuLayout->addWidget(dobox); - menuLayout->addWidget(doaxes); - menuLayout->addWidget(zoomin); - menuLayout->addWidget(zoomout); - menuLayout->addWidget(rotleft); - menuLayout->addWidget(rotright); - menuLayout->addWidget(rotup); - menuLayout->addWidget(rotdown); - menuLayout->addWidget(recenter); - menuLayout->addWidget(reset); + menuLayout->addWidget(dummy1); menuLayout->addWidget(new QLabel(" Group: ")); menuLayout->addWidget(combo); + buttonLayout->addWidget(dummy2); + buttonLayout->addWidget(dossao); + buttonLayout->addWidget(doanti); + buttonLayout->addWidget(doshiny); + buttonLayout->addWidget(dovdw); + buttonLayout->addWidget(dobox); + buttonLayout->addWidget(doaxes); + buttonLayout->addWidget(zoomin); + buttonLayout->addWidget(zoomout); + buttonLayout->addWidget(rotleft); + buttonLayout->addWidget(rotright); + buttonLayout->addWidget(rotup); + buttonLayout->addWidget(rotdown); + buttonLayout->addWidget(recenter); + buttonLayout->addWidget(reset); + buttonLayout->addStretch(1); connect(dossao, &QPushButton::released, this, &ImageViewer::toggle_ssao); connect(doanti, &QPushButton::released, this, &ImageViewer::toggle_anti); + connect(doshiny, &QPushButton::released, this, &ImageViewer::toggle_shiny); connect(dovdw, &QPushButton::released, this, &ImageViewer::toggle_vdw); connect(dobox, &QPushButton::released, this, &ImageViewer::toggle_box); connect(doaxes, &QPushButton::released, this, &ImageViewer::toggle_axes); @@ -268,7 +289,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge connect(reset, &QPushButton::released, this, &ImageViewer::reset_view); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(change_group(int))); - mainLayout->addLayout(menuLayout); + mainLayout->addLayout(topLayout); mainLayout->addWidget(scrollArea); setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); setWindowTitle(QString("LAMMPS-GUI - Image Viewer - ") + QFileInfo(fileName).fileName()); @@ -278,6 +299,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge // layout has not yet be established, so we need to fix up some pushbutton // properties directly since lookup in reset_view() will have failed dobox->setChecked(showbox); + doshiny->setChecked(shinyfactor > 0.4); dovdw->setChecked(vdwfactor > 1.0); dovdw->setEnabled(useelements || usediameter || usesigma); doaxes->setChecked(showaxes); @@ -296,16 +318,17 @@ void ImageViewer::reset_view() { QSettings settings; settings.beginGroup("snapshot"); - xsize = settings.value("xsize", "800").toInt(); - ysize = settings.value("ysize", "600").toInt(); - zoom = settings.value("zoom", 1.0).toDouble(); - hrot = settings.value("hrot", 60).toInt(); - vrot = settings.value("vrot", 30).toInt(); - vdwfactor = settings.value("vdwstyle", false).toBool() ? 1.6 : 0.5; - showbox = settings.value("box", true).toBool(); - showaxes = settings.value("axes", false).toBool(); - usessao = settings.value("ssao", false).toBool(); - antialias = settings.value("antialias", false).toBool(); + xsize = settings.value("xsize", "800").toInt(); + ysize = settings.value("ysize", "600").toInt(); + zoom = settings.value("zoom", 1.0).toDouble(); + hrot = settings.value("hrot", 60).toInt(); + vrot = settings.value("vrot", 30).toInt(); + shinyfactor = settings.value("shinystyle", true).toBool() ? 0.6 : 0.2; + vdwfactor = settings.value("vdwstyle", false).toBool() ? 1.6 : 0.5; + showbox = settings.value("box", true).toBool(); + showaxes = settings.value("axes", false).toBool(); + usessao = settings.value("ssao", false).toBool(); + antialias = settings.value("antialias", false).toBool(); xcenter = ycenter = zcenter = 0.5; settings.endGroup(); @@ -320,6 +343,8 @@ void ImageViewer::reset_view() if (button) button->setChecked(usessao); button = findChild("antialias"); if (button) button->setChecked(antialias); + button = findChild("shiny"); + if (button) button->setChecked(shinyfactor > 0.4); button = findChild("vdw"); if (button) button->setChecked(vdwfactor > 1.0); button = findChild("box"); @@ -358,6 +383,17 @@ void ImageViewer::toggle_anti() createImage(); } +void ImageViewer::toggle_shiny() +{ + auto *button = qobject_cast(sender()); + if (shinyfactor > 0.4) + shinyfactor = 0.2; + else + shinyfactor = 0.6; + button->setChecked(shinyfactor > 0.4); + createImage(); +} + void ImageViewer::toggle_vdw() { auto *button = qobject_cast(sender()); @@ -508,12 +544,14 @@ void ImageViewer::createImage() // use Lennard-Jones sigma for radius, if available usesigma = false; const char *pair_style = (const char *)lammps->extract_global("pair_style"); - if (!useelements && pair_style && (strncmp(pair_style, "lj/", 3) == 0)) { + if (!useelements && !usediameter && pair_style && (strncmp(pair_style, "lj/", 3) == 0)) { double **sigma = (double **)lammps->extract_pair("sigma"); if (sigma) { usesigma = true; - for (int i = 1; i <= ntypes; ++i) - adiams += QString("adiam %1 %2 ").arg(i).arg(vdwfactor * sigma[i][i]); + for (int i = 1; i <= ntypes; ++i) { + if (sigma[i][i] > 0.0) + adiams += QString("adiam %1 %2 ").arg(i).arg(vdwfactor * sigma[i][i]); + } } } // adjust pushbutton state and clear adiams string to disable VDW display, if needed @@ -526,17 +564,20 @@ void ImageViewer::createImage() if (button) button->setEnabled(false); } + // color if (useelements) dumpcmd += blank + "element"; else dumpcmd += blank + settings.value("color", "type").toString(); + + // diameter if (usediameter && (vdwfactor > 1.0)) dumpcmd += blank + "diameter"; else dumpcmd += blank + settings.value("diameter", "type").toString(); dumpcmd += QString(" size %1 %2").arg(xsize).arg(ysize); dumpcmd += QString(" zoom %1").arg(zoom); - dumpcmd += " shiny 0.5 "; + dumpcmd += QString(" shiny %1 ").arg(shinyfactor); dumpcmd += QString(" fsaa %1").arg(antialias ? "yes" : "no"); if (nbondtypes > 0) { if (vdwfactor > 1.0) diff --git a/tools/lammps-gui/imageviewer.h b/tools/lammps-gui/imageviewer.h index f9b935640e..94632bde89 100644 --- a/tools/lammps-gui/imageviewer.h +++ b/tools/lammps-gui/imageviewer.h @@ -46,6 +46,7 @@ private slots: void reset_view(); void toggle_ssao(); void toggle_anti(); + void toggle_shiny(); void toggle_vdw(); void toggle_box(); void toggle_axes(); @@ -90,7 +91,7 @@ private: QString last_dump_cmd; int xsize, ysize; int hrot, vrot; - double zoom, vdwfactor; + double zoom, vdwfactor, shinyfactor; double xcenter, ycenter, zcenter; bool showbox, showaxes, antialias, usessao, useelements, usediameter, usesigma; }; diff --git a/tools/lammps-gui/lammps-gui.appdata.xml b/tools/lammps-gui/lammps-gui.appdata.xml new file mode 100644 index 0000000000..b4d121e13d --- /dev/null +++ b/tools/lammps-gui/lammps-gui.appdata.xml @@ -0,0 +1,63 @@ + + + lammps-gui.desktop + CC-BY-3.0 + GPL-2.0 + LAMMPS-GUI + + Graphical interface to edit, run, plot, and visualize simulations with the LAMMPS MD code + + + +

LAMMPS-GUI is an editor customized for editing input files for the LAMMPS MD simulation software. It also includes LAMMPS and thus can run it directly from the GUI. Furthermore it has facilities to create or view and animate snapshot images, monitor and plot thermodynamic properties and show the console output of the running simulation.

+
+ + + https://docs.lammps.org/_images/lammps-gui-main.png + LAMMPS-GUI main editor window + + + https://docs.lammps.org/_images/lammps-gui-log.png + LAMMPS-GUI output window + + + https://docs.lammps.org/_images/lammps-gui-chart.png + LAMMPS-GUI chart window + + + https://docs.lammps.org/_images/lammps-gui-slideshow.png + LAMMPS-GUI slideshow window + + + https://docs.lammps.org/_images/lammps-gui-image.png + LAMMPS-GUI snapshot image window + + + + https://www.lammps.org/ + https://github.com/lammps/lammps/issues + https://docs.lammps.org/stable/ + + packages@lammps.org + Axel Kohlmeyer + LAMMPS + + Molecular Dynamics + Physics + Editor + N-body + + + + lammps-gui + lmp + + + + + + First version packaged in flatpak format + + + +
diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index d42d59bca2..1b477f63c4 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include +#include #include #include #include @@ -74,6 +76,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : qRegisterMetaTypeStreamOperators>("QList"); #endif + docver = ""; ui->setupUi(this); this->setCentralWidget(ui->textEdit); highlighter = new Highlighter(ui->textEdit->document()); @@ -137,8 +140,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : // check and initialize nthreads setting. Default is to use max if there // is no preference but do not override OMP_NUM_THREADS #if defined(_OPENMP) - // use maximum number of available threads unless OMP_NUM_THREADS was set - int nthreads = settings.value("nthreads", omp_get_max_threads()).toInt(); + // use up to 16 available threads unless OMP_NUM_THREADS was set + int nthreads = settings.value("nthreads", std::min(omp_get_max_threads(), 16)).toInt(); if (!qEnvironmentVariableIsSet("OMP_NUM_THREADS")) { qputenv("OMP_NUM_THREADS", std::to_string(nthreads).c_str()); } @@ -152,6 +155,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : lammps_args.push_back(mystrdup("-log")); lammps_args.push_back(mystrdup("none")); + installEventFilter(this); + setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); QFont all_font("Arial", -1); @@ -355,7 +360,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : #undef ADD_STYLES settings.beginGroup("reformat"); - ui->textEdit->setReformatOnReturn(settings.value("return", true).toBool()); + ui->textEdit->setReformatOnReturn(settings.value("return", false).toBool()); ui->textEdit->setAutoComplete(settings.value("automatic", true).toBool()); settings.endGroup(); } @@ -713,6 +718,7 @@ void LammpsGui::quit() lammpsstatus->hide(); lammps.finalize(); + autoSave(); if (ui->textEdit->document()->isModified()) { QMessageBox msg; msg.setWindowTitle("Unsaved Changes"); @@ -1002,6 +1008,7 @@ void LammpsGui::do_run(bool use_buffer) return; } + autoSave(); if (!use_buffer && ui->textEdit->document()->isModified()) { QMessageBox msg; msg.setWindowTitle("Unsaved Changes"); @@ -1217,6 +1224,35 @@ void LammpsGui::view_variables() } } +void LammpsGui::setDocver() +{ + QString git_branch = (const char *)lammps.extract_global("git_branch"); + if ((git_branch == "stable") || (git_branch == "maintenance")) { + docver = "/stable/"; + } else if (git_branch == "release") { + docver = "/"; + } else { + docver = "/latest/"; + } +} + +void LammpsGui::autoSave() +{ + // no need to auto-save, if the document has no name or is not modified. + QString fileName = current_file; + if (fileName.isEmpty()) return; + if (!ui->textEdit->document()->isModified()) return; + + // check preference + bool autosave = false; + QSettings settings; + settings.beginGroup("reformat"); + autosave = settings.value("autosave", false).toBool(); + settings.endGroup(); + + if (autosave) write_file(fileName); +} + void LammpsGui::about() { std::string version = "This is LAMMPS-GUI version " LAMMPS_GUI_VERSION; @@ -1328,7 +1364,8 @@ void LammpsGui::help() void LammpsGui::manual() { - QDesktopServices::openUrl(QUrl("https://docs.lammps.org/")); + if (docver.isEmpty()) setDocver(); + QDesktopServices::openUrl(QUrl(QString("https://docs.lammps.org%1").arg(docver))); } void LammpsGui::tutorial() @@ -1338,7 +1375,9 @@ void LammpsGui::tutorial() void LammpsGui::howto() { - QDesktopServices::openUrl(QUrl("https://docs.lammps.org/Howto_lammps_gui.html")); + if (docver.isEmpty()) setDocver(); + QDesktopServices::openUrl( + QUrl(QString("https://docs.lammps.org%1Howto_lammps_gui.html").arg(docver))); } void LammpsGui::defaults() @@ -1395,7 +1434,7 @@ void LammpsGui::preferences() } if (imagewindow) imagewindow->createImage(); settings.beginGroup("reformat"); - ui->textEdit->setReformatOnReturn(settings.value("return", true).toBool()); + ui->textEdit->setReformatOnReturn(settings.value("return", false).toBool()); ui->textEdit->setAutoComplete(settings.value("automatic", true).toBool()); settings.endGroup(); } @@ -1488,6 +1527,13 @@ void LammpsGui::start_lammps() } } +bool LammpsGui::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::Close) { + autoSave(); + } + return QWidget::eventFilter(watched, event); +} // Local Variables: // c-basic-offset: 4 // End: diff --git a/tools/lammps-gui/lammpsgui.h b/tools/lammps-gui/lammpsgui.h index 29372efc1c..a575b0acc1 100644 --- a/tools/lammps-gui/lammpsgui.h +++ b/tools/lammps-gui/lammpsgui.h @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -69,6 +70,9 @@ protected: void do_run(bool use_buffer); void start_lammps(); void run_done(); + void setDocver(); + void autoSave(); + bool eventFilter(QObject *watched, QEvent *event) override; public slots: void quit(); @@ -132,6 +136,7 @@ private: LammpsWrapper lammps; LammpsRunner *runner; + QString docver; std::string plugin_path; bool is_running; int run_counter; diff --git a/tools/lammps-gui/lammpsgui.qrc b/tools/lammps-gui/lammpsgui.qrc index eb7c1fbc19..510d86689f 100644 --- a/tools/lammps-gui/lammpsgui.qrc +++ b/tools/lammps-gui/lammpsgui.qrc @@ -42,6 +42,7 @@ icons/help-browser.png icons/help-faq.png icons/help-tutorial.png + icons/image-shiny.png icons/image-x-generic.png icons/media-playback-start-2.png icons/media-playlist-repeat.png diff --git a/tools/lammps-gui/org.lammps.lammps-gui.yml b/tools/lammps-gui/org.lammps.lammps-gui.yml new file mode 100644 index 0000000000..e72a7714cf --- /dev/null +++ b/tools/lammps-gui/org.lammps.lammps-gui.yml @@ -0,0 +1,111 @@ +id: org.lammps.lammps-gui +runtime: org.kde.Platform +runtime-version: "5.15-23.08" +sdk: org.kde.Sdk +command: lammps-gui +finish-args: + - --share=ipc + - --socket=fallback-x11 + - --socket=wayland + - --filesystem=host +build-options: + build-args: + - --share=network +rename-icon: lammps +rename-desktop-file: lammps-gui.desktop +rename-appdata-file: lammps-gui.appdata.xml +rename-mime-file: lammps-input.xml +modules: + - name: lammps-gui + buildsystem: cmake-ninja + builddir: true + subdir: cmake + config-opts: + - -D PKG_AMOEBA=yes + - -D PKG_ASPHERE=yes + - -D PKG_AWPMD=yes + - -D PKG_BOCS=yes + - -D PKG_BODY=yes + - -D PKG_BPM=yes + - -D PKG_BROWNIAN=yes + - -D PKG_CG-DNA=yes + - -D PKG_CG-SPICA=yes + - -D PKG_CLASS2=yes + - -D PKG_COLLOID=yes + - -D PKG_COLVARS=yes + - -D PKG_COMPRESS=yes + - -D PKG_CORESHELL=yes + - -D PKG_DIELECTRIC=yes + - -D PKG_DIFFRACTION=yes + - -D PKG_DIPOLE=yes + - -D PKG_DPD-BASIC=yes + - -D PKG_DPD-MESO=yes + - -D PKG_DPD-REACT=yes + - -D PKG_DPD-SMOOTH=yes + - -D PKG_DRUDE=yes + - -D PKG_EFF=yes + - -D PKG_ELECTRODE=yes + - -D PKG_EXTRA-COMMAND=yes + - -D PKG_EXTRA-COMPUTE=yes + - -D PKG_EXTRA-DUMP=yes + - -D PKG_EXTRA-FIX=yes + - -D PKG_EXTRA-MOLECULE=yes + - -D PKG_EXTRA-PAIR=yes + - -D PKG_FEP=yes + - -D PKG_GRANULAR=yes + - -D PKG_GPU=yes + - -D GPU_API=opencl + - -D PKG_INTERLAYER=yes + - -D PKG_KSPACE=yes + - -D PKG_LEPTON=yes + - -D PKG_MACHDYN=yes + - -D PKG_MANYBODY=yes + - -D PKG_MANIFOLD=yes + - -D PKG_MC=yes + - -D PKG_MEAM=yes + - -D PKG_MESONT=yes + - -D PKG_MGPT=yes + - -D PKG_MISC=yes + - -D PKG_ML-IAP=yes + - -D PKG_ML-PACE=yes + - -D PKG_ML-POD=yes + - -D PKG_ML-RANN=yes + - -D PKG_ML-SNAP=yes + - -D PKG_ML-UF3=yes + - -D PKG_MOFFF=yes + - -D PKG_MOLECULE=yes + - -D PKG_OPENMP=yes + - -D PKG_OPT=yes + - -D PKG_ORIENT=yes + - -D PKG_PERI=yes + - -D PKG_PHONON=yes + - -D PKG_PLUGIN=yes + - -D PKG_POEMS=yes + - -D PKG_PTM=yes + - -D PKG_PYTHON=yes + - -D PKG_QEQ=yes + - -D PKG_QTB=yes + - -D PKG_REACTION=yes + - -D PKG_REAXFF=yes + - -D PKG_RIGID=yes + - -D PKG_SHOCK=yes + - -D PKG_SMTBQ=yes + - -D PKG_SPH=yes + - -D PKG_SPIN=yes + - -D PKG_SRD=yes + - -D PKG_TALLY=yes + - -D PKG_UEF=yes + - -D PKG_VORONOI=yes + - -D PKG_YAFF=yes + - -D BUILD_LAMMPS_GUI=yes + - -D BUILD_SHARED_LIBS=yes + - -D CMAKE_CXX_COMPILER=g++ + - -D CMAKE_C_COMPILER=gcc + - -D CMAKE_Fortran_COMPILER=gfortran + - -D CMAKE_BUILD_TYPE=Release + - -D DOWNLOAD_POTENTIALS=no + - -D BUILD_TOOLS=yes + sources: + - type: git + url: https://github.com/akohlmey/lammps.git + branch: collected-small-changes diff --git a/tools/lammps-gui/preferences.cpp b/tools/lammps-gui/preferences.cpp index b601a9995f..015137e710 100644 --- a/tools/lammps-gui/preferences.cpp +++ b/tools/lammps-gui/preferences.cpp @@ -137,6 +137,8 @@ void Preferences::accept() if (box) settings->setValue("antialias", box->isChecked()); box = tabWidget->findChild("ssao"); if (box) settings->setValue("ssao", box->isChecked()); + box = tabWidget->findChild("shiny"); + if (box) settings->setValue("shinystyle", box->isChecked()); box = tabWidget->findChild("box"); if (box) settings->setValue("box", box->isChecked()); box = tabWidget->findChild("axes"); @@ -196,6 +198,8 @@ void Preferences::accept() if (box) settings->setValue("return", box->isChecked()); box = tabWidget->findChild("autoval"); if (box) settings->setValue("automatic", box->isChecked()); + box = tabWidget->findChild("savval"); + if (box) settings->setValue("autosave", box->isChecked()); settings->endGroup(); QDialog::accept(); @@ -444,6 +448,7 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) : auto *zoom = new QLabel("Zoom factor:"); auto *anti = new QLabel("Antialias:"); auto *ssao = new QLabel("HQ Image mode:"); + auto *shiny = new QLabel("Shiny Image mode:"); auto *bbox = new QLabel("Show Box:"); auto *axes = new QLabel("Show Axes:"); auto *vdw = new QLabel("VDW Style:"); @@ -455,6 +460,7 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) : auto *zval = new QLineEdit(settings->value("zoom", "1.0").toString()); auto *aval = new QCheckBox; auto *sval = new QCheckBox; + auto *hval = new QCheckBox; auto *bval = new QCheckBox; auto *eval = new QCheckBox; auto *vval = new QCheckBox; @@ -462,6 +468,8 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) : sval->setObjectName("ssao"); aval->setCheckState(settings->value("antialias", false).toBool() ? Qt::Checked : Qt::Unchecked); aval->setObjectName("anti"); + hval->setCheckState(settings->value("shinystyle", true).toBool() ? Qt::Checked : Qt::Unchecked); + hval->setObjectName("shiny"); bval->setCheckState(settings->value("box", true).toBool() ? Qt::Checked : Qt::Unchecked); bval->setObjectName("box"); eval->setCheckState(settings->value("axes", false).toBool() ? Qt::Checked : Qt::Unchecked); @@ -508,6 +516,8 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) : grid->addWidget(aval, i++, 1, Qt::AlignTop); grid->addWidget(ssao, i, 0, Qt::AlignTop); grid->addWidget(sval, i++, 1, Qt::AlignVCenter); + grid->addWidget(shiny, i, 0, Qt::AlignTop); + grid->addWidget(hval, i++, 1, Qt::AlignVCenter); grid->addWidget(bbox, i, 0, Qt::AlignTop); grid->addWidget(bval, i++, 1, Qt::AlignVCenter); grid->addWidget(axes, i, 0, Qt::AlignTop); @@ -536,29 +546,34 @@ EditorTab::EditorTab(QSettings *_settings, QWidget *parent) : QWidget(parent), s auto *namelbl = new QLabel("Name width:"); auto *retlbl = new QLabel("Reformat with 'Enter':"); auto *autolbl = new QLabel("Automatic completion:"); + auto *savlbl = new QLabel("Auto-save on 'Run' and 'Quit':"); auto *cmdval = new QSpinBox; auto *typeval = new QSpinBox; auto *idval = new QSpinBox; auto *nameval = new QSpinBox; auto *retval = new QCheckBox; auto *autoval = new QCheckBox; + auto *savval = new QCheckBox; + cmdval->setObjectName("cmdval"); cmdval->setRange(1, 32); cmdval->setValue(settings->value("command", "16").toInt()); - cmdval->setObjectName("cmdval"); + typeval->setObjectName("typeval"); typeval->setRange(1, 32); typeval->setValue(settings->value("type", "4").toInt()); - typeval->setObjectName("typeval"); + idval->setObjectName("idval"); idval->setRange(1, 32); idval->setValue(settings->value("id", "8").toInt()); - idval->setObjectName("idval"); + nameval->setObjectName("nameval"); nameval->setRange(1, 32); nameval->setValue(settings->value("name", "8").toInt()); - nameval->setObjectName("nameval"); - retval->setCheckState(settings->value("return", true).toBool() ? Qt::Checked : Qt::Unchecked); retval->setObjectName("retval"); + retval->setCheckState(settings->value("return", false).toBool() ? Qt::Checked : Qt::Unchecked); + autoval->setObjectName("autoval"); autoval->setCheckState(settings->value("automatic", true).toBool() ? Qt::Checked : Qt::Unchecked); - autoval->setObjectName("autoval"); + savval->setObjectName("savval"); + savval->setCheckState(settings->value("autosave", false).toBool() ? Qt::Checked + : Qt::Unchecked); settings->endGroup(); int i = 0; @@ -575,6 +590,8 @@ EditorTab::EditorTab(QSettings *_settings, QWidget *parent) : QWidget(parent), s grid->addWidget(retval, i++, 1, Qt::AlignVCenter); grid->addWidget(autolbl, i, 0, Qt::AlignTop); grid->addWidget(autoval, i++, 1, Qt::AlignVCenter); + grid->addWidget(savlbl, i, 0, Qt::AlignTop); + grid->addWidget(savval, i++, 1, Qt::AlignVCenter); grid->addItem(new QSpacerItem(100, 100, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 0); grid->addItem(new QSpacerItem(100, 100, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 1); diff --git a/tools/valgrind/MPICH.supp b/tools/valgrind/MPICH.supp index 6934cf8fbd..80d46a49c8 100644 --- a/tools/valgrind/MPICH.supp +++ b/tools/valgrind/MPICH.supp @@ -39,3 +39,45 @@ fun:PMPI_Init fun:main } +{ + MPICH_MPI_init4 + Memcheck:Leak + match-leak-kinds: reachable + fun:calloc + fun:psmx3_recv_generic + ... + obj:* + ... + fun:MPIDI_Init.constprop.0 + ... + fun:PMPI_Init + fun:main +} +{ + MPICH_MPI_init5 + Memcheck:Leak + match-leak-kinds: reachable + fun:calloc + obj:* + ... + fun: usdf_getinfo.lto_priv.0 + ... + fun:MPID_Init.constprop.0 + ... + fun:PMPI_Init + fun:main +} +{ + MPICH_MPI_init6 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:strdup + obj:* + ... + fun:MPID_Init.constprop.0 + ... + obj:* + fun:PMPI_Init + fun:main +} diff --git a/tools/valgrind/OpenMP.supp b/tools/valgrind/OpenMP.supp index e92e34e816..29284b3bcf 100644 --- a/tools/valgrind/OpenMP.supp +++ b/tools/valgrind/OpenMP.supp @@ -193,3 +193,13 @@ fun:GOMP_parallel } +{ + gomp_realloc1 + Memcheck:Leak + match-leak-kinds: reachable + fun:realloc + fun:gomp_realloc + fun:gomp_team_start + fun:GOMP_parallel +} + diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index bf4c6b50a8..7c94cad4e3 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -28,6 +28,11 @@ add_library(GTest::GMock ALIAS gmock) add_library(GTest::GTestMain ALIAS gtest_main) add_library(GTest::GMockMain ALIAS gmock_main) +option(SKIP_DEATH_TESTS "Do not run 'death tests' to reduce false positives in valgrind" OFF) +mark_as_advanced(SKIP_DEATH_TESTS) +if(SKIP_DEATH_TESTS) + add_compile_definitions(LAMMPS_SKIP_DEATH_TESTS) +endif() # import foreach(_FLAG ${CMAKE_TUNE_FLAGS}) add_compile_options(${_FLAG}) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index a2df55d120..96d63629df 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -547,13 +547,22 @@ TEST_F(LibraryProperties, neighlist) lammps_command(lmp, "run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); - int nhisto = - *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, 0); - int nskip = *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, 0); - double minval = - *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, 0); - double maxval = - *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 3, 0); + void *ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, 0); + int nhisto = *(double *)ptr; + lammps_free(ptr); + + ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, 0); + int nskip = *(double *)ptr; + lammps_free(ptr); + + ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, 0); + double minval = *(double *)ptr; + lammps_free(ptr); + + ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 3, 0); + double maxval = *(double *)ptr; + lammps_free(ptr); + // 21 pair distances counted, none skipped, smallest 1.0, largest 2.1 EXPECT_EQ(nhisto, 21); EXPECT_EQ(nskip, 0); diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 79a2560fae..a6687003b5 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -32,6 +32,12 @@ using LAMMPS_NS::LAMMPSException; using ::testing::ContainsRegex; +#if defined(LAMMPS_SKIP_DEATH_TESTS) +#define TEST_FAILURE(errmsg, ...) \ + { \ + ; \ + } +#else #define TEST_FAILURE(errmsg, ...) \ { \ ::testing::internal::CaptureStdout(); \ @@ -39,6 +45,7 @@ using ::testing::ContainsRegex; auto mesg = ::testing::internal::GetCapturedStdout(); \ ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ } +#endif // whether to print verbose output (i.e. not capturing LAMMPS screen output). extern bool verbose;