apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-09-10 03:29:32 -04:00
parent ab899861d5
commit 7e6bd892ed
78 changed files with 473 additions and 412 deletions

View File

@ -39,7 +39,7 @@ AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp)
// order of fields in a string does not matter
// except: fields_data_atom & fields_data_vel must match data file
fields_grow = {"q", "espin", "eradius", "ervel", "erforce",
fields_grow = {"q", "espin", "eradius", "ervel", "erforce",
"cs", "csforce", "vforce", "ervelforce", "etag"};
fields_copy = {"q", "espin", "eradius", "ervel", "cs", "etag"};
fields_comm = {"eradius"};
@ -108,7 +108,7 @@ void AtomVecWavepacket::data_atom_post(int ilocal)
int AtomVecWavepacket::property_atom(const std::string &name)
{
if (name == "espin") return 0;
if (name == "spin") return 0; // backward compatibility
if (name == "spin") return 0; // backward compatibility
if (name == "eradius") return 1;
if (name == "ervel") return 2;
if (name == "erforce") return 3;

View File

@ -84,9 +84,9 @@ void BondBPM::init_style()
{
if (id_fix_store_local) {
auto ifix = modify->get_fix_by_id(id_fix_store_local);
if (!ifix) error->all(FLERR, "Cannot find fix STORE/LOCAL id {}",id_fix_store_local);
if (!ifix) error->all(FLERR, "Cannot find fix STORE/LOCAL id {}", id_fix_store_local);
if (strcmp(ifix->style, "STORE/LOCAL") != 0)
error->all(FLERR, "Incorrect fix style matched, not STORE/LOCAL: {}",ifix->style);
error->all(FLERR, "Incorrect fix style matched, not STORE/LOCAL: {}", ifix->style);
fix_store_local = dynamic_cast<FixStoreLocal *>(ifix);
fix_store_local->nvalues = nvalues;
}

View File

@ -70,7 +70,7 @@ void FixBrownian::initial_integrate(int /*vflag */)
initial_integrate_templated<1, 0, 0>();
}
}
}
}
/* ---------------------------------------------------------------------- */
@ -126,4 +126,4 @@ template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D> void FixBrownian::initial_int
v[i][2] = dz / dt;
}
}
}
}

View File

@ -157,7 +157,7 @@ void FixBrownianAsphere::initial_integrate(int /*vflag */)
}
}
}
}
}
/* ---------------------------------------------------------------------- */
@ -296,5 +296,4 @@ void FixBrownianAsphere::initial_integrate_templated()
}
}
}
}
}

View File

@ -85,7 +85,7 @@ void FixBrownianSphere::initial_integrate(int /*vflag */)
initial_integrate_templated<1, 0, 0, 0>();
}
}
}
}
/* ---------------------------------------------------------------------- */

View File

@ -101,7 +101,8 @@ 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;
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(); };

View File

@ -21,7 +21,7 @@
using namespace LAMMPS_NS;
GzFileWriter::GzFileWriter() : compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
GzFileWriter::GzFileWriter() : compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
/* ---------------------------------------------------------------------- */

View File

@ -24,7 +24,7 @@
using namespace LAMMPS_NS;
ZstdFileWriter::ZstdFileWriter() :
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];

View File

@ -101,29 +101,30 @@ void AtomVecDielectric::init()
// with pair styles using coulomb without dielectric support.
std::string pair_style(force->pair_style);
if ((pair_style != "none") && (pair_style != "zero") && !utils::strmatch(force->pair_style,"/dielectric")) {
if ((pair_style != "none") && (pair_style != "zero") &&
!utils::strmatch(force->pair_style, "/dielectric")) {
bool mismatch = false;
if (utils::strmatch(force->pair_style,"^reaxff")) mismatch = true;
if (utils::strmatch(force->pair_style,"^comb")) mismatch = true;
if (utils::strmatch(force->pair_style,"coul")) mismatch = true;
if (utils::strmatch(force->pair_style,"tip4p")) mismatch = true;
if (utils::strmatch(force->pair_style,"dipole")) mismatch = true;
if (utils::strmatch(force->pair_style, "^reaxff")) mismatch = true;
if (utils::strmatch(force->pair_style, "^comb")) mismatch = true;
if (utils::strmatch(force->pair_style, "coul")) mismatch = true;
if (utils::strmatch(force->pair_style, "tip4p")) mismatch = true;
if (utils::strmatch(force->pair_style, "dipole")) mismatch = true;
if (utils::strmatch(force->pair_style,"^hybrid")) {
if (utils::strmatch(force->pair_style, "^hybrid")) {
auto hybrid = dynamic_cast<PairHybrid *>(force->pair);
if (hybrid) {
for (int i = 0; i < hybrid->nstyles; i++) {
if (utils::strmatch(hybrid->keywords[i],"^reaxff")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i],"^comb")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i],"coul")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i],"tip4p")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i],"dipole")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i], "^reaxff")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i], "^comb")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i], "coul")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i], "tip4p")) mismatch = true;
if (utils::strmatch(hybrid->keywords[i], "dipole")) mismatch = true;
}
}
}
if (mismatch)
error->all(FLERR, "Pair style {} is not compatible with atom style {}",
pair_style, atom->get_style());
error->all(FLERR, "Pair style {} is not compatible with atom style {}", pair_style,
atom->get_style());
}
}

View File

@ -36,8 +36,7 @@ using MathConst::MY_PIS;
/* ---------------------------------------------------------------------- */
PairCoulLongDielectric::PairCoulLongDielectric(LAMMPS *_lmp) :
PairCoulLong(_lmp), efield(nullptr)
PairCoulLongDielectric::PairCoulLongDielectric(LAMMPS *_lmp) : PairCoulLong(_lmp), efield(nullptr)
{
nmax = 0;
single_enable = 0;
@ -177,7 +176,8 @@ void PairCoulLongDielectric::compute(int eflag, int vflag)
ecoul = scale[itype][jtype] * qtmp * q[j] * 0.5 * (etmp + eps[j]) * table;
}
if (factor_coul < 1.0) ecoul -= (1.0 - factor_coul) * prefactor;
} else ecoul = 0.0;
} else
ecoul = 0.0;
if (evflag) ev_tally_full(i, 0.0, ecoul, fpair_i, delx, dely, delz);
}

View File

@ -159,7 +159,7 @@ void PairLJCutCoulCutDielectric::compute(int eflag, int vflag)
if (eflag) {
if (rsq < cut_coulsq[itype][jtype]) {
ecoul = factor_coul * qqrd2e * qtmp * q[j] * 0.5 * (etmp + eps[j]) *rinv;
ecoul = factor_coul * qqrd2e * qtmp * q[j] * 0.5 * (etmp + eps[j]) * rinv;
} else
ecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) {

View File

@ -120,7 +120,7 @@ void AtomVecElectron::data_atom_post(int ilocal)
int AtomVecElectron::property_atom(const std::string &name)
{
if (name == "espin") return 0;
if (name == "spin") return 0; // backward compatibility
if (name == "spin") return 0; // backward compatibility
if (name == "eradius") return 1;
if (name == "ervel") return 2;
if (name == "erforce") return 3;

View File

@ -57,8 +57,9 @@ ElectrodeVector::~ElectrodeVector()
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));
} catch (std::exception &) {}
utils::logmesg(lmp, fmt::format("B boundary time: {:.4g} s\n", boundary_time_total));
} catch (std::exception &) {
}
}
}

View File

