Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collected small changes and fixes #3937

Merged
merged 23 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2b1985f
restore GNU make build capability for ML-PACE
akohlmey Oct 10, 2023
07a0333
prevent potential memory leak
akohlmey Oct 10, 2023
84eab70
must select entire non-blank string under cursor for completion inser…
akohlmey Oct 11, 2023
86a5d6b
must re-initialized threads also for neigbor lists
akohlmey Oct 11, 2023
cc5c5bb
block waiting for end of stdout data not more than a second
akohlmey Oct 11, 2023
eff7440
don't replace end of line character from completion
akohlmey Oct 11, 2023
bb7e8c6
clarify
akohlmey Oct 11, 2023
45172d3
use potential file name distributed with LAMMPS in examples
akohlmey Oct 11, 2023
6f38fa0
Merge remote-tracking branch 'github/develop' into collected-small-ch…
akohlmey Oct 11, 2023
fbdd61e
enable spacefilling sphere option also for systems with per-atom radius
akohlmey Oct 11, 2023
26133bd
Revert "restore GNU make build capability for ML-PACE"
akohlmey Oct 12, 2023
1a9dac8
update fix srd docs
akohlmey Oct 13, 2023
6ad5c0e
port LAMMPS GUI to Qt6 while still supporting Qt5
akohlmey Oct 13, 2023
c67ca1b
Merge branch 'develop' into collected-small-changes
akohlmey Oct 13, 2023
506de70
document support for building LAMMPS GUI with Qt6
akohlmey Oct 13, 2023
6195be5
make keyboard shortcut handling consistent across the entire app
akohlmey Oct 13, 2023
3ebcb0f
store settings to different locations for different Qt versions
akohlmey Oct 13, 2023
2629136
avoid uninitialized data access and segfaults when calling main widge…
akohlmey Oct 13, 2023
926de15
avoid completion on empty lines
akohlmey Oct 13, 2023
3db7e1f
avoid invalid data accesses
akohlmey Oct 13, 2023
50d2ebc
auto-detect OpenMP support also when compiling a standalone binary
akohlmey Oct 13, 2023
2f67826
indicate whether multi-thread is available in preferences
akohlmey Oct 13, 2023
ae8791c
avoid out of bounds access to string under cursor
akohlmey Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions doc/src/Tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,15 @@ Prerequisites and portability
LAMMPS GUI is programmed in C++ based on the C++11 standard and using
the `Qt GUI framework <https://www.qt.io/product/framework>`_.
Currently, Qt version 5.12 or later is required; Qt 5.15LTS is
recommended; Qt 6.x not (yet) supported. Building LAMMPS with CMake is
required. The LAMMPS GUI has been successfully compiled and tested on:
recommended; support for Qt version 6.x is under active development and
thus far only tested with Qt 6.5LTS on Linux. Building LAMMPS with
CMake is required.

The LAMMPS GUI has been successfully compiled and tested on:

- Ubuntu Linux 20.04LTS x86_64 using GCC 9, Qt version 5.12
- Fedora Linux 38 x86\_64 using GCC 13 and Clang 16, Qt version 5.15LTS
- Fedora Linux 38 x86\_64 using GCC 13, Qt version 6.5LTS
- 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 MinGW / GCC 10.0 cross-compiler on Fedora 38, Qt version 5.15LTS
Expand All @@ -717,7 +721,7 @@ required. The LAMMPS GUI has been successfully compiled and tested on:
Pre-compiled executables
^^^^^^^^^^^^^^^^^^^^^^^^

Pre-compiled LAMMPS executables including the GUI are currently
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
Expand All @@ -742,7 +746,10 @@ stored in a location where CMake can find them without additional help.
Otherwise, the location of the Qt library installation must be indicated
by setting ``-D Qt5_DIR=/path/to/qt5/lib/cmake/Qt5``, which is a path to
a folder inside the Qt installation that contains the file
``Qt5Config.cmake``.
``Qt5Config.cmake``. Similarly, for Qt6 the location of the Qt library
installation can be indicated by setting ``-D Qt6_DIR=/path/to/qt6/lib/cmake/Qt6``,
if necessary. When both, Qt5 and Qt6 are available, Qt6 will be preferred
unless ``-D LAMMPS_GUI_USE_QT5=yes`` is set.

