Merge branch 'develop' into colvars-update

This commit is contained in:
Axel Kohlmeyer
2024-08-05 21:38:57 -04:00
46 changed files with 794 additions and 185 deletions

View File

@ -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 version of that library will be downloaded and compiled along with
LAMMPS and the test programs) and will download and compile a specific LAMMPS and the test programs) and will download and compile a specific
version of the `GoogleTest <https://github.com/google/googletest/>`_ C++ version of the `GoogleTest <https://github.com/google/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 .. admonition:: Software version and LAMMPS configuration requirements
:class: note :class: note

View File

@ -98,10 +98,26 @@ get access to the other included executables.
Linux on x86\_64 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-<version>.tar.gz`` package. You can switch ``LAMMPS-Linux-x86_64-GUI-<version>.tar.gz`` package. You can switch
into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly. into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly.
The second variant uses `flatpak <https://www.flatpak.org>`_ and
requires the flatpak management and runtime software to be installed.
After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-<version>.tar.gz``
flatpak bundle, you can install it with ``flatpak install --user
LAMMPS-GUI-Linux-x86_64-GUI-<version>.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 Compiling from Source
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
@ -400,10 +416,16 @@ Otherwise the default sequence of colors of the :doc:`dump image
<dump_image>` command is assigned to the different atom types and the <dump_image>` command is assigned to the different atom types and the
diameters are all the same. diameters are all the same.
.. image:: JPG/lammps-gui-image.png .. figure:: JPG/lammps-gui-image.png
:align: center :align: center
:scale: 50% :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 The default image size, some default image quality settings, the view
style and some colors can be changed in the ``Preferences`` dialog style and some colors can be changed in the ``Preferences`` dialog
window. From the image viewer window further adjustments can be made: 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 dialog will pop up asking whether to cancel the exit operation, or to
save or not save the buffer contents to a file. 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 Context Specific Word Completion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -471,11 +499,12 @@ Line Reformatting
The editor supports reformatting lines according to the syntax in order The editor supports reformatting lines according to the syntax in order
to have consistently aligned lines. This primarily means adding to have consistently aligned lines. This primarily means adding
whitespace padding to commands, type specifiers, IDs and names. This whitespace padding to commands, type specifiers, IDs and names. This
reformatting is performed by default when hitting the 'Enter' key to reformatting is performed manually by hitting the 'Tab' key. It is
start a new line. This feature can be turned on or off in the also possible to have this done automatically when hitting the 'Enter'
``Preferences`` dialog, but it can still be manually performed by key to start a new line. This feature can be turned on or off in the
hitting the 'TAB' key. The amount of padding can be adjusted in the ``Preferences`` dialog for ``Editor Settings`` with the
``Preferences`` dialog for the *Editor*. "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 Internally this functionality is achieved by splitting the line into
"words" and then putting it back together with padding added where the "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. log) of the application can be set.
- *Select Text Font:* Opens a font selection dialog where the type and - *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. 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 - *GUI update interval:* Allows to set the time interval between GUI and
and data updates during a LAMMPS run in milliseconds. The default is data updates during a LAMMPS run in milliseconds. The default is to
to update the GUI every 10 milliseconds. This is good for most cases. update the GUI every 10 milliseconds. This is good for many cases.
For LAMMPS runs that run *very* fast, however, data may be missed and Set this to 100 milliseconds or more if LAMMPS-GUI consumes too many
through lowering this interval, this can be corrected. However, this resources during a run. For LAMMPS runs that run *very* fast (for
will make the GUI use more resources, which may be a problem on some example in tutorial examples), however, data may be missed and through
computers with slower CPUs and a small number of CPU cores. This 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. setting may be changed to a value between 1 and 1000 milliseconds.
Accelerators: Accelerators:
@ -719,18 +750,23 @@ Snapshot Image:
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
This tab allows setting defaults for the snapshot images displayed in This tab allows setting defaults for the snapshot images displayed in
the ``Image Viewer`` window, such as its dimensions and the zoom the ``Image Viewer`` window, such as its dimensions and the zoom factor
factor applied. The *Antialias* switch will render images with twice applied. The *Antialias* switch will render images with twice the
the number of pixels for width and height and then smoothly scale the number of pixels for width and height and then smoothly scale the image
image back to the requested size. This produces higher quality images back to the requested size. This produces higher quality images with
with smoother edges at the expense of requiring more CPU time to smoother edges at the expense of requiring more CPU time to render the
render the image. The *HQ Image mode* option turns on screen space image. The *HQ Image mode* option turns on screen space ambient
ambient occlusion (SSAO) mode when rendering images. This is also occlusion (SSAO) mode when rendering images. This is also more time
more time consuming, but produces a more 'spatial' representation of consuming, but produces a more 'spatial' representation of the system
the system shading of atoms by their depth. The *VDW Style* checkbox shading of atoms by their depth. The *Shiny Image mode* option will
selects whether atoms are represented by space filling spheres when render objects with a shiny surface when enabled. Otherwise the
checked or by smaller spheres and sticks. Finally there are a couple surfaces will be matted. The *Show Box* option selects whether the
of drop down lists to select the background and box colors. 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: 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 set is the minimum width for the text element and it can be chosen in
the range between 1 and 32. the range between 1 and 32.
The two settings which follow enable or disable the automatic The three settings which follow enable or disable the automatic
reformatting when hitting the 'Enter' key and the automatic display of reformatting when hitting the 'Enter' key, the automatic display of
the completion pop-up window. 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.
----------- -----------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -92,7 +92,7 @@ Miscellaneous tools
* :ref:`emacs <emacs>` * :ref:`emacs <emacs>`
* :ref:`i-PI <ipi>` * :ref:`i-PI <ipi>`
* :ref:`kate <kate>` * :ref:`kate <kate>`
* :ref:`LAMMPS GUI <lammps_gui>` * :ref:`LAMMPS-GUI <lammps_gui>`
* :ref:`LAMMPS magic patterns for file(1) <magic>` * :ref:`LAMMPS magic patterns for file(1) <magic>`
* :ref:`Offline build tool <offline>` * :ref:`Offline build tool <offline>`
* :ref:`singularity/apptainer <singularity_tool>` * :ref:`singularity/apptainer <singularity_tool>`
@ -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 - 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 - 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.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 - Windows 10 and 11 x86_64 with MinGW / GCC 10.0 cross-compiler on Fedora 38, Qt version 5.15LTS
.. _lammps_gui_install: .. _lammps_gui_install:
@ -532,14 +533,28 @@ The LAMMPS-GUI has been successfully compiled and tested on:
Pre-compiled executables Pre-compiled executables
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
Pre-compiled LAMMPS executable packages that include the GUI are currently Pre-compiled LAMMPS executable packages that include the GUI are
available from https://download.lammps.org/static or currently available from https://download.lammps.org/static or
https://github.com/lammps/lammps/releases. You can unpack the archives https://github.com/lammps/lammps/releases. For Windows, you need to
(or mount the macOS disk image) and run the GUI directly in place. The download and then run the application installer. For macOS you download
folder may also be moved around and added to the ``PATH`` environment and mount the disk image and then drag the application bundle to the
variable so the executables will be found automatically. The LAMMPS-GUI Applications folder. For Linux (x86_64) you currently have two
executable is called ``lammps-gui`` and either takes no arguments or options: 1) you can download the tar.gz archive, unpack it and run the
attempts to load the first argument as LAMMPS input file. 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
<https://www.flatpak.org/>`_ and then install it locally with the
*flatpak* command: ``flatpak install --user
LAMMPS-Linux-x86_64-GUI-<version>.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: .. _lammps_gui_compilation:
@ -1107,13 +1122,13 @@ necessary development headers and libraries are present.
.. code-block:: bash .. code-block:: bash
-D WITH_SWIG=on # to enable building any SWIG 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_JAVA=on # to enable building the Java wrapper
-D BUILD_SWIG_LUA=on # to enable building the Lua 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_PERL5=on # to enable building the Perl 5.x wrapper
-D BUILD_SWIG_PYTHON=on # to enable building the Python 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_RUBY=on # to enable building the Ruby wrapper
-D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper -D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper
Manual building allows a little more flexibility. E.g. one can choose Manual building allows a little more flexibility. E.g. one can choose

View File