@ -1058,7 +1058,8 @@ FixElectrodeConp::~FixElectrodeConp()
try {
utils::logmesg(lmp, fmt::format("Multiplication time: {:.4g} s\n", mult_time));
utils::logmesg(lmp, fmt::format("Update time: {:.4g} s\n", update_time));
} catch (std::exception &) {}
} catch (std::exception &) {
}
}
if (!modify->get_fix_by_id(id)) // avoid segfault if derived fixes' ctor throws err
atom->delete_callback(id, Atom::GROW); // atomvec track local electrode atoms
@ -1107,7 +1108,7 @@ void FixElectrodeConp::write_to_file(FILE *file, const std::vector<tagint> &tags
/*----------------------------------------------------------------------- */
void FixElectrodeConp::read_from_file(const std::string& input_file, double **array,
void FixElectrodeConp::read_from_file(const std::string &input_file, double **array,
const std::string &filetype)
{
if (comm->me == 0) {

View File

@ -101,7 +101,7 @@ class FixElectrodeConp : public Fix {
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 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;

View File

@ -55,7 +55,7 @@ FixElectrodeThermo::FixElectrodeThermo(LAMMPS *lmp, int narg, char **arg) :
FixElectrodeThermo::~FixElectrodeThermo()
{
delete thermo_random;
delete thermo_random;
}
/* ----------------------------------------------------------------------- */

View File

@ -187,7 +187,7 @@ void PairLJCutTIP4PLongGPU::init_style()
cut_coulsq = cut_coul * cut_coul;
double cut_coulplus = cut_coul + qdist + blen;
double cut_coulsqplus = cut_coulplus*cut_coulplus;
double cut_coulsqplus = cut_coulplus * cut_coulplus;
if (maxcut < cut_coulsqplus) { cell_size = cut_coulplus + neighbor->skin; }
if (comm->cutghostuser < cell_size) {
if (comm->me == 0)

View File

@ -42,23 +42,23 @@ using namespace LAMMPS_NS;
// External functions from cuda library for atom decomposition
int spical_gpu_init(const int ntypes, double **cutsq, int **lj_type, double **host_lj1,
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
double *special_lj, const int nlocal, const int nall, const int max_nbors,
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen,
double **host_cut_ljsq, double host_cut_coulsq, double *host_special_coul,
const double qqrd2e, const double g_ewald);
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
double *special_lj, const int nlocal, const int nall, const int max_nbors,
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen,
double **host_cut_ljsq, double host_cut_coulsq, double *host_special_coul,
const double qqrd2e, const double g_ewald);
void spical_gpu_clear();
int **spical_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial,
tagint **special, const bool eflag, const bool vflag, const bool eatom,
const bool vatom, int &host_start, int **ilist, int **jnum,
const double cpu_time, bool &success, double *host_q, double *boxlo,
double *prd);
int *host_type, double *sublo, double *subhi, tagint *tag,
int **nspecial, tagint **special, const bool eflag, const bool vflag,
const bool eatom, const bool vatom, int &host_start, int **ilist,
int **jnum, const double cpu_time, bool &success, double *host_q,
double *boxlo, double *prd);
void spical_gpu_compute(const int ago, const int inum, const int nall, double **host_x,
int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag,
const bool vflag, const bool eatom, const bool vatom, int &host_start,
const double cpu_time, bool &success, double *host_q, const int nlocal,
double *boxlo, double *prd);
int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag,
const bool vflag, const bool eatom, const bool vatom, int &host_start,
const double cpu_time, bool &success, double *host_q, const int nlocal,
double *boxlo, double *prd);
double spical_gpu_bytes();
#include "lj_spica_common.h"
@ -111,17 +111,17 @@ void PairLJSPICACoulLongGPU::compute(int eflag, int vflag)
}
inum = atom->nlocal;
firstneigh = spical_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi,
atom->tag, atom->nspecial, atom->special, eflag, vflag,
eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time,
success, atom->q, domain->boxlo, domain->prd);
atom->tag, atom->nspecial, atom->special, eflag, vflag,
eflag_atom, vflag_atom, host_start, &ilist, &numneigh,
cpu_time, success, atom->q, domain->boxlo, domain->prd);
} else {
inum = list->inum;
ilist = list->ilist;
numneigh = list->numneigh;
firstneigh = list->firstneigh;
spical_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q,
atom->nlocal, domain->boxlo, domain->prd);
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q,
atom->nlocal, domain->boxlo, domain->prd);
}
if (!success) error->one(FLERR, "Insufficient memory on accelerator");
@ -144,7 +144,8 @@ void PairLJSPICACoulLongGPU::compute(int eflag, int vflag)
void PairLJSPICACoulLongGPU::init_style()
{
if (!atom->q_flag) error->all(FLERR, "Pair style lj/spica/coul/long/gpu requires atom attribute q");
if (!atom->q_flag)
error->all(FLERR, "Pair style lj/spica/coul/long/gpu requires atom attribute q");
// Repeat cutsq calculation because done after call to init_style
double maxcut = -1.0;
@ -176,10 +177,10 @@ void PairLJSPICACoulLongGPU::init_style()
int maxspecial = 0;
if (atom->molecular != Atom::ATOMIC) maxspecial = atom->maxspecial;
int mnf = 5e-2 * neighbor->oneatom;
int success =
spical_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset, force->special_lj,
atom->nlocal, atom->nlocal + atom->nghost, mnf, maxspecial, cell_size, gpu_mode,
screen, cut_ljsq, cut_coulsq, force->special_coul, force->qqrd2e, g_ewald);
int success = spical_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset,
force->special_lj, atom->nlocal, atom->nlocal + atom->nghost, mnf,
maxspecial, cell_size, gpu_mode, screen, cut_ljsq, cut_coulsq,
force->special_coul, force->qqrd2e, g_ewald);
GPU_EXTRA::check_flag(success, error, world);
if (gpu_mode == GPU_FORCE) neighbor->add_request(this, NeighConst::REQ_FULL);
@ -196,7 +197,7 @@ double PairLJSPICACoulLongGPU::memory_usage()
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG>
void PairLJSPICACoulLongGPU::cpu_compute(int start, int inum, int *ilist, int *numneigh,
int **firstneigh)
int **firstneigh)
{
int i, j, ii, jj;
double qtmp, xtmp, ytmp, ztmp;

View File

@ -33,19 +33,19 @@ using namespace LAMMPS_NS;
// External functions from cuda library for atom decomposition
int spica_gpu_init(const int ntypes, double **cutsq, int **cg_types, double **host_lj1,
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
double *special_lj, const int nlocal, const int nall, const int max_nbors,
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen);
double **host_lj2, double **host_lj3, double **host_lj4, double **offset,
double *special_lj, const int nlocal, const int nall, const int max_nbors,
const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen);
void spica_gpu_clear();
int **spica_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x,
int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial,
tagint **special, const bool eflag, const bool vflag, const bool eatom,
const bool vatom, int &host_start, int **ilist, int **jnum,
const double cpu_time, bool &success);
void spica_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type,
int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag,
const bool eatom, const bool vatom, int &host_start, const double cpu_time,
bool &success);
int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial,
tagint **special, const bool eflag, const bool vflag, const bool eatom,
const bool vatom, int &host_start, int **ilist, int **jnum,
const double cpu_time, bool &success);
void spica_gpu_compute(const int ago, const int inum, const int nall, double **host_x,
int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag,
const bool vflag, const bool eatom, const bool vatom, int &host_start,
const double cpu_time, bool &success);
double spica_gpu_bytes();
#include "lj_spica_common.h"
@ -98,15 +98,15 @@ void PairLJSPICAGPU::compute(int eflag, int vflag)
inum = atom->nlocal;
firstneigh =
spica_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, sublo, subhi, atom->tag,
atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom,
host_start, &ilist, &numneigh, cpu_time, success);
atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom,
host_start, &ilist, &numneigh, cpu_time, success);
} else {
inum = list->inum;
ilist = list->ilist;
numneigh = list->numneigh;
firstneigh = list->firstneigh;
spica_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh,
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success);
eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success);
}
if (!success) error->one(FLERR, "Insufficient memory on accelerator");
@ -150,8 +150,8 @@ void PairLJSPICAGPU::init_style()
if (atom->molecular != Atom::ATOMIC) maxspecial = atom->maxspecial;
int mnf = 5e-2 * neighbor->oneatom;
int success = spica_gpu_init(atom->ntypes + 1, cutsq, lj_type, lj1, lj2, lj3, lj4, offset,
force->special_lj, atom->nlocal, atom->nlocal + atom->nghost, mnf,
maxspecial, cell_size, gpu_mode, screen);
force->special_lj, atom->nlocal, atom->nlocal + atom->nghost, mnf,
maxspecial, cell_size, gpu_mode, screen);
GPU_EXTRA::check_flag(success, error, world);
if (gpu_mode == GPU_FORCE) neighbor->add_request(this, NeighConst::REQ_FULL);

View File

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

View File

@ -43,17 +43,17 @@ using namespace InterLayer;
#define PGDELTA 1
static const char cite_ilp_tmd[] =
"ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n"
"@Article{Ouyang2021\n"
" author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n"
" A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n"
" title = {Anisotropic Interlayer Force Field for Transition\n"
" Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n"
" journal = {J.~Chem.\\ Theory Comput.},\n"
" volume = 17,\n"
" pages = {7237--7245}\n"
" year = 2021,\n"
"}\n\n";
"ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n"
"@Article{Ouyang2021\n"
" author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n"
" A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n"
" title = {Anisotropic Interlayer Force Field for Transition\n"
" Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n"
" journal = {J.~Chem.\\ Theory Comput.},\n"
" volume = 17,\n"
" pages = {7237--7245}\n"
" year = 2021,\n"
"}\n\n";
/* ---------------------------------------------------------------------- */

View File

@ -46,7 +46,7 @@ template <class DeviceType> class ComputeAveSphereAtomKokkos : public ComputeAve
void operator()(TagComputeAveSphereAtom, const int &) const;
private:
double adof,mvv2e,mv2d,boltz;
double adof, mvv2e, mv2d, boltz;
typename AT::t_x_array x;
typename AT::t_v_array v;

View File

@ -13,7 +13,6 @@
#include <mpi.h>
#include "lmpfftsettings.h"
// -------------------------------------------------------------------------

View File