It should be possible to build the LAMMPS GUI as a standalone
compilation (e.g. when LAMMPS has been compiled with traditional make),
Expand Down
49 changes: 23 additions & 26 deletions doc/src/fix_srd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ imbue the SRD particles with fluid-like properties, including an
effective viscosity. Thus simulations with large solute particles can
be run more quickly, to measure solute properties like diffusivity
and viscosity in a background fluid. The usual LAMMPS fixes for such
simulations, such as :doc:`fix deform <fix_deform>`, :doc:`fix viscosity <fix_viscosity>`, and :doc:`fix nvt/sllod <fix_nvt_sllod>`,
simulations, such as :doc:`fix deform <fix_deform>`,
:doc:`fix viscosity <fix_viscosity>`, and :doc:`fix nvt/sllod <fix_nvt_sllod>`,
can be used in conjunction with the SRD model.

For more details on how the SRD model is implemented in LAMMPS, :ref:`this paper <Petersen1>` describes the implementation and usage of pure SRD
fluids. :ref:`This paper <Lechman>`, which is nearly complete, describes
the implementation and usage of mixture systems (solute particles in
an SRD fluid). See the examples/srd directory for sample input
scripts using SRD particles in both settings.
For more details on how the SRD model is implemented in LAMMPS,
:ref:`(Petersen) <Petersen1>` describes the implementation and usage of
pure SRD fluids. See the ``examples/srd`` directory for sample input
scripts using SRD particles for that and for mixture systems (solute
particles in an SRD fluid).

This fix does two things:

Expand Down Expand Up @@ -357,28 +358,28 @@ These are the 12 quantities. All are values for the current timestep,
except for quantity 5 and the last three, each of which are
cumulative quantities since the beginning of the run.

* (1) # of SRD/big collision checks performed
* (2) # of SRDs which had a collision
* (3) # of SRD/big collisions (including multiple bounces)
* (4) # of SRD particles inside a big particle
* (5) # of SRD particles whose velocity was rescaled to be < Vmax
* (6) # of bins for collision searching
* (7) # of bins for SRD velocity rotation
* (8) # of bins in which SRD temperature was computed
* (9) SRD temperature
* (10) # of SRD particles which have undergone max # of bounces
* (11) max # of bounces any SRD particle has had in a single step
* (12) # of reneighborings due to SRD particles moving too far
(1) # of SRD/big collision checks performed
(2) # of SRDs which had a collision
(3) # of SRD/big collisions (including multiple bounces)
(4) # of SRD particles inside a big particle
(5) # of SRD particles whose velocity was rescaled to be < Vmax
(6) # of bins for collision searching
(7) # of bins for SRD velocity rotation
(8) # of bins in which SRD temperature was computed
(9) SRD temperature
(10) # of SRD particles which have undergone max # of bounces
(11) max # of bounces any SRD particle has had in a single step
(12) # of reneighborings due to SRD particles moving too far

No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
the :doc:`run <run>` command. This fix is not invoked during
:doc:`energy minimization <minimize>`.

Restrictions
""""""""""""

This command can only be used if LAMMPS was built with the SRD
package. See the :doc:`Build package <Build_package>` doc
page for more info.
This command can only be used if LAMMPS was built with the SRD package.
See the :doc:`Build package <Build_package>` doc page for more info.

Related commands
""""""""""""""""
Expand All @@ -403,7 +404,3 @@ no, and rescale = yes.

**(Petersen)** Petersen, Lechman, Plimpton, Grest, in' t Veld, Schunk, J
Chem Phys, 132, 174106 (2010).

.. _Lechman:

**(Lechman)** Lechman, et al, in preparation (2010).
12 changes: 6 additions & 6 deletions doc/src/pair_ilp_tmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Examples
.. code-block:: LAMMPS

pair_style hybrid/overlay ilp/tmd 16.0 1
pair_coeff * * ilp/tmd TMD.ILP Mo S S
pair_coeff * * ilp/tmd MoS2.ILP Mo S S

pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0
pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL
pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S
pair_coeff * * ilp/tmd TMD.ILP Mo S S Mo S S
pair_coeff * * ilp/tmd MoS2.ILP Mo S S Mo S S

Description
"""""""""""
Expand Down Expand Up @@ -69,15 +69,15 @@ calculating the normals.
each atom `i`, its six nearest neighboring atoms belonging to the same
sub-layer are chosen to define the normal vector `{\bf n}_i`.

The parameter file (e.g. TMD.ILP), is intended for use with *metal*
The parameter file (e.g. MoS2.ILP), is intended for use with *metal*
:doc:`units <units>`, with energies in meV. Two additional parameters,
*S*, and *rcut* are included in the parameter file. *S* is designed to
facilitate scaling of energies. *rcut* is designed to build the neighbor
list for calculating the normals for each atom pair.

.. note::

