pair_style lambda/zone -> pair_style lambda/zone/apip

This commit is contained in:
David Immel
2025-06-05 15:15:06 +02:00
parent 1086db672c
commit 4fcbdbe3a1
5 changed files with 28 additions and 28 deletions

4
src/.gitignore vendored
View File

@ -123,8 +123,8 @@
/pair_eam_fs_apip.h /pair_eam_fs_apip.h
/pair_eam_apip.cpp /pair_eam_apip.cpp
/pair_eam_apip.h /pair_eam_apip.h
/pair_lambda_zone.cpp /pair_lambda_zone_apip.cpp
/pair_lambda_zone.h /pair_lambda_zone_apip.h
/pair_pace_apip.cpp /pair_pace_apip.cpp
/pair_pace_apip.h /pair_pace_apip.h
/pair_pace_precise_apip.cpp /pair_pace_precise_apip.cpp

View File

@ -253,9 +253,9 @@ void FixLambdaAPIP::init()
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 = (PairLambdaInput *) pair_tmp;
// lambda/zone // lambda/zone
pair_tmp = force->pair_match("lambda/zone", 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`");
pair_lambda_zone = (PairLambdaZone *) pair_tmp; pair_lambda_zone = (PairLambdaZoneAPIP *) pair_tmp;
if (force->pair->cutforce < cut_hi) if (force->pair->cutforce < cut_hi)
error->all(FLERR, "fix lambda: cutoff of potential smaller than cutoff of switching region"); error->all(FLERR, "fix lambda: cutoff of potential smaller than cutoff of switching region");
@ -382,7 +382,7 @@ void FixLambdaAPIP::post_integrate()
lambda[i] = lambda_const[i]; lambda[i] = lambda_const[i];
} }
// set lambda_input_ta to own lambda for new lambda calculation with pair_lambda_zone.cpp // set lambda_input_ta to own lambda for new lambda calculation with pair_lambda_zone_apip.cpp
calculate_lambda_input_ta(); calculate_lambda_input_ta();
} }

View File

@ -25,13 +25,13 @@ FixStyle(lambda/apip,FixLambdaAPIP);
#include "fix.h" #include "fix.h"
#include "pair_lambda_input.h" #include "pair_lambda_input.h"
#include "pair_lambda_zone.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 PairLambdaInput;
friend class PairLambdaZone; friend class PairLambdaZoneAPIP;
public: public:
FixLambdaAPIP(class LAMMPS *, int, char **); FixLambdaAPIP(class LAMMPS *, int, char **);
@ -54,7 +54,7 @@ class FixLambdaAPIP : public Fix {
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 PairLambdaInput *pair_lambda_input;
class PairLambdaZone *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
double cut_hi; ///< distance at which the cutoff function of the transition zone is 0 double cut_hi; ///< distance at which the cutoff function of the transition zone is 0

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_zone.h" #include "pair_lambda_zone_apip.h"
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
@ -27,7 +27,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaZone::PairLambdaZone(LAMMPS *lmp) : PairLambdaZoneAPIP::PairLambdaZoneAPIP(LAMMPS *lmp) :
Pair(lmp), fix_lambda(nullptr), lambda_ta(nullptr), cut(nullptr) Pair(lmp), fix_lambda(nullptr), lambda_ta(nullptr), cut(nullptr)
{ {
// set defaults // set defaults
@ -43,7 +43,7 @@ PairLambdaZone::PairLambdaZone(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLambdaZone::~PairLambdaZone() PairLambdaZoneAPIP::~PairLambdaZoneAPIP()
{ {
if (copymode) return; if (copymode) return;
@ -58,7 +58,7 @@ PairLambdaZone::~PairLambdaZone()
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairLambdaZone::coeff(int narg, char **arg) void PairLambdaZoneAPIP::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();
@ -83,7 +83,7 @@ void PairLambdaZone::coeff(int narg, char **arg)
allocate all arrays allocate all arrays
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaZone::allocate() void PairLambdaZoneAPIP::allocate()
{ {
allocated = 1; allocated = 1;
int n = atom->ntypes + 1; int n = atom->ntypes + 1;
@ -98,7 +98,7 @@ void PairLambdaZone::allocate()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairLambdaZone::compute(int eflag, int vflag) void PairLambdaZoneAPIP::compute(int eflag, int vflag)
{ {
// basic stuff (see pair_zero) // basic stuff (see pair_zero)
ev_init(eflag, vflag); ev_init(eflag, vflag);
@ -111,7 +111,7 @@ void PairLambdaZone::compute(int eflag, int vflag)
global settings global settings
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaZone::settings(int narg, char **arg) void PairLambdaZoneAPIP::settings(int narg, char **arg)
{ {
// parse arguments // parse arguments
if (narg != 1) error->all(FLERR, "pair_lambda_zone: expected 1 instead of {} arguments", narg); if (narg != 1) error->all(FLERR, "pair_lambda_zone: expected 1 instead of {} arguments", narg);
@ -133,7 +133,7 @@ void PairLambdaZone::settings(int narg, char **arg)
init specific to this pair style init specific to this pair style
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaZone::init_style() void PairLambdaZoneAPIP::init_style()
{ {
if (!atom->apip_lambda_input_ta_flag) if (!atom->apip_lambda_input_ta_flag)
error->all(FLERR, "pair_lambda_zone requires an atom style with lambda_input_ta"); error->all(FLERR, "pair_lambda_zone requires an atom style with lambda_input_ta");
@ -165,7 +165,7 @@ void PairLambdaZone::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 PairLambdaZone::init_one(int i, int j) double PairLambdaZoneAPIP::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];
@ -178,7 +178,7 @@ double PairLambdaZone::init_one(int i, int j)
* output: lambda_input_ta of own particles * output: lambda_input_ta of own particles
*/ */
void PairLambdaZone::calculate_lambda() void PairLambdaZoneAPIP::calculate_lambda()
{ {
double timer_start = platform::walltime(); double timer_start = platform::walltime();
@ -267,7 +267,7 @@ void PairLambdaZone::calculate_lambda()
// similar to cutoff_func_poly in ace_radial.cpp // similar to cutoff_func_poly in ace_radial.cpp
// compare Phys Rev Mat 6, 013804 (2022) APPENDIX C: RADIAL AND CUTOFF FUNCTIONS 2. Cutoff function // compare Phys Rev Mat 6, 013804 (2022) APPENDIX C: RADIAL AND CUTOFF FUNCTIONS 2. Cutoff function
// the first two derivatives of the switching function lambda vanishes at the boundaries of the switching region // the first two derivatives of the switching function lambda vanishes at the boundaries of the switching region
double PairLambdaZone::switching_function_poly_distance(double input) double PairLambdaZoneAPIP::switching_function_poly_distance(double input)
{ {
// calculate lambda // calculate lambda
if (input <= cut_lo) { if (input <= cut_lo) {
@ -284,7 +284,7 @@ double PairLambdaZone::switching_function_poly_distance(double input)
set return values for timers and counted particles set return values for timers and counted particles
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairLambdaZone::calculate_time_per_atom() void PairLambdaZoneAPIP::calculate_time_per_atom()
{ {
if (n_calculations > 0) if (n_calculations > 0)
time_per_atom = timer / n_calculations; time_per_atom = timer / n_calculations;
@ -298,10 +298,10 @@ void PairLambdaZone::calculate_time_per_atom()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void *PairLambdaZone::extract(const char *str, int &dim) void *PairLambdaZoneAPIP::extract(const char *str, int &dim)
{ {
dim = 0; dim = 0;
if (strcmp(str, "lambda_zone:time_per_atom") == 0) { if (strcmp(str, "lambda_zone/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/zone,PairLambdaZone); PairStyle(lambda/zone/apip,PairLambdaZoneAPIP);
// clang-format on // clang-format on
#else #else
#ifndef LMP_PAIR_LAMBDA_ZONE_H #ifndef LMP_PAIR_LAMBDA_ZONE_APIP_H
#define LMP_PAIR_LAMBDA_ZONE_H #define LMP_PAIR_LAMBDA_ZONE_APIP_H
#include "fix.h" #include "fix.h"
#include "pair.h" #include "pair.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class PairLambdaZone : public Pair { class PairLambdaZoneAPIP : public Pair {
friend class FixLambdaAPIP; friend class FixLambdaAPIP;
public: public:
PairLambdaZone(class LAMMPS *); PairLambdaZoneAPIP(class LAMMPS *);
~PairLambdaZone() override; ~PairLambdaZoneAPIP() override;
void compute(int, int) override; void compute(int, int) override;
void settings(int, char **) override; void settings(int, char **) override;
void coeff(int, char **) override; void coeff(int, char **) override;