@ -59,17 +59,17 @@ class PairTlsph : public Pair {
void PreCompute();
void ComputeForces(int eflag, int vflag);
void effective_longitudinal_modulus(const int itype, const double dt, const double d_iso,
const double p_rate, const Eigen::Matrix3d& d_dev,
const Eigen::Matrix3d& sigma_dev_rate, const double damage,
const double p_rate, const Eigen::Matrix3d &d_dev,
const Eigen::Matrix3d &sigma_dev_rate, const double damage,
double &K_eff, double &mu_eff, double &M_eff);
void ComputePressure(const int i, const double rho, const double mass_specific_energy,
const double vol_specific_energy, const double pInitial, const double d_iso,
double &pFinal, double &p_rate);
void ComputeStressDeviator(const int i, const Eigen::Matrix3d& sigmaInitial_dev,
const Eigen::Matrix3d& d_dev, Eigen::Matrix3d &sigmaFinal_dev,
void ComputeStressDeviator(const int i, const Eigen::Matrix3d &sigmaInitial_dev,
const Eigen::Matrix3d &d_dev, Eigen::Matrix3d &sigmaFinal_dev,
Eigen::Matrix3d &sigma_dev_rate, double &plastic_strain_increment);
void ComputeDamage(const int i, const Eigen::Matrix3d& strain, const Eigen::Matrix3d& sigmaFinal,
void ComputeDamage(const int i, const Eigen::Matrix3d &strain, const Eigen::Matrix3d &sigmaFinal,
Eigen::Matrix3d &sigma_damaged);
protected:

View File

@ -47,8 +47,8 @@ class PairTriSurf : public Pair {
void init_style() override;
void init_list(int, class NeighList *) override;
double memory_usage() override;
void PointTriangleDistance(const Eigen::Vector3d& P, const Eigen::Vector3d& TRI1,
const Eigen::Vector3d& TRI2, const Eigen::Vector3d& TRI3,
void PointTriangleDistance(const Eigen::Vector3d &P, const Eigen::Vector3d &TRI1,
const Eigen::Vector3d &TRI2, const Eigen::Vector3d &TRI3,
Eigen::Vector3d &CP, double &dist);
double clamp(const double a, const double min, const double max);
void *extract(const char *, int &) override;

View File

@ -53,12 +53,13 @@ class PairULSPH : public Pair {
void *extract(const char *, int &) override;
void PreCompute();
void PreCompute_DensitySummation();
double effective_shear_modulus(const Eigen::Matrix3d& d_dev, const Eigen::Matrix3d& deltaStressDev,
const double dt, const int itype);
double effective_shear_modulus(const Eigen::Matrix3d &d_dev,
const Eigen::Matrix3d &deltaStressDev, const double dt,
const int itype);
Eigen::Vector3d ComputeHourglassForce(const int i, const int itype, const int j, const int jtype,
const Eigen::Vector3d& dv, const Eigen::Vector3d& xij,
const Eigen::Vector3d& g, const double c_ij,
const Eigen::Vector3d &dv, const Eigen::Vector3d &xij,
const Eigen::Vector3d &g, const double c_ij,
const double mu_ij, const double rho_ij);
protected:

View File

@ -44,18 +44,18 @@ void PerfectGasEOS(const double gamma, const double vol, const double mass, cons
/*
* Material strength models
*/
void LinearStrength(const double mu, const Eigen::Matrix3d& sigmaInitial_dev,
const Eigen::Matrix3d& d_dev, const double dt, Eigen::Matrix3d &sigmaFinal_dev__,
Eigen::Matrix3d &sigma_dev_rate__);
void LinearStrength(const double mu, const Eigen::Matrix3d &sigmaInitial_dev,
const Eigen::Matrix3d &d_dev, const double dt,
Eigen::Matrix3d &sigmaFinal_dev__, Eigen::Matrix3d &sigma_dev_rate__);
void LinearPlasticStrength(const double G, const double yieldStress,
const Eigen::Matrix3d& sigmaInitial_dev, const Eigen::Matrix3d& d_dev,
const Eigen::Matrix3d &sigmaInitial_dev, const Eigen::Matrix3d &d_dev,
const double dt, Eigen::Matrix3d &sigmaFinal_dev__,
Eigen::Matrix3d &sigma_dev_rate__, double &plastic_strain_increment);
void JohnsonCookStrength(const double G, const double cp, const double espec, const double A,
const double B, const double a, const double C, const double epdot0,
const double T0, const double Tmelt, const double M, const double dt,
const double ep, const double epdot,
const Eigen::Matrix3d& sigmaInitial_dev, const Eigen::Matrix3d& d_dev,
const Eigen::Matrix3d &sigmaInitial_dev, const Eigen::Matrix3d &d_dev,
Eigen::Matrix3d &sigmaFinal_dev__, Eigen::Matrix3d &sigma_dev_rate__,
double &plastic_strain_increment);
@ -63,9 +63,9 @@ void JohnsonCookStrength(const double G, const double cp, const double espec, co
* Damage models
*/
bool IsotropicMaxStrainDamage(const Eigen::Matrix3d& E, const double maxStrain);
bool IsotropicMaxStressDamage(const Eigen::Matrix3d& E, const double maxStrain);
double JohnsonCookFailureStrain(const double p, const Eigen::Matrix3d& Sdev, const double d1,
bool IsotropicMaxStrainDamage(const Eigen::Matrix3d &E, const double maxStrain);
bool IsotropicMaxStressDamage(const Eigen::Matrix3d &E, const double maxStrain);
double JohnsonCookFailureStrain(const double p, const Eigen::Matrix3d &Sdev, const double d1,
const double d2, const double d3, const double d4,
const double epdot0, const double epdot);

View File

@ -83,7 +83,10 @@ namespace user_manifold {
return largest;
}
inline double dot(double *a, double *b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }
inline double dot(double *a, double *b)
{
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
} // namespace user_manifold

View File

@ -197,10 +197,16 @@ class PairMEAMSpline : public Pair {
}
/// Returns the number of bytes used by this function object.
double memory_usage() const { return sizeof(*this) + sizeof(X[0]) * N * 3; }
double memory_usage() const
{
return sizeof(*this) + sizeof(X[0]) * N * 3;
}
/// Returns the cutoff radius of this function.
double cutoff() const { return X[N - 1]; }
double cutoff() const
{
return X[N - 1];
}
/// Writes a Gnuplot script that plots the spline function.
void writeGnuplot(const char *filename, const char *title = nullptr) const;

View File

@ -187,10 +187,16 @@ class PairMEAMSWSpline : public Pair {
}
/// Returns the number of bytes used by this function object.
double memory_usage() const { return sizeof(*this) + sizeof(X[0]) * N * 3; }
double memory_usage() const
{
return sizeof(*this) + sizeof(X[0]) * N * 3;
}
/// Returns the cutoff radius of this function.
double cutoff() const { return X[N - 1]; }
double cutoff() const
{
return X[N - 1];
}
/// Writes a Gnuplot script that plots the spline function.
void writeGnuplot(const char *filename, const char *title = nullptr) const;

View File

@ -55,8 +55,8 @@ class PairSWAngleTable : public PairSW {
ParamTable *table_params; // tabulated parameter set for an I-J-K interaction
void read_file(char *) override;
void threebody_table(Param *, Param *, ParamTable *, double, double, double *, double *,
double *, double *, int, double &);
void threebody_table(Param *, Param *, ParamTable *, double, double, double *, double *, double *,
double *, int, double &);
void read_table(Table *, char *, char *);
void spline_table(Table *);

View File

@ -26,6 +26,7 @@ namespace LAMMPS_NS {
class FixBondBreak : public Fix {
friend class FixSRPREACT;
public:
FixBondBreak(class LAMMPS *, int, char **);
~FixBondBreak() override;

View File

@ -26,6 +26,7 @@ namespace LAMMPS_NS {
class FixBondCreate : public Fix {
friend class FixSRPREACT;
public:
FixBondCreate(class LAMMPS *, int, char **);
~FixBondCreate() override;

View File

@ -21,7 +21,6 @@ PairStyle(mesocnt/viscous, PairMesoCNTViscous);
// clang-format on
#else
#ifndef LMP_PAIR_MESOCNT_VISCOUS_H
#define LMP_PAIR_MESOCNT_VISCOUS_H

View File

@ -42,8 +42,8 @@ class MLIAPDescriptorSNAP : public MLIAPDescriptor {
int switchinnerflag;
double rfac0, rmin0;
double* sinnerelem;
double* dinnerelem;
double *sinnerelem;
double *dinnerelem;
};
} // namespace LAMMPS_NS

View File

@ -19,6 +19,7 @@
#include "mliap_model_python.h"
#include "comm.h"
#include "error.h"
#include "lmppython.h"
#include "mliap_data.h"
@ -26,7 +27,6 @@
#include "pair_mliap.h"
#include "python_compat.h"
#include "utils.h"
#include "comm.h"
#include <Python.h>

View File

@ -53,11 +53,20 @@ namespace RANN {
Activation::~Activation() {}
//default is linear activation (no change).
double Activation::activation_function(double A) { return A; }
double Activation::activation_function(double A)
{
return A;
}
double Activation::dactivation_function(double) { return 1.0; }
double Activation::dactivation_function(double)
{
return 1.0;
}
double Activation::ddactivation_function(double) { return 0.0; }
double Activation::ddactivation_function(double)
{
return 0.0;
}
} // namespace RANN
} // namespace LAMMPS_NS

View File

@ -49,11 +49,20 @@ namespace RANN {
style = "linear";
}
double Activation_linear::activation_function(double A) { return A; }
double Activation_linear::activation_function(double A)
{
return A;
}
double Activation_linear::dactivation_function(double) { return 1.0; }
double Activation_linear::dactivation_function(double)
{
return 1.0;
}
double Activation_linear::ddactivation_function(double) { return 0.0; }
double Activation_linear::ddactivation_function(double)
{
return 0.0;
}
} // namespace RANN
} // namespace LAMMPS_NS

View File

@ -227,7 +227,7 @@ void ComputeSNAGridLocal::compute_local()
const double ztmp = xgrid[2];
// currently, all grid points are type 1
// not clear what a better choice would be
// not clear what a better choice would be
const int itype = 1;
int ielem = 0;

View File

@ -62,7 +62,7 @@ class PairSNAP : public Pair {
int switchinnerflag; // inner cutoff switch
double *sinnerelem; // element inner cutoff midpoint
double *dinnerelem; // element inner cutoff half-width
int chunksize,parallel_thresh;
int chunksize, parallel_thresh;
double rfac0, rmin0, wj1, wj2;
int rcutfacflag, twojmaxflag; // flags for required parameters
int beta_max; // length of beta

View File

@ -77,8 +77,8 @@ class SNA : protected Pointers {
// only allocated for switch_inner_flag=1
double *sinnerij; // short inner cutoff midpoint list
double *dinnerij; // short inner half-width list
double *sinnerij; // short inner cutoff midpoint list
double *dinnerij; // short inner half-width list
// only allocated for chem_flag=1

View File

@ -388,7 +388,8 @@ void plugin_unload(const char *style, const char *name, LAMMPS *lmp)
auto found = region_map->find(name);
if (found != region_map->end()) region_map->erase(name);
for (auto &iregion : lmp->domain->get_region_by_style(name)) lmp->domain->delete_region(iregion);
for (auto &iregion : lmp->domain->get_region_by_style(name))
lmp->domain->delete_region(iregion);
} else if (pstyle == "command") {

View File

@ -189,43 +189,43 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : Fix(lmp,
iarg += ntypes + 1;
// delete species
} else if (strcmp(arg[iarg],"delete") == 0) {
} else if (strcmp(arg[iarg], "delete") == 0) {
delflag = 1;
delete[] filedel;
filedel = utils::strdup(arg[iarg+1]);
filedel = utils::strdup(arg[iarg + 1]);
if (me == 0) {
fdel = fopen(filedel, "w");
if (!fdel) error->one(FLERR,"Cannot open fix reaxff/species delete file {}: {}",
filedel, utils::getsyserror());
if (!fdel)
error->one(FLERR, "Cannot open fix reaxff/species delete file {}: {}", filedel,
utils::getsyserror());
}
del_opened = 1;
if (strcmp(arg[iarg+2],"masslimit") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix reaxff/species command");
if (strcmp(arg[iarg + 2], "masslimit") == 0) {
if (iarg + 5 > narg) error->all(FLERR, "Illegal fix reaxff/species command");
masslimitflag = 1;
massmin = atof(arg[iarg+3]);
massmax = atof(arg[iarg+4]);
massmin = atof(arg[iarg + 3]);
massmax = atof(arg[iarg + 4]);
iarg += 5;
} else if (strcmp(arg[iarg+2],"specieslist") == 0) {
} else if (strcmp(arg[iarg + 2], "specieslist") == 0) {
specieslistflag = 1;
ndelspec = atoi(arg[iarg+3]);
if (iarg+ndelspec+4 > narg) error->all(FLERR,"Illegal fix reaxff/species command");
ndelspec = atoi(arg[iarg + 3]);
if (iarg + ndelspec + 4 > narg) error->all(FLERR, "Illegal fix reaxff/species command");
del_species.resize(ndelspec);
for (int i = 0; i < ndelspec; i ++)
del_species[i] = arg[iarg+4+i];
for (int i = 0; i < ndelspec; i++) del_species[i] = arg[iarg + 4 + i];
if (me == 0) {
fprintf(fdel,"Timestep");
for (i = 0; i < ndelspec; i++)
fprintf(fdel,"\t%s",del_species[i].c_str());
fprintf(fdel,"\n");
fprintf(fdel, "Timestep");
for (i = 0; i < ndelspec; i++) fprintf(fdel, "\t%s", del_species[i].c_str());
fprintf(fdel, "\n");
fflush(fdel);
}
iarg += ndelspec + 4;
} else error->all(FLERR, "Illegal fix reaxff/species command");
} else
error->all(FLERR, "Illegal fix reaxff/species command");
// position of molecules
} else if (strcmp(arg[iarg], "position") == 0) {
@ -524,17 +524,19 @@ void FixReaxFFSpecies::SortMolecule(int &Nmole)
MPI_Allreduce(&lo, &idlo, 1, MPI_INT, MPI_MIN, world);
MPI_Allreduce(&hi, &idhi, 1, MPI_INT, MPI_MAX, world);
int nlen = idhi - idlo + 1;
if (nlen <= 0) { // no atoms in group
if (nlen <= 0) { // no atoms in group
Nmole = 0;
return;
}
if (idlo == ntotal)
if (me == 0)
error->warning(FLERR, "Atom with cluster ID = maxmol included in fix reaxff/species group {}",group->names[igroup]);
error->warning(FLERR, "Atom with cluster ID = maxmol included in fix reaxff/species group {}",
group->names[igroup]);
MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world);
if (flagall && me == 0)
error->warning(FLERR, "Atom with cluster ID = 0 included in fix reaxff/species group {}", group->names[igroup]);
error->warning(FLERR, "Atom with cluster ID = 0 included in fix reaxff/species group {}",
group->names[igroup]);
memory->create(molmap, nlen, "reaxff/species:molmap");
for (n = 0; n < nlen; n++) molmap[n] = 0;
@ -628,13 +630,13 @@ void FixReaxFFSpecies::FindSpecies(int Nmole, int &Nspec)
if (MolName[ntypes * k + l] != Name[l]) flag_spec = 1;
if (flag_spec == 0) {
NMol[k]++;
Mol2Spec[m-1] = k;
Mol2Spec[m - 1] = k;
}
flag_identity *= flag_spec;
}
if (Nspec == 0 || flag_identity == 1) {
for (l = 0; l < ntypes; l++) MolName[ntypes * Nspec + l] = Name[l];
Mol2Spec[m-1] = Nspec;
Mol2Spec[m - 1] = Nspec;
Nspec++;
}
}
@ -844,8 +846,10 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
memory->create(Nameall, ntypes, "reaxff/species:Nameall");
int ndelcomm;
if (masslimitflag) ndelcomm = Nspec;
else ndelcomm = ndelspec;
if (masslimitflag)
ndelcomm = Nspec;
else
ndelcomm = ndelspec;
double *deletecount;
memory->create(deletecount, ndelcomm, "reaxff/species:deletecount");
@ -863,7 +867,7 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
if (!(mask[i] & groupbit)) continue;
cid = nint(clusterID[i]);
if (cid == m) {
itype = atom->type[i]-1;
itype = atom->type[i] - 1;
Name[itype]++;
count++;
marklist[nmarklist++] = i;
@ -877,14 +881,16 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
MPI_Allreduce(Name, Nameall, ntypes, MPI_INT, MPI_SUM, world);
for (n = 0; n < ntypes; n++) Name[n] = Nameall[n];
MPI_Allreduce(&localmass, &totalmass, 1 , MPI_DOUBLE, MPI_SUM, world);
MPI_Allreduce(&localmass, &totalmass, 1, MPI_DOUBLE, MPI_SUM, world);
species_str = "";
for (j = 0; j < ntypes; j++) {
if (Name[j] != 0) {
if (eletype) species_str += eletype[j];
else species_str += ele[j];
if (Name[j] != 1) species_str += fmt::format("{}",Name[j]);
if (eletype)
species_str += eletype[j];
else
species_str += ele[j];
if (Name[j] != 1) species_str += fmt::format("{}", Name[j]);
}
}
@ -895,7 +901,7 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
if (totalmass > massmin && totalmass < massmax) {
for (j = 0; j < nmarklist; j++) {
mark[marklist[j]] = 1;
deletecount[Mol2Spec[m-1]] += 1.0 / (double) count;
deletecount[Mol2Spec[m - 1]] += 1.0 / (double) count;
}
}
} else {
@ -916,9 +922,9 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
// delete atoms. loop in reverse order to avoid copying marked atoms
ndel = ndelone = 0;
for (i = atom->nlocal-1; i >= 0; i--) {
for (i = atom->nlocal - 1; i >= 0; i--) {
if (mark[i] == 1) {
avec->copy(atom->nlocal-1,i,1);
avec->copy(atom->nlocal - 1, i, 1);
atom->nlocal--;
ndelone++;
}
@ -928,8 +934,10 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
atom->natoms -= ndel;
if (me == 0) MPI_Reduce(MPI_IN_PLACE, deletecount, ndelcomm, MPI_DOUBLE, MPI_SUM, 0, world);
else MPI_Reduce(deletecount, deletecount, ndelcomm, MPI_DOUBLE, MPI_SUM, 0, world);
if (me == 0)
MPI_Reduce(MPI_IN_PLACE, deletecount, ndelcomm, MPI_DOUBLE, MPI_SUM, 0, world);
else
MPI_Reduce(deletecount, deletecount, ndelcomm, MPI_DOUBLE, MPI_SUM, 0, world);
if (me == 0) {
if (masslimitflag) {
@ -941,11 +949,13 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
printflag = 1;
}
fprintf(fdel, " %g ", deletecount[m]);
for (j = 0; j < ntypes; j ++) {
for (j = 0; j < ntypes; j++) {
int itemp = MolName[ntypes * m + j];
if (itemp != 0) {
if (eletype) fprintf(fdel, "%s", eletype[j]);
else fprintf(fdel, "%c", ele[j]);
if (eletype)
fprintf(fdel, "%s", eletype[j]);
else
fprintf(fdel, "%c", ele[j]);
if (itemp != 1) fprintf(fdel, "%d", itemp);
}
}
@ -962,9 +972,7 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec)
if (writeflag) {
fmt::print(fdel, "{}", update->ntimestep);
for (i = 0; i < ndelspec; i++) {
fprintf(fdel, "\t%g", deletecount[i]);
}
for (i = 0; i < ndelspec; i++) { fprintf(fdel, "\t%g", deletecount[i]); }
fprintf(fdel, "\n");
fflush(fdel);
}

View File

@ -574,7 +574,7 @@ void FixEHEX::com_properties(double *vr, double *sfr, double *sfvr, double *K, d
mi = (rmass) ? rmass[0] : mass[type[0]];
else
mi = 1.0;
if ((*mr / mi) < 1.e-14) error->all(FLERR, "Fix ehex error mass of region is close to zero");
if ((*mr / mi) < 1.e-14) error->all(FLERR, "Fix ehex error mass of region is close to zero");
// total kinetic energy of region

View File

@ -65,14 +65,14 @@ class FixShake : public Fix {
double compute_scalar() override;
protected:
int vflag_post_force; // store the vflag of last post_force call
int eflag_pre_reverse; // store the eflag of last pre_reverse call
int respa; // 0 = vel. Verlet, 1 = respa
int rattle; // 0 = SHAKE, 1 = RATTLE
double tolerance; // SHAKE tolerance
int max_iter; // max # of SHAKE iterations
int output_every; // SHAKE stat output every so often
bigint next_output; // timestep for next output
int vflag_post_force; // store the vflag of last post_force call
int eflag_pre_reverse; // store the eflag of last pre_reverse call
int respa; // 0 = vel. Verlet, 1 = respa
int rattle; // 0 = SHAKE, 1 = RATTLE
double tolerance; // SHAKE tolerance
int max_iter; // max # of SHAKE iterations
int output_every; // SHAKE stat output every so often
bigint next_output; // timestep for next output
// settings from input command
int *bond_flag, *angle_flag; // bond/angle types to constrain

View File

@ -61,17 +61,17 @@ enum { SHIFT_NO, SHIFT_YES, SHIFT_POSSIBLE };
#define MAXITER 20
static const char cite_fix_srd[] =
"fix srd command: doi:10.1063/1.3419070\n\n"
"@Article{Petersen10,\n"
" author = {M. K. Petersen and J. B. Lechman and S. J. Plimpton and\n"
" G. S. Grest and in 't Veld, P. J. and P. R. Schunk},\n"
" title = {Mesoscale Hydrodynamics via Stochastic Rotation\n"
" Dynamics: Comparison with {L}ennard-{J}ones Fluid},\n"
" journal = {J.~Chem.\\ Phys.},\n"
" year = 2010,\n"
" volume = 132,\n"
" pages = 174106\n"
"}\n\n";
"fix srd command: doi:10.1063/1.3419070\n\n"
"@Article{Petersen10,\n"
" author = {M. K. Petersen and J. B. Lechman and S. J. Plimpton and\n"
" G. S. Grest and in 't Veld, P. J. and P. R. Schunk},\n"
" title = {Mesoscale Hydrodynamics via Stochastic Rotation\n"
" Dynamics: Comparison with {L}ennard-{J}ones Fluid},\n"
" journal = {J.~Chem.\\ Phys.},\n"
" year = 2010,\n"
" volume = 132,\n"
" pages = 174106\n"
"}\n\n";
//#define SRD_DEBUG 1
//#define SRD_DEBUG_ATOMID 58

View File

@ -368,17 +368,17 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond, double ea
called by AngleAmoeba for its 4-body angle term
------------------------------------------------------------------------- */
void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
double eangle,
void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond, double eangle,
double *f1, double *f2, double *f3, double *f4)
{
double eanglefourth,v[6];
double eanglefourth, v[6];
if (eflag_either) {
if (eflag_global) {
if (newton_bond) energy += eangle;
if (newton_bond)
energy += eangle;
else {
eanglefourth = FOURTH*eangle;
eanglefourth = FOURTH * eangle;
if (i < nlocal) energy += eanglefourth;
if (j < nlocal) energy += eanglefourth;
if (k < nlocal) energy += eanglefourth;
@ -386,7 +386,7 @@ void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
}
}
if (eflag_atom) {
eanglefourth = FOURTH*eangle;
eanglefourth = FOURTH * eangle;
if (newton_bond || i < nlocal) eatom[i] += eanglefourth;
if (newton_bond || j < nlocal) eatom[j] += eanglefourth;
if (newton_bond || k < nlocal) eatom[k] += eanglefourth;
@ -396,12 +396,12 @@ void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
if (vflag_either) {
double **x = atom->x;
v[0] = x[i][0]*f1[0] + x[j][0]*f2[0] + x[k][0]*f3[0] + x[m][0]*f4[0];
v[1] = x[i][1]*f1[1] + x[j][1]*f2[1] + x[k][1]*f3[1] + x[m][1]*f4[1];
v[2] = x[i][2]*f1[2] + x[j][2]*f2[2] + x[k][2]*f3[2] + x[m][2]*f4[2];
v[3] = x[i][0]*f1[1] + x[j][0]*f2[1] + x[k][0]*f3[1] + x[m][0]*f4[1];
v[4] = x[i][0]*f1[2] + x[j][0]*f2[2] + x[k][0]*f3[2] + x[m][0]*f4[2];
v[5] = x[i][1]*f1[2] + x[j][1]*f2[2] + x[k][1]*f3[2] + x[m][1]*f4[2];
v[0] = x[i][0] * f1[0] + x[j][0] * f2[0] + x[k][0] * f3[0] + x[m][0] * f4[0];
v[1] = x[i][1] * f1[1] + x[j][1] * f2[1] + x[k][1] * f3[1] + x[m][1] * f4[1];
v[2] = x[i][2] * f1[2] + x[j][2] * f2[2] + x[k][2] * f3[2] + x[m][2] * f4[2];
v[3] = x[i][0] * f1[1] + x[j][0] * f2[1] + x[k][0] * f3[1] + x[m][0] * f4[1];
v[4] = x[i][0] * f1[2] + x[j][0] * f2[2] + x[k][0] * f3[2] + x[m][0] * f4[2];
v[5] = x[i][1] * f1[2] + x[j][1] * f2[2] + x[k][1] * f3[2] + x[m][1] * f4[2];
if (vflag_global) {
if (newton_bond) {
@ -417,88 +417,87 @@ void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
if (j < nlocal) prefactor += 1.0;
if (k < nlocal) prefactor += 1.0;
if (m < nlocal) prefactor += 1.0;
virial[0] += prefactor*FOURTH*v[0];
virial[1] += prefactor*FOURTH*v[1];
virial[2] += prefactor*FOURTH*v[2];
virial[3] += prefactor*FOURTH*v[3];
virial[4] += prefactor*FOURTH*v[4];
virial[5] += prefactor*FOURTH*v[5];
virial[0] += prefactor * FOURTH * v[0];
virial[1] += prefactor * FOURTH * v[1];
virial[2] += prefactor * FOURTH * v[2];
virial[3] += prefactor * FOURTH * v[3];
virial[4] += prefactor * FOURTH * v[4];
virial[5] += prefactor * FOURTH * v[5];
}
}
if (vflag_atom) {
if (newton_bond || i < nlocal) {
vatom[i][0] += FOURTH*v[0];
vatom[i][1] += FOURTH*v[1];
vatom[i][2] += FOURTH*v[2];
vatom[i][3] += FOURTH*v[3];
vatom[i][4] += FOURTH*v[4];
vatom[i][5] += FOURTH*v[5];
vatom[i][0] += FOURTH * v[0];
vatom[i][1] += FOURTH * v[1];
vatom[i][2] += FOURTH * v[2];
vatom[i][3] += FOURTH * v[3];
vatom[i][4] += FOURTH * v[4];
vatom[i][5] += FOURTH * v[5];
}
if (newton_bond || j < nlocal) {
vatom[j][0] += FOURTH*v[0];
vatom[j][1] += FOURTH*v[1];
vatom[j][2] += FOURTH*v[2];
vatom[j][3] += FOURTH*v[3];
vatom[j][4] += FOURTH*v[4];
vatom[j][5] += FOURTH*v[5];
vatom[j][0] += FOURTH * v[0];
vatom[j][1] += FOURTH * v[1];
vatom[j][2] += FOURTH * v[2];
vatom[j][3] += FOURTH * v[3];
vatom[j][4] += FOURTH * v[4];
vatom[j][5] += FOURTH * v[5];
}
if (newton_bond || k < nlocal) {
vatom[k][0] += FOURTH*v[0];
vatom[k][1] += FOURTH*v[1];
vatom[k][2] += FOURTH*v[2];
vatom[k][3] += FOURTH*v[3];
vatom[k][4] += FOURTH*v[4];
vatom[k][5] += FOURTH*v[5];
vatom[k][0] += FOURTH * v[0];
vatom[k][1] += FOURTH * v[1];
vatom[k][2] += FOURTH * v[2];
vatom[k][3] += FOURTH * v[3];
vatom[k][4] += FOURTH * v[4];
vatom[k][5] += FOURTH * v[5];
}
if (newton_bond || m < nlocal) {
vatom[m][0] += FOURTH*v[0];
vatom[m][1] += FOURTH*v[1];
vatom[m][2] += FOURTH*v[2];
vatom[m][3] += FOURTH*v[3];
vatom[m][4] += FOURTH*v[4];
vatom[m][5] += FOURTH*v[5];
vatom[m][0] += FOURTH * v[0];
vatom[m][1] += FOURTH * v[1];
vatom[m][2] += FOURTH * v[2];
vatom[m][3] += FOURTH * v[3];
vatom[m][4] += FOURTH * v[4];
vatom[m][5] += FOURTH * v[5];
}
}
}
}
/* ----------------------------------------------------------------------
tally energy and virial into global and per-atom accumulators
called by AngleAmoeba for its 2-body Urey-Bradley H-H bond term
identical to Bond:ev_tally()
------------------------------------------------------------------------- */
void Angle::ev_tally2(int i, int j, int nlocal, int newton_bond,
double ebond, double fbond,
void Angle::ev_tally2(int i, int j, int nlocal, int newton_bond, double ebond, double fbond,
double delx, double dely, double delz)
{
double ebondhalf,v[6];
double ebondhalf, v[6];
if (eflag_either) {
if (eflag_global) {
if (newton_bond) energy += ebond;
if (newton_bond)
energy += ebond;
else {
ebondhalf = 0.5*ebond;
ebondhalf = 0.5 * ebond;
if (i < nlocal) energy += ebondhalf;
if (j < nlocal) energy += ebondhalf;
}
}
if (eflag_atom) {
ebondhalf = 0.5*ebond;
ebondhalf = 0.5 * ebond;
if (newton_bond || i < nlocal) eatom[i] += ebondhalf;
if (newton_bond || j < nlocal) eatom[j] += ebondhalf;
}
}
if (vflag_either) {
v[0] = delx*delx*fbond;
v[1] = dely*dely*fbond;
v[2] = delz*delz*fbond;
v[3] = delx*dely*fbond;
v[4] = delx*delz*fbond;
v[5] = dely*delz*fbond;
v[0] = delx * delx * fbond;
v[1] = dely * dely * fbond;
v[2] = delz * delz * fbond;
v[3] = delx * dely * fbond;
v[4] = delx * delz * fbond;
v[5] = dely * delz * fbond;
if (vflag_global) {
if (newton_bond) {
@ -510,40 +509,40 @@ void Angle::ev_tally2(int i, int j, int nlocal, int newton_bond,
virial[5] += v[5];
} else {
if (i < nlocal) {
virial[0] += 0.5*v[0];
virial[1] += 0.5*v[1];
virial[2] += 0.5*v[2];
virial[3] += 0.5*v[3];
virial[4] += 0.5*v[4];
virial[5] += 0.5*v[5];
virial[0] += 0.5 * v[0];
virial[1] += 0.5 * v[1];
virial[2] += 0.5 * v[2];
virial[3] += 0.5 * v[3];
virial[4] += 0.5 * v[4];
virial[5] += 0.5 * v[5];
}
if (j < nlocal) {
virial[0] += 0.5*v[0];
virial[1] += 0.5*v[1];
virial[2] += 0.5*v[2];
virial[3] += 0.5*v[3];
virial[4] += 0.5*v[4];
virial[5] += 0.5*v[5];
virial[0] += 0.5 * v[0];
virial[1] += 0.5 * v[1];
virial[2] += 0.5 * v[2];
virial[3] += 0.5 * v[3];
virial[4] += 0.5 * v[4];
virial[5] += 0.5 * v[5];
}
}
}
if (vflag_atom) {
if (newton_bond || i < nlocal) {
vatom[i][0] += 0.5*v[0];
vatom[i][1] += 0.5*v[1];
vatom[i][2] += 0.5*v[2];
vatom[i][3] += 0.5*v[3];
vatom[i][4] += 0.5*v[4];
vatom[i][5] += 0.5*v[5];
vatom[i][0] += 0.5 * v[0];
vatom[i][1] += 0.5 * v[1];
vatom[i][2] += 0.5 * v[2];
vatom[i][3] += 0.5 * v[3];
vatom[i][4] += 0.5 * v[4];
vatom[i][5] += 0.5 * v[5];
}
if (newton_bond || j < nlocal) {
vatom[j][0] += 0.5*v[0];
vatom[j][1] += 0.5*v[1];
vatom[j][2] += 0.5*v[2];
vatom[j][3] += 0.5*v[3];
vatom[j][4] += 0.5*v[4];
vatom[j][5] += 0.5*v[5];
vatom[j][0] += 0.5 * v[0];
vatom[j][1] += 0.5 * v[1];
vatom[j][2] += 0.5 * v[2];
vatom[j][3] += 0.5 * v[3];
vatom[j][4] += 0.5 * v[4];
vatom[j][5] += 0.5 * v[5];
}
}
}

View File

@ -33,7 +33,7 @@ class Atom : protected Pointers {
enum { GROW = 0, RESTART = 1, BORDER = 2 };
enum { ATOMIC = 0, MOLECULAR = 1, TEMPLATE = 2 };
enum { ATOM = 0, BOND = 1, ANGLE = 2, DIHEDRAL = 3, IMPROPER = 4 };
enum { NUMERIC = 0, LABELS = 1};
enum { NUMERIC = 0, LABELS = 1 };
enum { MAP_NONE = 0, MAP_ARRAY = 1, MAP_HASH = 2, MAP_YES = 3 };
// atom counts
@ -166,9 +166,9 @@ class Atom : protected Pointers {
// AMOEBA package
int *nspecial15; // # of 1-5 neighs
tagint **special15; // IDs of 1-5 neighs of each atom
int maxspecial15; // special15[nlocal][maxspecial15]
int *nspecial15; // # of 1-5 neighs
tagint **special15; // IDs of 1-5 neighs of each atom
int maxspecial15; // special15[nlocal][maxspecial15]
// DIELECTRIC package
@ -331,8 +331,7 @@ class Atom : protected Pointers {
void deallocate_topology();
void data_atoms(int, char *, tagint, tagint, int, int, double *,
int, int *);
void data_atoms(int, char *, tagint, tagint, int, int, double *, int, int *);
void data_vels(int, char *, tagint);
void data_bonds(int, char *, int *, tagint, int, int, int *);
void data_angles(int, char *, int *, tagint, int, int, int *);
@ -354,7 +353,7 @@ class Atom : protected Pointers {
void add_molecule(int, char **);
int find_molecule(const char *);
std::vector<Molecule *>get_molecule_by_id(const std::string &);
std::vector<Molecule *> get_molecule_by_id(const std::string &);
void add_molecule_atom(class Molecule *, int, int, tagint);
void add_label_map();

View File

@ -208,7 +208,7 @@ void AtomVec::grow(int n)
if (n == 0)
grow_nmax();
else
nmax = MAX(n,nmax);
nmax = MAX(n, nmax);
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT) error->one(FLERR, "Per-processor system is too big");
@ -1705,7 +1705,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector<std:
} else if (datatype == Atom::INT) {
if (cols == 0) {
int *vec = *((int **) pdata);
if (vec == atom->type) { // custom treatment of atom types
if (vec == atom->type) { // custom treatment of atom types
extract = values[ivalue++];
continue;
}
@ -1730,8 +1730,8 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector<std:
// error checks applicable to all styles
if (tag[nlocal] <= 0)
error->one(FLERR, "Invalid atom ID {} in line {} of Atoms section of data file",
tag[nlocal], nlocal+1);
error->one(FLERR, "Invalid atom ID {} in line {} of Atoms section of data file", tag[nlocal],
nlocal + 1);
// if needed, modify unpacked values or initialize other peratom values
@ -1825,8 +1825,9 @@ void AtomVec::write_data(FILE *fp, int n, double **buf)
if (cols == 0) {
if (atom->types_style == Atom::LABELS &&
atom->peratom[mdata_atom.index[nn]].name == "type") {
fmt::print(fp," {}",atom->lmap->typelabel[ubuf(buf[i][j++]).i-1]);
} else fmt::print(fp, " {}", ubuf(buf[i][j++]).i);
fmt::print(fp, " {}", atom->lmap->typelabel[ubuf(buf[i][j++]).i - 1]);
} else
fmt::print(fp, " {}", ubuf(buf[i][j++]).i);
} else {
for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i);
}
@ -2036,8 +2037,7 @@ void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index)
std::string typestr;
for (int i = 0; i < n; i++) {
typestr = std::to_string(buf[i][0]);
if (atom->types_style == Atom::LABELS)
typestr = atom->lmap->btypelabel[buf[i][0]-1];
if (atom->types_style == Atom::LABELS) typestr = atom->lmap->btypelabel[buf[i][0] - 1];
fmt::print(fp, "{} {} {} {}\n", index, typestr, buf[i][1], buf[i][2]);
index++;
}
@ -2102,10 +2102,8 @@ void AtomVec::write_angle(FILE *fp, int n, tagint **buf, int index)
std::string typestr;
for (int i = 0; i < n; i++) {
typestr = std::to_string(buf[i][0]);
if (atom->types_style == Atom::LABELS)
typestr = atom->lmap->atypelabel[buf[i][0]-1];
fmt::print(fp, "{} {} {} {} {}\n", index,
typestr, buf[i][1], buf[i][2], buf[i][3]);
if (atom->types_style == Atom::LABELS) typestr = atom->lmap->atypelabel[buf[i][0] - 1];
fmt::print(fp, "{} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3]);
index++;
}
}
@ -2167,10 +2165,9 @@ void AtomVec::write_dihedral(FILE *fp, int n, tagint **buf, int index)
std::string typestr;
for (int i = 0; i < n; i++) {
typestr = std::to_string(buf[i][0]);
if (atom->types_style == Atom::LABELS)
typestr = atom->lmap->dtypelabel[buf[i][0]-1];
fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr,
buf[i][1], buf[i][2], buf[i][3], buf[i][4]);
if (atom->types_style == Atom::LABELS) typestr = atom->lmap->dtypelabel[buf[i][0] - 1];
fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3],
buf[i][4]);
index++;
}
}
@ -2232,10 +2229,9 @@ void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index)
std::string typestr;
for (int i = 0; i < n; i++) {
typestr = std::to_string(buf[i][0]);
if (atom->types_style == Atom::LABELS)
typestr = atom->lmap->itypelabel[buf[i][0]-1];
fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr,
buf[i][1], buf[i][2], buf[i][3], buf[i][4]);
if (atom->types_style == Atom::LABELS) typestr = atom->lmap->itypelabel[buf[i][0] - 1];
fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3],
buf[i][4]);
index++;
}
}

View File

@ -185,8 +185,8 @@ void ComputeAngmomChunk::lock_enable()
void ComputeAngmomChunk::lock_disable()
{
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
if(cchunk) cchunk->lockcount--;
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
if (cchunk) cchunk->lockcount--;
}
/* ----------------------------------------------------------------------

View File

@ -36,7 +36,8 @@ using namespace LAMMPS_NS;
enum { NOBIAS, BIAS };
static const char cite_centroid_angle_improper_dihedral[] =
"compute centroid/stress/atom for angles, impropers and dihedrals: doi:10.1103/PhysRevE.99.051301\n\n"
"compute centroid/stress/atom for angles, impropers and dihedrals: "
"doi:10.1103/PhysRevE.99.051301\n\n"
"@article{Surblys2019,\n"
" title = {Application of Atomic Stress to Compute Heat Flux via Molecular\n"
" Dynamics for Systems With Many-Body Interactions},\n"

View File

@ -572,7 +572,7 @@ void ComputeChunkAtom::init()
if ((idsflag == ONCE || lockcount) && !fixstore) {
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
fixstore = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1", id_fix, group->names[igroup])));
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1", id_fix, group->names[igroup])));
}
if ((idsflag != ONCE && !lockcount) && fixstore) {

View File

@ -976,7 +976,7 @@ int CreateAtoms::add_quasirandom(const double vert[3][3], tagint molid)
area = 0.5 * MathExtra::len3(temp);
int nparticles = ceil(mesh_density * area);
// estimate radius from number of particles and area
double rad = sqrt(area/MY_PI/nparticles);
double rad = sqrt(area / MY_PI / nparticles);
for (int i = 0; i < nparticles; i++) {
// Define point in unit square

View File

@ -67,8 +67,8 @@ class CreateAtoms : public Command {
void add_single();
void add_random();
void add_mesh(const char *);
int add_bisection(const double [3][3], tagint);
int add_quasirandom(const double [3][3], tagint);
int add_bisection(const double[3][3], tagint);
int add_quasirandom(const double[3][3], tagint);
void add_lattice();
void loop_lattice(int);
void add_molecule(double *);

View File

@ -143,19 +143,22 @@ void CreateBox::command(int narg, char **arg)
atom->angle_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/dihedral/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/dihedral/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "create_box extra/dihedral/per/atom", error);
if (!atom->avec->dihedrals_allow)
error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style());
atom->dihedral_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/improper/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/improper/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "create_box extra/improper/per/atom", error);
if (!atom->avec->impropers_allow)
error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style());
atom->improper_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/special/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "create_box extra/special/per/atom", error);
force->special_extra = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
atom->maxspecial += force->special_extra;
iarg += 2;

View File

@ -358,7 +358,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
if (!(mask[i] & (group1bit|group2bit))) continue;
if (!(mask[i] & (group1bit | group2bit))) continue;
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
@ -370,7 +370,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
factor_lj = special_lj[sbmask(j)];
factor_coul = special_coul[sbmask(j)];
j &= NEIGHMASK;
if (!(mask[j] & (group1bit|group2bit))) continue;
if (!(mask[j] & (group1bit | group2bit))) continue;
// if both weighting factors are 0, skip this pair
// could be 0 and still be in neigh list for long-range Coulombics

View File

@ -45,9 +45,15 @@ class Dump : protected Pointers {
void init();
virtual void write();
virtual int pack_forward_comm(int, int *, double *, int, int *) { return 0; }
virtual int pack_forward_comm(int, int *, double *, int, int *)
{
return 0;
}
virtual void unpack_forward_comm(int, int, double *) {}
virtual int pack_reverse_comm(int, int, double *) { return 0; }
virtual int pack_reverse_comm(int, int, double *)
{
return 0;
}
virtual void unpack_reverse_comm(int, int *, double *) {}
void modify_params(int, char **);
@ -147,11 +153,17 @@ class Dump : protected Pointers {
virtual void init_style() = 0;
virtual void openfile();
virtual int modify_param(int, char **) { return 0; }
virtual int modify_param(int, char **)
{
return 0;
}
virtual void write_header(bigint) = 0;
virtual int count();
virtual void pack(tagint *) = 0;
virtual int convert_string(int, double *) { return 0; }
virtual int convert_string(int, double *)
{
return 0;
}
virtual void write_data(int, double *) = 0;
virtual void write_footer() {}

View File

@ -37,7 +37,7 @@ class DumpLocal : public Dump {
int *vtype; // type of each vector (INT, DOUBLE)
char **vformat; // format string for each vector element
char *columns; // column labels
char *columns; // column labels
char *columns_default;
int nfield; // # of keywords listed by user

View File

@ -30,8 +30,7 @@ enum { MOLECULE, CHARGE, RMASS, IVEC, DVEC, IARRAY, DARRAY };
/* ---------------------------------------------------------------------- */
FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg),
nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr)
Fix(lmp, narg, arg), nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr)
{
if (narg < 4) error->all(FLERR, "Illegal fix property/atom command");
@ -300,12 +299,10 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint
atom->dvector[index[j]][m] = values.next_double();
} else if (styles[j] == IARRAY) {
ncol = cols[j];
for (k = 0; k < ncol; k++)
atom->iarray[index[j]][m][k] = values.next_int();
for (k = 0; k < ncol; k++) atom->iarray[index[j]][m][k] = values.next_int();
} else if (styles[j] == DARRAY) {
ncol = cols[j];
for (k = 0; k < ncol; k++)
atom->darray[index[j]][m][k] = values.next_double();
for (k = 0; k < ncol; k++) atom->darray[index[j]][m][k] = values.next_double();
}
}
}
@ -566,12 +563,10 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/)
atom->dvector[index[nv]][j] = atom->dvector[index[nv]][i];
else if (styles[nv] == IARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k];
for (k = 0; k < ncol; k++) atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k];
} else if (styles[nv] == DARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++)
atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k];
for (k = 0; k < ncol; k++) atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k];
}
}
}
@ -671,8 +666,7 @@ int FixPropertyAtom::unpack_border(int n, int first, double *buf)
ncol = cols[nv];
last = first + n;
for (i = first; i < last; i++)
for (k = 0; k < ncol; k++)
iarray[i][k] = (int) ubuf(buf[m++]).i;
for (k = 0; k < ncol; k++) iarray[i][k] = (int) ubuf(buf[m++]).i;
} else if (styles[nv] == DARRAY) {
double **darray = atom->darray[index[nv]];
ncol = cols[nv];
@ -739,8 +733,7 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf)
atom->dvector[index[nv]][nlocal] = buf[m++];
else if (styles[nv] == IARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i;
for (k = 0; k < ncol; k++) atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i;
} else if (styles[nv] == DARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++) atom->darray[index[nv]][nlocal][k] = buf[m++];
@ -776,12 +769,10 @@ int FixPropertyAtom::pack_restart(int i, double *buf)
buf[m++] = atom->dvector[index[nv]][i];
else if (styles[nv] == IARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++)
buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d;
for (k = 0; k < ncol; k++) buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d;
} else if (styles[nv] == DARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++)
buf[m++] = atom->darray[index[nv]][i][k];
for (k = 0; k < ncol; k++) buf[m++] = atom->darray[index[nv]][i][k];
}
}

