Merge branch 'develop' into amoeba-ak
This commit is contained in:
47
src/.gitignore
vendored
47
src/.gitignore
vendored
@ -37,6 +37,12 @@
|
||||
/library_mdi.h
|
||||
/mdi_engine.cpp
|
||||
/mdi_engine.h
|
||||
/fix_mdi_aimd.cpp
|
||||
/fix_mdi_aimd.h
|
||||
/mdi_command.cpp
|
||||
/mdi_command.h
|
||||
/mdi_plugin.cpp
|
||||
/mdi_plugin.h
|
||||
|
||||
/fix_brownian*.cpp
|
||||
/fix_brownian*.h
|
||||
@ -269,6 +275,32 @@
|
||||
/pair_bpm_spring.cpp
|
||||
/pair_bpm_spring.h
|
||||
|
||||
/boundary_correction.cpp
|
||||
/boundary_correction.h
|
||||
/electrode_accel_interface.h
|
||||
/electrode_kspace.h
|
||||
/electrode_math.h
|
||||
/electrode_matrix.cpp
|
||||
/electrode_matrix.h
|
||||
/electrode_vector.cpp
|
||||
/electrode_vector.h
|
||||
/ewald_electrode.cpp
|
||||
/ewald_electrode.h
|
||||
/fix_electrode_conp.cpp
|
||||
/fix_electrode_conp.h
|
||||
/fix_electrode_conq.cpp
|
||||
/fix_electrode_conq.h
|
||||
/fix_electrode_thermo.cpp
|
||||
/fix_electrode_thermo.h
|
||||
/pppm_electrode.cpp
|
||||
/pppm_electrode.h
|
||||
/slab_2d.cpp
|
||||
/slab_2d.h
|
||||
/slab_dipole.cpp
|
||||
/slab_dipole.h
|
||||
/wire_dipole.cpp
|
||||
/wire_dipole.h
|
||||
|
||||
/compute_adf.cpp
|
||||
/compute_adf.h
|
||||
/compute_contact_atom.cpp
|
||||
@ -579,6 +611,7 @@
|
||||
/dihedral_table_cut.h
|
||||
/dump_atom_adios.cpp
|
||||
/dump_atom_adios.h
|
||||
/adios_common.h
|
||||
/dump_atom_gz.cpp
|
||||
/dump_atom_gz.h
|
||||
/dump_atom_zstd.cpp
|
||||
@ -627,6 +660,7 @@
|
||||
/ewald.h
|
||||
/ewald_cg.cpp
|
||||
/ewald_cg.h
|
||||
/ewald_const.h
|
||||
/ewald_dipole.cpp
|
||||
/ewald_dipole.h
|
||||
/ewald_dipole_spin.cpp
|
||||
@ -671,6 +705,8 @@
|
||||
/fix_client_md.h
|
||||
/fix_cmap.cpp
|
||||
/fix_cmap.h
|
||||
/fix_damping_cundall.cpp
|
||||
/fix_damping_cundall.h
|
||||
/fix_dpd_energy.cpp
|
||||
/fix_dpd_energy.h
|
||||
/fix_electron_stopping.cpp
|
||||
@ -727,6 +763,7 @@
|
||||
/fix_langevin_eff.h
|
||||
/fix_latte.cpp
|
||||
/fix_latte.h
|
||||
/latboltz_const.h
|
||||
/fix_lb_fluid.cpp
|
||||
/fix_lb_fluid.h
|
||||
/fix_lb_momentum.cpp
|
||||
@ -888,6 +925,8 @@
|
||||
/fix_ti_spring.h
|
||||
/fix_tune_kspace.cpp
|
||||
/fix_tune_kspace.h
|
||||
/fix_viscous_sphere.cpp
|
||||
/fix_viscous_sphere.h
|
||||
/fix_wall_body_polygon.cpp
|
||||
/fix_wall_body_polygon.h
|
||||
/fix_wall_body_polyhedron.cpp
|
||||
@ -1097,6 +1136,8 @@
|
||||
/pair_ilp_graphene_hbn_opt.h
|
||||
/pair_ilp_tmd.cpp
|
||||
/pair_ilp_tmd.h
|
||||
/pair_ilp_tmd_opt.cpp
|
||||
/pair_ilp_tmd_opt.h
|
||||
/pair_kolmogorov_crespi_full.cpp
|
||||
/pair_kolmogorov_crespi_full.h
|
||||
/pair_kolmogorov_crespi_z.cpp
|
||||
@ -1232,6 +1273,8 @@
|
||||
/pair_resquared.h
|
||||
/pair_saip_metal.cpp
|
||||
/pair_saip_metal.h
|
||||
/pair_saip_metal_opt.cpp
|
||||
/pair_saip_metal_opt.h
|
||||
/pair_sdpd_taitwater_isothermal.cpp
|
||||
/pair_sdpd_taitwater_isothermal.h
|
||||
/pair_sph_heatconduction.cpp
|
||||
@ -1537,6 +1580,10 @@
|
||||
/pair_mgpt.h
|
||||
/pair_morse_smooth_linear.cpp
|
||||
/pair_morse_smooth_linear.h
|
||||
/pair_smatb.cpp
|
||||
/pair_smatb.h
|
||||
/pair_smatb_single.cpp
|
||||
/pair_smatb_single.h
|
||||
/pair_smtbq.cpp
|
||||
/pair_smtbq.h
|
||||
/pair_vashishta*.cpp
|
||||
|
||||
@ -35,7 +35,7 @@ namespace LAMMPS_NS {
|
||||
class DumpAtomADIOSInternal {
|
||||
|
||||
public:
|
||||
DumpAtomADIOSInternal(){};
|
||||
DumpAtomADIOSInternal() = default;
|
||||
~DumpAtomADIOSInternal() = default;
|
||||
|
||||
// name of adios group, referrable in adios2_config.xml
|
||||
|
||||
@ -40,7 +40,7 @@ namespace LAMMPS_NS {
|
||||
class DumpCustomADIOSInternal {
|
||||
|
||||
public:
|
||||
DumpCustomADIOSInternal(){};
|
||||
DumpCustomADIOSInternal() = default;
|
||||
~DumpCustomADIOSInternal() = default;
|
||||
|
||||
// name of adios group, referrable in adios2_config.xml
|
||||
@ -76,7 +76,7 @@ DumpCustomADIOS::DumpCustomADIOS(LAMMPS *lmp, int narg, char **arg) : DumpCustom
|
||||
}
|
||||
|
||||
internal->columnNames.reserve(nfield);
|
||||
for (int i = 0; i < nfield; ++i) { internal->columnNames.push_back(earg[i]); }
|
||||
for (int i = 0; i < nfield; ++i) { internal->columnNames.emplace_back(earg[i]); }
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -41,7 +41,7 @@ namespace LAMMPS_NS {
|
||||
class ReadADIOSInternal {
|
||||
|
||||
public:
|
||||
ReadADIOSInternal(){};
|
||||
ReadADIOSInternal() = default;
|
||||
~ReadADIOSInternal() = default;
|
||||
|
||||
// name of adios group, referrable in adios2_config.xml
|
||||
|
||||
@ -61,7 +61,7 @@ AtomVecBPMSphere::AtomVecBPMSphere(LAMMPS *_lmp) : AtomVec(_lmp)
|
||||
fields_data_vel = {"id", "v", "omega"};
|
||||
|
||||
bond_per_atom = 0;
|
||||
bond_negative = NULL;
|
||||
bond_negative = nullptr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include "memory.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
|
||||
@ -70,8 +70,7 @@ void FixBrownian::initial_integrate(int /*vflag */)
|
||||
initial_integrate_templated<1, 0, 0>();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -127,5 +126,4 @@ template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D> void FixBrownian::initial_int
|
||||
v[i][2] = dz / dt;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,8 +157,7 @@ void FixBrownianAsphere::initial_integrate(int /*vflag */)
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -298,5 +297,4 @@ void FixBrownianAsphere::initial_integrate_templated()
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +85,7 @@ void FixBrownianSphere::initial_integrate(int /*vflag */)
|
||||
initial_integrate_templated<1, 0, 0, 0>();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -27,35 +27,6 @@
|
||||
|
||||
#define HASH_FAIL -1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// local helper functions
|
||||
|
||||
// safely move filename to filename.extension
|
||||
static int my_backup_file(const char *filename, const char *extension)
|
||||
{
|
||||
struct stat sbuf;
|
||||
if (stat(filename, &sbuf) == 0) {
|
||||
if (!extension) extension = ".BAK";
|
||||
char *backup = new char[strlen(filename)+strlen(extension)+1];
|
||||
strcpy(backup, filename);
|
||||
strcat(backup, extension);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
remove(backup);
|
||||
#endif
|
||||
if (rename(filename,backup)) {
|
||||
char *sys_err_msg = strerror(errno);
|
||||
if (!sys_err_msg) sys_err_msg = (char *) "(unknown error)";
|
||||
fprintf(stderr,"Error renaming file %s to %s: %s\n",
|
||||
filename, backup, sys_err_msg);
|
||||
delete [] backup;
|
||||
return COLVARS_ERROR;
|
||||
}
|
||||
delete [] backup;
|
||||
}
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
|
||||
const char *inp_name,
|
||||
@ -75,10 +46,6 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
|
||||
t_target=temp;
|
||||
do_exit=false;
|
||||
|
||||
// User-scripted forces are not available in LAMMPS
|
||||
force_script_defined = false;
|
||||
have_scripts = false;
|
||||
|
||||
// set input restart name and strip the extension, if present
|
||||
input_prefix_str = std::string(inp_name ? inp_name : "");
|
||||
if (input_prefix_str.rfind(".colvars.state") != std::string::npos)
|
||||
@ -130,6 +97,9 @@ void colvarproxy_lammps::init(const char *conf_file)
|
||||
cvm::log("Using LAMMPS interface, version "+
|
||||
cvm::to_str(COLVARPROXY_VERSION)+".\n");
|
||||
|
||||
colvars->cite_feature("LAMMPS engine");
|
||||
colvars->cite_feature("Colvars-LAMMPS interface");
|
||||
|
||||
my_angstrom = _lmp->force->angstrom;
|
||||
// Front-end unit is the same as back-end
|
||||
angstrom_value = my_angstrom;
|
||||
@ -179,10 +149,6 @@ int colvarproxy_lammps::read_state_file(char const *state_filename)
|
||||
colvarproxy_lammps::~colvarproxy_lammps()
|
||||
{
|
||||
delete _random;
|
||||
if (colvars != nullptr) {
|
||||
delete colvars;
|
||||
colvars = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// re-initialize data where needed
|
||||
@ -339,17 +305,6 @@ int colvarproxy_lammps::set_unit_system(std::string const &units_in, bool /*chec
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_lammps::backup_file(char const *filename)
|
||||
{
|
||||
if (std::string(filename).rfind(std::string(".colvars.state"))
|
||||
!= std::string::npos) {
|
||||
return my_backup_file(filename, ".old");
|
||||
} else {
|
||||
return my_backup_file(filename, ".BAK");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// multi-replica support
|
||||
|
||||
int colvarproxy_lammps::replica_enabled()
|
||||
@ -414,8 +369,8 @@ int colvarproxy_lammps::check_atom_id(int atom_number)
|
||||
// TODO add upper boundary check?
|
||||
if ((aid < 0)) {
|
||||
cvm::error("Error: invalid atom number specified, "+
|
||||
cvm::to_str(atom_number)+"\n", INPUT_ERROR);
|
||||
return INPUT_ERROR;
|
||||
cvm::to_str(atom_number)+"\n", COLVARS_INPUT_ERROR);
|
||||
return COLVARS_INPUT_ERROR;
|
||||
}
|
||||
|
||||
return aid;
|
||||
|
||||
@ -101,10 +101,7 @@ class colvarproxy_lammps : public colvarproxy {
|
||||
void log(std::string const &message) override;
|
||||
void error(std::string const &message) override;
|
||||
|
||||
cvm::rvector position_distance(cvm::atom_pos const &pos1,
|
||||
cvm::atom_pos const &pos2) const override;
|
||||
|
||||
int backup_file(char const *filename) override;
|
||||
cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const override;
|
||||
|
||||
cvm::real rand_gaussian(void) override { return _random->gaussian(); };
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#ifndef COLVARPROXY_VERSION
|
||||
#define COLVARPROXY_VERSION "2021-03-02"
|
||||
#define COLVARPROXY_VERSION "2022-05-09"
|
||||
#endif
|
||||
|
||||
@ -38,23 +38,14 @@
|
||||
#include "universe.h"
|
||||
#include "update.h"
|
||||
|
||||
#include "colvarproxy_lammps.h"
|
||||
#include "colvarmodule.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "colvarproxy_lammps.h"
|
||||
#include "colvarmodule.h"
|
||||
|
||||
static const char colvars_pub[] =
|
||||
"fix colvars command:\n\n"
|
||||
"@Article{fiorin13,\n"
|
||||
" author = {G.~Fiorin and M.{\\,}L.~Klein and J.~H{\\'e}nin},\n"
|
||||
" title = {Using collective variables to drive molecular"
|
||||
" dynamics simulations},\n"
|
||||
" journal = {Mol.~Phys.},\n"
|
||||
" year = 2013,\n"
|
||||
" note = {doi: 10.1080/00268976.2013.813594}\n"
|
||||
"}\n\n";
|
||||
|
||||
/* struct for packed data communication of coordinates and forces. */
|
||||
struct LAMMPS_NS::commdata {
|
||||
@ -349,8 +340,6 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
/* storage required to communicate a single coordinate or force. */
|
||||
size_one = sizeof(struct commdata);
|
||||
|
||||
if (lmp->citeme) lmp->citeme->add(colvars_pub);
|
||||
}
|
||||
|
||||
/*********************************
|
||||
@ -978,6 +967,9 @@ void FixColvars::post_run()
|
||||
{
|
||||
if (me == 0) {
|
||||
proxy->post_run();
|
||||
if (lmp->citeme) {
|
||||
lmp->citeme->add(proxy->colvars->feature_report(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
GzFileWriter::GzFileWriter() : FileWriter(), compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
|
||||
GzFileWriter::GzFileWriter() : compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ZstdFileWriter::ZstdFileWriter() :
|
||||
FileWriter(), compression_level(0), checksum_flag(1), cctx(nullptr), fp(nullptr)
|
||||
compression_level(0), checksum_flag(1), cctx(nullptr), fp(nullptr)
|
||||
{
|
||||
out_buffer_size = ZSTD_CStreamOutSize();
|
||||
out_buffer = new char[out_buffer_size];
|
||||
|
||||
@ -92,6 +92,6 @@ void AtomVecDPD::data_atom_post(int ilocal)
|
||||
uCG[ilocal] = 0.0;
|
||||
uCGnew[ilocal] = 0.0;
|
||||
|
||||
if (dpdTheta[ilocal] <= 0)
|
||||
error->one(FLERR, "Internal temperature in Atoms section of date file must be > zero");
|
||||
if (dpdTheta[ilocal] <= 0.0)
|
||||
error->one(FLERR, "Internal temperature theta in Atoms section of data file must be > 0.0");
|
||||
}
|
||||
|
||||
@ -1109,8 +1109,7 @@ void FixRX::rkf45_step (const int neq, const double h, double y[], double y_out[
|
||||
y_out[k] = y[k] + r4;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/,
|
||||
const double hmin, const double hmax,
|
||||
@ -1422,8 +1421,6 @@ void FixRX::odeDiagnostics()
|
||||
// Reset the counters.
|
||||
for (int i = 0; i < numDiagnosticCounters; ++i)
|
||||
diagnosticCounter[i] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[])
|
||||
|
||||
@ -111,7 +111,7 @@ int es_rand(es_RNG_t &state_)
|
||||
LAMMPS_INLINE
|
||||
double es_drand(es_RNG_t &state_)
|
||||
{
|
||||
return 1.0 * es_urand64(state_) / MAX_URAND64;
|
||||
return static_cast<double>(es_urand64(state_)) / static_cast<double>(MAX_URAND64);
|
||||
}
|
||||
|
||||
//Marsaglia polar method for drawing a standard normal distributed random number
|
||||
|
||||
@ -78,6 +78,10 @@ if (test $1 = "DPD-BASIC") then
|
||||
depend INTEL
|
||||
fi
|
||||
|
||||
if (test $1 = "ELECTRODE") then
|
||||
depend INTEL
|
||||
fi
|
||||
|
||||
if (test $1 = "EXTRA-COMPUTE") then
|
||||
depend KOKKOS
|
||||
fi
|
||||
@ -150,6 +154,10 @@ if (test $1 = "RIGID") then
|
||||
depend DPD-SMOOTH
|
||||
fi
|
||||
|
||||
if (test $1 = "ML-PACE") then
|
||||
depend KOKKOS
|
||||
fi
|
||||
|
||||
if (test $1 = "ML-SNAP") then
|
||||
depend KOKKOS
|
||||
depend ML-IAP
|
||||
|
||||
67
src/ELECTRODE/Install.sh
Executable file
67
src/ELECTRODE/Install.sh
Executable file
@ -0,0 +1,67 @@
|
||||
# Install/unInstall package files in LAMMPS
|
||||
# mode = 0/1/2 for uninstall/install/update
|
||||
|
||||
# this is default Install.sh for all packages
|
||||
# if package has an auxiliary library or a file with a dependency,
|
||||
# then package dir has its own customized Install.sh
|
||||
|
||||
mode=$1
|
||||
|
||||
# enforce using portable C locale
|
||||
LC_ALL=C
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
91
src/ELECTRODE/boundary_correction.cpp
Normal file
91
src/ELECTRODE/boundary_correction.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "boundary_correction.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
// use EW3DC slab correction
|
||||
//
|
||||
BoundaryCorrection::BoundaryCorrection(LAMMPS *lmp) : Pointers(lmp) {}
|
||||
|
||||
void BoundaryCorrection::setup(double x, double y, double z)
|
||||
{
|
||||
xprd_wire = x;
|
||||
yprd_wire = y;
|
||||
zprd_slab = z;
|
||||
volume = x * y * z;
|
||||
area = x * y;
|
||||
qqrd2e = force->qqrd2e;
|
||||
scale = 1.0;
|
||||
}
|
||||
void BoundaryCorrection::setup(double x, double y, double z, double g)
|
||||
{
|
||||
xprd_wire = x;
|
||||
yprd_wire = y;
|
||||
zprd_slab = z;
|
||||
volume = x * y * z;
|
||||
area = x * y;
|
||||
qqrd2e = force->qqrd2e;
|
||||
scale = 1.0;
|
||||
g_ewald = g;
|
||||
}
|
||||
|
||||
std::vector<int> BoundaryCorrection::gather_recvcounts(int n)
|
||||
{
|
||||
int const nprocs = comm->nprocs;
|
||||
std::vector<int> recvcounts = std::vector<int>(nprocs);
|
||||
MPI_Allgather(&n, 1, MPI_INT, &recvcounts.front(), 1, MPI_INT, world);
|
||||
return recvcounts;
|
||||
}
|
||||
|
||||
std::vector<int> BoundaryCorrection::gather_displs(const std::vector<int> &recvcounts)
|
||||
{
|
||||
int const nprocs = comm->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;
|
||||
}
|
||||
|
||||
std::vector<bigint> BoundaryCorrection::gather_jmat(bigint *imat)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
bigint ngroup = 0;
|
||||
int ngrouplocal = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (imat[i] > -1) ngrouplocal++;
|
||||
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
|
||||
|
||||
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
|
||||
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;
|
||||
}
|
||||
49
src/ELECTRODE/boundary_correction.h
Normal file
49
src/ELECTRODE/boundary_correction.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_BOUNDARY_CORRECTION_H
|
||||
#define LMP_BOUNDARY_CORRECTION_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class BoundaryCorrection : protected Pointers {
|
||||
public:
|
||||
BoundaryCorrection(LAMMPS *);
|
||||
virtual void vector_corr(double *, int, int, bool){};
|
||||
virtual void matrix_corr(bigint *, double **){};
|
||||
virtual void compute_corr(double, int, int, double &, double *){};
|
||||
void setup(double, double, double);
|
||||
void setup(double, double, double, double);
|
||||
|
||||
protected:
|
||||
double area;
|
||||
double volume;
|
||||
double xprd_wire;
|
||||
double yprd_wire;
|
||||
double zprd_slab;
|
||||
double qqrd2e;
|
||||
double scale;
|
||||
double g_ewald;
|
||||
|
||||
std::vector<bigint> gather_jmat(bigint *);
|
||||
std::vector<int> gather_recvcounts(int);
|
||||
std::vector<int> gather_displs(const std::vector<int> &);
|
||||
};
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
33
src/ELECTRODE/electrode_accel_interface.h
Normal file
33
src/ELECTRODE/electrode_accel_interface.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_ACCEL_INTERFACE_H
|
||||
#define LMP_ELECTRODE_ACCEL_INTERFACE_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ElectrodeAccelInterface : protected Pointers {
|
||||
public:
|
||||
ElectrodeAccelInterface(class LAMMPS *lmp) : Pointers(lmp) {}
|
||||
virtual void intel_find_fix() {}
|
||||
virtual void intel_pack_buffers() {}
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
33
src/ELECTRODE/electrode_kspace.h
Normal file
33
src/ELECTRODE/electrode_kspace.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_KSPACE_H
|
||||
#define LMP_ELECTRODE_KSPACE_H
|
||||
|
||||
#include "lmptype.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
class ElectrodeKSpace {
|
||||
public:
|
||||
virtual void compute_vector(double *, int, int, bool) = 0;
|
||||
virtual void compute_vector_corr(double *, int, int, bool) = 0;
|
||||
virtual void compute_matrix(bigint *, double **, bool) = 0;
|
||||
virtual void compute_matrix_corr(bigint *, double **) = 0;
|
||||
};
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
58
src/ELECTRODE/electrode_math.h
Normal file
58
src/ELECTRODE/electrode_math.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_MATH_H
|
||||
#define LMP_ELECTRODE_MATH_H
|
||||
|
||||
#include "math_const.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
namespace ElectrodeMath {
|
||||
static constexpr double EWALD_P = 0.3275911;
|
||||
static constexpr double A1 = 0.254829592;
|
||||
static constexpr double A2 = -0.284496736;
|
||||
static constexpr double A3 = 1.421413741;
|
||||
static constexpr double A4 = -1.453152027;
|
||||
static constexpr double A5 = 1.061405429;
|
||||
static constexpr double ERFCMAX = 5.8; // erfc(ERFCMAX) < machine epsilon(double)
|
||||
|
||||
static double safe_erfc(double x)
|
||||
{
|
||||
if (x > ERFCMAX) return 0.;
|
||||
double expm2 = exp(-x * x);
|
||||
double t = 1.0 / (1.0 + EWALD_P * x);
|
||||
return t * (A1 + t * (A2 + t * (A3 + t * (A4 + t * A5)))) * expm2;
|
||||
}
|
||||
|
||||
static double safe_derfcr(double x, double &erfc)
|
||||
{
|
||||
if (x > ERFCMAX) {
|
||||
erfc = 0.;
|
||||
return 0.;
|
||||
}
|
||||
double x2 = x * x;
|
||||
double expm2 = exp(-x2);
|
||||
double t = 1.0 / (1.0 + EWALD_P * x);
|
||||
erfc = t * (A1 + t * (A2 + t * (A3 + t * (A4 + t * A5)))) * expm2;
|
||||
return -erfc - 2 * expm2 * x / MathConst::MY_PIS;
|
||||
}
|
||||
} // namespace ElectrodeMath
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
205
src/ELECTRODE/electrode_matrix.cpp
Normal file
205
src/ELECTRODE/electrode_matrix.cpp
Normal file
@ -0,0 +1,205 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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_matrix.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "electrode_kspace.h"
|
||||
#include "electrode_math.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "kspace.h"
|
||||
#include "math_const.h"
|
||||
#include "neigh_list.h"
|
||||
#include "pair.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ElectrodeMatrix::ElectrodeMatrix(LAMMPS *lmp, int electrode_group, double eta) : Pointers(lmp)
|
||||
{
|
||||
igroup = electrode_group; // group of all electrode atoms
|
||||
groupbit = group->bitmask[igroup];
|
||||
ngroup = group->count(igroup);
|
||||
this->eta = eta;
|
||||
tfflag = false;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::setup(const std::unordered_map<tagint, int> &tag_ids, class Pair *fix_pair,
|
||||
class NeighList *fix_neighlist)
|
||||
{
|
||||
pair = fix_pair;
|
||||
cutsq = pair->cutsq;
|
||||
list = fix_neighlist;
|
||||
|
||||
electrode_kspace = dynamic_cast<ElectrodeKSpace *>(force->kspace);
|
||||
if (electrode_kspace == nullptr) error->all(FLERR, "KSpace does not implement ElectrodeKSpace");
|
||||
g_ewald = force->kspace->g_ewald;
|
||||
|
||||
tag_to_iele = tag_ids;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::setup_tf(const std::map<int, double> &tf_types)
|
||||
{
|
||||
tfflag = true;
|
||||
this->tf_types = tf_types;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::compute_array(double **array, bool timer_flag)
|
||||
{
|
||||
// setting all entries of coulomb matrix to zero
|
||||
size_t nbytes = sizeof(double) * ngroup * ngroup;
|
||||
if (nbytes) memset(&array[0][0], 0, nbytes);
|
||||
|
||||
MPI_Barrier(world);
|
||||
double kspace_time = MPI_Wtime();
|
||||
update_mpos();
|
||||
electrode_kspace->compute_matrix(&mpos[0], array, timer_flag);
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("KSpace time: {:.4g} s\n", MPI_Wtime() - kspace_time));
|
||||
pair_contribution(array);
|
||||
self_contribution(array);
|
||||
electrode_kspace->compute_matrix_corr(&mpos[0], array);
|
||||
if (tfflag) tf_contribution(array);
|
||||
|
||||
// reduce coulomb matrix with contributions from all procs
|
||||
// all procs need to know full matrix for matrix inversion
|
||||
for (int i = 0; i < ngroup; i++) {
|
||||
MPI_Allreduce(MPI_IN_PLACE, &array[i][0], ngroup, MPI_DOUBLE, MPI_SUM, world);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::pair_contribution(double **array)
|
||||
{
|
||||
int inum, jnum, itype, jtype;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz;
|
||||
double r, rinv, rsq, aij;
|
||||
int *ilist, *jlist, *numneigh, **firstneigh;
|
||||
|
||||
double **x = atom->x;
|
||||
tagint *tag = atom->tag;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
double etaij = eta * eta / sqrt(2.0 * eta * eta); // see mw ewald theory eq. (29)-(30)
|
||||
|
||||
// neighbor list will be ready because called from post_neighbor
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
// skip if I,J are not in 2 groups
|
||||
|
||||
for (int ii = 0; ii < inum; ii++) {
|
||||
int i = ilist[ii];
|
||||
// skip if atom I is not in either group
|
||||
if (!(mask[i] & groupbit)) continue;
|
||||
|
||||
bigint const ipos = mpos[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
// real-space part of matrix is symmetric
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
if (!(mask[j] & groupbit)) continue;
|
||||
|
||||
delx = xtmp - x[j][0]; // neighlists take care of pbc
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
rinv = 1.0 / r;
|
||||
aij = rinv;
|
||||
aij *= ElectrodeMath::safe_erfc(g_ewald * r);
|
||||
aij -= ElectrodeMath::safe_erfc(etaij * r) * rinv;
|
||||
// newton on or off?
|
||||
if (!(newton_pair || j < nlocal)) aij *= 0.5;
|
||||
bigint jpos = tag_to_iele[tag[j]];
|
||||
array[ipos][jpos] += aij;
|
||||
array[jpos][ipos] += aij;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::self_contribution(double **array)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
int *mask = atom->mask;
|
||||
|
||||
const double selfint = 2.0 / MY_PIS * g_ewald;
|
||||
const double preta = MY_SQRT2 / MY_PIS;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) { array[mpos[i]][mpos[i]] += preta * eta - selfint; }
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::tf_contribution(double **array)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) array[mpos[i]][mpos[i]] += tf_types[type[i]];
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeMatrix::update_mpos()
|
||||
{
|
||||
int const nall = atom->nlocal + atom->nghost;
|
||||
tagint *tag = atom->tag;
|
||||
int *mask = atom->mask;
|
||||
mpos = std::vector<bigint>(nall, -1);
|
||||
|
||||
for (int i = 0; i < nall; i++) {
|
||||
if (mask[i] & groupbit)
|
||||
mpos[i] = tag_to_iele[tag[i]];
|
||||
else
|
||||
mpos[i] = -1;
|
||||
}
|
||||
}
|
||||
58
src/ELECTRODE/electrode_matrix.h
Normal file
58
src/ELECTRODE/electrode_matrix.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_MATRIX_H
|
||||
#define LMP_ELECTRODE_MATRIX_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ElectrodeMatrix : protected Pointers {
|
||||
public:
|
||||
ElectrodeMatrix(class LAMMPS *, int, double);
|
||||
void setup(const std::unordered_map<tagint, int> &, class Pair *, class NeighList *);
|
||||
void setup_tf(const std::map<int, double> &);
|
||||
void compute_array(double **, bool);
|
||||
int igroup;
|
||||
|
||||
private:
|
||||
int groupbit;
|
||||
bigint ngroup;
|
||||
double **cutsq;
|
||||
double g_ewald, eta;
|
||||
bool tfflag;
|
||||
std::map<int, double> tf_types;
|
||||
std::unordered_map<tagint, int> tag_to_iele;
|
||||
bool assigned;
|
||||
std::vector<bigint> mpos;
|
||||
class Pair *pair;
|
||||
class NeighList *list;
|
||||
class ElectrodeKSpace *electrode_kspace;
|
||||
|
||||
void update_mpos();
|
||||
void pair_contribution(double **);
|
||||
void self_contribution(double **);
|
||||
void tf_contribution(double **);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
152
src/ELECTRODE/electrode_vector.cpp
Normal file
152
src/ELECTRODE/electrode_vector.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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_vector.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "electrode_kspace.h"
|
||||
#include "electrode_math.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "kspace.h"
|
||||
#include "neigh_list.h"
|
||||
#include "pair.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ElectrodeVector::ElectrodeVector(LAMMPS *lmp, int sensor_group, int source_group, double eta,
|
||||
bool invert_source) :
|
||||
Pointers(lmp)
|
||||
{
|
||||
igroup = sensor_group; // group of all atoms at which we calculate potential
|
||||
this->source_group = source_group; // group of all atoms influencing potential
|
||||
this->invert_source = invert_source;
|
||||
groupbit = group->bitmask[igroup];
|
||||
ngroup = group->count(igroup);
|
||||
source_grpbit = group->bitmask[source_group];
|
||||
this->eta = eta;
|
||||
|
||||
kspace_time_total = 0;
|
||||
pair_time_total = 0;
|
||||
boundary_time_total = 0;
|
||||
b_time_total = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ElectrodeVector::~ElectrodeVector()
|
||||
{
|
||||
if (timer_flag && (comm->me == 0)) {
|
||||
utils::logmesg(lmp, fmt::format("B time: {:.4g} s\n", b_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B kspace time: {:.4g} s\n", kspace_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B pair time: {:.4g} s\n", pair_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B boundary time: {:.4g} s\n", boundary_time_total));
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeVector::setup(class Pair *fix_pair, class NeighList *fix_neighlist, bool timer_flag)
|
||||
{
|
||||
pair = fix_pair;
|
||||
cutsq = pair->cutsq;
|
||||
list = fix_neighlist;
|
||||
this->timer_flag = timer_flag;
|
||||
|
||||
electrode_kspace = dynamic_cast<ElectrodeKSpace *>(force->kspace);
|
||||
if (electrode_kspace == nullptr) error->all(FLERR, "KSpace does not implement ElectrodeKSpace");
|
||||
g_ewald = force->kspace->g_ewald;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeVector::compute_vector(double *vector)
|
||||
{
|
||||
MPI_Barrier(world);
|
||||
double start_time = MPI_Wtime();
|
||||
// pair
|
||||
double pair_start_time = MPI_Wtime();
|
||||
pair_contribution(vector);
|
||||
MPI_Barrier(world);
|
||||
pair_time_total += MPI_Wtime() - pair_start_time;
|
||||
// kspace
|
||||
double kspace_start_time = MPI_Wtime();
|
||||
electrode_kspace->compute_vector(vector, groupbit, source_grpbit, invert_source);
|
||||
MPI_Barrier(world);
|
||||
kspace_time_total += MPI_Wtime() - kspace_start_time;
|
||||
// boundary
|
||||
double boundary_start_time = MPI_Wtime();
|
||||
electrode_kspace->compute_vector_corr(vector, groupbit, source_grpbit, invert_source);
|
||||
MPI_Barrier(world);
|
||||
boundary_time_total += MPI_Wtime() - boundary_start_time;
|
||||
b_time_total += MPI_Wtime() - start_time;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ElectrodeVector::pair_contribution(double *vector)
|
||||
{
|
||||
double **x = atom->x;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
// neighbor list will be ready because called from post_neighbor
|
||||
int const nlocal = atom->nlocal;
|
||||
int const inum = list->inum;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
for (int ii = 0; ii < inum; ii++) {
|
||||
int const i = ilist[ii];
|
||||
bool const i_in_sensor = (mask[i] & groupbit);
|
||||
bool const i_in_source = !!(mask[i] & source_grpbit) != invert_source;
|
||||
double const xtmp = x[i][0];
|
||||
double const ytmp = x[i][1];
|
||||
double const ztmp = x[i][2];
|
||||
int itype = type[i];
|
||||
int *jlist = firstneigh[i];
|
||||
int jnum = numneigh[i];
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int const j = jlist[jj] & NEIGHMASK;
|
||||
bool const j_in_sensor = (mask[j] & groupbit);
|
||||
bool const j_in_source = !!(mask[j] & source_grpbit) != invert_source;
|
||||
bool const compute_ij = i_in_sensor && j_in_source;
|
||||
bool const compute_ji = (newton_pair || j < nlocal) && (j_in_sensor && i_in_source);
|
||||
if (!(compute_ij || compute_ji)) continue;
|
||||
double const delx = xtmp - x[j][0]; // neighlists take care of pbc
|
||||
double const dely = ytmp - x[j][1];
|
||||
double const delz = ztmp - x[j][2];
|
||||
double const rsq = delx * delx + dely * dely + delz * delz;
|
||||
int jtype = type[j];
|
||||
if (rsq >= cutsq[itype][jtype]) continue;
|
||||
double const r = sqrt(rsq);
|
||||
double const rinv = 1.0 / r;
|
||||
double aij = rinv;
|
||||
aij *= ElectrodeMath::safe_erfc(g_ewald * r);
|
||||
aij -= ElectrodeMath::safe_erfc(eta * r) * rinv;
|
||||
if (i_in_sensor) {
|
||||
vector[i] += aij * q[j];
|
||||
} else if (j_in_sensor) {
|
||||
vector[j] += aij * q[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/ELECTRODE/electrode_vector.h
Normal file
55
src/ELECTRODE/electrode_vector.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_VECTOR_H
|
||||
#define LMP_ELECTRODE_VECTOR_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ElectrodeVector : protected Pointers {
|
||||
public:
|
||||
ElectrodeVector(class LAMMPS *, int, int, double, bool);
|
||||
~ElectrodeVector() override;
|
||||
void setup(class Pair *, class NeighList *, bool);
|
||||
void compute_vector(double *);
|
||||
int igroup, source_group;
|
||||
|
||||
private:
|
||||
bool invert_source;
|
||||
int groupbit, source_grpbit;
|
||||
bigint ngroup;
|
||||
double **cutsq;
|
||||
double g_ewald, eta;
|
||||
class Pair *pair;
|
||||
class NeighList *list;
|
||||
class ElectrodeKSpace *electrode_kspace;
|
||||
|
||||
void pair_contribution(double *);
|
||||
|
||||
double kspace_time_total;
|
||||
double pair_time_total;
|
||||
double boundary_time_total;
|
||||
double b_time_total;
|
||||
|
||||
bool timer_flag;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
1157
src/ELECTRODE/ewald_electrode.cpp
Normal file
1157
src/ELECTRODE/ewald_electrode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
61
src/ELECTRODE/ewald_electrode.h
Normal file
61
src/ELECTRODE/ewald_electrode.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef KSPACE_CLASS
|
||||
// clang-format off
|
||||
KSpaceStyle(ewald/electrode, EwaldElectrode);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_EWALD_ELECTRODE_H
|
||||
#define LMP_EWALD_ELECTRODE_H
|
||||
|
||||
#include "electrode_kspace.h"
|
||||
#include "ewald.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class EwaldElectrode : public Ewald, public ElectrodeKSpace {
|
||||
public:
|
||||
EwaldElectrode(class LAMMPS *);
|
||||
~EwaldElectrode() override;
|
||||
void init() override;
|
||||
void setup() override;
|
||||
void compute(int, int) override;
|
||||
void compute_group_group(int, int, int) override;
|
||||
|
||||
// k-space part of coulomb matrix computation
|
||||
void compute_vector(double *, int, int, bool) override;
|
||||
void compute_vector_corr(double *, int, int, bool) override;
|
||||
void compute_matrix(bigint *, double **, bool) override;
|
||||
void compute_matrix_corr(bigint *, double **) override;
|
||||
|
||||
protected:
|
||||
class BoundaryCorrection *boundcorr;
|
||||
double area;
|
||||
void coeffs() override;
|
||||
void eik_dot_r() override;
|
||||
|
||||
private:
|
||||
int eikr_step;
|
||||
void update_eikr(bool);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
1290
src/ELECTRODE/fix_electrode_conp.cpp
Normal file
1290
src/ELECTRODE/fix_electrode_conp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
153
src/ELECTRODE/fix_electrode_conp.h
Normal file
153
src/ELECTRODE/fix_electrode_conp.h
Normal file
@ -0,0 +1,153 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/conp, FixElectrodeConp);
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_CONP_H
|
||||
#define LMP_FIX_ELECTRODE_CONP_H
|
||||
|
||||
#include "electrode_accel_interface.h"
|
||||
#include "fix.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeConp : public Fix {
|
||||
public:
|
||||
FixElectrodeConp(class LAMMPS *, int, char **);
|
||||
~FixElectrodeConp() override;
|
||||
int setmask() override;
|
||||
void setup_pre_exchange() override;
|
||||
void setup_post_neighbor() override;
|
||||
void setup_pre_reverse(int, int) override;
|
||||
void pre_force(int) override;
|
||||
void pre_reverse(int, int) override;
|
||||
double compute_scalar() override;
|
||||
double compute_vector(int) override;
|
||||
int modify_param(int, char **) override;
|
||||
int modify_param(const std::string &);
|
||||
void init() override;
|
||||
void init_list(int, NeighList *) override;
|
||||
void post_constructor() override; // used by ffield to set up fix efield
|
||||
double memory_usage() override;
|
||||
|
||||
// atomvec-based tracking of electrode atoms
|
||||
int pack_exchange(int, double *) override;
|
||||
int unpack_exchange(int, double *) override;
|
||||
|
||||
int pack_reverse_comm(int, int, double *) override;
|
||||
void unpack_reverse_comm(int, int *, double *) override;
|
||||
|
||||
protected:
|
||||
virtual void update_psi();
|
||||
virtual void pre_update(){};
|
||||
virtual void compute_macro_matrices();
|
||||
std::vector<double> group_psi;
|
||||
std::vector<int> group_bits;
|
||||
int num_of_groups;
|
||||
bigint ngroup;
|
||||
std::vector<std::vector<double>> sd_vectors;
|
||||
std::vector<double> sb_charges;
|
||||
std::vector<int> group_psi_var_ids, group_psi_var_styles;
|
||||
std::vector<std::string> group_psi_var_names;
|
||||
bool symm; // symmetrize elastance for charge neutrality
|
||||
std::vector<std::vector<double>> macro_elastance; // used by conq
|
||||
std::vector<std::vector<double>> macro_capacitance; // used by thermo
|
||||
double thermo_temp, thermo_time; // used by electrode/thermo only
|
||||
int thermo_init; // initializer for rng in electrode/thermo
|
||||
bool ffield; // possibly tweak electrode/conq's version
|
||||
std::string fixname; // used by electrode/ffield to set up internal efield
|
||||
bool intelflag;
|
||||
ElectrodeAccelInterface *accel_interface; // used by /intel
|
||||
|
||||
private:
|
||||
FILE *f_inv, *f_mat, *f_vec; // files for capacitance, eleastance and vector
|
||||
std::string input_file_inv, input_file_mat;
|
||||
class ElectrodeMatrix *array_compute;
|
||||
class ElectrodeVector *ele_vector;
|
||||
std::vector<int> groups;
|
||||
double **capacitance;
|
||||
bool read_inv, read_mat;
|
||||
double eta;
|
||||
double update_time, mult_time;
|
||||
void create_taglist();
|
||||
void invert();
|
||||
void symmetrize();
|
||||
double gausscorr(int, bool);
|
||||
void update_charges();
|
||||
double potential_energy(int);
|
||||
double self_energy(int);
|
||||
void write_to_file(FILE *, const std::vector<tagint> &, const std::vector<std::vector<double>> &);
|
||||
void read_from_file(const std::string& input_file, double **, const std::string &);
|
||||
void compute_sd_vectors();
|
||||
void compute_sd_vectors_ffield();
|
||||
std::vector<int> setvars_types, setvars_groups, setvars_vars;
|
||||
void update_setvars(int);
|
||||
int groupnum_from_name(char *);
|
||||
double evscale;
|
||||
class Pair *pair;
|
||||
class NeighList *mat_neighlist, *vec_neighlist;
|
||||
std::vector<int> etypes;
|
||||
int mat_request, vec_request;
|
||||
void request_etypes_neighlists();
|
||||
bool etypes_neighlists;
|
||||
int get_top_group(); // used by ffield
|
||||
int top_group; // used by ffield
|
||||
bool tfflag;
|
||||
bool timer_flag;
|
||||
std::map<int, double> tf_types;
|
||||
|
||||
// fix-specific electrode ID storage system:
|
||||
|
||||
std::vector<tagint> taglist; // global list: all tags in combined electrode group
|
||||
std::vector<tagint> taglist_bygroup; // taglist sorted by group
|
||||
std::vector<tagint> group_idx; // permutation taglist<->taglist_bygroup
|
||||
std::unordered_map<tagint, int> tag_to_iele; // inverse of taglist:
|
||||
std::vector<int> iele_to_group;
|
||||
// tag_to_iele[taglist[iele]] = iele
|
||||
int nlocalele; // current no. of local electrode atoms
|
||||
|
||||
int nlocalele_outdated; // trigger rebuilding of following structures:
|
||||
std::vector<int> list_iele; // electrode IDs owned by me
|
||||
int *recvcounts, *displs; // for MPI-building of iele_gathered
|
||||
int *iele_gathered; // MPIgathered list_iele: all electrode IDs, nproc-ordered
|
||||
std::vector<double> buf_iele; // buffer for electrode properties ordered by list_iele
|
||||
double *buf_gathered; // buffer for MPIgathered buf_iele (NOT YET iele-ordered)
|
||||
double *potential_i; // potentials, i-indexed (0 for non-electrode atoms)
|
||||
double *potential_iele; // potentials ordered by iele
|
||||
double *charge_iele; // charges ordered by iele
|
||||
|
||||
void gather_list_iele(); // build iele_gathered
|
||||
void gather_elevec(double *); // gather buf_iele and rearrange into iele-order
|
||||
void buffer_and_gather(double *, double *); // buffer into buf_iele then gather and rearrange
|
||||
|
||||
int nmax;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
60
src/ELECTRODE/fix_electrode_conq.cpp
Normal file
60
src/ELECTRODE/fix_electrode_conq.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "fix_electrode_conq.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "fix_electrode_conp.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define SMALL 0.00001
|
||||
|
||||
enum { CONST, EQUAL };
|
||||
|
||||
// 0 1 2 3 4
|
||||
// fix fxupdate group1 electrode/conp pot1 eta couple group2 pot2
|
||||
FixElectrodeConq::FixElectrodeConq(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixElectrodeConp(lmp, narg, arg)
|
||||
{
|
||||
// copy const-style values across because update_psi will change group_psi
|
||||
group_q = group_psi;
|
||||
|
||||
if (symm) { error->all(FLERR, "Keyword symm on not allowed in electrode/conq"); }
|
||||
}
|
||||
|
||||
void FixElectrodeConq::update_psi()
|
||||
{
|
||||
// don't need MPI_Barrier because always preceded by MPI_Allreduce
|
||||
for (int g = 0; g < num_of_groups; g++) {
|
||||
if (group_psi_var_styles[g] == CONST) continue;
|
||||
group_q[g] = input->variable->compute_equal(group_psi_var_ids[g]);
|
||||
}
|
||||
|
||||
std::vector<double> group_remainder_q(num_of_groups);
|
||||
for (int g = 0; g < num_of_groups; g++) { group_remainder_q[g] = group_q[g] - sb_charges[g]; }
|
||||
|
||||
for (int g = 0; g < num_of_groups; g++) {
|
||||
double vtmp = 0;
|
||||
for (int h = 0; h < num_of_groups; h++) {
|
||||
vtmp += macro_elastance[g][h] * group_remainder_q[h];
|
||||
}
|
||||
group_psi[g] = vtmp;
|
||||
}
|
||||
}
|
||||
45
src/ELECTRODE/fix_electrode_conq.h
Normal file
45
src/ELECTRODE/fix_electrode_conq.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/conq, FixElectrodeConq);
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_CONQ_H
|
||||
#define LMP_FIX_ELECTRODE_CONQ_H
|
||||
|
||||
#include "fix_electrode_conp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeConq : public FixElectrodeConp {
|
||||
public:
|
||||
FixElectrodeConq(class LAMMPS *, int, char **);
|
||||
void update_psi() override;
|
||||
|
||||
private:
|
||||
std::vector<double> group_q;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
124
src/ELECTRODE/fix_electrode_thermo.cpp
Normal file
124
src/ELECTRODE/fix_electrode_thermo.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "fix_electrode_thermo.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "fix_electrode_conp.h"
|
||||
#include "force.h"
|
||||
#include "input.h"
|
||||
#include "random_mars.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define NUM_GROUPS 2
|
||||
#define SMALL 0.00001
|
||||
|
||||
enum { CONST, EQUAL };
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
// 0 1 2 3 4
|
||||
// fix fxupdate group1 electrode/thermo pot1 eta couple group2 pot2
|
||||
FixElectrodeThermo::FixElectrodeThermo(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixElectrodeConp(lmp, narg, arg)
|
||||
{
|
||||
if (num_of_groups != NUM_GROUPS)
|
||||
error->all(FLERR, "Number of electrodes != two in electrode/thermo");
|
||||
if (group_psi_var_styles[0] != group_psi_var_styles[1])
|
||||
error->all(FLERR, "Potentials in electrode/thermo must have same style");
|
||||
if (symm) error->all(FLERR, "Keyword symm on not allowed in electrode/thermo");
|
||||
if (thermo_time < SMALL) error->all(FLERR, "Keyword temp not set or zero in electrode/thermo");
|
||||
|
||||
thermo_random = new RanMars(lmp, thermo_init);
|
||||
if (group_psi_var_styles[0] == CONST) delta_psi_0 = group_psi[1] - group_psi[0];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
FixElectrodeThermo::~FixElectrodeThermo()
|
||||
{
|
||||
delete thermo_random;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
void FixElectrodeThermo::compute_macro_matrices()
|
||||
{
|
||||
FixElectrodeConp::compute_macro_matrices();
|
||||
vac_cap = (macro_capacitance[0][0] * macro_capacitance[1][1] -
|
||||
macro_capacitance[0][1] * macro_capacitance[0][1]) /
|
||||
(macro_capacitance[0][0] + macro_capacitance[1][1] + 2 * macro_capacitance[0][1]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
void FixElectrodeThermo::pre_update()
|
||||
{
|
||||
// total electrode charges after last step, required for update psi
|
||||
int const nlocal = atom->nlocal;
|
||||
int *mask = atom->mask;
|
||||
double *q = atom->q;
|
||||
for (int g = 0; g < NUM_GROUPS; g++) {
|
||||
group_q_old[g] = 0.;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & group_bits[g]) { group_q_old[g] += q[i]; }
|
||||
}
|
||||
}
|
||||
MPI_Allreduce(MPI_IN_PLACE, &group_q_old, NUM_GROUPS, MPI_DOUBLE, MPI_SUM, world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
void FixElectrodeThermo::update_psi()
|
||||
{
|
||||
double const dt = update->dt;
|
||||
|
||||
// group_q_eff is charge that corresponds to potential after previous step
|
||||
double group_q_eff[NUM_GROUPS] = {0., 0.};
|
||||
for (int g = 0; g < NUM_GROUPS; g++) { group_q_eff[g] = group_q_old[g] - sb_charges[g]; }
|
||||
double group_psi_old[NUM_GROUPS] = {0., 0.};
|
||||
for (int g = 0; g < NUM_GROUPS; g++) {
|
||||
double vtmp = 0;
|
||||
for (int h = 0; h < NUM_GROUPS; h++) { vtmp += macro_elastance[g][h] * group_q_eff[h]; }
|
||||
group_psi_old[g] = vtmp;
|
||||
}
|
||||
double const delta_psi = group_psi_old[1] - group_psi_old[0];
|
||||
|
||||
// target potential difference from input parameters
|
||||
if (group_psi_var_styles[0] != CONST) {
|
||||
delta_psi_0 = input->variable->compute_equal(group_psi_var_ids[1]) -
|
||||
input->variable->compute_equal(group_psi_var_ids[0]);
|
||||
}
|
||||
|
||||
double delta_charge = 0.5 * (group_q_old[1] - group_q_old[0]) -
|
||||
vac_cap * (delta_psi - delta_psi_0) * (1. - exp(-dt / thermo_time));
|
||||
delta_charge += sqrt((thermo_temp * vac_cap) * (1. - exp(-2. * dt / thermo_time))) *
|
||||
thermo_random->gaussian();
|
||||
|
||||
double const group_remainder_q[NUM_GROUPS] = {-delta_charge - sb_charges[0],
|
||||
delta_charge - sb_charges[1]};
|
||||
|
||||
for (int g = 0; g < NUM_GROUPS; g++) {
|
||||
double vtmp = 0;
|
||||
for (int h = 0; h < NUM_GROUPS; h++) { vtmp += macro_elastance[g][h] * group_remainder_q[h]; }
|
||||
group_psi[g] = vtmp;
|
||||
}
|
||||
}
|
||||
52
src/ELECTRODE/fix_electrode_thermo.h
Normal file
52
src/ELECTRODE/fix_electrode_thermo.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/thermo, FixElectrodeThermo);
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_THERMO_H
|
||||
#define LMP_FIX_ELECTRODE_THERMO_H
|
||||
|
||||
#include "fix_electrode_conp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeThermo : public FixElectrodeConp {
|
||||
public:
|
||||
FixElectrodeThermo(class LAMMPS *, int, char **);
|
||||
~FixElectrodeThermo() override;
|
||||
void update_psi() override;
|
||||
void pre_update() override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
void compute_macro_matrices() override;
|
||||
class RanMars *thermo_random;
|
||||
double delta_psi_0;
|
||||
double group_q_old[2];
|
||||
double vac_cap;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
1694
src/ELECTRODE/pppm_electrode.cpp
Normal file
1694
src/ELECTRODE/pppm_electrode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
106
src/ELECTRODE/pppm_electrode.h
Normal file
106
src/ELECTRODE/pppm_electrode.h
Normal file
@ -0,0 +1,106 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef KSPACE_CLASS
|
||||
// clang-format off
|
||||
KSpaceStyle(pppm/electrode, PPPMElectrode);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_PPPM_ELECTRODE_H
|
||||
#define LMP_PPPM_ELECTRODE_H
|
||||
|
||||
#include "electrode_kspace.h"
|
||||
#include "pppm.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PPPMElectrode : public PPPM, public ElectrodeKSpace {
|
||||
public:
|
||||
PPPMElectrode(class LAMMPS *);
|
||||
~PPPMElectrode() override;
|
||||
void init() override;
|
||||
void setup() override;
|
||||
void setup_grid() override;
|
||||
void compute(int, int) override;
|
||||
|
||||
void compute_vector(double *, int, int, bool) override;
|
||||
void compute_vector_corr(double *, int, int, bool) override;
|
||||
void compute_matrix(bigint *, double **, bool) override;
|
||||
void compute_matrix_corr(bigint *, double **) override;
|
||||
|
||||
void compute_group_group(int, int, int) override;
|
||||
|
||||
protected:
|
||||
FFT_SCALAR ***electrolyte_density_brick;
|
||||
FFT_SCALAR *electrolyte_density_fft;
|
||||
class BoundaryCorrection *boundcorr;
|
||||
|
||||
void set_grid_global() override;
|
||||
void set_grid_local() override;
|
||||
|
||||
void allocate() override;
|
||||
void deallocate() override;
|
||||
void allocate_peratom() override;
|
||||
double compute_df_kspace() override;
|
||||
double compute_qopt() override;
|
||||
void compute_gf_ik() override;
|
||||
void compute_gf_ad() override;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
denominator for Hockney-Eastwood Green's function
|
||||
of x,y,z = sin(kx*deltax/2), etc
|
||||
|
||||
inf n-1
|
||||
S(n,k) = Sum W(k+pi*j)**2 = Sum b(l)*(z*z)**l
|
||||
j=-inf l=0
|
||||
|
||||
= -(z*z)**n /(2n-1)! * (d/dx)**(2n-1) cot(x) at z = sin(x)
|
||||
gf_b = denominator expansion coeffs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
inline double gf_denom(const double &x, const double &y, const double &z) const
|
||||
{
|
||||
double sx, sy, sz;
|
||||
sz = sy = sx = 0.0;
|
||||
for (int l = order - 1; l >= 0; l--) {
|
||||
sx = gf_b[l] + sx * x;
|
||||
sy = gf_b[l] + sy * y;
|
||||
sz = gf_b[l] + sz * z;
|
||||
}
|
||||
double s = sx * sy * sz;
|
||||
return s * s;
|
||||
};
|
||||
|
||||
private:
|
||||
int compute_step;
|
||||
int last_source_grpbit;
|
||||
bool last_invert_source;
|
||||
void start_compute();
|
||||
void make_rho_in_brick(int, FFT_SCALAR ***, bool);
|
||||
void project_psi(double *, int);
|
||||
void one_step_multiplication(bigint *, const std::vector<double> &, double **, double **,
|
||||
int const, bool);
|
||||
void two_step_multiplication(bigint *, const std::vector<double> &, double **, double **,
|
||||
int const, bool);
|
||||
bool compute_vector_called;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
167
src/ELECTRODE/slab_2d.cpp
Normal file
167
src/ELECTRODE/slab_2d.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "slab_2d.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Slab-geometry correction term (k=0) of EW2D. See Hu, JCTC 10:12 (2014)
|
||||
pp. 5254-5264 or metalwalls ewald and parallelization documentation.
|
||||
------------------------------------------------------------------------- */
|
||||
Slab2d::Slab2d(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
||||
|
||||
void Slab2d::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, double &energy,
|
||||
double *eatom)
|
||||
{
|
||||
double *q = atom->q;
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
int nlocal = atom->nlocal;
|
||||
bigint natoms = atom->natoms;
|
||||
|
||||
std::vector<double> z = std::vector<double>(nlocal);
|
||||
for (int i = 0; i < nlocal; i++) z[i] = x[i][2];
|
||||
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(),
|
||||
&displs.front(), MPI_DOUBLE, world);
|
||||
|
||||
const double g_ewald_inv = 1.0 / g_ewald;
|
||||
const double qscale = qqrd2e * scale;
|
||||
const double ffact = qscale * MY_2PI / area;
|
||||
const double efact = qscale * MY_PIS / area;
|
||||
double e_keq0 = 0;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
double pot_ij = 0.0;
|
||||
|
||||
for (bigint j = 0; j < natoms; j++) {
|
||||
double const zij = z_all[j] - x[i][2];
|
||||
double const g_zij = g_ewald * zij;
|
||||
|
||||
// coulomb potential; see eq. (4) in metalwalls parallelization doc
|
||||
pot_ij += q_all[j] * (exp(-g_zij * g_zij) * g_ewald_inv + MY_PIS * zij * erf(g_zij));
|
||||
f[i][2] -= ffact * q[i] * q_all[j] * erf(g_zij);
|
||||
}
|
||||
|
||||
// per-atom energy; see eq. (20) in metalwalls ewald doc
|
||||
if (eflag_atom) eatom[i] -= efact * q[i] * pot_ij; // TODO check if 0.5 factor
|
||||
if (eflag_global) e_keq0 -= q[i] * pot_ij;
|
||||
}
|
||||
if (eflag_global) {
|
||||
MPI_Allreduce(MPI_IN_PLACE, &e_keq0, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
energy += efact * e_keq0;
|
||||
}
|
||||
}
|
||||
|
||||
void Slab2d::vector_corr(double *vec, int sensor_grpbit, int source_grpbit, bool invert_source)
|
||||
{
|
||||
int const nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
double *q = atom->q;
|
||||
int *mask = atom->mask;
|
||||
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 (!!(mask[i] & source_grpbit) != invert_source) {
|
||||
z_local.push_back(x[i][2]);
|
||||
q_local.push_back(q[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int n_electrolyte_local = z_local.size();
|
||||
int n_electrolyte;
|
||||
MPI_Allreduce(&n_electrolyte_local, &n_electrolyte, 1, MPI_INT, MPI_SUM, world);
|
||||
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(),
|
||||
&recvcounts.front(), &displs.front(), MPI_DOUBLE, world);
|
||||
double const prefac = 2 * MY_PIS / area;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (!(mask[i] & sensor_grpbit)) continue;
|
||||
double b = 0;
|
||||
double zi = x[i][2];
|
||||
for (size_t j = 0; j < z_all.size(); j++) {
|
||||
double zij = z_all[j] - zi;
|
||||
double gzij = g_ewald * zij;
|
||||
double zfac = (gzij > 7)
|
||||
? MY_PIS * zij
|
||||
: exp(-(gzij * gzij)) / g_ewald + MY_PIS * zij * erf(gzij); // avoid exp underflow
|
||||
b += q_all[j] * zfac;
|
||||
}
|
||||
vec[i] -= prefac * b;
|
||||
}
|
||||
}
|
||||
|
||||
void Slab2d::matrix_corr(bigint *imat, double **matrix)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
|
||||
// how many local and total group atoms?
|
||||
int ngrouplocal = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (imat[i] > -1) ngrouplocal++;
|
||||
bigint ngroup = 0;
|
||||
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
|
||||
|
||||
// gather non-periodic positions of groups
|
||||
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
|
||||
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;
|
||||
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++) {
|
||||
// matrix is symmetric
|
||||
if (jmat[j] > imat[i]) continue;
|
||||
double dij = nprd_all[j] - x[i][2];
|
||||
double aij =
|
||||
prefac * (exp(-dij * dij * g_ewald_sq) * g_ewald_inv + MY_PIS * dij * erf(dij * g_ewald));
|
||||
matrix[imat[i]][jmat[j]] -= aij;
|
||||
if (imat[i] != jmat[j]) matrix[jmat[j]][imat[i]] -= aij;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/ELECTRODE/slab_2d.h
Normal file
35
src/ELECTRODE/slab_2d.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_SLAB_2D_H
|
||||
#define LMP_SLAB_2D_H
|
||||
|
||||
#include "boundary_correction.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class Slab2d : public BoundaryCorrection {
|
||||
public:
|
||||
Slab2d(LAMMPS *);
|
||||
void vector_corr(double *, int, int, bool) override;
|
||||
void matrix_corr(bigint *, double **) override;
|
||||
void compute_corr(double, int, int, double &, double *) override;
|
||||
void setup(double);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
141
src/ELECTRODE/slab_dipole.cpp
Normal file
141
src/ELECTRODE/slab_dipole.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "slab_dipole.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "math_const.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
#define SMALL 0.00001
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Slab-geometry correction term to dampen inter-slab interactions between
|
||||
periodically repeating slabs. Yields good approximation to 2D Ewald if
|
||||
adequate empty space is left between repeating slabs (J. Chem. Phys.
|
||||
111, 3155). Slabs defined here to be parallel to the xy plane. Also
|
||||
extended to non-neutral systems (J. Chem. Phys. 131, 094107).
|
||||
-------------------------------------------------------------------------
|
||||
*/
|
||||
SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
||||
|
||||
void SlabDipole::compute_corr(double qsum, int eflag_atom, int eflag_global, double &energy,
|
||||
double *eatom)
|
||||
{
|
||||
// compute local contribution to global dipole moment
|
||||
double *q = atom->q;
|
||||
double **x = atom->x;
|
||||
double zprd = domain->zprd;
|
||||
int nlocal = atom->nlocal;
|
||||
double dipole = 0.0;
|
||||
for (int i = 0; i < nlocal; i++) dipole += q[i] * x[i][2];
|
||||
|
||||
// sum local contributions to get global dipole moment
|
||||
double dipole_all;
|
||||
MPI_Allreduce(&dipole, &dipole_all, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
|
||||
// need to make non-neutral systems and/or
|
||||
// per-atom energy translationally invariant
|
||||
double dipole_r2 = 0.0;
|
||||
if (eflag_atom || fabs(qsum) > SMALL) {
|
||||
for (int i = 0; i < nlocal; i++) dipole_r2 += q[i] * x[i][2] * x[i][2];
|
||||
// sum local contributions
|
||||
double tmp;
|
||||
MPI_Allreduce(&dipole_r2, &tmp, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
dipole_r2 = tmp;
|
||||
}
|
||||
|
||||
// compute corrections
|
||||
double const e_slabcorr = MY_2PI *
|
||||
(dipole_all * dipole_all - qsum * dipole_r2 - qsum * qsum * zprd * zprd / 12.0) / volume;
|
||||
double const qscale = qqrd2e * scale;
|
||||
if (eflag_global) energy += qscale * e_slabcorr;
|
||||
|
||||
// per-atom energy
|
||||
if (eflag_atom) {
|
||||
double efact = qscale * MY_2PI / volume;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
eatom[i] += efact * q[i] *
|
||||
(x[i][2] * dipole_all - 0.5 * (dipole_r2 + qsum * x[i][2] * x[i][2]) -
|
||||
qsum * zprd * zprd / 12.0);
|
||||
}
|
||||
|
||||
// add on force corrections
|
||||
double const ffact = qscale * (-4.0 * MY_PI / volume);
|
||||
double **f = atom->f;
|
||||
for (int i = 0; i < nlocal; i++) f[i][2] += ffact * q[i] * (dipole_all - qsum * x[i][2]);
|
||||
}
|
||||
|
||||
void SlabDipole::vector_corr(double *vec, int sensor_grpbit, int source_grpbit, bool invert_source)
|
||||
{
|
||||
int const nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
double *q = atom->q;
|
||||
int *mask = atom->mask;
|
||||
double dipole = 0.;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (!!(mask[i] & source_grpbit) != invert_source) dipole += q[i] * x[i][2];
|
||||
}
|
||||
MPI_Allreduce(MPI_IN_PLACE, &dipole, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
dipole *= 4.0 * MY_PI / volume;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & sensor_grpbit) vec[i] += x[i][2] * dipole;
|
||||
}
|
||||
}
|
||||
|
||||
void SlabDipole::matrix_corr(bigint *imat, double **matrix)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
|
||||
// how many local and total group atoms?
|
||||
int ngrouplocal = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (imat[i] > -1) ngrouplocal++;
|
||||
bigint ngroup = 0;
|
||||
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
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;
|
||||
for (bigint j = 0; j < ngroup; j++) {
|
||||
if (jmat[j] > imat[i]) continue; // matrix is symmetric
|
||||
double aij = prefac * x[i][2] * nprd_all[j];
|
||||
matrix[imat[i]][jmat[j]] += aij;
|
||||
if (imat[i] != jmat[j]) matrix[jmat[j]][imat[i]] += aij;
|
||||
}
|
||||
}
|
||||
// TODO add ELC corrections, needs sum over all kpoints but not (0,0)
|
||||
}
|
||||
35
src/ELECTRODE/slab_dipole.h
Normal file
35
src/ELECTRODE/slab_dipole.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_SLAB_DIPOLE_H
|
||||
#define LMP_SLAB_DIPOLE_H
|
||||
|
||||
#include "boundary_correction.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class SlabDipole : public BoundaryCorrection {
|
||||
public:
|
||||
SlabDipole(LAMMPS *);
|
||||
void vector_corr(double *, int, int, bool);
|
||||
void matrix_corr(bigint *, double **);
|
||||
void compute_corr(double, int, int, double &, double *);
|
||||
void setup(double);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
158
src/ELECTRODE/wire_dipole.cpp
Normal file
158
src/ELECTRODE/wire_dipole.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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 "wire_dipole.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "math_const.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Wire-geometry correction term to dampen inter-wire interactions between
|
||||
periodically repeating wires. Yields good approximation to 1D Ewald if
|
||||
adequate empty space is left between repeating wires (J. Mol. Struct.
|
||||
704, 101). x and y are non-periodic.
|
||||
-------------------------------------------------------------------------
|
||||
*/
|
||||
WireDipole::WireDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
||||
|
||||
void WireDipole::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, double &energy,
|
||||
double *eatom)
|
||||
{
|
||||
double *q = atom->q;
|
||||
double **x = atom->x;
|
||||
int nlocal = atom->nlocal;
|
||||
double xdipole = 0.0;
|
||||
double ydipole = 0.0;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
xdipole += q[i] * x[i][0];
|
||||
ydipole += q[i] * x[i][1];
|
||||
}
|
||||
|
||||
// sum local contributions to get global dipole moment
|
||||
double xdipole_all, ydipole_all;
|
||||
MPI_Allreduce(&xdipole, &xdipole_all, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
MPI_Allreduce(&ydipole, &ydipole_all, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
|
||||
// need to make per-atom energy translationally invariant
|
||||
double xdipole_r2 = 0.0;
|
||||
double ydipole_r2 = 0.0;
|
||||
if (eflag_atom) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
xdipole_r2 += q[i] * x[i][0] * x[i][0];
|
||||
ydipole_r2 += q[i] * x[i][1] * x[i][1];
|
||||
}
|
||||
|
||||
// sum local contributions
|
||||
double tmp;
|
||||
MPI_Allreduce(&xdipole_r2, &tmp, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
xdipole_r2 = tmp;
|
||||
MPI_Allreduce(&ydipole_r2, &tmp, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
ydipole_r2 = tmp;
|
||||
}
|
||||
|
||||
// compute corrections
|
||||
const double e_wirecorr =
|
||||
MY_PI * (xdipole_all * xdipole_all + ydipole_all * ydipole_all) / volume;
|
||||
const double qscale = qqrd2e * scale;
|
||||
if (eflag_global) energy += qscale * e_wirecorr;
|
||||
|
||||
// per-atom energy
|
||||
if (eflag_atom) {
|
||||
double efact = qscale * MY_PI / volume;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
eatom[i] += efact * q[i] *
|
||||
(x[i][0] * xdipole_all + x[i][1] * ydipole_all - 0.5 * (xdipole_r2 + ydipole_r2));
|
||||
}
|
||||
|
||||
// add on force corrections
|
||||
double ffact = qscale * (-MY_2PI / volume);
|
||||
double **f = atom->f;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
f[i][0] += ffact * q[i] * xdipole_all;
|
||||
f[i][1] += ffact * q[i] * ydipole_all;
|
||||
}
|
||||
}
|
||||
|
||||
void WireDipole::vector_corr(double *vec, int sensor_grpbit, int source_grpbit, bool invert_source)
|
||||
{
|
||||
int const nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
double *q = atom->q;
|
||||
int *mask = atom->mask;
|
||||
double dipole[2] = {0., 0.}; // dipole in x and y direction
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (!!(mask[i] & source_grpbit) != invert_source) {
|
||||
for (int dim : {0, 1}) dipole[dim] += q[i] * x[i][dim];
|
||||
}
|
||||
}
|
||||
MPI_Allreduce(MPI_IN_PLACE, &dipole, 2, MPI_DOUBLE, MPI_SUM, world);
|
||||
for (double &d : dipole) d *= MY_2PI / volume;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & sensor_grpbit) vec[i] += x[i][0] * dipole[0] + x[i][1] * dipole[1];
|
||||
}
|
||||
}
|
||||
|
||||
void WireDipole::matrix_corr(bigint *imat, double **matrix)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
double **x = atom->x;
|
||||
|
||||
// how many local and total group atoms?
|
||||
int ngrouplocal = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (imat[i] > -1) ngrouplocal++;
|
||||
bigint ngroup = 0;
|
||||
MPI_Allreduce(&ngrouplocal, &ngroup, 1, MPI_INT, MPI_SUM, world);
|
||||
|
||||
// gather non-periodic positions of groups
|
||||
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];
|
||||
yprd_local[n] = x[i][1];
|
||||
n++;
|
||||
}
|
||||
|
||||
// gather subsets nprd positions
|
||||
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);
|
||||
|
||||
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;
|
||||
for (bigint j = 0; j < ngroup; j++) {
|
||||
// matrix is symmetric
|
||||
if (jmat[j] > imat[i]) continue;
|
||||
double aij = prefac * (x[i][0] * xprd_all[j] + x[i][1] * yprd_all[j]);
|
||||
matrix[imat[i]][jmat[j]] += aij;
|
||||
if (imat[i] != jmat[j]) matrix[jmat[j]][imat[i]] += aij;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/ELECTRODE/wire_dipole.h
Normal file
35
src/ELECTRODE/wire_dipole.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, 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)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_WIRE_DIPOLE_H
|
||||
#define LMP_WIRE_DIPOLE_H
|
||||
|
||||
#include "boundary_correction.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class WireDipole : public BoundaryCorrection {
|
||||
public:
|
||||
WireDipole(LAMMPS *);
|
||||
void vector_corr(double *, int, int, bool);
|
||||
void matrix_corr(bigint *, double **);
|
||||
void compute_corr(double, int, int, double &, double *);
|
||||
void setup(double);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
#endif
|
||||
@ -346,8 +346,8 @@ void ComputeAcklandAtom::compute_peratom()
|
||||
2nd routine sorts auxiliary array at same time
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#define SWAP(a,b) tmp = a; a = b; b = tmp;
|
||||
#define ISWAP(a,b) itmp = a; a = b; b = itmp;
|
||||
#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp;
|
||||
#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp;
|
||||
|
||||
void ComputeAcklandAtom::select(int k, int n, double *arr)
|
||||
{
|
||||
|
||||
@ -432,8 +432,8 @@ void ComputeBasalAtom::compute_peratom()
|
||||
2nd routine sorts auxiliary array at same time
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#define SWAP(a,b) tmp = a; a = b; b = tmp;
|
||||
#define ISWAP(a,b) itmp = a; a = b; b = itmp;
|
||||
#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp;
|
||||
#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp;
|
||||
|
||||
void ComputeBasalAtom::select(int k, int n, double *arr)
|
||||
{
|
||||
|
||||
@ -120,8 +120,6 @@ ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) :
|
||||
{
|
||||
if (narg < 3) error->all(FLERR, "Illegal compute born/matrix command");
|
||||
|
||||
MPI_Comm_rank(world, &me);
|
||||
|
||||
nvalues = 21;
|
||||
|
||||
numflag = 0;
|
||||
@ -288,8 +286,6 @@ ComputeBornMatrix::~ComputeBornMatrix()
|
||||
|
||||
void ComputeBornMatrix::init()
|
||||
{
|
||||
dt = update->dt;
|
||||
|
||||
if (!numflag) {
|
||||
|
||||
// need an occasional half neighbor list
|
||||
|
||||
@ -52,17 +52,15 @@ class ComputeBornMatrix : public Compute {
|
||||
void virial_addon(); // restore atom positions
|
||||
void reallocate(); // grow the atom arrays
|
||||
|
||||
int me; // process rank
|
||||
int nvalues; // length of elastic tensor
|
||||
int numflag; // 1 if using finite differences
|
||||
double numdelta; // size of finite strain
|
||||
int maxatom; // allocated size of atom arrays
|
||||
|
||||
int pairflag, bondflag, angleflag;
|
||||
int dihedflag, impflag, kspaceflag;
|
||||
int dihedflag, impflag;
|
||||
|
||||
double *values_local, *values_global;
|
||||
double pos, pos1, dt, nktv2p, ftm2v;
|
||||
class NeighList *list;
|
||||
|
||||
char *id_virial; // name of virial compute
|
||||
|
||||
@ -267,8 +267,8 @@ inline void ComputeHexOrderAtom::calc_qn_trig(double delx, double dely, double &
|
||||
sort auxiliary array at same time
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#define SWAP(a,b) tmp = a; a = b; b = tmp;
|
||||
#define ISWAP(a,b) itmp = a; a = b; b = itmp;
|
||||
#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp;
|
||||
#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -381,7 +381,7 @@ static int *buf = nullptr;
|
||||
| with some routines to assist in this task (those are marked
|
||||
| static and cannot be called from user programs)
|
||||
*/
|
||||
#define MAXABS INT_MAX-2
|
||||
#define MAXABS (float)(INT_MAX-2)
|
||||
|
||||
#ifndef SQR
|
||||
#define SQR(x) ((x)*(x))
|
||||
|
||||
@ -77,7 +77,7 @@ void DumpYAML::write_header(bigint ndump)
|
||||
|
||||
if (comm->me == 0) {
|
||||
const std::string boundary(boundstr);
|
||||
fmt::print(fp, "---\ntimestep: {}\n", update->ntimestep);
|
||||
fmt::print(fp, "---\ncreator: LAMMPS\ntimestep: {}\n", update->ntimestep);
|
||||
if (unit_flag) fmt::print(fp, "units: {}\n", update->unit_style);
|
||||
if (time_flag) fmt::print(fp, "time: {:.16g}\n", compute_time());
|
||||
|
||||
|
||||
@ -474,9 +474,6 @@ void FixAveCorrelateLong::end_of_step()
|
||||
error->warning(FLERR,"Error while tuncating output: {}", utils::getsyserror());
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void FixAveCorrelateLong::evaluate() {
|
||||
|
||||
@ -106,6 +106,7 @@ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
FixElectronStopping::~FixElectronStopping()
|
||||
{
|
||||
delete[] idregion;
|
||||
memory->destroy(elstop_ranges);
|
||||
}
|
||||
|
||||
|
||||
@ -633,6 +633,4 @@ void FixGLD::init_s_gld()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -434,7 +434,6 @@ void FixGLE::init_gles()
|
||||
delete[] rootCT;
|
||||
delete[] news;
|
||||
delete[] newg;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -54,12 +54,6 @@ FixNHGPU::FixNHGPU(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixNHGPU::~FixNHGPU()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNHGPU::setup(int vflag)
|
||||
{
|
||||
FixNH::setup(vflag);
|
||||
|
||||
@ -25,7 +25,6 @@ namespace LAMMPS_NS {
|
||||
class FixNHGPU : public FixNH {
|
||||
public:
|
||||
FixNHGPU(class LAMMPS *, int, char **);
|
||||
~FixNHGPU() override;
|
||||
void setup(int vflag) override;
|
||||
void reset_dt() override;
|
||||
void final_integrate() override;
|
||||
|
||||
@ -179,10 +179,7 @@ void PairEAMAlloyGPU::init_style()
|
||||
GPU_EXTRA::check_flag(success, error, world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
if (fp_size == sizeof(double))
|
||||
fp_single = false;
|
||||
else
|
||||
fp_single = true;
|
||||
fp_single = fp_size != sizeof(double);
|
||||
|
||||
embedstep = -1;
|
||||
}
|
||||
|
||||
@ -179,10 +179,7 @@ void PairEAMFSGPU::init_style()
|
||||
GPU_EXTRA::check_flag(success, error, world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
if (fp_size == sizeof(double))
|
||||
fp_single = false;
|
||||
else
|
||||
fp_single = true;
|
||||
fp_single = fp_size != sizeof(double);
|
||||
|
||||
embedstep = -1;
|
||||
}
|
||||
|
||||
@ -176,10 +176,7 @@ void PairEAMGPU::init_style()
|
||||
GPU_EXTRA::check_flag(success, error, world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
if (fp_size == sizeof(double))
|
||||
fp_single = false;
|
||||
else
|
||||
fp_single = true;
|
||||
fp_single = fp_size != sizeof(double);
|
||||
|
||||
embedstep = -1;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ using namespace MathSpecial;
|
||||
#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3)
|
||||
#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6)
|
||||
#define INVROOT6 0.40824829046386307274 // 1/sqrt(6)
|
||||
#define FOURTHIRDS 4.0/3.0 // 4/3
|
||||
#define FOURTHIRDS (4.0/3.0) // 4/3
|
||||
#define THREEQUARTERS 0.75 // 3/4
|
||||
|
||||
#define EPSILON 1e-10
|
||||
@ -188,7 +188,7 @@ void PairGranular::compute(int eflag, int vflag)
|
||||
double *history,*allhistory,**firsthistory;
|
||||
|
||||
bool touchflag = false;
|
||||
const bool historyupdate = update->setupflag != 0;
|
||||
const bool historyupdate = update->setupflag == 0;
|
||||
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
|
||||
@ -338,13 +338,6 @@ void DumpH5MD::openfile()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpH5MD::write_header(bigint /* nbig */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpH5MD::pack(tagint *ids)
|
||||
{
|
||||
int m,n;
|
||||
|
||||
@ -60,7 +60,7 @@ class DumpH5MD : public Dump {
|
||||
void init_style() override;
|
||||
int modify_param(int, char **) override;
|
||||
void openfile() override;
|
||||
void write_header(bigint) override;
|
||||
void write_header(bigint) override {};
|
||||
void pack(tagint *) override;
|
||||
void write_data(int, double *) override;
|
||||
|
||||
|
||||
@ -51,6 +51,8 @@ action npair_intel.cpp
|
||||
action intel_simd.h
|
||||
action intel_intrinsics.h pair_tersoff_intel.cpp
|
||||
action intel_intrinsics_airebo.h pair_airebo_intel.cpp
|
||||
action electrode_accel_intel.h fix_electrode_conp.cpp
|
||||
action electrode_accel_intel.cpp fix_electrode_conp.cpp
|
||||
|
||||
if (test $mode = 1) then
|
||||
|
||||
|
||||
@ -49,12 +49,6 @@ AngleCharmmIntel::AngleCharmmIntel(LAMMPS *lmp) : AngleCharmm(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleCharmmIntel::~AngleCharmmIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleCharmmIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,7 +32,6 @@ namespace LAMMPS_NS {
|
||||
class AngleCharmmIntel : public AngleCharmm {
|
||||
public:
|
||||
AngleCharmmIntel(class LAMMPS *);
|
||||
~AngleCharmmIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
@ -49,12 +49,6 @@ AngleHarmonicIntel::AngleHarmonicIntel(LAMMPS *lmp) : AngleHarmonic(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleHarmonicIntel::~AngleHarmonicIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleHarmonicIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -33,7 +33,6 @@ namespace LAMMPS_NS {
|
||||
class AngleHarmonicIntel : public AngleHarmonic {
|
||||
public:
|
||||
AngleHarmonicIntel(class LAMMPS *);
|
||||
~AngleHarmonicIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
@ -49,12 +49,6 @@ BondFENEIntel::BondFENEIntel(LAMMPS *lmp) : BondFENE(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
BondFENEIntel::~BondFENEIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondFENEIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,7 +32,6 @@ namespace LAMMPS_NS {
|
||||
class BondFENEIntel : public BondFENE {
|
||||
public:
|
||||
BondFENEIntel(class LAMMPS *);
|
||||
~BondFENEIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
@ -45,12 +45,6 @@ BondHarmonicIntel::BondHarmonicIntel(LAMMPS *lmp) : BondHarmonic(lmp)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
BondHarmonicIntel::~BondHarmonicIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondHarmonicIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,7 +32,6 @@ namespace LAMMPS_NS {
|
||||
class BondHarmonicIntel : public BondHarmonic {
|
||||
public:
|
||||
BondHarmonicIntel(class LAMMPS *);
|
||||
~BondHarmonicIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
65
src/INTEL/electrode_accel_intel.cpp
Normal file
65
src/INTEL/electrode_accel_intel.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/ 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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "electrode_accel_intel.h"
|
||||
|
||||
#include "comm.h"
|
||||
#include "fix_intel.h"
|
||||
#include "intel_buffers.h"
|
||||
#include "modify.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ElectrodeAccelIntel::ElectrodeAccelIntel(class LAMMPS *lmp) : ElectrodeAccelInterface(lmp) {}
|
||||
|
||||
void ElectrodeAccelIntel::intel_find_fix()
|
||||
{
|
||||
int ifix = modify->find_fix("package_intel");
|
||||
if (ifix < 0) error->all(FLERR, "The 'package intel' command is required for /intel styles");
|
||||
fix = static_cast<FixIntel *>(modify->fix[ifix]);
|
||||
}
|
||||
|
||||
void ElectrodeAccelIntel::intel_pack_buffers()
|
||||
{
|
||||
switch (fix->precision()) {
|
||||
case FixIntel::PREC_MODE_MIXED:
|
||||
intel_pack_buffers_prec<float, double>(fix->get_mixed_buffers());
|
||||
break;
|
||||
case FixIntel::PREC_MODE_DOUBLE:
|
||||
intel_pack_buffers_prec<double, double>(fix->get_double_buffers());
|
||||
break;
|
||||
default: // FixIntel::PREC_MODE_SINGLE
|
||||
intel_pack_buffers_prec<float, float>(fix->get_single_buffers());
|
||||
}
|
||||
}
|
||||
|
||||
template <class flt_t, class acc_t>
|
||||
void ElectrodeAccelIntel::intel_pack_buffers_prec(IntelBuffers<flt_t, acc_t> *buffers)
|
||||
{
|
||||
fix->start_watch(TIME_PACK);
|
||||
int packthreads;
|
||||
if (comm->nthreads > INTEL_HTHREADS)
|
||||
packthreads = comm->nthreads;
|
||||
else
|
||||
packthreads = 1;
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel if (packthreads > 1)
|
||||
#endif
|
||||
{
|
||||
int ifrom, ito, tid;
|
||||
IP_PRE_omp_range_id_align(ifrom, ito, tid, atom->nlocal + atom->nghost, packthreads,
|
||||
sizeof(ATOM_T));
|
||||
buffers->thr_pack(ifrom, ito, 0);
|
||||
}
|
||||
fix->stop_watch(TIME_PACK);
|
||||
}
|
||||
37
src/INTEL/electrode_accel_intel.h
Normal file
37
src/INTEL/electrode_accel_intel.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/ 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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ELECTRODE_ACCEL_INTEL_H
|
||||
#define LMP_ELECTRODE_ACCEL_INTEL_H
|
||||
|
||||
#include "electrode_accel_interface.h"
|
||||
#include "fix_intel.h"
|
||||
#include "intel_buffers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ElectrodeAccelIntel : public ElectrodeAccelInterface {
|
||||
public:
|
||||
ElectrodeAccelIntel(class LAMMPS *lmp);
|
||||
void intel_find_fix();
|
||||
void intel_pack_buffers();
|
||||
|
||||
private:
|
||||
class FixIntel *fix;
|
||||
template <class flt_t, class acc_t>
|
||||
void intel_pack_buffers_prec(IntelBuffers<flt_t, acc_t> *buffers);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
47
src/INTEL/fix_electrode_conp_intel.h
Normal file
47
src/INTEL/fix_electrode_conp_intel.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/ 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 author: Shern Tee (UQ)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/conp/intel, FixElectrodeConpIntel)
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_CONP_INTEL_H
|
||||
#define LMP_FIX_ELECTRODE_CONP_INTEL_H
|
||||
|
||||
#include "electrode_accel_intel.h"
|
||||
#include "fix_electrode_conp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeConpIntel : public FixElectrodeConp {
|
||||
public:
|
||||
FixElectrodeConpIntel(class LAMMPS *lmp, int narg, char **arg) : FixElectrodeConp(lmp, narg, arg)
|
||||
{
|
||||
intelflag = true;
|
||||
delete accel_interface;
|
||||
accel_interface = new ElectrodeAccelIntel(lmp);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
47
src/INTEL/fix_electrode_conq_intel.h
Normal file
47
src/INTEL/fix_electrode_conq_intel.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/ 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 author: Shern Tee (UQ)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/conq/intel, FixElectrodeConqIntel)
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_CONQ_INTEL_H
|
||||
#define LMP_FIX_ELECTRODE_CONQ_INTEL_H
|
||||
|
||||
#include "electrode_accel_intel.h"
|
||||
#include "fix_electrode_conq.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeConqIntel : public FixElectrodeConq {
|
||||
public:
|
||||
FixElectrodeConqIntel(class LAMMPS *lmp, int narg, char **arg) : FixElectrodeConq(lmp, narg, arg)
|
||||
{
|
||||
intelflag = true;
|
||||
delete accel_interface;
|
||||
accel_interface = new ElectrodeAccelIntel(lmp);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
48
src/INTEL/fix_electrode_thermo_intel.h
Normal file
48
src/INTEL/fix_electrode_thermo_intel.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/ 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 author: Shern Tee (UQ)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
// clang-format off
|
||||
FixStyle(electrode/thermo/intel, FixElectrodeThermoIntel)
|
||||
// clang-format on
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ELECTRODE_THERMO_INTEL_H
|
||||
#define LMP_FIX_ELECTRODE_THERMO_INTEL_H
|
||||
|
||||
#include "electrode_accel_intel.h"
|
||||
#include "fix_electrode_thermo.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixElectrodeThermoIntel : public FixElectrodeThermo {
|
||||
public:
|
||||
FixElectrodeThermoIntel(class LAMMPS *lmp, int narg, char **arg) :
|
||||
FixElectrodeThermo(lmp, narg, arg)
|
||||
{
|
||||
intelflag = true;
|
||||
delete accel_interface;
|
||||
accel_interface = new ElectrodeAccelIntel(lmp);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -53,12 +53,6 @@ FixNHIntel::FixNHIntel(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixNHIntel::~FixNHIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNHIntel::setup(int vflag)
|
||||
{
|
||||
FixNH::setup(vflag);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -26,7 +25,6 @@ namespace LAMMPS_NS {
|
||||
class FixNHIntel : public FixNH {
|
||||
public:
|
||||
FixNHIntel(class LAMMPS *, int, char **);
|
||||
~FixNHIntel() override;
|
||||
void setup(int vflag) override;
|
||||
void reset_dt() override;
|
||||
double memory_usage() override;
|
||||
@ -42,7 +40,6 @@ class FixNHIntel : public FixNH {
|
||||
void nh_v_temp() override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -52,12 +52,6 @@ ImproperCvffIntel::ImproperCvffIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ImproperCvffIntel::~ImproperCvffIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperCvffIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,7 +32,6 @@ namespace LAMMPS_NS {
|
||||
class ImproperCvffIntel : public ImproperCvff {
|
||||
public:
|
||||
ImproperCvffIntel(class LAMMPS *);
|
||||
~ImproperCvffIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
@ -54,12 +54,6 @@ ImproperHarmonicIntel::ImproperHarmonicIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ImproperHarmonicIntel::~ImproperHarmonicIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperHarmonicIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,7 +32,6 @@ namespace LAMMPS_NS {
|
||||
class ImproperHarmonicIntel : public ImproperHarmonic {
|
||||
public:
|
||||
ImproperHarmonicIntel(class LAMMPS *);
|
||||
~ImproperHarmonicIntel() override;
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
|
||||
@ -39,15 +39,15 @@ NPairIntel::NPairIntel(LAMMPS *lmp) : NPair(lmp) {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
NPairIntel::~NPairIntel() {
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
if (_off_map_stencil) {
|
||||
const int * stencil = this->stencil;
|
||||
#pragma offload_transfer target(mic:_cop) \
|
||||
nocopy(stencil:alloc_if(0) free_if(1))
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -76,7 +76,9 @@ namespace LAMMPS_NS {
|
||||
class NPairIntel : public NPair {
|
||||
public:
|
||||
NPairIntel(class LAMMPS *);
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
~NPairIntel() override;
|
||||
#endif
|
||||
void copy_neighbor_info() override;
|
||||
|
||||
#ifdef _LMP_INTEL_OFFLOAD
|
||||
|
||||
@ -4464,10 +4464,8 @@ static void aut_lj_with_bo(
|
||||
}
|
||||
exceed_limits:
|
||||
for (int l = 0; l < fvec::VL; l++) {
|
||||
ref_lennard_jones_single_interaction(ka, ivec::at(i, l), ivec::at(j, l),
|
||||
MORSEFLAG);
|
||||
ref_lennard_jones_single_interaction(ka, ivec::at(i, l), ivec::at(j, l), MORSEFLAG);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -46,10 +46,6 @@ PairBuckCoulCutIntel::PairBuckCoulCutIntel(LAMMPS *lmp) :
|
||||
suffix_flag |= Suffix::INTEL;
|
||||
}
|
||||
|
||||
PairBuckCoulCutIntel::~PairBuckCoulCutIntel()
|
||||
{
|
||||
}
|
||||
|
||||
void PairBuckCoulCutIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -35,7 +34,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
|
||||
|
||||
public:
|
||||
PairBuckCoulCutIntel(class LAMMPS *);
|
||||
~PairBuckCoulCutIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
typedef struct {
|
||||
|
||||
@ -47,10 +47,6 @@ PairBuckCoulLongIntel::PairBuckCoulLongIntel(LAMMPS *lmp) :
|
||||
suffix_flag |= Suffix::INTEL;
|
||||
}
|
||||
|
||||
PairBuckCoulLongIntel::~PairBuckCoulLongIntel()
|
||||
{
|
||||
}
|
||||
|
||||
void PairBuckCoulLongIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,7 +33,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
|
||||
|
||||
public:
|
||||
PairBuckCoulLongIntel(class LAMMPS *);
|
||||
~PairBuckCoulLongIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
typedef struct {
|
||||
|
||||
@ -44,10 +44,6 @@ PairBuckIntel::PairBuckIntel(LAMMPS *lmp) : PairBuck(lmp)
|
||||
suffix_flag |= Suffix::INTEL;
|
||||
}
|
||||
|
||||
PairBuckIntel::~PairBuckIntel()
|
||||
{
|
||||
}
|
||||
|
||||
void PairBuckIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,7 +33,7 @@ class PairBuckIntel : public PairBuck {
|
||||
|
||||
public:
|
||||
PairBuckIntel(class LAMMPS *);
|
||||
~PairBuckIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
typedef struct {
|
||||
|
||||
@ -43,12 +43,6 @@ PairLJCharmmCoulCharmmIntel::PairLJCharmmCoulCharmmIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCharmmCoulCharmmIntel::~PairLJCharmmCoulCharmmIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCharmmCoulCharmmIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,7 +33,6 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
|
||||
|
||||
public:
|
||||
PairLJCharmmCoulCharmmIntel(class LAMMPS *);
|
||||
~PairLJCharmmCoulCharmmIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
@ -47,12 +47,6 @@ PairLJCharmmCoulLongIntel::PairLJCharmmCoulLongIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCharmmCoulLongIntel::~PairLJCharmmCoulLongIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,7 +33,6 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
|
||||
|
||||
public:
|
||||
PairLJCharmmCoulLongIntel(class LAMMPS *);
|
||||
~PairLJCharmmCoulLongIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
@ -48,12 +48,6 @@ PairLJCutCoulLongIntel::PairLJCutCoulLongIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCutCoulLongIntel::~PairLJCutCoulLongIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulLongIntel::compute(int eflag, int vflag)
|
||||
{
|
||||
if (fix->precision()==FixIntel::PREC_MODE_MIXED)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,7 +33,6 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
|
||||
|
||||
public:
|
||||
PairLJCutCoulLongIntel(class LAMMPS *);
|
||||
~PairLJCutCoulLongIntel() override;
|
||||
|
||||
void compute(int, int) override;
|
||||
void init_style() override;
|
||||
|
||||
@ -37,12 +37,6 @@ PairLJLongCoulLongIntel::PairLJLongCoulLongIntel(LAMMPS *lmp) :
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJLongCoulLongIntel::~PairLJLongCoulLongIntel()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJLongCoulLongIntel::init_style()
|
||||
{
|
||||
PairLJLongCoulLong::init_style();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user