Review akohlmey

This commit is contained in:
Ludwig Ahrens-Iwers 2022-04-05 15:35:04 +00:00 committed by Shern Tee
parent 7215939a89
commit 65be564cd6
127 changed files with 297 additions and 193 deletions

View File

@ -7,8 +7,12 @@ unit-tests:
script:
- echo "Installing dependencies"
- apt-get update
- apt-get install -y cmake make gcc g++ gfortran python3 python3-numpy libblas-dev liblapack-dev
- apt-get install -y cmake make gcc g++ gfortran python3 python3-numpy python3-yaml libblas-dev liblapack-dev
- base_dir=$PWD
- echo "Checking code style"
- python3 ./tools/coding_standard/homepage.py .
- python3 ./tools/coding_standard/whitespace.py .
- python3 ./tools/coding_standard/permissions.py .
- echo "Building lammps in directory $base_dir"
- mkdir build && cd build
- cmake ../cmake
@ -26,13 +30,13 @@ unit-tests:
- adduser tester
- chown -R tester $base_dir
- runuser -u tester ctest
- echo "running tests in examples/electrode subdirectory of $base_dir"
- echo "running tests in examples/PACKAGES/electrode subdirectory of $base_dir"
- lmpbin=$base_dir/build/lmp
- cd $base_dir/examples/electrode/check_amat/
- cd $base_dir/examples/PACKAGES/electrode/check_amat/
- bash check.sh $lmpbin
- cd $base_dir/examples/electrode/check_etypes/
- cd $base_dir/examples/PACKAGES/electrode/check_etypes/
- bash check.sh $lmpbin
- cd $base_dir/examples/electrode/check_ffield/
- cd $base_dir/examples/PACKAGES/electrode/check_ffield/
- bash check.sh $lmpbin
- cd $base_dir/examples/electrode/check_intel/
- cd $base_dir/examples/PACKAGES/electrode/check_intel/
- bash check.sh $lmpbin

View File

@ -1291,7 +1291,7 @@ be built for the most part with all major versions of the C++ language.
.. _electrode:
ELECTRODE package
ELECTRODE package
-----------------
This package depends on the KSPACE package.

View File

@ -66,9 +66,6 @@ OPT.
* :doc:`edpd/source <fix_dpd_source>`
* :doc:`efield <fix_efield>`
* :doc:`ehex <fix_ehex>`
* :doc:`electrode/conp <fix_electrode_conp>`
* :doc:`electrode/conq <fix_electrode_conp>`
* :doc:`electrode/thermo <fix_electrode_conp>`
* :doc:`electrode/conp (i) <fix_electrode_conp>`
* :doc:`electrode/conq (i) <fix_electrode_conp>`
* :doc:`electrode/thermo (i) <fix_electrode_conp>`

View File

@ -42,6 +42,5 @@ OPT.
* :doc:`pppm/stagger <kspace_style>`
* :doc:`pppm/tip4p (o) <kspace_style>`
* :doc:`pppm/dielectric <kspace_style>`
* :doc:`pppm/electrode <kspace_style>`
* :doc:`pppm/electrode (i) <kspace_style>`
* :doc:`scafacos <kspace_style>`

View File

@ -8,20 +8,17 @@
fix electrode/conp command
==========================
Accelerator Variant: *electrode/conp/intel*
fix electrode/conq command
==========================
Accelerator Variant: *electrode/conq/intel*
fix electrode/thermo command
============================
fix electrode/conp/intel command
================================
fix electrode/conq/intel command
================================
fix electrode/thermo/intel command
==================================
Accelerator Variant: *electrode/thermo/intel*
Syntax
""""""
@ -96,7 +93,7 @@ interactions. The Kspace styles *ewald/electrode*, *pppm/electrode* and
For systems with non-periodic boundaries in one or two directions dipole
corrections are available with the :doc:`kspace_modify <kspace_modify>`. For
ewald/electrode a two-dimensional Ewald summation :ref:`(Hu) <Hu>` can be used
ewald/electrode a two-dimensional Ewald summation :ref:`(Hu) <Hu>` can be used
by setting "slab ew2d":
.. code-block:: LAMMPS
@ -115,7 +112,7 @@ moderate mesh size but requires more memory.
kspace_modify amat onestep/twostep
The *fix_modify tf* option allows to specify Thomas-Fermi parameters (:ref:`Scalfi <Scalfi>`) for each atom type.
The *fix_modify tf* option allows to specify Thomas-Fermi parameters (:ref:`Scalfi <Scalfi>`) for each atom type.
.. code-block:: LAMMPS
@ -134,6 +131,10 @@ and top of the cell this can be achieved with *processors * * 2*.
----------
.. include:: accel_styles.rst
----------
.. _Siepmann:
**(Siepmann)** Siepmann and Strik, J. Chem. Phys. 102, 511 (1995).

View File