View File

@ -771,16 +771,21 @@ void Force::set_special(int narg, char **arg)
if (iarg + 2 > narg) error->all(FLERR, "Illegal special_bonds command");
special_dihedral = utils::logical(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"one/five") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
if (strcmp(arg[iarg+1],"no") == 0) special_onefive = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) special_onefive = 1;
else error->all(FLERR,"Illegal special_bonds command");
} else if (strcmp(arg[iarg], "one/five") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal special_bonds command");
if (strcmp(arg[iarg + 1], "no") == 0)
special_onefive = 0;
else if (strcmp(arg[iarg + 1], "yes") == 0)
special_onefive = 1;
else
error->all(FLERR, "Illegal special_bonds command");
if (special_onefive && atom->nspecial15_flag == 0)
error->all(FLERR,"Cannot set special_bonds one/five if "
error->all(FLERR,
"Cannot set special_bonds one/five if "
"atom style does not support it");
iarg += 2;
} else error->all(FLERR,"Illegal special_bonds command");
} else
error->all(FLERR, "Illegal special_bonds command");
}
for (int i = 1; i <= 3; i++)

View File

@ -17,11 +17,10 @@
#include "improper_deprecated.h"
#include "improper_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "force.h"
#include "improper_hybrid.h"
using namespace LAMMPS_NS;
@ -35,17 +34,15 @@ void ImproperDeprecated::settings(int, char **)
// so when this is called, our style was just added at the end
// of the list of substyles
if (utils::strmatch(my_style,"^hybrid")) {
if (utils::strmatch(my_style, "^hybrid")) {
auto hybrid = dynamic_cast<ImproperHybrid *>(force->improper);
my_style = hybrid->keywords[hybrid->nstyles];
}
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nImproper style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp, "\nImproper style 'DEPRECATED' is a dummy style\n\n");
return;
}
error->all(FLERR,"This improper style is no longer available");
error->all(FLERR, "This improper style is no longer available");
}

