Skip to content

Commit

Permalink
Merge pull request lammps#4255 from akohlmey/collected-small-changes
Browse files Browse the repository at this point in the history
Collected small changes and fixes
  • Loading branch information
akohlmey authored Aug 6, 2024
2 parents 9fa2ffa + 52416af commit 843e678
Show file tree
Hide file tree
Showing 44 changed files with 752 additions and 148 deletions.
7 changes: 6 additions & 1 deletion doc/src/Build_development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ development headers to compile (if those are not found locally a recent
version of that library will be downloaded and compiled along with
LAMMPS and the test programs) and will download and compile a specific
version of the `GoogleTest <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
:class: note
Expand Down
96 changes: 67 additions & 29 deletions doc/src/Howto_lammps_gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,26 @@ get access to the other included executables.
Linux on x86\_64
^^^^^^^^^^^^^^^^

After downloading and unpacking the
For Linux with x86\_64 CPU there are currently two variants. The first
is compiled on Ubuntu 20.04LTS, is using some wrapper scripts, and
should be compatible with more recent Linux distributions. After
downloading and unpacking the
``LAMMPS-Linux-x86_64-GUI-<version>.tar.gz`` package. You can switch
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
^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -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
diameters are all the same.

.. image:: JPG/lammps-gui-image.png
.. figure:: JPG/lammps-gui-image.png
:align: center
:scale: 50%

Visualization of LAMMPS "peptide" example

.. versionchanged:: 1.6

Buttons for toggling shininess and re-centering were added.

The default image size, some default image quality settings, the view
style and some colors can be changed in the ``Preferences`` dialog
window. From the image viewer window further adjustments can be made:
Expand Down Expand Up @@ -442,6 +464,12 @@ Paste (`Ctrl-V`), Undo (`Ctrl-Z`), Redo (`Ctrl-Shift-Z`), Select All
dialog will pop up asking whether to cancel the exit operation, or to
save or not save the buffer contents to a file.

.. versionadded:: 1.6

The editor has an auto-save mode that can be enabled or disabled in the
``Preferences`` dialog. In auto-save mode, the editor buffer is
automatically saved before running LAMMPS or before exiting LAMMPS-GUI.

Context Specific Word Completion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -471,11 +499,12 @@ Line Reformatting
The editor supports reformatting lines according to the syntax in order
to have consistently aligned lines. This primarily means adding
whitespace padding to commands, type specifiers, IDs and names. This
reformatting is performed by default when hitting the 'Enter' key to
start a new line. This feature can be turned on or off in the
``Preferences`` dialog, but it can still be manually performed by
hitting the 'TAB' key. The amount of padding can be adjusted in the
``Preferences`` dialog for the *Editor*.
reformatting is performed manually by hitting the 'Tab' key. It is
also possible to have this done automatically when hitting the 'Enter'
key to start a new line. This feature can be turned on or off in the
``Preferences`` dialog for ``Editor Settings`` with the
"Reformat with 'Enter'" checkbox. The amount of padding for multiple
categories can be adjusted in the same dialog.

Internally this functionality is achieved by splitting the line into
"words" and then putting it back together with padding added where the
Expand Down Expand Up @@ -696,13 +725,15 @@ General Settings:
log) of the application can be set.
- *Select Text Font:* Opens a font selection dialog where the type and
size for the text editor and log font of the application can be set.
- *GUI update interval:* Allows to set the time interval between GUI
and data updates during a LAMMPS run in milliseconds. The default is
to update the GUI every 10 milliseconds. This is good for most cases.
For LAMMPS runs that run *very* fast, however, data may be missed and
through lowering this interval, this can be corrected. However, this
will make the GUI use more resources, which may be a problem on some
computers with slower CPUs and a small number of CPU cores. This
- *GUI update interval:* Allows to set the time interval between GUI and
data updates during a LAMMPS run in milliseconds. The default is to
update the GUI every 10 milliseconds. This is good for many cases.
Set this to 100 milliseconds or more if LAMMPS-GUI consumes too many
resources during a run. For LAMMPS runs that run *very* fast (for
example in tutorial examples), however, data may be missed and through
lowering this interval, this can be corrected. However, this will
make the GUI use more resources, which may be a problem on some
computers with slower CPUs and a small number of CPU cores. This
setting may be changed to a value between 1 and 1000 milliseconds.

Accelerators:
Expand All @@ -719,18 +750,23 @@ Snapshot Image:
^^^^^^^^^^^^^^^

This tab allows setting defaults for the snapshot images displayed in
the ``Image Viewer`` window, such as its dimensions and the zoom
factor applied. The *Antialias* switch will render images with twice
the number of pixels for width and height and then smoothly scale the
image back to the requested size. This produces higher quality images
with smoother edges at the expense of requiring more CPU time to
render the image. The *HQ Image mode* option turns on screen space
ambient occlusion (SSAO) mode when rendering images. This is also
more time consuming, but produces a more 'spatial' representation of
the system shading of atoms by their depth. The *VDW Style* checkbox
selects whether atoms are represented by space filling spheres when
checked or by smaller spheres and sticks. Finally there are a couple
of drop down lists to select the background and box colors.
the ``Image Viewer`` window, such as its dimensions and the zoom factor
applied. The *Antialias* switch will render images with twice the
number of pixels for width and height and then smoothly scale the image
back to the requested size. This produces higher quality images with
smoother edges at the expense of requiring more CPU time to render the
image. The *HQ Image mode* option turns on screen space ambient
occlusion (SSAO) mode when rendering images. This is also more time
consuming, but produces a more 'spatial' representation of the system
shading of atoms by their depth. The *Shiny Image mode* option will
render objects with a shiny surface when enabled. Otherwise the
surfaces will be matted. The *Show Box* option selects whether the
system box is drawn as a colored set of sticks. Similarly, the *Show
Axes* option selects whether a representation of the three system axes
will be drawn as colored sticks. The *VDW Style* checkbox selects
whether atoms are represented by space filling spheres when checked or
by smaller spheres and sticks. Finally there are a couple of drop down
lists to select the background and box colors.

Editor Settings:
^^^^^^^^^^^^^^^^
Expand All @@ -741,9 +777,11 @@ ranges, IDs (e.g. for fixes), and names (e.g. for groups). The value
set is the minimum width for the text element and it can be chosen in
the range between 1 and 32.

The two settings which follow enable or disable the automatic
reformatting when hitting the 'Enter' key and the automatic display of
the completion pop-up window.
The three settings which follow enable or disable the automatic
reformatting when hitting the 'Enter' key, the automatic display of
the completion pop-up window, and whether auto-save mode is enabled.
In auto-save mode the editor buffer is saved before a run or before
exiting LAMMPS-GUI.

-----------

Expand Down
Binary file modified doc/src/JPG/lammps-gui-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/src/JPG/lammps-gui-prefs-accel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/src/JPG/lammps-gui-prefs-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/src/JPG/lammps-gui-prefs-general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/src/JPG/lammps-gui-prefs-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 31 additions & 16 deletions doc/src/Tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Miscellaneous tools
* :ref:`emacs <emacs>`
* :ref:`i-PI <ipi>`
* :ref:`kate <kate>`
* :ref:`LAMMPS GUI <lammps_gui>`
* :ref:`LAMMPS-GUI <lammps_gui>`
* :ref:`LAMMPS magic patterns for file(1) <magic>`
* :ref:`Offline build tool <offline>`
* :ref:`singularity/apptainer <singularity_tool>`
Expand Down Expand Up @@ -524,6 +524,7 @@ The LAMMPS-GUI has been successfully compiled and tested on:
- Fedora Linux 40 x86\_64 using GCC 14, Qt version 6.7
- Apple macOS 12 (Monterey) and macOS 13 (Ventura) with Xcode on arm64 and x86\_64, Qt version 5.15LTS
- Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.36, Qt version 5.15LTS
- Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.40, Qt version 6.7
- Windows 10 and 11 x86_64 with MinGW / GCC 10.0 cross-compiler on Fedora 38, Qt version 5.15LTS

.. _lammps_gui_install:
Expand All @@ -532,14 +533,28 @@ The LAMMPS-GUI has been successfully compiled and tested on:
Pre-compiled executables
^^^^^^^^^^^^^^^^^^^^^^^^

Pre-compiled LAMMPS executable packages that include the GUI are currently
available from https://download.lammps.org/static or
https://github.com/lammps/lammps/releases. You can unpack the archives
(or mount the macOS disk image) and run the GUI directly in place. The
folder may also be moved around and added to the ``PATH`` environment
variable so the executables will be found automatically. The LAMMPS-GUI
executable is called ``lammps-gui`` and either takes no arguments or
attempts to load the first argument as LAMMPS input file.
Pre-compiled LAMMPS executable packages that include the GUI are
currently available from https://download.lammps.org/static or
https://github.com/lammps/lammps/releases. For Windows, you need to
download and then run the application installer. For macOS you download
and mount the disk image and then drag the application bundle to the
Applications folder. For Linux (x86_64) you currently have two
options: 1) you can download the tar.gz archive, unpack it and run the
GUI directly in place. The ``LAMMPS_GUI`` folder may also be moved
around and added to the ``PATH`` environment variable so the executables
will be found automatically. 2) you can download the `Flatpak file
<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:

