enable and apply clang-format to a whole bunch of small .cpp files in src/
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -16,26 +15,24 @@
|
||||
#include "comm.h"
|
||||
#include "universe.h"
|
||||
|
||||
#include <functional> // IWYU pragma: keep
|
||||
#include <functional> // IWYU pragma: keep
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static const char cite_separator[] =
|
||||
"CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE\n\n";
|
||||
"CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE\n\n";
|
||||
|
||||
static const char cite_nagline[] =
|
||||
"Your simulation uses code contributions which should be cited:\n";
|
||||
"Your simulation uses code contributions which should be cited:\n";
|
||||
|
||||
static const char cite_file[] = "The {} {} lists these citations in "
|
||||
"BibTeX format.\n\n";
|
||||
static const char cite_file[] = "The {} {} lists these citations in BibTeX format.\n\n";
|
||||
|
||||
// define hash function
|
||||
static std::hash<std::string> get_hash;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file)
|
||||
: Pointers(lmp)
|
||||
CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file) : Pointers(lmp)
|
||||
{
|
||||
fp = nullptr;
|
||||
cs = new citeset();
|
||||
@ -47,13 +44,13 @@ CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file)
|
||||
|
||||
if (_file && universe->me == 0) {
|
||||
citefile = _file;
|
||||
fp = fopen(_file,"w");
|
||||
fp = fopen(_file, "w");
|
||||
if (fp) {
|
||||
fputs(cite_nagline,fp);
|
||||
fputs(cite_nagline, fp);
|
||||
fflush(fp);
|
||||
} else {
|
||||
utils::logmesg(lmp, "Unable to open citation file '" + citefile
|
||||
+ "': " + utils::getsyserror() + "\n");
|
||||
utils::logmesg(
|
||||
lmp, "Unable to open citation file '" + citefile + "': " + utils::getsyserror() + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +80,7 @@ void CiteMe::add(const std::string &reference)
|
||||
cs->insert(crc);
|
||||
|
||||
if (fp) {
|
||||
fputs(reference.c_str(),fp);
|
||||
fputs(reference.c_str(), fp);
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
@ -102,7 +99,7 @@ void CiteMe::add(const std::string &reference)
|
||||
}
|
||||
|
||||
std::size_t found = reference.find_first_of('\n');
|
||||
std::string header = reference.substr(0,found+1);
|
||||
std::string header = reference.substr(0, found + 1);
|
||||
if (screen_flag == VERBOSE) scrbuffer += "- " + reference;
|
||||
if (screen_flag == TERSE) scrbuffer += "- " + header;
|
||||
if (logfile_flag == VERBOSE) logbuffer += "- " + reference;
|
||||
@ -113,23 +110,18 @@ void CiteMe::flush()
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
if (!scrbuffer.empty()) {
|
||||
if (!citefile.empty())
|
||||
scrbuffer += fmt::format(cite_file,"file",citefile);
|
||||
if (logfile_flag == VERBOSE)
|
||||
scrbuffer += fmt::format(cite_file,"log","file");
|
||||
if (!citefile.empty()) scrbuffer += fmt::format(cite_file, "file", citefile);
|
||||
if (logfile_flag == VERBOSE) scrbuffer += fmt::format(cite_file, "log", "file");
|
||||
scrbuffer += cite_separator;
|
||||
if (screen) fputs(scrbuffer.c_str(),screen);
|
||||
if (screen) fputs(scrbuffer.c_str(), screen);
|
||||
scrbuffer.clear();
|
||||
}
|
||||
if (!logbuffer.empty()) {
|
||||
if (!citefile.empty())
|
||||
logbuffer += fmt::format(cite_file,"file",citefile);
|
||||
if (screen_flag == VERBOSE)
|
||||
logbuffer += fmt::format(cite_file,"screen","output");
|
||||
if (!citefile.empty()) logbuffer += fmt::format(cite_file, "file", citefile);
|
||||
if (screen_flag == VERBOSE) logbuffer += fmt::format(cite_file, "screen", "output");
|
||||
logbuffer += cite_separator;
|
||||
if (logfile) fputs(logbuffer.c_str(),logfile);
|
||||
if (logfile) fputs(logbuffer.c_str(), logfile);
|
||||
logbuffer.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -14,20 +13,19 @@
|
||||
|
||||
#include "compute_gyration.h"
|
||||
|
||||
#include "update.h"
|
||||
#include "atom.h"
|
||||
#include "group.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute gyration command");
|
||||
if (narg != 3) error->all(FLERR, "Illegal compute gyration command");
|
||||
|
||||
scalar_flag = vector_flag = 1;
|
||||
size_vector = 6;
|
||||
@ -41,7 +39,7 @@ ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
ComputeGyration::~ComputeGyration()
|
||||
{
|
||||
delete [] vector;
|
||||
delete[] vector;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -59,8 +57,8 @@ double ComputeGyration::compute_scalar()
|
||||
|
||||
double xcm[3];
|
||||
if (group->dynamic[igroup]) masstotal = group->mass(igroup);
|
||||
group->xcm(igroup,masstotal,xcm);
|
||||
scalar = group->gyration(igroup,masstotal,xcm);
|
||||
group->xcm(igroup, masstotal, xcm);
|
||||
scalar = group->gyration(igroup, masstotal, xcm);
|
||||
return scalar;
|
||||
}
|
||||
|
||||
@ -75,7 +73,7 @@ void ComputeGyration::compute_vector()
|
||||
invoked_vector = update->ntimestep;
|
||||
|
||||
double xcm[3];
|
||||
group->xcm(igroup,masstotal,xcm);
|
||||
group->xcm(igroup, masstotal, xcm);
|
||||
|
||||
double **x = atom->x;
|
||||
int *mask = atom->mask;
|
||||
@ -85,7 +83,7 @@ void ComputeGyration::compute_vector()
|
||||
double *rmass = atom->rmass;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
double dx,dy,dz,massone;
|
||||
double dx, dy, dz, massone;
|
||||
double unwrap[3];
|
||||
|
||||
double rg[6];
|
||||
@ -93,24 +91,25 @@ void ComputeGyration::compute_vector()
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (rmass) massone = rmass[i];
|
||||
else massone = mass[type[i]];
|
||||
if (rmass)
|
||||
massone = rmass[i];
|
||||
else
|
||||
massone = mass[type[i]];
|
||||
|
||||
domain->unmap(x[i],image[i],unwrap);
|
||||
domain->unmap(x[i], image[i], unwrap);
|
||||
dx = unwrap[0] - xcm[0];
|
||||
dy = unwrap[1] - xcm[1];
|
||||
dz = unwrap[2] - xcm[2];
|
||||
|
||||
rg[0] += dx*dx * massone;
|
||||
rg[1] += dy*dy * massone;
|
||||
rg[2] += dz*dz * massone;
|
||||
rg[3] += dx*dy * massone;
|
||||
rg[4] += dx*dz * massone;
|
||||
rg[5] += dy*dz * massone;
|
||||
rg[0] += dx * dx * massone;
|
||||
rg[1] += dy * dy * massone;
|
||||
rg[2] += dz * dz * massone;
|
||||
rg[3] += dx * dy * massone;
|
||||
rg[4] += dx * dz * massone;
|
||||
rg[5] += dy * dz * massone;
|
||||
}
|
||||
MPI_Allreduce(rg,vector,6,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(rg, vector, 6, MPI_DOUBLE, MPI_SUM, world);
|
||||
|
||||
if (masstotal > 0.0)
|
||||
for (int i = 0; i < 6; i++)
|
||||
vector[i] /= masstotal;
|
||||
for (int i = 0; i < 6; i++) vector[i] /= masstotal;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,24 +12,23 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_ke_atom.h"
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "modify.h"
|
||||
#include "update.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeKEAtom::ComputeKEAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg),
|
||||
ke(nullptr)
|
||||
Compute(lmp, narg, arg), ke(nullptr)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute ke/atom command");
|
||||
if (narg != 3) error->all(FLERR, "Illegal compute ke/atom command");
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 0;
|
||||
@ -51,9 +49,8 @@ void ComputeKEAtom::init()
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"ke/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute ke/atom");
|
||||
if (strcmp(modify->compute[i]->style, "ke/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute ke/atom");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -67,7 +64,7 @@ void ComputeKEAtom::compute_peratom()
|
||||
if (atom->nmax > nmax) {
|
||||
memory->destroy(ke);
|
||||
nmax = atom->nmax;
|
||||
memory->create(ke,nmax,"ke/atom:ke");
|
||||
memory->create(ke, nmax, "ke/atom:ke");
|
||||
vector_atom = ke;
|
||||
}
|
||||
|
||||
@ -84,17 +81,19 @@ void ComputeKEAtom::compute_peratom()
|
||||
if (rmass)
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
ke[i] = 0.5 * mvv2e * rmass[i] *
|
||||
(v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]);
|
||||
} else ke[i] = 0.0;
|
||||
ke[i] =
|
||||
0.5 * mvv2e * rmass[i] * (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]);
|
||||
} else
|
||||
ke[i] = 0.0;
|
||||
}
|
||||
|
||||
else
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
ke[i] = 0.5 * mvv2e * mass[type[i]] *
|
||||
(v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]);
|
||||
} else ke[i] = 0.0;
|
||||
(v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]);
|
||||
} else
|
||||
ke[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +103,6 @@ void ComputeKEAtom::compute_peratom()
|
||||
|
||||
double ComputeKEAtom::memory_usage()
|
||||
{
|
||||
double bytes = (double)nmax * sizeof(double);
|
||||
double bytes = (double) nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -24,15 +23,14 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{EPAIR,EVDWL,ECOUL};
|
||||
enum { EPAIR, EVDWL, ECOUL };
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg),
|
||||
pstyle(nullptr), pair(nullptr), one(nullptr)
|
||||
Compute(lmp, narg, arg), pstyle(nullptr), pair(nullptr), one(nullptr)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal compute pair command");
|
||||
if (narg < 4) error->all(FLERR, "Illegal compute pair command");
|
||||
|
||||
scalar_flag = 1;
|
||||
extscalar = 1;
|
||||
@ -41,8 +39,9 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// copy with suffix so we can later chop it off, if needed
|
||||
if (lmp->suffix)
|
||||
pstyle = utils::strdup(fmt::format("{}/{}",arg[3],lmp->suffix));
|
||||
else pstyle = utils::strdup(arg[3]);
|
||||
pstyle = utils::strdup(fmt::format("{}/{}", arg[3], lmp->suffix));
|
||||
else
|
||||
pstyle = utils::strdup(arg[3]);
|
||||
|
||||
int iarg = 4;
|
||||
nsub = 0;
|
||||
@ -50,31 +49,33 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
if (narg > iarg) {
|
||||
if (isdigit(arg[iarg][0])) {
|
||||
nsub = utils::inumeric(FLERR,arg[iarg],false,lmp);
|
||||
nsub = utils::inumeric(FLERR, arg[iarg], false, lmp);
|
||||
++iarg;
|
||||
if (nsub <= 0)
|
||||
error->all(FLERR,"Illegal compute pair command");
|
||||
if (nsub <= 0) error->all(FLERR, "Illegal compute pair command");
|
||||
}
|
||||
}
|
||||
|
||||
if (narg > iarg) {
|
||||
if (strcmp(arg[iarg],"epair") == 0) evalue = EPAIR;
|
||||
else if (strcmp(arg[iarg],"evdwl") == 0) evalue = EVDWL;
|
||||
else if (strcmp(arg[iarg],"ecoul") == 0) evalue = ECOUL;
|
||||
else error->all(FLERR, "Illegal compute pair command");
|
||||
if (narg > iarg) {
|
||||
if (strcmp(arg[iarg], "epair") == 0)
|
||||
evalue = EPAIR;
|
||||
else if (strcmp(arg[iarg], "evdwl") == 0)
|
||||
evalue = EVDWL;
|
||||
else if (strcmp(arg[iarg], "ecoul") == 0)
|
||||
evalue = ECOUL;
|
||||
else
|
||||
error->all(FLERR, "Illegal compute pair command");
|
||||
++iarg;
|
||||
}
|
||||
|
||||
// check if pair style with and without suffix exists
|
||||
|
||||
pair = force->pair_match(pstyle,1,nsub);
|
||||
pair = force->pair_match(pstyle, 1, nsub);
|
||||
if (!pair && lmp->suffix) {
|
||||
pstyle[strlen(pstyle) - strlen(lmp->suffix) - 1] = '\0';
|
||||
pair = force->pair_match(pstyle,1,nsub);
|
||||
pair = force->pair_match(pstyle, 1, nsub);
|
||||
}
|
||||
|
||||
if (!pair)
|
||||
error->all(FLERR,"Unrecognized pair style in compute pair command");
|
||||
if (!pair) error->all(FLERR, "Unrecognized pair style in compute pair command");
|
||||
npair = pair->nextra;
|
||||
|
||||
if (npair) {
|
||||
@ -83,7 +84,8 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
|
||||
extvector = 1;
|
||||
one = new double[npair];
|
||||
vector = new double[npair];
|
||||
} else one = vector = nullptr;
|
||||
} else
|
||||
one = vector = nullptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -101,9 +103,8 @@ void ComputePair::init()
|
||||
{
|
||||
// recheck for pair style in case it has been deleted
|
||||
|
||||
pair = force->pair_match(pstyle,1,nsub);
|
||||
if (!pair)
|
||||
error->all(FLERR,"Unrecognized pair style in compute pair command");
|
||||
pair = force->pair_match(pstyle, 1, nsub);
|
||||
if (!pair) error->all(FLERR, "Unrecognized pair style in compute pair command");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -112,14 +113,17 @@ double ComputePair::compute_scalar()
|
||||
{
|
||||
invoked_scalar = update->ntimestep;
|
||||
if (update->eflag_global != invoked_scalar)
|
||||
error->all(FLERR,"Energy was not tallied on needed timestep");
|
||||
error->all(FLERR, "Energy was not tallied on needed timestep");
|
||||
|
||||
double eng;
|
||||
if (evalue == EPAIR) eng = pair->eng_vdwl + pair->eng_coul;
|
||||
else if (evalue == EVDWL) eng = pair->eng_vdwl;
|
||||
else if (evalue == ECOUL) eng = pair->eng_coul;
|
||||
if (evalue == EPAIR)
|
||||
eng = pair->eng_vdwl + pair->eng_coul;
|
||||
else if (evalue == EVDWL)
|
||||
eng = pair->eng_vdwl;
|
||||
else if (evalue == ECOUL)
|
||||
eng = pair->eng_coul;
|
||||
|
||||
MPI_Allreduce(&eng,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(&eng, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
return scalar;
|
||||
}
|
||||
|
||||
@ -129,9 +133,8 @@ void ComputePair::compute_vector()
|
||||
{
|
||||
invoked_vector = update->ntimestep;
|
||||
if (update->eflag_global != invoked_vector)
|
||||
error->all(FLERR,"Energy was not tallied on needed timestep");
|
||||
error->all(FLERR, "Energy was not tallied on needed timestep");
|
||||
|
||||
for (int i = 0; i < npair; i++)
|
||||
one[i] = pair->pvector[i];
|
||||
MPI_Allreduce(one,vector,npair,MPI_DOUBLE,MPI_SUM,world);
|
||||
for (int i = 0; i < npair; i++) one[i] = pair->pvector[i];
|
||||
MPI_Allreduce(one, vector, npair, MPI_DOUBLE, MPI_SUM, world);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -15,20 +14,19 @@
|
||||
#include "compute_temp.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "domain.h"
|
||||
#include "group.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeTemp::ComputeTemp(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
ComputeTemp::ComputeTemp(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute temp command");
|
||||
if (narg != 3) error->all(FLERR, "Illegal compute temp command");
|
||||
|
||||
scalar_flag = vector_flag = 1;
|
||||
size_vector = 6;
|
||||
@ -43,8 +41,7 @@ ComputeTemp::ComputeTemp(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
ComputeTemp::~ComputeTemp()
|
||||
{
|
||||
if (!copymode)
|
||||
delete [] vector;
|
||||
if (!copymode) delete[] vector;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -64,8 +61,10 @@ void ComputeTemp::dof_compute()
|
||||
natoms_temp = group->count(igroup);
|
||||
dof = domain->dimension * natoms_temp;
|
||||
dof -= extra_dof + fix_dof;
|
||||
if (dof > 0.0) tfactor = force->mvv2e / (dof * force->boltz);
|
||||
else tfactor = 0.0;
|
||||
if (dof > 0.0)
|
||||
tfactor = force->mvv2e / (dof * force->boltz);
|
||||
else
|
||||
tfactor = 0.0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -86,18 +85,17 @@ double ComputeTemp::compute_scalar()
|
||||
if (rmass) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i];
|
||||
t += (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]) * rmass[i];
|
||||
} else {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) *
|
||||
mass[type[i]];
|
||||
t += (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]) * mass[type[i]];
|
||||
}
|
||||
|
||||
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(&t, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
if (dynamic) dof_compute();
|
||||
if (dof < 0.0 && natoms_temp > 0.0)
|
||||
error->all(FLERR,"Temperature compute degrees of freedom < 0");
|
||||
error->all(FLERR, "Temperature compute degrees of freedom < 0");
|
||||
scalar *= tfactor;
|
||||
return scalar;
|
||||
}
|
||||
@ -117,21 +115,23 @@ void ComputeTemp::compute_vector()
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
double massone,t[6];
|
||||
double massone, t[6];
|
||||
for (i = 0; i < 6; i++) t[i] = 0.0;
|
||||
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (rmass) massone = rmass[i];
|
||||
else massone = mass[type[i]];
|
||||
t[0] += massone * v[i][0]*v[i][0];
|
||||
t[1] += massone * v[i][1]*v[i][1];
|
||||
t[2] += massone * v[i][2]*v[i][2];
|
||||
t[3] += massone * v[i][0]*v[i][1];
|
||||
t[4] += massone * v[i][0]*v[i][2];
|
||||
t[5] += massone * v[i][1]*v[i][2];
|
||||
if (rmass)
|
||||
massone = rmass[i];
|
||||
else
|
||||
massone = mass[type[i]];
|
||||
t[0] += massone * v[i][0] * v[i][0];
|
||||
t[1] += massone * v[i][1] * v[i][1];
|
||||
t[2] += massone * v[i][2] * v[i][2];
|
||||
t[3] += massone * v[i][0] * v[i][1];
|
||||
t[4] += massone * v[i][0] * v[i][2];
|
||||
t[5] += massone * v[i][1] * v[i][2];
|
||||
}
|
||||
|
||||
MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(t, vector, 6, MPI_DOUBLE, MPI_SUM, world);
|
||||
for (i = 0; i < 6; i++) vector[i] *= force->mvv2e;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -15,20 +14,20 @@
|
||||
#include "compute_vacf.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "error.h"
|
||||
#include "fix_store_atom.h"
|
||||
#include "group.h"
|
||||
#include "modify.h"
|
||||
#include "fix_store_atom.h"
|
||||
#include "error.h"
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg), id_fix(nullptr)
|
||||
Compute(lmp, narg, arg), id_fix(nullptr)
|
||||
{
|
||||
if (narg < 3) error->all(FLERR,"Illegal compute vacf command");
|
||||
if (narg < 3) error->all(FLERR, "Illegal compute vacf command");
|
||||
|
||||
vector_flag = 1;
|
||||
size_vector = 4;
|
||||
@ -40,12 +39,13 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
||||
fix = dynamic_cast<FixStoreAtom *>(
|
||||
modify->add_fix(fmt::format("{} {} STORE/ATOM 3 0 0 1", id_fix, group->names[igroup])));
|
||||
modify->add_fix(fmt::format("{} {} STORE/ATOM 3 0 0 1", id_fix, group->names[igroup])));
|
||||
|
||||
// store current velocities in fix store array
|
||||
// skip if reset from restart file
|
||||
|
||||
if (fix->restart_reset) fix->restart_reset = 0;
|
||||
if (fix->restart_reset)
|
||||
fix->restart_reset = 0;
|
||||
else {
|
||||
double **voriginal = fix->astore;
|
||||
|
||||
@ -58,7 +58,8 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
|
||||
voriginal[i][0] = v[i][0];
|
||||
voriginal[i][1] = v[i][1];
|
||||
voriginal[i][2] = v[i][2];
|
||||
} else voriginal[i][0] = voriginal[i][1] = voriginal[i][2] = 0.0;
|
||||
} else
|
||||
voriginal[i][0] = voriginal[i][1] = voriginal[i][2] = 0.0;
|
||||
}
|
||||
|
||||
// displacement vector
|
||||
@ -74,8 +75,8 @@ ComputeVACF::~ComputeVACF()
|
||||
|
||||
if (modify->nfix) modify->delete_fix(id_fix);
|
||||
|
||||
delete [] id_fix;
|
||||
delete [] vector;
|
||||
delete[] id_fix;
|
||||
delete[] vector;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -85,7 +86,7 @@ void ComputeVACF::init()
|
||||
// set fix which stores original atom velocities
|
||||
|
||||
fix = dynamic_cast<FixStoreAtom *>(modify->get_fix_by_id(id_fix));
|
||||
if (!fix) error->all(FLERR,"Could not find compute vacf fix ID {}", id_fix);
|
||||
if (!fix) error->all(FLERR, "Could not find compute vacf fix ID {}", id_fix);
|
||||
|
||||
// nvacf = # of atoms in group
|
||||
|
||||
@ -104,7 +105,7 @@ void ComputeVACF::compute_vector()
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
double vxsq,vysq,vzsq;
|
||||
double vxsq, vysq, vzsq;
|
||||
double vacf[4];
|
||||
vacf[0] = vacf[1] = vacf[2] = vacf[3] = 0.0;
|
||||
|
||||
@ -119,7 +120,7 @@ void ComputeVACF::compute_vector()
|
||||
vacf[3] += vxsq + vysq + vzsq;
|
||||
}
|
||||
|
||||
MPI_Allreduce(vacf,vector,4,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(vacf, vector, 4, MPI_DOUBLE, MPI_SUM, world);
|
||||
if (nvacf) {
|
||||
vector[0] /= nvacf;
|
||||
vector[1] /= nvacf;
|
||||
@ -140,4 +141,3 @@ void ComputeVACF::set_arrays(int i)
|
||||
voriginal[i][1] = v[i][1];
|
||||
voriginal[i][2] = v[i][2];
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -37,28 +36,27 @@ DihedralZero::DihedralZero(LAMMPS *lmp) : Dihedral(lmp), coeffflag(1)
|
||||
|
||||
DihedralZero::~DihedralZero()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
}
|
||||
if (allocated && !copymode) memory->destroy(setflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
ev_init(eflag, vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal dihedral_style command");
|
||||
if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal dihedral_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal dihedral_style command");
|
||||
if (strcmp("nocoeff", arg[0]) == 0)
|
||||
coeffflag = 0;
|
||||
else
|
||||
error->all(FLERR, "Illegal dihedral_style command");
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +67,7 @@ void DihedralZero::allocate()
|
||||
allocated = 1;
|
||||
int n = atom->ndihedraltypes;
|
||||
|
||||
memory->create(setflag,n+1,"dihedral:setflag");
|
||||
memory->create(setflag, n + 1, "dihedral:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
@ -80,12 +78,12 @@ void DihedralZero::allocate()
|
||||
void DihedralZero::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 1))
|
||||
error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||
error->all(FLERR, "Incorrect args for dihedral coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error);
|
||||
int ilo, ihi;
|
||||
utils::bounds(FLERR, arg[0], 1, atom->ndihedraltypes, ilo, ihi, error);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
@ -93,7 +91,7 @@ void DihedralZero::coeff(int narg, char **arg)
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||
if (count == 0) error->all(FLERR, "Incorrect args for dihedral coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -116,7 +114,7 @@ void DihedralZero::read_restart(FILE * /*fp*/)
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero::write_data(FILE *fp) {
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d\n",i);
|
||||
void DihedralZero::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++) fprintf(fp, "%d\n", i);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -27,11 +26,9 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) :
|
||||
DumpImage(lmp, narg, arg)
|
||||
DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) : DumpImage(lmp, narg, arg)
|
||||
{
|
||||
if (multiproc || compressed || multifile)
|
||||
error->all(FLERR,"Invalid dump movie filename");
|
||||
if (multiproc || compressed || multifile) error->all(FLERR, "Invalid dump movie filename");
|
||||
|
||||
filetype = PPM;
|
||||
bitrate = 2000;
|
||||
@ -55,15 +52,15 @@ void DumpMovie::openfile()
|
||||
|
||||
#ifdef LAMMPS_FFMPEG
|
||||
auto moviecmd = fmt::format("ffmpeg -v error -y -r {:.2f} -f image2pipe -c:v ppm -i - "
|
||||
"-r 24.0 -b:v {}k {}", framerate, bitrate, filename);
|
||||
fp = platform::popen(moviecmd,"w");
|
||||
"-r 24.0 -b:v {}k {}",
|
||||
framerate, bitrate, filename);
|
||||
fp = platform::popen(moviecmd, "w");
|
||||
#else
|
||||
fp = nullptr;
|
||||
error->one(FLERR,"Support for writing movies not included");
|
||||
error->one(FLERR, "Support for writing movies not included");
|
||||
#endif
|
||||
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,"Failed to open FFmpeg pipeline to file {}",filename);
|
||||
if (fp == nullptr) error->one(FLERR, "Failed to open FFmpeg pipeline to file {}", filename);
|
||||
}
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -81,21 +78,21 @@ void DumpMovie::init_style()
|
||||
|
||||
int DumpMovie::modify_param(int narg, char **arg)
|
||||
{
|
||||
int n = DumpImage::modify_param(narg,arg);
|
||||
int n = DumpImage::modify_param(narg, arg);
|
||||
if (n) return n;
|
||||
|
||||
if (strcmp(arg[0],"bitrate") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
bitrate = utils::inumeric(FLERR,arg[1],false,lmp);
|
||||
if (bitrate <= 0.0) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[0], "bitrate") == 0) {
|
||||
if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
|
||||
bitrate = utils::inumeric(FLERR, arg[1], false, lmp);
|
||||
if (bitrate <= 0.0) error->all(FLERR, "Illegal dump_modify command");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (strcmp(arg[0],"framerate") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
framerate = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
if (strcmp(arg[0], "framerate") == 0) {
|
||||
if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
|
||||
framerate = utils::numeric(FLERR, arg[1], false, lmp);
|
||||
if ((framerate <= 0.1) || (framerate > 24.0))
|
||||
error->all(FLERR,"Illegal dump_modify framerate command");
|
||||
error->all(FLERR, "Illegal dump_modify framerate command");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -26,18 +25,17 @@ using namespace FixConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixLineForce::FixLineForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
FixLineForce::FixLineForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
|
||||
if (narg != 6) error->all(FLERR,"Illegal fix lineforce command");
|
||||
xdir = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
ydir = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
zdir = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
if (narg != 6) error->all(FLERR, "Illegal fix lineforce command");
|
||||
xdir = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
ydir = utils::numeric(FLERR, arg[4], false, lmp);
|
||||
zdir = utils::numeric(FLERR, arg[5], false, lmp);
|
||||
|
||||
double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir);
|
||||
if (len == 0.0) error->all(FLERR,"Illegal fix lineforce command");
|
||||
double len = sqrt(xdir * xdir + ydir * ydir + zdir * zdir);
|
||||
if (len == 0.0) error->all(FLERR, "Illegal fix lineforce command");
|
||||
|
||||
xdir /= len;
|
||||
ydir /= len;
|
||||
@ -59,13 +57,13 @@ int FixLineForce::setmask()
|
||||
|
||||
void FixLineForce::setup(int vflag)
|
||||
{
|
||||
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||
if (utils::strmatch(update->integrate_style, "^verlet"))
|
||||
post_force(vflag);
|
||||
else {
|
||||
int nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
|
||||
for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) {
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel);
|
||||
post_force_respa(vflag,ilevel,0);
|
||||
post_force_respa(vflag, ilevel, 0);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel);
|
||||
}
|
||||
}
|
||||
@ -89,7 +87,7 @@ void FixLineForce::post_force(int /*vflag*/)
|
||||
double dot;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dot = f[i][0]*xdir + f[i][1]*ydir + f[i][2]*zdir;
|
||||
dot = f[i][0] * xdir + f[i][1] * ydir + f[i][2] * zdir;
|
||||
f[i][0] = dot * xdir;
|
||||
f[i][1] = dot * ydir;
|
||||
f[i][2] = dot * zdir;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -26,18 +25,17 @@ using namespace FixConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
|
||||
if (narg != 6) error->all(FLERR,"Illegal fix planeforce command");
|
||||
xdir = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
ydir = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
zdir = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
if (narg != 6) error->all(FLERR, "Illegal fix planeforce command");
|
||||
xdir = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
ydir = utils::numeric(FLERR, arg[4], false, lmp);
|
||||
zdir = utils::numeric(FLERR, arg[5], false, lmp);
|
||||
|
||||
double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir);
|
||||
if (len == 0.0) error->all(FLERR,"Illegal fix planeforce command");
|
||||
double len = sqrt(xdir * xdir + ydir * ydir + zdir * zdir);
|
||||
if (len == 0.0) error->all(FLERR, "Illegal fix planeforce command");
|
||||
|
||||
xdir /= len;
|
||||
ydir /= len;
|
||||
@ -59,13 +57,13 @@ int FixPlaneForce::setmask()
|
||||
|
||||
void FixPlaneForce::setup(int vflag)
|
||||
{
|
||||
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||
if (utils::strmatch(update->integrate_style, "^verlet"))
|
||||
post_force(vflag);
|
||||
else {
|
||||
int nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
|
||||
for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) {
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel);
|
||||
post_force_respa(vflag,ilevel,0);
|
||||
post_force_respa(vflag, ilevel, 0);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel);
|
||||
}
|
||||
}
|
||||
@ -89,7 +87,7 @@ void FixPlaneForce::post_force(int /*vflag*/)
|
||||
double dot;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dot = f[i][0]*xdir + f[i][1]*ydir + f[i][2]*zdir;
|
||||
dot = f[i][0] * xdir + f[i][1] * ydir + f[i][2] * zdir;
|
||||
f[i][0] -= dot * xdir;
|
||||
f[i][1] -= dot * ydir;
|
||||
f[i][2] -= dot * zdir;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -23,11 +22,10 @@ using namespace FixConst;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
count(nullptr), extra(nullptr)
|
||||
Fix(lmp, narg, arg), count(nullptr), extra(nullptr)
|
||||
{
|
||||
nextra = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
int nfix = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
nextra = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
int nfix = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||
|
||||
// perform initial allocation of atom-based array
|
||||
// register with Atom class
|
||||
@ -39,11 +37,11 @@ FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
double **atom_extra = atom->extra;
|
||||
int nlocal = atom->nlocal;
|
||||
int i,j,m;
|
||||
int i, j, m;
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
m = 0;
|
||||
for (j = 0; j < nfix; j++) m += static_cast<int> (atom_extra[i][m]);
|
||||
for (j = 0; j < nfix; j++) m += static_cast<int>(atom_extra[i][m]);
|
||||
count[i] = m;
|
||||
for (j = 0; j < m; j++) extra[i][j] = atom_extra[i][j];
|
||||
}
|
||||
@ -55,7 +53,7 @@ FixReadRestart::~FixReadRestart()
|
||||
{
|
||||
// unregister callback to this fix from Atom class
|
||||
|
||||
atom->delete_callback(id,Atom::GROW);
|
||||
atom->delete_callback(id, Atom::GROW);
|
||||
|
||||
// delete locally stored arrays
|
||||
|
||||
@ -77,8 +75,8 @@ int FixReadRestart::setmask()
|
||||
|
||||
double FixReadRestart::memory_usage()
|
||||
{
|
||||
double bytes = (double)atom->nmax*nextra * sizeof(double);
|
||||
bytes += (double)atom->nmax * sizeof(int);
|
||||
double bytes = (double) atom->nmax * nextra * sizeof(double);
|
||||
bytes += (double) atom->nmax * sizeof(int);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -88,8 +86,8 @@ double FixReadRestart::memory_usage()
|
||||
|
||||
void FixReadRestart::grow_arrays(int nmax)
|
||||
{
|
||||
memory->grow(count,nmax,"read_restart:count");
|
||||
memory->grow(extra,nmax,nextra,"read_restart:extra");
|
||||
memory->grow(count, nmax, "read_restart:count");
|
||||
memory->grow(extra, nmax, nextra, "read_restart:extra");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -109,8 +107,8 @@ void FixReadRestart::copy_arrays(int i, int j, int /*delflag*/)
|
||||
int FixReadRestart::pack_exchange(int i, double *buf)
|
||||
{
|
||||
buf[0] = count[i];
|
||||
for (int m = 0; m < count[i]; m++) buf[m+1] = extra[i][m];
|
||||
return count[i]+1;
|
||||
for (int m = 0; m < count[i]; m++) buf[m + 1] = extra[i][m];
|
||||
return count[i] + 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -119,7 +117,7 @@ int FixReadRestart::pack_exchange(int i, double *buf)
|
||||
|
||||
int FixReadRestart::unpack_exchange(int nlocal, double *buf)
|
||||
{
|
||||
count[nlocal] = static_cast<int> (buf[0]);
|
||||
for (int m = 0; m < count[nlocal]; m++) extra[nlocal][m] = buf[m+1];
|
||||
return count[nlocal]+1;
|
||||
count[nlocal] = static_cast<int>(buf[0]);
|
||||
for (int m = 0; m < count[nlocal]; m++) extra[nlocal][m] = buf[m + 1];
|
||||
return count[nlocal] + 1;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -26,25 +25,23 @@ using namespace FixConst;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixStoreForce::FixStoreForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
foriginal(nullptr)
|
||||
Fix(lmp, narg, arg), foriginal(nullptr)
|
||||
{
|
||||
if (narg < 3) error->all(FLERR,"Illegal fix store/force command");
|
||||
if (narg < 3) error->all(FLERR, "Illegal fix store/force command");
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 3;
|
||||
peratom_freq = 1;
|
||||
|
||||
nmax = atom->nmax;
|
||||
memory->create(foriginal,nmax,3,"store/force:foriginal");
|
||||
memory->create(foriginal, nmax, 3, "store/force:foriginal");
|
||||
array_atom = foriginal;
|
||||
|
||||
// zero the array since dump may access it on timestep 0
|
||||
// zero the array since a variable may access it before first run
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
foriginal[i][0] = foriginal[i][1] = foriginal[i][2] = 0.0;
|
||||
for (int i = 0; i < nlocal; i++) foriginal[i][0] = foriginal[i][1] = foriginal[i][2] = 0.0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -69,7 +66,7 @@ int FixStoreForce::setmask()
|
||||
|
||||
void FixStoreForce::init()
|
||||
{
|
||||
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||
if (utils::strmatch(update->integrate_style, "^respa"))
|
||||
nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
|
||||
}
|
||||
|
||||
@ -77,12 +74,12 @@ void FixStoreForce::init()
|
||||
|
||||
void FixStoreForce::setup(int vflag)
|
||||
{
|
||||
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||
if (utils::strmatch(update->integrate_style, "^verlet"))
|
||||
post_force(vflag);
|
||||
else {
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(nlevels_respa-1);
|
||||
post_force_respa(vflag,nlevels_respa-1,0);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(nlevels_respa-1);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(nlevels_respa - 1);
|
||||
post_force_respa(vflag, nlevels_respa - 1, 0);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(nlevels_respa - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +97,7 @@ void FixStoreForce::post_force(int /*vflag*/)
|
||||
if (atom->nmax > nmax) {
|
||||
nmax = atom->nmax;
|
||||
memory->destroy(foriginal);
|
||||
memory->create(foriginal,nmax,3,"store/force:foriginal");
|
||||
memory->create(foriginal, nmax, 3, "store/force:foriginal");
|
||||
array_atom = foriginal;
|
||||
}
|
||||
|
||||
@ -113,14 +110,15 @@ void FixStoreForce::post_force(int /*vflag*/)
|
||||
foriginal[i][0] = f[i][0];
|
||||
foriginal[i][1] = f[i][1];
|
||||
foriginal[i][2] = f[i][2];
|
||||
} else foriginal[i][0] = foriginal[i][1] = foriginal[i][2] = 0.0;
|
||||
} else
|
||||
foriginal[i][0] = foriginal[i][1] = foriginal[i][2] = 0.0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixStoreForce::post_force_respa(int vflag, int ilevel, int /*iloop*/)
|
||||
{
|
||||
if (ilevel == nlevels_respa-1) post_force(vflag);
|
||||
if (ilevel == nlevels_respa - 1) post_force(vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -136,6 +134,6 @@ void FixStoreForce::min_post_force(int vflag)
|
||||
|
||||
double FixStoreForce::memory_usage()
|
||||
{
|
||||
double bytes = (double)atom->nmax*3 * sizeof(double);
|
||||
double bytes = (double) atom->nmax * 3 * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -26,31 +25,29 @@ using namespace FixConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
gamma(nullptr)
|
||||
FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), gamma(nullptr)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix viscous command");
|
||||
if (narg < 4) error->all(FLERR, "Illegal fix viscous command");
|
||||
|
||||
double gamma_one = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
gamma = new double[atom->ntypes+1];
|
||||
double gamma_one = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
gamma = new double[atom->ntypes + 1];
|
||||
for (int i = 1; i <= atom->ntypes; i++) gamma[i] = gamma_one;
|
||||
|
||||
// optional args
|
||||
|
||||
int iarg = 4;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"scale") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix viscous command");
|
||||
int itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
double scale = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR,"Illegal fix viscous command");
|
||||
if (strcmp(arg[iarg], "scale") == 0) {
|
||||
if (iarg + 3 > narg) error->all(FLERR, "Illegal fix viscous command");
|
||||
int itype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
double scale = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
|
||||
if (itype <= 0 || itype > atom->ntypes) error->all(FLERR, "Illegal fix viscous command");
|
||||
gamma[itype] = gamma_one * scale;
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal fix viscous command");
|
||||
} else
|
||||
error->all(FLERR, "Illegal fix viscous command");
|
||||
}
|
||||
|
||||
respa_level_support = 1;
|
||||
@ -63,7 +60,7 @@ FixViscous::~FixViscous()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
delete [] gamma;
|
||||
delete[] gamma;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -83,9 +80,9 @@ void FixViscous::init()
|
||||
{
|
||||
int max_respa = 0;
|
||||
|
||||
if (utils::strmatch(update->integrate_style,"^respa")) {
|
||||
ilevel_respa = max_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels-1;
|
||||
if (respa_level >= 0) ilevel_respa = MIN(respa_level,max_respa);
|
||||
if (utils::strmatch(update->integrate_style, "^respa")) {
|
||||
ilevel_respa = max_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
|
||||
if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,11 +90,11 @@ void FixViscous::init()
|
||||
|
||||
void FixViscous::setup(int vflag)
|
||||
{
|
||||
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||
if (utils::strmatch(update->integrate_style, "^verlet"))
|
||||
post_force(vflag);
|
||||
else {
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
|
||||
post_force_respa(vflag,ilevel_respa,0);
|
||||
post_force_respa(vflag, ilevel_respa, 0);
|
||||
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
|
||||
}
|
||||
}
|
||||
@ -128,9 +125,9 @@ void FixViscous::post_force(int /*vflag*/)
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
drag = gamma[type[i]];
|
||||
f[i][0] -= drag*v[i][0];
|
||||
f[i][1] -= drag*v[i][1];
|
||||
f[i][2] -= drag*v[i][2];
|
||||
f[i][0] -= drag * v[i][0];
|
||||
f[i][1] -= drag * v[i][1];
|
||||
f[i][2] -= drag * v[i][2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -17,17 +16,18 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_wall_lj1043.h"
|
||||
#include <cmath>
|
||||
|
||||
#include "atom.h"
|
||||
#include "math_const.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixWall(lmp, narg, arg)
|
||||
FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
}
|
||||
@ -36,26 +36,26 @@ FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
void FixWallLJ1043::precompute(int m)
|
||||
{
|
||||
coeff1[m] = MY_2PI * 2.0/5.0 * epsilon[m] * pow(sigma[m],10.0);
|
||||
coeff2[m] = MY_2PI * epsilon[m] * pow(sigma[m],4.0);
|
||||
coeff3[m] = MY_2PI * pow(2.0,1/2.0) / 3 * epsilon[m] * pow(sigma[m],3.0);
|
||||
coeff4[m] = 0.61 / pow(2.0,1/2.0) * sigma[m];
|
||||
coeff1[m] = MY_2PI * 2.0 / 5.0 * epsilon[m] * pow(sigma[m], 10.0);
|
||||
coeff2[m] = MY_2PI * epsilon[m] * pow(sigma[m], 4.0);
|
||||
coeff3[m] = MY_2PI * pow(2.0, 1 / 2.0) / 3 * epsilon[m] * pow(sigma[m], 3.0);
|
||||
coeff4[m] = 0.61 / pow(2.0, 1 / 2.0) * sigma[m];
|
||||
coeff5[m] = coeff1[m] * 10.0;
|
||||
coeff6[m] = coeff2[m] * 4.0;
|
||||
coeff7[m] = coeff3[m] * 3.0;
|
||||
|
||||
double rinv = 1.0/cutoff[m];
|
||||
double r2inv = rinv*rinv;
|
||||
double r4inv = r2inv*r2inv;
|
||||
offset[m] = coeff1[m]*r4inv*r4inv*r2inv - coeff2[m]*r4inv -
|
||||
coeff3[m]*pow(cutoff[m]+coeff4[m],-3.0);
|
||||
double rinv = 1.0 / cutoff[m];
|
||||
double r2inv = rinv * rinv;
|
||||
double r4inv = r2inv * r2inv;
|
||||
offset[m] = coeff1[m] * r4inv * r4inv * r2inv - coeff2[m] * r4inv -
|
||||
coeff3[m] * pow(cutoff[m] + coeff4[m], -3.0);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixWallLJ1043::wall_particle(int m, int which, double coord)
|
||||
{
|
||||
double delta,rinv,r2inv,r4inv,r10inv,fwall;
|
||||
double delta, rinv, r2inv, r4inv, r10inv, fwall;
|
||||
double vn;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -69,25 +69,30 @@ void FixWallLJ1043::wall_particle(int m, int which, double coord)
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (side < 0) delta = x[i][dim] - coord;
|
||||
else delta = coord - x[i][dim];
|
||||
if (side < 0)
|
||||
delta = x[i][dim] - coord;
|
||||
else
|
||||
delta = coord - x[i][dim];
|
||||
if (delta <= 0.0) continue;
|
||||
if (delta > cutoff[m]) continue;
|
||||
rinv = 1.0/delta;
|
||||
r2inv = rinv*rinv;
|
||||
r4inv = r2inv*r2inv;
|
||||
r10inv = r4inv*r4inv*r2inv;
|
||||
rinv = 1.0 / delta;
|
||||
r2inv = rinv * rinv;
|
||||
r4inv = r2inv * r2inv;
|
||||
r10inv = r4inv * r4inv * r2inv;
|
||||
|
||||
fwall = side * (coeff5[m]*r10inv*rinv - coeff6[m]*r4inv*rinv -
|
||||
coeff7[m]*pow(delta+coeff4[m],-4.0));
|
||||
fwall = side *
|
||||
(coeff5[m] * r10inv * rinv - coeff6[m] * r4inv * rinv -
|
||||
coeff7[m] * pow(delta + coeff4[m], -4.0));
|
||||
f[i][dim] -= fwall;
|
||||
ewall[0] += coeff1[m]*r10inv - coeff2[m]*r4inv -
|
||||
coeff3[m]*pow(delta+coeff4[m],-3.0) - offset[m];
|
||||
ewall[m+1] += fwall;
|
||||
ewall[0] += coeff1[m] * r10inv - coeff2[m] * r4inv -
|
||||
coeff3[m] * pow(delta + coeff4[m], -3.0) - offset[m];
|
||||
ewall[m + 1] += fwall;
|
||||
|
||||
if (evflag) {
|
||||
if (side < 0) vn = -fwall*delta;
|
||||
else vn = fwall*delta;
|
||||
if (side < 0)
|
||||
vn = -fwall * delta;
|
||||
else
|
||||
vn = fwall * delta;
|
||||
v_tally(dim, i, vn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,16 +12,15 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_wall_lj126.h"
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixWall(lmp, narg, arg)
|
||||
FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
}
|
||||
@ -31,14 +29,14 @@ FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
void FixWallLJ126::precompute(int m)
|
||||
{
|
||||
coeff1[m] = 48.0 * epsilon[m] * pow(sigma[m],12.0);
|
||||
coeff2[m] = 24.0 * epsilon[m] * pow(sigma[m],6.0);
|
||||
coeff3[m] = 4.0 * epsilon[m] * pow(sigma[m],12.0);
|
||||
coeff4[m] = 4.0 * epsilon[m] * pow(sigma[m],6.0);
|
||||
coeff1[m] = 48.0 * epsilon[m] * pow(sigma[m], 12.0);
|
||||
coeff2[m] = 24.0 * epsilon[m] * pow(sigma[m], 6.0);
|
||||
coeff3[m] = 4.0 * epsilon[m] * pow(sigma[m], 12.0);
|
||||
coeff4[m] = 4.0 * epsilon[m] * pow(sigma[m], 6.0);
|
||||
|
||||
double r2inv = 1.0/(cutoff[m]*cutoff[m]);
|
||||
double r6inv = r2inv*r2inv*r2inv;
|
||||
offset[m] = r6inv*(coeff3[m]*r6inv - coeff4[m]);
|
||||
double r2inv = 1.0 / (cutoff[m] * cutoff[m]);
|
||||
double r6inv = r2inv * r2inv * r2inv;
|
||||
offset[m] = r6inv * (coeff3[m] * r6inv - coeff4[m]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -50,7 +48,7 @@ void FixWallLJ126::precompute(int m)
|
||||
|
||||
void FixWallLJ126::wall_particle(int m, int which, double coord)
|
||||
{
|
||||
double delta,rinv,r2inv,r6inv,fwall;
|
||||
double delta, rinv, r2inv, r6inv, fwall;
|
||||
double vn;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -66,27 +64,31 @@ void FixWallLJ126::wall_particle(int m, int which, double coord)
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (side < 0) delta = x[i][dim] - coord;
|
||||
else delta = coord - x[i][dim];
|
||||
if (side < 0)
|
||||
delta = x[i][dim] - coord;
|
||||
else
|
||||
delta = coord - x[i][dim];
|
||||
if (delta >= cutoff[m]) continue;
|
||||
if (delta <= 0.0) {
|
||||
onflag = 1;
|
||||
continue;
|
||||
}
|
||||
rinv = 1.0/delta;
|
||||
r2inv = rinv*rinv;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
fwall = side * r6inv*(coeff1[m]*r6inv - coeff2[m]) * rinv;
|
||||
rinv = 1.0 / delta;
|
||||
r2inv = rinv * rinv;
|
||||
r6inv = r2inv * r2inv * r2inv;
|
||||
fwall = side * r6inv * (coeff1[m] * r6inv - coeff2[m]) * rinv;
|
||||
f[i][dim] -= fwall;
|
||||
ewall[0] += r6inv*(coeff3[m]*r6inv - coeff4[m]) - offset[m];
|
||||
ewall[m+1] += fwall;
|
||||
ewall[0] += r6inv * (coeff3[m] * r6inv - coeff4[m]) - offset[m];
|
||||
ewall[m + 1] += fwall;
|
||||
|
||||
if (evflag) {
|
||||
if (side < 0) vn = -fwall*delta;
|
||||
else vn = fwall*delta;
|
||||
if (side < 0)
|
||||
vn = -fwall * delta;
|
||||
else
|
||||
vn = fwall * delta;
|
||||
v_tally(dim, i, vn);
|
||||
}
|
||||
}
|
||||
|
||||
if (onflag) error->one(FLERR,"Particle on or inside fix wall surface");
|
||||
if (onflag) error->one(FLERR, "Particle on or inside fix wall surface");
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,16 +12,17 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_wall_lj93.h"
|
||||
#include <cmath>
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixWall(lmp, narg, arg)
|
||||
FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
|
||||
{
|
||||
dynamic_group_allow = 1;
|
||||
}
|
||||
@ -31,15 +31,15 @@ FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
void FixWallLJ93::precompute(int m)
|
||||
{
|
||||
coeff1[m] = 6.0/5.0 * epsilon[m] * pow(sigma[m],9.0);
|
||||
coeff2[m] = 3.0 * epsilon[m] * pow(sigma[m],3.0);
|
||||
coeff3[m] = 2.0/15.0 * epsilon[m] * pow(sigma[m],9.0);
|
||||
coeff4[m] = epsilon[m] * pow(sigma[m],3.0);
|
||||
coeff1[m] = 6.0 / 5.0 * epsilon[m] * pow(sigma[m], 9.0);
|
||||
coeff2[m] = 3.0 * epsilon[m] * pow(sigma[m], 3.0);
|
||||
coeff3[m] = 2.0 / 15.0 * epsilon[m] * pow(sigma[m], 9.0);
|
||||
coeff4[m] = epsilon[m] * pow(sigma[m], 3.0);
|
||||
|
||||
double rinv = 1.0/cutoff[m];
|
||||
double r2inv = rinv*rinv;
|
||||
double r4inv = r2inv*r2inv;
|
||||
offset[m] = coeff3[m]*r4inv*r4inv*rinv - coeff4[m]*r2inv*rinv;
|
||||
double rinv = 1.0 / cutoff[m];
|
||||
double r2inv = rinv * rinv;
|
||||
double r4inv = r2inv * r2inv;
|
||||
offset[m] = coeff3[m] * r4inv * r4inv * rinv - coeff4[m] * r2inv * rinv;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -51,7 +51,7 @@ void FixWallLJ93::precompute(int m)
|
||||
|
||||
void FixWallLJ93::wall_particle(int m, int which, double coord)
|
||||
{
|
||||
double delta,rinv,r2inv,r4inv,r10inv,fwall;
|
||||
double delta, rinv, r2inv, r4inv, r10inv, fwall;
|
||||
double vn;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -67,29 +67,32 @@ void FixWallLJ93::wall_particle(int m, int which, double coord)
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (side < 0) delta = x[i][dim] - coord;
|
||||
else delta = coord - x[i][dim];
|
||||
if (side < 0)
|
||||
delta = x[i][dim] - coord;
|
||||
else
|
||||
delta = coord - x[i][dim];
|
||||
if (delta >= cutoff[m]) continue;
|
||||
if (delta <= 0.0) {
|
||||
onflag = 1;
|
||||
continue;
|
||||
}
|
||||
rinv = 1.0/delta;
|
||||
r2inv = rinv*rinv;
|
||||
r4inv = r2inv*r2inv;
|
||||
r10inv = r4inv*r4inv*r2inv;
|
||||
fwall = side * (coeff1[m]*r10inv - coeff2[m]*r4inv);
|
||||
rinv = 1.0 / delta;
|
||||
r2inv = rinv * rinv;
|
||||
r4inv = r2inv * r2inv;
|
||||
r10inv = r4inv * r4inv * r2inv;
|
||||
fwall = side * (coeff1[m] * r10inv - coeff2[m] * r4inv);
|
||||
f[i][dim] -= fwall;
|
||||
ewall[0] += coeff3[m]*r4inv*r4inv*rinv -
|
||||
coeff4[m]*r2inv*rinv - offset[m];
|
||||
ewall[m+1] += fwall;
|
||||
ewall[0] += coeff3[m] * r4inv * r4inv * rinv - coeff4[m] * r2inv * rinv - offset[m];
|
||||
ewall[m + 1] += fwall;
|
||||
|
||||
if (evflag) {
|
||||
if (side < 0) vn = -fwall*delta;
|
||||
else vn = fwall*delta;
|
||||
if (side < 0)
|
||||
vn = -fwall * delta;
|
||||
else
|
||||
vn = fwall * delta;
|
||||
v_tally(dim, i, vn);
|
||||
}
|
||||
}
|
||||
|
||||
if (onflag) error->one(FLERR,"Particle on or inside fix wall surface");
|
||||
if (onflag) error->one(FLERR, "Particle on or inside fix wall surface");
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -37,28 +36,27 @@ ImproperZero::ImproperZero(LAMMPS *lmp) : Improper(lmp), coeffflag(1)
|
||||
|
||||
ImproperZero::~ImproperZero()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
}
|
||||
if (allocated && !copymode) memory->destroy(setflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
ev_init(eflag, vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal improper_style command");
|
||||
if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal improper_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal improper_style command");
|
||||
if (strcmp("nocoeff", arg[0]) == 0)
|
||||
coeffflag = 0;
|
||||
else
|
||||
error->all(FLERR, "Illegal improper_style command");
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +67,7 @@ void ImproperZero::allocate()
|
||||
allocated = 1;
|
||||
int n = atom->nimpropertypes;
|
||||
|
||||
memory->create(setflag,n+1,"improper:setflag");
|
||||
memory->create(setflag, n + 1, "improper:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
@ -80,12 +78,12 @@ void ImproperZero::allocate()
|
||||
void ImproperZero::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 1))
|
||||
error->all(FLERR,"Incorrect args for improper coefficients");
|
||||
error->all(FLERR, "Incorrect args for improper coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error);
|
||||
int ilo, ihi;
|
||||
utils::bounds(FLERR, arg[0], 1, atom->nimpropertypes, ilo, ihi, error);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
@ -93,7 +91,7 @@ void ImproperZero::coeff(int narg, char **arg)
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for improper coefficients");
|
||||
if (count == 0) error->all(FLERR, "Incorrect args for improper coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -116,8 +114,7 @@ void ImproperZero::read_restart(FILE * /*fp*/)
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero::write_data(FILE *fp) {
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d\n",i);
|
||||
void ImproperZero::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) fprintf(fp, "%d\n", i);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -23,23 +22,23 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
using std::array;
|
||||
using std::vector;
|
||||
using namespace MathEigen;
|
||||
|
||||
// Special case: 3x3 matrices
|
||||
|
||||
typedef Jacobi<double,double*,double(*)[3],double const(*)[3]> Jacobi_v1;
|
||||
typedef Jacobi<double,double*,double**,double const*const*> Jacobi_v2;
|
||||
typedef Jacobi<double, double *, double (*)[3], double const (*)[3]> Jacobi_v1;
|
||||
typedef Jacobi<double, double *, double **, double const *const *> Jacobi_v2;
|
||||
|
||||
int MathEigen::jacobi3(double const mat[3][3], double *eval, double evec[3][3])
|
||||
{
|
||||
// make copy of const matrix
|
||||
|
||||
double mat_cpy[3][3] = { {mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]} };
|
||||
double *M[3] = { &(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0]) };
|
||||
double mat_cpy[3][3] = {{mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]}};
|
||||
double *M[3] = {&(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0])};
|
||||
int midx[3];
|
||||
|
||||
// create instance of generic Jacobi class and get eigenvalues and -vectors
|
||||
@ -49,21 +48,20 @@ int MathEigen::jacobi3(double const mat[3][3], double *eval, double evec[3][3])
|
||||
|
||||
// transpose the evec matrix
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
for (int j=i+1; j<3; j++)
|
||||
std::swap(evec[i][j], evec[j][i]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = i + 1; j < 3; j++) std::swap(evec[i][j], evec[j][i]);
|
||||
|
||||
return ierror;
|
||||
}
|
||||
|
||||
int MathEigen::jacobi3(double const* const* mat, double *eval, double **evec)
|
||||
int MathEigen::jacobi3(double const *const *mat, double *eval, double **evec)
|
||||
{
|
||||
// make copy of const matrix
|
||||
|
||||
double mat_cpy[3][3] = { {mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]} };
|
||||
double *M[3] = { &(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0]) };
|
||||
double mat_cpy[3][3] = {{mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]}};
|
||||
double *M[3] = {&(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0])};
|
||||
int midx[3];
|
||||
|
||||
// create instance of generic Jacobi class and get eigenvalues and -vectors
|
||||
@ -73,9 +71,8 @@ int MathEigen::jacobi3(double const* const* mat, double *eval, double **evec)
|
||||
|
||||
// transpose the evec matrix
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
for (int j=i+1; j<3; j++)
|
||||
std::swap(evec[i][j], evec[j][i]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = i + 1; j < 3; j++) std::swap(evec[i][j], evec[j][i]);
|
||||
|
||||
return ierror;
|
||||
}
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#if defined(LMP_INTEL) && \
|
||||
((defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)))
|
||||
#if defined(LMP_INTEL) && ((defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)))
|
||||
#ifndef LMP_INTEL_NO_TBB
|
||||
#define LMP_USE_TBB_ALLOCATOR
|
||||
#include "tbb/scalable_allocator.h"
|
||||
@ -127,6 +126,5 @@ void Memory::sfree(void *ptr)
|
||||
|
||||
void Memory::fail(const char *name)
|
||||
{
|
||||
error->one(FLERR,"Cannot create/grow a vector/array of "
|
||||
"pointers for {}",name);
|
||||
error->one(FLERR,"Cannot create/grow a vector/array of pointers for {}",name);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -37,9 +36,9 @@ MinSD::MinSD(LAMMPS *lmp) : MinLineSearch(lmp) {}
|
||||
|
||||
int MinSD::iterate(int maxiter)
|
||||
{
|
||||
int i,m,n,fail,ntimestep;
|
||||
int i, m, n, fail, ntimestep;
|
||||
double fdotf;
|
||||
double *fatom,*hatom;
|
||||
double *fatom, *hatom;
|
||||
|
||||
// initialize working vectors
|
||||
|
||||
@ -56,8 +55,7 @@ int MinSD::iterate(int maxiter)
|
||||
|
||||
for (int iter = 0; iter < maxiter; iter++) {
|
||||
|
||||
if (timer->check_timeout(niter))
|
||||
return TIMEOUT;
|
||||
if (timer->check_timeout(niter)) return TIMEOUT;
|
||||
|
||||
ntimestep = ++update->ntimestep;
|
||||
niter++;
|
||||
@ -66,7 +64,7 @@ int MinSD::iterate(int maxiter)
|
||||
// h = downhill gradient direction
|
||||
|
||||
eprevious = ecurrent;
|
||||
fail = (this->*linemin)(ecurrent,alpha_final);
|
||||
fail = (this->*linemin)(ecurrent, alpha_final);
|
||||
if (fail) return fail;
|
||||
|
||||
// function evaluation criterion
|
||||
@ -75,19 +73,23 @@ int MinSD::iterate(int maxiter)
|
||||
|
||||
// energy tolerance criterion
|
||||
|
||||
if (fabs(ecurrent-eprevious) <
|
||||
update->etol * 0.5*(fabs(ecurrent) + fabs(eprevious) + EPS_ENERGY))
|
||||
if (fabs(ecurrent - eprevious) <
|
||||
update->etol * 0.5 * (fabs(ecurrent) + fabs(eprevious) + EPS_ENERGY))
|
||||
return ETOL;
|
||||
|
||||
// force tolerance criterion
|
||||
|
||||
fdotf = 0.0;
|
||||
if (update->ftol > 0.0) {
|
||||
if (normstyle == MAX) fdotf = fnorm_max(); // max force norm
|
||||
else if (normstyle == INF) fdotf = fnorm_inf(); // infinite force norm
|
||||
else if (normstyle == TWO) fdotf = fnorm_sqr(); // Euclidean force 2-norm
|
||||
else error->all(FLERR,"Illegal min_modify command");
|
||||
if (fdotf < update->ftol*update->ftol) return FTOL;
|
||||
if (normstyle == MAX)
|
||||
fdotf = fnorm_max(); // max force norm
|
||||
else if (normstyle == INF)
|
||||
fdotf = fnorm_inf(); // infinite force norm
|
||||
else if (normstyle == TWO)
|
||||
fdotf = fnorm_sqr(); // Euclidean force 2-norm
|
||||
else
|
||||
error->all(FLERR, "Illegal min_modify command");
|
||||
if (fdotf < update->ftol * update->ftol) return FTOL;
|
||||
}
|
||||
|
||||
// set new search direction h to f = -Grad(x)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,13 +12,14 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_full_bin.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -34,9 +34,9 @@ NPairFullBin::NPairFullBin(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairFullBin::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
int i, j, k, n, itype, jtype, ibin, which, imol, iatom, moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -52,8 +52,10 @@ void NPairFullBin::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
if (molecular == Atom::TEMPLATE)
|
||||
moltemplate = 1;
|
||||
else
|
||||
moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
@ -83,31 +85,35 @@ void NPairFullBin::build(NeighList *list)
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
for (j = binhead[ibin + stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (i == j) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
if (!moltemplate) {
|
||||
which = find_special(special[i], nspecial[i], tag[j]);
|
||||
} else if (imol >= 0) {
|
||||
const auto mol = onemols[imol];
|
||||
which = find_special(mol->special[iatom], mol->nspecial[iatom], tag[j] - tagprev);
|
||||
} else {
|
||||
which = 0;
|
||||
}
|
||||
if (which == 0)
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx, dely, delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0)
|
||||
neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else
|
||||
neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,8 +122,7 @@ void NPairFullBin::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,14 +12,15 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_full_nsq.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -35,9 +35,9 @@ NPairFullNsq::NPairFullNsq(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairFullNsq::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
int i, j, n, itype, jtype, which, bitmask, imol, iatom, moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -57,8 +57,10 @@ void NPairFullNsq::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
if (molecular == Atom::TEMPLATE)
|
||||
moltemplate = 1;
|
||||
else
|
||||
moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
@ -89,26 +91,31 @@ void NPairFullNsq::build(NeighList *list)
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
if (i == j) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
if (rsq <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
if (!moltemplate) {
|
||||
which = find_special(special[i], nspecial[i], tag[j]);
|
||||
} else if (imol >= 0) {
|
||||
const auto mol = onemols[imol];
|
||||
which = find_special(mol->special[iatom], mol->nspecial[iatom], tag[j] - tagprev);
|
||||
} else {
|
||||
which = 0;
|
||||
}
|
||||
|
||||
if (which == 0)
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx, dely, delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0)
|
||||
neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else
|
||||
neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,8 +123,7 @@ void NPairFullNsq::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -23,8 +22,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) :
|
||||
NPair(lmp) {}
|
||||
NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
@ -34,8 +32,8 @@ NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) :
|
||||
|
||||
void NPairHalfBinAtomonlyNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int i, j, k, n, itype, jtype, ibin;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -76,12 +74,12 @@ void NPairHalfBinAtomonlyNewton::build(NeighList *list)
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
@ -91,14 +89,14 @@ void NPairHalfBinAtomonlyNewton::build(NeighList *list)
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
for (j = binhead[ibin + stencil[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
@ -108,8 +106,7 @@ void NPairHalfBinAtomonlyNewton::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,13 +12,14 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_half_bin_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -36,9 +36,9 @@ NPairHalfBinNewtoff::NPairHalfBinNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairHalfBinNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
int i, j, k, n, itype, jtype, ibin, which, imol, iatom, moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -54,8 +54,10 @@ void NPairHalfBinNewtoff::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
if (molecular == Atom::TEMPLATE)
|
||||
moltemplate = 1;
|
||||
else
|
||||
moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
@ -87,32 +89,35 @@ void NPairHalfBinNewtoff::build(NeighList *list)
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
for (j = binhead[ibin + stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
which = find_special(special[i], nspecial[i], tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom],
|
||||
tag[j] - tagprev);
|
||||
else
|
||||
which = 0;
|
||||
if (which == 0)
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
else if (domain->minimum_image_check(delx, dely, delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0)
|
||||
neighptr[n++] = j ^ (which << SBBITS);
|
||||
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
} else
|
||||
neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,9 +126,7 @@ void NPairHalfBinNewtoff::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -13,14 +12,15 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_half_nsq_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -36,9 +36,9 @@ NPairHalfNsqNewtoff::NPairHalfNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairHalfNsqNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
int i, j, n, itype, jtype, which, bitmask, imol, iatom, moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -58,8 +58,10 @@ void NPairHalfNsqNewtoff::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
if (molecular == Atom::TEMPLATE)
|
||||
moltemplate = 1;
|
||||
else
|
||||
moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
@ -86,30 +88,33 @@ void NPairHalfNsqNewtoff::build(NeighList *list)
|
||||
// loop over remaining atoms, owned and ghost
|
||||
// only store pair if i < j
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
for (j = i + 1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
which = find_special(special[i], nspecial[i], tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom],
|
||||
tag[j] - tagprev);
|
||||
else
|
||||
which = 0;
|
||||
if (which == 0)
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx, dely, delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0)
|
||||
neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else
|
||||
neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,9 +122,7 @@ void NPairHalfNsqNewtoff::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -18,8 +17,8 @@
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
@ -38,10 +37,10 @@ NPairHalfSizeNsqNewtoff::NPairHalfSizeNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairHalfSizeNsqNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,n,bitmask,which,imol,iatom,moltemplate;
|
||||
int i, j, jh, n, bitmask, which, imol, iatom, moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||
double radi, radsum, cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
@ -62,8 +61,10 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
if (molecular == Atom::TEMPLATE)
|
||||
moltemplate = 1;
|
||||
else
|
||||
moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
@ -92,35 +93,37 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list)
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
for (j = i + 1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
if (exclude && exclusion(i, j, type[i], type[j], mask, molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
cutsq = (radsum + skin) * (radsum + skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
if (history && rsq < radsum * radsum) jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
which = find_special(special[i], nspecial[i], tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom],
|
||||
tag[j] - tagprev);
|
||||
else
|
||||
which = 0;
|
||||
if (which == 0)
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx, dely, delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0)
|
||||
neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else
|
||||
neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,9 +131,7 @@ void NPairHalfSizeNsqNewtoff::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,9 +33,9 @@ NPairHalffullNewton::NPairHalffullNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairHalffullNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,jnum,joriginal;
|
||||
int *neighptr,*jlist;
|
||||
double xtmp,ytmp,ztmp;
|
||||
int i, j, ii, jj, n, jnum, joriginal;
|
||||
int *neighptr, *jlist;
|
||||
double xtmp, ytmp, ztmp;
|
||||
|
||||
double **x = atom->x;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -89,9 +88,7 @@ void NPairHalffullNewton::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -34,10 +33,10 @@ NPairHalffullNewtonTrim::NPairHalffullNewtonTrim(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairHalffullNewtonTrim::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,jnum,joriginal;
|
||||
int *neighptr,*jlist;
|
||||
double xtmp,ytmp,ztmp;
|
||||
double delx,dely,delz,rsq;
|
||||
int i, j, ii, jj, n, jnum, joriginal;
|
||||
int *neighptr, *jlist;
|
||||
double xtmp, ytmp, ztmp;
|
||||
double delx, dely, delz, rsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -100,9 +99,7 @@ void NPairHalffullNewtonTrim::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -35,8 +34,8 @@ NPairSkip::NPairSkip(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairSkip::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,itype,jnum,joriginal;
|
||||
int *neighptr,*jlist;
|
||||
int i, j, ii, jj, n, itype, jnum, joriginal;
|
||||
int *neighptr, *jlist;
|
||||
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -86,16 +85,17 @@ void NPairSkip::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
if (list->ghost) {
|
||||
int num = 0;
|
||||
for (i = 0; i < inum; i++)
|
||||
if (ilist[i] < nlocal) num++;
|
||||
else break;
|
||||
if (ilist[i] < nlocal)
|
||||
num++;
|
||||
else
|
||||
break;
|
||||
list->inum = num;
|
||||
list->gnum = inum - num;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -33,9 +32,9 @@ NPairSkipSizeOff2on::NPairSkipSizeOff2on(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
void NPairSkipSizeOff2on::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,itype,jnum,joriginal;
|
||||
tagint itag,jtag;
|
||||
int *neighptr,*jlist;
|
||||
int i, j, ii, jj, n, itype, jnum, joriginal;
|
||||
tagint itag, jtag;
|
||||
int *neighptr, *jlist;
|
||||
|
||||
tagint *tag = atom->tag;
|
||||
int *type = atom->type;
|
||||
@ -92,9 +91,7 @@ void NPairSkipSizeOff2on::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");
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -51,7 +50,6 @@ void NStencilFullMulti3d::create()
|
||||
int n = ncollections;
|
||||
double cutsq;
|
||||
|
||||
|
||||
for (icollection = 0; icollection < n; icollection++) {
|
||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||
if (flag_skip_multi[icollection][jcollection]) {
|
||||
@ -76,9 +74,8 @@ void NStencilFullMulti3d::create()
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, k, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
|
||||
nstencil_multi[icollection][jcollection] = ns;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -20,8 +19,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti2d::NStencilHalfMulti2d(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
NStencilHalfMulti2d::NStencilHalfMulti2d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -37,11 +35,11 @@ void NStencilHalfMulti2d::set_stencil_properties()
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
if (cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
|
||||
flag_skip_multi[i][j] = false;
|
||||
|
||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||
if (cutcollectionsq[i][i] == cutcollectionsq[j][j]) {
|
||||
flag_half_multi[i][j] = true;
|
||||
bin_collection_multi[i][j] = i;
|
||||
} else {
|
||||
@ -62,7 +60,6 @@ void NStencilHalfMulti2d::create()
|
||||
int n = ncollections;
|
||||
double cutsq;
|
||||
|
||||
|
||||
for (icollection = 0; icollection < n; icollection++) {
|
||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||
if (flag_skip_multi[icollection][jcollection]) {
|
||||
@ -86,18 +83,16 @@ void NStencilHalfMulti2d::create()
|
||||
for (j = 0; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (j > 0 || (j == 0 && i > 0)) {
|
||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||
}
|
||||
if (bin_distance_multi(i, j, 0, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j * mbinx + i;
|
||||
}
|
||||
} else {
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i, j, 0, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j * mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi[icollection][jcollection] = ns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -20,8 +19,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti2dTri::NStencilHalfMulti2dTri(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
NStencilHalfMulti2dTri::NStencilHalfMulti2dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -37,11 +35,11 @@ void NStencilHalfMulti2dTri::set_stencil_properties()
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
if (cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
|
||||
flag_skip_multi[i][j] = false;
|
||||
|
||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||
if (cutcollectionsq[i][i] == cutcollectionsq[j][j]) {
|
||||
flag_half_multi[i][j] = true;
|
||||
bin_collection_multi[i][j] = i;
|
||||
} else {
|
||||
@ -62,7 +60,6 @@ void NStencilHalfMulti2dTri::create()
|
||||
int n = ncollections;
|
||||
double cutsq;
|
||||
|
||||
|
||||
for (icollection = 0; icollection < n; icollection++) {
|
||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||
if (flag_skip_multi[icollection][jcollection]) {
|
||||
@ -85,15 +82,14 @@ void NStencilHalfMulti2dTri::create()
|
||||
if (flag_half_multi[icollection][jcollection]) {
|
||||
for (j = 0; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, 0, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j * mbinx + i;
|
||||
} else {
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, 0, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = j * mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi[icollection][jcollection] = ns;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -20,8 +19,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti3d::NStencilHalfMulti3d(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
NStencilHalfMulti3d::NStencilHalfMulti3d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -37,11 +35,11 @@ void NStencilHalfMulti3d::set_stencil_properties()
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
if (cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
|
||||
flag_skip_multi[i][j] = false;
|
||||
|
||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||
if (cutcollectionsq[i][i] == cutcollectionsq[j][j]) {
|
||||
flag_half_multi[i][j] = true;
|
||||
bin_collection_multi[i][j] = i;
|
||||
} else {
|
||||
@ -62,7 +60,6 @@ void NStencilHalfMulti3d::create()
|
||||
int n = ncollections;
|
||||
double cutsq;
|
||||
|
||||
|
||||
for (icollection = 0; icollection < n; icollection++) {
|
||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||
if (flag_skip_multi[icollection][jcollection]) {
|
||||
@ -88,22 +85,18 @@ void NStencilHalfMulti3d::create()
|
||||
for (k = 0; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
}
|
||||
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
|
||||
if (bin_distance_multi(i, j, k, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
}
|
||||
} else {
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, k, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi[icollection][jcollection] = ns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -20,8 +19,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti3dTri::NStencilHalfMulti3dTri(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
NStencilHalfMulti3dTri::NStencilHalfMulti3dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -37,11 +35,11 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
if (cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||
|
||||
flag_skip_multi[i][j] = false;
|
||||
|
||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||
if (cutcollectionsq[i][i] == cutcollectionsq[j][j]) {
|
||||
flag_half_multi[i][j] = true;
|
||||
bin_collection_multi[i][j] = i;
|
||||
} else {
|
||||
@ -62,7 +60,6 @@ void NStencilHalfMulti3dTri::create()
|
||||
int n = ncollections;
|
||||
double cutsq;
|
||||
|
||||
|
||||
for (icollection = 0; icollection < n; icollection++) {
|
||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||
if (flag_skip_multi[icollection][jcollection]) {
|
||||
@ -81,25 +78,21 @@ void NStencilHalfMulti3dTri::create()
|
||||
mbinz = stencil_mbinz_multi[icollection][jcollection];
|
||||
|
||||
bin_collection = bin_collection_multi[icollection][jcollection];
|
||||
|
||||
cutsq = cutcollectionsq[icollection][jcollection];
|
||||
|
||||
if (flag_half_multi[icollection][jcollection]) {
|
||||
for (k = 0; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, k, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
} else {
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
if (bin_distance_multi(i, j, k, bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi[icollection][jcollection] = ns;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -15,14 +14,16 @@
|
||||
// Park/Miller RNG
|
||||
|
||||
#include "random_park.h"
|
||||
#include <cmath>
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define IA 16807
|
||||
#define IM 2147483647
|
||||
#define AM (1.0/IM)
|
||||
#define AM (1.0 / IM)
|
||||
#define IQ 127773
|
||||
#define IR 2836
|
||||
|
||||
@ -30,8 +31,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
RanPark::RanPark(LAMMPS *lmp, int seed_init) : Pointers(lmp)
|
||||
{
|
||||
if (seed_init <= 0)
|
||||
error->one(FLERR,"Invalid seed for Park random # generator");
|
||||
if (seed_init <= 0) error->one(FLERR, "Invalid seed for Park random # generator");
|
||||
seed = seed_init;
|
||||
save = 0;
|
||||
}
|
||||
@ -42,10 +42,10 @@ RanPark::RanPark(LAMMPS *lmp, int seed_init) : Pointers(lmp)
|
||||
|
||||
double RanPark::uniform()
|
||||
{
|
||||
int k = seed/IQ;
|
||||
seed = IA*(seed-k*IQ) - IR*k;
|
||||
int k = seed / IQ;
|
||||
seed = IA * (seed - k * IQ) - IR * k;
|
||||
if (seed < 0) seed += IM;
|
||||
double ans = AM*seed;
|
||||
double ans = AM * seed;
|
||||
return ans;
|
||||
}
|
||||
|
||||
@ -55,17 +55,17 @@ double RanPark::uniform()
|
||||
|
||||
double RanPark::gaussian()
|
||||
{
|
||||
double first,v1,v2,rsq,fac;
|
||||
double first, v1, v2, rsq, fac;
|
||||
|
||||
if (!save) {
|
||||
do {
|
||||
v1 = 2.0*uniform()-1.0;
|
||||
v2 = 2.0*uniform()-1.0;
|
||||
rsq = v1*v1 + v2*v2;
|
||||
v1 = 2.0 * uniform() - 1.0;
|
||||
v2 = 2.0 * uniform() - 1.0;
|
||||
rsq = v1 * v1 + v2 * v2;
|
||||
} while ((rsq >= 1.0) || (rsq == 0.0));
|
||||
fac = sqrt(-2.0*log(rsq)/rsq);
|
||||
second = v1*fac;
|
||||
first = v2*fac;
|
||||
fac = sqrt(-2.0 * log(rsq) / rsq);
|
||||
second = v1 * fac;
|
||||
first = v2 * fac;
|
||||
save = 1;
|
||||
} else {
|
||||
first = second;
|
||||
@ -78,8 +78,7 @@ double RanPark::gaussian()
|
||||
|
||||
void RanPark::reset(int seed_init)
|
||||
{
|
||||
if (seed_init <= 0)
|
||||
error->all(FLERR,"Invalid seed for Park random # generator");
|
||||
if (seed_init <= 0) error->all(FLERR, "Invalid seed for Park random # generator");
|
||||
seed = seed_init;
|
||||
save = 0;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -22,22 +21,23 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) :
|
||||
Region(lmp, narg, arg)
|
||||
RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
|
||||
{
|
||||
options(narg-8,&arg[8]);
|
||||
options(narg - 8, &arg[8]);
|
||||
|
||||
xp = xscale*utils::numeric(FLERR,arg[2],false,lmp);
|
||||
yp = yscale*utils::numeric(FLERR,arg[3],false,lmp);
|
||||
zp = zscale*utils::numeric(FLERR,arg[4],false,lmp);
|
||||
normal[0] = xscale*utils::numeric(FLERR,arg[5],false,lmp);
|
||||
normal[1] = yscale*utils::numeric(FLERR,arg[6],false,lmp);
|
||||
normal[2] = zscale*utils::numeric(FLERR,arg[7],false,lmp);
|
||||
xp = xscale * utils::numeric(FLERR, arg[2], false, lmp);
|
||||
yp = yscale * utils::numeric(FLERR, arg[3], false, lmp);
|
||||
zp = zscale * utils::numeric(FLERR, arg[4], false, lmp);
|
||||
normal[0] = xscale * utils::numeric(FLERR, arg[5], false, lmp);
|
||||
normal[1] = yscale * utils::numeric(FLERR, arg[6], false, lmp);
|
||||
normal[2] = zscale * utils::numeric(FLERR, arg[7], false, lmp);
|
||||
|
||||
// enforce unit normal
|
||||
|
||||
double rsq = normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2];
|
||||
if (rsq == 0.0) error->all(FLERR,"Illegal region plane normal vector: {} {} {}", normal[0], normal[1], normal[2]);
|
||||
double rsq = normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2];
|
||||
if (rsq == 0.0)
|
||||
error->all(FLERR, "Illegal region plane normal vector: {} {} {}", normal[0], normal[1],
|
||||
normal[2]);
|
||||
normal[0] /= sqrt(rsq);
|
||||
normal[1] /= sqrt(rsq);
|
||||
normal[2] /= sqrt(rsq);
|
||||
@ -54,7 +54,7 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
RegPlane::~RegPlane()
|
||||
{
|
||||
delete [] contact;
|
||||
delete[] contact;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -65,7 +65,7 @@ RegPlane::~RegPlane()
|
||||
|
||||
int RegPlane::inside(double x, double y, double z)
|
||||
{
|
||||
double dot = (x-xp)*normal[0] + (y-yp)*normal[1] + (z-zp)*normal[2];
|
||||
double dot = (x - xp) * normal[0] + (y - yp) * normal[1] + (z - zp) * normal[2];
|
||||
|
||||
if (dot >= 0.0) return 1;
|
||||
return 0;
|
||||
@ -79,12 +79,12 @@ int RegPlane::inside(double x, double y, double z)
|
||||
|
||||
int RegPlane::surface_interior(double *x, double cutoff)
|
||||
{
|
||||
double dot = (x[0]-xp)*normal[0] + (x[1]-yp)*normal[1] + (x[2]-zp)*normal[2];
|
||||
double dot = (x[0] - xp) * normal[0] + (x[1] - yp) * normal[1] + (x[2] - zp) * normal[2];
|
||||
if (dot < cutoff && dot >= 0.0) {
|
||||
contact[0].r = dot;
|
||||
contact[0].delx = dot*normal[0];
|
||||
contact[0].dely = dot*normal[1];
|
||||
contact[0].delz = dot*normal[2];
|
||||
contact[0].delx = dot * normal[0];
|
||||
contact[0].dely = dot * normal[1];
|
||||
contact[0].delz = dot * normal[2];
|
||||
contact[0].radius = 0;
|
||||
contact[0].iwall = 0;
|
||||
return 1;
|
||||
@ -100,13 +100,13 @@ int RegPlane::surface_interior(double *x, double cutoff)
|
||||
|
||||
int RegPlane::surface_exterior(double *x, double cutoff)
|
||||
{
|
||||
double dot = (x[0]-xp)*normal[0] + (x[1]-yp)*normal[1] + (x[2]-zp)*normal[2];
|
||||
double dot = (x[0] - xp) * normal[0] + (x[1] - yp) * normal[1] + (x[2] - zp) * normal[2];
|
||||
dot = -dot;
|
||||
if (dot < cutoff && dot >= 0.0) {
|
||||
contact[0].r = dot;
|
||||
contact[0].delx = -dot*normal[0];
|
||||
contact[0].dely = -dot*normal[1];
|
||||
contact[0].delz = -dot*normal[2];
|
||||
contact[0].delx = -dot * normal[0];
|
||||
contact[0].dely = -dot * normal[1];
|
||||
contact[0].delz = -dot * normal[2];
|
||||
contact[0].radius = 0;
|
||||
contact[0].iwall = 0;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user