View File

@ -23,6 +23,7 @@ namespace LAMMPS_NS {
class LabelMap : protected Pointers {
friend class AtomVec;
friend class ReadData;
public:
LabelMap(LAMMPS *lmp, int, int, int, int, int);
~LabelMap();
@ -31,7 +32,7 @@ class LabelMap : protected Pointers {
void merge_lmap(LabelMap *, int); // copy another lmap into this one
void create_lmap2lmap(LabelMap *, int); // index mapping between two lmaps
int find(const std::string &, int) const; // find numeric type of type label
bool is_complete(int) const; // check if all types are assigned
bool is_complete(int) const; // check if all types are assigned
// input/output for atom class label map

View File

@ -62,14 +62,14 @@ class LAMMPS {
int suffix_enable; // 1 if suffixes are enabled, 0 if disabled
char *exename; // pointer to argv[0]
char ***packargs; // arguments for cmdline package commands
int num_package; // number of cmdline package commands
char ***packargs; // arguments for cmdline package commands
int num_package; // number of cmdline package commands
MPI_Comm external_comm; // MPI comm encompassing external programs
// when multiple programs launched by mpirun
// set by -mpicolor command line arg
MPI_Comm external_comm; // MPI comm encompassing external programs
// when multiple programs launched by mpirun
// set by -mpicolor command line arg
void *mdicomm; // for use with MDI code coupling library
void *mdicomm; // for use with MDI code coupling library
const char *match_style(const char *style, const char *name);
static const char *installed_packages[];

View File

@ -110,21 +110,30 @@ namespace MathSpecial {
* \param x argument
* \return x*x */
static inline double square(const double &x) { return x * x; }
static inline double square(const double &x)
{
return x * x;
}
/*! Fast inline version of pow(x, 3.0)
*
* \param x argument
* \return x*x */
static inline double cube(const double &x) { return x * x * x; }
static inline double cube(const double &x)
{
return x * x * x;
}
/* Fast inline version of pow(-1.0, n)
*
* \param n argument (integer)
* \return -1 if n is odd, 1.0 if n is even */
static inline double powsign(const int n) { return (n & 1) ? -1.0 : 1.0; }
static inline double powsign(const int n)
{
return (n & 1) ? -1.0 : 1.0;
}
/* Fast inline version of pow(x,n) for integer n
*

View File

@ -31,7 +31,8 @@ Minimize::Minimize(LAMMPS *lmp) : Command(lmp) {}
void Minimize::command(int narg, char **arg)
{
if (narg != 4) error->all(FLERR,"Illegal minimize command: expected 4 arguments but found {}", narg);
if (narg != 4)
error->all(FLERR, "Illegal minimize command: expected 4 arguments but found {}", narg);
if (domain->box_exist == 0)
error->all(FLERR, "Minimize command before simulation box is defined");

View File

@ -1292,7 +1292,7 @@ Compute *Modify::add_compute(const std::string &computecmd, int trysuffix)
void Modify::modify_compute(int narg, char **arg)
{
if (narg < 2) utils::missing_cmd_args(FLERR, "compute_modify",error);
if (narg < 2) utils::missing_cmd_args(FLERR, "compute_modify", error);
// lookup Compute ID

View File

@ -94,7 +94,7 @@ class Neighbor : protected Pointers {
NeighList **lists;
NeighRequest **requests; // from Pair,Fix,Compute,Command classes
NeighRequest **old_requests; // copy of requests to compare to
int* j_sorted; // index of requests sorted by cutoff distance
int *j_sorted; // index of requests sorted by cutoff distance
// data from topology neighbor lists

View File

@ -37,8 +37,8 @@ void NPairHalffullNewtoffTrim::build(NeighList *list)
{
int i, j, ii, jj, n, jnum, joriginal;
int *neighptr, *jlist;
double xtmp,ytmp,ztmp;
double delx,dely,delz,rsq;
double xtmp, ytmp, ztmp;
double delx, dely, delz, rsq;
double **x = atom->x;

View File

@ -12,10 +12,10 @@
------------------------------------------------------------------------- */
#include "npair_trim.h"
#include "neigh_list.h"
#include "atom.h"
#include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
@ -33,10 +33,10 @@ void NPairTrim::build(NeighList *list)
double cutsq_custom = cutoff_custom * cutoff_custom;
int ii,jj,n,jnum,joriginal;
int *neighptr,*jlist;
double xtmp,ytmp,ztmp;
double delx,dely,delz,rsq;
int ii, jj, n, jnum, joriginal;
int *neighptr, *jlist;
double xtmp, ytmp, ztmp;
double delx, dely, delz, rsq;
double **x = atom->x;
@ -86,7 +86,6 @@ void NPairTrim::build(NeighList *list)
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
}
}

View File

@ -82,7 +82,7 @@ class Pair : protected Pointers {
int tail_flag; // pair_modify flag for LJ tail correction
double etail, ptail; // energy/pressure tail corrections
double etail_ij, ptail_ij;
int trim_flag; // pair_modify flag for trimming neigh list
int trim_flag; // pair_modify flag for trimming neigh list
int evflag; // energy,virial settings
int eflag_either, eflag_global, eflag_atom;
@ -123,7 +123,7 @@ class Pair : protected Pointers {
ExecutionSpace execution_space;
unsigned int datamask_read, datamask_modify;
int kokkosable; // 1 if Kokkos pair
int kokkosable; // 1 if Kokkos pair
int reverse_comm_device; // 1 if reverse comm on Device
Pair(class LAMMPS *);

View File

@ -70,11 +70,11 @@ class PairHybrid : public Pair {
double radii2cut(double, double) override;
protected:
int nstyles; // # of sub-styles
Pair **styles; // list of Pair style classes
double *cutmax_style; // max cutoff for each style
char **keywords; // style name of each Pair style
int *multiple; // 0 if style used once, else Mth instance
int nstyles; // # of sub-styles
Pair **styles; // list of Pair style classes
double *cutmax_style; // max cutoff for each style
char **keywords; // style name of each Pair style
int *multiple; // 0 if style used once, else Mth instance
int outerflag; // toggle compute() when invoked by outer()
int respaflag; // 1 if different substyles are assigned to

View File

@ -277,7 +277,7 @@ void PairHybridScaled::settings(int narg, char **arg)
styles = new Pair *[narg];
cutmax_style = new double[narg];
memset(cutmax_style, 0.0, narg*sizeof(double));
memset(cutmax_style, 0.0, narg * sizeof(double));
keywords = new char *[narg];
multiple = new int[narg];

View File

@ -169,7 +169,7 @@ void ReadData::command(int narg, char **arg)
addflag = MERGE;
else {
if (atom->molecule_flag && (iarg + 3 > narg))
utils::missing_cmd_args(FLERR, "read_data add", error);
utils::missing_cmd_args(FLERR, "read_data add", error);
addflag = VALUE;
bigint offset = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp);
if (offset > MAXTAGINT)
@ -209,7 +209,7 @@ void ReadData::command(int narg, char **arg)
coeffflag = 0;
iarg++;
} else if (strcmp(arg[iarg], "extra/atom/types") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/atom/types", error);
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/atom/types", error);
extra_atom_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
if (extra_atom_types < 0)
error->all(FLERR, "Illegal read_data extra/atom/types value {}", extra_atom_types);
@ -265,7 +265,8 @@ void ReadData::command(int narg, char **arg)
atom->extra_angle_per_atom);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/dihedral/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/dihedral/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "read_data extra/dihedral/per/atom", error);
if (atom->molecular == Atom::ATOMIC)
error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style());
atom->extra_dihedral_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
@ -274,7 +275,8 @@ void ReadData::command(int narg, char **arg)
atom->extra_dihedral_per_atom);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/improper/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/improper/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "read_data extra/improper/per/atom", error);
if (atom->molecular == Atom::ATOMIC)
error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style());
atom->extra_improper_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
@ -283,12 +285,14 @@ void ReadData::command(int narg, char **arg)
atom->extra_improper_per_atom);
iarg += 2;
} else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/special/per/atom", error);
if (iarg + 2 > narg)
utils::missing_cmd_args(FLERR, "read_data extra/special/per/atom", error);
if (atom->molecular == Atom::ATOMIC)
error->all(FLERR, "No bonded interactions allowed with atom style {}", atom->get_style());
force->special_extra = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
if (force->special_extra < 0)
error->all(FLERR, "Illegal read_data extra/special/per/atom value {}", force->special_extra);
error->all(FLERR, "Illegal read_data extra/special/per/atom value {}",
force->special_extra);
iarg += 2;
} else if (strcmp(arg[iarg], "group") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data group", error);
@ -343,7 +347,8 @@ void ReadData::command(int narg, char **arg)
} else {
if (atom->labelmapflag) {
if (comm->me == 0)
error->warning(FLERR, "Using read_data offset with a labelmap. Offsets will be only "
error->warning(FLERR,
"Using read_data offset with a labelmap. Offsets will be only "
"applied to numeric types and not to type labels");
}
}
@ -906,10 +911,8 @@ void ReadData::command(int narg, char **arg)
// at end of 1st pass, error check for required sections
// customize for new sections
if (nbonds && !bondflag)
error->one(FLERR, "Bonds section for {} bonds not found", nbonds);
if (nangles && !angleflag)
error->one(FLERR, "Angles section for {} angles not found", nangles);
if (nbonds && !bondflag) error->one(FLERR, "Bonds section for {} bonds not found", nbonds);
if (nangles && !angleflag) error->one(FLERR, "Angles section for {} angles not found", nangles);
if (ndihedrals && !dihedralflag)
error->one(FLERR, "Dihedrals section for {} dihedrals not found", ndihedrals);
if (nimpropers && !improperflag)
@ -917,12 +920,9 @@ void ReadData::command(int narg, char **arg)
if (nellipsoids && !ellipsoidflag)
error->one(FLERR, "Ellipsoids section for {} ellipsoids not found", nellipsoids);
if (nlines && !lineflag)
error->one(FLERR, "Lines section for {} lines not found", nlines);
if (ntris && !triflag)
error->one(FLERR, "Triangles section for {} triangles not found", ntris);
if (nbodies && !bodyflag)
error->one(FLERR, "Bodies section for {} bodies not found", nbodies);
if (nlines && !lineflag) error->one(FLERR, "Lines section for {} lines not found", nlines);
if (ntris && !triflag) error->one(FLERR, "Triangles section for {} triangles not found", ntris);
if (nbodies && !bodyflag) error->one(FLERR, "Bodies section for {} bodies not found", nbodies);
// break out of loop if no molecular topology in file
// else make 2nd pass

View File

@ -322,7 +322,7 @@ void Region::options(int narg, char **arg)
else if (strcmp(arg[iarg + 1], "lattice") == 0)
scaleflag = 1;
else
error->all(FLERR, "Illegal region units: {}", arg[iarg+1]);
error->all(FLERR, "Illegal region units: {}", arg[iarg + 1]);
iarg += 2;
} else if (strcmp(arg[iarg], "side") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region side", error);
@ -331,24 +331,24 @@ void Region::options(int narg, char **arg)
else if (strcmp(arg[iarg + 1], "out") == 0)
interior = 0;
else
error->all(FLERR, "Illegal region side: {}", arg[iarg+1]);
error->all(FLERR, "Illegal region side: {}", arg[iarg + 1]);
iarg += 2;
} else if (strcmp(arg[iarg], "move") == 0) {
if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "region move", error);
if (strcmp(arg[iarg + 1], "NULL") != 0) {
if (strstr(arg[iarg + 1], "v_") != arg[iarg + 1])
error->all(FLERR, "Illegal region move x displacement variable: {}", arg[iarg+1]);
error->all(FLERR, "Illegal region move x displacement variable: {}", arg[iarg + 1]);
xstr = utils::strdup(&arg[iarg + 1][2]);
}
if (strcmp(arg[iarg + 2], "NULL") != 0) {
if (strstr(arg[iarg + 2], "v_") != arg[iarg + 2])
error->all(FLERR, "Illegal region move y displacement variable: {}", arg[iarg+2]);
error->all(FLERR, "Illegal region move y displacement variable: {}", arg[iarg + 2]);
ystr = utils::strdup(&arg[iarg + 2][2]);
}
if (strcmp(arg[iarg + 3], "NULL") != 0) {
if (strstr(arg[iarg + 3], "v_") != arg[iarg + 3])
error->all(FLERR, "Illegal region move z displacement variable: {}", arg[iarg+3]);
error->all(FLERR, "Illegal region move z displacement variable: {}", arg[iarg + 3]);
zstr = utils::strdup(&arg[iarg + 3][2]);
}
moveflag = 1;
@ -375,7 +375,8 @@ void Region::options(int narg, char **arg)
open_faces[iface - 1] = 1;
openflag = 1;
iarg += 2;
} else error->all(FLERR, "Illegal region command argument: {}", arg[iarg]);
} else
error->all(FLERR, "Illegal region command argument: {}", arg[iarg]);
}
// error check