The parameters presented in the parameter file (e.g. TMD.ILP),
The parameters presented in the parameter file (e.g. MoS2.ILP),
are fitted with taper function by setting the cutoff equal to 16.0
Angstrom. Using different cutoff or taper function should be careful.
These parameters provide a good description in both short- and long-range
Expand Down Expand Up @@ -133,10 +133,10 @@ if LAMMPS was built with that package. See the :doc:`Build package
This pair style requires the newton setting to be *on* for pair
interactions.

The TMD.ILP potential file provided with LAMMPS (see the potentials
The MoS2.ILP potential file provided with LAMMPS (see the potentials
directory) are parameterized for *metal* units. You can use this
potential with any LAMMPS units, but you would need to create your own
custom TMD.ILP potential file with coefficients listed in the appropriate
custom MoS2.ILP potential file with coefficients listed in the appropriate
units, if your simulation does not use *metal* units.

Related commands
Expand Down
22 changes: 11 additions & 11 deletions doc/src/pair_reaxff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ Examples
Description
"""""""""""

Style *reaxff* computes the ReaxFF potential of van Duin, Goddard and
co-workers. ReaxFF uses distance-dependent bond-order functions to
Pair style *reaxff* computes the ReaxFF potential of van Duin, Goddard
and co-workers. ReaxFF uses distance-dependent bond-order functions to
represent the contributions of chemical bonding to the potential
energy. There is more than one version of ReaxFF. The version
energy. There is more than one version of ReaxFF. The version
implemented in LAMMPS uses the functional forms documented in the
supplemental information of the following paper:
:ref:`(Chenoweth et al., 2008) <Chenoweth_20082>`. The version integrated
into LAMMPS matches the version of ReaxFF From Summer 2010. For more
technical details about the pair reaxff implementation of ReaxFF, see
the :ref:`(Aktulga) <Aktulga>` paper. The *reaxff* style was initially
implemented as a stand-alone C code and is now converted to C++ and
integrated into LAMMPS as a package.
:ref:`(Chenoweth et al., 2008) <Chenoweth_20082>` and matches the
version of the reference ReaxFF implementation from Summer 2010. For
more technical details about the implementation of ReaxFF in pair style
*reaxff*, see the :ref:`(Aktulga) <Aktulga>` paper. The *reaxff* style
was initially implemented as a stand-alone C code and is now converted
to C++ and integrated into LAMMPS as a package.

The *reaxff/kk* style is a Kokkos version of the ReaxFF potential that
is derived from the *reaxff* style. The Kokkos version can run on GPUs
and can also use OpenMP multithreading. For more information about the
is derived from the *reaxff* style. The Kokkos version can run on GPUs
and can also use OpenMP multithreading. For more information about the
Kokkos package, see :doc:`Packages details <Packages_details>` and
:doc:`Speed kokkos <Speed_kokkos>` doc pages. One important
consideration when using the *reaxff/kk* style is the choice of either
Expand Down
1 change: 1 addition & 0 deletions src/OPENMP/npair_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace LAMMPS_NS {
// get access to number of threads and per-thread data structures via FixOMP
#define NPAIR_OMP_INIT \
const int nthreads = comm->nthreads; \
omp_set_num_threads(nthreads); \
const int ifix = modify->find_fix("package_omp")

// get thread id and then assign each thread a fixed chunk of atoms
Expand Down
10 changes: 8 additions & 2 deletions src/compute_msd_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */

ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
ComputeChunk(lmp, narg, arg), id_fix(nullptr), massproc(nullptr), masstotal(nullptr),
com(nullptr), comall(nullptr), msd(nullptr)
ComputeChunk(lmp, narg, arg), id_fix(nullptr), fix(nullptr), massproc(nullptr),
masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr)
{
if (narg != 4) error->all(FLERR, "Illegal compute msd/chunk command");

Expand Down Expand Up @@ -196,6 +196,12 @@ void ComputeMSDChunk::compute_array()
void ComputeMSDChunk::allocate()
{
ComputeChunk::allocate();
memory->destroy(massproc);
memory->destroy(masstotal);
memory->destroy(com);
memory->destroy(comall);
memory->destroy(msd);

memory->create(massproc, nchunk, "msd/chunk:massproc");
memory->create(masstotal, nchunk, "msd/chunk:masstotal");
memory->create(com, nchunk, 3, "msd/chunk:com");
Expand Down
76 changes: 68 additions & 8 deletions tools/lammps-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,42 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(LAMMPS_GUI_USE_PLUGIN "Load LAMMPS library dynamically at runtime" OFF)
mark_as_advanced(LAMMPS_GUI_USE_PLUGIN)
option(LAMMPS_GUI_USE_QT5 "Prefer using Qt5 over Qt6" OFF)

include(CheckIncludeFileCXX)
# helper function to check for usable omp.h header
function(check_omp_h_include)
find_package(OpenMP COMPONENTS CXX QUIET)
if(OpenMP_CXX_FOUND)
set(CMAKE_REQUIRED_FLAGS ${OpenMP_CXX_FLAGS})
set(CMAKE_REQUIRED_INCLUDES ${OpenMP_CXX_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LINK_OPTIONS ${OpenMP_CXX_FLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${OpenMP_CXX_LIBRARIES})
check_include_file_cxx(omp.h _have_omp_h)
else()
set(_have_omp_h FALSE)
endif()
set(HAVE_OMP_H_INCLUDE ${_have_omp_h} PARENT_SCOPE)
endfunction()

# detect if we may enable OpenMP support by default
set(BUILD_OMP_DEFAULT OFF)
find_package(OpenMP COMPONENTS CXX QUIET)
if(OpenMP_CXX_FOUND)
check_omp_h_include()
if(HAVE_OMP_H_INCLUDE)
set(BUILD_OMP_DEFAULT ON)
endif()
endif()

option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
if(BUILD_OMP)
find_package(OpenMP COMPONENTS CXX REQUIRED)
check_omp_h_include()
if(NOT HAVE_OMP_H_INCLUDE)
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
endif()
endif()

# checks
# when this file is included as subdirectory in the LAMMPS build, many settings are directly imported
Expand Down Expand Up @@ -73,7 +109,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()

# we require Qt 5 and at least version 5.12 at that.
find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets Charts)
if(NOT LAMMPS_GUI_USE_QT5)
find_package(Qt6 6.2 COMPONENTS Widgets Charts)
endif()
if(NOT Qt6_FOUND)
find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets Charts)
set(QT_VERSION_MAJOR "5")
else()
set(QT_VERSION_MAJOR "6")
endif()

set(PROJECT_SOURCES
main.cpp
Expand Down Expand Up @@ -105,18 +149,34 @@ set(PROJECT_SOURCES
${PLUGIN_LOADER_SRC}
${ICON_RC_FILE}
)
qt5_add_resources(PROJECT_SOURCES lammpsgui.qrc)
if(QT_VERSION_MAJOR EQUAL 6)
qt6_add_resources(PROJECT_SOURCES lammpsgui.qrc)
else()
qt5_add_resources(PROJECT_SOURCES lammpsgui.qrc)
endif()

if(APPLE)
set(MACOSX_ICON_FILE ${LAMMPS_DIR}/cmake/packaging/lammps.icns)
set(MACOSX_README_FILE ${LAMMPS_DIR}/cmake/packaging/README.macos)
set(MACOSX_BACKGROUND_FILE ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png)
endif()

add_executable(lammps-gui
${MACOSX_ICON_FILE}
${PROJECT_SOURCES}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_add_executable(lammps-gui
MANUAL_FINALIZATION
${MACOSX_ICON_FILE}
${PROJECT_SOURCES}
)
else()
add_executable(lammps-gui
${MACOSX_ICON_FILE}
${PROJECT_SOURCES}
)
endif()

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(lammps-gui)
endif()

# compilation settings
if(LAMMPS_GUI_USE_PLUGIN)
Expand All @@ -128,7 +188,7 @@ else()
endif()
target_include_directories(lammps-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(lammps-gui PRIVATE LAMMPS_GUI_VERSION="${PROJECT_VERSION}")
target_link_libraries(lammps-gui PRIVATE Qt5::Widgets Qt5::Charts)
target_link_libraries(lammps-gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${VERSION_MAJOR}::Charts)
if(BUILD_OMP)
find_package(OpenMP COMPONENTS CXX REQUIRED)
target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX)
Expand Down Expand Up @@ -209,7 +269,7 @@ elseif((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
COMMENT "Create zip file with windows binaries"
BYPRODUCT LAMMPS-Win10-amd64.zip
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND NOT LAMMPS_GUI_USE_PLUGIN)
install(TARGETS lammps-gui DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-gui.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lammps-input.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/)
Expand Down
1 change: 0 additions & 1 deletion tools/lammps-gui/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ LAMMPS-GUI TODO list:

# Long term ideas (v2.x)
- rewrite entire application to build the App and its layout manually
- port to Qt6 (with compatibility to Qt5?)
- also a rewrite should establish consistent naming conventions. now we have a mix of LAMMPS style, Qt style, and others.
- add option to attach a debugger to the running program (highly non-portable, need customization support in preferences)
- write a "wizard" dialog that can be used for beginners to create an input file template for a few typical use scenarios
Expand Down