Expand Down Expand Up @@ -1107,13 +1122,13 @@ necessary development headers and libraries are present.

.. code-block:: bash
-D WITH_SWIG=on # to enable building any SWIG wrapper
-D BUILD_SWIG_JAVA=on # to enable building the Java wrapper
-D BUILD_SWIG_LUA=on # to enable building the Lua wrapper
-D BUILD_SWIG_PERL5=on # to enable building the Perl 5.x wrapper
-D BUILD_SWIG_PYTHON=on # to enable building the Python wrapper
-D BUILD_SWIG_RUBY=on # to enable building the Ruby wrapper
-D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper
-D WITH_SWIG=on # to enable building any SWIG wrapper
-D BUILD_SWIG_JAVA=on # to enable building the Java wrapper
-D BUILD_SWIG_LUA=on # to enable building the Lua wrapper
-D BUILD_SWIG_PERL5=on # to enable building the Perl 5.x wrapper
-D BUILD_SWIG_PYTHON=on # to enable building the Python wrapper
-D BUILD_SWIG_RUBY=on # to enable building the Ruby wrapper
-D BUILD_SWIG_TCL=on # to enable building the Tcl wrapper
Manual building allows a little more flexibility. E.g. one can choose
Expand Down
1 change: 1 addition & 0 deletions doc/utils/sphinx-config/false_positives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ flaglog
flagN
flagVF
flang
flatpak
fld
floralwhite
Florez
Expand Down
6 changes: 3 additions & 3 deletions python/lammps/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ def __init__(self,name='',cmdargs=None,ptr=None,comm=None):
if self.has_mpi_support:
try:
from mpi4py import __version__ as mpi4py_version
# tested to work with mpi4py versions 2 and 3
self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3']
# tested to work with mpi4py versions 2, 3, and 4
self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3','4']
except ImportError:
# ignore failing import
pass
Expand All @@ -369,7 +369,7 @@ def __init__(self,name='',cmdargs=None,ptr=None,comm=None):
if not self.has_mpi_support:
raise Exception('LAMMPS not compiled with real MPI library')
if not self.has_mpi4py:
raise Exception('Python mpi4py version is not 2 or 3')
raise Exception('Python mpi4py version is not 2, 3, or 4')
if self.MPI._sizeof(self.MPI.Comm) == sizeof(c_int):
MPI_Comm = c_int
else:
Expand Down
2 changes: 1 addition & 1 deletion src/GRANULAR/fix_add_heat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void FixAddHeat::post_force(int /*vflag*/)
if (mask[i] & groupbit)
heatflow[i] = 0.0;

