Merge branch 'develop' into next_release

This commit is contained in:
Axel Kohlmeyer
2024-08-28 22:12:31 -04:00
76 changed files with 2172 additions and 1295 deletions

View File

@ -12,6 +12,11 @@ endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
# set policy to silence warnings about requiring execute permission for find_program
# we use OLD because the python-config script for the Fedora MinGW cross-compiler requires it currently
if(POLICY CMP0109)
cmake_policy(SET CMP0109 OLD)
endif()
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
if(POLICY CMP0135)
cmake_policy(SET CMP0135 OLD)

View File

@ -1,5 +1,11 @@
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
# PACE library support for ML-PACE package
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
if(POLICY CMP0135)
cmake_policy(SET CMP0135 OLD)
endif()
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
mark_as_advanced(PACELIB_URL)
mark_as_advanced(PACELIB_MD5)

View File

@ -1,5 +1,10 @@
# Plumed2 support for PLUMED package
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
if(POLICY CMP0135)
cmake_policy(SET CMP0135 OLD)
endif()
# for supporting multiple concurrent plumed2 installations for debugging and testing
set(PLUMED_SUFFIX "" CACHE STRING "Suffix for Plumed2 library")
mark_as_advanced(PLUMED_SUFFIX)
@ -81,6 +86,9 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (CMAKE_CROSSCOMPILING))
DEPENDS plumed_build
COMMENT "Copying Plumed files"
)
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
target_link_libraries(lammps INTERFACE LAMMPS::PLUMED)
endif()
else()
@ -155,6 +163,9 @@ else()
endif()
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
endif()
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(PLUMED REQUIRED plumed${PLUMED_SUFFIX})
@ -169,7 +180,9 @@ else()
endif()
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
target_link_libraries(lammps PUBLIC LAMMPS::PLUMED)
endif()
endif()
endif()
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)

Binary file not shown.

View File

@ -1517,6 +1517,11 @@ in lib/pace or somewhere else, which must be done before building
LAMMPS with this package. The code for the library can be found
at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps-user-pace/>`_
Instead of including the ML-PACE package directly into LAMMPS, it
is also possible to skip this step and build the ML-PACE package as
a plugin using the CMake script files in the ``examples/PACKAGE/pace/plugin``
folder and then load this plugin at runtime with the :doc:`plugin command <plugin>`.
.. tabs::
.. tab:: CMake build
@ -1701,6 +1706,11 @@ try a different one, switch to a different build system, consider a
global PLUMED installation or consider downloading PLUMED during the
LAMMPS build.
Instead of including the PLUMED package directly into LAMMPS, it
is also possible to skip this step and build the PLUMED package as
a plugin using the CMake script files in the ``examples/PACKAGE/plumed/plugin``
folder and then load this plugin at runtime with the :doc:`plugin command <plugin>`.
.. tabs::
.. tab:: CMake build

View File

@ -283,7 +283,7 @@ in the ``examples/kim/plugin`` folder. No changes to the sources of the
KIM package themselves are needed; only the plugin interface and loader
code needs to be added. This example only supports building with CMake,
but is probably a more typical example. To compile you need to run CMake
with -DLAMMPS_SOURCE_DIR=<path/to/lammps/src/folder>. Other
with ``-DLAMMPS_SOURCE_DIR=<path/to/lammps/src/folder>``. Other
configuration setting are identical to those for compiling LAMMPS.
A second example for a plugin from a package is in the

View File

@ -19,9 +19,9 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
Pre-compiled, ready-to-use LAMMPS-GUI executables for Linux x86\_64
(Ubuntu 20.04LTS or later and compatible), macOS (version 11 aka Big
Sur or later), and Windows (version 10 or later) :ref:`are available
<lammps_gui_install>` for download. None-MPI LAMMPS executables for
running LAMMPS from the command line and :doc:`some LAMMPS tools <Tools>`
are also included.
<lammps_gui_install>` for download. Non-MPI LAMMPS executables (as
``lmp``) for running LAMMPS from the command line and :doc:`some
LAMMPS tools <Tools>` compiled executables are also included.
The source code for LAMMPS-GUI is included in the LAMMPS source code
distribution and can be found in the ``tools/lammps-gui`` folder. It
@ -29,40 +29,50 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
<Build_cmake>`.
LAMMPS-GUI tries to provide an experience similar to what people
traditionally would have running LAMMPS using a command line window
and the console LAMMPS executable but just rolled into a single executable:
traditionally would have running LAMMPS using a command line window and
the console LAMMPS executable but just rolled into a single executable:
- writing & editing LAMMPS input files with a text editor
- run LAMMPS on those input file with selected command line flags
- use or extract data from the created files and visualize it with
either a molecular visualization program or a plotting program
- extract data from the created files and visualize it with and
external software
That procedure is quite effective for people proficient in using the
command line, as that allows them to use tools for the individual steps
that they are most comfortable with. It is often *required* to adopt
this workflow when running LAMMPS simulations on high-performance
that they are most comfortable with. In fact, it is often *required* to
adopt this workflow when running LAMMPS simulations on high-performance
computing facilities.
The main benefit of using LAMMPS-GUI is that many basic tasks can be
done directly from the GUI without switching to a text console window or
using external programs, let alone writing scripts to extract data from
the generated output. It also integrates well with graphical desktop
environments where the `.lmp` filename extension can be registered with
LAMMPS-GUI as the executable to launch when double clicking on such
files. Also, LAMMPS-GUI has support for drag-n-drop, i.e. an input
file can be selected and then moved and dropped on the LAMMPS-GUI
executable, and LAMMPS-GUI will launch and read the file into its
buffer.
done directly from the GUI **without** switching to a text console
window or using external programs, let alone writing scripts to extract
data from the generated output. It also integrates well with graphical
desktop environments where the `.lmp` filename extension can be
registered with LAMMPS-GUI as the executable to launch when double
clicking on such files. Also, LAMMPS-GUI has support for drag-n-drop,
i.e. an input file can be selected and then moved and dropped on the
LAMMPS-GUI executable, and LAMMPS-GUI will launch and read the file into
its buffer. In many cases LAMMPS-GUI will be integrated into the
graphical desktop environment and can be launched like other
applications.
LAMMPS-GUI thus makes it easier for beginners to get started running
simple LAMMPS simulations. It is very suitable for tutorials on LAMMPS
since you only need to learn how to use a single program for most tasks
and thus time can be saved and people can focus on learning LAMMPS.
The tutorials at https://lammpstutorials.github.io/ were specifically
The tutorials at https://lammpstutorials.github.io/ are specifically
updated for use with LAMMPS-GUI.
Another design goal is to keep the barrier low when replacing part of
the functionality of LAMMPS-GUI with external tools.
the functionality of LAMMPS-GUI with external tools. That said, LAMMPS-GUI
has some unique functionality that is not found elsewhere:
- auto-adapting to features available in the integrated LAMMPS library
- interactive visualization using the :doc:`dump image <dump_image>`
command with the option to copy-paste the resulting settings
- automatic slide show generation from dump image out at runtime
- automatic plotting of thermodynamics data at runtime
- inspection of binary restart files
The following text provides a detailed tour of the features and
functionality of LAMMPS-GUI. Suggestions for new features and
@ -134,9 +144,13 @@ When LAMMPS-GUI starts, it shows the main window, labeled *Editor*, with
either an empty buffer or the contents of the file used as argument. In
the latter case it may look like the following:
.. image:: JPG/lammps-gui-main.png
:align: center
:scale: 50%
.. |gui-main1| image:: JPG/lammps-gui-main.png
:width: 48%
.. |gui-main2| image:: JPG/lammps-gui-dark.png
:width: 48%
|gui-main1| |gui-main2|
There is the typical menu bar at the top, then the main editor buffer,
and a status bar at the bottom. The input file contents are shown
@ -276,8 +290,6 @@ right mouse button into the *Output* window text area.
:align: center
:scale: 50%
.. versionadded:: 1.6
Should the *Output* window contain embedded YAML format text (see above for a
demonstration), for example from using :doc:`thermo_style yaml
<thermo_style>` or :doc:`thermo_modify line yaml <thermo_modify>`, the
@ -289,10 +301,6 @@ text area.
Charts Window
-------------
.. versionadded:: 1.6
Plot smoothing support
By default, when starting a run, a *Charts* window opens that displays a
plot of thermodynamic output of the LAMMPS calculation as shown below.
@ -327,10 +335,6 @@ corresponds to. Same as for the *Output* window, the chart window is
replaced on each new run, but the behavior can be changed in the
*Preferences* dialog.
.. versionadded:: 1.6
Support for YAML export added
From the *File* menu on the top left, it is possible to save an image
of the currently displayed plot or export the data in either plain text
columns (for use by plotting tools like `gnuplot
@ -371,8 +375,6 @@ zoom in or zoom out of the displayed images. The button on the very
left triggers an export of the slide show animation to a movie file,
provided the `FFmpeg program <https://ffmpeg.org/>`_ is installed.
.. versionadded:: 1.6
When clicking on the "garbage can" icon, all image files of the slide
show will be deleted. Since their number can be large for long
simulations, this option enables to safely and quickly clean up the
@ -391,7 +393,7 @@ below.
.. image:: JPG/lammps-gui-variable-info.png
:align: center
:scale: 75%
:scale: 50%
Like for the *Output* and *Charts* windows, its content is continuously
updated during a run. It will show "(none)" if there are no variables
@ -435,20 +437,21 @@ instance when using reduced (= 'lj') :doc:`units <units>`, then
LAMMPS-GUI will check the current pair style and if it is a
Lennard-Jones type potential, it will extract the *sigma* parameter
for each atom type and assign atom diameters from those numbers.
For cases where atom diameters are not auto-detected, the *Atom size* field
can be edited and a suitable value set manually. The default value
is inferred from the x-direction lattice spacing.
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.
If elements cannot be detected the default sequence of colors of the
:doc:`dump image <dump_image>` command is assigned to the different atom
types.
.. figure:: JPG/lammps-gui-image.png
:align: center
:scale: 50%
.. |gui-image1| image:: JPG/lammps-gui-image.png
:width: 48%
Visualization of LAMMPS "peptide" example
.. |gui-image2| image:: JPG/lammps-gui-funnel.png
:width: 48%
.. versionchanged:: 1.6
Buttons for toggling shininess and re-centering were added.
|gui-image1| |gui-image2|
The default image size, some default image quality settings, the view
style and some colors can be changed in the *Preferences* dialog
@ -468,8 +471,6 @@ current image can be saved to a file (keyboard shortcut `Ctrl-S`) or
copied to the clipboard (keyboard shortcut `Ctrl-C`) for pasting the
image into another application.
.. versionadded:: 1.6
From the *File* menu it is also possible to copy the current
:doc:`dump image <dump_image>` and :doc:`dump_modify <dump_image>`
commands to the clipboard so they can be pasted into a LAMMPS input file
@ -488,8 +489,6 @@ 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.
@ -553,8 +552,6 @@ context menu that open the corresponding documentation page in the
online LAMMPS documentation in a web browser window. When using the
keyboard, the first of those entries is chosen.
.. versionadded:: 1.6
If the word under the cursor is a file, then additionally the context
menu has an entry to open the file in a read-only text viewer window.
If the file is a LAMMPS restart file, instead the menu entry offers to
@ -572,8 +569,6 @@ will contain a corresponding message.
Inspecting a Restart file
^^^^^^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 1.6
When LAMMPS-GUI is asked to "Inspect a Restart", it will read the
restart file into a LAMMPS instance and then open three different
windows. The first window is a text viewer with the output of an
@ -629,9 +624,10 @@ Edit
^^^^
The *Edit* menu offers the usual editor functions like *Undo*, *Redo*,
*Cut*, *Copy*, *Paste*. It can also open a *Preferences* dialog
(keyboard shortcut `Ctrl-P`) and allows deleting all stored preferences
and settings, so they are reset to their default values.
*Cut*, *Copy*, *Paste*, and a *Find and Replace* dialog (keyboard
shortcut `Ctrl-F`). It can also open a *Preferences* dialog (keyboard
shortcut `Ctrl-P`) and allows deleting all stored preferences and
settings, so they are reset to their default values.
Run
^^^
@ -667,7 +663,7 @@ set *before* a run is started.
.. image:: JPG/lammps-gui-variables.png
:align: center
:scale: 75%
:scale: 50%
The *Set Variables* dialog will be pre-populated with entries that
are set as index variables in the input and any variables that are
@ -716,6 +712,43 @@ https://lammpstutorials.github.io/ in a web browser window.
-----
Find and Replace
----------------
.. image:: JPG/lammps-gui-find.png
:align: center
:scale: 33%
The *Find and Replace* dialog allows searching for and replacing
text in the *Editor* window.
The dialog can be opened either from the *Edit* menu or with the
keyboard shortcut `Ctrl-F`. You can enter the text to search for.
Through three check-boxes the search behavior can be adjusted:
- If checked, "Match case" does a case sensitive search; otherwise
the search is case insensitive.
- If checked, "Wrap around" starts searching from the start of the
document, if there is no match found from the current cursor position
until the end of the document; otherwise the search will stop.
- If checked, the "Whole word" setting only finds full word matches
(white space and special characters are word boundaries).
Clicking on the *Next* button will search for the next occurrence of the
search text and select / highlight it. Clicking on the *Replace* button
will replace an already highlighted search text and find the next one.
If no text is selected, or the selected text does not match the
selection string, then the first click on the *Replace* button will
only search and highlight the next occurrence of the search string.
Clicking on the *Replace All* button will replace all occurrences from
the cursor position to the end of the file; if the *Wrap around* box is
checked, then it will replace **all** occurrences in the **entire**
document. Clicking on the *Done* button will dismiss the dialog.
------
Preferences
-----------
@ -848,7 +881,7 @@ available (On macOS use the Command key instead of Ctrl/Control).
.. list-table::
:header-rows: 1
:widths: auto
:widths: 16 19 13 16 13 22
* - Shortcut
- Function
@ -890,32 +923,32 @@ available (On macOS use the Command key instead of Ctrl/Control).
- Quit Application
- Ctrl+A
- Select All
- Ctrl+P
- Preferences
- Ctrl+F
- Find and Replace
* - Ctrl+W
- Close Window
- Ctrl+Shift+H
- Quick Help
- Ctrl+Shift+G
- LAMMPS-GUI Howto
* - Ctrl+Shift+A
- About LAMMPS
- Ctrl+?
- Context Help
- Ctrl+Shift+W
- Show Variables
* - Ctrl+Shift+M
- LAMMPS Manual
- TAB
- Reformat line
- Shift+TAB
- Show Completions
* - Ctrl+Shift+T
- LAMMPS Tutorial
- Ctrl+Shift+Enter
* - Ctrl+Shift+Enter
- Run File
-
-
- Ctrl+Shift+W
- Show Variables
- Ctrl+P
- Preferences
* - Ctrl+Shift+A
- About LAMMPS
- Ctrl+Shift+H
- Quick Help
- Ctrl+Shift+G
- LAMMPS-GUI Howto
* - Ctrl+Shift+M
- LAMMPS Manual
- Ctrl+?
- Context Help
- Ctrl+Shift+T
- LAMMPS Tutorial
Further editing keybindings `are documented with the Qt documentation
<https://doc.qt.io/qt-5/qplaintextedit.html#editing-key-bindings>`_. In

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -1823,7 +1823,8 @@ Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1.
**Install:**
This package has :ref:`specific installation instructions <ml-pace>` on the
:doc:`Build extras <Build_extras>` page.
:doc:`Build extras <Build_extras>` page. This package may also be compiled
as a plugin to avoid licensing conflicts when distributing binaries.
**Supporting info:**
@ -2344,7 +2345,9 @@ and Gareth Tribello.
**Install:**
This package has :ref:`specific installation instructions <plumed>` on the :doc:`Build extras <Build_extras>` page.
This package has :ref:`specific installation instructions <plumed>` on the
:doc:`Build extras <Build_extras>` page. This package may also be compiled
as a plugin to avoid licensing conflicts when distributing binaries.
**Supporting info:**