View File

@ -27,7 +27,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
{
nregion = 0;
if (narg < 5) utils::missing_cmd_args(FLERR, "region intersect", error);;
if (narg < 5) utils::missing_cmd_args(FLERR, "region intersect", error);
int n = utils::inumeric(FLERR, arg[2], false, lmp);
if (n < 2) error->all(FLERR, "Illegal region intersect n: {}", n);
options(narg - (n + 3), &arg[n + 3]);

View File

@ -28,7 +28,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg),
{
nregion = 0;
if (narg < 5) utils::missing_cmd_args(FLERR, "region union", error);;
if (narg < 5) utils::missing_cmd_args(FLERR, "region union", error);
int n = utils::inumeric(FLERR, arg[2], false, lmp);
if (n < 2) error->all(FLERR, "Illegal region union n: {}", n);
options(narg - (n + 3), &arg[n + 3]);

View File

@ -28,7 +28,7 @@ class Special : protected Pointers {
int me, nprocs;
int maxall;
int onefive_flag;
tagint **onetwo,**onethree,**onefour,**onefive;
tagint **onetwo, **onethree, **onefour, **onefive;
// data used by rendezvous callback methods

View File

@ -46,10 +46,10 @@ void WriteDump::command(int narg, char **arg)
// create dump command line with extra required args
auto dumpargs = new char *[modindex + 2];
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
dumpargs[1] = arg[0]; // group
dumpargs[2] = arg[1]; // dump style
dumpargs[3] = utils::strdup(std::to_string(MAX(update->ntimestep, 1))); // dump frequency
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
dumpargs[1] = arg[0]; // group
dumpargs[2] = arg[1]; // dump style
dumpargs[3] = utils::strdup(std::to_string(MAX(update->ntimestep, 1))); // dump frequency
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];