change neb/spin class names to better match the conventions used in the rest of LAMMPS

This commit is contained in:
Axel Kohlmeyer 2019-04-27 13:16:37 -04:00
parent 6fc2bda01c
commit 930748f6f2
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
4 changed files with 82 additions and 82 deletions

View File

@ -49,7 +49,7 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC};
/* ---------------------------------------------------------------------- */
FixNEB_spin::FixNEB_spin(LAMMPS *lmp, int narg, char **arg) :
FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL),
xnext(NULL), fnext(NULL), spprev(NULL), spnext(NULL), fmnext(NULL), springF(NULL),
tangent(NULL), xsend(NULL), xrecv(NULL), fsend(NULL), frecv(NULL), spsend(NULL),
@ -144,7 +144,7 @@ FixNEB_spin::FixNEB_spin(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */
FixNEB_spin::~FixNEB_spin()
FixNEBSpin::~FixNEBSpin()
{
modify->delete_compute(id_pe);
delete [] id_pe;
@ -192,7 +192,7 @@ FixNEB_spin::~FixNEB_spin()
/* ---------------------------------------------------------------------- */
int FixNEB_spin::setmask()
int FixNEBSpin::setmask()
{
int mask = 0;
mask |= MIN_POST_FORCE;
@ -201,7 +201,7 @@ int FixNEB_spin::setmask()
/* ---------------------------------------------------------------------- */
void FixNEB_spin::init()
void FixNEBSpin::init()
{
int icompute = modify->find_compute(id_pe);
if (icompute < 0)
@ -251,7 +251,7 @@ void FixNEB_spin::init()
/* ---------------------------------------------------------------------- */
void FixNEB_spin::min_setup(int vflag)
void FixNEBSpin::min_setup(int vflag)
{
min_post_force(vflag);
@ -262,7 +262,7 @@ void FixNEB_spin::min_setup(int vflag)
/* ---------------------------------------------------------------------- */
void FixNEB_spin::min_post_force(int /*vflag*/)
void FixNEBSpin::min_post_force(int /*vflag*/)
{
double vprev,vnext;
double delspxp,delspyp,delspzp;
@ -289,15 +289,15 @@ void FixNEB_spin::min_post_force(int /*vflag*/)
}
if (FreeEndFinal && ireplica == nreplica-1 && (update->ntimestep == 0))
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
if (ireplica == 0) vIni=veng;
if (FreeEndFinalWithRespToEIni)
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
if (FreeEndIni && ireplica == 0 && (update->ntimestep == 0))
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
// communicate atoms to/from adjacent replicas to fill xprev,xnext
@ -505,7 +505,7 @@ void FixNEB_spin::min_post_force(int /*vflag*/)
// no Perpendicular nudging force option active yet
if (kspringPerp != 0.0)
error->all(FLERR,"NEB_spin Perpendicular spring force not yet active");
error->all(FLERR,"NEBSpin Perpendicular spring force not yet active");
}
}
@ -569,16 +569,16 @@ void FixNEB_spin::min_post_force(int /*vflag*/)
// no Free End options active yet
if (FreeEndIni && ireplica == 0)
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
if (FreeEndFinal && ireplica == nreplica -1)
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
if (FreeEndFinalWithRespToEIni&&ireplica == nreplica -1)
error->all(FLERR,"NEB_spin Free End option not yet active");
error->all(FLERR,"NEBSpin Free End option not yet active");
// no NEB_spin long range option
// no NEBSpin long range option
if (NEBLongRange)
error->all(FLERR,"NEB_spin long range option not yet active");
error->all(FLERR,"NEBSpin long range option not yet active");
// exit calc. if first or last replica (no gneb force)
@ -604,7 +604,7 @@ void FixNEB_spin::min_post_force(int /*vflag*/)
if (ireplica == rclimber) prefactor = -2.0*dot; // for climbing replica
else {
if (NEBLongRange) {
error->all(FLERR,"Long Range NEB_spin climber option not yet active");
error->all(FLERR,"Long Range NEBSpin climber option not yet active");
} else if (StandardNEB) {
prefactor = -dot + kspring*(nlen-plen);
}
@ -645,7 +645,7 @@ void FixNEB_spin::min_post_force(int /*vflag*/)
geodesic distance calculation (Vincenty's formula)
------------------------------------------------------------------------- */
double FixNEB_spin::geodesic_distance(double spi[3], double spj[3])
double FixNEBSpin::geodesic_distance(double spi[3], double spj[3])
{
double dist;
double crossx,crossy,crossz;
@ -676,7 +676,7 @@ double FixNEB_spin::geodesic_distance(double spi[3], double spj[3])
replicas 0 and N-1 send but do not receive any atoms
------------------------------------------------------------------------- */
void FixNEB_spin::inter_replica_comm()
void FixNEBSpin::inter_replica_comm()
{
int i,m;
MPI_Request request;
@ -956,7 +956,7 @@ void FixNEB_spin::inter_replica_comm()
reallocate communication arrays if necessary
------------------------------------------------------------------------- */
void FixNEB_spin::reallocate()
void FixNEBSpin::reallocate()
{
maxlocal = atom->nmax;

View File

@ -13,7 +13,7 @@
#ifdef FIX_CLASS
FixStyle(neb/spin,FixNEB_spin)
FixStyle(neb/spin,FixNEBSpin)
#else
@ -24,13 +24,13 @@ FixStyle(neb/spin,FixNEB_spin)
namespace LAMMPS_NS {
class FixNEB_spin : public Fix {
class FixNEBSpin : public Fix {
public:
double veng,plen,nlen,dotpath,dottangrad,gradlen,dotgrad;
int rclimber;
FixNEB_spin(class LAMMPS *, int, char **);
~FixNEB_spin();
FixNEBSpin(class LAMMPS *, int, char **);
~FixNEBSpin();
int setmask();
void init();
void min_setup(int);

View File

@ -76,15 +76,15 @@ static const char cite_neb_spin[] =
/* ---------------------------------------------------------------------- */
NEB_spin::NEB_spin(LAMMPS *lmp) : Pointers(lmp) {
NEBSpin::NEBSpin(LAMMPS *lmp) : Pointers(lmp) {
if (lmp->citeme) lmp->citeme->add(cite_neb_spin);
}
/* ----------------------------------------------------------------------
internal NEB_spin constructor, called from TAD
internal NEBSpin constructor, called from TAD
------------------------------------------------------------------------- */
NEB_spin::NEB_spin(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in,
NEBSpin::NEBSpin(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in,
int n2steps_in, int nevery_in, double *buf_init, double *buf_final)
: Pointers(lmp)
{
@ -155,7 +155,7 @@ NEB_spin::NEB_spin(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in,
/* ---------------------------------------------------------------------- */
NEB_spin::~NEB_spin()
NEBSpin::~NEBSpin()
{
MPI_Comm_free(&roots);
memory->destroy(all);
@ -163,15 +163,15 @@ NEB_spin::~NEB_spin()
}
/* ----------------------------------------------------------------------
perform NEB_spin on multiple replicas
perform NEBSpin on multiple replicas
------------------------------------------------------------------------- */
void NEB_spin::command(int narg, char **arg)
void NEBSpin::command(int narg, char **arg)
{
if (domain->box_exist == 0)
error->all(FLERR,"NEB_spin command before simulation box is defined");
error->all(FLERR,"NEBSpin command before simulation box is defined");
if (narg < 6) error->universe_all(FLERR,"Illegal NEB_spin command");
if (narg < 6) error->universe_all(FLERR,"Illegal NEBSpin command");
etol = force->numeric(FLERR,arg[0]);
ttol = force->numeric(FLERR,arg[1]);
@ -181,11 +181,11 @@ void NEB_spin::command(int narg, char **arg)
// error checks
if (etol < 0.0) error->all(FLERR,"Illegal NEB_spin command");
if (ttol < 0.0) error->all(FLERR,"Illegal NEB_spin command");
if (nevery <= 0) error->universe_all(FLERR,"Illegal NEB_spin command");
if (etol < 0.0) error->all(FLERR,"Illegal NEBSpin command");
if (ttol < 0.0) error->all(FLERR,"Illegal NEBSpin command");
if (nevery <= 0) error->universe_all(FLERR,"Illegal NEBSpin command");
if (n1steps % nevery || n2steps % nevery)
error->universe_all(FLERR,"Illegal NEB_spin command");
error->universe_all(FLERR,"Illegal NEBSpin command");
// replica info
@ -204,23 +204,23 @@ void NEB_spin::command(int narg, char **arg)
// error checks
if (nreplica == 1) error->all(FLERR,"Cannot use NEB_spin with a single replica");
if (nreplica == 1) error->all(FLERR,"Cannot use NEBSpin with a single replica");
if (atom->map_style == 0)
error->all(FLERR,"Cannot use NEB_spin unless atom map exists");
error->all(FLERR,"Cannot use NEBSpin unless atom map exists");
// process file-style setting to setup initial configs for all replicas
if (strcmp(arg[5],"final") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB_spin command");
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
infile = arg[6];
readfile(infile,0);
} else if (strcmp(arg[5],"each") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB_spin command");
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
infile = arg[6];
readfile(infile,1);
} else if (strcmp(arg[5],"none") == 0) {
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEB_spin command");
} else error->universe_all(FLERR,"Illegal NEB_spin command");
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEBSpin command");
} else error->universe_all(FLERR,"Illegal NEBSpin command");
verbose=false;
if (strcmp(arg[narg-1],"verbose") == 0) verbose=true;
@ -229,10 +229,10 @@ void NEB_spin::command(int narg, char **arg)
}
/* ----------------------------------------------------------------------
run NEB_spin on multiple replicas
run NEBSpin on multiple replicas
------------------------------------------------------------------------- */
void NEB_spin::run()
void NEBSpin::run()
{
// create MPI communicator for root proc from each world
@ -246,9 +246,9 @@ void NEB_spin::run()
int ineb;
for (ineb = 0; ineb < modify->nfix; ineb++)
if (strcmp(modify->fix[ineb]->style,"neb/spin") == 0) break;
if (ineb == modify->nfix) error->all(FLERR,"NEB_spin requires use of fix neb/spin");
if (ineb == modify->nfix) error->all(FLERR,"NEBSpin requires use of fix neb/spin");
fneb = (FixNEB_spin *) modify->fix[ineb];
fneb = (FixNEBSpin *) modify->fix[ineb];
if (verbose) numall =7;
else numall = 4;
memory->create(all,nreplica,numall,"neb:all");
@ -266,24 +266,24 @@ void NEB_spin::run()
// check if correct minimizer is setup
if (update->minimize->searchflag)
error->all(FLERR,"NEB_spin requires damped dynamics minimizer");
error->all(FLERR,"NEBSpin requires damped dynamics minimizer");
if (strcmp(update->minimize_style,"spin") != 0)
error->all(FLERR,"NEB_spin requires spin minimizer");
error->all(FLERR,"NEBSpin requires spin minimizer");
// setup regular NEB_spin minimization
// setup regular NEBSpin minimization
FILE *uscreen = universe->uscreen;
FILE *ulogfile = universe->ulogfile;
if (me_universe == 0 && uscreen)
fprintf(uscreen,"Setting up regular NEB_spin ...\n");
fprintf(uscreen,"Setting up regular NEBSpin ...\n");
update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + n1steps;
update->nsteps = n1steps;
update->max_eval = n1steps;
if (update->laststep < 0)
error->all(FLERR,"Too many timesteps for NEB_spin");
error->all(FLERR,"Too many timesteps for NEBSpin");
update->minimize->setup();
@ -316,8 +316,8 @@ void NEB_spin::run()
}
print_status();
// perform regular NEB_spin for n1steps or until replicas converge
// retrieve PE values from fix NEB_spin and print every nevery iterations
// perform regular NEBSpin for n1steps or until replicas converge
// retrieve PE values from fix NEBSpin and print every nevery iterations
// break out of while loop early if converged
// damped dynamic min styles insure all replicas converge together
@ -337,7 +337,7 @@ void NEB_spin::run()
Finish finish(lmp);
finish.end(1);
// switch fix NEB_spin to climbing mode
// switch fix NEBSpin to climbing mode
// top = replica that becomes hill climber
double vmax = all[0][0];
@ -348,7 +348,7 @@ void NEB_spin::run()
top = m;
}
// setup climbing NEB_spin minimization
// setup climbing NEBSpin minimization
// must reinitialize minimizer so it re-creates its fix MINIMIZE
if (me_universe == 0 && uscreen)
@ -402,8 +402,8 @@ void NEB_spin::run()
}
print_status();
// perform climbing NEB_spin for n2steps or until replicas converge
// retrieve PE values from fix NEB_spin and print every nevery iterations
// perform climbing NEBSpin for n2steps or until replicas converge
// retrieve PE values from fix NEBSpin and print every nevery iterations
// break induced if converged
// damped dynamic min styles insure all replicas converge together
@ -443,7 +443,7 @@ void NEB_spin::run()
initial replica does nothing
------------------------------------------------------------------------- */
void NEB_spin::readfile(char *file, int flag)
void NEBSpin::readfile(char *file, int flag)
{
int i,j,m,nchunk,eofflag,nlines;
tagint tag;
@ -453,7 +453,7 @@ void NEB_spin::readfile(char *file, int flag)
double musp,spx,spy,spz;
if (me_universe == 0 && screen)
fprintf(screen,"Reading NEB_spin coordinate file(s) ...\n");
fprintf(screen,"Reading NEBSpin coordinate file(s) ...\n");
// flag = 0, universe root reads header of file, bcast to universe
// flag = 1, each replica's root reads header of file, bcast to world
@ -645,7 +645,7 @@ void NEB_spin::readfile(char *file, int flag)
interpolates between initial (spi) and final (stored in sploc)
------------------------------------------------------------------------- */
int NEB_spin::initial_rotation(double *spi, double *sploc, double fraction)
int NEBSpin::initial_rotation(double *spi, double *sploc, double fraction)
{
// no interpolation for initial and final replica
@ -757,11 +757,11 @@ int NEB_spin::initial_rotation(double *spi, double *sploc, double fraction)
}
/* ----------------------------------------------------------------------
universe proc 0 opens NEB_spin data file
universe proc 0 opens NEBSpin data file
test if gzipped
------------------------------------------------------------------------- */
void NEB_spin::open(char *file)
void NEBSpin::open(char *file)
{
compressed = 0;
char *suffix = file + strlen(file) - 3;
@ -791,11 +791,11 @@ void NEB_spin::open(char *file)
}
/* ----------------------------------------------------------------------
query fix NEB_spin for info on each replica
universe proc 0 prints current NEB_spin status
query fix NEBSpin for info on each replica
universe proc 0 prints current NEBSpin status
------------------------------------------------------------------------- */
void NEB_spin::print_status()
void NEBSpin::print_status()
{
int nlocal = atom->nlocal;
double tx,ty,tz;

View File

@ -13,7 +13,7 @@
#ifdef COMMAND_CLASS
CommandStyle(neb/spin,NEB_spin)
CommandStyle(neb/spin,NEBSpin)
#else
@ -25,13 +25,13 @@ CommandStyle(neb/spin,NEB_spin)
namespace LAMMPS_NS {
class NEB_spin : protected Pointers {
class NEBSpin : protected Pointers {
public:
NEB_spin(class LAMMPS *);
NEB_spin(class LAMMPS *, double, double, int, int, int, double *, double *);
~NEB_spin();
NEBSpin(class LAMMPS *);
NEBSpin(class LAMMPS *, double, double, int, int, int, double *, double *);
~NEBSpin();
void command(int, char **); // process neb/spin command
void run(); // run NEB_spin
void run(); // run NEBSpin
double ebf,ebr; // forward and reverse energy barriers
@ -49,7 +49,7 @@ class NEB_spin : protected Pointers {
int nevery; // output interval
char *infile; // name of file containing final state
class FixNEB_spin *fneb;
class FixNEBSpin *fneb;
int numall; // per-replica dimension of array all
double **all; // PE,plen,nlen,gradvnorm from each replica
double *rdist; // normalize reaction distance, 0 to 1
@ -69,7 +69,7 @@ class NEB_spin : protected Pointers {
/* ERROR/WARNING messages:
E: NEB_spin command before simulation box is defined
E: NEBSpin command before simulation box is defined
Self-explanatory.
@ -79,26 +79,26 @@ Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Cannot use NEB_spin with a single replica
E: Cannot use NEBSpin with a single replica
Self-explanatory.
E: Cannot use NEB_spin unless atom map exists
E: Cannot use NEBSpin unless atom map exists
Use the atom_modify command to create an atom map.
E: NEB_spin requires use of fix neb
E: NEBSpin requires use of fix neb
Self-explanatory.
E: NEB_spin requires damped dynamics minimizer
E: NEBSpin requires damped dynamics minimizer
Use a different minimization style.
E: Too many timesteps for NEB_spin
E: Too many timesteps for NEBSpin
You must use a number of timesteps that fit in a 32-bit integer
for NEB_spin.
for NEBSpin.
E: Too many timesteps
@ -127,12 +127,12 @@ The specified file cannot be opened. Check that the path and name are
correct. If the file is a compressed file, also check that the gzip
executable can be found and run.
U: Can only use NEB_spin with 1-processor replicas
U: Can only use NEBSpin with 1-processor replicas
This is current restriction for NEB_spin as implemented in LAMMPS.
This is current restriction for NEBSpin as implemented in LAMMPS.
U: Cannot use NEB_spin with atom_modify sort enabled
U: Cannot use NEBSpin with atom_modify sort enabled
This is current restriction for NEB_spin implemented in LAMMPS.
This is current restriction for NEBSpin implemented in LAMMPS.
*/