View File

@ -590,20 +590,31 @@ and the LAMMPS library, via ``-D LAMMPS_SOURCE_DIR=/path/to/lammps/src``.
CMake will try to guess a build folder with the LAMMPS library from that
path, but it can also be set with ``-D LAMMPS_LIB_DIR=/path/to/lammps/lib``.
Plugin version
""""""""""""""
Rather than linking to the LAMMPS library during compilation, it is also
possible to compile the GUI with a plugin loader that will load
the LAMMPS library dynamically at runtime during the start of the GUI
from a shared library; e.g. ``liblammps.so`` or ``liblammps.dylib`` or
possible to compile the GUI with a plugin loader that will load the
LAMMPS library dynamically at runtime during the start of the GUI from a
shared library; e.g. ``liblammps.so`` or ``liblammps.dylib`` or
``liblammps.dll`` (depending on the operating system). This has the
advantage that the LAMMPS library can be built from updated or modified
LAMMPS source without having to recompile the GUI. The ABI of the
LAMMPS C-library interface is very stable and generally backward
compatible. This feature is enabled by setting
``-D LAMMPS_GUI_USE_PLUGIN=on`` and then ``-D
compatible. This feature is enabled by setting ``-D
LAMMPS_GUI_USE_PLUGIN=on`` and then ``-D
LAMMPS_PLUGINLIB_DIR=/path/to/lammps/plugin/loader``. Typically, this
would be the ``examples/COUPLE/plugin`` folder of the LAMMPS
distribution.
When compiling LAMMPS-GUI with plugin support, there is an additional
command line flag (``-p <path>`` or ``--pluginpath <path>``) which
allows to override the path to LAMMPS shared library used by the GUI.
This is usually auto-detected on the first run and can be changed in the
LAMMPS-GUI *Preferences* dialog. The command line flag allows to reset
this path to a valid value in case the original setting has become
invalid. An empty path ("") as argument restores the default setting.
Platform notes
^^^^^^^^^^^^^^
@ -671,6 +682,15 @@ folder> --target tgz`` or ``make tgz`` to build a
``LAMMPS-Linux-amd64.tar.gz`` file with the executables and their
support libraries.
It is also possible to build a `flatpak bundle
<https://docs.flatpak.org/en/latest/single-file-bundles.html>`_ which is
a way to distribute applications in a way that is compatible with most
Linux distributions. Use the "flatpak" target to trigger a compile
(``cmake --build <build folder> --target flatpak`` or ``make flatpak``).
Please note that this will not build from the local sources but from the
repository and branch listed in the ``org.lammps.lammps-gui.yml``
LAMMPS-GUI source folder.
----------
.. _arc:

View File