@ -56,7 +56,7 @@ Syntax
*splittol* value = tol
tol = relative size of two eigenvalues (see discussion below)
*wire* value = volfactor (available with ELECTRODE package)
volfactor = ratio of the total extended dimension used in the 1d
volfactor = ratio of the total extended dimension used in the 1d
approximation compared with the dimension of the simulation domain
Examples

1
lib/electrode/Install.py Symbolic link
View File

@ -0,0 +1 @@
../Install.py

View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
electrode_SYSINC =
electrode_SYSLIB =
electrode_SYSPATH =

View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
electrode_SYSINC =
electrode_SYSLIB = -lblas -llapack
electrode_SYSPATH =

View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
electrode_SYSINC =
electrode_SYSLIB = -llinalg -lgfortran
electrode_SYSPATH = -L../../lib/linalg$(LIBOBJDIR)

View File

@ -0,0 +1,48 @@
SHELL = /bin/sh
# which file will be copied to Makefile.lammps
EXTRAMAKE = Makefile.lammps.linalg
# ------ DEFINITIONS ------
LIB = libelectrode.a
OBJ = $(SRC:.cpp=.o)
# ------ SETTINGS ------
# include any MPI settings needed for the ELECTRODE library to build with
# the same MPI library that LAMMPS is built with
CC = mpicxx
CCFLAGS = -O3 -fPIC -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1
ARCHIVE = ar
ARCHFLAG = -rc
DEPFLAGS = -M
#LINK =
#LINKFLAGS =
USRLIB =
SYSLIB =
# ------ MAKE PROCEDURE ------
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
@cp $(EXTRAMAKE) Makefile.lammps
# ------ COMPILE RULES ------
%.o:%.cpp
$(CC) $(CCFLAGS) -c $< -o $@
%.d:%.cpp
$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@
# ------ DEPENDENCIES ------
DEPENDS = $(OBJ:.o=.d)
# ------ CLEAN ------
clean:
-rm -f *.d *~ $(OBJ) $(LIB)

View File

@ -0,0 +1,48 @@
SHELL = /bin/sh
# which file will be copied to Makefile.lammps
EXTRAMAKE = Makefile.lammps.linalg
# ------ DEFINITIONS ------
LIB = libelectrode.a
OBJ = $(SRC:.cpp=.o)
# ------ SETTINGS ------
# include any MPI settings needed for the ATC library to build with
# the same MPI library that LAMMPS is built with
CC = g++
CCFLAGS = -O3 -fPIC -I../../src/STUBS
ARCHIVE = ar
ARCHFLAG = -rc
DEPFLAGS = -M
#LINK =
#LINKFLAGS =
USRLIB =
SYSLIB =
# ------ MAKE PROCEDURE ------
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
@cp $(EXTRAMAKE) Makefile.lammps
# ------ COMPILE RULES ------
%.o:%.cpp
$(CC) $(CCFLAGS) -c $< -o $@
%.d:%.cpp
$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@
# ------ DEPENDENCIES ------
DEPENDS = $(OBJ:.o=.d)
# ------ CLEAN ------
clean:
-rm -f *.d *~ $(OBJ) $(LIB)

View File

@ -14,33 +14,54 @@ export LC_ALL
# arg1 = file, arg2 = file it depends on
action () {
if (test $mode = 0) then
rm -f ../$1
elif (! cmp -s $1 ../$1) then
if (test -z "$2" || test -e ../$2) then
cp $1 ..
if (test $mode = 2) then
echo " updating src/$1"
fi
if (test $mode = 0) then
rm -f ../$1
elif (! cmp -s $1 ../$1) then
if (test -z "$2" || test -e ../$2) then
cp $1 ..
if (test $mode = 2) then
echo " updating src/$1"
fi
fi
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi
fi
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi
fi
}
# all package files with no dependencies
for file in *.cpp *.h; do
test -f ${file} && action $file
test -f ${file} && action $file
done
if (test $1 = 1) then
if (test ! -e ../pppm.cpp) then
echo "Must install KSPACE package with ELECTRODE"
exit 1
fi
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*electrode[^ \t]* //g' ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/electrode |' ../Makefile.package
sed -i -e 's|^PKG_LIB =[ \t]*|&-lelectrode |' ../Makefile.package
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(electrode_SYSPATH) |' ../Makefile.package
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(electrode_SYSLIB) |' ../Makefile.package
fi
if (test -e ../Makefile.package.settings) then
sed -i -e '/^include.*electrode.*$/d' ../Makefile.package.settings
# multiline form needed for BSD sed on Macs
sed -i -e '4 i \
include ..\/..\/lib\/electrode\/Makefile.lammps
' ../Makefile.package.settings
fi
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*conp[^ \t]* //g' ../Makefile.package
sed -i -e 's|^PKG_LIB =[ \t]*|&-llinalg -L../../lib/linalg$(LIBOBJDIR) -lgfortran |' ../Makefile.package
fi
elif (test $1 = 0) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*electrode[^ \t]* //g' ../Makefile.package
fi
if (test -e ../Makefile.package.settings) then
sed -i -e '/^include.*electrode.*$/d' ../Makefile.package.settings
fi
fi

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -17,14 +17,11 @@
#include "boundary_correction.h"
#include <iostream>
#include "atom.h"
#include "comm.h"
#include "force.h"
using namespace LAMMPS_NS;
using namespace std;
// use EW3DC slab correction
//
@ -52,24 +49,24 @@ void BoundaryCorrection::setup(double x, double y, double z, double g)
g_ewald = g;
}
vector<int> BoundaryCorrection::gather_recvcounts(int n)
std::vector<int> BoundaryCorrection::gather_recvcounts(int n)
{
int const nprocs = comm->nprocs;
vector<int> recvcounts = vector<int>(nprocs);
std::vector<int> recvcounts = std::vector<int>(nprocs);
MPI_Allgather(&n, 1, MPI_INT, &recvcounts.front(), 1, MPI_INT, world);
return recvcounts;
}
vector<int> BoundaryCorrection::gather_displs(vector<int> recvcounts)
std::vector<int> BoundaryCorrection::gather_displs(const std::vector<int> &recvcounts)
{
int const nprocs = comm->nprocs;
vector<int> displs = vector<int>(nprocs);
std::vector<int> displs = std::vector<int>(nprocs);
displs[0] = 0;
for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1];
return displs;
}
vector<bigint> BoundaryCorrection::gather_jmat(bigint *imat)
std::vector<bigint> BoundaryCorrection::gather_jmat(bigint *imat)
{
int nlocal = atom->nlocal;
bigint ngroup = 0;
@ -78,16 +75,16 @@ vector<bigint> BoundaryCorrection::gather_jmat(bigint *imat)
if (imat[i] > -1) ngrouplocal++;
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
vector<bigint> jmat_local = vector<bigint>(ngrouplocal);
std::vector<bigint> jmat_local = std::vector<bigint>(ngrouplocal);
for (int i = 0, n = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;
jmat_local[n++] = imat[i];
}
// gather global matrix indexing
vector<bigint> jmat = vector<bigint>(ngroup);
vector<int> recvcounts = gather_recvcounts(ngrouplocal);
vector<int> displs = gather_displs(recvcounts);
std::vector<bigint> jmat = std::vector<bigint>(ngroup);
std::vector<int> recvcounts = gather_recvcounts(ngrouplocal);
std::vector<int> displs = gather_displs(recvcounts);
MPI_Allgatherv(&jmat_local.front(), ngrouplocal, MPI_LMP_BIGINT, &jmat.front(),
&recvcounts.front(), &displs.front(), MPI_LMP_BIGINT, world);
return jmat;

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -43,7 +43,7 @@ class BoundaryCorrection : protected Pointers {
std::vector<bigint> gather_jmat(bigint *);
std::vector<int> gather_recvcounts(int);
std::vector<int> gather_displs(std::vector<int>);
std::vector<int> gather_displs(const std::vector<int> &);
};
} // namespace LAMMPS_NS
#endif

View File

@ -1,20 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
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.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors: Ludwig Ahrens-Iwers (TUHH), Shern Tee (UQ), Robert Meißner (TUHH)
------------------------------------------------------------------------- */
#include "electrode_accel_interface.h"
LAMMPS_NS::ElectrodeAccelInterface::~ElectrodeAccelInterface() {}

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -25,7 +25,7 @@ namespace LAMMPS_NS {
class ElectrodeAccelInterface : protected Pointers {
public:
ElectrodeAccelInterface(class LAMMPS *lmp) : Pointers(lmp) {}
virtual ~ElectrodeAccelInterface();
virtual ~ElectrodeAccelInterface() {}
virtual void intel_find_fix() {}
virtual void intel_pack_buffers() {}
};

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -19,6 +19,7 @@
#include "atom.h"
#include "comm.h"
#include "electrode_kspace.h"
#include "error.h"
#include "force.h"
#include "group.h"
@ -51,7 +52,7 @@ ElectrodeMatrix::ElectrodeMatrix(LAMMPS *lmp, int electrode_group, double eta) :
/* ---------------------------------------------------------------------- */
void ElectrodeMatrix::setup(std::map<tagint, int> tag_ids, class Pair *fix_pair,
void ElectrodeMatrix::setup(const std::map<tagint, int> &tag_ids, class Pair *fix_pair,
class NeighList *fix_neighlist)
{
pair = fix_pair;
@ -64,9 +65,10 @@ void ElectrodeMatrix::setup(std::map<tagint, int> tag_ids, class Pair *fix_pair,
tag_to_iele = tag_ids;
}
/* ---------------------------------------------------------------------- */
void ElectrodeMatrix::setup_tf(std::map<int, double> tf_types)
void ElectrodeMatrix::setup_tf(const std::map<int, double> &tf_types)
{
tfflag = true;
this->tf_types = tf_types;

Some files were not shown because too many files have changed in this diff Show More