@ -111,10 +111,10 @@ Syntax
.. parsed-literal:: .. parsed-literal::
*acolor* args = type color *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/... color = name of color or color1/color2/...
*adiam* args = type diam *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) diam = diameter of atoms of that type (distance units)
*amap* args = lo hi style delta N entry1 entry2 ... entryN *amap* args = lo hi style delta N entry1 entry2 ... entryN
lo = number or *min* = lower bound of range of color map lo = number or *min* = lower bound of range of color map
@ -139,10 +139,10 @@ Syntax
*backcolor* arg = color *backcolor* arg = color
color = name of color for background color = name of color for background
*bcolor* args = type color *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/... color = name of color or color1/color2/...
*bdiam* args = type diam *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) diam = diameter of bonds of that type (distance units)
*bitrate* arg = rate *bitrate* arg = rate
rate = target bitrate for movie in kbps 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 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 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 atom color setting is *type*, to set the color that atoms of each type
will be drawn in the image. will be drawn in the image.
The specified *type* should be an integer from 1 to Ntypes = the The specified *type* should be a type label or integer from 1 to Ntypes
number of atom types. A wildcard asterisk can be used in place of or = the number of atom types. For numeric types, a wildcard asterisk can
in conjunction with the *type* argument to specify a range of atom be used in place of or in conjunction with the *type* argument to
types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = specify a range of atom types. This takes the form "\*" or "\*n" or
the number of atom types, then an asterisk with no numeric values "n\*" or "m\*n". If N = the number of atom types, then an asterisk with
means all types from 1 to N. A leading asterisk means all types from no numeric values means all types from 1 to N. A leading asterisk
1 to n (inclusive). A trailing asterisk means all types from n to N means all types from 1 to n (inclusive). A trailing asterisk means all
(inclusive). A middle asterisk means all types from m to n types from n to N (inclusive). A middle asterisk means all types from
(inclusive). m to n (inclusive).
The specified *color* can be a single color which is any of the 140 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 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 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 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 type will be drawn in the image. The specified *type* should be a type
integer from 1 to Ntypes. As with the *acolor* keyword, a wildcard label or integer from 1 to Ntypes. As with the *acolor* keyword, a
asterisk can be used as part of the *type* argument to specify a range wildcard asterisk can be used as part of the *type* argument to specify
of atom types. The specified *diam* is the size in whatever distance a range of numeric atom types. The specified *diam* is the size in
:doc:`units <units>` the input script is using, e.g. Angstroms. whatever distance :doc:`units <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 *bond* keyword, when its color setting is *type*, to set the color
that bonds of each type will be drawn in the image. 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` The specified *type* should be a type label or integer from 1 to
is the number of bond types. A wildcard asterisk can be used in place of or :math:`N`, where :math:`N` is the number of bond types. For numeric
in conjunction with the *type* argument to specify a range of bond types, a wildcard asterisk can be used in place of or in conjunction
types. This takes the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` with the *type* argument to specify a range of bond types. This takes
is the number of bond types, then an asterisk with no numerical values the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is the number
means all types from 1 to :math:`N`. A leading asterisk means all types from of bond types, then an asterisk with no numerical values means all
1 to n (inclusive). A trailing asterisk means all types from m to :math:`N` types from 1 to :math:`N`. A leading asterisk means all types from 1
(inclusive). A middle asterisk means all types from m to n 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). (inclusive).
The specified *color* can be a single color which is any of the 140 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 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 *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 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 *type* should be a type label or integer from 1 to Nbondtypes. As with
*bcolor* keyword, a wildcard asterisk can be used as part of the the *bcolor* keyword, a wildcard asterisk can be used as part of the
*type* argument to specify a range of bond types. The specified *type* argument to specify a range of numeric bond types. The
*diam* is the size in whatever distance :doc:`units <units>` you are specified *diam* is the size in whatever distance :doc:`units <units>`
using (e.g., Angstroms). you are using (e.g., Angstroms).
---------- ----------

View File

@ -1186,6 +1186,7 @@ flaglog
flagN flagN
flagVF flagVF
flang flang
flatpak
fld fld
floralwhite floralwhite
Florez Florez

View File

@ -342,8 +342,8 @@ class lammps(object):
if self.has_mpi_support: if self.has_mpi_support:
try: try:
from mpi4py import __version__ as mpi4py_version from mpi4py import __version__ as mpi4py_version
# tested to work with mpi4py versions 2 and 3 # tested to work with mpi4py versions 2, 3, and 4
self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3'] self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3','4']
except ImportError: except ImportError:
# ignore failing import # ignore failing import
pass pass
@ -369,7 +369,7 @@ class lammps(object):
if not self.has_mpi_support: if not self.has_mpi_support:
raise Exception('LAMMPS not compiled with real MPI library') raise Exception('LAMMPS not compiled with real MPI library')
if not self.has_mpi4py: 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): if self.MPI._sizeof(self.MPI.Comm) == sizeof(c_int):
MPI_Comm = c_int MPI_Comm = c_int
else: else:

View File

@ -142,7 +142,7 @@ void FixAddHeat::post_force(int /*vflag*/)
if (mask[i] & groupbit) if (mask[i] & groupbit)
heatflow[i] = 0.0; heatflow[i] = 0.0;
double vtmp, dt; double vtmp = 0.0;
if (vstyle == CONSTANT) vtmp = value; if (vstyle == CONSTANT) vtmp = value;
if (vstyle == EQUAL) vtmp = input->variable->compute_equal(var); if (vstyle == EQUAL) vtmp = input->variable->compute_equal(var);
for (int i = 0; i < atom->nlocal; i++) { for (int i = 0; i < atom->nlocal; i++) {

View File

@ -613,8 +613,7 @@ void PPPMDipole::allocate()
memory->create2d_offset(rho1d,3,-order/2,order/2,"pppm_dipole:rho1d"); 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(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(rho_coeff,order,(1-order)/2,order/2,"pppm_dipole:rho_coeff");
memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2, memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2,"pppm_dipole:drho_coeff");
"pppm_dipole:drho_coeff");
// create 2 FFTs and a Remap // create 2 FFTs and a Remap
// 1st FFT keeps data in FFT decomposition // 1st FFT keeps data in FFT decomposition
@ -669,8 +668,23 @@ void PPPMDipole::deallocate()
memory->destroy(densityy_fft_dipole); memory->destroy(densityy_fft_dipole);
memory->destroy(densityz_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(work3);
memory->destroy(work4); 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 fft1;
delete fft2; delete fft2;
@ -678,6 +692,7 @@ void PPPMDipole::deallocate()
fft1 = fft2 = nullptr; fft1 = fft2 = nullptr;
remap = nullptr; remap = nullptr;
gf_b = nullptr;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -1492,8 +1492,6 @@ void FitPOD::environment_cluster_calculation(const datastruct &data)
&beta, A, &Mdesc); &beta, A, &Mdesc);
MPI_Allreduce(MPI_IN_PLACE, A, Mdesc * Mdesc, MPI_DOUBLE, MPI_SUM, world); 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)) if ((comm->me == 0) && (save == 1))
savematrix2binfile(data.filenametag + "_covariance_matrix_elem" + std::to_string(elem + 1) + savematrix2binfile(data.filenametag + "_covariance_matrix_elem" + std::to_string(elem + 1) +
".bin", ".bin",

View File

@ -77,6 +77,7 @@ PairPOD::PairPOD(LAMMPS *lmp) : Pair(lmp), fastpodptr(nullptr)
abfx = nullptr; abfx = nullptr;
abfy = nullptr; abfy = nullptr;
abfz = nullptr; abfz = nullptr;
abftm = nullptr;
sumU = nullptr; sumU = nullptr;
forcecoeff = nullptr; forcecoeff = nullptr;
Centroids = nullptr; Centroids = nullptr;
@ -88,6 +89,7 @@ PairPOD::PairPOD(LAMMPS *lmp) : Pair(lmp), fastpodptr(nullptr)
pdd = nullptr; pdd = nullptr;
coefficients = nullptr; coefficients = nullptr;
pn3 = nullptr; pn3 = nullptr;
pq3 = nullptr;
pc3 = nullptr; pc3 = nullptr;
pa4 = nullptr; pa4 = nullptr;
pb4 = nullptr; pb4 = nullptr;
@ -124,6 +126,7 @@ PairPOD::~PairPOD()
memory->destroy(abfx); memory->destroy(abfx);
memory->destroy(abfy); memory->destroy(abfy);
memory->destroy(abfz); memory->destroy(abfz);
memory->destroy(abftm);
memory->destroy(sumU); memory->destroy(sumU);
memory->destroy(forcecoeff); memory->destroy(forcecoeff);
memory->destroy(Centroids); memory->destroy(Centroids);
@ -135,6 +138,7 @@ PairPOD::~PairPOD()
memory->destroy(pdd); memory->destroy(pdd);
memory->destroy(coefficients); memory->destroy(coefficients);
memory->destroy(pn3); memory->destroy(pn3);
memory->destroy(pq3);
memory->destroy(pc3); memory->destroy(pc3);
memory->destroy(pa4); memory->destroy(pa4);
memory->destroy(pb4); memory->destroy(pb4);
@ -568,14 +572,18 @@ void PairPOD::copy_data_from_pod_class()
besselparams[1] = fastpodptr->besselparams[1]; besselparams[1] = fastpodptr->besselparams[1];
besselparams[2] = fastpodptr->besselparams[2]; besselparams[2] = fastpodptr->besselparams[2];
memory->destroy(abftm);
memory->create(abftm, 4*K3, "abftm"); memory->create(abftm, 4*K3, "abftm");
memory->destroy(elemindex);
memory->create(elemindex, nelements*nelements, "elemindex"); memory->create(elemindex, nelements*nelements, "elemindex");
for (int i=0; i<nelements*nelements; i++) elemindex[i] = fastpodptr->elemindex[i]; for (int i=0; i<nelements*nelements; i++) elemindex[i] = fastpodptr->elemindex[i];
memory->destroy(Phi);
memory->create(Phi, ns * ns, "pair_pod:Phi"); memory->create(Phi, ns * ns, "pair_pod:Phi");
for (int i=0; i<ns*ns; i++) for (int i=0; i<ns*ns; i++)
Phi[i] = fastpodptr->Phi[i]; Phi[i] = fastpodptr->Phi[i];
memory->destroy(coefficients);
memory->create(coefficients, nCoeffPerElement * nelements, "pair_pod:coefficients"); memory->create(coefficients, nCoeffPerElement * nelements, "pair_pod:coefficients");
for (int i=0; i<nCoeffPerElement * nelements; i++) for (int i=0; i<nCoeffPerElement * nelements; i++)
coefficients[i] = fastpodptr->coeff[i]; coefficients[i] = fastpodptr->coeff[i];
@ -590,11 +598,17 @@ void PairPOD::copy_data_from_pod_class()
Centroids[i] = fastpodptr->Centroids[i]; Centroids[i] = fastpodptr->Centroids[i];
} }
memory->destroy(pn3);
memory->create(pn3, nabf3+1, "pn3"); // array stores the number of monomials for each degree 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->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->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->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->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 memory->create(pc4, Q4, "pc4"); // array of monomial coefficients needed for the computation of the four-body descriptors
for (int i=0; i<nabf3+1; i++) pn3[i] = fastpodptr->pn3[i]; for (int i=0; i<nabf3+1; i++) pn3[i] = fastpodptr->pn3[i];
for (int i=0; i<K3; i++) pc3[i] = fastpodptr->pc3[i]; for (int i=0; i<K3; i++) pc3[i] = fastpodptr->pc3[i];
@ -890,7 +904,7 @@ void PairPOD::angularbasis(double *tm, double *tmu, double *tmv, double *tmw, in
double tmvm = abfy[mj]; double tmvm = abfy[mj];
double tmwm = abfz[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 // Calculate angular basis function and its derivatives using recursion relation
if (d==1) { if (d==1) {
tmn = tmm*u; tmn = tmm*u;

View File

@ -593,7 +593,6 @@ void FixCMAP::post_force(int vflag)
vcmap[5] = (vb12y*f1[2])+(vb32y*f3[2])+((vb43y+vb32y)*f4[2])+ vcmap[5] = (vb12y*f1[2])+(vb32y*f3[2])+((vb43y+vb32y)*f4[2])+
((vb54y+vb43y+vb32y)*f5[2]); ((vb54y+vb43y+vb32y)*f5[2]);
ev_tally(nlist,list,5.0,E,vcmap); ev_tally(nlist,list,5.0,E,vcmap);
//ev_tally(5,list,nlocal,newton_bond,E,vcmap);
} }
} }
} }

View File

@ -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; single_enable = 0;
writedata = 1; writedata = 1;
nmax = 0; nmax = 0;
hneigh = nullptr;
newsite = nullptr; typeH = typeO = typeA = typeB = -1;
alpha = qdist = 0.0;
// TIP4P cannot compute virial as F dot r // TIP4P cannot compute virial as F dot r
// due to finding bonded H atoms which are not near O atom // due to finding bonded H atoms which are not near O atom

View File

@ -763,11 +763,12 @@ void FixQEq::read_file(char *file)
chi[n] = eta[n] = gamma[n] = zeta[n] = zcore[n] = 0.0; chi[n] = eta[n] = gamma[n] = zeta[n] = zcore[n] = 0.0;
} }
FILE *fp = nullptr;
try { try {
int nlo,nhi; int nlo,nhi;
double val; double val;
FILE *fp = utils::open_potential(file,lmp,nullptr); fp = utils::open_potential(file,lmp,nullptr);
if (fp == nullptr) if (fp == nullptr)
throw qeq_parser_error(fmt::format("Cannot open fix qeq parameter file {}: {}", throw qeq_parser_error(fmt::format("Cannot open fix qeq parameter file {}: {}",
file,utils::getsyserror())); file,utils::getsyserror()));
@ -798,7 +799,7 @@ void FixQEq::read_file(char *file)
for (int n=nlo; n <= nhi; ++n) setflag[n] = 1; for (int n=nlo; n <= nhi; ++n) setflag[n] = 1;
} }
} catch (EOFException &) { } catch (EOFException &) {
; // catch and ignore to exit loop fclose(fp);
} catch (std::exception &e) { } catch (std::exception &e) {
error->one(FLERR,e.what()); error->one(FLERR,e.what());
} }

View File

@ -54,6 +54,7 @@ void FixQEqPoint::init()
neighbor->add_request(this, NeighConst::REQ_FULL); neighbor->add_request(this, NeighConst::REQ_FULL);
int ntypes = atom->ntypes; int ntypes = atom->ntypes;
memory->destroy(shld);
memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding");
} }

View File

@ -56,6 +56,7 @@ void FixQEqShielded::init()
neighbor->add_request(this, NeighConst::REQ_FULL); neighbor->add_request(this, NeighConst::REQ_FULL);
const int ntypes = atom->ntypes; const int ntypes = atom->ntypes;
memory->destroy(shld);
memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding");
init_shielding(); init_shielding();

View File

@ -36,12 +36,13 @@ int Bond::instance_total = 0;
a particular bond style can override this 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++; instance_me = instance_total++;
energy = 0.0; energy = 0.0;
virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0;
writedata = 1; writedata = 1;
reinitflag = 1; reinitflag = 1;
@ -53,12 +54,8 @@ Bond::Bond(LAMMPS *_lmp) : Pointers(_lmp)
partial_flag = 0; partial_flag = 0;
single_extra = 0; single_extra = 0;
svector = nullptr;
maxeatom = maxvatom = 0; maxeatom = maxvatom = 0;
eatom = nullptr;
vatom = nullptr;
setflag = nullptr;
execution_space = Host; execution_space = Host;
datamask_read = ALL_MASK; datamask_read = ALL_MASK;

View File

@ -1536,7 +1536,7 @@ int DumpImage::modify_param(int narg, char **arg)
if (strcmp(arg[0],"acolor") == 0) { if (strcmp(arg[0],"acolor") == 0) {
if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
int nlo,nhi; 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 // get list of colors
// assign colors in round-robin fashion to types // 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 (strcmp(arg[0],"adiam") == 0) {
if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
int nlo,nhi; 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); double diam = utils::numeric(FLERR,arg[2],false,lmp);
if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command");
for (int i = nlo; i <= nhi; i++) diamtype[i] = diam; 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) if (atom->nbondtypes == 0)
error->all(FLERR,"Dump modify bcolor not allowed with no bond types"); error->all(FLERR,"Dump modify bcolor not allowed with no bond types");
int nlo,nhi; 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 '/' // process list of ncount colornames separated by '/'
// assign colors in round-robin fashion to bond types // 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) if (atom->nbondtypes == 0)
error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); error->all(FLERR,"Dump modify bdiam not allowed with no bond types");
int nlo,nhi; 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); double diam = utils::numeric(FLERR,arg[2],false,lmp);
if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command");
for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam; for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam;

View File

@ -54,6 +54,7 @@
#include "universe.h" #include "universe.h"
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"
#include "version.h"
#include <cstring> #include <cstring>
@ -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_levels") == 0) return LAMMPS_INT;
if (strcmp(name,"respa_dt") == 0) return LAMMPS_DOUBLE; 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,"boxlo") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"boxhi") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"boxhi") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"sublo") == 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: .. _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** **Simulation box settings**
.. list-table:: .. list-table::
@ -1557,18 +1613,6 @@ report the "native" data type. The following tables are provided:
- Type - Type
- Length - Length
- Description - 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 * - boxxhi
- double - double
- 1 - 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_levels") == 0) return (void *) &respa->nlevels;
if (strcmp(name,"respa_dt") == 0) return (void *) respa->step; 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,"boxlo") == 0) return (void *) lmp->domain->boxlo;
if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi; if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi;
if (strcmp(name,"sublo") == 0) return (void *) lmp->domain->sublo; 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) if (strcmp(name,"subhi_lambda") == 0)
return (void *) lmp->domain->subhi_lamda; return (void *) lmp->domain->subhi_lamda;
} }
if (strcmp(name,"boxxlo") == 0) return (void *) &lmp->domain->boxlo[0]; 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,"boxxhi") == 0) return (void *) &lmp->domain->boxhi[0];
if (strcmp(name,"boxylo") == 0) return (void *) &lmp->domain->boxlo[1]; if (strcmp(name,"boxylo") == 0) return (void *) &lmp->domain->boxlo[1];

View File

@ -53,14 +53,15 @@ int Pair::instance_total = 0;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Pair::Pair(LAMMPS *lmp) : Pair::Pair(LAMMPS *lmp) :
Pointers(lmp), eatom(nullptr), vatom(nullptr), cvatom(nullptr), cutsq(nullptr), Pointers(lmp), virial{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, eatom(nullptr), vatom(nullptr),
setflag(nullptr), cutghost(nullptr), rtable(nullptr), drtable(nullptr), ftable(nullptr), cvatom(nullptr), cutsq(nullptr), setflag(nullptr), cutghost(nullptr), rtable(nullptr),
dftable(nullptr), ctable(nullptr), dctable(nullptr), etable(nullptr), detable(nullptr), drtable(nullptr), ftable(nullptr), dftable(nullptr), ctable(nullptr), dctable(nullptr),
ptable(nullptr), dptable(nullptr), vtable(nullptr), dvtable(nullptr), rdisptable(nullptr), etable(nullptr), detable(nullptr), ptable(nullptr), dptable(nullptr), vtable(nullptr),
drdisptable(nullptr), fdisptable(nullptr), dfdisptable(nullptr), edisptable(nullptr), dvtable(nullptr), rdisptable(nullptr), drdisptable(nullptr), fdisptable(nullptr),
dedisptable(nullptr), pvector(nullptr), svector(nullptr), list(nullptr), listhalf(nullptr), dfdisptable(nullptr), edisptable(nullptr), dedisptable(nullptr), pvector(nullptr),
listfull(nullptr), list_tally_compute(nullptr), elements(nullptr), elem1param(nullptr), svector(nullptr), list(nullptr), listhalf(nullptr), listfull(nullptr),
elem2param(nullptr), elem3param(nullptr), map(nullptr) list_tally_compute(nullptr), elements(nullptr), elem1param(nullptr), elem2param(nullptr),
elem3param(nullptr), map(nullptr)
{ {
instance_me = instance_total++; instance_me = instance_total++;

View File

@ -63,6 +63,7 @@ Update::Update(LAMMPS *lmp) :
restrict_output = 0; restrict_output = 0;
setupflag = 0; setupflag = 0;
multireplica = 0; multireplica = 0;
nsteps = 0;
eflag_global = vflag_global = -1; eflag_global = vflag_global = -1;
eflag_atom = vflag_atom = 0; eflag_atom = vflag_atom = 0;

View File

@ -50,16 +50,25 @@ void WriteDump::command(int narg, char **arg)
int dumpfreq = MAX(1, update->nsteps); int dumpfreq = MAX(1, update->nsteps);
dumpfreq += update->ntimestep % dumpfreq; dumpfreq += update->ntimestep % dumpfreq;
std::string dump_id = "WRITE_DUMP";
auto dumpargs = new char *[modindex + 2]; 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[1] = arg[0]; // group
dumpargs[2] = arg[1]; // dump style dumpargs[2] = arg[1]; // dump style
dumpargs[3] = utils::strdup(std::to_string(dumpfreq)); // dump frequency dumpargs[3] = utils::strdup(std::to_string(dumpfreq)); // dump frequency
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i]; for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];
Dump *dump = output->add_dump(modindex + 2, dumpargs); auto *dump = output->add_dump(modindex + 2, dumpargs);
if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]);
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 // write out one frame and then delete the dump again
// set multifile_override for DumpImage so that filename needs no "*" // 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 // delete the Dump instance and local storage
output->delete_dump(dumpargs[0]); output->delete_dump(dump_id);
delete[] dumpargs[3]; delete[] dumpargs[3];
delete[] dumpargs; delete[] dumpargs;
} }

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) 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_AUTOUIC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -198,6 +198,27 @@ if(BUILD_OMP)
target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX) target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX)
endif() 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" # when compiling on macOS, create an "app bundle"
if(APPLE) if(APPLE)
set_target_properties(lammps-gui PROPERTIES 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) elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND NOT LAMMPS_GUI_USE_PLUGIN)
install(TARGETS lammps-gui DESTINATION ${CMAKE_INSTALL_BINDIR}) 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.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/packages/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-input.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/text/x-application-lammps.xml) 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/) 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}") message(WARNING "Unresolved dependencies detected: ${_u_deps}")
endif() ]] endif() ]]
) )
add_custom_target(tgz add_custom_target(tgz
COMMAND ${LAMMPS_DIR}/cmake/packaging/build_linux_tgz.sh COMMAND ${LAMMPS_DIR}/cmake/packaging/build_linux_tgz.sh
DEPENDS lammps-gui 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 BYPRODUCT LAMMPS-Linux-amd64.tar.gz
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )

View File

@ -4,7 +4,12 @@ LAMMPS-GUI TODO list:
- figure out how widgets can be resized to fraction of available screen size. - 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 - 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 indenting regions for (nested) loops?
- implement data file manager GUI with the following features: - implement data file manager GUI with the following features:

View File

@ -14,6 +14,7 @@
#include "codeeditor.h" #include "codeeditor.h"
#include "fileviewer.h" #include "fileviewer.h"
#include "lammpsgui.h" #include "lammpsgui.h"
#include "lammpswrapper.h"
#include "linenumberarea.h" #include "linenumberarea.h"
#include <QAbstractItemView> #include <QAbstractItemView>
@ -146,6 +147,7 @@ CodeEditor::CodeEditor(QWidget *parent) :
{ {
help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent); help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent);
connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help); connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help);
docver = "";
// set up completer class (without a model currently) // set up completer class (without a model currently)
#define COMPLETER_SETUP(completer) \ #define COMPLETER_SETUP(completer) \
@ -1159,12 +1161,30 @@ void CodeEditor::insertCompletedCommand(const QString &completion)
setTextCursor(cursor); setTextCursor(cursor);
} }
void CodeEditor::setDocver()
{
LammpsWrapper *lammps = &qobject_cast<LammpsGui *>(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() void CodeEditor::get_help()
{ {
QString page, help; QString page, help;
find_help(page, help); find_help(page, help);
if (docver.isEmpty()) setDocver();
if (!page.isEmpty()) 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) void CodeEditor::find_help(QString &page, QString &help)
@ -1215,8 +1235,9 @@ void CodeEditor::find_help(QString &page, QString &help)
void CodeEditor::open_help() void CodeEditor::open_help()
{ {
auto *act = qobject_cast<QAction *>(sender()); auto *act = qobject_cast<QAction *>(sender());
if (docver.isEmpty()) setDocver();
QDesktopServices::openUrl( 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() void CodeEditor::open_url()

View File

@ -79,6 +79,7 @@ protected:
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;
void contextMenuEvent(QContextMenuEvent *event) override; void contextMenuEvent(QContextMenuEvent *event) override;
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
void setDocver();
private slots: private slots:
void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberAreaWidth(int newBlockCount);
@ -107,6 +108,7 @@ private:
int highlight; int highlight;
bool reformat_on_return; bool reformat_on_return;
bool automatic_completion; bool automatic_completion;
QString docver;
QMap<QString, QString> cmd_map; QMap<QString, QString> cmd_map;
QMap<QString, QString> fix_map; QMap<QString, QString> fix_map;

View File

@ -16,6 +16,7 @@
#include "lammpsgui.h" #include "lammpsgui.h"
#include <QApplication> #include <QApplication>
#include <QEvent>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QIcon> #include <QIcon>

View File

@ -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_exp.html angle_style cosine/shift/exp/omp
angle_cosine_shift.html angle_style cosine/shift angle_cosine_shift.html angle_style cosine/shift
angle_cosine_shift.html angle_style cosine/shift/omp 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
angle_cosine_squared.html angle_style cosine/squared/omp angle_cosine_squared.html angle_style cosine/squared/omp
angle_cross.html angle_style cross 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/kk
angle_harmonic.html angle_style harmonic/omp angle_harmonic.html angle_style harmonic/omp
angle_hybrid.html angle_style hybrid 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
angle_lepton.html angle_style lepton/omp angle_lepton.html angle_style lepton/omp
angle_mesocnt.html angle_style mesocnt 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
angle_quartic.html angle_style quartic/omp angle_quartic.html angle_style quartic/omp
angle_spica.html angle_style spica angle_spica.html angle_style spica
angle_spica.html angle_style spica/kk
angle_spica.html angle_style spica/omp angle_spica.html angle_style spica/omp
angle_style.html angle_style angle_style.html angle_style
angle_table.html angle_style table 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
bond_harmonic_shift.html bond_style harmonic/shift/omp bond_harmonic_shift.html bond_style harmonic/shift/omp
bond_hybrid.html bond_style hybrid 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
bond_lepton.html bond_style lepton/omp bond_lepton.html bond_style lepton/omp
bond_mesocnt.html bond_style mesocnt 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_oxdna.html bond_style oxrna2/fene
bond_quartic.html bond_style quartic bond_quartic.html bond_style quartic
bond_quartic.html bond_style quartic/omp bond_quartic.html bond_style quartic/omp
bond_rheo_shell.html bond_style rheo/shell
bond_special.html bond_style special bond_special.html bond_style special
bond_style.html bond_style bond_style.html bond_style
bond_table.html bond_style table bond_table.html bond_style table
@ -260,6 +266,10 @@ compute_pair.html compute pair
compute_pe_atom.html compute pe/atom compute_pe_atom.html compute pe/atom
compute_pe.html compute pe compute_pe.html compute pe
compute_plasticity_atom.html compute plasticity/atom 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_alchemy.html compute pressure/alchemy
compute_pressure.html compute pressure compute_pressure.html compute pressure
compute_pressure_uef.html compute pressure/uef 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_chunk.html compute reduce/chunk
compute_reduce.html compute reduce compute_reduce.html compute reduce
compute_reduce.html compute reduce/region compute_reduce.html compute reduce/region
compute_rheo_property_atom.html compute rheo/property/atom
compute_rigid_local.html compute rigid/local compute_rigid_local.html compute rigid/local
compute.html compute compute.html compute
compute_saed.html compute saed compute_saed.html compute saed
@ -360,6 +371,7 @@ delete_bonds.html delete_bonds
dielectric.html dielectric dielectric.html dielectric
dihedral_charmm.html dihedral_style charmm dihedral_charmm.html dihedral_style charmm
dihedral_charmm.html dihedral_style charmmfsw 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/intel
dihedral_charmm.html dihedral_style charmm/kk dihedral_charmm.html dihedral_style charmm/kk
dihedral_charmm.html dihedral_style charmm/omp dihedral_charmm.html dihedral_style charmm/omp
@ -369,6 +381,7 @@ dihedral_class2.html dihedral_style class2/omp
dihedral_coeff.html dihedral_coeff 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
dihedral_cosine_shift_exp.html dihedral_style cosine/shift/exp/omp 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
dihedral_fourier.html dihedral_style fourier/intel dihedral_fourier.html dihedral_style fourier/intel
dihedral_fourier.html dihedral_style fourier/omp 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
dihedral_helix.html dihedral_style helix/omp dihedral_helix.html dihedral_style helix/omp
dihedral_hybrid.html dihedral_style hybrid 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
dihedral_lepton.html dihedral_style lepton/omp dihedral_lepton.html dihedral_style lepton/omp
dihedral_multi_harmonic.html dihedral_style multi/harmonic 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_fep.html fix adapt/fep
fix_adapt.html fix adapt fix_adapt.html fix adapt
fix_addforce.html fix addforce fix_addforce.html fix addforce
fix_add_heat.html fix add/heat
fix_addtorque.html fix addtorque fix_addtorque.html fix addtorque
fix_alchemy.html fix alchemy fix_alchemy.html fix alchemy
fix_amoeba_bitorsion.html fix amoeba/bitorsion fix_amoeba_bitorsion.html fix amoeba/bitorsion
@ -475,6 +490,7 @@ fix_cmap.html fix cmap
fix_colvars.html fix colvars fix_colvars.html fix colvars
fix_controller.html fix controller fix_controller.html fix controller
fix_damping_cundall.html fix damping/cundall fix_damping_cundall.html fix damping/cundall
fix_deform_pressure.html fix deform/pressure
fix_deform.html fix deform fix_deform.html fix deform
fix_deform.html fix deform/kk fix_deform.html fix deform/kk
fix_deposit.html fix deposit 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_reaxff_species.html fix reaxff/species/kk
fix_recenter.html fix recenter fix_recenter.html fix recenter
fix_restrain.html fix restrain 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_rhok.html fix rhok
fix_rigid_meso.html fix rigid/meso fix_rigid_meso.html fix rigid/meso
fix_rigid.html fix rigid 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_body_polyhedron.html fix wall/body/polyhedron
fix_wall_ees.html fix wall/ees fix_wall_ees.html fix wall/ees
fix_wall_ees.html fix wall/region/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_region.html fix wall/gran/region
fix_wall_gran.html fix wall/gran fix_wall_gran.html fix wall/gran
fix_wall_gran.html fix wall/gran/kk 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/kk
improper_harmonic.html improper_style harmonic/omp improper_harmonic.html improper_style harmonic/omp
improper_hybrid.html improper_style hybrid improper_hybrid.html improper_style hybrid
improper_hybrid.html improper_style hybrid/kk
improper_inversion_harmonic.html improper_style inversion/harmonic improper_inversion_harmonic.html improper_style inversion/harmonic
improper_none.html improper_style none improper_none.html improper_style none
improper_ring.html improper_style ring 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/charmm/coul/msm/omp
pair_charmm.html pair_style lj/charmmfsw/coul/charmmfsh 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
pair_charmm.html pair_style lj/charmmfsw/coul/long/kk
pair_class2.html pair_style lj/class2 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
pair_class2.html pair_style lj/class2/coul/cut/kk 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
pair_dipole.html pair_style lj/sf/dipole/sf/gpu pair_dipole.html pair_style lj/sf/dipole/sf/gpu
pair_dipole.html pair_style lj/sf/dipole/sf/omp 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
pair_dpd_ext.html pair_style dpd/ext/kk pair_dpd_ext.html pair_style dpd/ext/kk
pair_dpd_ext.html pair_style dpd/ext/omp 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_hdnnp.html pair_style hdnnp
pair_hybrid.html pair_style hybrid pair_hybrid.html pair_style hybrid
pair_hybrid.html pair_style hybrid/kk 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
pair_hybrid.html pair_style hybrid/overlay/kk 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
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
pair_ilp_graphene_hbn.html pair_style ilp/graphene/hbn/opt pair_ilp_graphene_hbn.html pair_style ilp/graphene/hbn/opt
pair_ilp_tmd.html pair_style ilp/tmd 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
pair_pace.html pair_style pace/extrapolation/kk pair_pace.html pair_style pace/extrapolation/kk
pair_pace.html pair_style pace/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/eps
pair_peri.html pair_style peri/lps pair_peri.html pair_style peri/lps
pair_peri.html pair_style peri/lps/omp 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/pmb/omp
pair_peri.html pair_style peri/ves pair_peri.html pair_style peri/ves
pair_pod.html pair_style pod pair_pod.html pair_style pod
pair_pod.html pair_style pod/kk
pair_polymorphic.html pair_style polymorphic pair_polymorphic.html pair_style polymorphic
pair_python.html pair_style python pair_python.html pair_style python
pair_quip.html pair_style quip 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
pair_reaxff.html pair_style reaxff/kk pair_reaxff.html pair_style reaxff/kk
pair_reaxff.html pair_style reaxff/omp 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
pair_resquared.html pair_style resquared/gpu pair_resquared.html pair_style resquared/gpu
pair_resquared.html pair_style resquared/omp 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
pair_saip_metal.html pair_style saip/metal/opt pair_saip_metal.html pair_style saip/metal/opt
pair_sdpd_taitwater_isothermal.html pair_style sdpd/taitwater/isothermal 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_snap.html pair_style snap/kk
pair_soft.html pair_style soft pair_soft.html pair_style soft
pair_soft.html pair_style soft/gpu pair_soft.html pair_style soft/gpu
pair_soft.html pair_style soft/kk
pair_soft.html pair_style soft/omp pair_soft.html pair_style soft/omp
pair_sph_heatconduction.html pair_style sph/heatconduction pair_sph_heatconduction.html pair_style sph/heatconduction
pair_sph_heatconduction.html pair_style sph/heatconduction/gpu 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
pair_spica.html pair_style lj/spica/coul/long 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/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/long/omp
pair_spica.html pair_style lj/spica/coul/msm pair_spica.html pair_style lj/spica/coul/msm
pair_spica.html pair_style lj/spica/coul/msm/omp 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_threebody_table.html pair_style threebody/table
pair_tracker.html pair_style tracker pair_tracker.html pair_style tracker
pair_tri_lj.html pair_style tri/lj 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
pair_ufm.html pair_style ufm/gpu pair_ufm.html pair_style ufm/gpu
pair_ufm.html pair_style ufm/omp pair_ufm.html pair_style ufm/omp

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -23,7 +23,9 @@
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
#include <QFontMetrics>
#include <QGuiApplication> #include <QGuiApplication>
#include <QHBoxLayout>
#include <QIcon> #include <QIcon>
#include <QImage> #include <QImage>
#include <QImageReader> #include <QImageReader>
@ -150,9 +152,11 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
QSettings settings; QSettings settings;
vdwfactor = 0.5; vdwfactor = 0.5;
auto pix = QPixmap(":/icons/emblem-photos.png"); shinyfactor = 0.6;
auto pix = QPixmap(":/icons/emblem-photos.png");
xcenter = ycenter = zcenter = 0.5; xcenter = ycenter = zcenter = 0.5;
auto bsize = QFontMetrics(QApplication::font()).size(Qt::TextSingleLine, "Height: 200");
auto *renderstatus = new QLabel(QString()); auto *renderstatus = new QLabel(QString());
renderstatus->setPixmap(pix.scaled(22, 22, Qt::KeepAspectRatio)); 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->setValue(settings.value("xsize", "800").toInt());
xval->setObjectName("xsize"); xval->setObjectName("xsize");
xval->setToolTip("Set rendered image width"); xval->setToolTip("Set rendered image width");
xval->setMinimumSize(bsize);
auto *yval = new QSpinBox; auto *yval = new QSpinBox;
yval->setRange(100, 10000); yval->setRange(100, 10000);
yval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType); yval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType);
yval->setValue(settings.value("ysize", "600").toInt()); yval->setValue(settings.value("ysize", "600").toInt());
yval->setObjectName("ysize"); yval->setObjectName("ysize");
yval->setToolTip("Set rendered image height"); yval->setToolTip("Set rendered image height");
yval->setMinimumSize(bsize);
settings.endGroup(); settings.endGroup();
connect(xval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size); connect(xval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size);
connect(yval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size); connect(yval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size);
// workaround for incorrect highlight bug on macOS // workaround for incorrect highlight bug on macOS
auto *dummy = new QPushButton(QIcon(), ""); auto *dummy1 = new QPushButton(QIcon(), "");
dummy->hide(); dummy1->hide();
auto *dummy2 = new QPushButton(QIcon(), "");
dummy2->hide();
auto *dossao = new QPushButton(QIcon(":/icons/hd-img.png"), ""); auto *dossao = new QPushButton(QIcon(":/icons/hd-img.png"), "");
dossao->setCheckable(true); dossao->setCheckable(true);
@ -188,6 +196,10 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
doanti->setCheckable(true); doanti->setCheckable(true);
doanti->setToolTip("Toggle anti-aliasing"); doanti->setToolTip("Toggle anti-aliasing");
doanti->setObjectName("antialias"); 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"), ""); auto *dovdw = new QPushButton(QIcon(":/icons/vdw-style.png"), "");
dovdw->setCheckable(true); dovdw->setCheckable(true);
dovdw->setToolTip("Toggle VDW style representation"); dovdw->setToolTip("Toggle VDW style representation");
@ -229,32 +241,41 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
combo->addItem(gname); 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(menuBar);
menuLayout->addWidget(renderstatus); menuLayout->addWidget(renderstatus);
menuLayout->addWidget(new QLabel(" Width: ")); menuLayout->addWidget(new QLabel(" Width: "));
menuLayout->addWidget(xval); menuLayout->addWidget(xval);
menuLayout->addWidget(new QLabel(" Height: ")); menuLayout->addWidget(new QLabel(" Height: "));
menuLayout->addWidget(yval); menuLayout->addWidget(yval);
menuLayout->addWidget(dummy); menuLayout->addWidget(dummy1);
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(new QLabel(" Group: ")); menuLayout->addWidget(new QLabel(" Group: "));
menuLayout->addWidget(combo); 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(dossao, &QPushButton::released, this, &ImageViewer::toggle_ssao);
connect(doanti, &QPushButton::released, this, &ImageViewer::toggle_anti); 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(dovdw, &QPushButton::released, this, &ImageViewer::toggle_vdw);
connect(dobox, &QPushButton::released, this, &ImageViewer::toggle_box); connect(dobox, &QPushButton::released, this, &ImageViewer::toggle_box);
connect(doaxes, &QPushButton::released, this, &ImageViewer::toggle_axes); 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(reset, &QPushButton::released, this, &ImageViewer::reset_view);
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(change_group(int))); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(change_group(int)));
mainLayout->addLayout(menuLayout); mainLayout->addLayout(topLayout);
mainLayout->addWidget(scrollArea); mainLayout->addWidget(scrollArea);
setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
setWindowTitle(QString("LAMMPS-GUI - Image Viewer - ") + QFileInfo(fileName).fileName()); 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 // layout has not yet be established, so we need to fix up some pushbutton
// properties directly since lookup in reset_view() will have failed // properties directly since lookup in reset_view() will have failed
dobox->setChecked(showbox); dobox->setChecked(showbox);
doshiny->setChecked(shinyfactor > 0.4);
dovdw->setChecked(vdwfactor > 1.0); dovdw->setChecked(vdwfactor > 1.0);
dovdw->setEnabled(useelements || usediameter || usesigma); dovdw->setEnabled(useelements || usediameter || usesigma);
doaxes->setChecked(showaxes); doaxes->setChecked(showaxes);
@ -296,16 +318,17 @@ void ImageViewer::reset_view()
{ {
QSettings settings; QSettings settings;
settings.beginGroup("snapshot"); settings.beginGroup("snapshot");
xsize = settings.value("xsize", "800").toInt(); xsize = settings.value("xsize", "800").toInt();
ysize = settings.value("ysize", "600").toInt(); ysize = settings.value("ysize", "600").toInt();
zoom = settings.value("zoom", 1.0).toDouble(); zoom = settings.value("zoom", 1.0).toDouble();
hrot = settings.value("hrot", 60).toInt(); hrot = settings.value("hrot", 60).toInt();
vrot = settings.value("vrot", 30).toInt(); vrot = settings.value("vrot", 30).toInt();
vdwfactor = settings.value("vdwstyle", false).toBool() ? 1.6 : 0.5; shinyfactor = settings.value("shinystyle", true).toBool() ? 0.6 : 0.2;
showbox = settings.value("box", true).toBool(); vdwfactor = settings.value("vdwstyle", false).toBool() ? 1.6 : 0.5;
showaxes = settings.value("axes", false).toBool(); showbox = settings.value("box", true).toBool();
usessao = settings.value("ssao", false).toBool(); showaxes = settings.value("axes", false).toBool();
antialias = settings.value("antialias", false).toBool(); usessao = settings.value("ssao", false).toBool();
antialias = settings.value("antialias", false).toBool();
xcenter = ycenter = zcenter = 0.5; xcenter = ycenter = zcenter = 0.5;
settings.endGroup(); settings.endGroup();
@ -320,6 +343,8 @@ void ImageViewer::reset_view()
if (button) button->setChecked(usessao); if (button) button->setChecked(usessao);
button = findChild<QPushButton *>("antialias"); button = findChild<QPushButton *>("antialias");
if (button) button->setChecked(antialias); if (button) button->setChecked(antialias);
button = findChild<QPushButton *>("shiny");
if (button) button->setChecked(shinyfactor > 0.4);
button = findChild<QPushButton *>("vdw"); button = findChild<QPushButton *>("vdw");
if (button) button->setChecked(vdwfactor > 1.0); if (button) button->setChecked(vdwfactor > 1.0);
button = findChild<QPushButton *>("box"); button = findChild<QPushButton *>("box");
@ -358,6 +383,17 @@ void ImageViewer::toggle_anti()
createImage(); createImage();
} }
void ImageViewer::toggle_shiny()
{
auto *button = qobject_cast<QPushButton *>(sender());
if (shinyfactor > 0.4)
shinyfactor = 0.2;
else
shinyfactor = 0.6;
button->setChecked(shinyfactor > 0.4);
createImage();
}
void ImageViewer::toggle_vdw() void ImageViewer::toggle_vdw()
{ {
auto *button = qobject_cast<QPushButton *>(sender()); auto *button = qobject_cast<QPushButton *>(sender());
@ -508,12 +544,14 @@ void ImageViewer::createImage()
// use Lennard-Jones sigma for radius, if available // use Lennard-Jones sigma for radius, if available
usesigma = false; usesigma = false;
const char *pair_style = (const char *)lammps->extract_global("pair_style"); 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"); double **sigma = (double **)lammps->extract_pair("sigma");
if (sigma) { if (sigma) {
usesigma = true; usesigma = true;
for (int i = 1; i <= ntypes; ++i) for (int i = 1; i <= ntypes; ++i) {
adiams += QString("adiam %1 %2 ").arg(i).arg(vdwfactor * sigma[i][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 // 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); if (button) button->setEnabled(false);
} }
// color
if (useelements) if (useelements)
dumpcmd += blank + "element"; dumpcmd += blank + "element";
else else
dumpcmd += blank + settings.value("color", "type").toString(); dumpcmd += blank + settings.value("color", "type").toString();
// diameter
if (usediameter && (vdwfactor > 1.0)) if (usediameter && (vdwfactor > 1.0))
dumpcmd += blank + "diameter"; dumpcmd += blank + "diameter";
else else
dumpcmd += blank + settings.value("diameter", "type").toString(); dumpcmd += blank + settings.value("diameter", "type").toString();
dumpcmd += QString(" size %1 %2").arg(xsize).arg(ysize); dumpcmd += QString(" size %1 %2").arg(xsize).arg(ysize);
dumpcmd += QString(" zoom %1").arg(zoom); dumpcmd += QString(" zoom %1").arg(zoom);
dumpcmd += " shiny 0.5 "; dumpcmd += QString(" shiny %1 ").arg(shinyfactor);
dumpcmd += QString(" fsaa %1").arg(antialias ? "yes" : "no"); dumpcmd += QString(" fsaa %1").arg(antialias ? "yes" : "no");
if (nbondtypes > 0) { if (nbondtypes > 0) {
if (vdwfactor > 1.0) if (vdwfactor > 1.0)

View File

@ -46,6 +46,7 @@ private slots:
void reset_view(); void reset_view();
void toggle_ssao(); void toggle_ssao();
void toggle_anti(); void toggle_anti();
void toggle_shiny();
void toggle_vdw(); void toggle_vdw();
void toggle_box(); void toggle_box();
void toggle_axes(); void toggle_axes();
@ -90,7 +91,7 @@ private:
QString last_dump_cmd; QString last_dump_cmd;
int xsize, ysize; int xsize, ysize;
int hrot, vrot; int hrot, vrot;
double zoom, vdwfactor; double zoom, vdwfactor, shinyfactor;
double xcenter, ycenter, zcenter; double xcenter, ycenter, zcenter;
bool showbox, showaxes, antialias, usessao, useelements, usediameter, usesigma; bool showbox, showaxes, antialias, usessao, useelements, usediameter, usesigma;
}; };

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>lammps-gui.desktop</id>
<metadata_license>CC-BY-3.0</metadata_license>
<project_license>GPL-2.0</project_license>
<name>LAMMPS-GUI</name>
<summary>
Graphical interface to edit, run, plot, and visualize simulations with the LAMMPS MD code
</summary>
<description>
<p>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.</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://docs.lammps.org/_images/lammps-gui-main.png</image>
<caption>LAMMPS-GUI main editor window</caption>
</screenshot>
<screenshot>
<image>https://docs.lammps.org/_images/lammps-gui-log.png</image>
<caption>LAMMPS-GUI output window</caption>
</screenshot>
<screenshot>
<image>https://docs.lammps.org/_images/lammps-gui-chart.png</image>
<caption>LAMMPS-GUI chart window</caption>
</screenshot>
<screenshot>
<image>https://docs.lammps.org/_images/lammps-gui-slideshow.png</image>
<caption>LAMMPS-GUI slideshow window</caption>
</screenshot>
<screenshot>
<image>https://docs.lammps.org/_images/lammps-gui-image.png</image>
<caption>LAMMPS-GUI snapshot image window</caption>
</screenshot>
</screenshots>
<url type="homepage">https://www.lammps.org/</url>
<url type="bugtracker">https://github.com/lammps/lammps/issues</url>
<url type="help">https://docs.lammps.org/stable/</url>
<update_contact>packages@lammps.org</update_contact>
<developer_name>Axel Kohlmeyer</developer_name>
<project_group>LAMMPS</project_group>
<keywords>
<keyword>Molecular Dynamics</keyword>
<keyword>Physics</keyword>
<keyword>Editor</keyword>
<keyword>N-body</keyword>
</keywords>
<provides>
<binary>lammps-gui</binary>
<binary>lmp</binary>
</provides>
<releases>
<release version="1.6.6" timestamp="1722581799">
<description>
First version packaged in flatpak format
</description>
</release>
</releases>
</component>

View File

@ -29,6 +29,7 @@
#include <QClipboard> #include <QClipboard>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDesktopServices> #include <QDesktopServices>
#include <QEvent>
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
#include <QFont> #include <QFont>
@ -47,6 +48,7 @@
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
#include <algorithm>
#include <cstdint> #include <cstdint>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -74,6 +76,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
qRegisterMetaTypeStreamOperators<QList<QString>>("QList<QString>"); qRegisterMetaTypeStreamOperators<QList<QString>>("QList<QString>");
#endif #endif
docver = "";
ui->setupUi(this); ui->setupUi(this);
this->setCentralWidget(ui->textEdit); this->setCentralWidget(ui->textEdit);
highlighter = new Highlighter(ui->textEdit->document()); 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 // check and initialize nthreads setting. Default is to use max if there
// is no preference but do not override OMP_NUM_THREADS // is no preference but do not override OMP_NUM_THREADS
#if defined(_OPENMP) #if defined(_OPENMP)
// use maximum number of available threads unless OMP_NUM_THREADS was set // use up to 16 available threads unless OMP_NUM_THREADS was set
int nthreads = settings.value("nthreads", omp_get_max_threads()).toInt(); int nthreads = settings.value("nthreads", std::min(omp_get_max_threads(), 16)).toInt();
if (!qEnvironmentVariableIsSet("OMP_NUM_THREADS")) { if (!qEnvironmentVariableIsSet("OMP_NUM_THREADS")) {
qputenv("OMP_NUM_THREADS", std::to_string(nthreads).c_str()); 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("-log"));
lammps_args.push_back(mystrdup("none")); lammps_args.push_back(mystrdup("none"));
installEventFilter(this);
setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
QFont all_font("Arial", -1); QFont all_font("Arial", -1);
@ -355,7 +360,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
#undef ADD_STYLES #undef ADD_STYLES
settings.beginGroup("reformat"); 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()); ui->textEdit->setAutoComplete(settings.value("automatic", true).toBool());
settings.endGroup(); settings.endGroup();
} }
@ -713,6 +718,7 @@ void LammpsGui::quit()
lammpsstatus->hide(); lammpsstatus->hide();
lammps.finalize(); lammps.finalize();
autoSave();
if (ui->textEdit->document()->isModified()) { if (ui->textEdit->document()->isModified()) {
QMessageBox msg; QMessageBox msg;
msg.setWindowTitle("Unsaved Changes"); msg.setWindowTitle("Unsaved Changes");
@ -1002,6 +1008,7 @@ void LammpsGui::do_run(bool use_buffer)
return; return;
} }
autoSave();
if (!use_buffer && ui->textEdit->document()->isModified()) { if (!use_buffer && ui->textEdit->document()->isModified()) {
QMessageBox msg; QMessageBox msg;
msg.setWindowTitle("Unsaved Changes"); 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() void LammpsGui::about()
{ {
std::string version = "This is LAMMPS-GUI version " LAMMPS_GUI_VERSION; std::string version = "This is LAMMPS-GUI version " LAMMPS_GUI_VERSION;
@ -1328,7 +1364,8 @@ void LammpsGui::help()
void LammpsGui::manual() 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() void LammpsGui::tutorial()
@ -1338,7 +1375,9 @@ void LammpsGui::tutorial()
void LammpsGui::howto() 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() void LammpsGui::defaults()
@ -1395,7 +1434,7 @@ void LammpsGui::preferences()
} }
if (imagewindow) imagewindow->createImage(); if (imagewindow) imagewindow->createImage();
settings.beginGroup("reformat"); 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()); ui->textEdit->setAutoComplete(settings.value("automatic", true).toBool());
settings.endGroup(); 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: // Local Variables:
// c-basic-offset: 4 // c-basic-offset: 4
// End: // End:

View File

@ -16,6 +16,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QEvent>
#include <QGridLayout> #include <QGridLayout>
#include <QList> #include <QList>
#include <QPair> #include <QPair>
@ -69,6 +70,9 @@ protected:
void do_run(bool use_buffer); void do_run(bool use_buffer);
void start_lammps(); void start_lammps();
void run_done(); void run_done();
void setDocver();
void autoSave();
bool eventFilter(QObject *watched, QEvent *event) override;
public slots: public slots:
void quit(); void quit();
@ -132,6 +136,7 @@ private:
LammpsWrapper lammps; LammpsWrapper lammps;
LammpsRunner *runner; LammpsRunner *runner;
QString docver;
std::string plugin_path; std::string plugin_path;
bool is_running; bool is_running;
int run_counter; int run_counter;

View File

@ -42,6 +42,7 @@
<file>icons/help-browser.png</file> <file>icons/help-browser.png</file>
<file>icons/help-faq.png</file> <file>icons/help-faq.png</file>
<file>icons/help-tutorial.png</file> <file>icons/help-tutorial.png</file>
<file>icons/image-shiny.png</file>
<file>icons/image-x-generic.png</file> <file>icons/image-x-generic.png</file>
<file>icons/media-playback-start-2.png</file> <file>icons/media-playback-start-2.png</file>
<file>icons/media-playlist-repeat.png</file> <file>icons/media-playlist-repeat.png</file>

View File

@ -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

View File

@ -137,6 +137,8 @@ void Preferences::accept()
if (box) settings->setValue("antialias", box->isChecked()); if (box) settings->setValue("antialias", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("ssao"); box = tabWidget->findChild<QCheckBox *>("ssao");
if (box) settings->setValue("ssao", box->isChecked()); if (box) settings->setValue("ssao", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("shiny");
if (box) settings->setValue("shinystyle", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("box"); box = tabWidget->findChild<QCheckBox *>("box");
if (box) settings->setValue("box", box->isChecked()); if (box) settings->setValue("box", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("axes"); box = tabWidget->findChild<QCheckBox *>("axes");
@ -196,6 +198,8 @@ void Preferences::accept()
if (box) settings->setValue("return", box->isChecked()); if (box) settings->setValue("return", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("autoval"); box = tabWidget->findChild<QCheckBox *>("autoval");
if (box) settings->setValue("automatic", box->isChecked()); if (box) settings->setValue("automatic", box->isChecked());
box = tabWidget->findChild<QCheckBox *>("savval");
if (box) settings->setValue("autosave", box->isChecked());
settings->endGroup(); settings->endGroup();
QDialog::accept(); QDialog::accept();
@ -444,6 +448,7 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) :
auto *zoom = new QLabel("Zoom factor:"); auto *zoom = new QLabel("Zoom factor:");
auto *anti = new QLabel("Antialias:"); auto *anti = new QLabel("Antialias:");
auto *ssao = new QLabel("HQ Image mode:"); auto *ssao = new QLabel("HQ Image mode:");
auto *shiny = new QLabel("Shiny Image mode:");
auto *bbox = new QLabel("Show Box:"); auto *bbox = new QLabel("Show Box:");
auto *axes = new QLabel("Show Axes:"); auto *axes = new QLabel("Show Axes:");
auto *vdw = new QLabel("VDW Style:"); 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 *zval = new QLineEdit(settings->value("zoom", "1.0").toString());
auto *aval = new QCheckBox; auto *aval = new QCheckBox;
auto *sval = new QCheckBox; auto *sval = new QCheckBox;
auto *hval = new QCheckBox;
auto *bval = new QCheckBox; auto *bval = new QCheckBox;
auto *eval = new QCheckBox; auto *eval = new QCheckBox;
auto *vval = new QCheckBox; auto *vval = new QCheckBox;
@ -462,6 +468,8 @@ SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) :
sval->setObjectName("ssao"); sval->setObjectName("ssao");
aval->setCheckState(settings->value("antialias", false).toBool() ? Qt::Checked : Qt::Unchecked); aval->setCheckState(settings->value("antialias", false).toBool() ? Qt::Checked : Qt::Unchecked);
aval->setObjectName("anti"); 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->setCheckState(settings->value("box", true).toBool() ? Qt::Checked : Qt::Unchecked);
bval->setObjectName("box"); bval->setObjectName("box");
eval->setCheckState(settings->value("axes", false).toBool() ? Qt::Checked : Qt::Unchecked); 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(aval, i++, 1, Qt::AlignTop);
grid->addWidget(ssao, i, 0, Qt::AlignTop); grid->addWidget(ssao, i, 0, Qt::AlignTop);
grid->addWidget(sval, i++, 1, Qt::AlignVCenter); 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(bbox, i, 0, Qt::AlignTop);
grid->addWidget(bval, i++, 1, Qt::AlignVCenter); grid->addWidget(bval, i++, 1, Qt::AlignVCenter);
grid->addWidget(axes, i, 0, Qt::AlignTop); 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 *namelbl = new QLabel("Name width:");
auto *retlbl = new QLabel("Reformat with 'Enter':"); auto *retlbl = new QLabel("Reformat with 'Enter':");
auto *autolbl = new QLabel("Automatic completion:"); auto *autolbl = new QLabel("Automatic completion:");
auto *savlbl = new QLabel("Auto-save on 'Run' and 'Quit':");
auto *cmdval = new QSpinBox; auto *cmdval = new QSpinBox;
auto *typeval = new QSpinBox; auto *typeval = new QSpinBox;
auto *idval = new QSpinBox; auto *idval = new QSpinBox;
auto *nameval = new QSpinBox; auto *nameval = new QSpinBox;
auto *retval = new QCheckBox; auto *retval = new QCheckBox;
auto *autoval = new QCheckBox; auto *autoval = new QCheckBox;
auto *savval = new QCheckBox;
cmdval->setObjectName("cmdval");
cmdval->setRange(1, 32); cmdval->setRange(1, 32);
cmdval->setValue(settings->value("command", "16").toInt()); cmdval->setValue(settings->value("command", "16").toInt());
cmdval->setObjectName("cmdval"); typeval->setObjectName("typeval");
typeval->setRange(1, 32); typeval->setRange(1, 32);
typeval->setValue(settings->value("type", "4").toInt()); typeval->setValue(settings->value("type", "4").toInt());
typeval->setObjectName("typeval"); idval->setObjectName("idval");
idval->setRange(1, 32); idval->setRange(1, 32);
idval->setValue(settings->value("id", "8").toInt()); idval->setValue(settings->value("id", "8").toInt());
idval->setObjectName("idval"); nameval->setObjectName("nameval");
nameval->setRange(1, 32); nameval->setRange(1, 32);
nameval->setValue(settings->value("name", "8").toInt()); 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->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 autoval->setCheckState(settings->value("automatic", true).toBool() ? Qt::Checked
: Qt::Unchecked); : Qt::Unchecked);
autoval->setObjectName("autoval"); savval->setObjectName("savval");
savval->setCheckState(settings->value("autosave", false).toBool() ? Qt::Checked
: Qt::Unchecked);
settings->endGroup(); settings->endGroup();
int i = 0; 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(retval, i++, 1, Qt::AlignVCenter);
grid->addWidget(autolbl, i, 0, Qt::AlignTop); grid->addWidget(autolbl, i, 0, Qt::AlignTop);
grid->addWidget(autoval, i++, 1, Qt::AlignVCenter); 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, 0);
grid->addItem(new QSpacerItem(100, 100, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 1); grid->addItem(new QSpacerItem(100, 100, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 1);

View File

@ -39,3 +39,45 @@
fun:PMPI_Init fun:PMPI_Init
fun:main 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
}

View File

@ -193,3 +193,13 @@
fun:GOMP_parallel fun:GOMP_parallel
} }
{
gomp_realloc1
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:gomp_realloc
fun:gomp_team_start
fun:GOMP_parallel
}

View File

@ -28,6 +28,11 @@ add_library(GTest::GMock ALIAS gmock)
add_library(GTest::GTestMain ALIAS gtest_main) add_library(GTest::GTestMain ALIAS gtest_main)
add_library(GTest::GMockMain ALIAS gmock_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 # import
foreach(_FLAG ${CMAKE_TUNE_FLAGS}) foreach(_FLAG ${CMAKE_TUNE_FLAGS})
add_compile_options(${_FLAG}) add_compile_options(${_FLAG})

View File

@ -547,13 +547,22 @@ TEST_F(LibraryProperties, neighlist)
lammps_command(lmp, "run 0 post no"); lammps_command(lmp, "run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout(); if (!verbose) ::testing::internal::GetCapturedStdout();
int nhisto = void *ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, 0);
*(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, 0); int nhisto = *(double *)ptr;
int nskip = *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, 0); lammps_free(ptr);
double minval =
*(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, 0); ptr = lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, 0);
double maxval = int nskip = *(double *)ptr;
*(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 3, 0); 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 // 21 pair distances counted, none skipped, smallest 1.0, largest 2.1
EXPECT_EQ(nhisto, 21); EXPECT_EQ(nhisto, 21);
EXPECT_EQ(nskip, 0); EXPECT_EQ(nskip, 0);

View File

@ -32,6 +32,12 @@ using LAMMPS_NS::LAMMPSException;
using ::testing::ContainsRegex; using ::testing::ContainsRegex;
#if defined(LAMMPS_SKIP_DEATH_TESTS)
#define TEST_FAILURE(errmsg, ...) \
{ \
; \
}
#else
#define TEST_FAILURE(errmsg, ...) \ #define TEST_FAILURE(errmsg, ...) \
{ \ { \
::testing::internal::CaptureStdout(); \ ::testing::internal::CaptureStdout(); \
@ -39,6 +45,7 @@ using ::testing::ContainsRegex;
auto mesg = ::testing::internal::GetCapturedStdout(); \ auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ ASSERT_THAT(mesg, ContainsRegex(errmsg)); \
} }
#endif
// whether to print verbose output (i.e. not capturing LAMMPS screen output). // whether to print verbose output (i.e. not capturing LAMMPS screen output).
extern bool verbose; extern bool verbose;