double vtmp, dt;
double vtmp = 0.0;
if (vstyle == CONSTANT) vtmp = value;
if (vstyle == EQUAL) vtmp = input->variable->compute_equal(var);
for (int i = 0; i < atom->nlocal; i++) {
Expand Down
19 changes: 17 additions & 2 deletions src/KSPACE/pppm_dipole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@ void PPPMDipole::allocate()
memory->create2d_offset(rho1d,3,-order/2,order/2,"pppm_dipole:rho1d");
memory->create2d_offset(drho1d,3,-order/2,order/2,"pppm_dipole:drho1d");
memory->create2d_offset(rho_coeff,order,(1-order)/2,order/2,"pppm_dipole:rho_coeff");
memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2,
"pppm_dipole:drho_coeff");
memory->create2d_offset(drho_coeff,order,(1-order)/2,order/2,"pppm_dipole:drho_coeff");

// create 2 FFTs and a Remap
// 1st FFT keeps data in FFT decomposition
Expand Down Expand Up @@ -669,15 +668,31 @@ void PPPMDipole::deallocate()
memory->destroy(densityy_fft_dipole);
memory->destroy(densityz_fft_dipole);

memory->destroy(density_fft);
memory->destroy(greensfn);
memory->destroy(work1);
memory->destroy(work2);
memory->destroy(work3);
memory->destroy(work4);
memory->destroy(vg);

memory->destroy1d_offset(fkx,nxlo_fft);
memory->destroy1d_offset(fky,nylo_fft);
memory->destroy1d_offset(fkz,nzlo_fft);

memory->destroy(gf_b);
memory->destroy2d_offset(rho1d,-order_allocated/2);
memory->destroy2d_offset(drho1d,-order_allocated/2);
memory->destroy2d_offset(rho_coeff,(1-order_allocated)/2);
memory->destroy2d_offset(drho_coeff,(1-order_allocated)/2);

delete fft1;
delete fft2;
delete remap;

fft1 = fft2 = nullptr;
remap = nullptr;
gf_b = nullptr;
}

/* ----------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/ML-POD/fitpod_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,8 +1492,6 @@ void FitPOD::environment_cluster_calculation(const datastruct &data)
&beta, A, &Mdesc);
MPI_Allreduce(MPI_IN_PLACE, A, Mdesc * Mdesc, MPI_DOUBLE, MPI_SUM, world);

//if (comm->me == 0) print_matrix("A", Mdesc, Mdesc, A, Mdesc);

if ((comm->me == 0) && (save == 1))
savematrix2binfile(data.filenametag + "_covariance_matrix_elem" + std::to_string(elem + 1) +
".bin",
Expand Down
Loading

0 comments on commit 843e678

Please sign in to comment.