@ -59,11 +59,12 @@ may also contribute to the virial term.
A symmetric pressure tensor, stored as a 6-element vector, is also
calculated by this compute. The six components of the vector are
ordered :math:`xx,` :math:`yy,` :math:`zz,` :math:`xy,` :math:`xz,` :math:`yz.`
The equation for the :math:`(I,J)` components (where :math:`I` and :math:`J`
are :math:`x`, :math:`y`, or :math:`z`) is similar to the above formula,
except that the first term uses components of the kinetic energy tensor and the
second term uses components of the virial tensor:
ordered :math:`xx,` :math:`yy,` :math:`zz,` :math:`xy,` :math:`xz,`
:math:`yz.` The equation for the :math:`(I,J)` components (where
:math:`I` and :math:`J` are :math:`x`, :math:`y`, or :math:`z`) is
similar to the above formula, except that the first term uses
components related to the kinetic energy tensor and the second term
uses components of the virial tensor:
.. math::
@ -75,8 +76,8 @@ calculated. This includes a kinetic energy (temperature) term and the
virial as the sum of pair, bond, angle, dihedral, improper, kspace
(long-range), and fix contributions to the force on each atom. If any
extra keywords are listed, then only those components are summed to
compute temperature or ke and/or the virial. The *virial* keyword
means include all terms except the kinetic energy *ke*\ .
compute temperature or ke and/or the virial. The *virial* keyword means
include all terms except the kinetic energy *ke*\ .
The *pair/hybrid* keyword means to only include contribution
from a sub-style in a *hybrid* or *hybrid/overlay* pair style.
@ -86,26 +87,31 @@ system, including for many-body potentials and accounting for the
effects of periodic boundary conditions are discussed in
:ref:`(Thompson) <Thompson1>`.
The temperature and kinetic energy tensor is not calculated by this
The temperature and kinetic energy tensor are not calculated by this
compute, but rather by the temperature compute specified with the
command. If the kinetic energy is not included in the pressure, than
the temperature compute is not used and can be specified as NULL.
Normally the temperature compute used by compute pressure should
calculate the temperature of all atoms for consistency with the virial
term, but any compute style that calculates temperature can be used
(e.g., one that excludes frozen atoms or other degrees of freedom).
command. See the doc pages for individual compute temp variants for an
explanation of how they calculate temperature and a symmetric tensor
(6-element vector) whose components are twice that of the traditional KE
tensor. That tensor is what appears in the pressure tensor formula
above.
If the kinetic energy is not included in the pressure, than the
temperature compute is not used and can be specified as NULL. Normally
the temperature compute used by compute pressure should calculate the
temperature of all atoms for consistency with the virial term, but any
compute style that calculates temperature can be used (e.g., one that
excludes frozen atoms or other degrees of freedom).
Note that if desired the specified temperature compute can be one that
subtracts off a bias to calculate a temperature using only the thermal
velocity of the atoms (e.g., by subtracting a background streaming
velocity).
See the doc pages for individual :doc:`compute commands <compute>` to determine
which ones include a bias.
velocity). See the doc pages for individual :doc:`compute commands
<compute>` to determine which ones include a bias.
Also note that the :math:`N` in the first formula above is really
degrees-of-freedom divided by :math:`d` = dimensionality, where the DOF value
is calculated by the temperature compute.
See the various :doc:`compute temperature <compute>` styles for details.
degrees-of-freedom divided by :math:`d` = dimensionality, where the
DOF value is calculated by the temperature compute. See the various
:doc:`compute temperature <compute>` styles for details.
A compute of this style with the ID of thermo_press is created when
LAMMPS starts up, as if this command were in the input script:
@ -136,9 +142,8 @@ The ordering of values in the symmetric pressure tensor is as follows:
:math:`p_{xx},` :math:`p_{yy},` :math:`p_{zz},` :math:`p_{xy},`
:math:`p_{xz},` :math:`p_{yz}.`
The scalar and vector values calculated by this compute are
"intensive". The scalar and vector values will be in pressure
:doc:`units <units>`.
The scalar and vector values calculated by this compute are "intensive".
The scalar and vector values will be in pressure :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -48,13 +48,17 @@ the group, :math:`N_\mathrm{fix DOFs}` is the number of degrees of
freedom removed by fix commands (see below), :math:`k_B` is the
Boltzmann constant, and :math:`T` is the resulting computed temperature.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as the
above expression for :math:`E_\mathrm{kin}`, except that :math:`v_i^2` is
replaced by :math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on.
The six components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
@ -94,16 +98,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length six (KE tensor), which can be accessed by indices
1--6. These values can be used by any command that uses global scalar
or vector values from a compute as input. See the :doc:`Howto output
<Howto_output>` page for an overview of LAMMPS output options.
vector of length six (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -41,8 +41,8 @@ translational and rotational kinetic energy. This differs from the
usual :doc:`compute temp <compute_temp>` command, which assumes point
particles with only translational kinetic energy.
Only finite-size particles (aspherical or spherical) can be included
in the group. For 3d finite-size particles, each has six degrees of
Only finite-size particles (aspherical or spherical) can be included in
the group. For 3d finite-size particles, each has six degrees of
freedom (three translational, three rotational). For 2d finite-size
particles, each has three degrees of freedom (two translational, one
rotational).
@ -70,25 +70,39 @@ axis. It will also be the case for biaxial ellipsoids when exactly two
of the semiaxes have the same length and the corresponding relative well
depths are equal.
The translational kinetic energy is computed the same as is described
by the :doc:`compute temp <compute_temp>` command. The rotational
kinetic energy is computed as :math:`\frac12 I \omega^2`, where :math:`I` is
the inertia tensor for the aspherical particle and :math:`\omega` is its
The translational kinetic energy is computed the same as is described by
the :doc:`compute temp <compute_temp>` command. The rotational kinetic
energy is computed as :math:`\frac12 I \omega^2`, where :math:`I` is the
inertia tensor for the aspherical particle and :math:`\omega` is its
angular velocity, which is computed from its angular momentum.
.. note::
For :doc:`2d models <dimension>`, particles are treated as
ellipsoids, not ellipses, meaning their moments of inertia will be the
same as in 3d.
ellipsoids, not ellipses, meaning their moments of inertia will be
the same as in 3d.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute. The formula for the components of the
tensor is the same as the above formula, except that :math:`v^2` and
:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y`
for the :math:`xy` component, and the appropriate elements of the moment of
inertia tensor are used. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x
\omega_y` for the :math:`xy` component, and the appropriate elements of
the moment of inertia tensor are used. The six components of the vector
are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for the
components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
And the appropriate elements of the moment of inertia tensor are used.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`,
:math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic/dof* option of
@ -131,27 +145,26 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
vector of length 6 (symmetric tensor), which can be accessed by indices
1--6. These values can be used by any command that uses global scalar
or vector values from a compute as input. See the :doc:`Howto output
<Howto_output>` page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value calculated by this compute is "intensive". The vector
values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""
This compute is part of the ASPHERE package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
LAMMPS was built with that package. See the :doc:`Build package
<Build_package>` page for more info.
This compute requires that atoms store angular momentum and a
quaternion as defined by the :doc:`atom_style ellipsoid <atom_style>`
command.
This compute requires that atoms store angular momentum and a quaternion
as defined by the :doc:`atom_style ellipsoid <atom_style>` command.
All particles in the group must be finite-size. They cannot be point
particles, but they can be aspherical or spherical as defined by their

View File

@ -62,12 +62,17 @@ kinetic energy is computed as :math:`\frac12 I \omega^2`, where :math:`I`
is the moment of inertia tensor for the aspherical particle and :math:`\omega`
is its angular velocity, which is computed from its angular momentum.
A kinetic energy tensor, stored as a 6-element vector, is also calculated by
this compute. The formula for the components of the tensor is the same as the
above formula, except that :math:`v^2` and :math:`\omega^2` are
replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y` for the
math:`xy` component, and the appropriate elements of the inertia tensor are
used. The six components of the vector are ordered :math:`xx`, :math:`yy`,
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
And the appropriate elements of the moment of inertia tensor are used.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be
@ -111,17 +116,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`.
The vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -85,12 +85,14 @@ By default, *adof* = 2 or 3 = dimensionality of system, as set via the
:doc:`dimension <dimension>` command, and *cdof* = 0.0.
This gives the usual formula for temperature.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by
:math:`v_x v_y` for the :math:`xy` component, and so on.
The six components of the vector are ordered :math:`xx`, :math:`yy`,
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute. The formula for the components of the tensor is the
same as the above expression for :math:`E_\mathrm{kin}`, except that
the 1/2 factor is NOT included and the :math:`v_i^2` is replaced by
:math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. Note
that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
Note that the number of atoms contributing to the temperature is
@ -227,10 +229,10 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
This compute also optionally calculates a global array, if one or more
@ -245,9 +247,9 @@ page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive". The array values are "intensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`. The array values
will be in temperature :doc:`units <units>` for the *temp* value, and in
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`. The array values will be
in temperature :doc:`units <units>` for the *temp* value, and in
energy :doc:`units <units>` for the *kecom* and *internal* values.
Restrictions

View File

@ -44,12 +44,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
simulation, :math:`N` is number of atoms in the group, :math:`k_B` is
the Boltzmann constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y`
for the :math:`xy` component, and so on. The six components of the vector are
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
@ -81,17 +86,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`.
The vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values is in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -31,27 +31,27 @@ on the center-of-mass velocity of atom pairs that are bonded to each
other. This compute is designed to be used with the adiabatic
core/shell model of :ref:`(Mitchell and Fincham) <MitchellFincham1>`.
See the :doc:`Howto coreshell <Howto_coreshell>` page for an overview of
the model as implemented in LAMMPS. Specifically, this compute
enables correct temperature calculation and thermostatting of
core/shell pairs where it is desirable for the internal degrees of
freedom of the core/shell pairs to not be influenced by a thermostat.
A compute of this style can be used by any command that computes a
temperature via :doc:`fix_modify <fix_modify>`
(e.g., :doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix npt <fix_nh>`).
the model as implemented in LAMMPS. Specifically, this compute enables
correct temperature calculation and thermostatting of core/shell pairs
where it is desirable for the internal degrees of freedom of the
core/shell pairs to not be influenced by a thermostat. A compute of
this style can be used by any command that computes a temperature via
:doc:`fix_modify <fix_modify>` (e.g., :doc:`fix temp/rescale
<fix_temp_rescale>`, :doc:`fix npt <fix_nh>`).
Note that this compute does not require all ions to be polarized,
hence defined as core/shell pairs. One can mix core/shell pairs and
ions without a satellite particle if desired. The compute will
consider the non-polarized ions according to the physical system.
Note that this compute does not require all ions to be polarized, hence
defined as core/shell pairs. One can mix core/shell pairs and ions
without a satellite particle if desired. The compute will consider the
non-polarized ions according to the physical system.
For this compute, core and shell particles are specified by two
respective group IDs, which can be defined using the
:doc:`group <group>` command. The number of atoms in the two groups
must be the same and there should be one bond defined between a pair
of atoms in the two groups. Non-polarized ions which might also be
included in the treated system should not be included into either of
these groups, they are taken into account by the *group-ID* (second
argument) of the compute.
respective group IDs, which can be defined using the :doc:`group
<group>` command. The number of atoms in the two groups must be the
same and there should be one bond defined between a pair of atoms in the
two groups. Non-polarized ions which might also be included in the
treated system should not be included into either of these groups, they
are taken into account by the *group-ID* (second argument) of the
compute.
The temperature is calculated by the formula
@ -60,52 +60,56 @@ The temperature is calculated by the formula
\text{KE} = \frac{\text{dim}}{2} N k_B T,
where KE is the total kinetic energy of the group of atoms (sum of
:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the simulation,
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
constant, and :math:`T` is the absolute temperature. Note that
the velocity of each core or shell atom used in the KE calculation is
the velocity of the center-of-mass (COM) of the core/shell pair the
atom is part of.
:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the
simulation, :math:`N` is the number of atoms in the group, :math:`k_B`
is the Boltzmann constant, and :math:`T` is the absolute temperature.
Note that the velocity of each core or shell atom used in the KE
calculation is the velocity of the center-of-mass (COM) of the
core/shell pair the atom is part of.
A kinetic energy tensor, stored as a six-element vector, is also calculated by
this compute for use in the computation of a pressure tensor. The formula for
the components of the tensor is the same as the above formula, except that
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and so
on. The six components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. In contrast to the temperature,
the velocity of each core or shell atom is taken individually.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for the
components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The change this fix makes to core/shell atom velocities is essentially
computing the temperature after a "bias" has been removed from the velocity of
the atoms. This "bias" is the velocity of the atom relative to the
center-of-mass velocity of the core/shell pair. If this compute is used with a
fix command that performs thermostatting then this bias will be subtracted from
each atom, thermostatting of the remaining center-of-mass velocity will be
performed, and the bias will be added back in. This means the thermostatting
will effectively be performed on the core/shell pairs, instead of on the
individual core and shell atoms. Thermostatting fixes that work in this way
include :doc:`fix nvt <fix_nh>`, :doc:`fix temp/rescale <fix_temp_rescale>`,
:doc:`fix temp/berendsen <fix_temp_berendsen>`, and
:doc:`fix langevin <fix_langevin>`.
computing the temperature after a "bias" has been removed from the
velocity of the atoms. This "bias" is the velocity of the atom relative
to the center-of-mass velocity of the core/shell pair. If this compute
is used with a fix command that performs thermostatting then this bias
will be subtracted from each atom, thermostatting of the remaining
center-of-mass velocity will be performed, and the bias will be added
back in. This means the thermostatting will effectively be performed on
the core/shell pairs, instead of on the individual core and shell atoms.
Thermostatting fixes that work in this way include :doc:`fix nvt
<fix_nh>`, :doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix
temp/berendsen <fix_temp_berendsen>`, and :doc:`fix langevin
<fix_langevin>`.
The internal energy of core/shell pairs can be calculated by the
:doc:`compute temp/chunk <compute_temp_chunk>` command, if chunks are defined
as core/shell pairs. See the :doc:`Howto coreshell <Howto_coreshell>` doc
page for more discussion on how to do this.
:doc:`compute temp/chunk <compute_temp_chunk>` command, if chunks are
defined as core/shell pairs. See the :doc:`Howto coreshell
<Howto_coreshell>` doc page for more discussion on how to do this.
Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
vector of length 6 (symmetric tensor), which can be accessed by indices
1--6. These values can be used by any command that uses global scalar
or vector values from a compute as input.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value calculated by this compute is "intensive". The vector
values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -73,12 +73,16 @@ simulation, :math:`N` is the number of atoms in the group, :math:`k_B`
is the Boltzmann constant, and :math:`T` is the temperature. Note that
:math:`v` in the kinetic energy formula is the atom's velocity.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for
the :math:`xy` component, and so on. The six components of the vector are
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
@ -128,17 +132,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`.
The vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -29,17 +29,20 @@ model, after subtracting out a streaming velocity induced by the
simulation box changing size and/or shape, for example in a
non-equilibrium MD (NEMD) simulation. The size/shape change is
induced by use of the :doc:`fix deform <fix_deform>` command. A
compute of this style is created by the
:doc:`fix nvt/sllod/eff <fix_nvt_sllod_eff>` command to compute the thermal
temperature of atoms for thermostatting purposes. A compute of this
style can also be used by any command that computes a temperature
(e.g., :doc:`thermo_modify <thermo_modify>`, :doc:`fix npt/eff <fix_nh_eff>`).
compute of this style is created by the :doc:`fix nvt/sllod/eff
<fix_nvt_sllod_eff>` command to compute the thermal temperature of
atoms for thermostatting purposes. A compute of this style can also
be used by any command that computes a temperature (e.g.,
:doc:`thermo_modify <thermo_modify>`, :doc:`fix npt/eff
<fix_nh_eff>`).
The calculation performed by this compute is exactly like that
described by the :doc:`compute temp/deform <compute_temp_deform>`
command, except that the formula for the temperature includes the
radial electron velocity contributions, as discussed by the :doc:`compute temp/eff <compute_temp_eff>` command. Note that only the
translational degrees of freedom for each nuclei or electron are
command, except that the formulas for the temperature (scalar) and
diagonal components of the symmetric tensor (vector) include the
radial electron velocity contributions, as discussed by the
:doc:`compute temp/eff <compute_temp_eff>` command. Note that only
the translational degrees of freedom for each nuclei or electron are
affected by the streaming velocity adjustment. The radial velocity
component of the electrons is not affected.
@ -47,17 +50,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -44,12 +44,16 @@ constant, and :math:`T` = temperature. The calculation of KE excludes the
is 0. The dim parameter is adjusted to give the correct number of
degrees of freedom.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the calculation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for
the :math:`xy` component, and so on. The six components of the vector are
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
@ -88,17 +92,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -97,21 +97,27 @@ center-of-mass velocity across the group in directions where streaming velocity
is *not* subtracted. This can be altered using the *extra* option of the
:doc:`compute_modify <compute_modify>` command.
If the *out* keyword is used with a *tensor* value, which is the default,
a kinetic energy tensor, stored as a six-element vector, is also calculated by
this compute for use in the computation of a pressure tensor. The formula for
the components of the tensor is the same as the above formula, except that
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`,
If the *out* keyword is used with a *tensor* value, which is the
default, then a symmetric tensor, stored as a six-element vector, is
also calculated by this compute for use in the computation of a
pressure tensor by the :doc:`compute pressue <compute_pressure>`
command. The formula for the components of the tensor is the same as
the above expression for :math:`E_\mathrm{kin}`, except that the 1/2
factor is NOT included and the :math:`v_i^2` is replaced by
:math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. Note
that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
If the *out* keyword is used with a *bin* value, the count of atoms and
computed temperature for each bin are stored for output, as an array of values,
as described below. The temperature of each bin is calculated as described
above, where the bias velocity is subtracted and only the remaining thermal
velocity of atoms in the bin contributes to the temperature. See the note
below for how the temperature is normalized by the degrees-of-freedom of atoms
in the bin.
If the *out* keyword is used with a *bin* value, the count of atoms
and computed temperature for each bin are stored for output, as an
array of values, as described below. The temperature of each bin is
calculated as described above, where the bias velocity is subtracted
and only the remaining thermal velocity of atoms in the bin
contributes to the temperature. See the note below for how the
temperature is normalized by the degrees-of-freedom of atoms in the
bin.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
@ -166,16 +172,17 @@ Output info
This compute calculates a global scalar (the temperature). Depending
on the setting of the *out* keyword, it also calculates a global
vector or array. For *out* = *tensor*, it calculates a vector of
length 6 (KE tensor), which can be accessed by indices 1--6. For *out*
= *bin* it calculates a global array which has 2 columns and :math:`N` rows,
where :math:`N` is the number of bins. The first column contains the number
of atoms in that bin. The second contains the temperature of that
bin, calculated as described above. The ordering of rows in the array
is as follows. Bins in :math:`x` vary fastest, then :math:`y`, then
:math:`z`. Thus for a :math:`10\times 10\times 10` 3d array of bins, there
will be 1000 rows. The bin with indices :math:`(i_x,i_y,i_z) = (2,3,4)` would
map to row :math:`M = 10^2(i_z-1) + 10(i_y-1) + i_x = 322`, where the rows are
numbered from 1 to 1000 and the bin indices are numbered from 1 to 10 in each
length 6 (symmetric tensor), which can be accessed by indices 1--6.
For *out* = *bin* it calculates a global array which has 2 columns and
:math:`N` rows, where :math:`N` is the number of bins. The first
column contains the number of atoms in that bin. The second contains
the temperature of that bin, calculated as described above. The
ordering of rows in the array is as follows. Bins in :math:`x` vary
fastest, then :math:`y`, then :math:`z`. Thus for a :math:`10\times
10\times 10` 3d array of bins, there will be 1000 rows. The bin with
indices :math:`(i_x,i_y,i_z) = (2,3,4)` would map to row :math:`M =
10^2(i_z-1) + 10(i_y-1) + i_x = 322`, where the rows are numbered from
1 to 1000 and the bin indices are numbered from 1 to 10 in each
dimension.
These values can be used by any command that uses global scalar or
@ -186,9 +193,9 @@ options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive". The array values are "intensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`. The first column
of array values are counts; the values in the second column will be in
The scalar value us in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`. The first column of array
values are counts; the values in the second column will be in
temperature :doc:`units <units>`.
Restrictions
@ -203,7 +210,10 @@ will be for most thermostats.
Related commands
""""""""""""""""
:doc:`compute temp <compute_temp>`, :doc:`compute temp/ramp <compute_temp_ramp>`, :doc:`compute temp/deform <compute_temp_deform>`, :doc:`compute pressure <compute_pressure>`
:doc:`compute temp <compute_temp>`,
:doc:`compute temp/ramp <compute_temp_ramp>`,
:doc:`compute temp/deform <compute_temp_deform>`,
:doc:`compute pressure <compute_pressure>`
Default
"""""""

View File

@ -63,12 +63,17 @@ command (e.g., :math:`\AA` for units = real or metal). A
velocity in lattice spacings per unit time). The :doc:`lattice <lattice>`
command must have been previously used to define the lattice spacing.
A kinetic energy tensor, stored as a six-element vector, is also calculated by
this compute for use in the computation of a pressure tensor. The formula for
the components of the tensor is the same as the above formula, except that
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be constant
for the duration of the run; use the *dynamic* option of the
@ -100,17 +105,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""
@ -119,7 +124,10 @@ Restrictions
Related commands
""""""""""""""""
:doc:`compute temp <compute_temp>`, :doc:`compute temp/profie <compute_temp_profile>`, :doc:`compute temp/deform <compute_temp_deform>`, :doc:`compute pressure <compute_pressure>`
:doc:`compute temp <compute_temp>`,
:doc:`compute temp/profile <compute_temp_profile>`,
:doc:`compute temp/deform <compute_temp_deform>`,
:doc:`compute pressure <compute_pressure>`
Default
"""""""

View File

@ -49,12 +49,17 @@ where KE = is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in both the group and region, :math:`k_B` is
the Boltzmann constant, and :math:`T` temperature.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y`
for the :math:`xy` component, and so on. The six components of the vector are
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is calculated each
time the temperature is evaluated since it is assumed atoms can
@ -78,12 +83,13 @@ will operate only on atoms that are currently in the geometric region.
Unlike other compute styles that calculate temperature, this compute
does not subtract out degrees-of-freedom due to fixes that constrain
motion, such as :doc:`fix shake <fix_shake>` and :doc:`fix rigid <fix_rigid>`. This is because those degrees of freedom
(e.g., a constrained bond) could apply to sets of atoms that straddle
the region boundary, and hence the concept is somewhat ill-defined.
If needed the number of subtracted degrees of freedom can be set
explicitly using the *extra* option of the
:doc:`compute_modify <compute_modify>` command.
motion, such as :doc:`fix shake <fix_shake>` and :doc:`fix rigid
<fix_rigid>`. This is because those degrees of freedom (e.g., a
constrained bond) could apply to sets of atoms that straddle the
region boundary, and hence the concept is somewhat ill-defined. If
needed the number of subtracted degrees of freedom can be set
explicitly using the *extra* option of the :doc:`compute_modify
<compute_modify>` command.
See the :doc:`Howto thermostat <Howto_thermostat>` page for a
discussion of different ways to compute temperature and perform
@ -93,17 +99,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`.
The vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -32,32 +32,33 @@ temperature (e.g., :doc:`thermo_modify <thermo_modify>`).
The operation of this compute is exactly like that described by the
:doc:`compute temp/region <compute_temp_region>` command, except that
the formula for the temperature itself includes the radial electron
velocity contributions, as discussed by the
:doc:`compute temp/eff <compute_temp_eff>` command.
the formulas for the temperature (scalar) and diagonal components of
the symmetric tensor (vector) include the radial electron velocity
contributions, as discussed by the :doc:`compute temp/eff
<compute_temp_eff>` command.
Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""
This compute is part of the EFF package. It is only enabled if
LAMMPS was built with that package.
See the :doc:`Build package <Build_package>` page for more info.
This compute is part of the EFF package. It is only enabled if LAMMPS
was built with that package. See the :doc:`Build package
<Build_package>` page for more info.
Related commands
""""""""""""""""

View File

@ -43,12 +43,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also calculated by
this compute for use in the computation of a pressure tensor. The formula for
the components of the tensor is the same as the above formula, except that
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
@ -80,17 +85,16 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1-6.
These values can be used by any command that uses global scalar or
vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
vector of length 6 (symmetric tensor), which can be accessed by
indices 1-6. These values can be used by any command that uses global
scalar or vector values from a compute as input. See the :doc:`Howto
output <Howto_output>` page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -77,6 +77,18 @@ tensor is the same as the above formulas, except that :math:`v^2` and
vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`,
:math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
:doc:`compute_modify <compute_modify>` command if this is not the case.
@ -117,17 +129,17 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
vector of length 6 (symmetric tensor), which can be accessed by
indices 1--6. These values can be used by any command that uses
global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The
vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The
vector values will be in energy :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The vector
values are in energy :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -86,12 +86,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute for use in the computation of a pressure
tensor. The formula for the components of the tensor is the same as
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for
the :math:`xy` component, and so on. The six components of the vector are
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the
@ -126,21 +131,21 @@ Output info
"""""""""""
This compute calculates a global scalar (the temperature) and a global
vector of length 7, which can be accessed by indices 1--7.
The first six elements of the vector are the KE tensor,
and the seventh is the cosine-shaped velocity amplitude :math:`V`,
which can be used to calculate the reciprocal viscosity, as shown in the example.
These values can be used by any command that uses global scalar or
vector values from a compute as input.
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS output options.
vector of length 7, which can be accessed by indices 1--7. The first
six elements of the vector are those of the symmetric tensor discussed
above. The seventh is the cosine-shaped velocity amplitude :math:`V`,
which can be used to calculate the reciprocal viscosity, as shown in
the example. These values can be used by any command that uses global
scalar or vector values from a compute as input. See the :doc:`Howto
output <Howto_output>` page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The
first six elements of vector values are "extensive",
and the seventh element of vector values is "intensive".
The scalar value will be in temperature :doc:`units <units>`.
The first six elements of vector values will be in energy :doc:`units <units>`.
The seventh element of vector value will be in velocity :doc:`units <units>`.
The scalar value is in temperature :doc:`units <units>`. The first
six elements of vector values are in energy :doc:`units <units>`. The
seventh element of vector value us in velocity :doc:`units <units>`.
Restrictions
""""""""""""

View File

@ -785,3 +785,7 @@ reset_mol_ids = yes, custom_charges = no, molecule = off, modify_create = *fit a
.. _Gissinger2020:
**(Gissinger2020)** Gissinger, Jensen and Wise, Macromolecules, 53, 22, 9953-9961 (2020).
.. _Gissinger2024:
**(Gissinger2024)** Gissinger, Jensen and Wise, Computer Physics Communications, 304, 109287 (2024).

View File

@ -4130,6 +4130,7 @@ Xiaowang
Xie
xk
xlat
xlattice
xlo
xmax
Xmax
@ -4181,6 +4182,7 @@ yflag
yhi
yi
ylat
ylattice
ylo
ylz
ymax
@ -4229,6 +4231,7 @@ Ziegenhain
zincblende
zj
Zj
zlattice
zlim
zlo
Zm

View File

@ -41,7 +41,6 @@
#include <stdlib.h>
liblammpsplugin_t *liblammpsplugin_load(const char *lib)
{
liblammpsplugin_t *lmp;
@ -191,6 +190,9 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
ADDSYM(is_running);
ADDSYM(force_timeout);
// symbol not present
if (!lmp->config_has_exceptions) return NULL;
lmp->has_exceptions = lmp->config_has_exceptions();
if (lmp->has_exceptions) {
ADDSYM(has_error);

View File

@ -39,7 +39,7 @@ InstallDir "$LOCALAPPDATA\${PACEPLUGIN}"
ShowInstDetails show
ShowUninstDetails show
SetCompressor lzma
SetCompressor zlib
!define MUI_ABORTWARNING

View File

@ -0,0 +1,59 @@
# -*- CMake -*- build system for plugin examples.
# The is meant to be used as a template for plugins that are
# distributed independent from the LAMMPS package.
##########################################
cmake_minimum_required(VERSION 3.16)
project(plumedplugin VERSION 1.0 LANGUAGES CXX)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(CheckIncludeFileCXX)
include(LAMMPSInterfacePlugin)
include(PLUMED)
##########################
# building the plugins
add_library(plumedplugin MODULE plumedplugin.cpp ${LAMMPS_SOURCE_DIR}/PLUMED/fix_plumed.cpp)
target_link_libraries(plumedplugin PRIVATE LAMMPS::PLUMED)
target_link_libraries(plumedplugin PRIVATE lammps)
target_include_directories(plumedplugin PRIVATE ${LAMMPS_SOURCE_DIR}/PLUMED)
set_target_properties(plumedplugin PROPERTIES PREFIX "" SUFFIX ".so")
# MacOS seems to need this
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(plumedplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers
set_target_properties(plumedplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(CMAKE_CROSSCOMPILING)
set_target_properties(plumedplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION)
find_program(MAKENSIS_PATH makensis)
if(MAKENSIS_PATH)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/lammps.ico
${CMAKE_SOURCE_DIR}/lammps-text-logo-wide.bmp ${CMAKE_SOURCE_DIR}/plumedplugin.nsis
${CMAKE_BINARY_DIR})
if(BUILD_MPI)
if(USE_MSMPI)
add_custom_target(package ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MSMPI plumedplugin.nsis
DEPENDS plumedplugin plumed_copy lammps.ico lammps-text-logo-wide.bmp plumedplugin.nsis
BYPRODUCTS LAMMPS-PLUMED-plugin-${LAMMPS_VERSION}-MSMPI.exe)
else()
add_custom_target(package ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI plumedplugin.nsis
DEPENDS plumedplugin plumed_copy lammps.ico lammps-text-logo-wide.bmp plumedplugin.nsis
BYPRODUCTS LAMMPS-PLUMED-plugin-${LAMMPS_VERSION}-MPI.exe)
endif()
else()
add_custom_target(package ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION} plumedplugin.nsis
COMMAND ${CMAKE_COMMAND} -E echo ${PWD}
DEPENDS plumedplugin plumed_copy lammps.ico lammps-text-logo-wide.bmp plumedplugin.nsis
BYPRODUCTS LAMMPS-PLUMED-plugin-${LAMMPS_VERSION}.exe)
endif()
endif()
else()
set_target_properties(plumedplugin PROPERTIES LINK_FLAGS "-rdynamic")
endif()

View File

@ -0,0 +1 @@
../../../../cmake/Modules/LAMMPSInterfacePlugin.cmake

View File

@ -0,0 +1 @@
../../../../cmake/Modules/Packages/PLUMED.cmake

View File

@ -0,0 +1,2 @@
This folder contains a loader and support files to build the PLUMED package as plugin.
For more information please see: https://docs.lammps.org/Developer_plugins.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -0,0 +1,28 @@
#include "lammpsplugin.h"
#include "version.h"
#include "fix_plumed.h"
using namespace LAMMPS_NS;
static Fix *fix_plumed_creator(LAMMPS *lmp, int argc, char **argv)
{
return new FixPlumed(lmp, argc, argv);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_t plugin;
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
// register plumed fix style
plugin.version = LAMMPS_VERSION;
plugin.style = "fix";
plugin.name = "plumed";
plugin.info = "Plumed2 plugin fix style v1.0";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v1 = (lammpsplugin_factory1 *) &fix_plumed_creator;
plugin.handle = handle;
(*register_plugin)(&plugin, lmp);
}

View File

@ -0,0 +1,172 @@
#!Nsis Installer Command Script
#
# The following external defines are recognized:
# ${VERSION} = YYYYMMDD
!include "MUI2.nsh"
!include "FileFunc.nsh"
!define MUI_ICON "lammps.ico"
!define MUI_UNICON "lammps.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "lammps-text-logo-wide.bmp"
!define MUI_HEADERIMAGE_RIGHT
Unicode true
XPStyle on
!include "LogicLib.nsh"
!addplugindir "envvar/Plugins/x86-unicode"
!include "x64.nsh"
RequestExecutionLevel user
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin"
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
!define PLUMEDPLUGIN "LAMMPS PLUMED Plugin ${VERSION}"
OutFile "LAMMPS-PLUMED-plugin-${VERSION}.exe"
Name "${PLUMEDPLUGIN}"
InstallDir "$LOCALAPPDATA\${PLUMEDPLUGIN}"
ShowInstDetails show
ShowUninstDetails show
SetCompressor zlib
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
function .onInit
# Determine if LAMMPS was already installed and check whether it was in 32-bit
# or 64-bit. Then look up path to uninstaller and offer to uninstall or quit
SetRegView 32
ReadRegDWORD $0 HKCU "Software\LAMMPS-PLUMED" "Bits"
SetRegView LastUsed
${If} $0 == "32"
SetRegView 32
${ElseIf} $0 == "64"
SetRegView 64
${Else}
SetRegView 64
${EndIf}
ClearErrors
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" "UninstallString"
SetRegView LastUsed
${If} ${Errors}
DetailPrint "LAMMPS PLUMED plugin not (yet) installed"
${Else}
MessageBox MB_YESNO "LAMMPS PLUMED plugin ($0 bit) is already installed. Uninstall existing version?" /SD IDYES IDNO Quit
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Quit:
Quit
${EndIf}
setShellVarContext all
functionEnd
Section "${PLUMEDPLUGIN}" SecPlumedplugin
SectionIn RO
# Write LAMMPS installation bitness marker. Always use 32-bit registry view
SetRegView 32
IntFmt $0 "0x%08X" 64
WriteRegDWORD HKCU "Software\LAMMPS-PLUMED" "Bits" $0
# Switch to "native" registry view
SetRegView 64
SetShellVarContext current
SetOutPath "$INSTDIR"
CreateDirectory "$INSTDIR\patches"
CreateDirectory "$INSTDIR\bin"
File lammps.ico
File plumedplugin.so
SetOutPath "$INSTDIR\bin"
File plumed.exe
# Register Application and its uninstaller
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"DisplayName" "${PLUMEDPLUGIN}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"Publisher" "The LAMMPS and PLUMED Developers"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"URLInfoAbout" "lammps.org"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"DisplayIcon" "$INSTDIR\lammps.ico"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"DisplayVersion" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED" \
"EstimatedSize" "$0"
# update path variables
EnVar::SetHKCU
# add plumed executable path
EnVar::AddValue "PATH" "$INSTDIR\bin"
# add to LAMMPS plugin search path
EnVar::AddValue "LAMMPS_PLUGIN_PATH" "$INSTDIR"
# add plumed2 patch files
EnVar::AddValue "PLUMED_ROOT" "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
function un.onInit
SetShellVarContext current
functionEnd
Section "Uninstall"
# remove LAMMPS bitness/installation indicator always in 32-bit registry view
SetRegView 32
DeleteRegKey HKCU "Software\LAMMPS-PLUMED"
# unregister extension, and uninstall info
SetRegView 64
SetShellVarContext current
# unregister installation
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-PLUMED"
# update path variables
EnVar::SetHKCU
# remove plumed executable path
EnVar::DeleteValue "PATH" "$INSTDIR\bin"
# remove entry from LAMMPS plugin search path
EnVar::DeleteValue "LAMMPS_PLUGIN_PATH" "$INSTDIR"
# remove plumed patch environment
EnVar::Delete "PLUMED_ROOT"
RMDir /r /REBOOTOK "$INSTDIR\patches"
RMDir /r /REBOOTOK "$INSTDIR\bin"
Delete /REBOOTOK "$INSTDIR\plumedplugin.so"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
Delete /REBOOTOK "$INSTDIR\lammps.ico"
RMDir /REBOOTOK "$INSTDIR"
SectionEnd
# Local Variables:
# mode: sh
# End:

View File

@ -44,6 +44,7 @@ thermo 50
fix myrxns all bond/react stabilization yes statted_grp .03 &
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map rescale_charges yes
fix 1 statted_grp_REACT nvt temp 300 300 100

View File

@ -47,7 +47,7 @@ thermo 50
fix myrxns all bond/react stabilization yes statted_grp .03 &
react rxn1 all 1 0.0 5.0 mol1 mol2 rxn1_stp1_map prob v_prob1 1234 &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map prob v_prob2 1234
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map prob v_prob2 1234 rescale_charges yes
fix 1 statted_grp_REACT nvt temp 300 300 100

View File

@ -44,7 +44,7 @@ thermo 50
fix myrxns all bond/react stabilization no &
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map rescale_charges yes
fix 1 all nve/limit .03

View File

@ -48,27 +48,6 @@ Types
17 hc
18 hc
Charges
1 -0.300000
2 0.000000
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.300000
11 0.000000
12 0.000000
13 0.000000
14 0.000000
15 0.000000
16 0.000000
17 0.000000
18 0.000000
Molecules
1 1

View File

@ -44,21 +44,21 @@ Types
Charges
1 -0.300000
2 0.000000
3 0.000000
4 0.410000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.300000
11 0.000000
12 -0.820000
13 0.000000
14 0.000000
15 0.410000
1 -0.60533
2 -0.01149
3 -0.76306
4 0.38
5 0.29346
6 0.18360
7 0.15396
8 -0.72636
9 -0.27437
10 0.40603
11 -0.65530
12 -0.76
13 0.21423
14 0.18949
15 0.38
Molecules

File diff suppressed because it is too large Load Diff

View File

@ -18,17 +18,17 @@
#include "angle_class2.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "neighbor.h"
#include "domain.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;

View File

@ -43,7 +43,6 @@ FFT3dKokkos<DeviceType>::FFT3dKokkos(LAMMPS *lmp, MPI_Comm comm, int nfast, int
#if defined(LMP_KOKKOS_GPU)
int ngpus = lmp->kokkos->ngpus;
ExecutionSpace execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
#endif
#if defined(FFT_KOKKOS_MKL)
if (ngpus > 0 && execution_space == Device)
@ -69,6 +68,8 @@ FFT3dKokkos<DeviceType>::FFT3dKokkos(LAMMPS *lmp, MPI_Comm comm, int nfast, int
if (stack_size < 2048)
cudaDeviceSetLimit(cudaLimitStackSize,2048);
#endif
#endif
#endif
plan = fft_3d_create_plan_kokkos(comm,nfast,nmid,nslow,

View File

@ -1655,7 +1655,7 @@ double PairUF3Kokkos<DeviceType>::single(int /*i*/, int /*j*/, int itype, int jt
namespace LAMMPS_NS {
template class PairUF3Kokkos<LMPDeviceType>;
#ifdef KOKKOS_ENABLE_GPU
#ifdef LMP_KOKKOS_GPU
template class PairUF3Kokkos<LMPHostType>;
#endif
} // namespace LAMMPS_NS

View File

@ -58,7 +58,7 @@ using namespace MathConst;
static const char cite_fix_bond_react[] =
"fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, "
"doi:10.1021/acs.macromol.0c02012\n\n"
"doi:10.1021/acs.macromol.0c02012, doi:10.1016/j.cpc.2024.109287\n\n"
"@Article{Gissinger17,\n"
" author = {J. R. Gissinger and B. D. Jensen and K. E. Wise},\n"
" title = {Modeling Chemical Reactions in Classical Molecular Dynamics Simulations},\n"
@ -75,6 +75,14 @@ static const char cite_fix_bond_react[] =
" volume = 53,\n"
" number = 22,\n"
" pages = {9953--9961}\n"
"}\n\n"
"@Article{Gissinger24,\n"
" author = {J. R. Gissinger, B. D. Jensen, K. E. Wise},\n"
" title = {Molecular Modeling of Reactive Systems with REACTER},\n"
" journal = {Computer Physics Communications},\n"
" year = 2024,\n"
" volume = 304,\n"
" number = 109287\n"
"}\n\n";
static constexpr double BIG = 1.0e20;
@ -225,8 +233,8 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
memory->create(reacted_mol,nreacts,"bond/react:reacted_mol");
memory->create(fraction,nreacts,"bond/react:fraction");
memory->create(max_rxn,nreacts,"bond/react:max_rxn");
memory->create(nlocalskips,nreacts,"bond/react:nlocalskips");
memory->create(nghostlyskips,nreacts,"bond/react:nghostlyskips");
memory->create(nlocalkeep,nreacts,"bond/react:nlocalkeep");
memory->create(nghostlykeep,nreacts,"bond/react:nghostlykeep");
memory->create(seed,nreacts,"bond/react:seed");
memory->create(limit_duration,nreacts,"bond/react:limit_duration");
memory->create(rate_limit,3,nreacts,"bond/react:rate_limit");
@ -486,10 +494,6 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
get_molxspecials();
read_map_file(i);
fclose(fp);
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
iatomtype[i] = onemol->type[ibonding[i]-1];
jatomtype[i] = onemol->type[jbonding[i]-1];
find_landlocked_atoms(i);
@ -644,8 +648,8 @@ FixBondReact::~FixBondReact()
memory->destroy(fraction);
memory->destroy(seed);
memory->destroy(max_rxn);
memory->destroy(nlocalskips);
memory->destroy(nghostlyskips);
memory->destroy(nlocalkeep);
memory->destroy(nghostlykeep);
memory->destroy(limit_duration);
memory->destroy(var_flag);
memory->destroy(var_id);
@ -716,6 +720,7 @@ int FixBondReact::setmask()
int mask = 0;
mask |= POST_INTEGRATE;
mask |= POST_INTEGRATE_RESPA;
mask |= POST_FORCE;
return mask;
}
@ -872,8 +877,8 @@ void FixBondReact::post_integrate()
reaction_count[i] = 0;
local_rxn_count[i] = 0;
ghostly_rxn_count[i] = 0;
nlocalskips[i] = 0;
nghostlyskips[i] = 0;
nlocalkeep[i] = INT_MAX;
nghostlykeep[i] = INT_MAX;
// update reaction probability
if (var_flag[PROB][i])
fraction[i] = input->variable->compute_equal(var_id[PROB][i]);
@ -1424,10 +1429,13 @@ void FixBondReact::superimpose_algorithm()
MPI_Allreduce(&local_rxn_count[0],&reaction_count[0],nreacts,MPI_INT,MPI_SUM,world);
int rxnflag = 0;
int *delta_rxn;
memory->create(delta_rxn,nreacts,"bond/react:delta_rxn");
if (comm->me == 0)
for (int i = 0; i < nreacts; i++) {
reaction_count_total[i] += reaction_count[i] + ghostly_rxn_count[i];
rxnflag += reaction_count[i] + ghostly_rxn_count[i];
delta_rxn[i] = reaction_count[i] + ghostly_rxn_count[i];
reaction_count_total[i] += delta_rxn[i];
rxnflag += delta_rxn[i];
}
MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world);
@ -1460,42 +1468,43 @@ void FixBondReact::superimpose_algorithm()
if (overstep > 0) {
// let's randomly choose rxns to skip, unbiasedly from local and ghostly
int *local_rxncounts;
int *all_localskips;
int *all_localkeep;
memory->create(local_rxncounts,nprocs,"bond/react:local_rxncounts");
memory->create(all_localskips,nprocs,"bond/react:all_localskips");
memory->create(all_localkeep,nprocs,"bond/react:all_localkeep");
MPI_Gather(&local_rxn_count[i],1,MPI_INT,local_rxncounts,1,MPI_INT,0,world);
if (comm->me == 0) {
int delta_rxn = reaction_count[i] + ghostly_rxn_count[i];
// when using variable input for rate_limit, rate_limit_overstep could be > delta_rxn (below)
// we need to limit overstep to the number of reactions on this timestep
// essentially skipping all reactions, would be more efficient to use a skip_all flag
if (overstep > delta_rxn) overstep = delta_rxn;
if (overstep > delta_rxn[i]) overstep = delta_rxn[i];
int nkeep = delta_rxn[i] - overstep;
int *rxn_by_proc;
memory->create(rxn_by_proc,delta_rxn,"bond/react:rxn_by_proc");
for (int j = 0; j < delta_rxn; j++)
memory->create(rxn_by_proc,delta_rxn[i],"bond/react:rxn_by_proc");
for (int j = 0; j < delta_rxn[i]; j++)
rxn_by_proc[j] = -1; // corresponds to ghostly
int itemp = 0;
for (int j = 0; j < nprocs; j++)
for (int k = 0; k < local_rxncounts[j]; k++)
rxn_by_proc[itemp++] = j;
std::shuffle(&rxn_by_proc[0],&rxn_by_proc[delta_rxn], park_rng);
std::shuffle(&rxn_by_proc[0],&rxn_by_proc[delta_rxn[i]], park_rng);
for (int j = 0; j < nprocs; j++)
all_localskips[j] = 0;
nghostlyskips[i] = 0;
for (int j = 0; j < overstep; j++) {
if (rxn_by_proc[j] == -1) nghostlyskips[i]++;
else all_localskips[rxn_by_proc[j]]++;
all_localkeep[j] = 0;
nghostlykeep[i] = 0;
for (int j = 0; j < nkeep; j++) {
if (rxn_by_proc[j] == -1) nghostlykeep[i]++;
else all_localkeep[rxn_by_proc[j]]++;
}
memory->destroy(rxn_by_proc);
reaction_count_total[i] -= overstep;
}
MPI_Scatter(&all_localskips[0],1,MPI_INT,&nlocalskips[i],1,MPI_INT,0,world);
MPI_Bcast(&nghostlyskips[i],1,MPI_INT,0,world);
MPI_Scatter(&all_localkeep[0],1,MPI_INT,&nlocalkeep[i],1,MPI_INT,0,world);
MPI_Bcast(&nghostlykeep[i],1,MPI_INT,0,world);
memory->destroy(local_rxncounts);
memory->destroy(all_localskips);
memory->destroy(all_localkeep);
}
}
MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world);
memory->destroy(delta_rxn);
// this updates topology next step
next_reneighbor = update->ntimestep;
@ -2965,6 +2974,8 @@ void FixBondReact::update_everything()
int *type = atom->type;
int **nspecial = atom->nspecial;
tagint **special = atom->special;
tagint *tag = atom->tag;
AtomVec *avec = atom->avec;
int **bond_type = atom->bond_type;
tagint **bond_atom = atom->bond_atom;
@ -2977,13 +2988,16 @@ void FixBondReact::update_everything()
memory->create(mark,nmark,"bond/react:mark");
for (int i = 0; i < nmark; i++) mark[i] = 0;
// used when creating atoms
addatomtag = 0;
for (int i = 0; i < nlocal; i++) addatomtag = MAX(addatomtag,tag[i]);
MPI_Allreduce(MPI_IN_PLACE,&addatomtag,1,MPI_LMP_TAGINT,MPI_MAX,world);
addatoms.clear();
// flag used to delete special interactions
int *delflag;
memory->create(delflag,atom->maxspecial,"bond/react:delflag");
tagint *tag = atom->tag;
AtomVec *avec = atom->avec;
// used when creating atoms
int inserted_atoms_flag = 0;
@ -3026,13 +3040,14 @@ void FixBondReact::update_everything()
for (int pass = 0; pass < 2; pass++) {
update_num_mega = 0;
int *iskip = new int[nreacts];
for (int i = 0; i < nreacts; i++) iskip[i] = 0;
int *noccur = new int[nreacts];
for (int i = 0; i < nreacts; i++) noccur[i] = 0;
if (pass == 0) {
for (int i = 0; i < local_num_mega; i++) {
rxnID = (int) local_mega_glove[0][i];
// reactions already shuffled from dedup procedure, so can skip first N
if (iskip[rxnID]++ < nlocalskips[rxnID]) continue;
// wait, this check needs to be after add atoms, because they can also be 'skipped' due to overlap
if (noccur[rxnID] >= nlocalkeep[rxnID]) continue;
// this will be overwritten if reaction skipped by create_atoms below
update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i];
@ -3043,13 +3058,14 @@ void FixBondReact::update_everything()
if (create_atoms_flag[rxnID] == 1) {
onemol = atom->molecules[unreacted_mol[rxnID]];
twomol = atom->molecules[reacted_mol[rxnID]];
if (insert_atoms(update_mega_glove,update_num_mega)) {
if (insert_atoms_setup(update_mega_glove,update_num_mega)) {
inserted_atoms_flag = 1;
} else { // create aborted
reaction_count_total[rxnID]--;
continue;
}
}
noccur[rxnID]++;
if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i];
update_num_mega++;
@ -3058,7 +3074,7 @@ void FixBondReact::update_everything()
for (int i = 0; i < global_megasize; i++) {
rxnID = (int) global_mega_glove[0][i];
// reactions already shuffled from dedup procedure, so can skip first N
if (iskip[rxnID]++ < nghostlyskips[rxnID]) continue;
if (noccur[rxnID] >= nghostlykeep[rxnID]) continue;
// this will be overwritten if reaction skipped by create_atoms below
update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i];
@ -3071,30 +3087,49 @@ void FixBondReact::update_everything()
if (create_atoms_flag[rxnID] == 1) {
onemol = atom->molecules[unreacted_mol[rxnID]];
twomol = atom->molecules[reacted_mol[rxnID]];
if (insert_atoms(update_mega_glove,update_num_mega)) {
if (insert_atoms_setup(update_mega_glove,update_num_mega)) {
inserted_atoms_flag = 1;
} else { // create aborted
reaction_count_total[rxnID]--;
continue;
}
}
noccur[rxnID]++;
if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i];
update_num_mega++;
}
}
delete [] iskip;
delete [] noccur;
if (update_num_mega == 0) continue;
// if inserted atoms and global map exists, reset map now instead
// of waiting for comm since other pre-exchange fixes may use it
// invoke map_init() b/c atom count has grown
// do this once after all atom insertions
if (inserted_atoms_flag == 1 && atom->map_style != Atom::MAP_NONE) {
// insert all atoms for all rxns here
if (inserted_atoms_flag == 1) {
// clear to-be-overwritten ghost info
atom->nghost = 0;
atom->avec->clear_bonus();
for (auto & myaddatom : addatoms) {
atom->avec->create_atom(myaddatom.type,myaddatom.x);
int n = atom->nlocal - 1;
atom->tag[n] = myaddatom.tag;
atom->molecule[n] = myaddatom.molecule;
atom->mask[n] = myaddatom.mask;
atom->image[n] = myaddatom.image;
atom->v[n][0] = myaddatom.v[0];
atom->v[n][1] = myaddatom.v[1];
atom->v[n][2] = myaddatom.v[2];
if (atom->rmass) atom->rmass[n]= myaddatom.rmass;
modify->create_attribute(n);
}
// reset atom->map
if (atom->map_style != Atom::MAP_NONE) {
atom->map_init();
atom->map_set();
}
}
// mark to-delete atoms
nlocal = atom->nlocal;
@ -3620,10 +3655,6 @@ void FixBondReact::update_everything()
atom->natoms -= ndel;
// done deleting atoms
// reset mol ids
if (reset_mol_ids_flag) reset_mol_ids->reset();
// something to think about: this could done much more concisely if
// all atom-level info (bond,angles, etc...) were kinda inherited from a common data struct --JG
@ -3651,17 +3682,17 @@ void FixBondReact::update_everything()
}
/* ----------------------------------------------------------------------
insert created atoms
setup for inserting created atoms
atoms for all rxns are actually created all at once in update_everything
------------------------------------------------------------------------- */
int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
int FixBondReact::insert_atoms_setup(tagint **my_update_mega_glove, int iupdate)
{
// inserting atoms based off fix_deposit->pre_exchange
int flag;
imageint *imageflags;
double **coords,lamda[3],rotmat[3][3];
double *newcoord;
double **v = atom->v;
double t,delx,dely,delz,rsq;
memory->create(coords,twomol->natoms,3,"bond/react:coords");
@ -3677,19 +3708,13 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
}
// find current max atom and molecule IDs
tagint *tag = atom->tag;
double **x = atom->x;
tagint *molecule = atom->molecule;
int nlocal = atom->nlocal;
tagint maxtag_all,maxmol_all;
tagint max = 0;
for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]);
MPI_Allreduce(&max,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
max = 0;
for (int i = 0; i < nlocal; i++) max = MAX(max,molecule[i]);
MPI_Allreduce(&max,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
tagint maxmol_all = 0;;
for (int i = 0; i < nlocal; i++) maxmol_all = MAX(maxmol_all,molecule[i]);
MPI_Allreduce(MPI_IN_PLACE,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
int dimension = domain->dimension;
@ -3786,6 +3811,26 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
if (abortflag) break;
}
}
// also check against previous to-be-added atoms
if (!abortflag) {
for (auto & myaddatom : addatoms) {
for (int m = 0; m < twomol->natoms; m++) {
if (create_atoms[m][rxnID] == 1) {
delx = coords[m][0] - myaddatom.x[0];
dely = coords[m][1] - myaddatom.x[1];
delz = coords[m][2] - myaddatom.x[2];
domain->minimum_image(delx,dely,delz);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq < overlapsq[rxnID]) {
abortflag = 1;
break;
}
}
}
if (abortflag) break;
}
}
MPI_Allreduce(MPI_IN_PLACE,&abortflag,1,MPI_INT,MPI_MAX,world);
if (abortflag) {
memory->destroy(coords);
@ -3794,12 +3839,6 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
}
}
// clear ghost count and any ghost bonus data internal to AtomVec
// same logic as beginning of Comm::exchange()
// do it now b/c inserting atoms will overwrite ghost atoms
atom->nghost = 0;
atom->avec->clear_bonus();
// check if new atoms are in my sub-box or above it if I am highest proc
// if so, add atom to my list via create_atom()
// initialize additional info about the atoms
@ -3842,40 +3881,46 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
}
int root = 0;
addatomtag++;
if (flag) {
struct AddAtom myaddatom;
root = comm->me;
atom->avec->create_atom(twomol->type[m],coords[m]);
int n = atom->nlocal - 1;
atom->tag[n] = maxtag_all + add_count;
myaddatom.type = twomol->type[m];
myaddatom.x[0] = coords[m][0];
myaddatom.x[1] = coords[m][1];
myaddatom.x[2] = coords[m][2];
myaddatom.tag = addatomtag;
// locally update mega_glove
my_update_mega_glove[preID][iupdate] = atom->tag[n];
my_update_mega_glove[preID][iupdate] = myaddatom.tag;
// !! could do better job choosing mol ID for added atoms
if (atom->molecule_flag) {
if (twomol->moleculeflag) {
atom->molecule[n] = maxmol_all + twomol->molecule[m];
myaddatom.molecule = maxmol_all + twomol->molecule[m];
} else {
atom->molecule[n] = maxmol_all + 1;
myaddatom.molecule = maxmol_all + 1;
}
}
atom->mask[n] = 1 | groupbit;
atom->image[n] = imageflags[m];
myaddatom.mask = 1 | groupbit;
myaddatom.image = imageflags[m];
// guess a somewhat reasonable initial velocity based on reaction site
// further control is possible using bond_react_MASTER_group
// compute |velocity| corresponding to a given temperature t, using specific atom's mass
double mymass = atom->rmass ? atom->rmass[n] : atom->mass[twomol->type[m]];
double vtnorm = sqrt(t / (force->mvv2e / (dimension * force->boltz)) / mymass);
v[n][0] = random[rxnID]->uniform();
v[n][1] = random[rxnID]->uniform();
v[n][2] = random[rxnID]->uniform();
double vnorm = sqrt(v[n][0]*v[n][0] + v[n][1]*v[n][1] + v[n][2]*v[n][2]);
v[n][0] = v[n][0]/vnorm*vtnorm;
v[n][1] = v[n][1]/vnorm*vtnorm;
v[n][2] = v[n][2]/vnorm*vtnorm;
modify->create_attribute(n);
myaddatom.rmass = atom->rmass ? twomol->rmass[m] : atom->mass[twomol->type[m]];
double vtnorm = sqrt(t / (force->mvv2e / (dimension * force->boltz)) / myaddatom.rmass);
double myv[3];
myv[0] = random[rxnID]->uniform();
myv[1] = random[rxnID]->uniform();
myv[2] = random[rxnID]->uniform();
double vnorm = sqrt(myv[0]*myv[0] + myv[1]*myv[1] + myv[2]*myv[2]);
myaddatom.v[0] = myv[0]/vnorm*vtnorm;
myaddatom.v[1] = myv[1]/vnorm*vtnorm;
myaddatom.v[2] = myv[2]/vnorm*vtnorm;
addatoms.push_back(myaddatom);
}
// globally update mega_glove and equivalences
MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world);
@ -3888,12 +3933,11 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
}
// reset global natoms here
// reset atom map elsewhere, after all calls to 'insert_atoms'
// reset atom map elsewhere, after all calls to 'insert_atoms_setup'
atom->natoms += add_count;
if (atom->natoms < 0)
error->all(FLERR,"Too many total atoms");
maxtag_all += add_count;
if (maxtag_all >= MAXTAGINT)
if (addatomtag >= MAXTAGINT)
error->all(FLERR,"New atom IDs exceed maximum allowed ID");
// atom creation successful
memory->destroy(coords);
@ -3970,6 +4014,11 @@ void FixBondReact::read_map_file(int myrxn)
} else break;
}
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
// grab keyword and skip next line
parse_keyword(0,line,keyword);
@ -4012,6 +4061,13 @@ void FixBondReact::read_map_file(int myrxn)
}
// error check
for (int i = 0; i < onemol->natoms; i++) {
int my_equiv = reverse_equiv[i][1][myrxn];
if (create_atoms[my_equiv-1][myrxn] == 1)
error->all(FLERR,"Fix bond/react: Created atoms cannot also be listed in Equivalences section\n");
}
// error check
if (bondflag == 0 || equivflag == 0)
error->all(FLERR,"Fix bond/react: Map file missing InitiatorIDs or Equivalences section\n");
@ -4071,6 +4127,8 @@ void FixBondReact::CreateAtoms(char *line, int myrxn)
readline(line);
rv = sscanf(line,"%d",&tmp);
if (rv != 1) error->one(FLERR, "CreateIDs section is incorrectly formatted");
if (tmp > twomol->natoms)
error->one(FLERR,"Fix bond/react: Invalid atom ID in CreateIDs section of map file");
create_atoms[tmp-1][myrxn] = 1;
}
if (twomol->xflag == 0)
@ -4331,6 +4389,13 @@ void FixBondReact::post_integrate_respa(int ilevel, int /*iloop*/)
/* ---------------------------------------------------------------------- */
void FixBondReact::post_force(int /*vflag*/)
{
if (reset_mol_ids_flag) reset_mol_ids->reset();
}
/* ---------------------------------------------------------------------- */
int FixBondReact::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/)
{

View File

@ -46,6 +46,7 @@ class FixBondReact : public Fix {
void init_list(int, class NeighList *) override;
void post_integrate() override;
void post_integrate_respa(int, int) override;
void post_force(int) override;
int pack_forward_comm(int, int *, double *, int, int *) override;
void unpack_forward_comm(int, int, double *) override;
@ -62,7 +63,7 @@ class FixBondReact : public Fix {
int *iatomtype, *jatomtype;
int *seed;
double **cutsq, *fraction;
int *max_rxn, *nlocalskips, *nghostlyskips;
int *max_rxn, *nlocalkeep, *nghostlykeep;
tagint lastcheck;
int stabilization_flag;
int reset_mol_ids_flag;
@ -215,7 +216,7 @@ class FixBondReact : public Fix {
void glove_ghostcheck();
void ghost_glovecast();
void update_everything();
int insert_atoms(tagint **, int);
int insert_atoms_setup(tagint **, int);
void unlimit_bond(); // removes atoms from stabilization, and other post-reaction every-step operations
void dedup_mega_gloves(int); //dedup global mega_glove
void write_restart(FILE *) override;
@ -245,6 +246,15 @@ class FixBondReact : public Fix {
std::map<std::set<tagint>, int> atoms2bond; // maps atom pair to index of local bond array
std::vector<std::vector<Constraint>> constraints;
tagint addatomtag;
struct AddAtom {
tagint tag, molecule;
int type, mask;
imageint image;
double rmass, x[3], v[3];
};
std::vector<AddAtom> addatoms;
// DEBUG
void print_bb();

View File

@ -35,6 +35,7 @@
#include "group.h"
#include "info.h"
#include "input.h"
#include "lattice.h"
#include "lmppython.h"
#include "memory.h"
#include "modify.h"
@ -1414,6 +1415,9 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name)
if (strcmp(name,"xy") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"xz") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"yz") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"xlattice") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"ylattice") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"zlattice") == 0) return LAMMPS_DOUBLE;
if (strcmp(name,"procgrid") == 0) return LAMMPS_INT;
if (strcmp(name,"natoms") == 0) return LAMMPS_BIGINT;
@ -1510,9 +1514,9 @@ The function :cpp:func:`lammps_extract_global_datatype` will directly
report the "native" data type. The following tables are provided:
* :ref:`Timestep settings <extract_timestep_settings>`
* :ref:`Git revision and version settings <extract_git_settings>`
* :ref:`Simulation box settings <extract_box_settings>`
* :ref:`System property settings <extract_system_settings>`
* :ref:`Git revision and version settings <extract_git_settings>`
* :ref:`Unit settings <extract_unit_settings>`
.. _extract_timestep_settings:
@ -1552,35 +1556,6 @@ report the "native" data type. The following tables are provided:
- :math:`N_{respa}`
- length of the time steps with r-RESPA. See :doc:`run_style`.
.. _extract_git_settings:
**Git revision and version settings**
.. list-table::
:header-rows: 1
:widths: 16 14 10 60
* - 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.
.. _extract_box_settings:
**Simulation box settings**
@ -1649,6 +1624,18 @@ report the "native" data type. The following tables are provided:
- double
- 1
- triclinic tilt factor; see :doc:`Howto_triclinic`.
* - xlattice
- double
- 1
- lattice spacing in x-direction; see :doc:`lattice command <lattice>`.
* - ylattice
- double
- 1
- lattice spacing in y-direction; see :doc:`lattice command <lattice>`.
* - zlattice
- double
- 1
- lattice spacing in z-direction; see :doc:`lattice command <lattice>`.
* - procgrid
- int
- 3
@ -1763,6 +1750,35 @@ report the "native" data type. The following tables are provided:
- 1
- string with the current KSpace style.
.. _extract_git_settings:
**Git revision and version settings**
.. list-table::
:header-rows: 1
:widths: 16 14 10 60
* - 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.
.. _extract_unit_settings:
**Unit settings**
@ -1917,6 +1933,9 @@ void *lammps_extract_global(void *handle, const char *name)
if (strcmp(name,"xy") == 0) return (void *) &lmp->domain->xy;
if (strcmp(name,"xz") == 0) return (void *) &lmp->domain->xz;
if (strcmp(name,"yz") == 0) return (void *) &lmp->domain->yz;
if (strcmp(name,"xlattice") == 0) return (void *) &lmp->domain->lattice->xlattice;
if (strcmp(name,"ylattice") == 0) return (void *) &lmp->domain->lattice->ylattice;
if (strcmp(name,"zlattice") == 0) return (void *) &lmp->domain->lattice->zlattice;
if (((lmp->comm->layout == Comm::LAYOUT_UNIFORM) ||
(lmp->comm->layout == Comm::LAYOUT_NONUNIFORM)) && (strcmp(name,"procgrid") == 0))
return (void *) &lmp->comm->procgrid;

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(lammps-gui VERSION 1.6.9 LANGUAGES CXX)
project(lammps-gui VERSION 1.6.10 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
@ -130,6 +130,8 @@ set(PROJECT_SOURCES
chartviewer.h
codeeditor.cpp
codeeditor.h
findandreplace.cpp
findandreplace.h
helpers.cpp
highlighter.cpp
highlighter.h

View File

@ -2,12 +2,21 @@ LAMMPS-GUI TODO list:
# Short term goals (v1.x)
- implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences.
- add a "Filter data" checkbox to the "Charts" window to select whether data should be dropped.
- add a "Charts tab" to the preferences with the following (default) settings:
- default filter data yes/no
- default smooth parameters
- default plot colors
- enable "raw" or "smooth" or "both"
- add QLineEdit field to enter plot title
- add a "Colors" menu to the image viewer to adjust color settings for the
current image (unlike the defaults in the perferences) including assigning
colors to individual atom types.
- Support color by property (e.g. scan computes or fixes with per-atom data), define colormaps etc.
- Add a "Diameters" dialog where diamaters can by specified by atom type
- 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
- implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences.
- add a "Colors" menu to the image viewer to adjust color settings for the
current image (unlike the defaults in the perferences). Support color by
property (e.g. scan computes or fixes with per-atom data), define colormaps etc.
- implement indenting regions for (nested) loops?
- implement data file manager GUI with the following features:

View File

@ -424,7 +424,7 @@ void ChartViewer::add_data(int step, double data)
if (last_step < step) {
last_step = step;
// do not add data that deviates by more than 5 sigma from the average
// do not add data that deviates by more than 4 sigma from the average
// over the last 5 to 20 data items. this is a hack to work around
// getting corrupted data from lammps_get_last_thermo()
const auto &points = series->points();

View File

@ -218,7 +218,10 @@ CodeEditor::CodeEditor(QWidget *parent) :
help_index.close();
}
setBackgroundRole(QPalette::Light);
lineNumberArea = new LineNumberArea(this);
lineNumberArea->setBackgroundRole(QPalette::Dark);
lineNumberArea->setAutoFillBackground(true);
connect(this, &CodeEditor::blockCountChanged, this, &CodeEditor::updateLineNumberAreaWidth);
connect(this, &CodeEditor::updateRequest, this, &CodeEditor::updateLineNumberArea);
updateLineNumberAreaWidth(0);
@ -669,7 +672,7 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
if (block.isVisible() && bottom >= event->rect().top()) {
QString number = QString::number(blockNumber + 1) + " ";
if ((highlight == NO_HIGHLIGHT) || (blockNumber != std::abs(highlight))) {
painter.setPen(Qt::black);
painter.setPen(palette().color(QPalette::WindowText));
} else {
number = QString(">") + QString::number(blockNumber + 1) + "<";
if (highlight < 0)

View File

@ -0,0 +1,148 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "findandreplace.h"
#include "codeeditor.h"
#include "lammpsgui.h"
#include <QApplication>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QIcon>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QShortcut>
#include <QSizePolicy>
#include <QTextCursor>
/* ---------------------------------------------------------------------- */
FindAndReplace::FindAndReplace(CodeEditor *_editor, QWidget *parent) :
QDialog(parent), editor(_editor), search(nullptr), replace(nullptr), withcase(nullptr),
wrap(nullptr), whole(nullptr)
{
auto *layout = new QGridLayout;
search = new QLineEdit;
replace = new QLineEdit;
withcase = new QCheckBox("Match case");
wrap = new QCheckBox("Wrap around");
whole = new QCheckBox("Whole word");
auto *next = new QPushButton("&Next");
auto *replone = new QPushButton("&Replace");
auto *replall = new QPushButton("Replace &All");
auto *done = new QPushButton("&Done");
layout->addWidget(new QLabel("Find:"), 0, 0, Qt::AlignRight);
layout->addWidget(search, 0, 1, 1, 2, Qt::AlignLeft);
layout->addWidget(new QLabel("Replace with:"), 1, 0, Qt::AlignRight);
layout->addWidget(replace, 1, 1, 1, 2, Qt::AlignLeft);
layout->addWidget(withcase, 2, 0, Qt::AlignLeft);
layout->addWidget(wrap, 2, 1, Qt::AlignLeft);
layout->addWidget(whole, 2, 2, Qt::AlignLeft);
wrap->setChecked(true);
auto *buttons = new QHBoxLayout;
buttons->addWidget(next);
buttons->addWidget(replone);
buttons->addWidget(replall);
buttons->addWidget(done);
layout->addLayout(buttons, 3, 0, 1, 3, Qt::AlignHCenter);
connect(next, &QPushButton::released, this, &FindAndReplace::find_next);
connect(replone, &QPushButton::released, this, &FindAndReplace::replace_next);
connect(replall, &QPushButton::released, this, &FindAndReplace::replace_all);
connect(done, &QPushButton::released, this, &QDialog::accept);
auto action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(action, &QShortcut::activated, this, &FindAndReplace::quit);
setLayout(layout);
setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
setWindowTitle("LAMMPS-GUI - Find and Replace");
}
/* ---------------------------------------------------------------------- */
void FindAndReplace::find_next()
{
auto text = search->text();
int find_flags = 0;
if (withcase->isChecked()) find_flags |= QTextDocument::FindCaseSensitively;
if (whole->isChecked()) find_flags |= QTextDocument::FindWholeWords;
if (!text.isEmpty()) {
if (!editor->find(text, (QTextDocument::FindFlag)find_flags) && wrap->isChecked()) {
// nothing found from the current position to the end, reposition cursor and beginning
editor->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
editor->find(text, (QTextDocument::FindFlag)find_flags);
}
}
}
/* ---------------------------------------------------------------------- */
void FindAndReplace::replace_next()
{
auto text = search->text();
if (text.isEmpty()) return;
auto cursor = editor->textCursor();
auto flag = withcase->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
// if selected text at cursor location matches search text, replace
if (QString::compare(cursor.selectedText(), search->text(), flag) == 0)
cursor.insertText(replace->text());
find_next();
}
/* ---------------------------------------------------------------------- */
void FindAndReplace::replace_all()
{
auto text = search->text();
if (text.isEmpty()) return;
// drop selection if we have one
auto cursor = editor->textCursor();
if (cursor.hasSelection()) cursor.movePosition(QTextCursor::Left);
find_next();
cursor = editor->textCursor();
// keep replacing until find_next() does not find anything anymore
while (cursor.hasSelection()) {
cursor.insertText(replace->text());
find_next();
cursor = editor->textCursor();
}
}
/* ---------------------------------------------------------------------- */
void FindAndReplace::quit()
{
LammpsGui *main = nullptr;
for (QWidget *widget : QApplication::topLevelWidgets())
if (widget->objectName() == "LammpsGui") main = dynamic_cast<LammpsGui *>(widget);
if (main) main->quit();
}
// Local Variables:
// c-basic-offset: 4
// End:

View File

@ -0,0 +1,46 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
LAMMPS development team: developers@lammps.org
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifndef FIND_AND_REPLACE_H
#define FIND_AND_REPLACE_H
#include "codeeditor.h"
#include <QDialog>
class QLineEdit;
class QCheckBox;
class FindAndReplace : public QDialog {
Q_OBJECT
public:
explicit FindAndReplace(CodeEditor *_editor, QWidget *parent = nullptr);
~FindAndReplace() = default;
private slots:
void find_next();
void replace_next();
void replace_all();
void quit();
private:
CodeEditor *editor;
QLineEdit *search, *replace;
QCheckBox *withcase, *wrap, *whole;
};
#endif
// Local Variables:
// c-basic-offset: 4
// End:

View File

@ -13,9 +13,12 @@
#include "helpers.h"
#include <QBrush>
#include <QColor>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QPalette>
#include <QProcess>
#include <QStringList>
@ -84,6 +87,16 @@ void purge_directory(const QString &dir)
}
}
// compare black level of foreground and background color
bool is_light_theme()
{
QPalette p;
int fg = p.brush(QPalette::Active, QPalette::WindowText).color().black();
int bg = p.brush(QPalette::Active, QPalette::Window).color().black();
return (fg > bg);
}
// Local Variables:
// c-basic-offset: 4
// End:

View File

@ -28,6 +28,9 @@ extern bool has_exe(const QString &exe);
// recursively purge a directory
extern void purge_directory(const QString &dir);
// flag if light or dark theme
extern bool is_light_theme();
#endif
// Local Variables:
// c-basic-offset: 4

View File

@ -12,6 +12,28 @@
------------------------------------------------------------------------- */
#include "highlighter.h"
#include "helpers.h"
#include <QColor>
// workaround for Qt-5.12
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
namespace QColorConstants {
const QColor Red = QColor::fromRgb(0xff, 0x00, 0x00);
const QColor Green = QColor::fromRgb(0x00, 0xff, 0x00);
const QColor Blue = QColor::fromRgb(0x00, 0x00, 0xff);
const QColor Cyan = QColor::fromRgb(0x00, 0xff, 0xff);
const QColor Magenta = QColor::fromRgb(0xff, 0x00, 0xff);
const QColor Yellow = QColor::fromRgb(0xff, 0xff, 0x00);
namespace Svg {
const QColor dodgerblue = QColor::fromRgb(0x1e, 0x90, 0xff);
const QColor indianred = QColor::fromRgb(0xcd, 0x5c, 0x5c);
const QColor lightcoral = QColor::fromRgb(0xf0, 0x80, 0x80);
const QColor lightgray = QColor::fromRgb(0xd3, 0xd3, 0xd3);
const QColor lightgreen = QColor::fromRgb(0x90, 0xee, 0x90);
const QColor lightskyblue = QColor::fromRgb(0x87, 0xce, 0xfa);
} // namespace Svg
} // namespace QColorConstants
#endif
Highlighter::Highlighter(QTextDocument *parent) :
QSyntaxHighlighter(parent),
@ -54,6 +76,8 @@ Highlighter::Highlighter(QTextDocument *parent) :
isTriple(QStringLiteral("[^\"]*\"\"\"[^\"]*")),
isString(QStringLiteral("(\".+?\"|'.+?'|\"\"\".*\"\"\")")), in_triple(false)
{
if (is_light_theme()) {
// syntax colors for light themes
formatNumber.setForeground(Qt::blue);
formatString.setForeground(Qt::darkGreen);
formatString.setFontWeight(QFont::Normal);
@ -75,6 +99,31 @@ Highlighter::Highlighter(QTextDocument *parent) :
formatLattice.setFontWeight(QFont::Bold);
formatSetup.setForeground(Qt::darkCyan);
formatSetup.setFontWeight(QFont::Bold);
} else {
// syntax colors for dark themes
formatNumber.setForeground(QColorConstants::Svg::dodgerblue);
formatString.setForeground(QColorConstants::Green);
formatString.setFontWeight(QFont::Normal);
formatComment.setForeground(QColorConstants::Red);
formatComment.setFontWeight(QFont::Bold);
formatSpecial.setForeground(QColorConstants::Magenta);
formatSpecial.setFontWeight(QFont::Bold);
formatParticle.setForeground(QColorConstants::Svg::indianred);
formatParticle.setFontWeight(QFont::Bold);
formatRun.setForeground(QColorConstants::Svg::lightskyblue);
formatRun.setFontWeight(QFont::Bold);
formatVariable.setForeground(QColorConstants::Svg::lightgray);
formatVariable.setFontWeight(QFont::Bold);
formatOutput.setForeground(QColorConstants::Yellow);
formatOutput.setFontWeight(QFont::Bold);
formatRead.setForeground(QColorConstants::Svg::lightcoral);
formatRead.setFontWeight(QFont::Bold);
formatLattice.setForeground(QColorConstants::Svg::lightgreen);
formatLattice.setFontWeight(QFont::Bold);
formatSetup.setForeground(QColorConstants::Cyan);
formatSetup.setFontWeight(QFont::Bold);
}
}
void Highlighter::highlightBlock(const QString &text)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -20,6 +20,7 @@
#include <QApplication>
#include <QClipboard>
#include <QDir>
#include <QDoubleValidator>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
@ -31,6 +32,7 @@
#include <QImageReader>
#include <QKeySequence>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QMenuBar>
#include <QPalette>
@ -135,9 +137,10 @@ static const QString blank(" ");
ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidget *parent) :
QDialog(parent), menuBar(new QMenuBar), imageLabel(new QLabel), scrollArea(new QScrollArea),
saveAsAct(nullptr), copyAct(nullptr), cmdAct(nullptr), zoomInAct(nullptr), zoomOutAct(nullptr),
normalSizeAct(nullptr), lammps(_lammps), group("all"), filename(fileName), useelements(false),
usediameter(false), usesigma(false)
buttonBox(nullptr), scaleFactor(1.0), atomSize(1.0), saveAsAct(nullptr), copyAct(nullptr),
cmdAct(nullptr), zoomInAct(nullptr), zoomOutAct(nullptr), normalSizeAct(nullptr),
lammps(_lammps), group("all"), filename(fileName), useelements(false), usediameter(false),
usesigma(false)
{
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
@ -163,6 +166,13 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
renderstatus->setEnabled(false);
renderstatus->setToolTip("Render status");
renderstatus->setObjectName("renderstatus");
auto *asize = new QLineEdit(QString::number(atomSize));
auto *valid = new QDoubleValidator(1.0e-10, 1.0e10, 10, asize);
asize->setValidator(valid);
asize->setObjectName("atomSize");
asize->setToolTip("Set Atom size");
asize->setEnabled(false);
asize->hide();
settings.beginGroup("snapshot");
auto *xval = new QSpinBox;
xval->setRange(100, 10000);
@ -179,6 +189,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
yval->setToolTip("Set rendered image height");
yval->setMinimumSize(bsize);
settings.endGroup();
connect(asize, &QLineEdit::editingFinished, this, &ImageViewer::set_atom_size);
connect(xval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size);
connect(yval, &QAbstractSpinBox::editingFinished, this, &ImageViewer::edit_size);
@ -249,6 +260,11 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
menuLayout->addWidget(menuBar);
menuLayout->addWidget(renderstatus);
menuLayout->addWidget(new QLabel(" Atom Size: "));
menuLayout->addWidget(asize);
// hide item initially
menuLayout->itemAt(2)->widget()->setObjectName("AtomLabel");
menuLayout->itemAt(2)->widget()->hide();
menuLayout->addWidget(new QLabel(" Width: "));
menuLayout->addWidget(xval);
menuLayout->addWidget(new QLabel(" Height: "));
@ -307,7 +323,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
doanti->setChecked(antialias);
scaleFactor = 1.0;
resize(image.width() + 20, image.height() + 75);
resize(image.width() + 25, image.height() + 80);
scrollArea->setVisible(true);
updateActions();
@ -356,6 +372,13 @@ void ImageViewer::reset_view()
createImage();
}
void ImageViewer::set_atom_size()
{
auto *field = qobject_cast<QLineEdit *>(sender());
atomSize = field->text().toDouble();
createImage();
}
void ImageViewer::edit_size()
{
auto *field = qobject_cast<QSpinBox *>(sender());
@ -560,10 +583,43 @@ void ImageViewer::createImage()
if (useelements || usediameter || usesigma) {
auto *button = findChild<QPushButton *>("vdw");
if (button) button->setEnabled(true);
auto *edit = findChild<QLineEdit *>("atomSize");
if (edit) {
edit->setEnabled(false);
edit->hide();
}
auto *label = findChild<QLabel *>("AtomLabel");
if (label) {
label->setEnabled(false);
label->hide();
}
} else {
adiams.clear();
auto *button = findChild<QPushButton *>("vdw");
if (button) button->setEnabled(false);
auto *label = findChild<QLabel *>("AtomLabel");
if (label) {
label->setEnabled(true);
label->show();
}
auto *edit = findChild<QLineEdit *>("atomSize");
if (edit) {
if (!edit->isEnabled()) {
edit->setEnabled(true);
edit->show();
// initialize with lattice spacing
auto *xlattice = (const double *)lammps->extract_global("xlattice");
if (xlattice) atomSize = *xlattice;
edit->setText(QString::number(atomSize));
}
atomSize = edit->text().toDouble();
}
if (atomSize != 1.0) {
for (int i = 1; i <= ntypes; ++i)
adiams += QString("adiam %1 %2 ").arg(i).arg(atomSize);
}
}
// color
@ -607,6 +663,7 @@ void ImageViewer::createImage()
dumpcmd += " backcolor " + settings.value("background", "black").toString();
if (useelements) dumpcmd += blank + elements + blank + adiams + blank;
if (usesigma) dumpcmd += blank + adiams + blank;
if (!useelements && !usesigma && (atomSize != 1.0)) dumpcmd += blank + adiams + blank;
settings.endGroup();
last_dump_cmd = dumpcmd;
@ -617,10 +674,10 @@ void ImageViewer::createImage()
const QImage newImage = reader.read();
dumpfile.remove();
// read of new image failed. Don't try to scale and load it.
// read of new image failed. nothing left to do.
if (newImage.isNull()) return;
// scale back to achieve antialiasing
// show show image
image = newImage;
imageLabel->setPixmap(QPixmap::fromImage(image));
imageLabel->adjustSize();

View File

@ -34,13 +34,15 @@ class ImageViewer : public QDialog {
Q_OBJECT
public:
explicit ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidget *parent = nullptr);
explicit ImageViewer(const QString &fileName, LammpsWrapper *_lammps,
QWidget *parent = nullptr);
private slots:
void saveAs();
void copy();
void quit();
void set_atom_size();
void edit_size();
void reset_view();
void toggle_ssao();
@ -75,7 +77,8 @@ private:
QLabel *imageLabel;
QScrollArea *scrollArea;
QDialogButtonBox *buttonBox;
double scaleFactor = 1.0;
double scaleFactor;
double atomSize;
QAction *saveAsAct;
QAction *copyAct;

View File

@ -54,8 +54,17 @@
</provides>
<releases>
<release version="1.6.10" timestamp="1724585189">
<description>
</description>
</release>
<release version="1.6.9" timestamp="1724308872">
<description>
Added search and replace functionality
Converged command line argument parsing using Qt facilities
Added dark mode adjustments to syntax highlighting
Add field to enter Atom size, if not determined otherwise
</description>
</release>
<release version="1.6.8" timestamp="1723581926">

View File

@ -15,6 +15,7 @@
#include "chartviewer.h"
#include "fileviewer.h"
#include "findandreplace.h"
#include "helpers.h"
#include "highlighter.h"
#include "imageviewer.h"
@ -68,18 +69,13 @@
static const QString blank(" ");
static constexpr int BUFLEN = 256;
LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
LammpsGui::LammpsGui(QWidget *parent, const QString &filename) :
QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr),
status(nullptr), logwindow(nullptr), imagewindow(nullptr), chartwindow(nullptr),
slideshow(nullptr), logupdater(nullptr), dirstatus(nullptr), progress(nullptr),
prefdialog(nullptr), lammpsstatus(nullptr), varwindow(nullptr), wizard(nullptr),
runner(nullptr), is_running(false), run_counter(0)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// register QList<QString> only needed for Qt5
qRegisterMetaTypeStreamOperators<QList<QString>>("QList<QString>");
#endif
docver = "";
ui->setupUi(this);
this->setCentralWidget(ui->textEdit);
@ -90,27 +86,34 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
// use $HOME if we get dropped to "/" like on macOS
if (current_dir == "/") current_dir = QDir::homePath();
inspectList.clear();
setAutoFillBackground(true);
// restore and initialize settings
QSettings settings;
#if defined(LAMMPS_GUI_USE_PLUGIN)
plugin_path.clear();
std::string deffile = settings.value("plugin_path", "liblammps.so").toString().toStdString();
for (const char *libfile : {deffile.c_str(), "./liblammps.so", "liblammps.dylib",
"./liblammps.dylib", "liblammps.dll"}) {
plugin_path =
QFileInfo(settings.value("plugin_path", "liblammps.so").toString()).canonicalFilePath();
if (!lammps.load_lib(plugin_path.toStdString().c_str())) {
// fall back to defaults
for (const char *libfile :
{"./liblammps.so", "liblammps.dylib", "./liblammps.dylib", "liblammps.dll"}) {
if (lammps.load_lib(libfile)) {
auto canonical = QFileInfo(libfile).canonicalFilePath();
plugin_path = canonical.toStdString();
settings.setValue("plugin_path", canonical);
plugin_path = QFileInfo(libfile).canonicalFilePath();
settings.setValue("plugin_path", plugin_path);
break;
} else {
plugin_path.clear();
}
}
}
if (plugin_path.empty()) {
if (plugin_path.isEmpty()) {
// none of the plugin paths could load, remove key
settings.remove("plugin_path");
QMessageBox::critical(this, "Error", "Cannot open LAMMPS shared library file");
QMessageBox::critical(this, "Error",
"Cannot open LAMMPS shared library file.\n"
"Use -p command line flag to specify a path to the library.");
exit(1);
}
#endif
@ -205,6 +208,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
connect(ui->actionPaste, &QAction::triggered, this, &LammpsGui::paste);
connect(ui->actionUndo, &QAction::triggered, this, &LammpsGui::undo);
connect(ui->actionRedo, &QAction::triggered, this, &LammpsGui::redo);
connect(ui->actionSearchAndReplace, &QAction::triggered, this, &LammpsGui::findandreplace);
connect(ui->actionRun_Buffer, &QAction::triggered, this, &LammpsGui::run_buffer);
connect(ui->actionRun_File, &QAction::triggered, this, &LammpsGui::run_file);
connect(ui->actionStop_LAMMPS, &QAction::triggered, this, &LammpsGui::stop_run);
@ -278,7 +282,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
dirstatus->show();
ui->statusbar->addWidget(progress);
if (filename) {
if (filename.size() > 0) {
open_file(filename);
} else {
setWindowTitle("LAMMPS-GUI - Editor - *unknown*");
@ -502,7 +506,7 @@ void LammpsGui::start_exe()
void LammpsGui::update_recents(const QString &filename)
{
QSettings settings;
recent = settings.value("recent").value<QList<QString>>();
if (settings.contains("recent")) recent = settings.value("recent").value<QList<QString>>();
for (int i = 0; i < recent.size(); ++i) {
QFileInfo fi(recent[i]);
@ -514,7 +518,10 @@ void LammpsGui::update_recents(const QString &filename)
if (!filename.isEmpty() && !recent.contains(filename)) recent.prepend(filename);
if (recent.size() > 5) recent.removeLast();
if (recent.size() > 0)
settings.setValue("recent", QVariant::fromValue(recent));
else
settings.remove("recent");
ui->action_1->setVisible(false);
if ((recent.size() > 0) && !recent[0].isEmpty()) {
@ -1428,12 +1435,16 @@ void LammpsGui::setFont(const QFont &newfont)
void LammpsGui::about()
{
std::string version = "This is LAMMPS-GUI version " LAMMPS_GUI_VERSION;
version += " using Qt version " QT_VERSION_STR "\n";
version += " using Qt version " QT_VERSION_STR;
if (is_light_theme())
version += " using light theme\n";
else
version += " using dark theme\n";
if (lammps.has_plugin()) {
version += "LAMMPS library loaded as plugin";
if (!plugin_path.empty()) {
if (!plugin_path.isEmpty()) {
version += " from file ";
version += plugin_path;
version += plugin_path.toStdString();
}
} else {
version += "LAMMPS library linked to executable";
@ -1862,6 +1873,14 @@ void LammpsGui::edit_variables()
}
}
void LammpsGui::findandreplace()
{
FindAndReplace find(ui->textEdit, this);
find.setFont(font());
find.setObjectName("find");
find.exec();
}
void LammpsGui::preferences()
{
QSettings settings;

View File

@ -68,7 +68,7 @@ class LammpsGui : public QMainWindow {
friend class Tutorial2Wizard;
public:
LammpsGui(QWidget *parent = nullptr, const char *filename = nullptr);
LammpsGui(QWidget *parent = nullptr, const QString &filename = QString());
~LammpsGui() override;
protected:
@ -115,6 +115,7 @@ private slots:
void paste();
void undo();
void redo();
void findandreplace();
void run_buffer() { do_run(true); }
void run_file() { do_run(false); }
@ -171,7 +172,7 @@ private:
LammpsWrapper lammps;
LammpsRunner *runner;
QString docver;
std::string plugin_path;
QString plugin_path;
bool is_running;
int run_counter;
std::vector<char *> lammps_args;

View File

@ -58,6 +58,7 @@
<file>icons/preferences-desktop.png</file>
<file>icons/process-stop.png</file>
<file>icons/run-file.png</file>
<file>icons/search.png</file>
<file>icons/system-box.png</file>
<file>icons/system-help.png</file>
<file>icons/system-run.png</file>

View File

@ -62,6 +62,8 @@
<addaction name="actionCut"/>
<addaction name="actionPaste"/>
<addaction name="separator"/>
<addaction name="actionSearchAndReplace"/>
<addaction name="separator"/>
<addaction name="actionPreferences"/>
<addaction name="actionDefaults"/>
</widget>
@ -312,12 +314,23 @@
<string>Ctrl+Shift+H</string>
</property>
</action>
<action name="actionSearchAndReplace">
<property name="icon">
<iconset theme=":/icons/search.png"/>
</property>
<property name="text">
<string>&amp;Find and Replace...</string>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
</action>
<action name="actionPreferences">
<property name="icon">
<iconset theme=":/icons/preferences-desktop.png"/>
</property>
<property name="text">
<string>Pre&amp;ferences...</string>
<string>P&amp;references...</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>

View File

@ -115,7 +115,7 @@ double LammpsWrapper::extract_variable(const char *keyword)
}
double val = *((double *)ptr);
#if defined(LAMMPS_GUI_USE_PLUGIN)
ptr = ((liblammpsplugin_t *)plugin_handle)->free(ptr);
((liblammpsplugin_t *)plugin_handle)->free(ptr);
#else
lammps_free(ptr);
#endif

View File

@ -17,6 +17,9 @@
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QLocale>
#include <QSettings>
#include <QString>
#include <QStringList>
#include <cstdio>
#include <cstring>
@ -27,6 +30,11 @@
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(lammpsgui);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// register QList<QString> only needed for Qt5
qRegisterMetaTypeStreamOperators<QList<QString>>("QList<QString>");
#endif
QApplication app(argc, argv);
// enforce using the plain ASCII C locale within the GUI.
QLocale::setDefault(QLocale::c());
@ -40,13 +48,32 @@ int main(int argc, char *argv[])
"\nA graphical editor for LAMMPS input files with syntax highlighting and\n"
"auto-completion that can run LAMMPS directly. It has built-in capabilities\n"
"for monitoring, visualization, plotting, and capturing console output.");
#if defined(LAMMPS_GUI_USE_PLUGIN)
QCommandLineOption plugindir(QStringList() << "p"
<< "pluginpath",
"Path to LAMMPS shared library", "path");
parser.addOption(plugindir);
#endif
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The LAMMPS input file to open (optional).");
parser.process(app); // this removes known arguments
parser.process(app);
const char *infile = nullptr;
if (argc > 1) infile = argv[1];
#if defined(LAMMPS_GUI_USE_PLUGIN)
if (parser.isSet(plugindir)) {
QStringList pluginpath = parser.values(plugindir);
if (pluginpath.length() > 0) {
QSettings settings;
settings.setValue("plugin_path", QString(pluginpath.at(0)));
settings.sync();
}
}
#endif
QString infile;
QStringList args = parser.positionalArguments();
if (args.size() > 0) infile = args[0];
LammpsGui w(nullptr, infile);
w.show();
return app.exec();

View File

@ -466,6 +466,33 @@ TEST_F(LibraryProperties, global)
if (!verbose) ::testing::internal::GetCapturedStdout();
map_style = *(int *)lammps_extract_global(lmp, "map_style");
EXPECT_EQ(map_style, Atom::MAP_ARRAY);
EXPECT_EQ(lammps_extract_global_datatype(lmp, "xlattice"), LAMMPS_DOUBLE);
EXPECT_EQ(lammps_extract_global_datatype(lmp, "ylattice"), LAMMPS_DOUBLE);
EXPECT_EQ(lammps_extract_global_datatype(lmp, "zlattice"), LAMMPS_DOUBLE);
auto *xlattice = (double *)lammps_extract_global(lmp, "xlattice");
auto *ylattice = (double *)lammps_extract_global(lmp, "ylattice");
auto *zlattice = (double *)lammps_extract_global(lmp, "zlattice");
EXPECT_NE(xlattice, nullptr);
EXPECT_NE(ylattice, nullptr);
EXPECT_NE(zlattice, nullptr);
EXPECT_DOUBLE_EQ(*xlattice, 1.0);
EXPECT_DOUBLE_EQ(*ylattice, 1.0);
EXPECT_DOUBLE_EQ(*zlattice, 1.0);
if (!verbose) ::testing::internal::CaptureStdout();
lammps_command(lmp, "clear");
lammps_command(lmp, "units real");
lammps_command(lmp, "lattice fcc 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
xlattice = (double *)lammps_extract_global(lmp, "xlattice");
ylattice = (double *)lammps_extract_global(lmp, "ylattice");
zlattice = (double *)lammps_extract_global(lmp, "zlattice");
EXPECT_NE(xlattice, nullptr);
EXPECT_NE(ylattice, nullptr);
EXPECT_NE(zlattice, nullptr);
EXPECT_DOUBLE_EQ(*xlattice, 2.0);
EXPECT_DOUBLE_EQ(*ylattice, 2.0);
EXPECT_DOUBLE_EQ(*zlattice, 2.0);
};
TEST_F(LibraryProperties, pair1)

View File

@ -656,6 +656,9 @@ create_atoms 1 single &
self.assertEqual(self.lmp.extract_global("map_tag_max"), -1)
self.assertEqual(self.lmp.extract_global("sortfreq"), 1000)
self.assertEqual(self.lmp.extract_global("nextsort"), 0)
self.assertEqual(self.lmp.extract_global("xlattice"), 1.0)
self.assertEqual(self.lmp.extract_global("ylattice"), 1.0)
self.assertEqual(self.lmp.extract_global("zlattice"), 1.0)
# set and initialize r-RESPA
self.lmp.command("run_style respa 3 5 2 pair 2 kspace 3")