Add apip suffix in pair_styles lambda/input and lambda/input/csp.

This commit is contained in:
David Immel
2025-06-05 15:38:38 +02:00
parent 4fcbdbe3a1
commit 19a108bd21
8 changed files with 46 additions and 46 deletions

8
src/.gitignore vendored
View File

@ -115,10 +115,10 @@
/fix_lambda_apip.h /fix_lambda_apip.h
/fix_lambda_thermostat_apip.cpp /fix_lambda_thermostat_apip.cpp
/fix_lambda_thermostat_apip.h /fix_lambda_thermostat_apip.h
/pair_lambda_input.cpp /pair_lambda_input_apip.cpp
/pair_lambda_input.h /pair_lambda_input_apip.h
/pair_lambda_input_csp.cpp /pair_lambda_input_csp_apip.cpp
/pair_lambda_input_csp.h /pair_lambda_input_csp_apip.h
/pair_eam_fs_apip.cpp /pair_eam_fs_apip.cpp
/pair_eam_fs_apip.h /pair_eam_fs_apip.h
/pair_eam_apip.cpp /pair_eam_apip.cpp

View File

@ -77,15 +77,15 @@ FixAtomWeightAPIP::FixAtomWeightAPIP(LAMMPS *lmp, int narg, char **arg) :
avg_time_atom[1] = time_complex_atom; avg_time_atom[1] = time_complex_atom;
} }
if (strcmp(arg[6], "lambda_input") == 0) { if (strcmp(arg[6], "lambda/input") == 0) {
time_group_extract_name = utils::strdup("lambda_input:time_per_atom"); time_group_extract_name = utils::strdup("lambda/input/apip:time_per_atom");
} else { } else {
time_group_atom = utils::numeric(FLERR, arg[6], false, lmp); time_group_atom = utils::numeric(FLERR, arg[6], false, lmp);
avg_time_atom[2] = time_group_atom; avg_time_atom[2] = time_group_atom;
} }
if (strcmp(arg[7], "lambda/zone") == 0) { if (strcmp(arg[7], "lambda/zone") == 0) {
time_lambda_extract_name = utils::strdup("lambda_zone:time_per_atom"); time_lambda_extract_name = utils::strdup("lambda/zone/apip:time_per_atom");
} else { } else {
time_lambda_atom = utils::numeric(FLERR, arg[7], false, lmp); time_lambda_atom = utils::numeric(FLERR, arg[7], false, lmp);
avg_time_atom[3] = time_lambda_atom; avg_time_atom[3] = time_lambda_atom;

View File

@ -249,9 +249,9 @@ void FixLambdaAPIP::init()
Pair *pair_tmp; Pair *pair_tmp;
// lambda_input // lambda_input
pair_tmp = force->pair_match("lambda_input/", 0); pair_tmp = force->pair_match("lambda/input/", 0);
if (!pair_tmp) error->all(FLERR, "fix lambda requires a `pair lambda_input`"); if (!pair_tmp) error->all(FLERR, "fix lambda requires a `pair lambda_input`");
pair_lambda_input = (PairLambdaInput *) pair_tmp; pair_lambda_input = (PairLambdaInputAPIP *) pair_tmp;
// lambda/zone // lambda/zone
pair_tmp = force->pair_match("lambda/zone/apip", 1); pair_tmp = force->pair_match("lambda/zone/apip", 1);
if (!pair_tmp) error->all(FLERR, "fix lambda requires a `pair lambda`"); if (!pair_tmp) error->all(FLERR, "fix lambda requires a `pair lambda`");

View File

@ -24,13 +24,13 @@ FixStyle(lambda/apip,FixLambdaAPIP);
#define LMP_FIX_LAMBDA_APIP_H #define LMP_FIX_LAMBDA_APIP_H
#include "fix.h" #include "fix.h"
#include "pair_lambda_input.h" #include "pair_lambda_input_apip.h"
#include "pair_lambda_zone_apip.h" #include "pair_lambda_zone_apip.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class FixLambdaAPIP : public Fix { class FixLambdaAPIP : public Fix {
friend class PairLambdaInput; friend class PairLambdaInputAPIP;
friend class PairLambdaZoneAPIP; friend class PairLambdaZoneAPIP;
public: public:
@ -53,7 +53,7 @@ class FixLambdaAPIP : public Fix {
enum { FORWARD_MAX, FORWARD_TA }; enum { FORWARD_MAX, FORWARD_TA };
int comm_forward_flag; // flag that determines which variables are communicated in comm forward int comm_forward_flag; // flag that determines which variables are communicated in comm forward
class PairLambdaInput *pair_lambda_input; class PairLambdaInputAPIP *pair_lambda_input;
class PairLambdaZoneAPIP *pair_lambda_zone; class PairLambdaZoneAPIP *pair_lambda_zone;
double cut_lo; ///< distance at which the cutoff function of the transition zone decays from 1 double cut_lo; ///< distance at which the cutoff function of the transition zone decays from 1

View File

@ -14,7 +14,7 @@
Contributing author: David Immel (d.immel@fz-juelich.de, FZJ, Germany) Contributing author: David Immel (d.immel@fz-juelich.de, FZJ, Germany)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_lambda_input.h" #include "pair_lambda_input_apip.h"
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
@ -30,7 +30,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaInput::PairLambdaInput(LAMMPS *lmp) : Pair(lmp), fix_lambda(nullptr), cut(nullptr) PairLambdaInputAPIP::PairLambdaInputAPIP(LAMMPS *lmp) : Pair(lmp), fix_lambda(nullptr), cut(nullptr)
{ {
cut_global = -1; cut_global = -1;
@ -42,7 +42,7 @@ PairLambdaInput::PairLambdaInput(LAMMPS *lmp) : Pair(lmp), fix_lambda(nullptr),
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaInput::~PairLambdaInput() PairLambdaInputAPIP::~PairLambdaInputAPIP()
{ {
if (copymode) return; if (copymode) return;
@ -55,7 +55,7 @@ PairLambdaInput::~PairLambdaInput()
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairLambdaInput::coeff(int narg, char **arg) void PairLambdaInputAPIP::coeff(int narg, char **arg)
{ {
if (narg != 2) error->all(FLERR, "Incorrect args for pair coefficients"); if (narg != 2) error->all(FLERR, "Incorrect args for pair coefficients");
if (!allocated) allocate(); if (!allocated) allocate();
@ -80,7 +80,7 @@ void PairLambdaInput::coeff(int narg, char **arg)
allocate all arrays allocate all arrays
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInput::allocate() void PairLambdaInputAPIP::allocate()
{ {
allocated = 1; allocated = 1;
int n = atom->ntypes + 1; int n = atom->ntypes + 1;
@ -95,7 +95,7 @@ void PairLambdaInput::allocate()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairLambdaInput::compute(int eflag, int vflag) void PairLambdaInputAPIP::compute(int eflag, int vflag)
{ {
// basic stuff (see pair_zero) // basic stuff (see pair_zero)
ev_init(eflag, vflag); ev_init(eflag, vflag);
@ -114,7 +114,7 @@ void PairLambdaInput::compute(int eflag, int vflag)
global settings global settings
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInput::settings(int narg, char **arg) void PairLambdaInputAPIP::settings(int narg, char **arg)
{ {
if (narg < 1) utils::missing_cmd_args(FLERR, "pair_style lambda_input", error); if (narg < 1) utils::missing_cmd_args(FLERR, "pair_style lambda_input", error);
@ -133,7 +133,7 @@ void PairLambdaInput::settings(int narg, char **arg)
init specific to this pair style init specific to this pair style
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInput::init_style() void PairLambdaInputAPIP::init_style()
{ {
if (!atom->apip_lambda_input_flag) if (!atom->apip_lambda_input_flag)
error->all(FLERR, "pair_lambda input requires an atom style with lambda_input"); error->all(FLERR, "pair_lambda input requires an atom style with lambda_input");
@ -158,7 +158,7 @@ void PairLambdaInput::init_style()
init for one type pair i,j and corresponding j,i init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double PairLambdaInput::init_one(int i, int j) double PairLambdaInputAPIP::init_one(int i, int j)
{ {
if (setflag[i][j] == 0) { cut[i][j] = mix_distance(cut[i][i], cut[j][j]); } if (setflag[i][j] == 0) { cut[i][j] = mix_distance(cut[i][i], cut[j][j]); }
return cut[i][j]; return cut[i][j];
@ -170,7 +170,7 @@ double PairLambdaInput::init_one(int i, int j)
* fix atom_weight/apip. * fix atom_weight/apip.
*/ */
int PairLambdaInput::calculate_lambda_input() int PairLambdaInputAPIP::calculate_lambda_input()
{ {
int i, ii, inum; int i, ii, inum;
int *ilist; int *ilist;
@ -193,7 +193,7 @@ int PairLambdaInput::calculate_lambda_input()
set return values for timers and counted particles set return values for timers and counted particles
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInput::calculate_time_per_atom() void PairLambdaInputAPIP::calculate_time_per_atom()
{ {
if (n_calculations > 0) if (n_calculations > 0)
time_per_atom = timer / n_calculations; time_per_atom = timer / n_calculations;
@ -207,10 +207,10 @@ void PairLambdaInput::calculate_time_per_atom()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void *PairLambdaInput::extract(const char *str, int &dim) void *PairLambdaInputAPIP::extract(const char *str, int &dim)
{ {
dim = 0; dim = 0;
if (strcmp(str, "lambda_input:time_per_atom") == 0) { if (strcmp(str, "lambda_input/apip:time_per_atom") == 0) {
calculate_time_per_atom(); calculate_time_per_atom();
return (void *) &time_per_atom; return (void *) &time_per_atom;
} }

View File

@ -16,24 +16,24 @@
#ifdef PAIR_CLASS #ifdef PAIR_CLASS
// clang-format off // clang-format off
PairStyle(lambda_input,PairLambdaInput); PairStyle(lambda/input/apip,PairLambdaInputAPIP);
// clang-format on // clang-format on
#else #else
#ifndef LMP_PAIR_LAMBDA_INPUT_H #ifndef LMP_PAIR_LAMBDA_INPUT_APIP_H
#define LMP_PAIR_LAMBDA_INPUT_H #define LMP_PAIR_LAMBDA_INPUT_APIP_H
#include "fix_lambda_apip.h" #include "fix_lambda_apip.h"
#include "pair.h" #include "pair.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class PairLambdaInput : public Pair { class PairLambdaInputAPIP : public Pair {
friend class FixLambdaAPIP; friend class FixLambdaAPIP;
public: public:
PairLambdaInput(class LAMMPS *); PairLambdaInputAPIP(class LAMMPS *);
~PairLambdaInput() override; ~PairLambdaInputAPIP() override;
void compute(int, int) override; void compute(int, int) override;
virtual void settings(int, char **) override; virtual void settings(int, char **) override;
void coeff(int, char **) override; void coeff(int, char **) override;

View File

@ -14,7 +14,7 @@
Contributing author: David Immel (d.immel@fz-juelich.de, FZJ, Germany) Contributing author: David Immel (d.immel@fz-juelich.de, FZJ, Germany)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_lambda_input_csp.h" #include "pair_lambda_input_csp_apip.h"
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
@ -25,8 +25,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaInputCsp::PairLambdaInputCsp(LAMMPS *lmp) : PairLambdaInputCSPAPIP::PairLambdaInputCSPAPIP(LAMMPS *lmp) :
PairLambdaInput(lmp), distsq(nullptr), nearest(nullptr) PairLambdaInputAPIP(lmp), distsq(nullptr), nearest(nullptr)
{ {
// set defaults // set defaults
nnn = 0; nnn = 0;
@ -37,7 +37,7 @@ PairLambdaInputCsp::PairLambdaInputCsp(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaInputCsp::~PairLambdaInputCsp() PairLambdaInputCSPAPIP::~PairLambdaInputCSPAPIP()
{ {
if (copymode) return; if (copymode) return;
@ -49,7 +49,7 @@ PairLambdaInputCsp::~PairLambdaInputCsp()
global settings global settings
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInputCsp::settings(int narg, char **arg) void PairLambdaInputCSPAPIP::settings(int narg, char **arg)
{ {
double cut_csp = 5; double cut_csp = 5;
@ -103,7 +103,7 @@ void PairLambdaInputCsp::settings(int narg, char **arg)
* fix atom_weight/apip. * fix atom_weight/apip.
*/ */
int PairLambdaInputCsp::calculate_lambda_input() int PairLambdaInputCSPAPIP::calculate_lambda_input()
{ {
int i, j, k, ii, jj, kk, n, n_cutoff, inum, jnum; int i, j, k, ii, jj, kk, n, n_cutoff, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, rsq, value; double xtmp, ytmp, ztmp, delx, dely, delz, rsq, value;
@ -224,7 +224,7 @@ int PairLambdaInputCsp::calculate_lambda_input()
2nd routine sorts auxiliary array at same time 2nd routine sorts auxiliary array at same time
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaInputCsp::select(int k, int n, double *arr) void PairLambdaInputCSPAPIP::select(int k, int n, double *arr)
{ {
int i, ir, j, l, mid; int i, ir, j, l, mid;
double a; double a;
@ -263,7 +263,7 @@ void PairLambdaInputCsp::select(int k, int n, double *arr)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairLambdaInputCsp::select2(int k, int n, double *arr, int *iarr) void PairLambdaInputCSPAPIP::select2(int k, int n, double *arr, int *iarr)
{ {
int i, ir, j, l, mid, ia, itmp; int i, ir, j, l, mid, ia, itmp;
double a; double a;

View File

@ -16,22 +16,22 @@
#ifdef PAIR_CLASS #ifdef PAIR_CLASS
// clang-format off // clang-format off
PairStyle(lambda_input/csp,PairLambdaInputCsp); PairStyle(lambda/input/csp/apip,PairLambdaInputCSPAPIP);
// clang-format on // clang-format on
#else #else
#ifndef LMP_PAIR_LAMBDA_INPUT_CSP_H #ifndef LMP_PAIR_LAMBDA_INPUT_CSP_APIP_H
#define LMP_PAIR_LAMBDA_INPUT_CSP_H #define LMP_PAIR_LAMBDA_INPUT_CSP_APIP_H
#include "pair_lambda_input.h" #include "pair_lambda_input_apip.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class PairLambdaInputCsp : virtual public PairLambdaInput { class PairLambdaInputCSPAPIP : virtual public PairLambdaInputAPIP {
public: public:
PairLambdaInputCsp(class LAMMPS *); PairLambdaInputCSPAPIP(class LAMMPS *);
~PairLambdaInputCsp(); ~PairLambdaInputCSPAPIP();
void settings(int, char **) override; void settings(int, char **) override;
protected: protected: