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

@ -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;

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
@ -15,19 +15,18 @@
Contributing authors: Ludwig Ahrens-Iwers (TUHH), Shern Tee (UQ), Robert Meißner (TUHH)
------------------------------------------------------------------------- */
#include <map>
#include "electrode_kspace.h"
#include "pointers.h"
#include <map>
namespace LAMMPS_NS {
class ElectrodeMatrix : protected Pointers {
public:
ElectrodeMatrix(class LAMMPS *, int, double);
~ElectrodeMatrix() {}
void setup(std::map<tagint, int>, class Pair *, class NeighList *);
void setup_tf(std::map<int, double>);
void setup(const std::map<tagint, int> &, class Pair *, class NeighList *);
void setup_tf(const std::map<int, double> &);
void compute_array(double **);
int igroup;

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"
@ -72,7 +73,7 @@ ElectrodeVector::~ElectrodeVector()
/* ---------------------------------------------------------------------- */
void ElectrodeVector::setup(std::map<tagint, int> tag_ids, class Pair *fix_pair,
void ElectrodeVector::setup(const std::map<tagint, int> &tag_ids, class Pair *fix_pair,
class NeighList *fix_neighlist)
{
pair = fix_pair;

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
@ -15,18 +15,17 @@
Contributing authors: Ludwig Ahrens-Iwers (TUHH), Shern Tee (UQ), Robert Meißner (TUHH)
------------------------------------------------------------------------- */
#include <map>
#include "electrode_kspace.h"
#include "pointers.h"
#include <map>
namespace LAMMPS_NS {
class ElectrodeVector : protected Pointers {
public:
ElectrodeVector(class LAMMPS *, int, double);
~ElectrodeVector();
void setup(std::map<tagint, int>, class Pair *, class NeighList *);
void setup(const std::map<tagint, int> &, class Pair *, class NeighList *);
void compute_vector();
double *vector;
int igroup;

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,9 +17,6 @@
#include "ewald_electrode.h"
#include <cmath>
#include <iostream>
#include "atom.h"
#include "comm.h"
#include "domain.h"
@ -33,9 +30,11 @@
#include "update.h"
#include "wire_dipole.h"
#include <algorithm>
#include <cmath>
using namespace LAMMPS_NS;
using namespace MathConst;
using namespace std;
#define SMALL 0.00001
@ -59,7 +58,7 @@ EwaldElectrode::~EwaldElectrode()
void EwaldElectrode::init()
{
if (comm->me == 0) utils::logmesg(lmp, "Ewald initialization ...\n");
if (comm->me == 0) utils::logmesg(lmp, "Ewald/electrode initialization ...\n");
// error check
if (domain->triclinic) error->all(FLERR, "Cannot (yet) use Ewald with triclinic box ");

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
@ -18,7 +18,7 @@
#ifdef KSPACE_CLASS
// clang-format off
KSpaceStyle(ewald/electrode, EwaldElectrode)
KSpaceStyle(ewald/electrode, EwaldElectrode);
// clang-format on
#else
@ -28,7 +28,6 @@ KSpaceStyle(ewald/electrode, EwaldElectrode)
#include "electrode_kspace.h"
#include "ewald.h"
#include <algorithm>
namespace LAMMPS_NS {
@ -63,7 +62,7 @@ class EwaldElectrode : public Ewald, public ElectrodeKSpace {
#endif
#endif
/* ERROR/WARNING messages:
/* ERROR/WARNING messages:
E: Illegal ... command

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,11 +17,6 @@
#include "fix_electrode_conp.h"
#include <cassert>
#include <fstream>
#include <numeric>
#include <sstream>
#include "atom.h"
#include "comm.h"
#include "compute.h"
@ -43,6 +38,11 @@
#include "pointers.h"
#include "variable.h"
#include <cassert>
#include <fstream>
#include <numeric>
#include <sstream>
using namespace LAMMPS_NS;
using namespace FixConst;
using namespace MathConst;
@ -899,7 +899,7 @@ double FixElectrodeConp::compute_vector(int i)
/* ---------------------------------------------------------------------- */
double FixElectrodeConp::potential_energy(int eflag, std::vector<int> mpos)
double FixElectrodeConp::potential_energy(int eflag, const std::vector<int> &mpos)
{
// corrections to energy due to potential psi
double const qqrd2e = force->qqrd2e;

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
@ -18,7 +18,7 @@
#ifdef FIX_CLASS
// clang-format off
FixStyle(electrode/conp, FixElectrodeConp)
FixStyle(electrode/conp, FixElectrodeConp);
// clang-format on
#else
@ -26,12 +26,12 @@ FixStyle(electrode/conp, FixElectrodeConp)
#ifndef LMP_FIX_ELECTRODE_CONP_H
#define LMP_FIX_ELECTRODE_CONP_H
#include <algorithm>
#include <map>
#include "electrode_accel_interface.h"
#include "fix.h"
#include <algorithm>
#include <map>
namespace LAMMPS_NS {
class FixElectrodeConp : public Fix {
@ -90,7 +90,7 @@ class FixElectrodeConp : public Fix {
void symmetrize();
double gausscorr(int, bool);
void update_charges();
double potential_energy(int, std::vector<int>);
double potential_energy(int, const std::vector<int> &);
double self_energy(int);
std::vector<int> local_to_matrix();
void write_to_file(FILE *, std::vector<tagint>, std::vector<std::vector<double>>);

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
@ -18,7 +18,7 @@
#ifdef FIX_CLASS
// clang-format off
FixStyle(electrode/conq, FixElectrodeConq)
FixStyle(electrode/conq, FixElectrodeConq);
// clang-format on
#else
@ -26,7 +26,6 @@ FixStyle(electrode/conq, FixElectrodeConq)
#ifndef LMP_FIX_ELECTRODE_CONQ_H
#define LMP_FIX_ELECTRODE_CONQ_H
#include "fix.h"
#include "fix_electrode_conp.h"
namespace LAMMPS_NS {

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
@ -27,7 +27,6 @@
#include "variable.h"
using namespace LAMMPS_NS;
using namespace std;
#define NUM_GROUPS 2
#define SMALL 0.00001

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
@ -18,7 +18,7 @@
#ifdef FIX_CLASS
// clang-format off
FixStyle(electrode/thermo, FixElectrodeThermo)
FixStyle(electrode/thermo, FixElectrodeThermo);
// clang-format on
#else
@ -26,7 +26,6 @@ FixStyle(electrode/thermo, FixElectrodeThermo)
#ifndef LMP_FIX_ELECTRODE_THERMO_H
#define LMP_FIX_ELECTRODE_THERMO_H
#include "fix.h"
#include "fix_electrode_conp.h"
namespace LAMMPS_NS {

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,13 +17,10 @@
#include "pppm_electrode.h"
#include <cmath>
#include <cstring>
#include <iostream>
#include "angle.h"
#include "atom.h"
#include "bond.h"
#include "boundary_correction.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
@ -40,10 +37,13 @@
#include "update.h"
#include "wire_dipole.h"
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
using namespace MathSpecial;
using namespace std;
#define MAXORDER 7
#define OFFSET 16384
@ -666,7 +666,7 @@ void PPPMElectrode::compute_matrix(bigint *imat, double **matrix)
compute(1, 0);
// fft green's function k -> r
vector<double> greens_real(nz_pppm * ny_pppm * nx_pppm, 0.);
std::vector<double> greens_real(nz_pppm * ny_pppm * nx_pppm, 0.);
for (int i = 0, n = 0; i < nfft; i++) {
work2[n++] = greensfn[i];
work2[n++] = ZEROF;
@ -705,7 +705,7 @@ void PPPMElectrode::compute_matrix(bigint *imat, double **matrix)
/* ----------------------------------------------------------------------*/
void PPPMElectrode::one_step_multiplication(bigint *imat, vector<double> greens_real,
void PPPMElectrode::one_step_multiplication(bigint *imat, const std::vector<double> &greens_real,
double **x_ele, double **matrix, int const nmat)
{
// map green's function in real space from mesh to particle positions
@ -718,8 +718,8 @@ void PPPMElectrode::one_step_multiplication(bigint *imat, vector<double> greens_
double step1_time = MPI_Wtime();
// precalculate rho_1d for local electrode
vector<vector<vector<double>>> rho1d_j(nlocal,
vector<vector<double>>(3, vector<double>(order, 0)));
std::vector<std::vector<std::vector<double>>> rho1d_j(
nlocal, std::vector<std::vector<double>>(3, std::vector<double>(order, 0)));
for (int j = 0; j < nlocal; j++) {
int jpos = imat[j];
if (jpos < 0) continue;
@ -795,7 +795,7 @@ void PPPMElectrode::one_step_multiplication(bigint *imat, vector<double> greens_
/* ----------------------------------------------------------------------*/
void PPPMElectrode::two_step_multiplication(bigint *imat, vector<double> greens_real,
void PPPMElectrode::two_step_multiplication(bigint *imat, const std::vector<double> &greens_real,
double **x_ele, double **matrix, int const nmat)
{
// map green's function in real space from mesh to particle positions
@ -808,7 +808,7 @@ void PPPMElectrode::two_step_multiplication(bigint *imat, vector<double> greens_
int ny_ele = nyhi_out - nylo_out + 1; // ny_pppm + order + 1;
int nz_ele = nzhi_out - nzlo_out + 1; // nz_pppm + order + 1;
int nxyz = nx_ele * ny_ele * nz_ele;
vector<vector<double>> gw(nmat, vector<double>(nxyz, 0.));
std::vector<std::vector<double>> gw(nmat, std::vector<double>(nxyz, 0.));
// loops over weights of electrode atoms and weights of complete grid
// (nx,ny,nz) = global coords of grid pt to "lower left" of charge
@ -971,7 +971,7 @@ void PPPMElectrode::allocate_peratom()
peratom_allocate_flag = 1;
memory->create3d_offset(v0_brick, nzlo_out, nzhi_out, nylo_out, nyhi_out, nxlo_out, nxhi_out,
"pppm:v0_brick");
"pppm:v0_brick");
memory->create3d_offset(v1_brick, nzlo_out, nzhi_out, nylo_out, nyhi_out, nxlo_out, nxhi_out,
"pppm:v1_brick");
memory->create3d_offset(v2_brick, nzlo_out, nzhi_out, nylo_out, nyhi_out, nxlo_out, nxhi_out,

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
@ -18,7 +18,7 @@
#ifdef KSPACE_CLASS
// clang-format off
KSpaceStyle(pppm/electrode, PPPMElectrode)
KSpaceStyle(pppm/electrode, PPPMElectrode);
// clang-format on
#else
@ -26,10 +26,8 @@ KSpaceStyle(pppm/electrode, PPPMElectrode)
#ifndef LMP_PPPM_ELECTRODE_H
#define LMP_PPPM_ELECTRODE_H
#include "boundary_correction.h"
#include "electrode_kspace.h"
#include "pppm.h"
#include <algorithm>
#if defined(FFT_FFTW3)
#define LMP_FFT_LIB "FFTW3"
@ -117,8 +115,10 @@ class PPPMElectrode : public PPPM, public ElectrodeKSpace {
void start_compute();
void make_rho_in_brick(bigint *, FFT_SCALAR ***, bool);
void project_psi(bigint *, double *vec);
void one_step_multiplication(bigint *, std::vector<double>, double **, double **, int const);
void two_step_multiplication(bigint *, std::vector<double>, double **, double **, int const);
void one_step_multiplication(bigint *, const std::vector<double> &, double **, double **,
int const);
void two_step_multiplication(bigint *, const std::vector<double> &, double **, double **,
int const);
bool compute_vector_called;
bigint *imat_cached;
};
@ -128,7 +128,7 @@ class PPPMElectrode : public PPPM, public ElectrodeKSpace {
#endif
#endif
/* ERROR/WARNING messages:
/* ERROR/WARNING messages:
E: Illegal ... command

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,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
using namespace std;
/* ----------------------------------------------------------------------
Slab-geometry correction term (k=0) of EW2D. See Hu, JCTC 10:12 (2014)
@ -42,12 +41,12 @@ void Slab2d::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, dou
int nlocal = atom->nlocal;
bigint natoms = atom->natoms;
vector<double> z = vector<double>(nlocal);
std::vector<double> z = std::vector<double>(nlocal);
for (int i = 0; i < nlocal; i++) z[i] = x[i][2];
vector<double> z_all = vector<double>(natoms);
vector<double> q_all = vector<double>(natoms);
vector<int> recvcounts = gather_recvcounts(nlocal);
vector<int> displs = gather_displs(recvcounts);
std::vector<double> z_all = std::vector<double>(natoms);
std::vector<double> q_all = std::vector<double>(natoms);
std::vector<int> recvcounts = gather_recvcounts(nlocal);
std::vector<int> displs = gather_displs(recvcounts);
MPI_Allgatherv(q, nlocal, MPI_DOUBLE, &q_all.front(), &recvcounts.front(), &displs.front(),
MPI_DOUBLE, world);
MPI_Allgatherv(&z.front(), nlocal, MPI_DOUBLE, &z_all.front(), &recvcounts.front(),
@ -85,8 +84,8 @@ void Slab2d::vector_corr(bigint *imat, double *vec)
int const nlocal = atom->nlocal;
double **x = atom->x;
double *q = atom->q;
vector<double> z_local; // z coordinates of electrolyte atoms
vector<double> q_local; // charges of electrolyte atoms
std::vector<double> z_local; // z coordinates of electrolyte atoms
std::vector<double> q_local; // charges of electrolyte atoms
for (int i = 0; i < nlocal; i++) {
if (imat[i] < 0) {
z_local.push_back(x[i][2]);
@ -97,10 +96,10 @@ void Slab2d::vector_corr(bigint *imat, double *vec)
int n_electrolyte_local = z_local.size();
int n_electrolyte;
MPI_Allreduce(&n_electrolyte_local, &n_electrolyte, 1, MPI_INT, MPI_SUM, world);
vector<double> z_all = vector<double>(n_electrolyte);
vector<double> q_all = vector<double>(n_electrolyte);
vector<int> recvcounts = gather_recvcounts(n_electrolyte_local);
vector<int> displs = gather_displs(recvcounts);
std::vector<double> z_all = std::vector<double>(n_electrolyte);
std::vector<double> q_all = std::vector<double>(n_electrolyte);
std::vector<int> recvcounts = gather_recvcounts(n_electrolyte_local);
std::vector<int> displs = gather_displs(recvcounts);
MPI_Allgatherv(&z_local.front(), n_electrolyte_local, MPI_DOUBLE, &z_all.front(),
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
MPI_Allgatherv(&q_local.front(), n_electrolyte_local, MPI_DOUBLE, &q_all.front(),
@ -133,23 +132,23 @@ void Slab2d::matrix_corr(bigint *imat, double **matrix)
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
// gather non-periodic positions of groups
vector<double> nprd_local = vector<double>(ngrouplocal);
std::vector<double> nprd_local = std::vector<double>(ngrouplocal);
for (int i = 0, n = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;
nprd_local[n++] = x[i][2];
}
// gather subsets nprd positions
vector<int> recvcounts = gather_recvcounts(ngrouplocal);
vector<int> displs = gather_displs(recvcounts);
vector<double> nprd_all = vector<double>(ngroup);
std::vector<int> recvcounts = gather_recvcounts(ngrouplocal);
std::vector<int> displs = gather_displs(recvcounts);
std::vector<double> nprd_all = std::vector<double>(ngroup);
MPI_Allgatherv(&nprd_local.front(), ngrouplocal, MPI_DOUBLE, &nprd_all.front(),
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
const double g_ewald_inv = 1.0 / g_ewald;
const double g_ewald_sq = g_ewald * g_ewald;
const double prefac = 2.0 * MY_PIS / area;
vector<bigint> jmat = gather_jmat(imat);
std::vector<bigint> jmat = gather_jmat(imat);
for (int i = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;
for (bigint j = 0; j < ngroup; j++) {

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
@ -24,7 +24,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
using namespace std;
#define SMALL 0.00001
@ -114,20 +113,20 @@ void SlabDipole::matrix_corr(bigint *imat, double **matrix)
bigint ngroup = 0;
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
vector<double> nprd_local = vector<double>(ngrouplocal);
std::vector<double> nprd_local = std::vector<double>(ngrouplocal);
for (int i = 0, n = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;
nprd_local[n++] = x[i][2];
}
// gather subsets nprd positions
vector<int> recvcounts = gather_recvcounts(ngrouplocal);
vector<int> displs = gather_displs(recvcounts);
vector<double> nprd_all = vector<double>(ngroup);
std::vector<int> recvcounts = gather_recvcounts(ngrouplocal);
std::vector<int> displs = gather_displs(recvcounts);
std::vector<double> nprd_all = std::vector<double>(ngroup);
MPI_Allgatherv(&nprd_local.front(), ngrouplocal, MPI_DOUBLE, &nprd_all.front(),
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
vector<bigint> jmat = gather_jmat(imat);
std::vector<bigint> jmat = gather_jmat(imat);
const double prefac = MY_4PI / volume;
for (int i = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;

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
@ -24,7 +24,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
using namespace std;
/* ----------------------------------------------------------------------
Wire-geometry correction term to dampen inter-wire interactions between
@ -125,8 +124,8 @@ void WireDipole::matrix_corr(bigint *imat, double **matrix)
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
// gather non-periodic positions of groups
vector<double> xprd_local = vector<double>(ngrouplocal);
vector<double> yprd_local = vector<double>(ngrouplocal);
std::vector<double> xprd_local = std::vector<double>(ngrouplocal);
std::vector<double> yprd_local = std::vector<double>(ngrouplocal);
for (int i = 0, n = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;
xprd_local[n] = x[i][0];
@ -135,16 +134,16 @@ void WireDipole::matrix_corr(bigint *imat, double **matrix)
}
// gather subsets nprd positions
vector<int> recvcounts = gather_recvcounts(ngrouplocal);
vector<int> displs = gather_displs(recvcounts);
vector<double> xprd_all = vector<double>(ngroup);
vector<double> yprd_all = vector<double>(ngroup);
std::vector<int> recvcounts = gather_recvcounts(ngrouplocal);
std::vector<int> displs = gather_displs(recvcounts);
std::vector<double> xprd_all = std::vector<double>(ngroup);
std::vector<double> yprd_all = std::vector<double>(ngroup);
MPI_Allgatherv(&xprd_local.front(), ngrouplocal, MPI_DOUBLE, &xprd_all.front(),
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
MPI_Allgatherv(&yprd_local.front(), ngrouplocal, MPI_DOUBLE, &yprd_all.front(),
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
vector<bigint> jmat = gather_jmat(imat);
std::vector<bigint> jmat = gather_jmat(imat);
const double prefac = MY_2PI / volume;
for (int i = 0; i < nlocal; i++) {
if (imat[i] < 0) continue;

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
http://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
http://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 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://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 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://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 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://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

View File

@ -1,6 +1,6 @@
/* *- c++ -*- -----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://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

@ -1159,12 +1159,12 @@ int PPPMIntel::use_base() {
/* ----------------------------------------------------------------------
allows usage in derived classes (pppm/electrode/intel)
------------------------------------------------------------------------- */
template void PPPMIntel::particle_map<float,double>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::particle_map<float,double>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::particle_map<double,double>(IntelBuffers<double,double> *buffers);
template void PPPMIntel::particle_map<float,float>(IntelBuffers<float,float> *buffers);
template void PPPMIntel::make_rho<float,double,0>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::make_rho<float,double,0>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::make_rho<double,double,0>(IntelBuffers<double,double> *buffers);
template void PPPMIntel::make_rho<float,float,0>(IntelBuffers<float,float> *buffers);
template void PPPMIntel::make_rho<float,double,1>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::make_rho<float,double,1>(IntelBuffers<float,double> *buffers);
template void PPPMIntel::make_rho<double,double,1>(IntelBuffers<double,double> *buffers);
template void PPPMIntel::make_rho<float,float,1>(IntelBuffers<float,float> *buffers);