Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Collected small changes and fixes #3937

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/src/pair_ilp_tmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Examples
.. code-block:: LAMMPS
pair_style hybrid/overlay ilp/tmd 16.0 1
pair_coeff * * ilp/tmd TMD.ILP Mo S S
pair_coeff * * ilp/tmd MoS2.ILP Mo S S
pair_style hybrid/overlay sw/mod sw/mod ilp/tmd 16.0
pair_coeff * * sw/mod 1 tmd.sw.mod Mo S S NULL NULL NULL
pair_coeff * * sw/mod 2 tmd.sw.mod NULL NULL NULL Mo S S
pair_coeff * * ilp/tmd TMD.ILP Mo S S Mo S S
pair_coeff * * ilp/tmd MoS2.ILP Mo S S Mo S S
Description
"""""""""""
Expand Down Expand Up @@ -69,15 +69,15 @@ calculating the normals.
each atom `i`, its six nearest neighboring atoms belonging to the same
sub-layer are chosen to define the normal vector `{\bf n}_i`.

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

.. note::

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

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

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

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

The *reaxff/kk* style is a Kokkos version of the ReaxFF potential that
is derived from the *reaxff* style. The Kokkos version can run on GPUs
and can also use OpenMP multithreading. For more information about the
is derived from the *reaxff* style. The Kokkos version can run on GPUs
and can also use OpenMP multithreading. For more information about the
Kokkos package, see :doc:`Packages details <Packages_details>` and
:doc:`Speed kokkos <Speed_kokkos>` doc pages. One important
consideration when using the *reaxff/kk* style is the choice of either
Expand Down
6 changes: 3 additions & 3 deletions lib/pace/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SHELL = /bin/sh
CMAKE= cmake
akohlmey marked this conversation as resolved.
Show resolved Hide resolved

# ------ FILES ------

Expand Down Expand Up @@ -35,7 +36,7 @@ lib: $(OBJ) lib-yaml-cpp


lib-yaml-cpp:
cd $(YAML_CPP_PATH) && $(MAKE) lib
cd $(YAML_CPP_PATH) && $(CMAKE) . && $(MAKE) all

# ------ COMPILE RULES ------

Expand All @@ -45,9 +46,8 @@ lib-yaml-cpp:
# ------ CLEAN ------
clean-all:
-rm -f *~ $(OBJ) $(LIB)
cd $(YAML_CPP_PATH) && $(MAKE) clean-all
cd $(YAML_CPP_PATH) && $(MAKE) clean

clean-build:
-rm -f *~ $(OBJ)
cd $(YAML_CPP_PATH) && $(MAKE) clean-build

2 changes: 1 addition & 1 deletion lib/pace/Makefile.lammps
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pace_SYSINC =-I../../lib/pace/src/ML-PACE -I../../lib/pace/src/yaml-cpp/include -I../../lib/pace/src/wigner-cpp/include -DEXTRA_C_PROJECTIONS
pace_SYSLIB = -L../../lib/pace/ -lpace -L../../lib/pace/src/yaml-cpp/ -lyaml-cpp
pace_SYSLIB = -L../../lib/pace/ -lpace -L../../lib/pace/src/yaml-cpp/ -lyaml-cpp-pace
pace_SYSPATH =
1 change: 1 addition & 0 deletions src/OPENMP/npair_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace LAMMPS_NS {
// get access to number of threads and per-thread data structures via FixOMP
#define NPAIR_OMP_INIT \
const int nthreads = comm->nthreads; \
omp_set_num_threads(nthreads); \
const int ifix = modify->find_fix("package_omp")

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

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

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

memory->create(massproc, nchunk, "msd/chunk:massproc");
memory->create(masstotal, nchunk, "msd/chunk:masstotal");
memory->create(com, nchunk, 3, "msd/chunk:com");
Expand Down
22 changes: 20 additions & 2 deletions tools/lammps-gui/codeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void CodeEditor::keyPressEvent(QKeyEvent *event)
// process key event in parent class
QPlainTextEdit::keyPressEvent(event);

// if enabled, try pop up completion automatically after 3 characters
// if enabled, try pop up completion automatically after 2 characters
if (automatic_completion) {
auto cursor = textCursor();
auto line = cursor.block().text();
Expand Down Expand Up @@ -990,8 +990,26 @@ void CodeEditor::insertCompletedCommand(const QString &completion)
{
auto *completer = qobject_cast<QCompleter *>(sender());
if (completer->widget() != this) return;

// select the entire word (non-space text) under the cursor
// we need to do it in this compicated way, since QTextCursor does not recognize
// special characters as part of a word.
auto cursor = textCursor();
cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
auto line = cursor.block().text();
int begin = cursor.positionInBlock();
do {
if (line[begin].isSpace()) break;
--begin;
} while (begin >= 0);

int end = begin + 1;
while (end < line.length()) {
if (line[end].isSpace()) break;
++end;
}

cursor.setPosition(cursor.position() - cursor.positionInBlock() + begin + 1);
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, end - begin - 1);
cursor.insertText(completion);
setTextCursor(cursor);
}
Expand Down
14 changes: 9 additions & 5 deletions tools/lammps-gui/imageviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static const QString blank(" ");

ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidget *parent) :
QDialog(parent), menuBar(new QMenuBar), imageLabel(new QLabel), scrollArea(new QScrollArea),
lammps(_lammps), group("all"), filename(fileName), useelements(false)
lammps(_lammps), group("all"), filename(fileName), useelements(false), usediameter(false)
{
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
Expand Down Expand Up @@ -268,7 +268,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
// properties directly since lookup in reset_view() will have failed
dobox->setChecked(showbox);
dovdw->setChecked(vdwfactor > 1.0);
dovdw->setEnabled(useelements);
dovdw->setEnabled(useelements || usediameter);
doaxes->setChecked(showaxes);
dossao->setChecked(usessao);
doanti->setChecked(antialias);
Expand Down Expand Up @@ -435,7 +435,7 @@ void ImageViewer::createImage()
dumpcmd += "'" + dumpfile.fileName() + "'";

settings.beginGroup("snapshot");
int hhrot = (hrot > 180) ? 360 - hrot : hrot;
int hhrot = (hrot > 180) ? 360 - hrot : hrot;

// determine elements from masses and set their covalent radii
int ntypes = lammps->extract_setting("ntypes");
Expand All @@ -454,9 +454,10 @@ void ImageViewer::createImage()
adiams += QString("adiam %1 %2 ").arg(i).arg(vdwfactor * pte_vdw_radius[idx]);
}
}
usediameter = lammps->extract_setting("radius_flag") != 0;

// adjust pushbutton state and clear adiams string to disable VDW display, if needed
if (useelements) {
if (useelements || usediameter) {
auto *button = findChild<QPushButton *>("vdw");
if (button) button->setEnabled(true);
} else {
Expand All @@ -469,7 +470,10 @@ void ImageViewer::createImage()
dumpcmd += blank + "element";
else
dumpcmd += blank + settings.value("color", "type").toString();
dumpcmd += blank + settings.value("diameter", "type").toString();
if (usediameter && (vdwfactor > 1.0))
dumpcmd += blank + "diameter";
else
dumpcmd += blank + settings.value("diameter", "type").toString();
dumpcmd += QString(" size %1 %2").arg(xsize).arg(ysize);
dumpcmd += QString(" zoom %1").arg(zoom);
dumpcmd += " shiny 0.5 ";
Expand Down
2 changes: 1 addition & 1 deletion tools/lammps-gui/imageviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private slots:
int xsize, ysize;
int hrot, vrot;
double zoom, vdwfactor;
bool showbox, showaxes, antialias, usessao, useelements;
bool showbox, showaxes, antialias, usessao, useelements, usediameter;
};
#endif

Expand Down
4 changes: 3 additions & 1 deletion tools/lammps-gui/stdcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ bool StdCapture::EndCapture()

int bytesRead;
bool fd_blocked;
int maxwait = 100;

do {
bytesRead = 0;
Expand All @@ -93,9 +94,10 @@ bool StdCapture::EndCapture()
buf[bytesRead] = 0;
m_captured += buf;
} else if (bytesRead < 0) {
fd_blocked = ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR));
fd_blocked = ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR)) && (maxwait > 0);

if (fd_blocked) std::this_thread::sleep_for(std::chrono::milliseconds(10));
--maxwait;
}
} while (fd_blocked || (bytesRead == (bufSize - 1)));
m_capturing = false;
Expand Down