enable and apply clang-format
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -25,10 +24,9 @@ using namespace LAMMPS_NS;
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
|
ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg),
|
Compute(lmp, narg, arg), emine(nullptr)
|
||||||
emine(nullptr)
|
|
||||||
{
|
{
|
||||||
if (narg != 3) error->all(FLERR,"Illegal compute dihedral command");
|
if (narg != 3) error->all(FLERR, "Illegal compute dihedral command");
|
||||||
|
|
||||||
vector_flag = 1;
|
vector_flag = 1;
|
||||||
extvector = 1;
|
extvector = 1;
|
||||||
@ -37,9 +35,8 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// check if dihedral style hybrid exists
|
// check if dihedral style hybrid exists
|
||||||
|
|
||||||
dihedral = dynamic_cast<DihedralHybrid *>( force->dihedral_match("hybrid"));
|
dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid"));
|
||||||
if (!dihedral)
|
if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
|
||||||
error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
|
|
||||||
size_vector = nsub = dihedral->nstyles;
|
size_vector = nsub = dihedral->nstyles;
|
||||||
|
|
||||||
emine = new double[nsub];
|
emine = new double[nsub];
|
||||||
@ -50,8 +47,8 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
ComputeDihedral::~ComputeDihedral()
|
ComputeDihedral::~ComputeDihedral()
|
||||||
{
|
{
|
||||||
delete [] emine;
|
delete[] emine;
|
||||||
delete [] vector;
|
delete[] vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -60,11 +57,10 @@ void ComputeDihedral::init()
|
|||||||
{
|
{
|
||||||
// recheck dihedral style in case it has been changed
|
// recheck dihedral style in case it has been changed
|
||||||
|
|
||||||
dihedral = dynamic_cast<DihedralHybrid *>( force->dihedral_match("hybrid"));
|
dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid"));
|
||||||
if (!dihedral)
|
if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
|
||||||
error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
|
|
||||||
if (dihedral->nstyles != nsub)
|
if (dihedral->nstyles != nsub)
|
||||||
error->all(FLERR,"Dihedral style for compute dihedral command has changed");
|
error->all(FLERR, "Dihedral style for compute dihedral command has changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -73,10 +69,9 @@ void ComputeDihedral::compute_vector()
|
|||||||
{
|
{
|
||||||
invoked_vector = update->ntimestep;
|
invoked_vector = update->ntimestep;
|
||||||
if (update->eflag_global != invoked_vector)
|
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 < nsub; i++)
|
for (int i = 0; i < nsub; i++) emine[i] = dihedral->styles[i]->energy;
|
||||||
emine[i] = dihedral->styles[i]->energy;
|
|
||||||
|
|
||||||
MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -14,21 +13,20 @@
|
|||||||
|
|
||||||
#include "compute_improper.h"
|
#include "compute_improper.h"
|
||||||
|
|
||||||
#include "update.h"
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "improper.h"
|
#include "improper.h"
|
||||||
#include "improper_hybrid.h"
|
#include "improper_hybrid.h"
|
||||||
#include "error.h"
|
#include "update.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
|
ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg),
|
Compute(lmp, narg, arg), emine(nullptr)
|
||||||
emine(nullptr)
|
|
||||||
{
|
{
|
||||||
if (narg != 3) error->all(FLERR,"Illegal compute improper command");
|
if (narg != 3) error->all(FLERR, "Illegal compute improper command");
|
||||||
|
|
||||||
vector_flag = 1;
|
vector_flag = 1;
|
||||||
extvector = 1;
|
extvector = 1;
|
||||||
@ -37,9 +35,8 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// check if improper style hybrid exists
|
// check if improper style hybrid exists
|
||||||
|
|
||||||
improper = dynamic_cast<ImproperHybrid *>( force->improper_match("hybrid"));
|
improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid"));
|
||||||
if (!improper)
|
if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid");
|
||||||
error->all(FLERR, "Improper style for compute improper command is not hybrid");
|
|
||||||
size_vector = nsub = improper->nstyles;
|
size_vector = nsub = improper->nstyles;
|
||||||
|
|
||||||
emine = new double[nsub];
|
emine = new double[nsub];
|
||||||
@ -50,8 +47,8 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
ComputeImproper::~ComputeImproper()
|
ComputeImproper::~ComputeImproper()
|
||||||
{
|
{
|
||||||
delete [] emine;
|
delete[] emine;
|
||||||
delete [] vector;
|
delete[] vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -60,11 +57,10 @@ void ComputeImproper::init()
|
|||||||
{
|
{
|
||||||
// recheck improper style in case it has been changed
|
// recheck improper style in case it has been changed
|
||||||
|
|
||||||
improper = dynamic_cast<ImproperHybrid *>( force->improper_match("hybrid"));
|
improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid"));
|
||||||
if (!improper)
|
if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid");
|
||||||
error->all(FLERR, "Improper style for compute improper command is not hybrid");
|
|
||||||
if (improper->nstyles != nsub)
|
if (improper->nstyles != nsub)
|
||||||
error->all(FLERR,"Improper style for compute improper command has changed");
|
error->all(FLERR, "Improper style for compute improper command has changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -73,10 +69,9 @@ void ComputeImproper::compute_vector()
|
|||||||
{
|
{
|
||||||
invoked_vector = update->ntimestep;
|
invoked_vector = update->ntimestep;
|
||||||
if (update->eflag_global != invoked_vector)
|
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 < nsub; i++)
|
for (int i = 0; i < nsub; i++) emine[i] = improper->styles[i]->energy;
|
||||||
emine[i] = improper->styles[i]->energy;
|
|
||||||
|
|
||||||
MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -13,16 +12,16 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "fix_dummy.h"
|
#include "fix_dummy.h"
|
||||||
#include <cstring>
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) :
|
FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||||
Fix(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
// process optional args
|
// process optional args
|
||||||
// customize here and in setmask() by adding a new keyword from fix.h
|
// customize here and in setmask() by adding a new keyword from fix.h
|
||||||
@ -39,14 +38,22 @@ FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
int iarg = 3;
|
int iarg = 3;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"initial_integrate") == 0) initial_integrate_flag = 1;
|
if (strcmp(arg[iarg], "initial_integrate") == 0)
|
||||||
else if (strcmp(arg[iarg],"final_integrate") == 0) final_integrate_flag = 1;
|
initial_integrate_flag = 1;
|
||||||
else if (strcmp(arg[iarg],"pre_exchange") == 0) pre_exchange_flag = 1;
|
else if (strcmp(arg[iarg], "final_integrate") == 0)
|
||||||
else if (strcmp(arg[iarg],"pre_neighbor") == 0) pre_neighbor_flag = 1;
|
final_integrate_flag = 1;
|
||||||
else if (strcmp(arg[iarg],"pre_force") == 0) pre_force_flag = 1;
|
else if (strcmp(arg[iarg], "pre_exchange") == 0)
|
||||||
else if (strcmp(arg[iarg],"post_force") == 0) post_force_flag = 1;
|
pre_exchange_flag = 1;
|
||||||
else if (strcmp(arg[iarg],"end_of_step") == 0) end_of_step_flag = 1;
|
else if (strcmp(arg[iarg], "pre_neighbor") == 0)
|
||||||
else error->all(FLERR,"Illegal fix DUMMY command");
|
pre_neighbor_flag = 1;
|
||||||
|
else if (strcmp(arg[iarg], "pre_force") == 0)
|
||||||
|
pre_force_flag = 1;
|
||||||
|
else if (strcmp(arg[iarg], "post_force") == 0)
|
||||||
|
post_force_flag = 1;
|
||||||
|
else if (strcmp(arg[iarg], "end_of_step") == 0)
|
||||||
|
end_of_step_flag = 1;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Illegal fix DUMMY command");
|
||||||
iarg++;
|
iarg++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -24,10 +23,9 @@ using namespace FixConst;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) :
|
FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||||
Fix(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
if (narg != 3) error->all(FLERR,"Illegal fix nve/noforce command");
|
if (narg != 3) error->all(FLERR, "Illegal fix nve/noforce command");
|
||||||
|
|
||||||
time_integrate = 1;
|
time_integrate = 1;
|
||||||
}
|
}
|
||||||
@ -48,8 +46,8 @@ void FixNVENoforce::init()
|
|||||||
{
|
{
|
||||||
dtv = update->dt;
|
dtv = update->dt;
|
||||||
|
|
||||||
if (utils::strmatch(update->integrate_style,"^respa"))
|
if (utils::strmatch(update->integrate_style, "^respa"))
|
||||||
step_respa = (dynamic_cast<Respa *>( update->integrate))->step;
|
step_respa = (dynamic_cast<Respa *>(update->integrate))->step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -75,7 +73,7 @@ void FixNVENoforce::initial_integrate(int /*vflag*/)
|
|||||||
|
|
||||||
void FixNVENoforce::initial_integrate_respa(int vflag, int ilevel, int flag)
|
void FixNVENoforce::initial_integrate_respa(int vflag, int ilevel, int flag)
|
||||||
{
|
{
|
||||||
if (flag) return; // only used by NPT,NPH
|
if (flag) return; // only used by NPT,NPH
|
||||||
|
|
||||||
dtv = step_respa[ilevel];
|
dtv = step_respa[ilevel];
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -23,19 +22,15 @@ using namespace FixConst;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) :
|
FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : FixNHSphere(lmp, narg, arg)
|
||||||
FixNHSphere(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
if (!tstat_flag)
|
if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/sphere");
|
||||||
error->all(FLERR,"Temperature control must be used with fix nvt/sphere");
|
if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/sphere");
|
||||||
if (pstat_flag)
|
|
||||||
error->all(FLERR,"Pressure control can not be used with fix nvt/sphere");
|
|
||||||
|
|
||||||
// create a new compute temp style
|
// create a new compute temp style
|
||||||
// id = fix-ID + temp
|
// id = fix-ID + temp
|
||||||
|
|
||||||
id_temp = utils::strdup(std::string(id) + "_temp");
|
id_temp = utils::strdup(std::string(id) + "_temp");
|
||||||
modify->add_compute(fmt::format("{} {} temp/sphere",
|
modify->add_compute(fmt::format("{} {} temp/sphere", id_temp, group->names[igroup]));
|
||||||
id_temp,group->names[igroup]));
|
|
||||||
tcomputeflag = 1;
|
tcomputeflag = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -21,8 +20,7 @@ using namespace FixConst;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) :
|
FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
|
||||||
FixWall(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
dynamic_group_allow = 1;
|
dynamic_group_allow = 1;
|
||||||
}
|
}
|
||||||
@ -36,7 +34,7 @@ FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
void FixWallHarmonic::wall_particle(int m, int which, double coord)
|
void FixWallHarmonic::wall_particle(int m, int which, double coord)
|
||||||
{
|
{
|
||||||
double delta,dr,fwall;
|
double delta, dr, fwall;
|
||||||
double vn;
|
double vn;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -52,25 +50,29 @@ void FixWallHarmonic::wall_particle(int m, int which, double coord)
|
|||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (side < 0) delta = x[i][dim] - coord;
|
if (side < 0)
|
||||||
else delta = coord - x[i][dim];
|
delta = x[i][dim] - coord;
|
||||||
|
else
|
||||||
|
delta = coord - x[i][dim];
|
||||||
if (delta >= cutoff[m]) continue;
|
if (delta >= cutoff[m]) continue;
|
||||||
if (delta <= 0.0) {
|
if (delta <= 0.0) {
|
||||||
onflag = 1;
|
onflag = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dr = cutoff[m]-delta;
|
dr = cutoff[m] - delta;
|
||||||
fwall = side * 2.0*epsilon[m]*dr;
|
fwall = side * 2.0 * epsilon[m] * dr;
|
||||||
f[i][dim] -= fwall;
|
f[i][dim] -= fwall;
|
||||||
ewall[0] += epsilon[m]*dr*dr;
|
ewall[0] += epsilon[m] * dr * dr;
|
||||||
ewall[m+1] += fwall;
|
ewall[m + 1] += fwall;
|
||||||
|
|
||||||
if (evflag) {
|
if (evflag) {
|
||||||
if (side < 0) vn = -fwall*delta;
|
if (side < 0)
|
||||||
else vn = fwall*delta;
|
vn = -fwall * delta;
|
||||||
v_tally(dim,i,vn);
|
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
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -13,17 +12,17 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "fix_wall_morse.h"
|
#include "fix_wall_morse.h"
|
||||||
#include <cmath>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) :
|
FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
|
||||||
FixWall(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
dynamic_group_allow = 1;
|
dynamic_group_allow = 1;
|
||||||
}
|
}
|
||||||
@ -34,7 +33,7 @@ void FixWallMorse::precompute(int m)
|
|||||||
{
|
{
|
||||||
coeff1[m] = 2.0 * epsilon[m] * alpha[m];
|
coeff1[m] = 2.0 * epsilon[m] * alpha[m];
|
||||||
const double alpha_dr = -alpha[m] * (cutoff[m] - sigma[m]);
|
const double alpha_dr = -alpha[m] * (cutoff[m] - sigma[m]);
|
||||||
offset[m] = epsilon[m] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr));
|
offset[m] = epsilon[m] * (exp(2.0 * alpha_dr) - 2.0 * exp(alpha_dr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -46,7 +45,7 @@ void FixWallMorse::precompute(int m)
|
|||||||
|
|
||||||
void FixWallMorse::wall_particle(int m, int which, double coord)
|
void FixWallMorse::wall_particle(int m, int which, double coord)
|
||||||
{
|
{
|
||||||
double delta,fwall;
|
double delta, fwall;
|
||||||
double vn;
|
double vn;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -62,8 +61,10 @@ void FixWallMorse::wall_particle(int m, int which, double coord)
|
|||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (side < 0) delta = x[i][dim] - coord;
|
if (side < 0)
|
||||||
else delta = coord - x[i][dim];
|
delta = x[i][dim] - coord;
|
||||||
|
else
|
||||||
|
delta = coord - x[i][dim];
|
||||||
if (delta >= cutoff[m]) continue;
|
if (delta >= cutoff[m]) continue;
|
||||||
if (delta <= 0.0) {
|
if (delta <= 0.0) {
|
||||||
onflag = 1;
|
onflag = 1;
|
||||||
@ -71,18 +72,20 @@ void FixWallMorse::wall_particle(int m, int which, double coord)
|
|||||||
}
|
}
|
||||||
double dr = delta - sigma[m];
|
double dr = delta - sigma[m];
|
||||||
double dexp = exp(-alpha[m] * dr);
|
double dexp = exp(-alpha[m] * dr);
|
||||||
fwall = side * coeff1[m] * (dexp*dexp - dexp) / delta;
|
fwall = side * coeff1[m] * (dexp * dexp - dexp) / delta;
|
||||||
ewall[0] += epsilon[m] * (dexp*dexp - 2.0*dexp) - offset[m];
|
ewall[0] += epsilon[m] * (dexp * dexp - 2.0 * dexp) - offset[m];
|
||||||
f[i][dim] -= fwall;
|
f[i][dim] -= fwall;
|
||||||
ewall[m+1] += fwall;
|
ewall[m + 1] += fwall;
|
||||||
|
|
||||||
if (evflag) {
|
if (evflag) {
|
||||||
if (side < 0) vn = -fwall*delta;
|
if (side < 0)
|
||||||
else vn = fwall*delta;
|
vn = -fwall * delta;
|
||||||
|
else
|
||||||
|
vn = fwall * delta;
|
||||||
v_tally(dim, i, vn);
|
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
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -32,8 +31,8 @@ NPairFullBinAtomonly::NPairFullBinAtomonly(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
void NPairFullBinAtomonly::build(NeighList *list)
|
void NPairFullBinAtomonly::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i,j,k,n,itype,jtype,ibin;
|
int i, j, k, n, itype, jtype, ibin;
|
||||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||||
int *neighptr;
|
int *neighptr;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -66,16 +65,16 @@ void NPairFullBinAtomonly::build(NeighList *list)
|
|||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
for (k = 0; k < nstencil; k++) {
|
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;
|
if (i == j) continue;
|
||||||
|
|
||||||
jtype = type[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];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
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;
|
if (rsq <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||||
}
|
}
|
||||||
@ -85,8 +84,7 @@ void NPairFullBinAtomonly::build(NeighList *list)
|
|||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
ipage->vgot(n);
|
ipage->vgot(n);
|
||||||
if (ipage->status())
|
if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
|
||||||
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list->inum = inum;
|
list->inum = inum;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -35,8 +34,8 @@ NPairHalffullNewtoff::NPairHalffullNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
void NPairHalffullNewtoff::build(NeighList *list)
|
void NPairHalffullNewtoff::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i,j,ii,jj,n,jnum,joriginal;
|
int i, j, ii, jj, n, jnum, joriginal;
|
||||||
int *neighptr,*jlist;
|
int *neighptr, *jlist;
|
||||||
|
|
||||||
int *ilist = list->ilist;
|
int *ilist = list->ilist;
|
||||||
int *numneigh = list->numneigh;
|
int *numneigh = list->numneigh;
|
||||||
@ -74,8 +73,7 @@ void NPairHalffullNewtoff::build(NeighList *list)
|
|||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
ipage->vgot(n);
|
ipage->vgot(n);
|
||||||
if (ipage->status())
|
if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
|
||||||
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list->inum = inum;
|
list->inum = inum;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -32,8 +31,8 @@ NPairSkipSize::NPairSkipSize(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
void NPairSkipSize::build(NeighList *list)
|
void NPairSkipSize::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i,j,ii,jj,n,itype,jnum,joriginal;
|
int i, j, ii, jj, n, itype, jnum, joriginal;
|
||||||
int *neighptr,*jlist;
|
int *neighptr, *jlist;
|
||||||
|
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int *ilist = list->ilist;
|
int *ilist = list->ilist;
|
||||||
@ -80,8 +79,7 @@ void NPairSkipSize::build(NeighList *list)
|
|||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
ipage->vgot(n);
|
ipage->vgot(n);
|
||||||
if (ipage->status())
|
if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
|
||||||
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list->inum = inum;
|
list->inum = inum;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -26,12 +25,11 @@ NStencilFullBin2d::NStencilFullBin2d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilFullBin2d::create()
|
void NStencilFullBin2d::create()
|
||||||
{
|
{
|
||||||
int i,j;
|
int i, j;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,0) < cutneighmaxsq)
|
if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
|
||||||
stencil[nstencil++] = j*mbinx + i;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -26,13 +25,13 @@ NStencilFullBin3d::NStencilFullBin3d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilFullBin3d::create()
|
void NStencilFullBin3d::create()
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int i, j, k;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (k = -sz; k <= sz; k++)
|
for (k = -sz; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,k) < cutneighmaxsq)
|
if (bin_distance(i, j, k) < cutneighmaxsq)
|
||||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -29,16 +28,16 @@ NStencilFullGhostBin2d::NStencilFullGhostBin2d(LAMMPS *lmp) : NStencil(lmp)
|
|||||||
|
|
||||||
void NStencilFullGhostBin2d::create()
|
void NStencilFullGhostBin2d::create()
|
||||||
{
|
{
|
||||||
int i,j;
|
int i, j;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,0) < cutneighmaxsq) {
|
if (bin_distance(i, j, 0) < cutneighmaxsq) {
|
||||||
stencilxyz[nstencil][0] = i;
|
stencilxyz[nstencil][0] = i;
|
||||||
stencilxyz[nstencil][1] = j;
|
stencilxyz[nstencil][1] = j;
|
||||||
stencilxyz[nstencil][2] = 0;
|
stencilxyz[nstencil][2] = 0;
|
||||||
stencil[nstencil++] = j*mbinx + i;
|
stencil[nstencil++] = j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -29,17 +28,17 @@ NStencilFullGhostBin3d::NStencilFullGhostBin3d(LAMMPS *lmp) : NStencil(lmp)
|
|||||||
|
|
||||||
void NStencilFullGhostBin3d::create()
|
void NStencilFullGhostBin3d::create()
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int i, j, k;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (k = -sz; k <= sz; k++)
|
for (k = -sz; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,k) < cutneighmaxsq) {
|
if (bin_distance(i, j, k) < cutneighmaxsq) {
|
||||||
stencilxyz[nstencil][0] = i;
|
stencilxyz[nstencil][0] = i;
|
||||||
stencilxyz[nstencil][1] = j;
|
stencilxyz[nstencil][1] = j;
|
||||||
stencilxyz[nstencil][2] = k;
|
stencilxyz[nstencil][2] = k;
|
||||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -50,7 +49,6 @@ void NStencilFullMulti2d::create()
|
|||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
@ -72,8 +70,8 @@ void NStencilFullMulti2d::create()
|
|||||||
|
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
if (bin_distance_multi(i, j, 0, bin_collection) < cutsq)
|
||||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
stencil_multi[icollection][jcollection][ns++] = j * mbinx + i;
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -27,8 +26,8 @@ NStencilFullMultiOld2d::NStencilFullMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilFullMultiOld2d::create()
|
void NStencilFullMultiOld2d::create()
|
||||||
{
|
{
|
||||||
int i,j,n;
|
int i, j, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -40,10 +39,10 @@ void NStencilFullMultiOld2d::create()
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++) {
|
for (i = -sx; i <= sx; i++) {
|
||||||
rsq = bin_distance(i,j,0);
|
rsq = bin_distance(i, j, 0);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = j*mbinx + i;
|
s[n++] = j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -27,8 +26,8 @@ NStencilFullMultiOld3d::NStencilFullMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilFullMultiOld3d::create()
|
void NStencilFullMultiOld3d::create()
|
||||||
{
|
{
|
||||||
int i,j,k,n;
|
int i, j, k, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -41,10 +40,10 @@ void NStencilFullMultiOld3d::create()
|
|||||||
for (k = -sz; k <= sz; k++)
|
for (k = -sz; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++) {
|
for (i = -sx; i <= sx; i++) {
|
||||||
rsq = bin_distance(i,j,k);
|
rsq = bin_distance(i, j, k);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = k*mbiny*mbinx + j*mbinx + i;
|
s[n++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -26,13 +25,12 @@ NStencilHalfBin2d::NStencilHalfBin2d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfBin2d::create()
|
void NStencilHalfBin2d::create()
|
||||||
{
|
{
|
||||||
int i,j;
|
int i, j;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (j > 0 || (j == 0 && i > 0))
|
if (j > 0 || (j == 0 && i > 0))
|
||||||
if (bin_distance(i,j,0) < cutneighmaxsq)
|
if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
|
||||||
stencil[nstencil++] = j*mbinx + i;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -18,8 +17,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) :
|
NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -27,12 +25,11 @@ NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) :
|
|||||||
|
|
||||||
void NStencilHalfBin2dTri::create()
|
void NStencilHalfBin2dTri::create()
|
||||||
{
|
{
|
||||||
int i,j;
|
int i, j;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,0) < cutneighmaxsq)
|
if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
|
||||||
stencil[nstencil++] = j*mbinx + i;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -26,7 +25,7 @@ NStencilHalfBin3d::NStencilHalfBin3d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfBin3d::create()
|
void NStencilHalfBin3d::create()
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int i, j, k;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
@ -34,6 +33,6 @@ void NStencilHalfBin3d::create()
|
|||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (k > 0 || j > 0 || (j == 0 && i > 0))
|
if (k > 0 || j > 0 || (j == 0 && i > 0))
|
||||||
if (bin_distance(i,j,k) < cutneighmaxsq)
|
if (bin_distance(i, j, k) < cutneighmaxsq)
|
||||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -18,8 +17,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) :
|
NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -27,13 +25,13 @@ NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) :
|
|||||||
|
|
||||||
void NStencilHalfBin3dTri::create()
|
void NStencilHalfBin3dTri::create()
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int i, j, k;
|
||||||
|
|
||||||
nstencil = 0;
|
nstencil = 0;
|
||||||
|
|
||||||
for (k = 0; k <= sz; k++)
|
for (k = 0; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance(i,j,k) < cutneighmaxsq)
|
if (bin_distance(i, j, k) < cutneighmaxsq)
|
||||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfMultiOld2d::
|
NStencilHalfMultiOld2d::NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -28,8 +26,8 @@ NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfMultiOld2d::create()
|
void NStencilHalfMultiOld2d::create()
|
||||||
{
|
{
|
||||||
int i,j,n;
|
int i, j, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -42,10 +40,10 @@ void NStencilHalfMultiOld2d::create()
|
|||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (j > 0 || (j == 0 && i > 0)) {
|
if (j > 0 || (j == 0 && i > 0)) {
|
||||||
rsq = bin_distance(i,j,0);
|
rsq = bin_distance(i, j, 0);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = j*mbinx + i;
|
s[n++] = j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfMultiOld2dTri::
|
NStencilHalfMultiOld2dTri::NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -28,8 +26,8 @@ NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfMultiOld2dTri::create()
|
void NStencilHalfMultiOld2dTri::create()
|
||||||
{
|
{
|
||||||
int i,j,n;
|
int i, j, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -41,10 +39,10 @@ void NStencilHalfMultiOld2dTri::create()
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++) {
|
for (i = -sx; i <= sx; i++) {
|
||||||
rsq = bin_distance(i,j,0);
|
rsq = bin_distance(i, j, 0);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = j*mbinx + i;
|
s[n++] = j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfMultiOld3d::
|
NStencilHalfMultiOld3d::NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -28,8 +26,8 @@ NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfMultiOld3d::create()
|
void NStencilHalfMultiOld3d::create()
|
||||||
{
|
{
|
||||||
int i,j,k,n;
|
int i, j, k, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -43,10 +41,10 @@ void NStencilHalfMultiOld3d::create()
|
|||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
|
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
|
||||||
rsq = bin_distance(i,j,k);
|
rsq = bin_distance(i, j, k);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = k*mbiny*mbinx + j*mbinx + i;
|
s[n++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NStencilHalfMultiOld3dTri::
|
NStencilHalfMultiOld3dTri::NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
||||||
NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create stencil based on bin geometry and cutoff
|
create stencil based on bin geometry and cutoff
|
||||||
@ -28,8 +26,8 @@ NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {}
|
|||||||
|
|
||||||
void NStencilHalfMultiOld3dTri::create()
|
void NStencilHalfMultiOld3dTri::create()
|
||||||
{
|
{
|
||||||
int i,j,k,n;
|
int i, j, k, n;
|
||||||
double rsq,typesq;
|
double rsq, typesq;
|
||||||
int *s;
|
int *s;
|
||||||
double *distsq;
|
double *distsq;
|
||||||
|
|
||||||
@ -42,10 +40,10 @@ void NStencilHalfMultiOld3dTri::create()
|
|||||||
for (k = 0; k <= sz; k++)
|
for (k = 0; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++) {
|
for (i = -sx; i <= sx; i++) {
|
||||||
rsq = bin_distance(i,j,k);
|
rsq = bin_distance(i, j, k);
|
||||||
if (rsq < typesq) {
|
if (rsq < typesq) {
|
||||||
distsq[n] = rsq;
|
distsq[n] = rsq;
|
||||||
s[n++] = k*mbiny*mbinx + j*mbinx + i;
|
s[n++] = k * mbiny * mbinx + j * mbinx + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nstencil_multi_old[itype] = n;
|
nstencil_multi_old[itype] = n;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -15,14 +14,13 @@
|
|||||||
#include "ntopo_bond_all.h"
|
#include "ntopo_bond_all.h"
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "update.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "memory.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "thermo.h"
|
#include "thermo.h"
|
||||||
#include "memory.h"
|
#include "update.h"
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ NTopoBondAll::NTopoBondAll(LAMMPS *lmp) : NTopo(lmp)
|
|||||||
|
|
||||||
void NTopoBondAll::build()
|
void NTopoBondAll::build()
|
||||||
{
|
{
|
||||||
int i,m,atom1;
|
int i, m, atom1;
|
||||||
|
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
int *num_bond = atom->num_bond;
|
int *num_bond = atom->num_bond;
|
||||||
@ -58,16 +56,17 @@ void NTopoBondAll::build()
|
|||||||
if (atom1 == -1) {
|
if (atom1 == -1) {
|
||||||
nmissing++;
|
nmissing++;
|
||||||
if (lostbond == Thermo::ERROR)
|
if (lostbond == Thermo::ERROR)
|
||||||
error->one(FLERR,"Bond atoms {} {} missing on "
|
error->one(FLERR,
|
||||||
"proc {} at step {}",tag[i],
|
"Bond atoms {} {} missing on "
|
||||||
bond_atom[i][m],me,update->ntimestep);
|
"proc {} at step {}",
|
||||||
|
tag[i], bond_atom[i][m], me, update->ntimestep);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
atom1 = domain->closest_image(i,atom1);
|
atom1 = domain->closest_image(i, atom1);
|
||||||
if (newton_bond || i < atom1) {
|
if (newton_bond || i < atom1) {
|
||||||
if (nbondlist == maxbond) {
|
if (nbondlist == maxbond) {
|
||||||
maxbond += DELTA;
|
maxbond += DELTA;
|
||||||
memory->grow(bondlist,maxbond,3,"neigh_topo:bondlist");
|
memory->grow(bondlist, maxbond, 3, "neigh_topo:bondlist");
|
||||||
}
|
}
|
||||||
bondlist[nbondlist][0] = i;
|
bondlist[nbondlist][0] = i;
|
||||||
bondlist[nbondlist][1] = atom1;
|
bondlist[nbondlist][1] = atom1;
|
||||||
@ -80,7 +79,6 @@ void NTopoBondAll::build()
|
|||||||
if (lostbond == Thermo::IGNORE) return;
|
if (lostbond == Thermo::IGNORE) return;
|
||||||
|
|
||||||
int all;
|
int all;
|
||||||
MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world);
|
MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (all && (me == 0))
|
if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep);
|
||||||
error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -15,14 +14,13 @@
|
|||||||
#include "ntopo_bond_partial.h"
|
#include "ntopo_bond_partial.h"
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "update.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "memory.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "thermo.h"
|
#include "thermo.h"
|
||||||
#include "memory.h"
|
#include "update.h"
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ NTopoBondPartial::NTopoBondPartial(LAMMPS *lmp) : NTopo(lmp)
|
|||||||
|
|
||||||
void NTopoBondPartial::build()
|
void NTopoBondPartial::build()
|
||||||
{
|
{
|
||||||
int i,m,atom1;
|
int i, m, atom1;
|
||||||
|
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
int *num_bond = atom->num_bond;
|
int *num_bond = atom->num_bond;
|
||||||
@ -59,16 +57,17 @@ void NTopoBondPartial::build()
|
|||||||
if (atom1 == -1) {
|
if (atom1 == -1) {
|
||||||
nmissing++;
|
nmissing++;
|
||||||
if (lostbond == Thermo::ERROR)
|
if (lostbond == Thermo::ERROR)
|
||||||
error->one(FLERR,"Bond atoms {} {} missing on "
|
error->one(FLERR,
|
||||||
"proc {} at step {}",tag[i],
|
"Bond atoms {} {} missing on "
|
||||||
bond_atom[i][m],me,update->ntimestep);
|
"proc {} at step {}",
|
||||||
|
tag[i], bond_atom[i][m], me, update->ntimestep);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
atom1 = domain->closest_image(i,atom1);
|
atom1 = domain->closest_image(i, atom1);
|
||||||
if (newton_bond || i < atom1) {
|
if (newton_bond || i < atom1) {
|
||||||
if (nbondlist == maxbond) {
|
if (nbondlist == maxbond) {
|
||||||
maxbond += DELTA;
|
maxbond += DELTA;
|
||||||
memory->grow(bondlist,maxbond,3,"neigh_topo:bondlist");
|
memory->grow(bondlist, maxbond, 3, "neigh_topo:bondlist");
|
||||||
}
|
}
|
||||||
bondlist[nbondlist][0] = i;
|
bondlist[nbondlist][0] = i;
|
||||||
bondlist[nbondlist][1] = atom1;
|
bondlist[nbondlist][1] = atom1;
|
||||||
@ -81,7 +80,6 @@ void NTopoBondPartial::build()
|
|||||||
if (lostbond == Thermo::IGNORE) return;
|
if (lostbond == Thermo::IGNORE) return;
|
||||||
|
|
||||||
int all;
|
int all;
|
||||||
MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world);
|
MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (all && (me == 0))
|
if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep);
|
||||||
error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -41,19 +40,19 @@ void Reader::open_file(const std::string &file)
|
|||||||
if (platform::has_compress_extension(file)) {
|
if (platform::has_compress_extension(file)) {
|
||||||
compressed = true;
|
compressed = true;
|
||||||
fp = platform::compressed_read(file);
|
fp = platform::compressed_read(file);
|
||||||
if (!fp) error->one(FLERR,"Cannot open compressed file for reading");
|
if (!fp) error->one(FLERR, "Cannot open compressed file for reading");
|
||||||
} else {
|
} else {
|
||||||
compressed = false;
|
compressed = false;
|
||||||
if (utils::strmatch(file, "\\.bin$")) {
|
if (utils::strmatch(file, "\\.bin$")) {
|
||||||
binary = true;
|
binary = true;
|
||||||
fp = fopen(file.c_str(),"rb");
|
fp = fopen(file.c_str(), "rb");
|
||||||
} else {
|
} else {
|
||||||
fp = fopen(file.c_str(),"r");
|
fp = fopen(file.c_str(), "r");
|
||||||
binary = false;
|
binary = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fp) error->one(FLERR,"Cannot open file {}: {}", file, utils::getsyserror());
|
if (!fp) error->one(FLERR, "Cannot open file {}: {}", file, utils::getsyserror());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -64,8 +63,10 @@ void Reader::open_file(const std::string &file)
|
|||||||
void Reader::close_file()
|
void Reader::close_file()
|
||||||
{
|
{
|
||||||
if (fp == nullptr) return;
|
if (fp == nullptr) return;
|
||||||
if (compressed) platform::pclose(fp);
|
if (compressed)
|
||||||
else fclose(fp);
|
platform::pclose(fp);
|
||||||
|
else
|
||||||
|
fclose(fp);
|
||||||
fp = nullptr;
|
fp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +74,7 @@ void Reader::close_file()
|
|||||||
detect unused arguments
|
detect unused arguments
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Reader::settings(int narg, char** /*args*/)
|
void Reader::settings(int narg, char ** /*args*/)
|
||||||
{
|
{
|
||||||
if (narg > 0)
|
if (narg > 0) error->all(FLERR, "Illegal read_dump command");
|
||||||
error->all(FLERR,"Illegal read_dump command");
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -34,41 +33,39 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
void WriteDump::command(int narg, char **arg)
|
void WriteDump::command(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Illegal write_dump command");
|
if (narg < 3) error->all(FLERR, "Illegal write_dump command");
|
||||||
|
|
||||||
// modindex = index in args of "modify" keyword
|
// modindex = index in args of "modify" keyword
|
||||||
// will be narg if "modify" is not present
|
// will be narg if "modify" is not present
|
||||||
|
|
||||||
int modindex;
|
int modindex;
|
||||||
for (modindex = 0; modindex < narg; modindex++)
|
for (modindex = 0; modindex < narg; modindex++)
|
||||||
if (strcmp(arg[modindex],"modify") == 0) break;
|
if (strcmp(arg[modindex], "modify") == 0) break;
|
||||||
|
|
||||||
// create the Dump instance
|
// create the Dump instance
|
||||||
// create dump command line with extra required args
|
// create dump command line with extra required args
|
||||||
|
|
||||||
auto dumpargs = new char*[modindex+2];
|
auto dumpargs = new char *[modindex + 2];
|
||||||
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
|
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
|
||||||
dumpargs[1] = arg[0]; // group
|
dumpargs[1] = arg[0]; // group
|
||||||
dumpargs[2] = arg[1]; // dump style
|
dumpargs[2] = arg[1]; // dump style
|
||||||
std::string ntimestep = std::to_string(MAX(update->ntimestep,1));
|
std::string ntimestep = std::to_string(MAX(update->ntimestep, 1));
|
||||||
dumpargs[3] = (char *) ntimestep.c_str(); // dump frequency
|
dumpargs[3] = (char *) ntimestep.c_str(); // dump frequency
|
||||||
|
|
||||||
for (int i = 2; i < modindex; ++i) dumpargs[i+2] = arg[i];
|
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];
|
||||||
|
|
||||||
Dump *dump = output->add_dump(modindex+2, dumpargs);
|
Dump *dump = output->add_dump(modindex + 2, dumpargs);
|
||||||
if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]);
|
if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]);
|
||||||
|
|
||||||
// write out one frame and then delete the dump again
|
// write out one frame and then delete the dump again
|
||||||
// set multifile_override for DumpImage so that filename needs no "*"
|
// set multifile_override for DumpImage so that filename needs no "*"
|
||||||
|
|
||||||
if (strcmp(arg[1],"image") == 0)
|
if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
|
||||||
(dynamic_cast<DumpImage *>( dump))->multifile_override = 1;
|
|
||||||
|
|
||||||
if (strcmp(arg[1],"cfg") == 0)
|
if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
|
||||||
(dynamic_cast<DumpCFG *>( dump))->multifile_override = 1;
|
|
||||||
|
|
||||||
if ((update->first_update == 0) && (comm->me == 0))
|
if ((update->first_update == 0) && (comm->me == 0))
|
||||||
error->warning(FLERR,"Calling write_dump before a full system init.");
|
error->warning(FLERR, "Calling write_dump before a full system init.");
|
||||||
|
|
||||||
dump->init();
|
dump->init();
|
||||||
dump->write();
|
dump->write();
|
||||||
|
|||||||
Reference in New Issue
Block a user