From 89b0227849d1b87208a3f891fc433cdb61d0c884 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Apr 2021 16:20:39 -0400 Subject: [PATCH 001/119] move file opening step to reax/c function. simplify code. --- src/USER-REAXC/pair_reaxc.cpp | 12 ++---------- src/USER-REAXC/reaxc_control.cpp | 7 ++++++- src/USER-REAXC/reaxc_ffield.cpp | 17 +++++++++++++---- src/USER-REAXC/reaxc_ffield.h | 3 +-- src/USER-REAXC/reaxc_types.h | 15 ++++++++++----- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 4d6f240ec6..6e9429809e 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -121,6 +121,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->pair_ptr = this; system->error_ptr = error; control->error_ptr = error; + control->lmp_ptr = lmp; system->omp_active = 0; @@ -314,16 +315,7 @@ void PairReaxC::coeff( int nargs, char **args ) // read ffield file - char *file = args[2]; - FILE *fp; - fp = utils::open_potential(file,lmp,nullptr); - if (fp != nullptr) - Read_Force_Field(fp, &(system->reax_param), control); - else { - char str[128]; - snprintf(str,128,"Cannot open ReaxFF potential file %s",file); - error->all(FLERR,str); - } + Read_Force_Field(args[2], &(system->reax_param), control); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if "NULL" diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index b717b6b97f..e4771427e8 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -31,6 +31,9 @@ #include "reaxc_tool_box.h" #include "error.h" +#include "utils.h" + +using LAMMPS_NS::utils::getsyserror; char Read_Control_File( char *control_file, control_params* control, output_controls *out_control ) @@ -42,7 +45,9 @@ char Read_Control_File( char *control_file, control_params* control, /* open control file */ if ((fp = fopen( control_file, "r" ) ) == nullptr) { - control->error_ptr->all(FLERR, "The control file cannot be opened"); + control->error_ptr->all(FLERR,fmt::format("The control file {} cannot be " + "opened: {}",control_file, + getsyserror())); } /* assign default values */ diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index e54b3b75e0..a48ba93e85 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -25,16 +25,22 @@ ----------------------------------------------------------------------*/ #include "reaxc_ffield.h" + #include #include #include #include +#include #include #include "reaxc_defs.h" #include "error.h" #include "reaxc_tool_box.h" +#include "utils.h" -char Read_Force_Field( FILE *fp, reax_interaction *reax, +using LAMMPS_NS::utils::open_potential; +using LAMMPS_NS::utils::getsyserror; + +void Read_Force_Field(const char *filename, reax_interaction *reax, control_params *control ) { char *s; @@ -46,6 +52,11 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, double val; int me = control->me; + FILE *fp = open_potential(filename,control->lmp_ptr,nullptr); + if (!fp) + control->error_ptr->all(FLERR,fmt::format("Cannot open ReaxFF potential " + "file {}: {}",filename, + getsyserror())); s = (char*) malloc(sizeof(char)*MAX_LINE); tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); for (i=0; i < MAX_TOKENS; i++) @@ -66,7 +77,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, fclose(fp); free(s); free(tmp); - return 1; + return; } reax->gp.n_global = n; @@ -734,6 +745,4 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, // close file fclose(fp); - - return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_ffield.h b/src/USER-REAXC/reaxc_ffield.h index b6fe1c9ea9..d334047ab5 100644 --- a/src/USER-REAXC/reaxc_ffield.h +++ b/src/USER-REAXC/reaxc_ffield.h @@ -28,8 +28,7 @@ #define __FFIELD_H_ #include "reaxc_types.h" -#include -char Read_Force_Field( FILE*, reax_interaction*, control_params* ); +void Read_Force_Field(const char *, reax_interaction *, control_params *); #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 36678ad2b0..5e7e655899 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -32,7 +32,12 @@ #include #include "accelerator_kokkos.h" -namespace LAMMPS_NS { class Error;} +// forward declarations +namespace LAMMPS_NS { + class Error; + class LAMMPS; + class Pair; +} #if defined LMP_USER_OMP #define OMP_TIMING 0 @@ -406,8 +411,8 @@ struct _reax_system boundary_cutoff bndry_cuts; reax_atom *my_atoms; - class LAMMPS_NS::Error *error_ptr; - class LAMMPS_NS::Pair *pair_ptr; + LAMMPS_NS::Error *error_ptr; + LAMMPS_NS::Pair *pair_ptr; int my_bonds; int mincap,minhbonds; double safezone, saferzone; @@ -486,9 +491,9 @@ typedef struct int lgflag; int enobondsflag; - class LAMMPS_NS::Error *error_ptr; + LAMMPS_NS::Error *error_ptr; + LAMMPS_NS::LAMMPS *lmp_ptr; int me; - } control_params; From 73cd6f8e4ebe4d117605a969b7c00b10c5ec4406 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Apr 2021 17:36:17 -0400 Subject: [PATCH 002/119] read control file only on MPI rank 0, then broadcast its data --- src/USER-REAXC/reaxc_control.cpp | 13 +++++-------- src/USER-REAXC/reaxc_control.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index e4771427e8..6496f27ab5 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -35,8 +35,8 @@ using LAMMPS_NS::utils::getsyserror; -char Read_Control_File( char *control_file, control_params* control, - output_controls *out_control ) +void Read_Control_File(const char *control_file, control_params *control, + output_controls *out_control) { FILE *fp; char *s, **tmp; @@ -44,12 +44,11 @@ char Read_Control_File( char *control_file, control_params* control, double val; /* open control file */ - if ((fp = fopen( control_file, "r" ) ) == nullptr) { - control->error_ptr->all(FLERR,fmt::format("The control file {} cannot be " + fp = fopen(control_file, "r"); + if (!fp) + control->error_ptr->one(FLERR,fmt::format("The control file {} cannot be " "opened: {}",control_file, getsyserror())); - } - /* assign default values */ strcpy( control->sim_name, "simulate" ); control->ensemble = NVE; @@ -390,6 +389,4 @@ char Read_Control_File( char *control_file, control_params* control, free( s ); fclose(fp); - - return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_control.h b/src/USER-REAXC/reaxc_control.h index b2b455d6b8..5739d97574 100644 --- a/src/USER-REAXC/reaxc_control.h +++ b/src/USER-REAXC/reaxc_control.h @@ -29,6 +29,6 @@ #include "reaxc_types.h" -char Read_Control_File( char*, control_params*, output_controls* ); +void Read_Control_File(const char *, control_params *, output_controls *); #endif From a2dcbf6a2d556a678e54cf28e031d956184bd9b0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Apr 2021 17:52:10 -0400 Subject: [PATCH 003/119] remove obsolete define --- src/USER-REAXC/reaxc_list.h | 2 -- src/USER-REAXC/reaxc_types.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/USER-REAXC/reaxc_list.h b/src/USER-REAXC/reaxc_list.h index 28567252da..1894f6cbbd 100644 --- a/src/USER-REAXC/reaxc_list.h +++ b/src/USER-REAXC/reaxc_list.h @@ -38,7 +38,6 @@ inline int End_Index( int, reax_list* ); inline void Set_Start_Index(int,int,reax_list*); inline void Set_End_Index(int,int,reax_list*); -#if defined(LAMMPS_REAX) inline int Num_Entries( int i, reax_list *l ) { return l->end_index[i] - l->index[i]; @@ -63,6 +62,5 @@ inline void Set_End_Index( int i, int val, reax_list *l ) { l->end_index[i] = val; } -#endif // LAMMPS_REAX #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 5e7e655899..a0173c9c20 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -75,8 +75,6 @@ extern int ompTimingCGCount[LASTTIMINGINDEX]; /************* SOME DEFS - crucial for reax_types.h *********/ -#define LAMMPS_REAX - //#define DEBUG //#define DEBUG_FOCUS //#define TEST_ENERGY From 390b1683f0d154dee773e7600c09acfe21c21cc1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Apr 2021 17:53:29 -0400 Subject: [PATCH 004/119] remove unusued function pointer typedefs --- src/USER-REAXC/reaxc_types.h | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index a0173c9c20..fdcd0436e2 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -907,23 +907,8 @@ typedef struct _LR_lookup_table } LR_lookup_table; /* function pointer defs */ -typedef void (*evolve_function)(reax_system*, control_params*, - simulation_data*, storage*, reax_list**, - output_controls*, mpi_datatypes* ); -typedef void (*interaction_function) (reax_system*, control_params*, - simulation_data*, storage*, - reax_list**, output_controls*); - -typedef void (*print_interaction)(reax_system*, control_params*, - simulation_data*, storage*, - reax_list**, output_controls*); - -typedef double (*lookup_function)(double); - -typedef void (*message_sorter) (reax_system*, int, int, int, mpi_out_data*); -typedef void (*unpacker) ( reax_system*, int, void*, int, neighbor_proc*, int ); - -typedef void (*dist_packer) (void*, mpi_out_data*); -typedef void (*coll_unpacker) (void*, void*, mpi_out_data*); +typedef void (*interaction_function) (reax_system *, control_params *, + simulation_data *, storage *, + reax_list **, output_controls *); #endif From 487e0b041c52bb120e852d414de95b553bc1f604 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Apr 2021 23:26:37 -0400 Subject: [PATCH 005/119] eliminate mpi_datatypes struct --- src/USER-OMP/pair_reaxc_omp.cpp | 9 +- src/USER-OMP/reaxc_forces_omp.cpp | 29 ++-- src/USER-OMP/reaxc_forces_omp.h | 3 +- src/USER-OMP/reaxc_init_md_omp.cpp | 24 +-- src/USER-OMP/reaxc_init_md_omp.h | 2 +- src/USER-OMP/reaxc_nonbonded_omp.cpp | 4 +- src/USER-REAXC/pair_reaxc.cpp | 33 ++-- src/USER-REAXC/pair_reaxc.h | 14 +- src/USER-REAXC/reaxc_forces.cpp | 50 +++--- src/USER-REAXC/reaxc_forces.h | 4 +- src/USER-REAXC/reaxc_init_md.cpp | 37 +--- src/USER-REAXC/reaxc_init_md.h | 4 +- src/USER-REAXC/reaxc_io_tools.cpp | 21 +-- src/USER-REAXC/reaxc_io_tools.h | 12 +- src/USER-REAXC/reaxc_lookup.cpp | 8 +- src/USER-REAXC/reaxc_lookup.h | 3 +- src/USER-REAXC/reaxc_traj.cpp | 93 +++++----- src/USER-REAXC/reaxc_traj.h | 5 +- src/USER-REAXC/reaxc_types.h | 244 +++++++++------------------ 19 files changed, 234 insertions(+), 365 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index d10a4573f1..6bb9377ca3 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -117,7 +117,7 @@ PairReaxCOMP::~PairReaxCOMP() #ifdef OMP_TIMING int myrank; - MPI_Comm_rank(mpi_data->world,&myrank); + MPI_Comm_rank(world,&myrank); // Write screen output if (timer->has_full() && myrank == 0 && screen) { @@ -230,7 +230,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) startTimeBase = MPI_Wtime(); #endif - Compute_ForcesOMP(system,control,data,workspace,&lists,out_control,mpi_data); + Compute_ForcesOMP(system,control,data,workspace,&lists,out_control); read_reax_forces(vflag); #ifdef OMP_TIMING @@ -289,7 +289,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) data->step = update->ntimestep; - Output_Results( system, control, data, &lists, out_control, mpi_data ); + Output_Results( system, control, data, &lists, out_control, world ); // populate tmpid and tmpbo arrays for fix reax/c/species @@ -430,8 +430,7 @@ void PairReaxCOMP::setup( ) write_reax_lists(); - InitializeOMP( system, control, data, workspace, &lists, out_control, - mpi_data, world ); + InitializeOMP(system, control, data, workspace, &lists, out_control, world); for (int k = 0; k < system->N; ++k) { num_bonds[k] = system->my_atoms[k].num_bonds; diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 5eb939cf8c..4bed7a3828 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -81,8 +81,7 @@ void Init_Force_FunctionsOMP( control_params *control ) // Only difference with MPI-only version is inclusion of OMP_TIMING statements void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm /* comm */) + reax_list **lists, output_controls *out_control) { int i; @@ -107,8 +106,7 @@ void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control, // Only difference with MPI-only version is inclusion of OMP_TIMING statements void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm /* comm */) + reax_list **lists, output_controls *out_control) { /* van der Waals and Coulomb interactions */ #ifdef OMP_TIMING @@ -136,7 +134,7 @@ void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control, Saves enormous time & space! */ void Compute_Total_ForceOMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, mpi_datatypes * /* mpi_data */) + reax_list **lists) { #ifdef OMP_TIMING double startTimeBase,endTimeBase; @@ -266,7 +264,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, /* ---------------------------------------------------------------------- */ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list **lists, - int step, int n, int N, int numH, MPI_Comm /*comm*/) + int step, int n, int N, int numH) { int comp, Hindex; reax_list *bonds, *hbonds; @@ -334,8 +332,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /* out_control */, - MPI_Comm comm) { + reax_list **lists) { #ifdef OMP_TIMING double startTimeBase, endTimeBase; startTimeBase = MPI_Wtime(); @@ -588,7 +585,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, workspace->realloc.num_hbonds = num_hbonds; Validate_ListsOMP( system, workspace, lists, data->step, - system->n, system->N, system->numH, comm ); + system->n, system->N, system->numH); #ifdef OMP_TIMING endTimeBase = MPI_Wtime(); @@ -600,23 +597,19 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, void Compute_ForcesOMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - mpi_datatypes *mpi_data ) + reax_list **lists, output_controls *out_control) { - MPI_Comm comm = mpi_data->world; - // Init Forces - Init_Forces_noQEq_OMP( system, control, data, workspace, - lists, out_control, comm ); + Init_Forces_noQEq_OMP( system, control, data, workspace, lists); // Bonded Interactions Compute_Bonded_ForcesOMP( system, control, data, workspace, - lists, out_control, mpi_data->world ); + lists, out_control ); // Nonbonded Interactions Compute_NonBonded_ForcesOMP( system, control, data, workspace, - lists, out_control, mpi_data->world ); + lists, out_control); // Total Force - Compute_Total_ForceOMP( system, control, data, workspace, lists, mpi_data ); + Compute_Total_ForceOMP( system, control, data, workspace, lists); } diff --git a/src/USER-OMP/reaxc_forces_omp.h b/src/USER-OMP/reaxc_forces_omp.h index 6df0288656..e2065d8305 100644 --- a/src/USER-OMP/reaxc_forces_omp.h +++ b/src/USER-OMP/reaxc_forces_omp.h @@ -30,8 +30,9 @@ #define __FORCES_OMP_H_ #include "reaxc_types.h" +#include void Init_Force_FunctionsOMP( control_params* ); void Compute_ForcesOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, mpi_datatypes* ); + storage*, reax_list**, output_controls*); #endif diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index 1312953180..bb7d102141 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -41,16 +41,14 @@ #include // Functions defined in reaxc_init_md.cpp -extern int Init_MPI_Datatypes(reax_system*, storage*, mpi_datatypes*, MPI_Comm, char*); -extern int Init_System(reax_system*, control_params*, char*); +extern void Init_System(reax_system*, control_params*); extern int Init_Simulation_Data(reax_system*, control_params*, simulation_data*, char*); extern int Init_Workspace(reax_system*, control_params*, storage*, char*); /* ---------------------------------------------------------------------- */ int Init_ListsOMP(reax_system *system, control_params *control, - simulation_data * /* data */, storage * /* workspace */, - reax_list **lists, mpi_datatypes * /* mpi_data */, char * /* msg */) + reax_list **lists) { int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int *hb_top, *bond_top; @@ -119,18 +117,12 @@ int Init_ListsOMP(reax_system *system, control_params *control, void InitializeOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, - mpi_datatypes *mpi_data, MPI_Comm comm) + MPI_Comm world) { char msg[MAX_STR]; LAMMPS_NS::Error *error = system->error_ptr; - if (Init_MPI_Datatypes(system,workspace,mpi_data,comm,msg) == FAILURE) - error->one(FLERR,"init_mpi_datatypes: could not create datatypes. " - "Mpi_data could not be initialized! Terminating."); - - if (Init_System(system,control,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. System could not be " - "initialized! Terminating.",msg)); + Init_System(system,control); if (Init_Simulation_Data(system,control,data,msg) == FAILURE) error->one(FLERR,fmt::format("Error on: {}. Sim_data could not be " @@ -140,16 +132,14 @@ void InitializeOMP(reax_system *system, control_params *control, error->one(FLERR,"init_workspace: not enough memory. " "Workspace could not be initialized. Terminating."); - if (Init_ListsOMP(system,control,data,workspace,lists,mpi_data,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. System could not be " - "initialized. Terminating.",msg)); + Init_ListsOMP(system,control,lists); - if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) + if (Init_Output_Files(system,control,out_control,world,msg)== FAILURE) error->one(FLERR,fmt::format("Error on: {}. Could not open output files! " "Terminating.",msg)); if (control->tabulate) - if (Init_Lookup_Tables(system,control,workspace,mpi_data,msg) == FAILURE) + if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) error->one(FLERR,fmt::format("Error on: {}. Could not create lookup " "table. Terminating.",msg)); diff --git a/src/USER-OMP/reaxc_init_md_omp.h b/src/USER-OMP/reaxc_init_md_omp.h index 45478ec632..422e2aa452 100644 --- a/src/USER-OMP/reaxc_init_md_omp.h +++ b/src/USER-OMP/reaxc_init_md_omp.h @@ -34,5 +34,5 @@ #include void InitializeOMP( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); + reax_list**, output_controls*, MPI_Comm ); #endif diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index 7abcb5b42a..3a4214d306 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -28,14 +28,14 @@ #include "pair_reaxc_omp.h" -#include "reaxc_defs.h" #include "reaxc_types.h" - #include "reaxc_nonbonded.h" #include "reaxc_nonbonded_omp.h" #include "reaxc_list.h" #include "reaxc_vector.h" +#include "reaxc_defs.h" + #include #if defined(_OPENMP) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 6e9429809e..2897a24d66 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -98,8 +98,6 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) out_control = (output_controls *) memory->smalloc(sizeof(output_controls),"reax:out_control"); memset(out_control,0,sizeof(output_controls)); - mpi_data = (mpi_datatypes *) - memory->smalloc(sizeof(mpi_datatypes),"reax:mpi"); control->me = system->my_rank = comm->me; @@ -148,28 +146,27 @@ PairReaxC::~PairReaxC() delete[] fix_id; if (setup_flag) { - Close_Output_Files( system, control, out_control, mpi_data ); + Close_Output_Files(system,out_control); // deallocate reax data-structures - if (control->tabulate ) Deallocate_Lookup_Tables( system); + if (control->tabulate) Deallocate_Lookup_Tables(system); - if (control->hbond_cut > 0 ) Delete_List( lists+HBONDS ); - Delete_List( lists+BONDS ); - Delete_List( lists+THREE_BODIES ); - Delete_List( lists+FAR_NBRS ); + if (control->hbond_cut > 0) Delete_List(lists+HBONDS); + Delete_List(lists+BONDS); + Delete_List(lists+THREE_BODIES); + Delete_List(lists+FAR_NBRS); - DeAllocate_Workspace( control, workspace ); - DeAllocate_System( system ); + DeAllocate_Workspace(control, workspace); + DeAllocate_System(system); } - memory->destroy( system ); - memory->destroy( control ); + memory->destroy(system); + memory->destroy(control); memory->destroy( data ); memory->destroy( workspace ); memory->destroy( lists ); memory->destroy( out_control ); - memory->destroy( mpi_data ); // deallocate interface storage if (allocated) { @@ -467,8 +464,8 @@ void PairReaxC::setup( ) (lists+FAR_NBRS)->error_ptr=error; write_reax_lists(); - Initialize( system, control, data, workspace, &lists, out_control, - mpi_data, world ); + system->wsize = comm->nprocs; + Initialize(system, control, data, workspace, &lists, out_control, world); for (int k = 0; k < system->N; ++k) { num_bonds[k] = system->my_atoms[k].num_bonds; num_hbonds[k] = system->my_atoms[k].num_hbonds; @@ -491,7 +488,7 @@ void PairReaxC::setup( ) } bigint local_ngroup = list->inum; - MPI_Allreduce( &local_ngroup, &ngroup, 1, MPI_LMP_BIGINT, MPI_SUM, world ); + MPI_Allreduce(&local_ngroup, &ngroup, 1, MPI_LMP_BIGINT, MPI_SUM, world); } /* ---------------------------------------------------------------------- */ @@ -548,7 +545,7 @@ void PairReaxC::compute(int eflag, int vflag) // forces - Compute_Forces(system,control,data,workspace,&lists,out_control,mpi_data); + Compute_Forces(system,control,data,workspace,&lists,out_control); read_reax_forces(vflag); for (int k = 0; k < system->N; ++k) { @@ -602,7 +599,7 @@ void PairReaxC::compute(int eflag, int vflag) data->step = update->ntimestep; - Output_Results( system, control, data, &lists, out_control, mpi_data ); + Output_Results(system, control, data, &lists, out_control, world); // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; diff --git a/src/USER-REAXC/pair_reaxc.h b/src/USER-REAXC/pair_reaxc.h index 53b41ba9c8..5283824116 100644 --- a/src/USER-REAXC/pair_reaxc.h +++ b/src/USER-REAXC/pair_reaxc.h @@ -31,7 +31,15 @@ PairStyle(reax/c,PairReaxC) #define LMP_PAIR_REAXC_H #include "pair.h" -#include "reaxc_types.h" + +// forward declarations +struct control_params; +struct reax_system; +struct output_controls; +struct simulation_data; +struct storage; +struct reax_list; +struct far_neighbor_data; namespace LAMMPS_NS { @@ -55,11 +63,11 @@ class PairReaxC : public Pair { simulation_data *data; storage *workspace; reax_list *lists; - mpi_datatypes *mpi_data; bigint ngroup; + typedef double rvec[3]; - protected: +protected: char *fix_id; double cutmax; class FixReaxC *fix_reax; diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index cde80e9866..0289c08504 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -42,14 +42,14 @@ interaction_function Interaction_Functions[NUM_INTRS]; -void Dummy_Interaction( reax_system * /*system*/, control_params * /*control*/, - simulation_data * /*data*/, storage * /*workspace*/, - reax_list ** /*lists*/, output_controls * /*out_control*/ ) +void Dummy_Interaction(reax_system * /*system*/, control_params * /*control*/, + simulation_data * /*data*/, storage * /*workspace*/, + reax_list ** /*lists*/, output_controls * /*out_control*/ ) { } -void Init_Force_Functions( control_params *control ) +void Init_Force_Functions(control_params *control) { Interaction_Functions[0] = BO; Interaction_Functions[1] = Bonds; //Dummy_Interaction; @@ -66,10 +66,9 @@ void Init_Force_Functions( control_params *control ) } -void Compute_Bonded_Forces( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm /*comm*/ ) +void Compute_Bonded_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) { int i; @@ -81,10 +80,9 @@ void Compute_Bonded_Forces( reax_system *system, control_params *control, } -void Compute_NonBonded_Forces( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm /*comm*/ ) +void Compute_NonBonded_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) { /* van der Waals and Coulomb interactions */ @@ -97,9 +95,9 @@ void Compute_NonBonded_Forces( reax_system *system, control_params *control, } -void Compute_Total_Force( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, mpi_datatypes * /*mpi_data*/ ) +void Compute_Total_Force(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) { int i, pj; reax_list *bonds = (*lists) + BONDS; @@ -433,24 +431,22 @@ void Estimate_Storages( reax_system *system, control_params *control, } -void Compute_Forces( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - mpi_datatypes *mpi_data ) +void Compute_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) { - Init_Forces_noQEq( system, control, data, workspace, - lists, out_control); + Init_Forces_noQEq(system, control, data, workspace, + lists, out_control); /********* bonded interactions ************/ - Compute_Bonded_Forces( system, control, data, workspace, - lists, out_control, mpi_data->world ); + Compute_Bonded_Forces(system, control, data, workspace, + lists, out_control); /********* nonbonded interactions ************/ - Compute_NonBonded_Forces( system, control, data, workspace, - lists, out_control, mpi_data->world ); + Compute_NonBonded_Forces(system, control, data, workspace, + lists, out_control); /*********** total force ***************/ - Compute_Total_Force( system, control, data, workspace, lists, mpi_data ); - + Compute_Total_Force(system, control, data, workspace, lists); } diff --git a/src/USER-REAXC/reaxc_forces.h b/src/USER-REAXC/reaxc_forces.h index bfad2e9b71..b679a66650 100644 --- a/src/USER-REAXC/reaxc_forces.h +++ b/src/USER-REAXC/reaxc_forces.h @@ -32,9 +32,9 @@ extern interaction_function Interaction_Functions[NUM_INTRS]; -void Init_Force_Functions( control_params* ); +void Init_Force_Functions(control_params *); void Compute_Forces( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, mpi_datatypes* ); + storage*, reax_list**, output_controls*); void Estimate_Storages( reax_system*, control_params*, reax_list**, int*, int*, int*, int* ); #endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 9d10966d3b..23c20d1c21 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -41,7 +41,7 @@ #include "error.h" #include "fmt/format.h" -int Init_System(reax_system *system, control_params *control, char * /*msg*/) +void Init_System(reax_system *system, control_params *control) { int i; reax_atom *atom; @@ -65,8 +65,6 @@ int Init_System(reax_system *system, control_params *control, char * /*msg*/) else atom->Hindex = -1; } system->Hcap = (int)(MAX(system->numH * saferzone, mincap)); - - return SUCCESS; } @@ -145,22 +143,7 @@ int Init_Workspace(reax_system *system, control_params *control, return SUCCESS; } - -/************** setup communication data structures **************/ -int Init_MPI_Datatypes(reax_system *system, storage * /*workspace*/, - mpi_datatypes *mpi_data, MPI_Comm comm, char * /*msg*/) -{ - - /* setup the world */ - mpi_data->world = comm; - MPI_Comm_size(comm, &(system->wsize)); - - return SUCCESS; -} - -int Init_Lists(reax_system *system, control_params *control, - simulation_data * /*data*/, storage * /*workspace*/, reax_list **lists, - mpi_datatypes * /*mpi_data*/, char * /*msg*/) +int Init_Lists(reax_system *system, control_params *control, reax_list **lists) { int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int *hb_top, *bond_top; @@ -221,18 +204,12 @@ int Init_Lists(reax_system *system, control_params *control, void Initialize(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, - mpi_datatypes *mpi_data, MPI_Comm comm) + MPI_Comm world) { char msg[MAX_STR]; LAMMPS_NS::Error *error = system->error_ptr; - if (Init_MPI_Datatypes(system,workspace,mpi_data,comm,msg) == FAILURE) - error->one(FLERR,"init_mpi_datatypes: could not create datatypes. " - "Mpi_data could not be initialized! Terminating."); - - if (Init_System(system,control,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. System could not be " - "initialized! Terminating.",msg)); + Init_System(system,control); if (Init_Simulation_Data( system,control,data,msg) == FAILURE) error->one(FLERR,fmt::format("Error on: {}. Sim_data could not be " @@ -242,16 +219,16 @@ void Initialize(reax_system *system, control_params *control, error->one(FLERR,"init_workspace: not enough memory. " "Workspace could not be initialized. Terminating."); - if (Init_Lists(system, control, data, workspace, lists, mpi_data, msg) ==FAILURE) + if (Init_Lists(system, control, lists) ==FAILURE) error->one(FLERR,fmt::format("Error on: {}. System could not be " "initialized. Terminating.",msg)); - if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) + if (Init_Output_Files(system,control,out_control,world,msg)== FAILURE) error->one(FLERR,fmt::format("Error on: {}. Could not open output files! " "Terminating.",msg)); if (control->tabulate) - if (Init_Lookup_Tables(system,control,workspace,mpi_data,msg) == FAILURE) + if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) error->one(FLERR,fmt::format("Error on: {}. Could not create lookup " "table. Terminating.",msg)); diff --git a/src/USER-REAXC/reaxc_init_md.h b/src/USER-REAXC/reaxc_init_md.h index 5d593f50ea..4528ee95b1 100644 --- a/src/USER-REAXC/reaxc_init_md.h +++ b/src/USER-REAXC/reaxc_init_md.h @@ -30,6 +30,6 @@ #include "reaxc_types.h" #include -void Initialize( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); +void Initialize(reax_system*, control_params*, simulation_data*, storage*, + reax_list**, output_controls*, MPI_Comm); #endif diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 5864ab6a15..290b559817 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -31,15 +31,14 @@ #include "reaxc_system_props.h" #include "reaxc_traj.h" -int Init_Output_Files( reax_system *system, control_params *control, - output_controls *out_control, mpi_datatypes *mpi_data, - char *msg ) +int Init_Output_Files(reax_system *system, control_params *control, + output_controls *out_control, MPI_Comm world, char *msg) { char temp[MAX_STR+8]; int ret; if (out_control->write_steps > 0) { - ret = Init_Traj( system, control, out_control, mpi_data, msg ); + ret = Init_Traj( system, control, out_control, world, msg ); if (ret == FAILURE) return ret; } @@ -80,10 +79,8 @@ int Init_Output_Files( reax_system *system, control_params *control, return SUCCESS; } - /************************ close output files ************************/ -int Close_Output_Files( reax_system *system, control_params * /* control */, - output_controls *out_control, mpi_datatypes * /*mpi_data*/ ) +int Close_Output_Files(reax_system *system, output_controls *out_control) { if (out_control->write_steps > 0) End_Traj( system->my_rank, out_control ); @@ -104,9 +101,9 @@ int Close_Output_Files( reax_system *system, control_params * /* control */, } -void Output_Results( reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, mpi_datatypes *mpi_data ) +void Output_Results(reax_system *system, control_params *control, + simulation_data *data, reax_list **lists, + output_controls *out_control, MPI_Comm world) { if ((out_control->energy_update_freq > 0 && @@ -114,7 +111,7 @@ void Output_Results( reax_system *system, control_params *control, (out_control->write_steps > 0 && data->step%out_control->write_steps == 0)) { /* update system-wide energies */ - Compute_System_Energy( system, data, mpi_data->world ); + Compute_System_Energy(system, data, world); /* output energies */ if ( system->my_rank == MASTER_NODE && @@ -143,7 +140,7 @@ void Output_Results( reax_system *system, control_params *control, /* write current frame */ if ( out_control->write_steps > 0 && (data->step-data->prev_steps) % out_control->write_steps == 0) { - Append_Frame( system, control, data, lists, out_control, mpi_data ); + Append_Frame( system, control, data, lists, out_control, world); } } diff --git a/src/USER-REAXC/reaxc_io_tools.h b/src/USER-REAXC/reaxc_io_tools.h index a3f22fccc2..643b563f73 100644 --- a/src/USER-REAXC/reaxc_io_tools.h +++ b/src/USER-REAXC/reaxc_io_tools.h @@ -28,11 +28,11 @@ #define __IO_TOOLS_H_ #include "reaxc_types.h" +#include -int Init_Output_Files( reax_system*, control_params*, - output_controls*, mpi_datatypes*, char* ); -int Close_Output_Files( reax_system*, control_params*, - output_controls*, mpi_datatypes* ); -void Output_Results( reax_system*, control_params*, simulation_data*, - reax_list**, output_controls*, mpi_datatypes* ); +int Init_Output_Files(reax_system *, control_params *, + output_controls *, MPI_Comm, char *); +int Close_Output_Files(reax_system *, output_controls *); +void Output_Results(reax_system *, control_params *, simulation_data *, + reax_list **, output_controls *, MPI_Comm); #endif diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index b45a6da265..7584c34b82 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -147,8 +147,8 @@ void Complete_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const } -int Init_Lookup_Tables( reax_system *system, control_params *control, - storage *workspace, mpi_datatypes *mpi_data, char * /*msg*/ ) +int Init_Lookup_Tables(reax_system *system, control_params *control, + storage *workspace, MPI_Comm world, char * /*msg*/) { int i, j, r; int num_atom_types; @@ -190,8 +190,8 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, for (i = 0; i < system->n; ++i) existing_types[ system->my_atoms[i].type ] = 1; - MPI_Allreduce( existing_types, aggregated, REAX_MAX_ATOM_TYPES, - MPI_INT, MPI_SUM, mpi_data->world ); + MPI_Allreduce(existing_types, aggregated, REAX_MAX_ATOM_TYPES, + MPI_INT, MPI_SUM, world); for (i = 0; i < num_atom_types; ++i) { if (aggregated[i]) { diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h index 3aae7e0b63..39b0b14ef1 100644 --- a/src/USER-REAXC/reaxc_lookup.h +++ b/src/USER-REAXC/reaxc_lookup.h @@ -40,8 +40,7 @@ void Complete_Cubic_Spline( LAMMPS_NS::Error*, const double *h, const double *f, double v0, double vlast, cubic_spline_coef *coef, unsigned int n ); -int Init_Lookup_Tables( reax_system*, control_params*, storage*, - mpi_datatypes*, char* ); +int Init_Lookup_Tables(reax_system*, control_params*, storage*, MPI_Comm, char* ); void Deallocate_Lookup_Tables( reax_system* ); diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 66a1c70b0e..66968f186e 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -50,9 +50,8 @@ int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_ return SUCCESS; } - -void Write_Skip_Line( output_controls *out_control, mpi_datatypes * /*mpi_data*/, - int my_rank, int skip, int num_section ) +void Write_Skip_Line(output_controls *out_control, + int my_rank, int skip, int num_section) { if (my_rank == MASTER_NODE) fprintf( out_control->strj, INT2_LINE, @@ -60,8 +59,8 @@ void Write_Skip_Line( output_controls *out_control, mpi_datatypes * /*mpi_data*/ } -int Write_Header( reax_system *system, control_params *control, - output_controls *out_control, mpi_datatypes * /*mpi_data*/ ) +int Write_Header(reax_system *system, control_params *control, + output_controls *out_control) { int num_hdr_lines, my_hdr_lines, buffer_req; char ensembles[ens_N][25] = { "NVE", "NVT", "fully flexible NPT", @@ -262,8 +261,8 @@ int Write_Header( reax_system *system, control_params *control, } -int Write_Init_Desc( reax_system *system, control_params * /*control*/, - output_controls *out_control, mpi_datatypes *mpi_data ) +int Write_Init_Desc(reax_system *system, output_controls *out_control, + MPI_Comm world) { int i, me, np, cnt, buffer_len, buffer_req; reax_atom *p_atom; @@ -273,8 +272,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, np = system->wsize; /* skip info */ - Write_Skip_Line( out_control, mpi_data, me, - system->bigN * INIT_DESC_LEN, system->bigN ); + Write_Skip_Line(out_control, me, system->bigN*INIT_DESC_LEN, system->bigN); if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) buffer_req = system->bigN * INIT_DESC_LEN + 1; @@ -295,14 +293,14 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, } if (me != MASTER_NODE) { - MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np * INIT_DESCS + me, mpi_data->world ); + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np * INIT_DESCS + me, world); } else { buffer_len = system->n * INIT_DESC_LEN; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*INIT_DESCS+i, mpi_data->world, &status ); + MPI_CHAR, i, np*INIT_DESCS+i, world, &status ); MPI_Get_count( &status, MPI_CHAR, &cnt ); buffer_len += cnt; } @@ -314,9 +312,8 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, } -int Init_Traj( reax_system *system, control_params *control, - output_controls *out_control, mpi_datatypes *mpi_data, - char *msg ) +int Init_Traj(reax_system *system, control_params *control, + output_controls *out_control, MPI_Comm world, char *msg) { char fname[MAX_STR+8]; int atom_line_len[ NR_OPT_ATOM ] = { 0, 0, 0, 0, @@ -346,21 +343,20 @@ int Init_Traj( reax_system *system, control_params *control, /* write trajectory header and atom info, if applicable */ if (out_control->traj_method == REG_TRAJ) { if (system->my_rank == MASTER_NODE) - out_control->strj = fopen( fname, "w" ); + out_control->strj = fopen(fname, "w"); } else { strcpy( msg, "init_traj: unknown trajectory option" ); return FAILURE; } - Write_Header( system, control, out_control, mpi_data ); - Write_Init_Desc( system, control, out_control, mpi_data ); + Write_Header(system, control, out_control); + Write_Init_Desc(system, out_control, world); return SUCCESS; } -int Write_Frame_Header( reax_system *system, control_params *control, - simulation_data *data, output_controls *out_control, - mpi_datatypes * /*mpi_data*/ ) +int Write_Frame_Header(reax_system *system, control_params *control, + simulation_data *data, output_controls *out_control) { int me, num_frm_hdr_lines, my_frm_hdr_lines, buffer_req; @@ -484,8 +480,8 @@ int Write_Frame_Header( reax_system *system, control_params *control, -int Write_Atoms( reax_system *system, control_params * /*control*/, - output_controls *out_control, mpi_datatypes *mpi_data ) +int Write_Atoms(reax_system *system, output_controls *out_control, + MPI_Comm world) { int i, me, np, line_len, buffer_len, buffer_req, cnt; MPI_Status status; @@ -495,8 +491,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, np = system->wsize; line_len = out_control->atom_line_len; - Write_Skip_Line( out_control, mpi_data, me, - system->bigN*line_len, system->bigN ); + Write_Skip_Line(out_control, me, system->bigN*line_len, system->bigN); if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) buffer_req = system->bigN * line_len + 1; @@ -542,13 +537,13 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, if (me != MASTER_NODE) { MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ATOM_LINES+me, mpi_data->world ); + np*ATOM_LINES+me, world); } else { buffer_len = system->n * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ATOM_LINES+i, mpi_data->world, &status ); + MPI_CHAR, i, np*ATOM_LINES+i, world, &status ); MPI_Get_count( &status, MPI_CHAR, &cnt ); buffer_len += cnt; } @@ -561,7 +556,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, - output_controls *out_control, mpi_datatypes *mpi_data) + output_controls *out_control, MPI_Comm world) { int i, j, pj, me, np; int my_bonds, num_bonds; @@ -584,9 +579,9 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, } /* allreduce - total number of bonds */ - MPI_Allreduce( &my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, mpi_data->world ); + MPI_Allreduce( &my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world ); - Write_Skip_Line( out_control, mpi_data, me, num_bonds*line_len, num_bonds ); + Write_Skip_Line( out_control, me, num_bonds*line_len, num_bonds ); if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) buffer_req = num_bonds * line_len + 1; @@ -631,13 +626,13 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, if (me != MASTER_NODE) { MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*BOND_LINES+me, mpi_data->world ); + np*BOND_LINES+me, world ); } else { buffer_len = my_bonds * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*BOND_LINES+i, mpi_data->world, &status ); + MPI_CHAR, i, np*BOND_LINES+i, world, &status ); MPI_Get_count( &status, MPI_CHAR, &cnt ); buffer_len += cnt; } @@ -651,7 +646,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, int Write_Angles( reax_system *system, control_params *control, reax_list *bonds, reax_list *thb_intrs, - output_controls *out_control, mpi_datatypes *mpi_data ) + output_controls *out_control, MPI_Comm world) { int i, j, k, pi, pk, me, np; int my_angles, num_angles; @@ -684,9 +679,9 @@ int Write_Angles( reax_system *system, control_params *control, } } /* total number of valences */ - MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, mpi_data->world); + MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, world); - Write_Skip_Line( out_control, mpi_data, me, num_angles*line_len, num_angles ); + Write_Skip_Line( out_control, me, num_angles*line_len, num_angles ); if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) buffer_req = num_angles * line_len + 1; @@ -726,13 +721,13 @@ int Write_Angles( reax_system *system, control_params *control, if (me != MASTER_NODE) { MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ANGLE_LINES+me, mpi_data->world ); + np*ANGLE_LINES+me, world ); } else { buffer_len = my_angles * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ANGLE_LINES+i, mpi_data->world, &status ); + MPI_CHAR, i, np*ANGLE_LINES+i, world, &status ); MPI_Get_count( &status, MPI_CHAR, &cnt ); buffer_len += cnt; } @@ -744,33 +739,33 @@ int Write_Angles( reax_system *system, control_params *control, } -int Append_Frame( reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, mpi_datatypes *mpi_data ) +int Append_Frame(reax_system *system, control_params *control, + simulation_data *data, reax_list **lists, + output_controls *out_control, MPI_Comm world) { - Write_Frame_Header( system, control, data, out_control, mpi_data ); + Write_Frame_Header(system, control, data, out_control); if (out_control->write_atoms) - Write_Atoms( system, control, out_control, mpi_data ); + Write_Atoms(system, out_control, world); if (out_control->write_bonds) - Write_Bonds( system, control, (*lists + BONDS), out_control, mpi_data ); + Write_Bonds(system, control, (*lists + BONDS), out_control, world); if (out_control->write_angles) - Write_Angles( system, control, (*lists + BONDS), (*lists + THREE_BODIES), - out_control, mpi_data ); + Write_Angles(system, control, (*lists + BONDS), (*lists + THREE_BODIES), + out_control, world); return SUCCESS; } -int End_Traj( int my_rank, output_controls *out_control ) +int End_Traj(int my_rank, output_controls *out_control) { if (my_rank == MASTER_NODE) - fclose( out_control->strj ); + fclose(out_control->strj); - free( out_control->buffer ); - free( out_control->line ); + free(out_control->buffer); + free(out_control->line); return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 2ff5995204..cb3f12b6f4 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -28,6 +28,7 @@ #define __TRAJ_H__ #include "reaxc_types.h" +#include #define MAX_TRJ_LINE_LEN 120 #define MAX_TRJ_BUFFER_SIZE (MAX_TRJ_LINE_LEN * 100) @@ -94,10 +95,10 @@ enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; int Init_Traj( reax_system*, control_params*, output_controls*, - mpi_datatypes*, char* ); + MPI_Comm , char* ); int End_Traj( int, output_controls* ); int Append_Frame( reax_system*, control_params*, simulation_data*, - reax_list**, output_controls*, mpi_datatypes* ); + reax_list**, output_controls*, MPI_Comm); #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index fdcd0436e2..b5e5fa911a 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -104,48 +104,14 @@ typedef double rvec4[4]; typedef LAMMPS_NS::tagint rc_tagint; typedef LAMMPS_NS::bigint rc_bigint; -typedef struct -{ - int cnt; - int *index; - void *out_atoms; -} mpi_out_data; - -typedef struct -{ - MPI_Comm world; - MPI_Comm comm_mesh3D; - - MPI_Datatype sys_info; - MPI_Datatype mpi_atom_type; - MPI_Datatype boundary_atom_type; - MPI_Datatype mpi_rvec, mpi_rvec2; - MPI_Datatype restart_atom_type; - - MPI_Datatype header_line; - MPI_Datatype header_view; - MPI_Datatype init_desc_line; - MPI_Datatype init_desc_view; - MPI_Datatype atom_line; - MPI_Datatype atom_view; - MPI_Datatype bond_line; - MPI_Datatype bond_view; - MPI_Datatype angle_line; - MPI_Datatype angle_view; - - mpi_out_data out_buffers[REAX_MAX_NBRS]; - void *in1_buffer; - void *in2_buffer; -} mpi_datatypes; - -typedef struct +struct global_parameters { int n_global; double* l; int vdw_type; -} global_parameters; +}; -typedef struct +struct single_body_parameters { /* Line one in field file */ char name[15]; // Two character atom name @@ -189,10 +155,10 @@ typedef struct double lgcij; double lgre; -} single_body_parameters; +}; /* Two Body Parameters */ -typedef struct { +struct two_body_parameters { /* Bond Order parameters */ double p_bo1,p_bo2,p_bo3,p_bo4,p_bo5,p_bo6; double r_s, r_p, r_pp; // r_o distances in BO formula @@ -217,10 +183,10 @@ typedef struct { double gamma; // note: this parameter is gamma^-3 and not gamma. double v13cor, ovc; -} two_body_parameters; +}; /* 3-body parameters */ -typedef struct { +struct three_body_parameters { /* valence angle */ double theta_00; double p_val1, p_val2, p_val4, p_val7; @@ -230,21 +196,23 @@ typedef struct { /* 3-body conjugation */ double p_coa1; -} three_body_parameters; +}; - -typedef struct{ +struct three_body_header +{ int cnt; three_body_parameters prm[REAX_MAX_3BODY_PARAM]; -} three_body_header; +}; /* hydrogen-bond parameters */ -typedef struct{ +struct hbond_parameters +{ double r0_hb, p_hb1, p_hb2, p_hb3; -} hbond_parameters; +}; /* 4-body parameters */ -typedef struct { +struct four_body_parameters +{ double V1, V2, V3; /* torsion angle */ @@ -252,15 +220,15 @@ typedef struct { /* 4-body conjugation */ double p_cot1; -} four_body_parameters; +}; -typedef struct +struct four_body_header { int cnt; four_body_parameters prm[REAX_MAX_4BODY_PARAM]; -} four_body_header; +}; -typedef struct +struct reax_interaction { int num_atom_types; global_parameters gp; @@ -269,9 +237,9 @@ typedef struct three_body_header ***thbp; hbond_parameters ***hbp; four_body_header ****fbp; -} reax_interaction; +}; -struct _reax_atom +struct reax_atom { rc_tagint orig_id; int imprt_id; @@ -297,9 +265,8 @@ struct _reax_atom double nbr_bo[MAX_BOND]; // BO values of bond between i and nbr double sum_bo, no_lp; // sum of BO values and no. of lone pairs }; -typedef _reax_atom reax_atom; -typedef struct +struct simulation_box { double V; rvec min, max, box_norms; @@ -307,29 +274,9 @@ typedef struct rtensor box, box_inv; rtensor trans, trans_inv; rtensor g; -} simulation_box; - -struct grid_cell -{ - double cutoff; - rvec min, max; - ivec rel_box; - - int mark; - int type; - int str; - int end; - int top; - int* atoms; - struct grid_cell** nbrs; - ivec* nbrs_x; - rvec* nbrs_cp; }; -typedef struct grid_cell grid_cell; - - -typedef struct +struct grid { int total, max_atoms, max_nbrs; ivec ncells; @@ -350,12 +297,10 @@ typedef struct ivec ghost_hbond_span; ivec ghost_bond_span; - grid_cell*** cells; ivec *order; -} grid; +}; - -typedef struct +struct neighbor_proc { int rank; int est_send, est_recv; @@ -369,30 +314,25 @@ typedef struct ivec end_send; ivec str_recv; ivec end_recv; -} neighbor_proc; +}; - - -typedef struct +struct bound_estimate { int N; int exc_gcells; int exc_atoms; -} bound_estimate; +}; - - -typedef struct +struct boundary_cutoff { double ghost_nonb; double ghost_hbond; double ghost_bond; double ghost_cutoff; -} boundary_cutoff; +}; - -struct _LR_lookup_table; // forward declaration -struct _reax_system +struct LR_lookup_table; // forward declaration +struct reax_system { reax_interaction reax_param; @@ -415,16 +355,13 @@ struct _reax_system int mincap,minhbonds; double safezone, saferzone; - _LR_lookup_table **LR; + LR_lookup_table **LR; int omp_active; }; -typedef _reax_system reax_system; - - /* system control parameters */ -typedef struct +struct control_params { char sim_name[REAX_MAX_STR]; int nprocs; @@ -492,10 +429,9 @@ typedef struct LAMMPS_NS::Error *error_ptr; LAMMPS_NS::LAMMPS *lmp_ptr; int me; -} control_params; +}; - -typedef struct +struct thermostat { double T; double xi; @@ -503,10 +439,9 @@ typedef struct double v_xi_old; double G_xi; -} thermostat; +}; - -typedef struct +struct isotropic_barostat { double P; double eps; @@ -514,10 +449,9 @@ typedef struct double v_eps_old; double a_eps; -} isotropic_barostat; +}; - -typedef struct +struct flexible_barostat { rtensor P; double P_scalar; @@ -532,10 +466,9 @@ typedef struct rtensor v_g0_old; rtensor a_g0; -} flexible_barostat; +}; - -typedef struct +struct reax_timing { double start; double end; @@ -550,10 +483,9 @@ typedef struct double qEq; int s_matvecs; int t_matvecs; -} reax_timing; +}; - -typedef struct +struct energy_data { double e_tot; double e_kin; // Total kinetic energy @@ -572,9 +504,9 @@ typedef struct double e_vdW; // Total van der Waals energy double e_ele; // Total electrostatics energy double e_pol; // Polarization energy -} energy_data; +}; -typedef struct +struct simulation_data { int step; int prev_steps; @@ -612,44 +544,40 @@ typedef struct rvec tot_press; reax_timing timing; -} simulation_data; +}; - -typedef struct{ +struct three_body_interaction_data +{ int thb; int pthb; // pointer to the third body on the central atom's nbrlist double theta, cos_theta; rvec dcos_di, dcos_dj, dcos_dk; -} three_body_interaction_data; +}; - -typedef struct { +struct far_neighbor_data { int nbr; ivec rel_box; double d; rvec dvec; -} far_neighbor_data; +}; - -typedef struct { +struct hbond_data { int nbr; int scl; far_neighbor_data *ptr; -} hbond_data; +}; - -typedef struct{ +struct dDelta_data { int wrt; rvec dVal; -} dDelta_data; +}; - -typedef struct{ +struct dbond_data { int wrt; rvec dBO, dBOpi, dBOpi2; -} dbond_data; +}; -typedef struct{ +struct bond_order_data { double BO, BO_s, BO_pi, BO_pi2; double Cdbo, Cdbopi, Cdbopi2; double C1dbo, C2dbo, C3dbo; @@ -657,9 +585,9 @@ typedef struct{ double C1dbopi2, C2dbopi2, C3dbopi2, C4dbopi2; rvec dBOp, dln_BOp_s, dln_BOp_pi, dln_BOp_pi2; double *CdboReduction; -} bond_order_data; +}; -typedef struct { +struct bond_data { int nbr; int sym_index; int dbond_index; @@ -668,32 +596,29 @@ typedef struct { double d; rvec dvec; bond_order_data bo_data; -} bond_data; +}; - -typedef struct { +struct sparse_matrix_entry { int j; double val; -} sparse_matrix_entry; +}; -typedef struct { +struct sparse_matrix { int cap, n, m; int *start, *end; sparse_matrix_entry *entries; -} sparse_matrix; +}; - -typedef struct { +struct reallocate_data { int num_far; int H, Htop; int hbonds, num_hbonds; int bonds, num_bonds; int num_3body; int gcell_atoms; -} reallocate_data; +}; - -typedef struct +struct storage { int allocated; @@ -750,10 +675,9 @@ typedef struct int *valence_angle_atom_myoffset; reallocate_data realloc; -} storage; +}; - -typedef union +union list_type { void *v; three_body_interaction_data *three_body_list; @@ -762,10 +686,9 @@ typedef union dDelta_data *dDelta_list; far_neighbor_data *far_nbr_list; hbond_data *hbond_list; -} list_type; +}; - -struct _reax_list +struct reax_list { int allocated; @@ -779,10 +702,8 @@ struct _reax_list list_type select; class LAMMPS_NS::Error *error_ptr; }; -typedef _reax_list reax_list; - -typedef struct +struct output_controls { FILE *strj; int trj_offset; @@ -818,16 +739,14 @@ typedef struct int debug_level; int energy_update_freq; -} output_controls; +}; - -typedef struct +struct molecule { int atom_count; int atom_list[REAX_MAX_MOLECULE_SIZE]; int mtypes[REAX_MAX_ATOM_TYPES]; -} molecule; - +}; struct LR_data { @@ -856,7 +775,6 @@ struct LR_data } }; - struct cubic_spline_coef { double a, b, c, d; @@ -889,9 +807,7 @@ struct cubic_spline_coef } }; - - -typedef struct _LR_lookup_table +struct LR_lookup_table { double xmin, xmax; int n; @@ -904,7 +820,7 @@ typedef struct _LR_lookup_table cubic_spline_coef *H; cubic_spline_coef *vdW, *CEvd; cubic_spline_coef *ele, *CEclmb; -} LR_lookup_table; +}; /* function pointer defs */ From 112142be35c54918b0faa4c6ee7b19f8688bd4aa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 00:18:47 -0400 Subject: [PATCH 006/119] remove some unused structs, typedefs and data members --- src/USER-OMP/pair_reaxc_omp.cpp | 9 --- src/USER-REAXC/pair_reaxc.cpp | 17 ------ src/USER-REAXC/reaxc_control.cpp | 19 +----- src/USER-REAXC/reaxc_io_tools.cpp | 9 +-- src/USER-REAXC/reaxc_traj.cpp | 7 +-- src/USER-REAXC/reaxc_types.h | 99 ++----------------------------- 6 files changed, 13 insertions(+), 147 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 6bb9377ca3..5e20b06a28 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -201,10 +201,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) system->N = atom->nlocal + atom->nghost; // mine + ghosts system->bigN = static_cast (atom->natoms); // all atoms in the system - system->big_box.V = 0; - system->big_box.box_norms[0] = 0; - system->big_box.box_norms[1] = 0; - system->big_box.box_norms[2] = 0; if (comm->me == 0 ) t_start = MPI_Wtime(); // setup data structures @@ -334,11 +330,6 @@ void PairReaxCOMP::init_style( ) system->bigN = static_cast (atom->natoms); // all atoms in the system system->wsize = comm->nprocs; - system->big_box.V = 0; - system->big_box.box_norms[0] = 0; - system->big_box.box_norms[1] = 0; - system->big_box.box_norms[2] = 0; - if (atom->tag_enable == 0) error->all(FLERR,"Pair style reax/c/omp requires atom IDs"); if (force->newton_pair == 0) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 2897a24d66..c289cf9310 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -101,20 +101,12 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) control->me = system->my_rank = comm->me; - system->my_coords[0] = 0; - system->my_coords[1] = 0; - system->my_coords[2] = 0; system->num_nbrs = 0; system->n = 0; // my atoms system->N = 0; // mine + ghosts system->bigN = 0; // all atoms in the system system->local_cap = 0; system->total_cap = 0; - system->gcell_cap = 0; - system->bndry_cuts.ghost_nonb = 0; - system->bndry_cuts.ghost_hbond = 0; - system->bndry_cuts.ghost_bond = 0; - system->bndry_cuts.ghost_cutoff = 0; system->my_atoms = nullptr; system->pair_ptr = this; system->error_ptr = error; @@ -378,11 +370,6 @@ void PairReaxC::init_style( ) system->bigN = static_cast (atom->natoms); // all atoms in the system system->wsize = comm->nprocs; - system->big_box.V = 0; - system->big_box.box_norms[0] = 0; - system->big_box.box_norms[1] = 0; - system->big_box.box_norms[2] = 0; - if (atom->tag_enable == 0) error->all(FLERR,"Pair style reax/c requires atom IDs"); if (force->newton_pair == 0) @@ -525,10 +512,6 @@ void PairReaxC::compute(int eflag, int vflag) system->N = atom->nlocal + atom->nghost; // mine + ghosts system->bigN = static_cast (atom->natoms); // all atoms in the system - system->big_box.V = 0; - system->big_box.box_norms[0] = 0; - system->big_box.box_norms[1] = 0; - system->big_box.box_norms[2] = 0; if (comm->me == 0 ) t_start = MPI_Wtime(); // setup data structures diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 6496f27ab5..b74c07a5fe 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -53,12 +53,8 @@ void Read_Control_File(const char *control_file, control_params *control, strcpy( control->sim_name, "simulate" ); control->ensemble = NVE; control->nsteps = 0; - control->dt = 0.25; - control->nprocs = 1; + control->dt = 0.0; control->nthreads = 1; - control->procs_by_dim[0] = 1; - control->procs_by_dim[1] = 1; - control->procs_by_dim[2] = 1; control->geo_format = 1; control->restart = 0; @@ -139,19 +135,10 @@ void Read_Control_File(const char *control_file, control_params *control, control->nsteps = ival; } else if ( strcmp(tmp[0], "dt") == 0) { - val = atof(tmp[1]); - control->dt = val * 1.e-3; // convert dt from fs to ps! + ; // ignore } else if (strcmp(tmp[0], "proc_by_dim") == 0) { - ival = atoi(tmp[1]); - control->procs_by_dim[0] = ival; - ival = atoi(tmp[2]); - control->procs_by_dim[1] = ival; - ival = atoi(tmp[3]); - control->procs_by_dim[2] = ival; - - control->nprocs = control->procs_by_dim[0]*control->procs_by_dim[1]* - control->procs_by_dim[2]; + ; // ignore } else if (strcmp(tmp[0], "random_vel") == 0) { ival = atoi(tmp[1]); diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 290b559817..52e6a0c108 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -126,12 +126,9 @@ void Output_Results(reax_system *system, control_params *control, data->ext_press[0], data->ext_press[1], data->ext_press[2], data->kin_press ); - fprintf( out_control->prs, - "%8s%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f\n", - "",system->big_box.box_norms[0], system->big_box.box_norms[1], - system->big_box.box_norms[2], - data->tot_press[0], data->tot_press[1], data->tot_press[2], - system->big_box.V ); + fprintf(out_control->prs, + "%8s%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f\n", "", 0.0, 0.0, 0.0, + data->tot_press[0], data->tot_press[1], data->tot_press[2], 0.0); fflush( out_control->prs); } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 66968f186e..f97a80f023 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -389,13 +389,10 @@ int Write_Frame_Header(reax_system *system, control_params *control, /* box info */ - sprintf( out_control->line, REAL_LINE, "volume:", system->big_box.V ); + sprintf( out_control->line, REAL_LINE, "volume:", 0.0 ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL3_LINE, "box_dimensions:", - system->big_box.box_norms[0], - system->big_box.box_norms[1], - system->big_box.box_norms[2] ); + sprintf( out_control->line, REAL3_LINE, "box_dimensions:", 0.0, 0.0, 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); sprintf( out_control->line, REAL3_LINE, diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index b5e5fa911a..ee2db705d5 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------- +/*- -*- c++ -*- -------------------------------------------------------- PuReMD - Purdue ReaxFF Molecular Dynamics Program Copyright (2010) Purdue University @@ -24,8 +24,8 @@ . ----------------------------------------------------------------------*/ -#ifndef __REAX_TYPES_H_ -#define __REAX_TYPES_H_ +#ifndef LMP_REAXC_TYPES_H +#define LMP_REAXC_TYPES_H #include "lmptype.h" #include @@ -98,7 +98,6 @@ typedef int ivec[3]; typedef double rvec[3]; typedef double rtensor[3][3]; typedef double rvec2[2]; -typedef double rvec4[4]; // import LAMMPS' definition of tagint and bigint typedef LAMMPS_NS::tagint rc_tagint; @@ -113,9 +112,7 @@ struct global_parameters struct single_body_parameters { - /* Line one in field file */ - char name[15]; // Two character atom name - + char name[4]; // two character atom name double r_s; double valency; // Valency of the atom double mass; // Mass of atom @@ -242,93 +239,17 @@ struct reax_interaction struct reax_atom { rc_tagint orig_id; - int imprt_id; int type; char name[8]; rvec x; // position rvec v; // velocity rvec f; // force - rvec f_old; - double q; // charge - rvec4 s; // they take part in - rvec4 t; // computing q int Hindex; int num_bonds; int num_hbonds; - int renumber; - - int numbonds; // true number of bonds around atoms - int nbr_id[MAX_BOND]; // ids of neighbors around atoms - double nbr_bo[MAX_BOND]; // BO values of bond between i and nbr - double sum_bo, no_lp; // sum of BO values and no. of lone pairs -}; - -struct simulation_box -{ - double V; - rvec min, max, box_norms; - - rtensor box, box_inv; - rtensor trans, trans_inv; - rtensor g; -}; - -struct grid -{ - int total, max_atoms, max_nbrs; - ivec ncells; - rvec cell_len; - rvec inv_len; - - ivec bond_span; - ivec nonb_span; - ivec vlist_span; - - ivec native_cells; - ivec native_str; - ivec native_end; - - double ghost_cut; - ivec ghost_span; - ivec ghost_nonb_span; - ivec ghost_hbond_span; - ivec ghost_bond_span; - - ivec *order; -}; - -struct neighbor_proc -{ - int rank; - int est_send, est_recv; - int atoms_str, atoms_cnt; - ivec rltv, prdc; - rvec bndry_min, bndry_max; - - int send_type; - int recv_type; - ivec str_send; - ivec end_send; - ivec str_recv; - ivec end_recv; -}; - -struct bound_estimate -{ - int N; - int exc_gcells; - int exc_atoms; -}; - -struct boundary_cutoff -{ - double ghost_nonb; - double ghost_hbond; - double ghost_bond; - double ghost_cutoff; }; struct LR_lookup_table; // forward declaration @@ -338,15 +259,8 @@ struct reax_system rc_bigint bigN; int n, N, numH; - int local_cap, total_cap, gcell_cap, Hcap; - int est_recv, est_trans, max_recved; + int local_cap, total_cap, Hcap; int wsize, my_rank, num_nbrs; - ivec my_coords; - neighbor_proc my_nbrs[REAX_MAX_NBRS]; - int *global_offset; - simulation_box big_box, my_box, my_ext_box; - grid my_grid; - boundary_cutoff bndry_cuts; reax_atom *my_atoms; LAMMPS_NS::Error *error_ptr; @@ -364,9 +278,7 @@ struct reax_system struct control_params { char sim_name[REAX_MAX_STR]; - int nprocs; int nthreads; - ivec procs_by_dim; /* ensemble values: 0 : NVE 1 : bNVT (Berendsen) @@ -738,7 +650,6 @@ struct output_controls int restart_freq; int debug_level; int energy_update_freq; - }; struct molecule From 54ee33fe5806ecaeb5be182b828a0b50fce98c6c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 04:48:02 -0400 Subject: [PATCH 007/119] simplify creation of reaxc fix --- src/USER-OMP/pair_reaxc_omp.cpp | 13 ++----------- src/USER-REAXC/pair_reaxc.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 5e20b06a28..6ed0979fc9 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -360,20 +360,11 @@ void PairReaxCOMP::init_style( ) lists[i].allocated = 0; if (fix_reax == nullptr) { - char **fixarg = new char*[3]; - fixarg[0] = (char *) fix_id; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "REAXC"; - modify->add_fix(3,fixarg); - delete [] fixarg; + modify->add_fix(fmt::format("{} all REAXC",fix_id)); fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; } -#if defined(_OPENMP) - control->nthreads = omp_get_max_threads(); -#else - control->nthreads = 1; -#endif + control->nthreads = comm->nthreads; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c289cf9310..eee48b20f4 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -79,8 +79,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; ghostneigh = 1; - fix_id = new char[24]; - snprintf(fix_id,24,"REAXC_%d",instance_me); + fix_id = utils::strdup("REAXC_" + std::to_string(instance_me)); system = (reax_system *) memory->smalloc(sizeof(reax_system),"reax:system"); @@ -400,12 +399,7 @@ void PairReaxC::init_style( ) lists[i].allocated = 0; if (fix_reax == nullptr) { - char **fixarg = new char*[3]; - fixarg[0] = (char *) fix_id; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "REAXC"; - modify->add_fix(3,fixarg); - delete [] fixarg; + modify->add_fix(fmt::format("{} all REAXC",fix_id)); fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; } } From 7dc21842c2a130b46f83260268616d7ee12f3e6e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 05:40:16 -0400 Subject: [PATCH 008/119] ignore/remove unused control file settings and related functions and data structures --- src/USER-OMP/pair_reaxc_omp.cpp | 2 - src/USER-REAXC/pair_reaxc.cpp | 10 -- src/USER-REAXC/reaxc_allocate.cpp | 37 +++--- src/USER-REAXC/reaxc_control.cpp | 167 ++++++--------------------- src/USER-REAXC/reaxc_defs.h | 3 - src/USER-REAXC/reaxc_forces.cpp | 22 +--- src/USER-REAXC/reaxc_init_md.cpp | 2 +- src/USER-REAXC/reaxc_io_tools.cpp | 17 +-- src/USER-REAXC/reaxc_reset_tools.cpp | 21 ---- src/USER-REAXC/reaxc_traj.cpp | 80 ++++--------- src/USER-REAXC/reaxc_types.h | 88 +------------- 11 files changed, 80 insertions(+), 369 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 6ed0979fc9..505ca1467f 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -393,8 +393,6 @@ void PairReaxCOMP::setup( ) int *num_bonds = fix_reax->num_bonds; int *num_hbonds = fix_reax->num_hbonds; - control->vlist_cut = neighbor->cutneighmax; - // determine the local and total capacity system->local_cap = MAX( (int)(system->n * safezone), mincap ); diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index eee48b20f4..768827fb58 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -204,19 +204,15 @@ void PairReaxC::settings(int narg, char **arg) if (strcmp(arg[0],"NULL") == 0) { strcpy( control->sim_name, "simulate" ); - control->ensemble = 0; out_control->energy_update_freq = 0; control->tabulate = 0; - control->reneighbor = 1; - control->vlist_cut = control->nonb_cut; control->bond_cut = 5.; control->hbond_cut = 7.50; control->thb_cut = 0.001; control->thb_cutsq = 0.00001; control->bg_cut = 0.3; - // Initialize for when omp style included control->nthreads = 1; out_control->write_steps = 0; @@ -281,10 +277,6 @@ void PairReaxC::settings(int narg, char **arg) iarg += 2; } else error->all(FLERR,"Illegal pair_style reax/c command"); } - - // LAMMPS is responsible for generating nbrs - - control->reneighbor = 1; } /* ---------------------------------------------------------------------- */ @@ -424,8 +416,6 @@ void PairReaxC::setup( ) int *num_bonds = fix_reax->num_bonds; int *num_hbonds = fix_reax->num_hbonds; - control->vlist_cut = neighbor->cutneighmax; - // determine the local and total capacity system->local_cap = MAX( (int)(system->n * safezone), mincap ); diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 9ba92b9dfa..0c565e5c33 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -164,7 +164,6 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) sfree(control->error_ptr, workspace->b_prm, "b_prm" ); sfree(control->error_ptr, workspace->s, "s" ); sfree(control->error_ptr, workspace->t, "t" ); - sfree(control->error_ptr, workspace->droptol, "droptol" ); sfree(control->error_ptr, workspace->b, "b" ); sfree(control->error_ptr, workspace->x, "x" ); @@ -263,8 +262,6 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, workspace->b_prm = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prm"); workspace->s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "s"); workspace->t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "t"); - workspace->droptol = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "droptol"); workspace->b = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "b"); workspace->x = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "x"); @@ -398,8 +395,9 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, void ReAllocate( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists ) { + auto error = system->error_ptr; int num_bonds, est_3body, Hflag, ret; - int renbr, newsize; + int newsize; reallocate_data *realloc; reax_list *far_nbrs; char msg[200]; @@ -428,7 +426,7 @@ void ReAllocate( reax_system *system, control_params *control, if (ret != SUCCESS) { char errmsg[256]; snprintf(errmsg, 256, "Not enough space for atom_list: total_cap=%d", system->total_cap); - system->error_ptr->one(FLERR, errmsg); + error->one(FLERR, errmsg); } /* workspace */ @@ -438,29 +436,24 @@ void ReAllocate( reax_system *system, control_params *control, if (ret != SUCCESS) { char errmsg[256]; snprintf(errmsg, 256, "Not enough space for workspace: local_cap=%d total_cap=%d", system->local_cap, system->total_cap); - system->error_ptr->one(FLERR, errmsg); + error->one(FLERR, errmsg); } } - - renbr = (data->step - data->prev_steps) % control->reneighbor == 0; /* far neighbors */ - if (renbr) { - far_nbrs = *lists + FAR_NBRS; - if (Nflag || realloc->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { - if (realloc->num_far > far_nbrs->num_intrs) { - char errmsg[256]; - snprintf(errmsg, 256, "step%d-ran out of space on far_nbrs: top=%d, max=%d", data->step, realloc->num_far, far_nbrs->num_intrs); - system->error_ptr->one(FLERR, errmsg); - } + far_nbrs = *lists + FAR_NBRS; - newsize = static_cast - (MAX( realloc->num_far*safezone, mincap*REAX_MIN_NBRS)); + if (Nflag || realloc->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { + if (realloc->num_far > far_nbrs->num_intrs) + error->one(FLERR,fmt::format("step{}: ran out of space on far_nbrs: top={}, max={}", + data->step, realloc->num_far, far_nbrs->num_intrs)); - Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize); - realloc->num_far = 0; - } + newsize = static_cast + (MAX( realloc->num_far*safezone, mincap*REAX_MIN_NBRS)); + + Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize); + realloc->num_far = 0; } /* hydrogen bonds list */ @@ -498,7 +491,7 @@ void ReAllocate( reax_system *system, control_params *control, if ( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, (*lists)+THREE_BODIES )) { - system->error_ptr->one(FLERR, "Problem in initializing angles list"); + error->one(FLERR, "Problem in initializing angles list"); } realloc->num_3body = -1; } diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index b74c07a5fe..93cb642a1f 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -51,23 +51,11 @@ void Read_Control_File(const char *control_file, control_params *control, getsyserror())); /* assign default values */ strcpy( control->sim_name, "simulate" ); - control->ensemble = NVE; - control->nsteps = 0; - control->dt = 0.0; control->nthreads = 1; - control->geo_format = 1; - control->restart = 0; - out_control->restart_format = WRITE_BINARY; - out_control->restart_freq = 0; - control->reposition_atoms = 0; - control->restrict_bonds = 0; - control->remove_CoM_vel = 25; out_control->debug_level = 0; out_control->energy_update_freq = 0; - control->reneighbor = 1; - control->vlist_cut = control->nonb_cut; control->bond_cut = 5.0; control->bg_cut = 0.3; control->thb_cut = 0.001; @@ -76,23 +64,6 @@ void Read_Control_File(const char *control_file, control_params *control, control->tabulate = 0; - control->qeq_freq = 1; - control->q_err = 1e-6; - control->refactor = 100; - control->droptol = 1e-2;; - - control->T_init = 0.; - control->T_final = 300.; - control->Tau_T = 500.0; - control->T_mode = 0; - control->T_rate = 1.; - control->T_freq = 1.; - - control->P[0] = control->P[1] = control->P[2] = 0.000101325; - control->Tau_P[0] = control->Tau_P[1] = control->Tau_P[2] = 500.0; - control->Tau_PT[0] = control->Tau_PT[1] = control->Tau_PT[2] = 500.0; - control->compressibility = 1.0; - control->press_mode = 0; control->virial = 0; out_control->write_steps = 0; @@ -103,13 +74,6 @@ void Read_Control_File(const char *control_file, control_params *control, out_control->bond_info = 0; out_control->angle_info = 0; - control->molecular_analysis = 0; - control->dipole_anal = 0; - control->freq_dipole_anal = 0; - control->diffusion_coef = 0; - control->freq_diffusion_coef = 0; - control->restrict_type = 0; - /* memory allocations */ s = (char*) malloc(sizeof(char)*MAX_LINE); tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); @@ -125,14 +89,10 @@ void Read_Control_File(const char *control_file, control_params *control, strcpy( control->sim_name, tmp[1] ); } else if (strcmp(tmp[0], "ensemble_type") == 0) { - ival = atoi(tmp[1]); - control->ensemble = ival; - if (ival == iNPT || ival ==sNPT || ival == NPT) - control->virial = 1; + ; // ignore } else if (strcmp(tmp[0], "nsteps") == 0) { - ival = atoi(tmp[1]); - control->nsteps = ival; + ; // ignore } else if ( strcmp(tmp[0], "dt") == 0) { ; // ignore @@ -141,28 +101,22 @@ void Read_Control_File(const char *control_file, control_params *control, ; // ignore } else if (strcmp(tmp[0], "random_vel") == 0) { - ival = atoi(tmp[1]); - control->random_vel = ival; + ; // ignore } else if (strcmp(tmp[0], "restart_format") == 0) { - ival = atoi(tmp[1]); - out_control->restart_format = ival; + ; // ignore } else if (strcmp(tmp[0], "restart_freq") == 0) { - ival = atoi(tmp[1]); - out_control->restart_freq = ival; + ; // ignore } else if (strcmp(tmp[0], "reposition_atoms") == 0) { - ival = atoi(tmp[1]); - control->reposition_atoms = ival; + ; // ignore } else if (strcmp(tmp[0], "restrict_bonds") == 0) { - ival = atoi( tmp[1] ); - control->restrict_bonds = ival; + ; // ignore } else if (strcmp(tmp[0], "remove_CoM_vel") == 0) { - ival = atoi(tmp[1]); - control->remove_CoM_vel = ival; + ; // ignore } else if (strcmp(tmp[0], "debug_level") == 0) { ival = atoi(tmp[1]); @@ -173,12 +127,10 @@ void Read_Control_File(const char *control_file, control_params *control, out_control->energy_update_freq = ival; } else if (strcmp(tmp[0], "reneighbor") == 0) { - ival = atoi( tmp[1] ); - control->reneighbor = ival; + ; // ignore } else if (strcmp(tmp[0], "vlist_buffer") == 0) { - val = atof(tmp[1]); - control->vlist_cut= val + control->nonb_cut; + ; // ignore } else if (strcmp(tmp[0], "nbrhood_cutoff") == 0) { val = atof(tmp[1]); @@ -201,97 +153,59 @@ void Read_Control_File(const char *control_file, control_params *control, control->hbond_cut = val; } else if (strcmp(tmp[0], "ghost_cutoff") == 0) { - val = atof(tmp[1]); - control->user_ghost_cut = val; + ; // ignore } else if (strcmp(tmp[0], "tabulate_long_range") == 0) { ival = atoi( tmp[1] ); control->tabulate = ival; } else if (strcmp(tmp[0], "qeq_freq") == 0) { - ival = atoi( tmp[1] ); - control->qeq_freq = ival; + ; // ignore } else if (strcmp(tmp[0], "q_err") == 0) { - val = atof( tmp[1] ); - control->q_err = val; + ; // ignore } else if (strcmp(tmp[0], "ilu_refactor") == 0) { - ival = atoi( tmp[1] ); - control->refactor = ival; + ; // ignore } else if (strcmp(tmp[0], "ilu_droptol") == 0) { - val = atof( tmp[1] ); - control->droptol = val; + ; // ignore } else if (strcmp(tmp[0], "temp_init") == 0) { - val = atof(tmp[1]); - control->T_init = val; - - if (control->T_init < 0.1) - control->T_init = 0.1; + ; // ignore } else if (strcmp(tmp[0], "temp_final") == 0) { - val = atof(tmp[1]); - control->T_final = val; - - if (control->T_final < 0.1) - control->T_final = 0.1; + ; // ignore } else if (strcmp(tmp[0], "t_mass") == 0) { - val = atof(tmp[1]); - control->Tau_T = val * 1.e-3; // convert t_mass from fs to ps + ; // ignore } else if (strcmp(tmp[0], "t_mode") == 0) { - ival = atoi(tmp[1]); - control->T_mode = ival; + ; // ignore } else if (strcmp(tmp[0], "t_rate") == 0) { - val = atof(tmp[1]); - control->T_rate = val; + ; // ignore } else if (strcmp(tmp[0], "t_freq") == 0) { - val = atof(tmp[1]); - control->T_freq = val; + ; // ignore } else if (strcmp(tmp[0], "pressure") == 0) { - if (control->ensemble == iNPT) { - control->P[0] = control->P[1] = control->P[2] = atof(tmp[1]); - } - else if (control->ensemble == sNPT) { - control->P[0] = atof(tmp[1]); - control->P[1] = atof(tmp[2]); - control->P[2] = atof(tmp[3]); - } + ; // ignore } else if (strcmp(tmp[0], "p_mass") == 0) { - // convert p_mass from fs to ps - if (control->ensemble == iNPT) { - control->Tau_P[0] = control->Tau_P[1] = control->Tau_P[2] = - atof(tmp[1]) * 1.e-3; - } - else if (control->ensemble == sNPT) { - control->Tau_P[0] = atof(tmp[1]) * 1.e-3; - control->Tau_P[1] = atof(tmp[2]) * 1.e-3; - control->Tau_P[2] = atof(tmp[3]) * 1.e-3; - } + ; // ignore } else if (strcmp(tmp[0], "pt_mass") == 0) { - val = atof(tmp[1]); - control->Tau_PT[0] = control->Tau_PT[1] = control->Tau_PT[2] = - val * 1.e-3; // convert pt_mass from fs to ps + ; // ignore } else if (strcmp(tmp[0], "compress") == 0) { - val = atof(tmp[1]); - control->compressibility = val; + ; // ignore } else if (strcmp(tmp[0], "press_mode") == 0) { - ival = atoi(tmp[1]); - control->press_mode = ival; + ; // ignore } else if (strcmp(tmp[0], "geo_format") == 0) { - ival = atoi( tmp[1] ); - control->geo_format = ival; + ; // ignore } else if (strcmp(tmp[0], "write_freq") == 0) { ival = atoi(tmp[1]); @@ -329,33 +243,25 @@ void Read_Control_File(const char *control_file, control_params *control, out_control->angle_info = ival; } else if (strcmp(tmp[0], "molecular_analysis") == 0) { - ival = atoi(tmp[1]); - control->molecular_analysis = ival; + ; // ignore } else if (strcmp(tmp[0], "ignore") == 0) { - control->num_ignored = atoi(tmp[1]); - for (i = 0; i < control->num_ignored; ++i) - control->ignore[atoi(tmp[i+2])] = 1; + ; // ignore } else if (strcmp(tmp[0], "dipole_anal") == 0) { - ival = atoi(tmp[1]); - control->dipole_anal = ival; + ; // ignore } else if (strcmp(tmp[0], "freq_dipole_anal") == 0) { - ival = atoi(tmp[1]); - control->freq_dipole_anal = ival; + ; // ignore } else if (strcmp(tmp[0], "diffusion_coef") == 0) { - ival = atoi(tmp[1]); - control->diffusion_coef = ival; + ; // ignore } else if (strcmp(tmp[0], "freq_diffusion_coef") == 0) { - ival = atoi(tmp[1]); - control->freq_diffusion_coef = ival; + ; // ignore } else if (strcmp(tmp[0], "restrict_type") == 0) { - ival = atoi(tmp[1]); - control->restrict_type = ival; + ; // ignore } else { char errmsg[128]; @@ -364,11 +270,6 @@ void Read_Control_File(const char *control_file, control_params *control, } } - /* determine target T */ - if (control->T_mode == 0) - control->T = control->T_final; - else control->T = control->T_init; - /* free memory allocations at the top */ for (i = 0; i < MAX_TOKENS; i++) free( tmp[i] ); diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h index 3ead22842a..4103f06129 100644 --- a/src/USER-REAXC/reaxc_defs.h +++ b/src/USER-REAXC/reaxc_defs.h @@ -115,12 +115,9 @@ #define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ /******************* ENUMERATIONS *************************/ -enum geo_formats { CUSTOM, PDB, ASCII_RESTART, BINARY_RESTART, GF_N }; enum restart_formats { WRITE_ASCII, WRITE_BINARY, RF_N }; -enum ensembles { NVE, bNVT, nhNVT, sNPT, iNPT, NPT, ens_N }; - enum lists { BONDS, OLD_BONDS, THREE_BODIES, HBONDS, FAR_NBRS, DBOS, DDELTAS, LIST_N }; diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 0289c08504..f5f3db89ad 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -180,7 +180,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, int type_i, type_j; int btop_i, num_bonds, num_hbonds; int ihb, jhb, ihb_top, jhb_top; - int local, flag, renbr; + int local, flag; double cutoff; reax_list *far_nbrs, *bonds, *hbonds; single_body_parameters *sbp_i, *sbp_j; @@ -201,7 +201,6 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, num_bonds = 0; num_hbonds = 0; btop_i = 0; - renbr = (data->step-data->prev_steps) % control->reneighbor == 0; for (i = 0; i < system->N; ++i) { atom_i = &(system->my_atoms[i]); @@ -235,22 +234,9 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, j = nbr_pj->nbr; atom_j = &(system->my_atoms[j]); - if (renbr) { - if (nbr_pj->d <= cutoff) - flag = 1; - else flag = 0; - } else { - nbr_pj->dvec[0] = atom_j->x[0] - atom_i->x[0]; - nbr_pj->dvec[1] = atom_j->x[1] - atom_i->x[1]; - nbr_pj->dvec[2] = atom_j->x[2] - atom_i->x[2]; - nbr_pj->d = rvec_Norm_Sqr( nbr_pj->dvec ); - if (nbr_pj->d <= SQR(cutoff)) { - nbr_pj->d = sqrt(nbr_pj->d); - flag = 1; - } else { - flag = 0; - } - } + if (nbr_pj->d <= cutoff) + flag = 1; + else flag = 0; if (flag) { type_j = atom_j->type; diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 23c20d1c21..9009f7995c 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -78,7 +78,7 @@ int Init_Simulation_Data(reax_system *system, control_params *control, data->timing.start = MPI_Wtime(); } - data->step = data->prev_steps = 0; + data->step = 0; return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 52e6a0c108..581ddf84ec 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -60,20 +60,6 @@ int Init_Output_Files(reax_system *system, control_params *control, } /* init pressure file */ - if ( control->ensemble == NPT || - control->ensemble == iNPT || - control->ensemble == sNPT) { - sprintf( temp, "%s.prs", control->sim_name ); - if ((out_control->prs = fopen( temp, "w" )) != nullptr) { - fprintf(out_control->prs,"%8s%13s%13s%13s%13s%13s%13s%13s\n", - "step", "Pint/norm[x]", "Pint/norm[y]", "Pint/norm[z]", - "Pext/Ptot[x]", "Pext/Ptot[y]", "Pext/Ptot[z]", "Pkin/V" ); - fflush( out_control->prs ); - } else { - strcpy(msg,"init_out_controls: .prs file couldn't be opened\n"); - return FAILURE; - } - } } return SUCCESS; @@ -135,8 +121,7 @@ void Output_Results(reax_system *system, control_params *control, } /* write current frame */ - if ( out_control->write_steps > 0 && - (data->step-data->prev_steps) % out_control->write_steps == 0) { + if ( out_control->write_steps > 0 && data->step % out_control->write_steps == 0) { Append_Frame( system, control, data, lists, out_control, world); } } diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 4367be8217..fa56b471ff 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -73,31 +73,10 @@ void Reset_Energies( energy_data *en ) en->e_tot = 0; } - -void Reset_Temperatures( simulation_data *data ) -{ - data->therm.T = 0; -} - - -void Reset_Pressures( simulation_data *data ) -{ - data->flex_bar.P_scalar = 0; - rtensor_MakeZero( data->flex_bar.P ); - - data->iso_bar.P = 0; - rvec_MakeZero( data->int_press ); - rvec_MakeZero( data->my_ext_press ); - rvec_MakeZero( data->ext_press ); -} - - void Reset_Simulation_Data( simulation_data* data, int /*virial*/ ) { Reset_Energies( &data->my_en ); Reset_Energies( &data->sys_en ); - Reset_Temperatures( data ); - Reset_Pressures( data ); } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index f97a80f023..da7c7955e5 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -63,11 +63,6 @@ int Write_Header(reax_system *system, control_params *control, output_controls *out_control) { int num_hdr_lines, my_hdr_lines, buffer_req; - char ensembles[ens_N][25] = { "NVE", "NVT", "fully flexible NPT", - "semi isotropic NPT", "isotropic NPT" }; - char reposition[3][25] = { "fit to periodic box", "CoM to center of box", - "CoM to origin" }; - char t_regime[3][25] = { "T-coupling only", "step-wise", "constant slope" }; char traj_methods[TF_N][10] = { "custom", "xyz" }; char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", @@ -106,29 +101,23 @@ int Write_Header(reax_system *system, control_params *control, sprintf( out_control->line, BIGINT_LINE, "number_of_atoms:", system->bigN ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "ensemble_type:", - ensembles[ control->ensemble ] ); + sprintf( out_control->line, STR_LINE, "ensemble_type:", "(unknown)"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, INT_LINE, "number_of_steps:", - control->nsteps ); + sprintf( out_control->line, INT_LINE, "number_of_steps:", 0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "timestep_length_(in_fs):", - control->dt * 1000 ); + sprintf( out_control->line, REAL_LINE, "timestep_length_(in_fs):", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* restart info */ - sprintf( out_control->line, STR_LINE, "is_this_a_restart?:", - (control->restart ? "yes" : "no") ); + sprintf( out_control->line, STR_LINE, "is_this_a_restart?:", "no"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "write_restart_files?:", - ((out_control->restart_freq > 0) ? "yes" : "no") ); + sprintf( out_control->line, STR_LINE, "write_restart_files?:", "no"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, INT_LINE, "frequency_to_write_restarts:", - out_control->restart_freq ); + sprintf( out_control->line, INT_LINE, "frequency_to_write_restarts:", 0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* preferences */ @@ -139,23 +128,18 @@ int Write_Header(reax_system *system, control_params *control, sprintf( out_control->line, INT_LINE, "table_size:", control->tabulate ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "restrict_bonds?:", - (control->restrict_bonds ? "yes" : "no") ); + sprintf( out_control->line, STR_LINE, "restrict_bonds?:", "no"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, INT_LINE, "bond_restriction_length:", - control->restrict_bonds ); + sprintf( out_control->line, INT_LINE, "bond_restriction_length:", 0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "reposition_atoms?:", - reposition[control->reposition_atoms] ); + sprintf( out_control->line, STR_LINE, "reposition_atoms?:", "fit to periodic box"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, INT_LINE, "remove_CoM_velocity?:", - (control->ensemble==NVE) ? 0 : control->remove_CoM_vel); + sprintf( out_control->line, INT_LINE, "remove_CoM_velocity?:", 0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - /* cut-off values */ sprintf( out_control->line, REAL_LINE, "bonded_intr_dist_cutoff:", control->bond_cut ); @@ -181,37 +165,30 @@ int Write_Header(reax_system *system, control_params *control, control->thb_cut ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, SCI_LINE, "QEq_tolerance:", control->q_err ); + sprintf( out_control->line, SCI_LINE, "QEq_tolerance:", 0.0 ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* temperature controls */ - sprintf( out_control->line, REAL_LINE, "initial_temperature:", - control->T_init ); + sprintf( out_control->line, REAL_LINE, "initial_temperature:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "target_temperature:", - control->T_final ); + sprintf( out_control->line, REAL_LINE, "target_temperature:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "thermal_inertia:", - control->Tau_T ); + sprintf( out_control->line, REAL_LINE, "thermal_inertia:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "temperature_regime:", - t_regime[ control->T_mode ] ); + sprintf( out_control->line, STR_LINE, "temperature_regime:", "(unknown)"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "temperature_change_rate_(K/ps):", - control->T_rate / control->T_freq ); + sprintf( out_control->line, REAL_LINE, "temperature_change_rate_(K/ps):", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* pressure controls */ - sprintf( out_control->line, REAL3_LINE, "target_pressure_(GPa):", - control->P[0], control->P[1], control->P[2] ); + sprintf( out_control->line, REAL3_LINE, "target_pressure_(GPa):", 0.0, 0.0, 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL3_LINE, "virial_inertia:", - control->Tau_P[0], control->Tau_P[1], control->Tau_P[2] ); + sprintf( out_control->line, REAL3_LINE, "virial_inertia:", 0.0, 0.0, 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* trajectory */ @@ -244,12 +221,9 @@ int Write_Header(reax_system *system, control_params *control, strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* analysis */ - //sprintf( out_control->line, STR_LINE, "molecular_analysis:", - // (control->molec_anal ? "yes" : "no") ); - //strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "molecular_analysis_frequency:", - control->molecular_analysis ); + sprintf( out_control->line, STR_LINE, "molecular_analysis:", "no"); + strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + sprintf( out_control->line, INT_LINE, "molecular_analysis_frequency:", 0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); } @@ -383,11 +357,9 @@ int Write_Frame_Header(reax_system *system, control_params *control, sprintf( out_control->line, INT_LINE, "step:", data->step ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "time_in_ps:", - data->step * control->dt ); + sprintf( out_control->line, REAL_LINE, "time_in_ps:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - /* box info */ sprintf( out_control->line, REAL_LINE, "volume:", 0.0 ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); @@ -399,17 +371,13 @@ int Write_Frame_Header(reax_system *system, control_params *control, "coordinate_angles:", 90.0, 90.0, 90.0 ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - /* system T and P */ - sprintf( out_control->line, REAL_LINE, "temperature:", data->therm.T ); + sprintf( out_control->line, REAL_LINE, "temperature:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "pressure:", - (control->ensemble==iNPT) ? - data->iso_bar.P : data->flex_bar.P_scalar ); + sprintf( out_control->line, REAL_LINE, "pressure:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - /* energies */ sprintf( out_control->line, REAL_LINE, "total_energy:", data->sys_en.e_tot ); diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index ee2db705d5..b8be985994 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -279,30 +279,10 @@ struct control_params { char sim_name[REAX_MAX_STR]; int nthreads; - /* ensemble values: - 0 : NVE - 1 : bNVT (Berendsen) - 2 : nhNVT (Nose-Hoover) - 3 : sNPT (Parrinello-Rehman-Nose-Hoover) semiisotropic - 4 : iNPT (Parrinello-Rehman-Nose-Hoover) isotropic - 5 : NPT (Parrinello-Rehman-Nose-Hoover) Anisotropic*/ - int ensemble; - int nsteps; - double dt; - int geo_format; - int restart; - int restrict_bonds; - int remove_CoM_vel; - int random_vel; - int reposition_atoms; - - int reneighbor; - double vlist_cut; double bond_cut; double nonb_cut, nonb_low; double hbond_cut; - double user_ghost_cut; double bg_cut; double bo_cut; @@ -310,31 +290,7 @@ struct control_params double thb_cutsq; int tabulate; - - int qeq_freq; - double q_err; - int refactor; - double droptol; - - double T_init, T_final, T; - double Tau_T; - int T_mode; - double T_rate, T_freq; - int virial; - rvec P, Tau_P, Tau_PT; - int press_mode; - double compressibility; - - int molecular_analysis; - int num_ignored; - int ignore[REAX_MAX_ATOM_TYPES]; - - int dipole_anal; - int freq_dipole_anal; - int diffusion_coef; - int freq_diffusion_coef; - int restrict_type; int lgflag; int enobondsflag; @@ -343,43 +299,6 @@ struct control_params int me; }; -struct thermostat -{ - double T; - double xi; - double v_xi; - double v_xi_old; - double G_xi; - -}; - -struct isotropic_barostat -{ - double P; - double eps; - double v_eps; - double v_eps_old; - double a_eps; - -}; - -struct flexible_barostat -{ - rtensor P; - double P_scalar; - - double eps; - double v_eps; - double v_eps_old; - double a_eps; - - rtensor h0; - rtensor v_g0; - rtensor v_g0_old; - rtensor a_g0; - -}; - struct reax_timing { double start; @@ -420,8 +339,7 @@ struct energy_data struct simulation_data { - int step; - int prev_steps; + rc_bigint step; double time; double M; // Total Mass @@ -444,9 +362,6 @@ struct simulation_data double N_f; //Number of degrees of freedom rvec t_scale; rtensor p_scale; - thermostat therm; // Used in Nose_Hoover method - isotropic_barostat iso_bar; - flexible_barostat flex_bar; double inv_W; double kin_press; @@ -552,7 +467,6 @@ struct storage /* QEq storage */ sparse_matrix *H, *L, *U; double *Hdia_inv, *b_s, *b_t, *b_prc, *b_prm, *s, *t; - double *droptol; rvec2 *b, *x; /* GMRES storage */ From f0369ce72d365a47d69887c678fcc351e5f921e6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 07:06:56 -0400 Subject: [PATCH 009/119] remove unused timing data structure --- src/USER-OMP/pair_reaxc_omp.cpp | 8 -------- src/USER-OMP/reaxc_init_md_omp.cpp | 7 ++----- src/USER-REAXC/pair_reaxc.cpp | 8 -------- src/USER-REAXC/reaxc_init_md.cpp | 16 ++-------------- src/USER-REAXC/reaxc_reset_tools.cpp | 15 --------------- src/USER-REAXC/reaxc_reset_tools.h | 1 - src/USER-REAXC/reaxc_types.h | 19 ------------------- 7 files changed, 4 insertions(+), 70 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 505ca1467f..e754316ea0 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -178,7 +178,6 @@ PairReaxCOMP::~PairReaxCOMP() void PairReaxCOMP::compute(int eflag, int vflag) { double evdwl,ecoul; - double t_start, t_end; // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them @@ -201,7 +200,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) system->N = atom->nlocal + atom->nghost; // mine + ghosts system->bigN = static_cast (atom->natoms); // all atoms in the system - if (comm->me == 0 ) t_start = MPI_Wtime(); // setup data structures setup(); @@ -213,12 +211,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) //workspace->realloc.num_far = write_reax_lists(); write_reax_lists(); - // timing for filling in the reax lists - if (comm->me == 0) { - t_end = MPI_Wtime(); - data->timing.nbrs = t_end - t_start; - } - // forces #ifdef OMP_TIMING diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index bb7d102141..9652b52fe7 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -42,7 +42,7 @@ // Functions defined in reaxc_init_md.cpp extern void Init_System(reax_system*, control_params*); -extern int Init_Simulation_Data(reax_system*, control_params*, simulation_data*, char*); +extern void Init_Simulation_Data(control_params*, simulation_data*); extern int Init_Workspace(reax_system*, control_params*, storage*, char*); /* ---------------------------------------------------------------------- */ @@ -123,10 +123,7 @@ void InitializeOMP(reax_system *system, control_params *control, LAMMPS_NS::Error *error = system->error_ptr; Init_System(system,control); - - if (Init_Simulation_Data(system,control,data,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Sim_data could not be " - "initialized! Terminating.",msg)); + Init_Simulation_Data(control,data); if (Init_Workspace(system,control,workspace,msg) == FAILURE) error->one(FLERR,"init_workspace: not enough memory. " diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 768827fb58..cb1fe5f64d 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -477,7 +477,6 @@ double PairReaxC::init_one(int i, int j) void PairReaxC::compute(int eflag, int vflag) { double evdwl,ecoul; - double t_start, t_end; // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them @@ -496,19 +495,12 @@ void PairReaxC::compute(int eflag, int vflag) system->N = atom->nlocal + atom->nghost; // mine + ghosts system->bigN = static_cast (atom->natoms); // all atoms in the system - if (comm->me == 0 ) t_start = MPI_Wtime(); - // setup data structures setup(); Reset( system, control, data, workspace, &lists ); workspace->realloc.num_far = write_reax_lists(); - // timing for filling in the reax lists - if (comm->me == 0) { - t_end = MPI_Wtime(); - data->timing.nbrs = t_end - t_start; - } // forces diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 9009f7995c..b9d46fc3f1 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -68,19 +68,10 @@ void Init_System(reax_system *system, control_params *control) } -int Init_Simulation_Data(reax_system *system, control_params *control, - simulation_data *data, char * /*msg*/) +void Init_Simulation_Data(control_params *control, simulation_data *data) { Reset_Simulation_Data(data, control->virial); - - /* initialize the timer(s) */ - if (system->my_rank == MASTER_NODE) { - data->timing.start = MPI_Wtime(); - } - data->step = 0; - - return SUCCESS; } void Init_Taper(control_params *control, storage *workspace) @@ -210,10 +201,7 @@ void Initialize(reax_system *system, control_params *control, LAMMPS_NS::Error *error = system->error_ptr; Init_System(system,control); - - if (Init_Simulation_Data( system,control,data,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Sim_data could not be " - "initialized! Terminating.",msg)); + Init_Simulation_Data(control,data); if (Init_Workspace( system,control,workspace,msg) == FAILURE) error->one(FLERR,"init_workspace: not enough memory. " diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index fa56b471ff..c32fe6a602 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -79,20 +79,6 @@ void Reset_Simulation_Data( simulation_data* data, int /*virial*/ ) Reset_Energies( &data->sys_en ); } - -void Reset_Timing( reax_timing *rt ) -{ - rt->total = MPI_Wtime(); - rt->comm = 0; - rt->nbrs = 0; - rt->init_forces = 0; - rt->bonded = 0; - rt->nonb = 0; - rt->qEq = 0; - rt->s_matvecs = 0; - rt->t_matvecs = 0; -} - void Reset_Workspace( reax_system *system, storage *workspace ) { memset( workspace->total_bond_order, 0, system->total_cap * sizeof( double ) ); @@ -102,7 +88,6 @@ void Reset_Workspace( reax_system *system, storage *workspace ) } - void Reset_Neighbor_Lists( reax_system *system, control_params *control, storage *workspace, reax_list **lists ) { diff --git a/src/USER-REAXC/reaxc_reset_tools.h b/src/USER-REAXC/reaxc_reset_tools.h index 20d1ab6964..39cda0ac9b 100644 --- a/src/USER-REAXC/reaxc_reset_tools.h +++ b/src/USER-REAXC/reaxc_reset_tools.h @@ -31,7 +31,6 @@ void Reset_Pressures( simulation_data* ); void Reset_Simulation_Data( simulation_data*, int ); -void Reset_Timing( reax_timing* ); void Reset_Workspace( reax_system*, storage* ); void Reset_Neighbor_Lists( reax_system*, control_params*, storage*, reax_list** ); diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index b8be985994..87543ca155 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -299,23 +299,6 @@ struct control_params int me; }; -struct reax_timing -{ - double start; - double end; - double elapsed; - - double total; - double comm; - double nbrs; - double init_forces; - double bonded; - double nonb; - double qEq; - int s_matvecs; - int t_matvecs; -}; - struct energy_data { double e_tot; @@ -369,8 +352,6 @@ struct simulation_data rvec my_ext_press; rvec ext_press; rvec tot_press; - - reax_timing timing; }; struct three_body_interaction_data From def09d4d7a4209562ca2d4bd729bbc9b807df45f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 07:26:53 -0400 Subject: [PATCH 010/119] remove unused simulation data struct members and related code --- src/USER-OMP/reaxc_bond_orders_omp.cpp | 18 +-------------- src/USER-OMP/reaxc_forces_omp.cpp | 8 ------- src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 9 ++------ src/USER-OMP/reaxc_nonbonded_omp.cpp | 11 ++------- src/USER-OMP/reaxc_torsion_angles_omp.cpp | 16 +------------- src/USER-OMP/reaxc_valence_angles_omp.cpp | 8 +------ src/USER-REAXC/reaxc_allocate.cpp | 3 --- src/USER-REAXC/reaxc_bond_orders.cpp | 20 ++--------------- src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 9 ++------ src/USER-REAXC/reaxc_io_tools.cpp | 21 ------------------ src/USER-REAXC/reaxc_nonbonded.cpp | 10 ++------- src/USER-REAXC/reaxc_torsion_angles.cpp | 17 +------------- src/USER-REAXC/reaxc_types.h | 27 ----------------------- src/USER-REAXC/reaxc_valence_angles.cpp | 6 +---- 14 files changed, 15 insertions(+), 168 deletions(-) diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index 499c5f2933..aaebe9c83c 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -234,8 +234,7 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; dbond_coefficients coef; - rvec temp, ext_press; - ivec rel_box; + rvec temp; int pk, k, j; #if defined(_OPENMP) @@ -285,10 +284,6 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, /* force */ rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); - - /* pressure */ - rvec_iMultiply( ext_press, nbr_k->rel_box, temp ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } /* then atom i itself */ @@ -318,13 +313,6 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, /* force */ rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); - - /* pressure */ - if (k != i) { - ivec_Sum( rel_box, nbr_k->rel_box, nbr_j->rel_box ); //rel_box(k, i) - rvec_iMultiply( ext_press, rel_box, temp ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); - } } /* then atom j itself */ @@ -343,10 +331,6 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, /* force */ rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); - - /* pressure */ - rvec_iMultiply( ext_press, nbr_j->rel_box, temp ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 4bed7a3828..956621f4db 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -247,14 +247,6 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, } } // parallel region - if (control->virial) - for (int i=0; i < nthreads; ++i) { - rvec_Add(data->my_ext_press, workspace->my_ext_pressReduction[i]); - workspace->my_ext_pressReduction[i][0] = 0; - workspace->my_ext_pressReduction[i][1] = 0; - workspace->my_ext_pressReduction[i][2] = 0; - } - #ifdef OMP_TIMING endTimeBase = MPI_Wtime(); ompTimingData[COMPUTETFINDEX] += (endTimeBase-startTimeBase); diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index c0fe4e3792..b21b8b7cac 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -72,7 +72,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, e_hb_thr = 0.0, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force, ext_press; + rvec dvec_jk, force; hbond_parameters *hbp; bond_order_data *bo_ij; bond_data *pbond_ij; @@ -197,23 +197,18 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, derivatives are added directly into pressure vector/tensor */ rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms rvec_Add(workspace->forceReduction[reductionOffset+i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_ScaledAdd( workspace->my_ext_pressReduction[tid],1.0, ext_press ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); rvec_Scale( force, +CEhb2, dcos_theta_dk ); rvec_Add(workspace->forceReduction[reductionOffset+k], force ); - rvec_iMultiply( ext_press, rel_jk, force ); - rvec_ScaledAdd( workspace->my_ext_pressReduction[tid],1.0, ext_press ); // dr terms rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk ); rvec_Scale( force, CEhb3/r_jk, dvec_jk ); rvec_Add(workspace->forceReduction[reductionOffset+k], force ); - rvec_iMultiply( ext_press, rel_jk, force ); - rvec_ScaledAdd( workspace->my_ext_pressReduction[tid],1.0, ext_press ); } /* tally into per-atom virials */ diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index 3a4214d306..f4a4e988bc 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -75,7 +75,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, double e_ele, e_vdW, e_core; const double SMALL = 0.0001; double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp, ext_press; + rvec temp; two_body_parameters *twbp; far_neighbor_data *nbr_pj; @@ -230,10 +230,6 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); rvec_ScaledAdd( workspace->f[reductionOffset+i], -1., temp ); rvec_Add( workspace->forceReduction[reductionOffset+j], temp); - - rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); - - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } } } @@ -273,7 +269,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro double e_vdW, e_ele; double CEvd, CEclmb; double f_tmp, delij[3]; - rvec temp, ext_press; + rvec temp; far_neighbor_data *nbr_pj; LR_lookup_table *t; #if defined(_OPENMP) @@ -370,9 +366,6 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro rvec_ScaledAdd( workspace->f[i], -1., temp ); rvec_Add( workspace->forceReduction[froffset+j], temp ); - - rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } } } diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index cb92a9a68c..9fe2542b47 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -103,7 +103,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, double CEconj4, CEconj5, CEconj6; double e_tor, e_con; rvec dvec_li; - rvec force, ext_press; + rvec force; ivec rel_box_jl; // rtensor total_rtensor, temp_rtensor; four_body_header *fbh; @@ -373,16 +373,12 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, /* dcos_theta_ijk */ rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk ); rvec_Add( workspace->forceReduction[reductionOffset+i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_ScaledAdd( workspace->f[j], CEtors7 + CEconj4, p_ijk->dcos_dj ); rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di ); rvec_Add( workspace->forceReduction[reductionOffset+k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); /* dcos_theta_jkl */ rvec_ScaledAdd( workspace->f[j], @@ -390,32 +386,22 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj ); rvec_Add( workspace->forceReduction[reductionOffset+k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk ); rvec_Add( workspace->forceReduction[reductionOffset+l], force ); - rvec_iMultiply( ext_press, rel_box_jl, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); /* dcos_omega */ rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di ); rvec_Add( workspace->forceReduction[reductionOffset+i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_ScaledAdd( workspace->f[j], CEtors9 + CEconj6, dcos_omega_dj ); rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dk ); rvec_Add( workspace->forceReduction[reductionOffset+k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dl ); rvec_Add( workspace->forceReduction[reductionOffset+i], force ); - rvec_iMultiply( ext_press, rel_box_jl, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } /* tally into per-atom virials */ diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 8b6f1e7617..7c417c0678 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -154,7 +154,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, double f7_ij, f7_jk, f8_Dj, f9_Dj; double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; double BOA_ij, BOA_jk; - rvec force, ext_press; + rvec force; // rtensor temp_rtensor, total_rtensor; // Tallying variables @@ -552,16 +552,10 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, rvec_Scale( force, CEval8, p_ijk->dcos_di ); rvec_Add( workspace->forceReduction[reductionOffset+i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); rvec_Scale( force, CEval8, p_ijk->dcos_dk ); rvec_Add( workspace->forceReduction[reductionOffset+k], force ); - - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); } /* tally into per-atom virials */ diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 0c565e5c33..455e8f9ada 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -60,7 +60,6 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, workspace->CdDeltaReduction = nullptr; workspace->forceReduction = nullptr; workspace->valence_angle_atom_myoffset = nullptr; - workspace->my_ext_pressReduction = nullptr; #else LMP_UNUSED_PARAM(workspace); #endif @@ -201,7 +200,6 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) if (workspace->CdDeltaReduction) sfree(control->error_ptr, workspace->CdDeltaReduction, "cddelta_reduce" ); if (workspace->forceReduction) sfree(control->error_ptr, workspace->forceReduction, "f_reduce" ); if (workspace->valence_angle_atom_myoffset) sfree(control->error_ptr, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); - if (workspace->my_ext_pressReduction) sfree(control->error_ptr, workspace->my_ext_pressReduction, "ext_press_reduce"); #endif } @@ -306,7 +304,6 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, "forceReduction"); workspace->valence_angle_atom_myoffset = (int *) scalloc(control->error_ptr, sizeof(int), total_cap, "valence_angle_atom_myoffset"); - workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads); #else LMP_UNUSED_PARAM(control); #endif diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index 6a854e1805..0c26784ccb 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -32,15 +32,14 @@ #include "reaxc_list.h" #include "reaxc_vector.h" -void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, +void Add_dBond_to_Forces_NPT( int i, int pj, storage *workspace, reax_list **lists ) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; dbond_coefficients coef; - rvec temp, ext_press; - ivec rel_box; + rvec temp; int pk, k, j; /* Initializations */ @@ -78,10 +77,6 @@ void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, /* force */ rvec_Add( workspace->f[k], temp ); - /* pressure */ - rvec_iMultiply( ext_press, nbr_k->rel_box, temp ); - rvec_Add( data->my_ext_press, ext_press ); - } /* then atom i itself */ @@ -111,13 +106,6 @@ void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, /* force */ rvec_Add( workspace->f[k], temp ); - /* pressure */ - if (k != i) { - ivec_Sum( rel_box, nbr_k->rel_box, nbr_j->rel_box ); //rel_box(k, i) - rvec_iMultiply( ext_press, rel_box, temp ); - rvec_Add( data->my_ext_press, ext_press ); - - } } /* then atom j itself */ @@ -136,10 +124,6 @@ void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, /* force */ rvec_Add( workspace->f[j], temp ); - /* pressure */ - rvec_iMultiply( ext_press, nbr_j->rel_box, temp ); - rvec_Add( data->my_ext_press, ext_press ); - } void Add_dBond_to_Forces( reax_system *system, int i, int pj, diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index ac94d7b62c..4391bf769a 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -46,7 +46,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force, ext_press; + rvec dvec_jk, force; hbond_parameters *hbp; bond_order_data *bo_ij; bond_data *pbond_ij; @@ -146,23 +146,18 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, else { rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms rvec_Add( workspace->f[i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_ScaledAdd( data->my_ext_press, 1.0, ext_press ); rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); rvec_Scale( force, +CEhb2, dcos_theta_dk ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, rel_jk, force ); - rvec_ScaledAdd( data->my_ext_press, 1.0, ext_press ); + // dr terms rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); rvec_Scale( force, CEhb3/r_jk, dvec_jk ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, rel_jk, force ); - rvec_ScaledAdd( data->my_ext_press, 1.0, ext_press ); } /* tally into per-atom virials */ diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 581ddf84ec..8c962d2bad 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -99,27 +99,6 @@ void Output_Results(reax_system *system, control_params *control, /* update system-wide energies */ Compute_System_Energy(system, data, world); - /* output energies */ - if ( system->my_rank == MASTER_NODE && - out_control->energy_update_freq > 0 && - data->step % out_control->energy_update_freq == 0) { - - if (control->virial && out_control->prs) { - fprintf( out_control->prs, - "%8d%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f\n", - data->step, - data->int_press[0], data->int_press[1], data->int_press[2], - data->ext_press[0], data->ext_press[1], data->ext_press[2], - data->kin_press ); - - fprintf(out_control->prs, - "%8s%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f%13.6f\n", "", 0.0, 0.0, 0.0, - data->tot_press[0], data->tot_press[1], data->tot_press[2], 0.0); - - fflush( out_control->prs); - } - } - /* write current frame */ if ( out_control->write_steps > 0 && data->step % out_control->write_steps == 0) { Append_Frame( system, control, data, lists, out_control, world); diff --git a/src/USER-REAXC/reaxc_nonbonded.cpp b/src/USER-REAXC/reaxc_nonbonded.cpp index 97790aa997..c5a1f808c5 100644 --- a/src/USER-REAXC/reaxc_nonbonded.cpp +++ b/src/USER-REAXC/reaxc_nonbonded.cpp @@ -46,7 +46,7 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, double dr3gamij_1, dr3gamij_3; double e_ele, e_vdW, e_core, SMALL = 0.0001; double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp, ext_press; + rvec temp; two_body_parameters *twbp; far_neighbor_data *nbr_pj; reax_list *far_nbrs; @@ -190,9 +190,6 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, rvec_ScaledAdd( workspace->f[i], -1., temp ); rvec_Add( workspace->f[j], temp ); - - rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); - rvec_Add( data->my_ext_press, ext_press ); } } } @@ -217,7 +214,7 @@ void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control, double CEvd, CEclmb, SMALL = 0.0001; double f_tmp, delij[3]; - rvec temp, ext_press; + rvec temp; far_neighbor_data *nbr_pj; reax_list *far_nbrs; LR_lookup_table *t; @@ -303,9 +300,6 @@ void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control, rvec_ScaledAdd( workspace->f[i], -1., temp ); rvec_Add( workspace->f[j], temp ); - - rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); - rvec_Add( data->my_ext_press, ext_press ); } } } diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index 305e83707d..08a64f3c24 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -148,7 +148,7 @@ void Torsion_Angles( reax_system *system, control_params *control, double CEconj4, CEconj5, CEconj6; double e_tor, e_con; rvec dvec_li; - rvec force, ext_press; + rvec force; ivec rel_box_jl; // rtensor total_rtensor, temp_rtensor; four_body_header *fbh; @@ -390,17 +390,12 @@ void Torsion_Angles( reax_system *system, control_params *control, /* dcos_theta_ijk */ rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk ); rvec_Add( workspace->f[i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); rvec_ScaledAdd( workspace->f[j], CEtors7 + CEconj4, p_ijk->dcos_dj ); rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); - /* dcos_theta_jkl */ rvec_ScaledAdd( workspace->f[j], @@ -408,33 +403,23 @@ void Torsion_Angles( reax_system *system, control_params *control, rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk ); rvec_Add( workspace->f[l], force ); - rvec_iMultiply( ext_press, rel_box_jl, force ); - rvec_Add( data->my_ext_press, ext_press ); /* dcos_omega */ rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di ); rvec_Add( workspace->f[i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); rvec_ScaledAdd( workspace->f[j], CEtors9 + CEconj6, dcos_omega_dj ); rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dk ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dl ); rvec_Add( workspace->f[l], force ); - rvec_iMultiply( ext_press, rel_box_jl, force ); - rvec_Add( data->my_ext_press, ext_press ); } /* tally into per-atom virials */ diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 87543ca155..0880abf313 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -323,35 +323,9 @@ struct energy_data struct simulation_data { rc_bigint step; - double time; - - double M; // Total Mass - double inv_M; // 1 / Total Mass - - rvec xcm; // Center of mass - rvec vcm; // Center of mass velocity - rvec fcm; // Center of mass force - rvec amcm; // Angular momentum of CoM - rvec avcm; // Angular velocity of CoM - double etran_cm; // Translational kinetic energy of CoM - double erot_cm; // Rotational kinetic energy of CoM - - rtensor kinetic; // Kinetic energy tensor - rtensor virial; // Hydrodynamic virial energy_data my_en; energy_data sys_en; - - double N_f; //Number of degrees of freedom - rvec t_scale; - rtensor p_scale; - double inv_W; - - double kin_press; - rvec int_press; - rvec my_ext_press; - rvec ext_press; - rvec tot_press; }; struct three_body_interaction_data @@ -477,7 +451,6 @@ struct storage /* omp */ rvec *forceReduction; - rvec *my_ext_pressReduction; double *CdDeltaReduction; int *valence_angle_atom_myoffset; diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index 9aec0a1f05..78887e5ecc 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -102,7 +102,7 @@ void Valence_Angles( reax_system *system, control_params *control, double f7_ij, f7_jk, f8_Dj, f9_Dj; double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; double BOA_ij, BOA_jk; - rvec force, ext_press; + rvec force; // Tallying variables double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; @@ -364,15 +364,11 @@ void Valence_Angles( reax_system *system, control_params *control, } else { rvec_Scale( force, CEval8, p_ijk->dcos_di ); rvec_Add( workspace->f[i], force ); - rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); rvec_Scale( force, CEval8, p_ijk->dcos_dk ); rvec_Add( workspace->f[k], force ); - rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); - rvec_Add( data->my_ext_press, ext_press ); } /* tally into per-atom virials */ From 06a8f746cc3ea0182f39407b7b0c13e0acde8419 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 09:36:21 -0400 Subject: [PATCH 011/119] remove some more unused timer info and unused arguments --- src/USER-OMP/fix_qeq_reax_omp.cpp | 8 -------- src/USER-OMP/reaxc_bond_orders_omp.h | 13 ++++++------- src/USER-OMP/reaxc_forces_omp.cpp | 19 ++++--------------- src/USER-REAXC/fix_qeq_reax.cpp | 8 -------- src/USER-REAXC/fix_qeq_reax.h | 1 - src/USER-REAXC/reaxc_bond_orders.h | 3 +-- src/USER-REAXC/reaxc_forces.cpp | 2 +- 7 files changed, 12 insertions(+), 42 deletions(-) diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 7ddbe77f87..b1ab1e5d62 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -265,10 +265,7 @@ void FixQEqReaxOMP::pre_force(int /* vflag */) funcstartTimeBase = MPI_Wtime(); #endif - double t_start, t_end; - if (update->ntimestep % nevery) return; - if (comm->me == 0) t_start = MPI_Wtime(); int n = atom->nlocal; @@ -341,11 +338,6 @@ void FixQEqReaxOMP::pre_force(int /* vflag */) ompTimingData[COMPUTECALCQINDEX] += (endTimeBase-startTimeBase); #endif - if (comm->me == 0) { - t_end = MPI_Wtime(); - qeq_time = t_end - t_start; - } - #ifdef OMP_TIMING endTimeBase = MPI_Wtime(); ompTimingData[COMPUTEQEQINDEX] += (endTimeBase-funcstartTimeBase); diff --git a/src/USER-OMP/reaxc_bond_orders_omp.h b/src/USER-OMP/reaxc_bond_orders_omp.h index 2027a8628e..1711a9ca0c 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.h +++ b/src/USER-OMP/reaxc_bond_orders_omp.h @@ -31,14 +31,13 @@ #include "reaxc_types.h" -void Add_dBond_to_ForcesOMP( reax_system*, int, int, storage*, reax_list** ); -void Add_dBond_to_Forces_NPTOMP( reax_system *system, int, int, - simulation_data*, storage*, reax_list** ); +void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); +void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **); -int BOp_OMP(storage*, reax_list*, double, int, int, far_neighbor_data*, - single_body_parameters*, single_body_parameters*, two_body_parameters*, +int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *, + single_body_parameters *, single_body_parameters *, two_body_parameters *, int, double, double, double, double, double, double, double); -void BOOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); +void BOOMP(reax_system *, control_params *, simulation_data *, + storage *, reax_list **, output_controls *); #endif diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 956621f4db..05a72c93eb 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -132,9 +132,8 @@ void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control, /* this version of Compute_Total_Force computes forces from coefficients accumulated by all interaction functions. Saves enormous time & space! */ -void Compute_Total_ForceOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists) +void Compute_Total_ForceOMP(reax_system *system, control_params *control, + storage *workspace, reax_list **lists) { #ifdef OMP_TIMING double startTimeBase,endTimeBase; @@ -187,16 +186,6 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, } } -// #pragma omp for schedule(guided) //(dynamic,50) -// for (i = 0; i < system->N; ++i) -// for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) -// if (i < bonds->select.bond_list[pj].nbr) { -// if (control->virial == 0) -// Add_dBond_to_ForcesOMP( system, i, pj, workspace, lists ); -// else -// Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists ); -// } - if (control->virial == 0) { #if defined(_OPENMP) @@ -220,7 +209,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, const int endj = End_Index(i, bonds); for (pj = startj; pj < endj; ++pj) if (i < bonds->select.bond_list[pj].nbr) - Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists ); + Add_dBond_to_Forces_NPTOMP(system, i, pj, workspace, lists ); } } // if (virial == 0) @@ -603,5 +592,5 @@ void Compute_ForcesOMP( reax_system *system, control_params *control, lists, out_control); // Total Force - Compute_Total_ForceOMP( system, control, data, workspace, lists); + Compute_Total_ForceOMP( system, control, workspace, lists); } diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 3109950ff2..4fd177f76e 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -503,10 +503,7 @@ void FixQEqReax::init_storage() void FixQEqReax::pre_force(int /*vflag*/) { - double t_start, t_end; - if (update->ntimestep % nevery) return; - if (comm->me == 0) t_start = MPI_Wtime(); int n = atom->nlocal; @@ -538,11 +535,6 @@ void FixQEqReax::pre_force(int /*vflag*/) matvecs = matvecs_s + matvecs_t; calculate_Q(); - - if (comm->me == 0) { - t_end = MPI_Wtime(); - qeq_time = t_end - t_start; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index 5658167aca..932f2e3679 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -53,7 +53,6 @@ class FixQEqReax : public Fix { void min_pre_force(int); int matvecs; - double qeq_time; protected: int nevery,reaxflag; diff --git a/src/USER-REAXC/reaxc_bond_orders.h b/src/USER-REAXC/reaxc_bond_orders.h index 3631d90c89..09137a7afb 100644 --- a/src/USER-REAXC/reaxc_bond_orders.h +++ b/src/USER-REAXC/reaxc_bond_orders.h @@ -37,8 +37,7 @@ typedef struct{ }dbond_coefficients; void Add_dBond_to_Forces( reax_system*, int, int, storage*, reax_list** ); -void Add_dBond_to_Forces_NPT( int, int, simulation_data*, - storage*, reax_list** ); +void Add_dBond_to_Forces_NPT( int, int, storage*, reax_list** ); int BOp(storage*, reax_list*, double, int, int, far_neighbor_data*, single_body_parameters*, single_body_parameters*, two_body_parameters*); void BO( reax_system*, control_params*, simulation_data*, diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index f5f3db89ad..16224f2abb 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -108,7 +108,7 @@ void Compute_Total_Force(reax_system *system, control_params *control, if (control->virial == 0) Add_dBond_to_Forces( system, i, pj, workspace, lists ); else - Add_dBond_to_Forces_NPT( i, pj, data, workspace, lists ); + Add_dBond_to_Forces_NPT( i, pj, workspace, lists ); } } From 1fe2812c2bb0404f8ba9fe9e14accb0af7c62797 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 09:45:10 -0400 Subject: [PATCH 012/119] recover from CI compilation failure --- src/USER-OMP/reaxc_bond_orders_omp.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index aaebe9c83c..a2abb60f27 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -227,9 +227,8 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, /* ---------------------------------------------------------------------- */ -void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, - simulation_data * /* data */, - storage *workspace, reax_list **lists) { +void Add_dBond_to_Forces_NPTOMP(reax_system *system, int i, int pj, + storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; From 8118c23a986259481c1b45dea940b91356d40695 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 10:11:24 -0400 Subject: [PATCH 013/119] remove totals from energy_data struct --- src/USER-REAXC/reaxc_forces.cpp | 5 ++--- src/USER-REAXC/reaxc_reset_tools.cpp | 4 ---- src/USER-REAXC/reaxc_system_props.cpp | 24 ++---------------------- src/USER-REAXC/reaxc_traj.cpp | 15 +++++++++------ src/USER-REAXC/reaxc_types.h | 8 ++------ 5 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 16224f2abb..d135571009 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -96,8 +96,7 @@ void Compute_NonBonded_Forces(reax_system *system, control_params *control, void Compute_Total_Force(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists) + storage *workspace, reax_list **lists) { int i, pj; reax_list *bonds = (*lists) + BONDS; @@ -434,5 +433,5 @@ void Compute_Forces(reax_system *system, control_params *control, lists, out_control); /*********** total force ***************/ - Compute_Total_Force(system, control, data, workspace, lists); + Compute_Total_Force(system, control, workspace, lists); } diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index c32fe6a602..dbd879a2a8 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -67,10 +67,6 @@ void Reset_Energies( energy_data *en ) en->e_vdW = 0; en->e_ele = 0; en->e_pol = 0; - - en->e_pot = 0; - en->e_kin = 0; - en->e_tot = 0; } void Reset_Simulation_Data( simulation_data* data, int /*virial*/ ) diff --git a/src/USER-REAXC/reaxc_system_props.cpp b/src/USER-REAXC/reaxc_system_props.cpp index e2cd7215aa..de513e11de 100644 --- a/src/USER-REAXC/reaxc_system_props.cpp +++ b/src/USER-REAXC/reaxc_system_props.cpp @@ -31,7 +31,7 @@ void Compute_System_Energy( reax_system *system, simulation_data *data, MPI_Comm comm ) { - double my_en[15], sys_en[15]; + double my_en[13], sys_en[13]; my_en[0] = data->my_en.e_bond; my_en[1] = data->my_en.e_ov; @@ -46,17 +46,7 @@ void Compute_System_Energy( reax_system *system, simulation_data *data, my_en[10] = data->my_en.e_vdW; my_en[11] = data->my_en.e_ele; my_en[12] = data->my_en.e_pol; - my_en[13] = data->my_en.e_kin; - MPI_Reduce( my_en, sys_en, 14, MPI_DOUBLE, MPI_SUM, MASTER_NODE, comm ); - - data->my_en.e_pot = data->my_en.e_bond + - data->my_en.e_ov + data->my_en.e_un + data->my_en.e_lp + - data->my_en.e_ang + data->my_en.e_pen + data->my_en.e_coa + - data->my_en.e_hb + - data->my_en.e_tor + data->my_en.e_con + - data->my_en.e_vdW + data->my_en.e_ele + data->my_en.e_pol; - - data->my_en.e_tot = data->my_en.e_pot + E_CONV * data->my_en.e_kin; + MPI_Reduce( my_en, sys_en, 13, MPI_DOUBLE, MPI_SUM, MASTER_NODE, comm ); if (system->my_rank == MASTER_NODE) { data->sys_en.e_bond = sys_en[0]; @@ -72,15 +62,5 @@ void Compute_System_Energy( reax_system *system, simulation_data *data, data->sys_en.e_vdW = sys_en[10]; data->sys_en.e_ele = sys_en[11]; data->sys_en.e_pol = sys_en[12]; - data->sys_en.e_kin = sys_en[13]; - - data->sys_en.e_pot = data->sys_en.e_bond + - data->sys_en.e_ov + data->sys_en.e_un + data->sys_en.e_lp + - data->sys_en.e_ang + data->sys_en.e_pen + data->sys_en.e_coa + - data->sys_en.e_hb + - data->sys_en.e_tor + data->sys_en.e_con + - data->sys_en.e_vdW + data->sys_en.e_ele + data->sys_en.e_pol; - - data->sys_en.e_tot = data->sys_en.e_pot + E_CONV * data->sys_en.e_kin; } } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index da7c7955e5..658dfe4504 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -379,16 +379,19 @@ int Write_Frame_Header(reax_system *system, control_params *control, strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); /* energies */ - sprintf( out_control->line, REAL_LINE, "total_energy:", - data->sys_en.e_tot ); + double epot = data->sys_en.e_bond + data->sys_en.e_ov + data->sys_en.e_un + + data->sys_en.e_lp + data->sys_en.e_ang + data->sys_en.e_pen + + data->sys_en.e_coa + data->sys_en.e_hb + data->sys_en.e_tor + + data->sys_en.e_con + data->sys_en.e_vdW + + data->sys_en.e_ele + data->my_en.e_pol; + + sprintf( out_control->line, REAL_LINE, "total_energy:", epot); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "total_kinetic:", - data->sys_en.e_kin ); + sprintf( out_control->line, REAL_LINE, "total_kinetic:", 0.0); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, REAL_LINE, "total_potential:", - data->sys_en.e_pot ); + sprintf( out_control->line, REAL_LINE, "total_potential:", epot); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); sprintf( out_control->line, REAL_LINE, "bond_energy:", diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 0880abf313..73efda423e 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -301,10 +301,6 @@ struct control_params struct energy_data { - double e_tot; - double e_kin; // Total kinetic energy - double e_pot; - double e_bond; // Total bond energy double e_ov; // Total over coordination double e_un; // Total under coordination energy @@ -324,8 +320,8 @@ struct simulation_data { rc_bigint step; - energy_data my_en; - energy_data sys_en; + energy_data my_en; // per MPI rank energies + energy_data sys_en; // global energies }; struct three_body_interaction_data From 4dfd06cd8f39a493c23159eed13bab4d9b62f39b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 10:20:34 -0400 Subject: [PATCH 014/119] remove unused communication storage --- src/USER-REAXC/reaxc_allocate.cpp | 20 -------------------- src/USER-REAXC/reaxc_types.h | 7 ------- 2 files changed, 27 deletions(-) diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 455e8f9ada..96c709f2fa 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -127,15 +127,7 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) workspace->allocated = 0; - /* communication storage */ - for (i = 0; i < MAX_NBRS; ++i) { - sfree(control->error_ptr, workspace->tmp_dbl[i], "tmp_dbl[i]" ); - sfree(control->error_ptr, workspace->tmp_rvec[i], "tmp_rvec[i]" ); - sfree(control->error_ptr, workspace->tmp_rvec2[i], "tmp_rvec2[i]" ); - } - /* bond order storage */ - sfree(control->error_ptr, workspace->within_bond_box, "skin" ); sfree(control->error_ptr, workspace->total_bond_order, "total_bo" ); sfree(control->error_ptr, workspace->Deltap, "Deltap" ); sfree(control->error_ptr, workspace->Deltap_boc, "Deltap_boc" ); @@ -215,19 +207,7 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, total_rvec = total_cap * sizeof(rvec); local_rvec = local_cap * sizeof(rvec); - /* communication storage */ - for (i = 0; i < MAX_NBRS; ++i) { - workspace->tmp_dbl[i] = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "tmp_dbl"); - workspace->tmp_rvec[i] = (rvec*) - scalloc(control->error_ptr, total_cap, sizeof(rvec), "tmp_rvec"); - workspace->tmp_rvec2[i] = (rvec2*) - scalloc(control->error_ptr, total_cap, sizeof(rvec2), "tmp_rvec2"); - } - /* bond order related storage */ - workspace->within_bond_box = (int*) - scalloc(control->error_ptr, total_cap, sizeof(int), "skin"); workspace->total_bond_order = (double*) smalloc(control->error_ptr, total_real, "total_bo"); workspace->Deltap = (double*) smalloc(control->error_ptr, total_real, "Deltap"); workspace->Deltap_boc = (double*) smalloc(control->error_ptr, total_real, "Deltap_boc"); diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 73efda423e..5fbd74bf5f 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -393,19 +393,12 @@ struct reallocate_data { int hbonds, num_hbonds; int bonds, num_bonds; int num_3body; - int gcell_atoms; }; struct storage { int allocated; - /* communication storage */ - double *tmp_dbl[REAX_MAX_NBRS]; - rvec *tmp_rvec[REAX_MAX_NBRS]; - rvec2 *tmp_rvec2[REAX_MAX_NBRS]; - int *within_bond_box; - /* bond order related storage */ double *total_bond_order; double *Deltap, *Deltap_boc; From 499b6854213cc6ac9c84c3dde66f2eb429c1b95d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 10:58:29 -0400 Subject: [PATCH 015/119] clean up workspace management, output control, and enumerators --- src/USER-OMP/reaxc_init_md_omp.cpp | 8 ++------ src/USER-REAXC/pair_reaxc.cpp | 1 - src/USER-REAXC/reaxc_allocate.cpp | 28 ++++------------------------ src/USER-REAXC/reaxc_allocate.h | 5 ++--- src/USER-REAXC/reaxc_control.cpp | 12 +++--------- src/USER-REAXC/reaxc_defs.h | 29 +++-------------------------- src/USER-REAXC/reaxc_init_md.cpp | 18 +++--------------- src/USER-REAXC/reaxc_traj.cpp | 25 +++++++++---------------- src/USER-REAXC/reaxc_types.h | 25 +------------------------ 9 files changed, 27 insertions(+), 124 deletions(-) diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index 9652b52fe7..31360a3bc0 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -43,7 +43,7 @@ // Functions defined in reaxc_init_md.cpp extern void Init_System(reax_system*, control_params*); extern void Init_Simulation_Data(control_params*, simulation_data*); -extern int Init_Workspace(reax_system*, control_params*, storage*, char*); +extern void Init_Workspace(reax_system*, control_params*, storage*); /* ---------------------------------------------------------------------- */ @@ -124,11 +124,7 @@ void InitializeOMP(reax_system *system, control_params *control, Init_System(system,control); Init_Simulation_Data(control,data); - - if (Init_Workspace(system,control,workspace,msg) == FAILURE) - error->one(FLERR,"init_workspace: not enough memory. " - "Workspace could not be initialized. Terminating."); - + Init_Workspace(system,control,workspace); Init_ListsOMP(system,control,lists); if (Init_Output_Files(system,control,out_control,world,msg)== FAILURE) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index cb1fe5f64d..9074ab8ca5 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -216,7 +216,6 @@ void PairReaxC::settings(int narg, char **arg) control->nthreads = 1; out_control->write_steps = 0; - out_control->traj_method = 0; strcpy( out_control->traj_title, "default_title" ); out_control->atom_info = 0; out_control->bond_info = 0; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 96c709f2fa..b0d83fc70d 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -145,7 +145,6 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) sfree(control->error_ptr, workspace->Clp, "Clp" ); sfree(control->error_ptr, workspace->vlpex, "vlpex" ); sfree(control->error_ptr, workspace->bond_mark, "bond_mark" ); - sfree(control->error_ptr, workspace->done_after, "done_after" ); /* QEq storage */ sfree(control->error_ptr, workspace->Hdia_inv, "Hdia_inv" ); @@ -180,9 +179,6 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) sfree(control->error_ptr, workspace->q2, "q2" ); sfree(control->error_ptr, workspace->p2, "p2" ); - /* integrator storage */ - sfree(control->error_ptr, workspace->v_const, "v_const" ); - /* force related storage */ sfree(control->error_ptr, workspace->f, "f" ); sfree(control->error_ptr, workspace->CdDelta, "CdDelta" ); @@ -196,16 +192,13 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) } -int Allocate_Workspace( reax_system * /*system*/, control_params * control, - storage *workspace, int local_cap, int total_cap, - char * /*msg*/ ) +void Allocate_Workspace( control_params *control, storage *workspace, int total_cap) { - int i, total_real, total_rvec, local_rvec; + int i, total_real, total_rvec; workspace->allocated = 1; total_real = total_cap * sizeof(double); total_rvec = total_cap * sizeof(rvec); - local_rvec = local_cap * sizeof(rvec); /* bond order related storage */ workspace->total_bond_order = (double*) smalloc(control->error_ptr, total_real, "total_bo"); @@ -228,8 +221,6 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, workspace->vlpex = (double*) smalloc(control->error_ptr, total_real, "vlpex"); workspace->bond_mark = (int*) scalloc(control->error_ptr, total_cap, sizeof(int), "bond_mark"); - workspace->done_after = (int*) - scalloc(control->error_ptr, total_cap, sizeof(int), "done_after"); /* QEq storage */ workspace->Hdia_inv = (double*) @@ -267,9 +258,6 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, workspace->q2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "q2"); workspace->p2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "p2"); - /* integrator storage */ - workspace->v_const = (rvec*) smalloc(control->error_ptr, local_rvec, "v_const"); - /* force related storage */ workspace->f = (rvec*) scalloc(control->error_ptr, total_cap, sizeof(rvec), "f"); workspace->CdDelta = (double*) @@ -287,8 +275,6 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, #else LMP_UNUSED_PARAM(control); #endif - - return SUCCESS; } @@ -407,14 +393,8 @@ void ReAllocate( reax_system *system, control_params *control, } /* workspace */ - DeAllocate_Workspace( control, workspace ); - ret = Allocate_Workspace( system, control, workspace, system->local_cap, - system->total_cap, msg ); - if (ret != SUCCESS) { - char errmsg[256]; - snprintf(errmsg, 256, "Not enough space for workspace: local_cap=%d total_cap=%d", system->local_cap, system->total_cap); - error->one(FLERR, errmsg); - } + DeAllocate_Workspace(control, workspace); + Allocate_Workspace(control, workspace, system->total_cap); } /* far neighbors */ diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index be203340f6..e94066113b 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -33,9 +33,8 @@ int PreAllocate_Space( reax_system*, control_params*, storage* ); int Allocate_System( reax_system*, int, int, char* ); void DeAllocate_System( reax_system* ); -int Allocate_Workspace( reax_system*, control_params*, storage*, - int, int, char* ); -void DeAllocate_Workspace( control_params*, storage* ); +void Allocate_Workspace(control_params *, storage *, int); +void DeAllocate_Workspace(control_params *, storage *); void ReAllocate( reax_system*, control_params*, simulation_data*, storage*, reax_list** ); diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 93cb642a1f..67d019ae9c 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -53,7 +53,6 @@ void Read_Control_File(const char *control_file, control_params *control, strcpy( control->sim_name, "simulate" ); control->nthreads = 1; - out_control->debug_level = 0; out_control->energy_update_freq = 0; control->bond_cut = 5.0; @@ -67,8 +66,6 @@ void Read_Control_File(const char *control_file, control_params *control, control->virial = 0; out_control->write_steps = 0; - out_control->traj_compress = 0; - out_control->traj_method = REG_TRAJ; strcpy( out_control->traj_title, "default_title" ); out_control->atom_info = 0; out_control->bond_info = 0; @@ -119,8 +116,7 @@ void Read_Control_File(const char *control_file, control_params *control, ; // ignore } else if (strcmp(tmp[0], "debug_level") == 0) { - ival = atoi(tmp[1]); - out_control->debug_level = ival; + ; // ignore } else if (strcmp(tmp[0], "energy_update_freq") == 0) { ival = atoi(tmp[1]); @@ -212,12 +208,10 @@ void Read_Control_File(const char *control_file, control_params *control, out_control->write_steps = ival; } else if (strcmp(tmp[0], "traj_compress") == 0) { - ival = atoi(tmp[1]); - out_control->traj_compress = ival; + ; // ignore } else if (strcmp(tmp[0], "traj_method") == 0) { - ival = atoi(tmp[1]); - out_control->traj_method = ival; + ; // ignore } else if (strcmp(tmp[0], "traj_title") == 0) { strcpy( out_control->traj_title, tmp[1] ); diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h index 4103f06129..f66fd9086c 100644 --- a/src/USER-REAXC/reaxc_defs.h +++ b/src/USER-REAXC/reaxc_defs.h @@ -116,36 +116,13 @@ /******************* ENUMERATIONS *************************/ -enum restart_formats { WRITE_ASCII, WRITE_BINARY, RF_N }; - enum lists { BONDS, OLD_BONDS, THREE_BODIES, HBONDS, FAR_NBRS, DBOS, DDELTAS, LIST_N }; -enum interactions { TYP_VOID, TYP_BOND, TYP_THREE_BODY, - TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N }; +enum message_tags {NONE, INIT_DESCS, ATOM_LINES, BOND_LINES, ANGLE_LINES}; -enum message_tags { INIT, UPDATE, BNDRY, UPDATE_BNDRY, - EXC_VEC1, EXC_VEC2, DIST_RVEC2, COLL_RVEC2, - DIST_RVECS, COLL_RVECS, INIT_DESCS, ATOM_LINES, - BOND_LINES, ANGLE_LINES, RESTART_ATOMS, TAGS_N }; - -enum errors { FILE_NOT_FOUND = -10, UNKNOWN_ATOM_TYPE = -11, - CANNOT_OPEN_FILE = -12, CANNOT_INITIALIZE = -13, - INSUFFICIENT_MEMORY = -14, UNKNOWN_OPTION = -15, - INVALID_INPUT = -16, INVALID_GEO = -17 }; - -enum exchanges { NONE, NEAR_EXCH, FULL_EXCH }; - -enum gcell_types { NO_NBRS=0, NEAR_ONLY=1, HBOND_ONLY=2, FAR_ONLY=4, - NEAR_HBOND=3, NEAR_FAR=5, HBOND_FAR=6, FULL_NBRS=7, - NATIVE=8 }; - -enum atoms { C_ATOM = 0, H_ATOM = 1, O_ATOM = 2, N_ATOM = 3, - S_ATOM = 4, SI_ATOM = 5, GE_ATOM = 6, X_ATOM = 7 }; - -enum traj_methods { REG_TRAJ, MPI_TRAJ, TF_N }; - -enum molecules { UNKNOWN, WATER }; +enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, + TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; #endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index b9d46fc3f1..44dbc764af 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -114,24 +114,15 @@ void Init_Taper(control_params *control, storage *workspace) 7.0*swa*swb3*swb3 + swb3*swb3*swb) / d7; } - -int Init_Workspace(reax_system *system, control_params *control, - storage *workspace, char *msg) +void Init_Workspace(reax_system *system, control_params *control, storage *workspace) { - int ret; - - ret = Allocate_Workspace(system, control, workspace, - system->local_cap, system->total_cap, msg); - if (ret != SUCCESS) - return ret; + Allocate_Workspace(control, workspace,system->total_cap); memset(&(workspace->realloc), 0, sizeof(reallocate_data)); Reset_Workspace(system, workspace); /* Initialize the Taper function */ Init_Taper(control, workspace); - - return SUCCESS; } int Init_Lists(reax_system *system, control_params *control, reax_list **lists) @@ -202,10 +193,7 @@ void Initialize(reax_system *system, control_params *control, Init_System(system,control); Init_Simulation_Data(control,data); - - if (Init_Workspace( system,control,workspace,msg) == FAILURE) - error->one(FLERR,"init_workspace: not enough memory. " - "Workspace could not be initialized. Terminating."); + Init_Workspace( system,control,workspace); if (Init_Lists(system, control, lists) ==FAILURE) error->one(FLERR,fmt::format("Error on: {}. System could not be " diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 658dfe4504..96b216241a 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -64,7 +64,6 @@ int Write_Header(reax_system *system, control_params *control, { int num_hdr_lines, my_hdr_lines, buffer_req; - char traj_methods[TF_N][10] = { "custom", "xyz" }; char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", "xyz_q", "xyz_q_fxfyfz", @@ -200,12 +199,10 @@ int Write_Header(reax_system *system, control_params *control, out_control->write_steps ); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "compress_trajectory_output?:", - (out_control->traj_compress ? "yes" : "no") ); + sprintf( out_control->line, STR_LINE, "compress_trajectory_output?:", "no"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, STR_LINE, "trajectory_format:", - traj_methods[ out_control->traj_method ] ); + sprintf( out_control->line, STR_LINE, "trajectory_format:", "regular"); strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); sprintf( out_control->line, STR_LINE, "atom_info:", @@ -248,7 +245,7 @@ int Write_Init_Desc(reax_system *system, output_controls *out_control, /* skip info */ Write_Skip_Line(out_control, me, system->bigN*INIT_DESC_LEN, system->bigN); - if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) + if (me == MASTER_NODE) buffer_req = system->bigN * INIT_DESC_LEN + 1; else buffer_req = system->n * INIT_DESC_LEN + 1; @@ -315,13 +312,9 @@ int Init_Traj(reax_system *system, control_params *control, out_control->buffer = nullptr; /* write trajectory header and atom info, if applicable */ - if (out_control->traj_method == REG_TRAJ) { - if (system->my_rank == MASTER_NODE) - out_control->strj = fopen(fname, "w"); - } else { - strcpy( msg, "init_traj: unknown trajectory option" ); - return FAILURE; - } + if (system->my_rank == MASTER_NODE) + out_control->strj = fopen(fname, "w"); + Write_Header(system, control, out_control); Write_Init_Desc(system, out_control, world); @@ -461,7 +454,7 @@ int Write_Atoms(reax_system *system, output_controls *out_control, Write_Skip_Line(out_control, me, system->bigN*line_len, system->bigN); - if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) + if (me == MASTER_NODE) buffer_req = system->bigN * line_len + 1; else buffer_req = system->n * line_len + 1; @@ -551,7 +544,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, Write_Skip_Line( out_control, me, num_bonds*line_len, num_bonds ); - if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) + if (me == MASTER_NODE) buffer_req = num_bonds * line_len + 1; else buffer_req = my_bonds * line_len + 1; @@ -651,7 +644,7 @@ int Write_Angles( reax_system *system, control_params *control, Write_Skip_Line( out_control, me, num_angles*line_len, num_angles ); - if (out_control->traj_method == REG_TRAJ && me == MASTER_NODE) + if (me == MASTER_NODE) buffer_req = num_angles * line_len + 1; else buffer_req = my_angles * line_len + 1; diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 5fbd74bf5f..53b0e35842 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -406,7 +406,7 @@ struct storage double *dDelta_lp, *dDelta_lp_temp; double *nlp, *nlp_temp, *Clp, *vlpex; rvec *dDeltap_self; - int *bond_mark, *done_after; + int *bond_mark; /* QEq storage */ sparse_matrix *H, *L, *U; @@ -423,17 +423,6 @@ struct storage /* Taper */ double Tap[8]; //Tap7, Tap6, Tap5, Tap4, Tap3, Tap2, Tap1, Tap0; - /* storage for analysis */ - int *mark, *old_mark; - rvec *x_old; - - /* storage space for bond restrictions */ - int *restricted; - int **restricted_list; - - /* integrator */ - rvec *v_const; - /* force calculations */ double *CdDelta; // coefficient of dDelta rvec *f; @@ -496,26 +485,14 @@ struct output_controls FILE *prs; int write_steps; - int traj_compress; - int traj_method; char traj_title[81]; int atom_info; int bond_info; int angle_info; - int restart_format; - int restart_freq; - int debug_level; int energy_update_freq; }; -struct molecule -{ - int atom_count; - int atom_list[REAX_MAX_MOLECULE_SIZE]; - int mtypes[REAX_MAX_ATOM_TYPES]; -}; - struct LR_data { double H; From b3bc2d3df1b9302da8787f6850ba0d7c01399f08 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 13:21:54 -0400 Subject: [PATCH 016/119] adjust pair style reax/c to read control file on MPI rank 0 and use tokenizer class --- src/USER-REAXC/pair_reaxc.cpp | 49 +++-- src/USER-REAXC/reaxc_control.cpp | 302 +++++++++---------------------- 2 files changed, 117 insertions(+), 234 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 9074ab8ca5..e8a47658d1 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -101,9 +101,9 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) control->me = system->my_rank = comm->me; system->num_nbrs = 0; - system->n = 0; // my atoms - system->N = 0; // mine + ghosts - system->bigN = 0; // all atoms in the system + system->n = 0; // my atoms + system->N = 0; // mine + ghosts + system->bigN = 0; // all atoms in the system system->local_cap = 0; system->total_cap = 0; system->my_atoms = nullptr; @@ -200,27 +200,36 @@ void PairReaxC::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal pair_style command"); - // read name of control file or use default controls + if (comm->me == 0) { + // read name of control file or use default controls - if (strcmp(arg[0],"NULL") == 0) { - strcpy( control->sim_name, "simulate" ); - out_control->energy_update_freq = 0; - control->tabulate = 0; + if (strcmp(arg[0],"NULL") == 0) { + strcpy( control->sim_name, "simulate" ); + out_control->energy_update_freq = 0; + control->tabulate = 0; - control->bond_cut = 5.; - control->hbond_cut = 7.50; - control->thb_cut = 0.001; - control->thb_cutsq = 0.00001; - control->bg_cut = 0.3; + control->bond_cut = 5.; + control->hbond_cut = 7.50; + control->thb_cut = 0.001; + control->thb_cutsq = 0.00001; + control->bg_cut = 0.3; - control->nthreads = 1; + control->nthreads = 1; - out_control->write_steps = 0; - strcpy( out_control->traj_title, "default_title" ); - out_control->atom_info = 0; - out_control->bond_info = 0; - out_control->angle_info = 0; - } else Read_Control_File(arg[0], control, out_control); + out_control->write_steps = 0; + strcpy( out_control->traj_title, "default_title" ); + out_control->atom_info = 0; + out_control->bond_info = 0; + out_control->angle_info = 0; + } else Read_Control_File(arg[0], control, out_control); + } + MPI_Bcast(control,sizeof(control_params),MPI_CHAR,0,world); + MPI_Bcast(out_control,sizeof(output_controls),MPI_CHAR,0,world); + + // must reset these to local values after broadcast + control->me = comm->me; + control->error_ptr = error; + control->lmp_ptr = lmp; // default values diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 67d019ae9c..fe238ddb3c 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -25,250 +25,124 @@ ----------------------------------------------------------------------*/ #include "reaxc_control.h" -#include -#include #include "reaxc_defs.h" #include "reaxc_tool_box.h" #include "error.h" #include "utils.h" +#include "tokenizer.h" + +#include +#include +#include +#include using LAMMPS_NS::utils::getsyserror; +using LAMMPS_NS::utils::sfgets; +using LAMMPS_NS::utils::logmesg; +using LAMMPS_NS::ValueTokenizer; + +static std::unordered_set ignored_keywords = { + "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", + "restart_format", "restart_freq", "reposition_atoms", + "restrict_bonds", "remove_CoM_vel", "debug_level", "reneighbor", + "vlist_buffer", "ghost_cutoff", "qeq_freq", "q_err", "ilu_refactor", + "ilu_droptol", "temp_init", "temp_final", "t_mass", "t_mode", "t_rate", + "t_freq", "pressure", "p_mass", "pt_mass", "compress", "press_mode", + "geo_format", "traj_compress", "traj_method", "molecular_analysis", + "ignore", "dipole_anal", "freq_dipole_anal", "diffusion_coef", + "freq_diffusion_coef", "restrict_type" +}; + +class parser_error : public std::exception { + std::string message; +public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } +}; void Read_Control_File(const char *control_file, control_params *control, - output_controls *out_control) + output_controls *out_control) { FILE *fp; - char *s, **tmp; - int i,ival; - double val; + char line[MAX_LINE]; + auto error = control->error_ptr; + auto lmp = control->lmp_ptr; /* open control file */ fp = fopen(control_file, "r"); if (!fp) - control->error_ptr->one(FLERR,fmt::format("The control file {} cannot be " - "opened: {}",control_file, - getsyserror())); + error->one(FLERR,fmt::format("The control file {} cannot be opened: {}", + control_file, getsyserror())); /* assign default values */ - strcpy( control->sim_name, "simulate" ); - control->nthreads = 1; - - out_control->energy_update_freq = 0; - + strcpy(control->sim_name, "simulate"); + control->nthreads = 1; + control->tabulate = 0; + control->virial = 0; control->bond_cut = 5.0; control->bg_cut = 0.3; control->thb_cut = 0.001; control->thb_cutsq = 0.00001; control->hbond_cut = 7.5; - control->tabulate = 0; - - control->virial = 0; - out_control->write_steps = 0; - strcpy( out_control->traj_title, "default_title" ); + out_control->energy_update_freq = 0; + strcpy(out_control->traj_title, "default_title"); out_control->atom_info = 0; out_control->bond_info = 0; out_control->angle_info = 0; - /* memory allocations */ - s = (char*) malloc(sizeof(char)*MAX_LINE); - tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); - for (i=0; i < MAX_TOKENS; i++) - tmp[i] = (char*) malloc(sizeof(char)*MAX_LINE); - /* read control parameters file */ - while (!feof(fp)) { - fgets( s, MAX_LINE, fp ); - Tokenize( s, &tmp ); + while (fgets(line, MAX_LINE, fp)) { + ValueTokenizer values(line); - if (strcmp(tmp[0], "simulation_name") == 0) { - strcpy( control->sim_name, tmp[1] ); - } - else if (strcmp(tmp[0], "ensemble_type") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "nsteps") == 0) { - ; // ignore - } - else if ( strcmp(tmp[0], "dt") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "proc_by_dim") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "random_vel") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "restart_format") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "restart_freq") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "reposition_atoms") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "restrict_bonds") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "remove_CoM_vel") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "debug_level") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "energy_update_freq") == 0) { - ival = atoi(tmp[1]); - out_control->energy_update_freq = ival; - } - else if (strcmp(tmp[0], "reneighbor") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "vlist_buffer") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "nbrhood_cutoff") == 0) { - val = atof(tmp[1]); - control->bond_cut = val; - } - else if (strcmp(tmp[0], "bond_graph_cutoff") == 0) { - val = atof(tmp[1]); - control->bg_cut = val; - } - else if (strcmp(tmp[0], "thb_cutoff") == 0) { - val = atof(tmp[1]); - control->thb_cut = val; - } - else if (strcmp(tmp[0], "thb_cutoff_sq") == 0) { - val = atof(tmp[1]); - control->thb_cutsq = val; - } - else if (strcmp(tmp[0], "hbond_cutoff") == 0) { - val = atof( tmp[1] ); - control->hbond_cut = val; - } - else if (strcmp(tmp[0], "ghost_cutoff") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "tabulate_long_range") == 0) { - ival = atoi( tmp[1] ); - control->tabulate = ival; - } - else if (strcmp(tmp[0], "qeq_freq") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "q_err") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "ilu_refactor") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "ilu_droptol") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "temp_init") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "temp_final") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "t_mass") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "t_mode") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "t_rate") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "t_freq") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "pressure") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "p_mass") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "pt_mass") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "compress") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "press_mode") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "geo_format") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "write_freq") == 0) { - ival = atoi(tmp[1]); - out_control->write_steps = ival; - } - else if (strcmp(tmp[0], "traj_compress") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "traj_method") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "traj_title") == 0) { - strcpy( out_control->traj_title, tmp[1] ); - } - else if (strcmp(tmp[0], "atom_info") == 0) { - ival = atoi(tmp[1]); - out_control->atom_info += ival * 4; - } - else if (strcmp(tmp[0], "atom_velocities") == 0) { - ival = atoi(tmp[1]); - out_control->atom_info += ival * 2; - } - else if (strcmp(tmp[0], "atom_forces") == 0) { - ival = atoi(tmp[1]); - out_control->atom_info += ival * 1; - } - else if (strcmp(tmp[0], "bond_info") == 0) { - ival = atoi(tmp[1]); - out_control->bond_info = ival; - } - else if (strcmp(tmp[0], "angle_info") == 0) { - ival = atoi(tmp[1]); - out_control->angle_info = ival; - } - else if (strcmp(tmp[0], "molecular_analysis") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "ignore") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "dipole_anal") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "freq_dipole_anal") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "diffusion_coef") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "freq_diffusion_coef") == 0) { - ; // ignore - } - else if (strcmp(tmp[0], "restrict_type") == 0) { - ; // ignore - } - else { - char errmsg[128]; - snprintf(errmsg,128,"Unknown parameter %s in the control file", tmp[0]); - control->error_ptr->all(FLERR, errmsg); + // empty line + if (values.count() == 0) continue; + + try { + auto keyword = values.next_string(); + + if (!values.has_next()) + throw parser_error(fmt::format("No value(s) for control parameter: {}\n",keyword)); + + if (ignored_keywords.find(keyword) != ignored_keywords.end()) { + logmesg(lmp,fmt::format("Ignoring inactive control parameter: {}\n",keyword)); + } else if (keyword == "simulation_name") { + strcpy(control->sim_name, values.next_string().c_str()); + } else if (keyword == "energy_update_freq") { + out_control->energy_update_freq = values.next_int(); + } else if (keyword == "nbrhood_cutoff") { + control->bond_cut = values.next_double(); + } else if (keyword == "bond_graph_cutoff") { + control->bg_cut = values.next_double(); + } else if (keyword == "thb_cutoff") { + control->thb_cut = values.next_double(); + } else if (keyword == "thb_cutoff_sq") { + control->thb_cutsq = values.next_double(); + } else if (keyword == "hbond_cutoff") { + control->hbond_cut = values.next_double(); + } else if (keyword == "tabulate_long_range") { + control->tabulate = values.next_int(); + } else if (keyword == "write_freq") { + out_control->write_steps = values.next_int(); + } else if (keyword == "traj_title") { + strcpy(out_control->traj_title, values.next_string().c_str()); + } else if (keyword == "atom_info") { + out_control->atom_info += values.next_int() * 4; + } else if (keyword == "atom_velocities") { + out_control->atom_info += values.next_int() * 2; + } else if (keyword == "atom_forces") { + out_control->atom_info += values.next_int() * 1; + } else if (keyword == "bond_info") { + out_control->bond_info = values.next_int(); + } else if (keyword == "angle_info") { + out_control->angle_info = values.next_int(); + } else { + throw parser_error(fmt::format("Unknown parameter {} in control file", keyword)); + } + } catch (std::exception &e) { + error->one(FLERR, e.what()); } } - - /* free memory allocations at the top */ - for (i = 0; i < MAX_TOKENS; i++) - free( tmp[i] ); - free( tmp ); - free( s ); - fclose(fp); } From fb75e3e8b1f1ef26a2715e6c00d956977c21b554 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 14:25:10 -0400 Subject: [PATCH 017/119] remove unused and commented out defines --- src/USER-REAXC/reaxc_defs.h | 25 ++----------------------- src/USER-REAXC/reaxc_types.h | 13 ------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h index f66fd9086c..6df4460fb9 100644 --- a/src/USER-REAXC/reaxc_defs.h +++ b/src/USER-REAXC/reaxc_defs.h @@ -26,8 +26,8 @@ . ----------------------------------------------------------------------*/ -#ifndef REAX_DEFS_H -#define REAX_DEFS_H +#ifndef LMP_REAXC_DEFS_H +#define LMP_REAXC_DEFS_H #if defined(__IBMC__) #define inline __inline__ @@ -39,19 +39,11 @@ #ifndef FAILURE #define FAILURE 0 #endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) #define DEG2RAD(a) ((a)*constPI/180.0) #define RAD2DEG(a) ((a)*180.0/constPI) -// #define MAX(x,y) (((x) > (y)) ? (x) : (y)) -// #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX3(x,y,z) MAX( MAX(x,y), z) #define constPI 3.14159265 @@ -88,8 +80,6 @@ #define MIN_BONDS 25 #define REAX_MIN_HBONDS 25 #define MIN_3BODIES 1000 -#define MIN_GCELL_POPL 50 -#define MIN_SEND 100 #define REAX_SAFE_ZONE 1.2 #define REAX_SAFER_ZONE 1.4 #define DANGER_ZONE 0.90 @@ -97,20 +87,10 @@ #define MAX_3BODY_PARAM 5 #define MAX_4BODY_PARAM 5 -#define MAX_dV 1.01 -#define MIN_dV 0.99 -#define MAX_dT 4.00 -#define MIN_dT 0.00 - #define MASTER_NODE 0 -#define MAX_NBRS 6 //27 -#define MYSELF 13 // encoding of relative coordinate (0,0,0) -#define MAX_ITR 10 #define RESTART 30 -#define MAX_BOND 20 - #define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ #define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ @@ -121,7 +101,6 @@ enum lists { BONDS, OLD_BONDS, THREE_BODIES, enum message_tags {NONE, INIT_DESCS, ATOM_LINES, BOND_LINES, ANGLE_LINES}; - enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 53b0e35842..bef6475b6f 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -75,23 +75,10 @@ extern int ompTimingCGCount[LASTTIMINGINDEX]; /************* SOME DEFS - crucial for reax_types.h *********/ -//#define DEBUG -//#define DEBUG_FOCUS -//#define TEST_ENERGY -//#define TEST_FORCES -//#define CG_PERFORMANCE -//#define LOG_PERFORMANCE -//#define STANDARD_BOUNDARIES -//#define OLD_BOUNDARIES -//#define MIDPOINT_BOUNDARIES - #define REAX_MAX_STR 1024 -#define REAX_MAX_NBRS 6 #define REAX_MAX_3BODY_PARAM 5 #define REAX_MAX_4BODY_PARAM 5 #define REAX_MAX_ATOM_TYPES 25 -#define REAX_MAX_MOLECULE_SIZE 20 -#define MAX_BOND 20 // same as reaxc_defs.h /********************** TYPE DEFINITIONS ********************/ typedef int ivec[3]; From cc82e9b5581bfb840f07e38f953a89ca8e6b3a85 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 14:36:07 -0400 Subject: [PATCH 018/119] remove unused rtensor data type and support functions for it. --- src/USER-OMP/reaxc_torsion_angles_omp.cpp | 1 - src/USER-OMP/reaxc_valence_angles_omp.cpp | 1 - src/USER-REAXC/reaxc_torsion_angles.cpp | 1 - src/USER-REAXC/reaxc_types.h | 1 - src/USER-REAXC/reaxc_vector.cpp | 29 ----------------------- src/USER-REAXC/reaxc_vector.h | 3 --- 6 files changed, 36 deletions(-) diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index 9fe2542b47..642efd836e 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -105,7 +105,6 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, rvec dvec_li; rvec force; ivec rel_box_jl; - // rtensor total_rtensor, temp_rtensor; four_body_header *fbh; four_body_parameters *fbp; bond_data *pbond_ij, *pbond_jk, *pbond_kl; diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 7c417c0678..c83b26564a 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -155,7 +155,6 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; double BOA_ij, BOA_jk; rvec force; - // rtensor temp_rtensor, total_rtensor; // Tallying variables double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index 08a64f3c24..04e7bfcc1c 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -150,7 +150,6 @@ void Torsion_Angles( reax_system *system, control_params *control, rvec dvec_li; rvec force; ivec rel_box_jl; - // rtensor total_rtensor, temp_rtensor; four_body_header *fbh; four_body_parameters *fbp; bond_data *pbond_ij, *pbond_jk, *pbond_kl; diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index bef6475b6f..00c6de56ab 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -83,7 +83,6 @@ extern int ompTimingCGCount[LASTTIMINGINDEX]; /********************** TYPE DEFINITIONS ********************/ typedef int ivec[3]; typedef double rvec[3]; -typedef double rtensor[3][3]; typedef double rvec2[2]; // import LAMMPS' definition of tagint and bigint diff --git a/src/USER-REAXC/reaxc_vector.cpp b/src/USER-REAXC/reaxc_vector.cpp index e0e3a14782..2f06b57c02 100644 --- a/src/USER-REAXC/reaxc_vector.cpp +++ b/src/USER-REAXC/reaxc_vector.cpp @@ -100,35 +100,6 @@ void rvec_MakeZero( rvec v ) } -void rtensor_MatVec( rvec ret, rtensor m, rvec v ) -{ - int i; - rvec temp; - - if (ret == v) - { - for (i = 0; i < 3; ++i) - temp[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2]; - - for (i = 0; i < 3; ++i) - ret[i] = temp[i]; - } - else - { - for (i = 0; i < 3; ++i) - ret[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2]; - } -} - - -void rtensor_MakeZero( rtensor t ) -{ - t[0][0] = t[0][1] = t[0][2] = 0; - t[1][0] = t[1][1] = t[1][2] = 0; - t[2][0] = t[2][1] = t[2][2] = 0; -} - - void ivec_MakeZero( ivec v ) { v[0] = v[1] = v[2] = 0; diff --git a/src/USER-REAXC/reaxc_vector.h b/src/USER-REAXC/reaxc_vector.h index 549c1f927c..3dc36f96ef 100644 --- a/src/USER-REAXC/reaxc_vector.h +++ b/src/USER-REAXC/reaxc_vector.h @@ -42,9 +42,6 @@ double rvec_Norm( rvec ); void rvec_MakeZero( rvec ); void rvec_Random( rvec ); -void rtensor_MakeZero( rtensor ); -void rtensor_MatVec( rvec, rtensor, rvec ); - void ivec_MakeZero( ivec ); void ivec_Copy( ivec, ivec ); void ivec_Scale( ivec, double, ivec ); From 8b87eb9468da754a41d826512239a9a54ce5c02e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 15:49:51 -0400 Subject: [PATCH 019/119] remove unused file pointers and file streams --- src/USER-REAXC/reaxc_io_tools.cpp | 33 ------------------------------- src/USER-REAXC/reaxc_types.h | 10 ---------- 2 files changed, 43 deletions(-) diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 8c962d2bad..bb0b3e6b85 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -34,7 +34,6 @@ int Init_Output_Files(reax_system *system, control_params *control, output_controls *out_control, MPI_Comm world, char *msg) { - char temp[MAX_STR+8]; int ret; if (out_control->write_steps > 0) { @@ -42,26 +41,6 @@ int Init_Output_Files(reax_system *system, control_params *control, if (ret == FAILURE) return ret; } - - if (system->my_rank == MASTER_NODE) { - /* These files are written only by the master node */ - if (out_control->energy_update_freq > 0) { - - /* init potentials file */ - sprintf( temp, "%s.pot", control->sim_name ); - if ((out_control->pot = fopen( temp, "w" )) != nullptr) { - fflush( out_control->pot ); - } else { - strcpy( msg, "init_out_controls: .pot file could not be opened\n" ); - return FAILURE; - } - - /* init log file */ - } - - /* init pressure file */ - } - return SUCCESS; } @@ -71,18 +50,6 @@ int Close_Output_Files(reax_system *system, output_controls *out_control) if (out_control->write_steps > 0) End_Traj( system->my_rank, out_control ); - if (system->my_rank == MASTER_NODE) { - if (out_control->pot) { - fclose( out_control->pot ); - out_control->pot = nullptr; - } - - if (out_control->prs) { - fclose(out_control->prs); - out_control->prs = nullptr; - } - } - return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 00c6de56ab..fcc21cbda2 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -450,7 +450,6 @@ struct reax_list struct output_controls { FILE *strj; - int trj_offset; int atom_line_len; int bond_line_len; int angle_line_len; @@ -461,15 +460,6 @@ struct output_controls int buffer_len; char *buffer; - FILE *out; - FILE *pot; - FILE *log; - FILE *mol, *ign; - FILE *dpl; - FILE *drft; - FILE *pdb; - FILE *prs; - int write_steps; char traj_title[81]; int atom_info; From d1f004962a3a6e8c06e5472a0a5c35c74e098d85 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 17:13:31 -0400 Subject: [PATCH 020/119] convert fix qeq/reax to use modern LAMMPS file parsing --- src/USER-OMP/fix_qeq_reax_omp.cpp | 2 -- src/USER-REAXC/fix_qeq_reax.cpp | 52 +++++++++++++++++++------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index b1ab1e5d62..ddc89ac4dc 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -52,8 +52,6 @@ using namespace LAMMPS_NS; using namespace FixConst; #define EV_TO_KCAL_PER_MOL 14.4 -//#define DANGER_ZONE 0.95 -//#define LOOSE_ZONE 0.7 #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) #define MIN_NBRS 100 diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 4fd177f76e..1d342df999 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -33,6 +33,8 @@ #include "pair.h" #include "pair_reaxc.h" #include "respa.h" +#include "text_file_reader.h" +#include "tokenizer.h" #include "update.h" #include @@ -44,6 +46,13 @@ using namespace LAMMPS_NS; using namespace FixConst; +class parser_error : public std::exception { + std::string message; +public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } +}; + #define EV_TO_KCAL_PER_MOL 14.4 #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) @@ -193,8 +202,8 @@ void FixQEqReax::pertype_parameters(char *arg) { if (strcmp(arg,"reax/c") == 0) { reaxflag = 1; - Pair *pair = force->pair_match("reax/c",0); - if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/reax"); + Pair *pair = force->pair_match("^reax/c",0); + if (!pair) error->all(FLERR,"No reax/c pair style for fix qeq/reax"); int tmp; chi = (double *) pair->extract("chi",tmp); @@ -206,33 +215,36 @@ void FixQEqReax::pertype_parameters(char *arg) return; } - int i,itype,ntypes,rv; - double v1,v2,v3; - FILE *pf; - reaxflag = 0; - ntypes = atom->ntypes; + const int ntypes = atom->ntypes; memory->create(chi,ntypes+1,"qeq/reax:chi"); memory->create(eta,ntypes+1,"qeq/reax:eta"); memory->create(gamma,ntypes+1,"qeq/reax:gamma"); if (comm->me == 0) { - if ((pf = fopen(arg,"r")) == nullptr) - error->one(FLERR,"Fix qeq/reax parameter file could not be found"); + try { + TextFileReader reader(arg,"qeq/reax parameter"); + for (int i = 1; i <= ntypes; i++) { + const char *line = reader.next_line(); + if (!line) + throw parser_error("Invalid param file for fix qeq/reax"); + ValueTokenizer values(line); - for (i = 1; i <= ntypes && !feof(pf); i++) { - rv = fscanf(pf,"%d %lg %lg %lg",&itype,&v1,&v2,&v3); - if (rv != 4) - error->one(FLERR,"Fix qeq/reax: Incorrect format of param file"); - if (itype < 1 || itype > ntypes) - error->one(FLERR,"Fix qeq/reax: invalid atom type in param file"); - chi[itype] = v1; - eta[itype] = v2; - gamma[itype] = v3; + if (values.count() != 4) + throw parser_error("Fix qeq/reax: Incorrect format of param file"); + + int itype = values.next_int(); + if ((itype < 1) || (itype > ntypes)) + throw parser_error("Fix qeq/reax: invalid atom type in param file"); + + chi[itype] = values.next_double(); + eta[itype] = values.next_double(); + gamma[itype] = values.next_double(); + } + } catch (std::exception &e) { + error->one(FLERR,e.what()); } - if (i <= ntypes) error->one(FLERR,"Invalid param file for fix qeq/reax"); - fclose(pf); } MPI_Bcast(&chi[1],ntypes,MPI_DOUBLE,0,world); From 3eed9f23c8fe70e8c8592580fba43f077b81bfd8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 17:54:04 -0400 Subject: [PATCH 021/119] replace sprintf() into local char buffers with fmtlib --- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 26 ++++------- src/KOKKOS/pair_reaxc_kokkos.cpp | 8 ++-- src/USER-OMP/fix_qeq_reax_omp.cpp | 33 +++++-------- src/USER-OMP/reaxc_forces_omp.cpp | 20 ++++---- src/USER-OMP/reaxc_valence_angles_omp.cpp | 26 +++++------ src/USER-REAXC/fix_qeq_reax.cpp | 21 +++------ src/USER-REAXC/fix_reaxc_bonds.cpp | 27 ++++++----- src/USER-REAXC/fix_reaxc_species.cpp | 15 +++--- src/USER-REAXC/reaxc_allocate.cpp | 57 ++++++++--------------- src/USER-REAXC/reaxc_allocate.h | 10 ++-- src/USER-REAXC/reaxc_valence_angles.cpp | 12 ++--- 11 files changed, 99 insertions(+), 156 deletions(-) diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index 7e4d99e1c3..fe1969c54f 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -838,14 +838,11 @@ void FixQEqReaxKokkos::cg_solve1() Kokkos::parallel_for(inum,vecsum2_functor); } - if (loop >= imax && comm->me == 0) { - char str[128]; - sprintf(str,"Fix qeq/reax cg_solve1 convergence failed after %d iterations " - "at " BIGINT_FORMAT " step: %f",loop,update->ntimestep,sqrt(sig_new)/b_norm); - error->warning(FLERR,str); - //error->all(FLERR,str); - } - + if (loop >= imax && comm->me == 0) + error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve1 convergence " + "failed after {} iterations at step {}: " + "{}", loop, update->ntimestep, + sqrt(sig_new)/b_norm)); } /* ---------------------------------------------------------------------- */ @@ -970,14 +967,11 @@ void FixQEqReaxKokkos::cg_solve2() Kokkos::parallel_for(inum,vecsum2_functor); } - if (loop >= imax && comm->me == 0) { - char str[128]; - sprintf(str,"Fix qeq/reax cg_solve2 convergence failed after %d iterations " - "at " BIGINT_FORMAT " step: %f",loop,update->ntimestep,sqrt(sig_new)/b_norm); - error->warning(FLERR,str); - //error->all(FLERR,str); - } - + if (loop >= imax && comm->me == 0) + error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve2 convergence " + "failed after {} iterations at step {}: " + "{}", loop, update->ntimestep, + sqrt(sig_new)/b_norm)); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 75a1448b33..f9f3ebfdfa 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -349,11 +349,9 @@ void PairReaxCKokkos::init_md() if (swb < 0) error->one(FLERR,"Negative upper Taper-radius cutoff"); - else if (swb < 5) { - char str[128]; - sprintf(str,"Warning: very low Taper-radius cutoff: %f\n", swb); - error->one(FLERR,str); - } + else if (swb < 5) + error->one(FLERR,fmt::format("Warning: very low Taper-radius cutoff: " + "{}\n", swb)); d1 = swb - swa; d7 = powint(d1,7); diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index ddc89ac4dc..66760b8aa3 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -224,16 +224,11 @@ void FixQEqReaxOMP::compute_H() H.numnbrs[i] = mfill - H.firstnbr[i]; } } - - if (mfill >= H.m) { - char str[128]; - sprintf(str,"H matrix size has been exceeded: mfill=%d H.m=%d\n", - mfill, H.m); - error->warning(FLERR,str); - error->all(FLERR,"Fix qeq/reax/omp has insufficient QEq matrix size"); - } } // omp + if (m_fill >= H.m) + error->all(FLERR,fmt::format("Fix qeq/reax: H matrix size has been " + "exceeded: m_fill={} H.m={}\n", m_fill, H.m)); } /* ---------------------------------------------------------------------- */ @@ -528,13 +523,10 @@ int FixQEqReaxOMP::CG( double *b, double *x) } } - if (i >= imax && comm->me == 0) { - char str[128]; - sprintf(str,"Fix qeq/reax CG convergence failed after %d iterations " - "at " BIGINT_FORMAT " step",i,update->ntimestep); - error->warning(FLERR,str); - } - + if (i >= imax && comm->me == 0) + error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " + "after {} iterations at step {}", + i,update->ntimestep)); return i; } @@ -882,13 +874,10 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) startTimeBase = endTimeBase; #endif - if ( i >= imax && comm->me == 0) { - char str[128]; - sprintf(str,"Fix qeq/reax CG convergence failed after %d iterations " - "at " BIGINT_FORMAT " step",i,update->ntimestep); - error->warning(FLERR,str); - } - + if ( i >= imax && comm->me == 0) + error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " + "after {} iterations at step {}", + i,update->ntimestep)); return i; } diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 05a72c93eb..aff543225d 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -270,12 +270,10 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * comp = Start_Index(i+1, bonds); else comp = bonds->num_intrs; - if (End_Index(i, bonds) > comp) { - char errmsg[256]; - snprintf(errmsg, 256, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n", - step, i, End_Index(i,bonds), comp ); - system->error_ptr->one(FLERR,errmsg); - } + if (End_Index(i, bonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " + "i={} end(i)={} str(i+1)={}\n", + step,i,End_Index(i,bonds),comp)); } } @@ -297,12 +295,10 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * comp = Start_Index(Hindex+1, hbonds); else comp = hbonds->num_intrs; - if (End_Index(Hindex, hbonds) > comp) { - char errmsg[256]; - snprintf(errmsg, 256, "step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", - step, Hindex, End_Index(Hindex,hbonds), comp ); - system->error_ptr->one(FLERR, errmsg); - } + if (End_Index(Hindex, hbonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " + "H={} end(H)={} str(H+1)={}\n", + step, Hindex,End_Index(Hindex,hbonds),comp)); } } } diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index c83b26564a..167f647790 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -239,15 +239,12 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, } // for (pi) // Confirm that thb_intrs->num_intrs / nthreads is enough to hold all angles from a single atom - if (my_offset >= (tid+1)*per_thread) { - char errmsg[512]; - snprintf( errmsg, 512, "step%d-ran out of space on angle_list for atom %i:\n" - " nthreads= %d, tid=%d, my_offset=%d, per_thread=%d\n" - " num_intrs= %i N= %i\n" - , data->step, j, nthreads, tid, my_offset, per_thread,thb_intrs->num_intrs , system->N); - control->error_ptr->one(FLERR, errmsg); - } - + if (my_offset >= (tid+1)*per_thread) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list for atom {}:\n" + " nthreads={} tid={} my_offset={} per_thread={}\n" + " num_intrs={} N={}",data->step,j,nthreads,tid, + my_offset,per_thread,thb_intrs->num_intrs,system->N)); // Number of angles owned by this atom _my_offset[j] = my_offset - tid * per_thread; } // for (j) @@ -597,12 +594,11 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { workspace->realloc.num_3body = num_thb_intrs * TWICE; - if (num_thb_intrs > thb_intrs->num_intrs) { - char errmsg[128]; - snprintf(errmsg, 128, "step%d-ran out of space on angle_list: top=%d, max=%d", - data->step, num_thb_intrs, thb_intrs->num_intrs); - control->error_ptr->one(FLERR, errmsg); - } + if (num_thb_intrs > thb_intrs->num_intrs) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list: top={}, max={}", + data->step, num_thb_intrs, + thb_intrs->num_intrs)); } #ifdef OMP_TIMING diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 1d342df999..2472fc3098 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -652,13 +652,9 @@ void FixQEqReax::compute_H() } } - if (m_fill >= H.m) { - char str[128]; - sprintf(str,"H matrix size has been exceeded: m_fill=%d H.m=%d\n", - m_fill, H.m); - error->warning(FLERR,str); - error->all(FLERR,"Fix qeq/reax has insufficient QEq matrix size"); - } + if (m_fill >= H.m) + error->all(FLERR,fmt::format("Fix qeq/reax: H matrix size has been " + "exceeded: m_fill={} H.m={}\n", m_fill, H.m)); } /* ---------------------------------------------------------------------- */ @@ -731,13 +727,10 @@ int FixQEqReax::CG( double *b, double *x) vector_sum( d, 1., p, beta, d, nn ); } - if (i >= imax && comm->me == 0) { - char str[128]; - sprintf(str,"Fix qeq/reax CG convergence failed after %d iterations " - "at " BIGINT_FORMAT " step",i,update->ntimestep); - error->warning(FLERR,str); - } - + if (i >= imax && comm->me == 0) + error->warning(FLERR,fmt::format("Fix qeq/reax CG convergence failed " + "after {} iterations at step {}", + i,update->ntimestep)); return i; } diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 0cb78521f2..26cd7870ff 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -17,18 +17,20 @@ #include "fix_reaxc_bonds.h" -#include #include "atom.h" -#include "update.h" -#include "pair_reaxc.h" -#include "neigh_list.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "pair_reaxc.h" +#include "update.h" + #include "reaxc_list.h" #include "reaxc_types.h" #include "reaxc_defs.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -53,23 +55,20 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : char *suffix = strrchr(arg[4],'.'); if (suffix && strcmp(suffix,".gz") == 0) { #ifdef LAMMPS_GZIP - char gzip[128]; - snprintf(gzip,128,"gzip -6 > %s",arg[4]); + auto gzip = fmt::format("gzip -6 > {}",arg[4]); #ifdef _WIN32 - fp = _popen(gzip,"wb"); + fp = _popen(gzip.c_str(),"wb"); #else - fp = popen(gzip,"w"); + fp = popen(gzip.c_str(),"w"); #endif #else error->one(FLERR,"Cannot open gzipped file"); #endif } else fp = fopen(arg[4],"w"); - if (fp == nullptr) { - char str[128]; - snprintf(str,128,"Cannot open fix reax/c/bonds file %s",arg[4]); - error->one(FLERR,str); - } + if (!fp) + error->one(FLERR,fmt::format("Cannot open fix reax/c/bonds file {}: " + "{}",arg[4],utils::getsyserror())); } if (atom->tag_consecutive() == 0) diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 81b1dafa61..8128b23662 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -108,23 +108,20 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : char *suffix = strrchr(arg[6],'.'); if (suffix && strcmp(suffix,".gz") == 0) { #ifdef LAMMPS_GZIP - char gzip[128]; - sprintf(gzip,"gzip -6 > %s",arg[6]); + auto gzip = fmt::format("gzip -6 > {}",arg[6]); #ifdef _WIN32 - fp = _popen(gzip,"wb"); + fp = _popen(gzip.c_str(),"wb"); #else - fp = popen(gzip,"w"); + fp = popen(gzip.c_str(),"w"); #endif #else error->one(FLERR,"Cannot open gzipped file"); #endif } else fp = fopen(arg[6],"w"); - if (fp == nullptr) { - char str[128]; - snprintf(str,128,"Cannot open fix reax/c/species file %s",arg[6]); - error->one(FLERR,str); - } + if (!fp) + error->one(FLERR,fmt::format("Cannot open fix reax/c/species file {}: " + "{}",arg[6],utils::getsyserror())); } x0 = nullptr; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index b0d83fc70d..3f0a251a97 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -70,16 +70,6 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, /************* system *************/ -int Allocate_System( reax_system *system, int /*local_cap*/, int total_cap, - char * /*msg*/ ) -{ - system->my_atoms = (reax_atom*) - realloc( system->my_atoms, total_cap*sizeof(reax_atom) ); - - return SUCCESS; -} - - void DeAllocate_System( reax_system *system ) { int i, j, k; @@ -359,17 +349,16 @@ void ReAllocate( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists ) { auto error = system->error_ptr; - int num_bonds, est_3body, Hflag, ret; + int num_bonds, est_3body, Hflag; int newsize; - reallocate_data *realloc; + reallocate_data *wsr; reax_list *far_nbrs; - char msg[200]; int mincap = system->mincap; double safezone = system->safezone; double saferzone = system->saferzone; - realloc = &(workspace->realloc); + wsr = &(workspace->realloc); if ( system->n >= DANGER_ZONE * system->local_cap || (0 && system->n <= LOOSE_ZONE * system->local_cap)) { @@ -385,13 +374,8 @@ void ReAllocate( reax_system *system, control_params *control, if (Nflag) { /* system */ - ret = Allocate_System( system, system->local_cap, system->total_cap, msg ); - if (ret != SUCCESS) { - char errmsg[256]; - snprintf(errmsg, 256, "Not enough space for atom_list: total_cap=%d", system->total_cap); - error->one(FLERR, errmsg); - } - + system->my_atoms = (reax_atom *)::realloc(system->my_atoms, + system->total_cap*sizeof(reax_atom)); /* workspace */ DeAllocate_Workspace(control, workspace); Allocate_Workspace(control, workspace, system->total_cap); @@ -401,16 +385,16 @@ void ReAllocate( reax_system *system, control_params *control, far_nbrs = *lists + FAR_NBRS; - if (Nflag || realloc->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { - if (realloc->num_far > far_nbrs->num_intrs) + if (Nflag || wsr->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { + if (wsr->num_far > far_nbrs->num_intrs) error->one(FLERR,fmt::format("step{}: ran out of space on far_nbrs: top={}, max={}", - data->step, realloc->num_far, far_nbrs->num_intrs)); + data->step, wsr->num_far, far_nbrs->num_intrs)); newsize = static_cast - (MAX( realloc->num_far*safezone, mincap*REAX_MIN_NBRS)); + (MAX( wsr->num_far*safezone, mincap*REAX_MIN_NBRS)); Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize); - realloc->num_far = 0; + wsr->num_far = 0; } /* hydrogen bonds list */ @@ -422,35 +406,34 @@ void ReAllocate( reax_system *system, control_params *control, system->Hcap = int(MAX( system->numH * saferzone, mincap )); } - if (Hflag || realloc->hbonds) { - ret = Reallocate_HBonds_List( system, (*lists)+HBONDS); - realloc->hbonds = 0; + if (Hflag || wsr->hbonds) { + Reallocate_HBonds_List( system, (*lists)+HBONDS); + wsr->hbonds = 0; } } /* bonds list */ num_bonds = est_3body = -1; - if (Nflag || realloc->bonds) { + if (Nflag || wsr->bonds) { Reallocate_Bonds_List( system, (*lists)+BONDS, &num_bonds, &est_3body); - realloc->bonds = 0; - realloc->num_3body = MAX( realloc->num_3body, est_3body ) * 2; + wsr->bonds = 0; + wsr->num_3body = MAX( wsr->num_3body, est_3body ) * 2; } /* 3-body list */ - if (realloc->num_3body > 0) { + if (wsr->num_3body > 0) { Delete_List( (*lists)+THREE_BODIES); if (num_bonds == -1) num_bonds = ((*lists)+BONDS)->num_intrs; - realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); + wsr->num_3body = (int)(MAX(wsr->num_3body*safezone, MIN_3BODIES)); - if ( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, + if ( !Make_List( num_bonds, wsr->num_3body, TYP_THREE_BODY, (*lists)+THREE_BODIES )) { error->one(FLERR, "Problem in initializing angles list"); } - realloc->num_3body = -1; + wsr->num_3body = -1; } - } diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index e94066113b..7229927b57 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -28,14 +28,14 @@ #define __ALLOCATE_H_ #include "reaxc_types.h" -int PreAllocate_Space( reax_system*, control_params*, storage* ); -int Allocate_System( reax_system*, int, int, char* ); -void DeAllocate_System( reax_system* ); +int PreAllocate_Space(reax_system *, control_params *, storage *); + +void DeAllocate_System(reax_system *); void Allocate_Workspace(control_params *, storage *, int); void DeAllocate_Workspace(control_params *, storage *); -void ReAllocate( reax_system*, control_params*, simulation_data*, storage*, - reax_list** ); +void ReAllocate(reax_system *, control_params *, simulation_data *, + storage*, reax_list**); #endif diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index 78887e5ecc..b363fd8e04 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -403,12 +403,10 @@ void Valence_Angles( reax_system *system, control_params *control, if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { workspace->realloc.num_3body = num_thb_intrs; - if (num_thb_intrs > thb_intrs->num_intrs) { - char errmsg[128]; - snprintf(errmsg, 128, "step%d-ran out of space on angle_list: top=%d, max=%d", - data->step, num_thb_intrs, thb_intrs->num_intrs); - control->error_ptr->one(FLERR, errmsg); - } + if (num_thb_intrs > thb_intrs->num_intrs) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list: top={}, max={}", + data->step, num_thb_intrs, + thb_intrs->num_intrs)); } - } From 6c07d2fb118dd9dbddc9ddd705b63b2b8a4301ab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 20:08:25 -0400 Subject: [PATCH 022/119] replace some more sprintf() calls to local buffers with fmtlib --- src/USER-REAXC/reaxc_forces.cpp | 20 ++++++++------------ src/USER-REAXC/reaxc_init_md.cpp | 9 +++------ src/USER-REAXC/reaxc_list.cpp | 8 ++------ src/USER-REAXC/reaxc_reset_tools.cpp | 20 ++++++++------------ src/USER-REAXC/reaxc_traj.cpp | 14 +++++--------- 5 files changed, 26 insertions(+), 45 deletions(-) diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index d135571009..7e412afbd6 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -131,12 +131,10 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l comp = Start_Index(i+1, bonds); else comp = bonds->num_intrs; - if (End_Index(i, bonds) > comp) { - char errmsg[256]; - snprintf(errmsg, 256, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n", - step, i, End_Index(i,bonds), comp ); - system->error_ptr->one(FLERR,errmsg); - } + if (End_Index(i, bonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " + "i={} end(i)={} str(i+1)={}\n", + step,i,End_Index(i,bonds),comp)); } } @@ -159,12 +157,10 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l comp = Start_Index(Hindex+1, hbonds); else comp = hbonds->num_intrs; - if (End_Index(Hindex, hbonds) > comp) { - char errmsg[256]; - snprintf(errmsg, 256, "step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", - step, Hindex, End_Index(Hindex,hbonds), comp ); - system->error_ptr->one(FLERR, errmsg); - } + if (End_Index(Hindex, hbonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " + "H={} end(H)={} str(H+1)={}\n", + step, Hindex,End_Index(Hindex,hbonds),comp)); } } } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 44dbc764af..e94037c5f5 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -90,12 +90,9 @@ void Init_Taper(control_params *control, storage *workspace) if (swb < 0) { error->all(FLERR,"Negative upper Taper-radius cutoff"); } - else if (swb < 5 && control->me == 0) { - char errmsg[256]; - snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb); - error->warning(FLERR, errmsg); - } - + else if (swb < 5 && control->me == 0) + error->warning(FLERR,fmt::format("Warning: very low Taper-radius cutoff: " + "{}\n", swb)); d1 = swb - swa; d7 = pow(d1, 7.0); swa2 = SQR(swa); diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index ff5cf98900..b48a9a540e 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -89,9 +89,7 @@ int Make_List(int n, int num_intrs, int type, reax_list *l ) break; default: - char errmsg[128]; - snprintf(errmsg, 128, "No %d list type defined", l->type); - l->error_ptr->one(FLERR,errmsg); + l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); } return SUCCESS; @@ -140,9 +138,7 @@ void Delete_List( reax_list *l ) break; default: - char errmsg[128]; - snprintf(errmsg, 128, "No %d list type defined", l->type); - l->error_ptr->all(FLERR,errmsg); + l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); } } diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index dbd879a2a8..5d3053fb37 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -105,12 +105,10 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, /* is reallocation needed? */ if (total_bonds >= bonds->num_intrs * DANGER_ZONE) { workspace->realloc.bonds = 1; - if (total_bonds >= bonds->num_intrs) { - char errmsg[256]; - snprintf(errmsg, 256, "Not enough space for bonds! total=%d allocated=%d\n", - total_bonds, bonds->num_intrs); - control->error_ptr->one(FLERR, errmsg); - } + if (total_bonds >= bonds->num_intrs) + control->error_ptr->one(FLERR,fmt::format("Not enough space for bonds! " + "total={} allocated={}\n", + total_bonds, bonds->num_intrs)); } } @@ -131,12 +129,10 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, /* is reallocation needed? */ if (total_hbonds >= hbonds->num_intrs * 0.90/*DANGER_ZONE*/) { workspace->realloc.hbonds = 1; - if (total_hbonds >= hbonds->num_intrs) { - char errmsg[256]; - snprintf(errmsg, 256, "Not enough space for hbonds! total=%d allocated=%d\n", - total_hbonds, hbonds->num_intrs); - control->error_ptr->one(FLERR, errmsg); - } + if (total_hbonds >= hbonds->num_intrs) + control->error_ptr->one(FLERR,fmt::format("Not enough space for hbonds! " + "total={} allocated={}\n", + total_hbonds, hbonds->num_intrs)); } } } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 96b216241a..280f40b7d3 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -41,12 +41,9 @@ int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_ out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (out_control->buffer == nullptr) { - char errmsg[256]; - snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*REAX_SAFE_ZONE)); - error_ptr->one(FLERR,errmsg); - } - + if (!out_control->buffer) + error_ptr->one(FLERR,fmt::format("Insufficient memory for required buffer " + "size {}", (req_space*REAX_SAFE_ZONE))); return SUCCESS; } @@ -286,7 +283,6 @@ int Write_Init_Desc(reax_system *system, output_controls *out_control, int Init_Traj(reax_system *system, control_params *control, output_controls *out_control, MPI_Comm world, char *msg) { - char fname[MAX_STR+8]; int atom_line_len[ NR_OPT_ATOM ] = { 0, 0, 0, 0, ATOM_BASIC_LEN, ATOM_wV_LEN, ATOM_wF_LEN, ATOM_FULL_LEN }; @@ -294,7 +290,7 @@ int Init_Traj(reax_system *system, control_params *control, int angle_line_len[ NR_OPT_ANGLE ] = { 0, ANGLE_BASIC_LEN }; /* generate trajectory name */ - sprintf( fname, "%s.trj", control->sim_name ); + auto fname = std::string(control->sim_name) + ".trj"; /* how should I write atoms? */ out_control->atom_line_len = atom_line_len[ out_control->atom_info ]; @@ -313,7 +309,7 @@ int Init_Traj(reax_system *system, control_params *control, /* write trajectory header and atom info, if applicable */ if (system->my_rank == MASTER_NODE) - out_control->strj = fopen(fname, "w"); + out_control->strj = fopen(fname.c_str(), "w"); Write_Header(system, control, out_control); Write_Init_Desc(system, out_control, world); From 2c38d1b7d4546558e42d07bad8aa9c14f85a170f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Apr 2021 21:19:00 -0400 Subject: [PATCH 023/119] reax/c native trajectory output cleanup/simplification --- src/USER-OMP/reaxc_init_md_omp.cpp | 4 +- src/USER-REAXC/reaxc_init_md.cpp | 4 +- src/USER-REAXC/reaxc_io_tools.cpp | 21 +- src/USER-REAXC/reaxc_io_tools.h | 5 +- src/USER-REAXC/reaxc_traj.cpp | 588 +++++++++++------------------ src/USER-REAXC/reaxc_traj.h | 78 +--- src/USER-REAXC/reaxc_types.h | 1 - 7 files changed, 231 insertions(+), 470 deletions(-) diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index 31360a3bc0..d20ab954fe 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -127,9 +127,7 @@ void InitializeOMP(reax_system *system, control_params *control, Init_Workspace(system,control,workspace); Init_ListsOMP(system,control,lists); - if (Init_Output_Files(system,control,out_control,world,msg)== FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Could not open output files! " - "Terminating.",msg)); + Init_Output_Files(system,control,out_control,world); if (control->tabulate) if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index e94037c5f5..beb7d1b87c 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -196,9 +196,7 @@ void Initialize(reax_system *system, control_params *control, error->one(FLERR,fmt::format("Error on: {}. System could not be " "initialized. Terminating.",msg)); - if (Init_Output_Files(system,control,out_control,world,msg)== FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Could not open output files! " - "Terminating.",msg)); + Init_Output_Files(system,control,out_control,world); if (control->tabulate) if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index bb0b3e6b85..2f5c6b8f65 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -31,29 +31,20 @@ #include "reaxc_system_props.h" #include "reaxc_traj.h" -int Init_Output_Files(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world, char *msg) +void Init_Output_Files(reax_system *system, control_params *control, + output_controls *out_control, MPI_Comm world) { - int ret; - - if (out_control->write_steps > 0) { - ret = Init_Traj( system, control, out_control, world, msg ); - if (ret == FAILURE) - return ret; - } - return SUCCESS; + if (out_control->write_steps > 0) + Init_Traj(system, control, out_control, world); } /************************ close output files ************************/ -int Close_Output_Files(reax_system *system, output_controls *out_control) +void Close_Output_Files(reax_system *system, output_controls *out_control) { if (out_control->write_steps > 0) - End_Traj( system->my_rank, out_control ); - - return SUCCESS; + End_Traj(system->my_rank, out_control); } - void Output_Results(reax_system *system, control_params *control, simulation_data *data, reax_list **lists, output_controls *out_control, MPI_Comm world) diff --git a/src/USER-REAXC/reaxc_io_tools.h b/src/USER-REAXC/reaxc_io_tools.h index 643b563f73..8b69125032 100644 --- a/src/USER-REAXC/reaxc_io_tools.h +++ b/src/USER-REAXC/reaxc_io_tools.h @@ -30,9 +30,8 @@ #include "reaxc_types.h" #include -int Init_Output_Files(reax_system *, control_params *, - output_controls *, MPI_Comm, char *); -int Close_Output_Files(reax_system *, output_controls *); +void Init_Output_Files(reax_system *, control_params *, output_controls *, MPI_Comm); +void Close_Output_Files(reax_system *, output_controls *); void Output_Results(reax_system *, control_params *, simulation_data *, reax_list **, output_controls *, MPI_Comm); #endif diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 280f40b7d3..6c8c1e079d 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -25,42 +25,79 @@ ----------------------------------------------------------------------*/ #include "reaxc_traj.h" + #include #include #include #include + #include "reaxc_defs.h" #include "reaxc_list.h" #include "error.h" -int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space ) +#define MAX_TRJ_LINE_LEN 120 +#define MAX_TRJ_BUFFER_SIZE (MAX_TRJ_LINE_LEN * 100) + +#define NUM_HEADER_LINES 37 +#define HEADER_LINE_LEN 62 +#define INIT_DESC_LEN 32 + +#define ATOM_BASIC_LEN 50 +#define ATOM_wV_LEN 80 +#define ATOM_wF_LEN 80 +#define ATOM_FULL_LEN 110 + +#define BOND_BASIC_LEN 39 +#define BOND_FULL_LEN 69 +#define ANGLE_BASIC_LEN 38 + +enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; +enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; +enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; + +std::string fmtline(const char *key, double val) +{ + return fmt::format("{:<37}{:<24.3f}\n",key,val); +} + +std::string fmtline(const char *key, double val1, double val2, double val3) +{ + return fmt::format("{:<32}{:>9.3f},{:>9.3f},{:>9.3f}\n",key,val1,val2,val3); +} + +template +std::string fmtline(const char *key, T val) +{ + return fmt::format("{:<37}{:<24}\n",key,val); +} + +template +std::string fmtline(const char *key, T val1, T val2) +{ + return fmt::format("{:<36}{:<12},{:<12}\n",key,val1,val2); +} + +void Reallocate_Output_Buffer(LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space) { if (out_control->buffer_len > 0) - free( out_control->buffer ); + free(out_control->buffer); out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); if (!out_control->buffer) error_ptr->one(FLERR,fmt::format("Insufficient memory for required buffer " "size {}", (req_space*REAX_SAFE_ZONE))); - return SUCCESS; } -void Write_Skip_Line(output_controls *out_control, - int my_rank, int skip, int num_section) +void Write_Skip_Line(output_controls *out_control, int my_rank, int skip, int num_section) { if (my_rank == MASTER_NODE) - fprintf( out_control->strj, INT2_LINE, - "chars_to_skip_section:", skip, num_section ); + fmt::print(out_control->strj,fmtline("chars_to_skip_section:",skip,num_section)); } - -int Write_Header(reax_system *system, control_params *control, - output_controls *out_control) +void Write_Header(reax_system *system, control_params *control, output_controls *out_control) { - int num_hdr_lines, my_hdr_lines, buffer_req; - char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", "xyz_q", "xyz_q_fxfyfz", @@ -71,166 +108,71 @@ int Write_Header(reax_system *system, control_params *control, "detailed_bond_info" }; char angle_formats[2][30] = { "none", "basic_angle_info" }; - /* set header lengths */ - num_hdr_lines = NUM_HEADER_LINES; - my_hdr_lines = num_hdr_lines * ( system->my_rank == MASTER_NODE ); - buffer_req = my_hdr_lines * HEADER_LINE_LEN; - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req ); - /* only the master node writes into trajectory header */ if (system->my_rank == MASTER_NODE) { - /* clear the contents of line & buffer */ - out_control->line[0] = 0; - out_control->buffer[0] = 0; - + std::string buffer(""); + /* to skip the header */ - sprintf( out_control->line, INT_LINE, "chars_to_skip_header:", - (num_hdr_lines-1) * HEADER_LINE_LEN ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("chars_to_skip_header:",(NUM_HEADER_LINES-1) * HEADER_LINE_LEN); /* general simulation info */ - sprintf( out_control->line, STR_LINE, "simulation_name:", - out_control->traj_title ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, BIGINT_LINE, "number_of_atoms:", system->bigN ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "ensemble_type:", "(unknown)"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "number_of_steps:", 0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "timestep_length_(in_fs):", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("simulation_name:", out_control->traj_title); + buffer += fmtline("number_of_atoms:", system->bigN); + buffer += fmtline("ensemble_type:", "(unknown)"); + buffer += fmtline("number_of_steps:", 0); + buffer += fmtline("timestep_length_(in_fs):", 0.0); /* restart info */ - sprintf( out_control->line, STR_LINE, "is_this_a_restart?:", "no"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "write_restart_files?:", "no"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "frequency_to_write_restarts:", 0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("is_this_a_restart?:", "no"); + buffer += fmtline("write_restart_files?:", "no"); + buffer += fmtline("frequency_to_write_restarts:", 0); /* preferences */ - sprintf( out_control->line, STR_LINE, "tabulate_long_range_intrs?:", - (control->tabulate ? "yes" : "no") ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "table_size:", control->tabulate ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "restrict_bonds?:", "no"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "bond_restriction_length:", 0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "reposition_atoms?:", "fit to periodic box"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "remove_CoM_velocity?:", 0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - /* cut-off values */ - sprintf( out_control->line, REAL_LINE, "bonded_intr_dist_cutoff:", - control->bond_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "nonbonded_intr_dist_cutoff:", - control->nonb_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "hbond_dist_cutoff:", - control->hbond_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "reax_bond_threshold:", - control->bo_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "physical_bond_threshold:", - control->bg_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "valence_angle_threshold:", - control->thb_cut ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, SCI_LINE, "QEq_tolerance:", 0.0 ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("tabulate_long_range_intrs?:",(control->tabulate ? "yes" : "no")); + buffer += fmtline("table_size:", control->tabulate); + buffer += fmtline("restrict_bonds?:", "no"); + buffer += fmtline("bond_restriction_length:", 0); + buffer += fmtline("reposition_atoms?:", "fit to periodic box"); + buffer += fmtline("remove_CoM_velocity?:", 0); + buffer += fmtline("bonded_intr_dist_cutoff:",control->bond_cut); + buffer += fmtline("nonbonded_intr_dist_cutoff:",control->nonb_cut); + buffer += fmtline("hbond_dist_cutoff:",control->hbond_cut); + buffer += fmtline("reax_bond_threshold:",control->bo_cut); + buffer += fmtline("physical_bond_threshold:", control->bg_cut); + buffer += fmtline("valence_angle_threshold:",control->thb_cut); + buffer += fmtline("QEq_tolerance:", 0.0); /* temperature controls */ - sprintf( out_control->line, REAL_LINE, "initial_temperature:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "target_temperature:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "thermal_inertia:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "temperature_regime:", "(unknown)"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "temperature_change_rate_(K/ps):", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("initial_temperature:", 0.0); + buffer += fmtline("target_temperature:", 0.0); + buffer += fmtline("thermal_inertia:", 0.0); + buffer += fmtline("temperature_regime:", "(unknown)"); + buffer += fmtline("temperature_change_rate_(K/ps):", 0.0); /* pressure controls */ - sprintf( out_control->line, REAL3_LINE, "target_pressure_(GPa):", 0.0, 0.0, 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL3_LINE, "virial_inertia:", 0.0, 0.0, 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("target_pressure_(GPa):", 0.0, 0.0, 0.0); + buffer += fmtline("virial_inertia:", 0.0, 0.0, 0.0); /* trajectory */ - sprintf( out_control->line, INT_LINE, "energy_dumping_freq:", - out_control->energy_update_freq ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, INT_LINE, "trajectory_dumping_freq:", - out_control->write_steps ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "compress_trajectory_output?:", "no"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "trajectory_format:", "regular"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "atom_info:", - atom_formats[ out_control->atom_info ] ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "bond_info:", - bond_formats[ out_control->bond_info ] ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, STR_LINE, "angle_info:", - angle_formats[ out_control->angle_info ] ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("energy_dumping_freq:", out_control->energy_update_freq); + buffer += fmtline("trajectory_dumping_freq:",out_control->write_steps); + buffer += fmtline("compress_trajectory_output?:", "no"); + buffer += fmtline("trajectory_format:", "regular"); + buffer += fmtline("atom_info:", atom_formats[out_control->atom_info]); + buffer += fmtline("bond_info:", bond_formats[out_control->bond_info]); + buffer += fmtline("angle_info:", angle_formats[out_control->angle_info]); /* analysis */ - sprintf( out_control->line, STR_LINE, "molecular_analysis:", "no"); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - sprintf( out_control->line, INT_LINE, "molecular_analysis_frequency:", 0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("molecular_analysis:", "no"); + buffer += fmtline("molecular_analysis_frequency:", 0); + + /* dump out the buffer */ + + fputs(buffer.c_str(),out_control->strj); } - - /* dump out the buffer */ - if (system->my_rank == MASTER_NODE) - fprintf( out_control->strj, "%s", out_control->buffer ); - - return SUCCESS; } - -int Write_Init_Desc(reax_system *system, output_controls *out_control, - MPI_Comm world) +void Write_Init_Desc(reax_system *system, output_controls *out_control, MPI_Comm world) { int i, me, np, cnt, buffer_len, buffer_req; reax_atom *p_atom; @@ -247,63 +189,55 @@ int Write_Init_Desc(reax_system *system, output_controls *out_control, else buffer_req = system->n * INIT_DESC_LEN + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - out_control->line[0] = 0; out_control->buffer[0] = 0; for (i = 0; i < system->n; ++i) { - p_atom = &( system->my_atoms[i] ); - sprintf( out_control->line, INIT_DESC, - p_atom->orig_id, p_atom->type, p_atom->name, - system->reax_param.sbp[ p_atom->type ].mass ); - strncpy( out_control->buffer + i*INIT_DESC_LEN, - out_control->line, INIT_DESC_LEN+1 ); + p_atom = &(system->my_atoms[i]); + auto buffer = fmt::format("{:9}{:3}{:9}{:10.3f}\n", + p_atom->orig_id, p_atom->type, p_atom->name, + system->reax_param.sbp[p_atom->type].mass); + strncpy(out_control->buffer + i*INIT_DESC_LEN, buffer.c_str(), INIT_DESC_LEN+1); } if (me != MASTER_NODE) { MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np * INIT_DESCS + me, world); + np * INIT_DESCS + me, world); } else { buffer_len = system->n * INIT_DESC_LEN; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { - MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*INIT_DESCS+i, world, &status ); - MPI_Get_count( &status, MPI_CHAR, &cnt ); + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*INIT_DESCS+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); buffer_len += cnt; } out_control->buffer[buffer_len] = 0; - fprintf( out_control->strj, "%s", out_control->buffer ); + fputs(out_control->buffer,out_control->strj); } - - return SUCCESS; } - -int Init_Traj(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world, char *msg) +void Init_Traj(reax_system *system, control_params *control, + output_controls *out_control, MPI_Comm world) { - int atom_line_len[ NR_OPT_ATOM ] = { 0, 0, 0, 0, - ATOM_BASIC_LEN, ATOM_wV_LEN, - ATOM_wF_LEN, ATOM_FULL_LEN }; - int bond_line_len[ NR_OPT_BOND ] = { 0, BOND_BASIC_LEN, BOND_FULL_LEN }; - int angle_line_len[ NR_OPT_ANGLE ] = { 0, ANGLE_BASIC_LEN }; + int atom_line_len[NR_OPT_ATOM] = { 0, 0, 0, 0, ATOM_BASIC_LEN, ATOM_wV_LEN, ATOM_wF_LEN, ATOM_FULL_LEN}; + int bond_line_len[NR_OPT_BOND] = { 0, BOND_BASIC_LEN, BOND_FULL_LEN }; + int angle_line_len[NR_OPT_ANGLE] = { 0, ANGLE_BASIC_LEN }; /* generate trajectory name */ auto fname = std::string(control->sim_name) + ".trj"; /* how should I write atoms? */ - out_control->atom_line_len = atom_line_len[ out_control->atom_info ]; - out_control->write_atoms = ( out_control->atom_line_len ? 1 : 0 ); + out_control->atom_line_len = atom_line_len[out_control->atom_info]; + out_control->write_atoms = (out_control->atom_line_len ? 1 : 0); /* bonds? */ - out_control->bond_line_len = bond_line_len[ out_control->bond_info ]; - out_control->write_bonds = ( out_control->bond_line_len ? 1 : 0 ); + out_control->bond_line_len = bond_line_len[out_control->bond_info]; + out_control->write_bonds = (out_control->bond_line_len ? 1 : 0); /* angles? */ - out_control->angle_line_len = angle_line_len[ out_control->angle_info ]; - out_control->write_angles = ( out_control->angle_line_len ? 1 : 0 ); + out_control->angle_line_len = angle_line_len[out_control->angle_info]; + out_control->write_angles = (out_control->angle_line_len ? 1 : 0); /* allocate line & buffer space */ - out_control->line = (char*) calloc( MAX_TRJ_LINE_LEN + 1, sizeof(char) ); out_control->buffer_len = 0; out_control->buffer = nullptr; @@ -313,59 +247,33 @@ int Init_Traj(reax_system *system, control_params *control, Write_Header(system, control, out_control); Write_Init_Desc(system, out_control, world); - - return SUCCESS; } - -int Write_Frame_Header(reax_system *system, control_params *control, - simulation_data *data, output_controls *out_control) +void Write_Frame_Header(reax_system *system, simulation_data *data, output_controls *out_control) { - int me, num_frm_hdr_lines, my_frm_hdr_lines, buffer_req; - - me = system->my_rank; + const int me = system->my_rank; /* frame header lengths */ - num_frm_hdr_lines = 22; - my_frm_hdr_lines = num_frm_hdr_lines * ( me == MASTER_NODE ); - buffer_req = my_frm_hdr_lines * HEADER_LINE_LEN; - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req ); + constexpr int num_frm_hdr_lines = 22; /* only the master node writes into trajectory header */ if (me == MASTER_NODE) { - /* clear the contents of line & buffer */ - out_control->line[0] = 0; - out_control->buffer[0] = 0; + std::string buffer(""); /* skip info */ - sprintf( out_control->line, INT_LINE, "chars_to_skip_frame_header:", - (num_frm_hdr_lines - 1) * HEADER_LINE_LEN ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("chars_to_skip_frame_header:", (num_frm_hdr_lines-1)*HEADER_LINE_LEN); /* step & time */ - sprintf( out_control->line, INT_LINE, "step:", data->step ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "time_in_ps:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("step:", data->step); + buffer += fmtline("time_in_ps:", 0.0); /* box info */ - sprintf( out_control->line, REAL_LINE, "volume:", 0.0 ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL3_LINE, "box_dimensions:", 0.0, 0.0, 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL3_LINE, - "coordinate_angles:", 90.0, 90.0, 90.0 ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("volume:", 0.0); + buffer += fmtline("box_dimensions:", 0.0, 0.0, 0.0); + buffer += fmtline("coordinate_angles:", 90.0, 90.0, 90.0); /* system T and P */ - sprintf( out_control->line, REAL_LINE, "temperature:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "pressure:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("temperature:", 0.0); + buffer += fmtline("pressure:", 0.0); /* energies */ double epot = data->sys_en.e_bond + data->sys_en.e_ov + data->sys_en.e_un @@ -374,71 +282,28 @@ int Write_Frame_Header(reax_system *system, control_params *control, + data->sys_en.e_con + data->sys_en.e_vdW + data->sys_en.e_ele + data->my_en.e_pol; - sprintf( out_control->line, REAL_LINE, "total_energy:", epot); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + buffer += fmtline("total_energy:", epot); + buffer += fmtline("total_kinetic:", 0.0); + buffer += fmtline("total_potential:", epot); + buffer += fmtline("bond_energy:", data->sys_en.e_bond); + buffer += fmtline("atom_energy:", data->sys_en.e_ov + data->sys_en.e_un); + buffer += fmtline("lone_pair_energy:", data->sys_en.e_lp); + buffer += fmtline("valence_angle_energy:", data->sys_en.e_ang + data->sys_en.e_pen); + buffer += fmtline("3-body_conjugation:", data->sys_en.e_coa); + buffer += fmtline("hydrogen_bond_energy:", data->sys_en.e_hb); + buffer += fmtline("torsion_angle_energy:", data->sys_en.e_tor); + buffer += fmtline("4-body_conjugation:", data->sys_en.e_con); + buffer += fmtline("vdWaals_energy:", data->sys_en.e_vdW); + buffer += fmtline("electrostatics_energy:", data->sys_en.e_ele); + buffer += fmtline("polarization_energy:", data->sys_en.e_pol); - sprintf( out_control->line, REAL_LINE, "total_kinetic:", 0.0); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "total_potential:", epot); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "bond_energy:", - data->sys_en.e_bond ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "atom_energy:", - data->sys_en.e_ov + data->sys_en.e_un ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "lone_pair_energy:", - data->sys_en.e_lp ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "valence_angle_energy:", - data->sys_en.e_ang + data->sys_en.e_pen ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "3-body_conjugation:", - data->sys_en.e_coa ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "hydrogen_bond_energy:", - data->sys_en.e_hb ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "torsion_angle_energy:", - data->sys_en.e_tor ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "4-body_conjugation:", - data->sys_en.e_con ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "vdWaals_energy:", - data->sys_en.e_vdW ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "electrostatics_energy:", - data->sys_en.e_ele ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); - - sprintf( out_control->line, REAL_LINE, "polarization_energy:", - data->sys_en.e_pol ); - strncat( out_control->buffer, out_control->line, HEADER_LINE_LEN+1 ); + /* dump out the buffer */ + fputs(buffer.c_str(),out_control->strj); } - - /* dump out the buffer */ - if (system->my_rank == MASTER_NODE) - fprintf( out_control->strj, "%s", out_control->buffer ); - - return SUCCESS; } - - -int Write_Atoms(reax_system *system, output_controls *out_control, - MPI_Comm world) +void Write_Atoms(reax_system *system, output_controls *out_control, + MPI_Comm world) { int i, me, np, line_len, buffer_len, buffer_req, cnt; MPI_Status status; @@ -455,65 +320,60 @@ int Write_Atoms(reax_system *system, output_controls *out_control, else buffer_req = system->n * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); /* fill in buffer */ - out_control->line[0] = 0; out_control->buffer[0] = 0; + for (i = 0; i < system->n; ++i) { - p_atom = &( system->my_atoms[i] ); - + std::string buffer(""); + p_atom = &(system->my_atoms[i]); + buffer += fmt::format("{:9}{:10.3f}{:10.3f}{:10.3f}",p_atom->orig_id, + p_atom->x[0], p_atom->x[1],p_atom->x[2]); + switch (out_control->atom_info) { case OPT_ATOM_BASIC: - sprintf( out_control->line, ATOM_BASIC, - p_atom->orig_id, p_atom->x[0], p_atom->x[1], p_atom->x[2], - p_atom->q ); + buffer += fmt::format("{:10.3f}\n",p_atom->q); break; case OPT_ATOM_wF: - sprintf( out_control->line, ATOM_wF, - p_atom->orig_id, p_atom->x[0], p_atom->x[1], p_atom->x[2], - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q ); + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); break; case OPT_ATOM_wV: - sprintf( out_control->line, ATOM_wV, - p_atom->orig_id, p_atom->x[0], p_atom->x[1], p_atom->x[2], - p_atom->v[0], p_atom->v[1], p_atom->v[2], p_atom->q ); + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->v[0], p_atom->v[1], p_atom->v[2], p_atom->q); break; case OPT_ATOM_FULL: - sprintf( out_control->line, ATOM_FULL, - p_atom->orig_id, p_atom->x[0], p_atom->x[1], p_atom->x[2], - p_atom->v[0], p_atom->v[1], p_atom->v[2], - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q ); + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->v[0], p_atom->v[1], p_atom->v[2], + p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); break; default: system->error_ptr->one(FLERR,"Write_traj_atoms: unknown atom trajectory format"); } - strncpy( out_control->buffer + i*line_len, out_control->line, line_len+1 ); + strncpy(out_control->buffer + i*line_len, buffer.c_str(), line_len+1); } if (me != MASTER_NODE) { - MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ATOM_LINES+me, world); + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np*ATOM_LINES+me, world); } else { buffer_len = system->n * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { - MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ATOM_LINES+i, world, &status ); - MPI_Get_count( &status, MPI_CHAR, &cnt ); + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*ATOM_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); buffer_len += cnt; } out_control->buffer[buffer_len] = 0; - fprintf( out_control->strj, "%s", out_control->buffer ); + fputs(out_control->buffer, out_control->strj); } - - return SUCCESS; } - -int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, - output_controls *out_control, MPI_Comm world) +void Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, + output_controls *out_control, MPI_Comm world) { int i, j, pj, me, np; int my_bonds, num_bonds; @@ -530,78 +390,71 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, for (i=0; i < system->n; ++i) for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { j = bonds->select.bond_list[pj].nbr; - if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut ) + if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut) ++my_bonds; } /* allreduce - total number of bonds */ - MPI_Allreduce( &my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world ); + MPI_Allreduce(&my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world); - Write_Skip_Line( out_control, me, num_bonds*line_len, num_bonds ); + Write_Skip_Line(out_control, me, num_bonds*line_len, num_bonds); if (me == MASTER_NODE) buffer_req = num_bonds * line_len + 1; else buffer_req = my_bonds * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); /* fill in the buffer */ - out_control->line[0] = 0; out_control->buffer[0] = 0; my_bonds = 0; for (i=0; i < system->n; ++i) { for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - bo_ij = &( bonds->select.bond_list[pj] ); + bo_ij = &(bonds->select.bond_list[pj]); j = bo_ij->nbr; - if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && bo_ij->bo_data.BO >= control->bg_cut) { + auto buffer = fmt::format("{:9}{:9}{:10.3f}{:10.3f}", system->my_atoms[i].orig_id, + system->my_atoms[j].orig_id,bo_ij->d,bo_ij->bo_data.BO); + switch (out_control->bond_info) { case OPT_BOND_BASIC: - sprintf( out_control->line, BOND_BASIC, - system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, - bo_ij->d, bo_ij->bo_data.BO ); + buffer += "\n"; break; case OPT_BOND_FULL: - sprintf( out_control->line, BOND_FULL, - system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, - bo_ij->d, bo_ij->bo_data.BO, bo_ij->bo_data.BO_s, - bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2 ); + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}\n", bo_ij->bo_data.BO_s, + bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2); break; default: system->error_ptr->one(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); } - strncpy( out_control->buffer + my_bonds*line_len, - out_control->line, line_len+1 ); + strncpy(out_control->buffer + my_bonds*line_len, buffer.c_str(), line_len+1); ++my_bonds; } } } if (me != MASTER_NODE) { - MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*BOND_LINES+me, world ); + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, np*BOND_LINES+me, world); } else { buffer_len = my_bonds * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { - MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*BOND_LINES+i, world, &status ); - MPI_Get_count( &status, MPI_CHAR, &cnt ); + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*BOND_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); buffer_len += cnt; } out_control->buffer[buffer_len] = 0; - fprintf( out_control->strj, "%s", out_control->buffer ); + fputs(out_control->buffer,out_control->strj); } - - return SUCCESS; } - -int Write_Angles( reax_system *system, control_params *control, +void Write_Angles(reax_system *system, control_params *control, reax_list *bonds, reax_list *thb_intrs, output_controls *out_control, MPI_Comm world) { @@ -624,32 +477,31 @@ int Write_Angles( reax_system *system, control_params *control, i = bo_ij->nbr; if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index( pi, thb_intrs); - pk < End_Index( pi, thb_intrs ); ++pk) { + for (pk = Start_Index(pi, thb_intrs); + pk < End_Index(pi, thb_intrs); ++pk) { angle_ijk = &(thb_intrs->select.three_body_list[pk]); k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - if ( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut ) // physical j&k bond + if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + bo_jk->bo_data.BO >= control->bg_cut) // physical j&k bond ++my_angles; } } /* total number of valences */ MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, world); - Write_Skip_Line( out_control, me, num_angles*line_len, num_angles ); + Write_Skip_Line(out_control, me, num_angles*line_len, num_angles); if (me == MASTER_NODE) buffer_req = num_angles * line_len + 1; else buffer_req = my_angles * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); /* fill in the buffer */ my_angles = 0; - out_control->line[0] = 0; out_control->buffer[0] = 0; for (j = 0; j < system->n; ++j) for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { @@ -657,50 +509,46 @@ int Write_Angles( reax_system *system, control_params *control, i = bo_ij->nbr; if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index( pi, thb_intrs); - pk < End_Index( pi, thb_intrs ); ++pk) { + for (pk = Start_Index(pi, thb_intrs); + pk < End_Index(pi, thb_intrs); ++pk) { angle_ijk = &(thb_intrs->select.three_body_list[pk]); k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - if ( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && bo_jk->bo_data.BO >= control->bg_cut) { // physical j&k bond - sprintf( out_control->line, ANGLE_BASIC, - system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, - system->my_atoms[k].orig_id, RAD2DEG( angle_ijk->theta ) ); + auto buffer = fmt::format("{:9}{:9}{:9}{:10.3f}\n", + system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, + system->my_atoms[k].orig_id, RAD2DEG(angle_ijk->theta)); - strncpy( out_control->buffer + my_angles*line_len, - out_control->line, line_len+1 ); + strncpy(out_control->buffer + my_angles*line_len, buffer.c_str(), line_len+1); ++my_angles; } } } if (me != MASTER_NODE) { - MPI_Send( out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ANGLE_LINES+me, world ); + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np*ANGLE_LINES+me, world); } else { buffer_len = my_angles * line_len; for (i = 0; i < np; ++i) if (i != MASTER_NODE) { - MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ANGLE_LINES+i, world, &status ); - MPI_Get_count( &status, MPI_CHAR, &cnt ); + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*ANGLE_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); buffer_len += cnt; } out_control->buffer[buffer_len] = 0; - fprintf( out_control->strj, "%s", out_control->buffer ); + fputs(out_control->buffer,out_control->strj); } - - return SUCCESS; } - -int Append_Frame(reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, MPI_Comm world) +void Append_Frame(reax_system *system, control_params *control, + simulation_data *data, reax_list **lists, + output_controls *out_control, MPI_Comm world) { - Write_Frame_Header(system, control, data, out_control); + Write_Frame_Header(system, data, out_control); if (out_control->write_atoms) Write_Atoms(system, out_control, world); @@ -710,19 +558,13 @@ int Append_Frame(reax_system *system, control_params *control, if (out_control->write_angles) Write_Angles(system, control, (*lists + BONDS), (*lists + THREE_BODIES), - out_control, world); - - return SUCCESS; + out_control, world); } - -int End_Traj(int my_rank, output_controls *out_control) +void End_Traj(int my_rank, output_controls *out_control) { if (my_rank == MASTER_NODE) fclose(out_control->strj); free(out_control->buffer); - free(out_control->line); - - return SUCCESS; } diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index cb3f12b6f4..93fa4a6771 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -24,81 +24,15 @@ . ----------------------------------------------------------------------*/ -#ifndef __TRAJ_H__ -#define __TRAJ_H__ +#ifndef LMP_REAXC_TRAJ_H +#define LMP_REAXC_TRAJ_H #include "reaxc_types.h" #include -#define MAX_TRJ_LINE_LEN 120 -#define MAX_TRJ_BUFFER_SIZE (MAX_TRJ_LINE_LEN * 100) - -#define NUM_HEADER_LINES 37 -#define HEADER_LINE_LEN 62 -#define STR_LINE "%-37s%-24s\n" -#define INT_LINE "%-37s%-24d\n" -#if defined(LAMMPS_SMALLSMALL) -#define BIGINT_LINE "%-37s%-24d\n" -#else -#define BIGINT_LINE "%-37s%-24lld\n" -#endif -#define INT2_LINE "%-36s%-12d,%-12d\n" -#define REAL_LINE "%-37s%-24.3f\n" -#define SCI_LINE "%-37s%-24g\n" -#define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n" - -#if defined(LAMMPS_BIGBIG) -#define INIT_DESC "%9lld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass -#else -#define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass -#endif -#define INIT_DESC_LEN 32 - -#define SIZE_INFO_LINE2 "%-10d%-10d\n" -#define SIZE_INFO_LEN2 21 - -#define SIZE_INFO_LINE3 "%-10d%-10d%-10d\n" -#define SIZE_INFO_LEN3 31 - -#if defined(LAMMPS_BIGBIG) -#define ATOM_BASIC "%9lld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge -#define ATOM_wV "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge -#define ATOM_wF "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge -#define ATOM_FULL "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge -#else -#define ATOM_BASIC "%9d%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge -#define ATOM_wV "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge -#define ATOM_wF "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge -#define ATOM_FULL "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge -#endif -#define ATOM_BASIC_LEN 50 -#define ATOM_wV_LEN 80 -#define ATOM_wF_LEN 80 -#define ATOM_FULL_LEN 110 - -#if defined(LAMMPS_BIGBIG) -#define BOND_BASIC "%9lld%9lld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO -#define BOND_FULL "%9lld%9lld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 -#define ANGLE_BASIC "%9lld%9lld%9lld%10.3f\n" // Atom1 Atom2 Atom3 Theta -#else -#define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO -#define BOND_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 -#define ANGLE_BASIC "%9d%9d%9d%10.3f\n" // Atom1 Atom2 Atom3 Theta -#endif -#define BOND_BASIC_LEN 39 -#define BOND_FULL_LEN 69 -#define ANGLE_BASIC_LEN 38 - -enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; -enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; -enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; - - -int Init_Traj( reax_system*, control_params*, output_controls*, - MPI_Comm , char* ); -int End_Traj( int, output_controls* ); - -int Append_Frame( reax_system*, control_params*, simulation_data*, - reax_list**, output_controls*, MPI_Comm); +void Init_Traj(reax_system *, control_params *, output_controls *, MPI_Comm); +void End_Traj(int, output_controls *); +void Append_Frame(reax_system *, control_params *, simulation_data *, + reax_list **, output_controls *, MPI_Comm); #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index fcc21cbda2..94adf6c3f7 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -456,7 +456,6 @@ struct output_controls int write_atoms; int write_bonds; int write_angles; - char *line; int buffer_len; char *buffer; From f2772e58948a2d9c2aa555630c5231ca718508d8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Apr 2021 10:50:53 -0400 Subject: [PATCH 024/119] PIMPL-ify reax/c pair styles; first steps toward a ReaxFF namespace --- src/KOKKOS/pair_reaxc_kokkos.cpp | 319 +++++++++++----------- src/USER-OMP/pair_reaxc_omp.cpp | 196 +++++++------- src/USER-REAXC/fix_qeq_reax.cpp | 6 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 14 +- src/USER-REAXC/pair_reaxc.cpp | 422 ++++++++++++++--------------- src/USER-REAXC/pair_reaxc.h | 22 +- src/USER-REAXC/reaxc_ffield.h | 4 +- src/USER-REAXC/reaxc_traj.cpp | 8 +- src/USER-REAXC/reaxc_types.h | 9 + src/USER-REAXC/reaxff_api.h | 38 +++ 10 files changed, 541 insertions(+), 497 deletions(-) create mode 100644 src/USER-REAXC/reaxff_api.h diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index f9f3ebfdfa..4ef82776d8 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -27,10 +27,13 @@ #include "math_special.h" #include "neigh_request.h" #include "neighbor.h" + #include "reaxc_defs.h" #include "reaxc_lookup.h" #include "reaxc_tool_box.h" +#include "reaxff_api.h" + #include @@ -174,14 +177,14 @@ void PairReaxCKokkos::setup() // general parameters for (i = 0; i < 39; i ++) - gp[i] = system->reax_param.gp.l[i]; + gp[i] = api->system->reax_param.gp.l[i]; p_boc1 = gp[0]; p_boc2 = gp[1]; // vdw parameters - vdwflag = system->reax_param.gp.vdw_type; - lgflag = control->lgflag; + vdwflag = api->system->reax_param.gp.vdw_type; + lgflag = api->control->lgflag; // atom, bond, angle, dihedral, H-bond specific parameters two_body_parameters *twbp; @@ -201,38 +204,38 @@ void PairReaxCKokkos::setup() if (map[i] == -1) continue; // general - k_params_sing.h_view(i).mass = system->reax_param.sbp[map[i]].mass; + k_params_sing.h_view(i).mass = api->system->reax_param.sbp[map[i]].mass; // polarization - k_params_sing.h_view(i).chi = system->reax_param.sbp[map[i]].chi; - k_params_sing.h_view(i).eta = system->reax_param.sbp[map[i]].eta; + k_params_sing.h_view(i).chi = api->system->reax_param.sbp[map[i]].chi; + k_params_sing.h_view(i).eta = api->system->reax_param.sbp[map[i]].eta; // bond order - k_params_sing.h_view(i).r_s = system->reax_param.sbp[map[i]].r_s; - k_params_sing.h_view(i).r_pi = system->reax_param.sbp[map[i]].r_pi; - k_params_sing.h_view(i).r_pi2 = system->reax_param.sbp[map[i]].r_pi_pi; - k_params_sing.h_view(i).valency = system->reax_param.sbp[map[i]].valency; - k_params_sing.h_view(i).valency_val = system->reax_param.sbp[map[i]].valency_val; - k_params_sing.h_view(i).valency_boc = system->reax_param.sbp[map[i]].valency_boc; - k_params_sing.h_view(i).valency_e = system->reax_param.sbp[map[i]].valency_e; - k_params_sing.h_view(i).nlp_opt = system->reax_param.sbp[map[i]].nlp_opt; + k_params_sing.h_view(i).r_s = api->system->reax_param.sbp[map[i]].r_s; + k_params_sing.h_view(i).r_pi = api->system->reax_param.sbp[map[i]].r_pi; + k_params_sing.h_view(i).r_pi2 = api->system->reax_param.sbp[map[i]].r_pi_pi; + k_params_sing.h_view(i).valency = api->system->reax_param.sbp[map[i]].valency; + k_params_sing.h_view(i).valency_val = api->system->reax_param.sbp[map[i]].valency_val; + k_params_sing.h_view(i).valency_boc = api->system->reax_param.sbp[map[i]].valency_boc; + k_params_sing.h_view(i).valency_e = api->system->reax_param.sbp[map[i]].valency_e; + k_params_sing.h_view(i).nlp_opt = api->system->reax_param.sbp[map[i]].nlp_opt; // multibody - k_params_sing.h_view(i).p_lp2 = system->reax_param.sbp[map[i]].p_lp2; - k_params_sing.h_view(i).p_ovun2 = system->reax_param.sbp[map[i]].p_ovun2; - k_params_sing.h_view(i).p_ovun5 = system->reax_param.sbp[map[i]].p_ovun5; + k_params_sing.h_view(i).p_lp2 = api->system->reax_param.sbp[map[i]].p_lp2; + k_params_sing.h_view(i).p_ovun2 = api->system->reax_param.sbp[map[i]].p_ovun2; + k_params_sing.h_view(i).p_ovun5 = api->system->reax_param.sbp[map[i]].p_ovun5; // angular - k_params_sing.h_view(i).p_val3 = system->reax_param.sbp[map[i]].p_val3; - k_params_sing.h_view(i).p_val5 = system->reax_param.sbp[map[i]].p_val5; + k_params_sing.h_view(i).p_val3 = api->system->reax_param.sbp[map[i]].p_val3; + k_params_sing.h_view(i).p_val5 = api->system->reax_param.sbp[map[i]].p_val5; // hydrogen bond - k_params_sing.h_view(i).p_hbond = system->reax_param.sbp[map[i]].p_hbond; + k_params_sing.h_view(i).p_hbond = api->system->reax_param.sbp[map[i]].p_hbond; for (j = 1; j <= n; j++) { if (map[j] == -1) continue; - twbp = &(system->reax_param.tbp[map[i]][map[j]]); + twbp = &(api->system->reax_param.tbp[map[i]][map[j]]); // vdW k_params_twbp.h_view(i,j).gamma = twbp->gamma; @@ -276,7 +279,7 @@ void PairReaxCKokkos::setup() if (map[k] == -1) continue; // Angular - thbh = &(system->reax_param.thbp[map[i]][map[j]][map[k]]); + thbh = &(api->system->reax_param.thbp[map[i]][map[j]][map[k]]); thbp = &(thbh->prm[0]); k_params_thbp.h_view(i,j,k).cnt = thbh->cnt; k_params_thbp.h_view(i,j,k).theta_00 = thbp->theta_00; @@ -288,7 +291,7 @@ void PairReaxCKokkos::setup() k_params_thbp.h_view(i,j,k).p_coa1 = thbp->p_coa1; // Hydrogen Bond - hbp = &(system->reax_param.hbp[map[i]][map[j]][map[k]]); + hbp = &(api->system->reax_param.hbp[map[i]][map[j]][map[k]]); k_params_hbp.h_view(i,j,k).p_hb1 = hbp->p_hb1; k_params_hbp.h_view(i,j,k).p_hb2 = hbp->p_hb2; k_params_hbp.h_view(i,j,k).p_hb3 = hbp->p_hb3; @@ -298,7 +301,7 @@ void PairReaxCKokkos::setup() if (map[m] == -1) continue; // Torsion - fbh = &(system->reax_param.fbp[map[i]][map[j]][map[k]][map[m]]); + fbh = &(api->system->reax_param.fbp[map[i]][map[j]][map[k]][map[m]]); fbp = &(fbh->prm[0]); k_params_fbp.h_view(i,j,k,m).p_tor1 = fbp->p_tor1; k_params_fbp.h_view(i,j,k,m).p_cot1 = fbp->p_cot1; @@ -316,13 +319,13 @@ void PairReaxCKokkos::setup() k_params_hbp.template modify(); // cutoffs - cut_nbsq = control->nonb_cut * control->nonb_cut; - cut_hbsq = control->hbond_cut * control->hbond_cut; - cut_bosq = control->bond_cut * control->bond_cut; + cut_nbsq = api->control->nonb_cut * api->control->nonb_cut; + cut_hbsq = api->control->hbond_cut * api->control->hbond_cut; + cut_bosq = api->control->bond_cut * api->control->bond_cut; // bond order cutoffs bo_cut = 0.01 * gp[29]; - thb_cut = control->thb_cut; + thb_cut = api->control->thb_cut; thb_cutsq = 0.000010; //thb_cut*thb_cut; if (atom->nmax > nmax) { @@ -338,13 +341,13 @@ void PairReaxCKokkos::init_md() { // init_taper() F_FLOAT d1, d7, swa, swa2, swa3, swb, swb2, swb3; - LR_lookup_table ** & LR = system->LR; + LR_lookup_table ** & LR = api->system->LR; - swa = control->nonb_low; - swb = control->nonb_cut; - enobondsflag = control->enobondsflag; + swa = api->control->nonb_low; + swb = api->control->nonb_cut; + enobondsflag = api->control->enobondsflag; - if (fabs(swa) > 0.01 ) + if (fabs(swa) > 0.01) error->warning(FLERR,"Warning: non-zero lower Taper-radius cutoff"); if (swb < 0) @@ -363,18 +366,18 @@ void PairReaxCKokkos::init_md() k_tap.h_view(7) = 20.0/d7; k_tap.h_view(6) = -70.0 * (swa + swb) / d7; k_tap.h_view(5) = 84.0 * (swa2 + 3.0*swa*swb + swb2) / d7; - k_tap.h_view(4) = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3 ) / d7; - k_tap.h_view(3) = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3 ) / d7; + k_tap.h_view(4) = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3) / d7; + k_tap.h_view(3) = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3) / d7; k_tap.h_view(2) =-210.0 * (swa3*swb2 + swa2*swb3) / d7; k_tap.h_view(1) = 140.0 * swa3 * swb3 / d7; k_tap.h_view(0) = (-35.0*swa3*swb2*swb2 + 21.0*swa2*swb3*swb2 - - 7.0*swa*swb3*swb3 + swb3*swb3*swb ) / d7; + 7.0*swa*swb3*swb3 + swb3*swb3*swb) / d7; k_tap.template modify(); k_tap.template sync(); - if (control->tabulate) { + if (api->control->tabulate) { int ntypes = atom->ntypes; Init_Lookup_Tables(); @@ -436,7 +439,7 @@ int PairReaxCKokkos::Init_Lookup_Tables() double dr; double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb; double v0_vdw, v0_ele, vlast_vdw, vlast_ele; - LR_lookup_table ** & LR = system->LR; + LR_lookup_table ** & LR = api->system->LR; /* initializations */ v0_vdw = 0; @@ -445,49 +448,49 @@ int PairReaxCKokkos::Init_Lookup_Tables() vlast_ele = 0; num_atom_types = atom->ntypes; - dr = control->nonb_cut / control->tabulate; + dr = api->control->nonb_cut / api->control->tabulate; h = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:h"); fh = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:fh"); fvdw = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:fvdw"); fCEvd = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:fCEvd"); fele = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:fele"); fCEclmb = (double*) - smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); + smalloc(api->control->error_ptr, (api->control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); LR = (LR_lookup_table**) - scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR"); + scalloc(api->control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR"); for (i = 0; i < num_atom_types+1; ++i) LR[i] = (LR_lookup_table*) - scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]"); + scalloc(api->control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]"); for (i = 1; i <= num_atom_types; ++i) { for (j = i; j <= num_atom_types; ++j) { LR[i][j].xmin = 0; - LR[i][j].xmax = control->nonb_cut; - LR[i][j].n = control->tabulate + 2; + LR[i][j].xmax = api->control->nonb_cut; + LR[i][j].n = api->control->tabulate + 2; LR[i][j].dx = dr; - LR[i][j].inv_dx = control->tabulate / control->nonb_cut; + LR[i][j].inv_dx = api->control->tabulate / api->control->nonb_cut; LR[i][j].y = (LR_data*) - smalloc( control->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y"); + smalloc(api->control->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y"); LR[i][j].H = (cubic_spline_coef*) - smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H"); + smalloc(api->control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H"); LR[i][j].vdW = (cubic_spline_coef*) - smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW"); + smalloc(api->control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW"); LR[i][j].CEvd = (cubic_spline_coef*) - smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd"); + smalloc(api->control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd"); LR[i][j].ele = (cubic_spline_coef*) - smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele"); + smalloc(api->control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele"); LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), + smalloc(api->control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb"); - for (r = 1; r <= control->tabulate; ++r) { - LR_vdW_Coulomb(i, j, r * dr, &(LR[i][j].y[r]) ); + for (r = 1; r <= api->control->tabulate; ++r) { + LR_vdW_Coulomb(i, j, r * dr, &(LR[i][j].y[r])); h[r] = LR[i][j].dx; fh[r] = LR[i][j].y[r].H; fvdw[r] = LR[i][j].y[r].e_vdW; @@ -508,20 +511,20 @@ int PairReaxCKokkos::Init_Lookup_Tables() vlast_vdw = fCEvd[r-1]; vlast_ele = fele[r-1]; - Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1], - &(LR[i][j].H[1]), control->tabulate+1 ); + Natural_Cubic_Spline(api->control->error_ptr, &h[1], &fh[1], + &(LR[i][j].H[1]), api->control->tabulate+1); - Complete_Cubic_Spline( control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw, - &(LR[i][j].vdW[1]), control->tabulate+1 ); + Complete_Cubic_Spline(api->control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw, + &(LR[i][j].vdW[1]), api->control->tabulate+1); - Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEvd[1], - &(LR[i][j].CEvd[1]), control->tabulate+1 ); + Natural_Cubic_Spline(api->control->error_ptr, &h[1], &fCEvd[1], + &(LR[i][j].CEvd[1]), api->control->tabulate+1); - Complete_Cubic_Spline( control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele, - &(LR[i][j].ele[1]), control->tabulate+1 ); + Complete_Cubic_Spline(api->control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele, + &(LR[i][j].ele[1]), api->control->tabulate+1); - Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEclmb[1], - &(LR[i][j].CEclmb[1]), control->tabulate+1 ); + Natural_Cubic_Spline(api->control->error_ptr, &h[1], &fCEclmb[1], + &(LR[i][j].CEclmb[1]), api->control->tabulate+1); } } free(h); @@ -541,7 +544,7 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() { int i, j; int ntypes; - LR_lookup_table ** & LR = system->LR; + LR_lookup_table ** & LR = api->system->LR; ntypes = atom->ntypes; @@ -550,25 +553,25 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() for (j = i; j <= ntypes; ++j) { if (map[i] == -1) continue; if (LR[i][j].n) { - sfree( control->error_ptr, LR[i][j].y, "LR[i,j].y" ); - sfree( control->error_ptr, LR[i][j].H, "LR[i,j].H" ); - sfree( control->error_ptr, LR[i][j].vdW, "LR[i,j].vdW" ); - sfree( control->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree( control->error_ptr, LR[i][j].ele, "LR[i,j].ele" ); - sfree( control->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); + sfree(api->control->error_ptr, LR[i][j].y, "LR[i,j].y"); + sfree(api->control->error_ptr, LR[i][j].H, "LR[i,j].H"); + sfree(api->control->error_ptr, LR[i][j].vdW, "LR[i,j].vdW"); + sfree(api->control->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd"); + sfree(api->control->error_ptr, LR[i][j].ele, "LR[i,j].ele"); + sfree(api->control->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb"); } } - sfree( control->error_ptr, LR[i], "LR[i]" ); + sfree(api->control->error_ptr, LR[i], "LR[i]"); } - sfree( control->error_ptr, LR, "LR" ); + sfree(api->control->error_ptr, LR, "LR"); } /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_data *lr ) +void PairReaxCKokkos::LR_vdW_Coulomb(int i, int j, double r_ij, LR_data *lr) { - double p_vdW1 = system->reax_param.gp.l[28]; + double p_vdW1 = api->system->reax_param.gp.l[28]; double p_vdW1i = 1.0 / p_vdW1; double powr_vdW1, powgi_vdW1; double tmp, fn13, exp1, exp2; @@ -578,7 +581,7 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ double e_lg, de_lg, r_ij5, r_ij6, re6; two_body_parameters *twbp; - twbp = &(system->reax_param.tbp[map[i]][map[j]]); + twbp = &(api->system->reax_param.tbp[map[i]][map[j]]); e_core = 0; de_core = 0; e_lg = de_lg = 0.0; @@ -600,32 +603,32 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ dTap += k_tap.h_view[1]/r_ij; /*vdWaals Calculations*/ - if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + if (api->system->reax_param.gp.vdw_type==1 || api->system->reax_param.gp.vdw_type==3) { // shielding powr_vdW1 = pow(r_ij, p_vdW1); - powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); + powgi_vdW1 = pow(1.0 / twbp->gamma_w, p_vdW1); - fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i ); - exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); + fn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i); + exp1 = exp(twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); lr->e_vdW = Tap * twbp->D * (exp1 - 2.0 * exp2); - dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i-1.0) * pow(r_ij, p_vdW1-2.0); + dfn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i-1.0) * pow(r_ij, p_vdW1-2.0); lr->CEvd = dTap * twbp->D * (exp1 - 2.0 * exp2) - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; } else { // no shielding - exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); + exp1 = exp(twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); lr->e_vdW = Tap * twbp->D * (exp1 - 2.0 * exp2); lr->CEvd = dTap * twbp->D * (exp1 - 2.0 * exp2) - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + if (api->system->reax_param.gp.vdw_type==2 || api->system->reax_param.gp.vdw_type==3) { // inner wall e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); lr->e_vdW += Tap * e_core; @@ -634,14 +637,14 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ lr->CEvd += dTap * e_core + Tap * de_core / r_ij; // lg correction, only if lgvdw is yes - if (control->lgflag) { - r_ij5 = powint( r_ij, 5 ); - r_ij6 = powint( r_ij, 6 ); - re6 = powint( twbp->lgre, 6 ); - e_lg = -(twbp->lgcij/( r_ij6 + re6 )); + if (api->control->lgflag) { + r_ij5 = powint(r_ij, 5); + r_ij6 = powint(r_ij, 6); + re6 = powint(twbp->lgre, 6); + e_lg = -(twbp->lgcij/(r_ij6 + re6)); lr->e_vdW += Tap * e_lg; - de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ; + de_lg = -6.0 * e_lg * r_ij5 / (r_ij6 + re6) ; lr->CEvd += dTap * e_lg + Tap * de_lg/r_ij; } @@ -649,14 +652,14 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ /* Coulomb calculations */ - dr3gamij_1 = ( r_ij * r_ij * r_ij + twbp->gamma ); - dr3gamij_3 = pow( dr3gamij_1 , 0.33333333333333 ); + dr3gamij_1 = (r_ij * r_ij * r_ij + twbp->gamma); + dr3gamij_3 = pow(dr3gamij_1 , 0.33333333333333); tmp = Tap / dr3gamij_3; lr->H = EV_to_KCALpMOL * tmp; lr->e_ele = C_ele * tmp; - lr->CEclmb = C_ele * ( dTap - Tap * r_ij / dr3gamij_1 ) / dr3gamij_3; + lr->CEclmb = C_ele * (dTap - Tap * r_ij / dr3gamij_1) / dr3gamij_3; } /* ---------------------------------------------------------------------- */ @@ -736,7 +739,7 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) pvector[13] = ev.ecoul; // LJ + Coulomb - if (control->tabulate) { + if (api->control->tabulate) { if (neighflag == HALF) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); @@ -1276,8 +1279,8 @@ void PairReaxCKokkos::operator()(PairReaxComputeTabulatedLJCoulomb cut_nbsq) continue; const F_FLOAT rij = sqrt(rsq); - const int tmin = MIN( itype, jtype ); - const int tmax = MAX( itype, jtype ); + const int tmin = MIN(itype, jtype); + const int tmax = MAX(itype, jtype); const LR_lookup_table_kk& t = d_LR(tmin,tmax); @@ -1665,7 +1668,7 @@ void PairReaxCKokkos::operator()(PairReaxBuildListsHalf, } d_hb_list[j_index] = j; - } else if ( j < nlocal && ihb == 2 && jhb == 1) { + } else if (j < nlocal && ihb == 2 && jhb == 1) { if (NEIGHFLAG == HALF) { i_index = d_hb_first[j] + d_hb_num[j]; d_hb_num[j]++; @@ -1880,7 +1883,7 @@ void PairReaxCKokkos::operator()(PairReaxBondOrder2, const int &ii) (-p_boc1 * exp_p1i + exp_p2i / (exp_p2i + exp_p2j)) + -p_boc1 * exp_p1i / u1_ji - ((val_j+f2) / (u1_ji*u1_ji)) * (-p_boc1 * exp_p1i + exp_p2i / (exp_p2i + exp_p2j))); - Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); + Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + Cf1B_ij * exp_p2j / (exp_p2i + exp_p2j); } else { f1 = 1.0; Cf1_ij = Cf1_ji = 0.0; @@ -2050,7 +2053,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2::operator()(PairReaxComputeMulti2template e_tally(ev,i,i,e_lp); // over coordination - const F_FLOAT exp_ovun1 = p_ovun3 * exp( p_ovun4 * d_sum_ovun(i,2) ); + const F_FLOAT exp_ovun1 = p_ovun3 * exp(p_ovun4 * d_sum_ovun(i,2)); const F_FLOAT inv_exp_ovun1 = 1.0 / (1 + exp_ovun1); const F_FLOAT Delta_lpcorr = d_Delta[i] - (dfvl * d_Delta_lp_temp[i]) * inv_exp_ovun1; - const F_FLOAT exp_ovun2 = exp( p_ovun2 * Delta_lpcorr ); + const F_FLOAT exp_ovun2 = exp(p_ovun2 * Delta_lpcorr); const F_FLOAT inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2); const F_FLOAT DlpVi = 1.0 / (Delta_lpcorr + val_i + 1e-8); @@ -2085,14 +2088,14 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2template e_tally(ev,i,i,e_ov); CEover2 = d_sum_ovun(i,1) * DlpVi * inv_exp_ovun2 * - (1.0 - Delta_lpcorr * ( DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2 )); - CEover3 = CEover2 * (1.0 - dfvl * d_dDelta_lp[i] * inv_exp_ovun1 ); + (1.0 - Delta_lpcorr * (DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2)); + CEover3 = CEover2 * (1.0 - dfvl * d_dDelta_lp[i] * inv_exp_ovun1); CEover4 = CEover2 * (dfvl * d_Delta_lp_temp[i]) * p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1); // under coordination const F_FLOAT exp_ovun2n = 1.0 / exp_ovun2; - const F_FLOAT exp_ovun6 = exp( p_ovun6 * Delta_lpcorr ); + const F_FLOAT exp_ovun6 = exp(p_ovun6 * Delta_lpcorr); const F_FLOAT exp_ovun8 = p_ovun7 * exp(p_ovun8 * d_sum_ovun(i,2)); const F_FLOAT inv_exp_ovun2n = 1.0 / (1.0 + exp_ovun2n); const F_FLOAT inv_exp_ovun8 = 1.0 / (1.0 + exp_ovun8); @@ -2106,7 +2109,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2template e_tally(ev,i,i,e_un); CEunder1 = inv_exp_ovun2n * - ( p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + p_ovun2 * e_un * exp_ovun2n ); + (p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + p_ovun2 * e_un * exp_ovun2n); CEunder2 = -e_un * p_ovun8 * exp_ovun8 * inv_exp_ovun8; CEunder3 = CEunder1 * (1.0 - dfvl * d_dDelta_lp[i] * inv_exp_ovun1); CEunder4 = CEunder1 * (dfvl * d_Delta_lp_temp[i]) * @@ -2242,7 +2245,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular::operator()(PairReaxComputeAngular 0.0 && SBO <= 1.0) { - SBO2 = pow( SBO, p_val9 ); - CSBO2 = p_val9 * pow( SBO, p_val9 - 1.0 ); + SBO2 = pow(SBO, p_val9); + CSBO2 = p_val9 * pow(SBO, p_val9 - 1.0); } else if (SBO > 1.0 && SBO < 2.0) { - SBO2 = 2.0 - pow( 2.0-SBO, p_val9 ); - CSBO2 = p_val9 * pow( 2.0 - SBO, p_val9 - 1.0 ); + SBO2 = 2.0 - pow(2.0-SBO, p_val9); + CSBO2 = p_val9 * pow(2.0 - SBO, p_val9 - 1.0); } else { SBO2 = 2.0; CSBO2 = 0.0; } - expval6 = exp( p_val6 * d_Delta_boc[i] ); + expval6 = exp(p_val6 * d_Delta_boc[i]); F_FLOAT CdDelta_i = 0.0; F_FLOAT fitmp[3],fjtmp[3]; @@ -2349,21 +2352,21 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular= 0) expval12theta = p_val1 * (1.0 - expval2theta); else // To avoid linear Me-H-Me angles (6/6/06) @@ -2373,7 +2376,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular::operator()(PairReaxComputeAngular::operator()(PairReaxComputeAngular::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion= 0 && sin_ijk <= 1e-10) tan_ijk_i = cos_ijk / 1e-10; else if (sin_ijk <= 0 && sin_ijk >= -1e-10) tan_ijk_i = -cos_ijk / 1e-10; else tan_ijk_i = cos_ijk / sin_ijk; - exp_tor2_ik = exp( -p_tor2 * BOA_ik ); - exp_cot2_ik = exp( -p_cot2 * SQR(BOA_ik -1.5) ); + exp_tor2_ik = exp(-p_tor2 * BOA_ik); + exp_cot2_ik = exp(-p_cot2 * SQR(BOA_ik -1.5)); for (int l = 0; l < 3; l++) fktmp[l] = 0.0; @@ -2648,7 +2651,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion= 0 && sin_jil <= 1e-10) tan_jil_i = cos_jil / 1e-10; else if (sin_jil <= 0 && sin_jil >= -1e-10) @@ -2676,13 +2679,13 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeBond1= 1.00) { if (gp[37] == 2 || (imass == 12.0000 && jmass == 15.9990) || (jmass == 12.0000 && imass == 15.9990)) { - const F_FLOAT exphu = exp(-gp[7] * SQR(BO_i - 2.50) ); + const F_FLOAT exphu = exp(-gp[7] * SQR(BO_i - 2.50)); const F_FLOAT exphua1 = exp(-gp[3] * (d_total_bo[i]-BO_i)); const F_FLOAT exphub1 = exp(-gp[3] * (d_total_bo[j]-BO_i)); const F_FLOAT exphuov = exp(gp[4] * (d_Delta[i] + d_Delta[j])); @@ -3148,7 +3151,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeBond1template e_tally(ev,i,j,estriph); const F_FLOAT decobdbo = gp[10] * exphu * hulpov * (exphua1 + exphub1) * - ( gp[3] - 2.0 * gp[7] * (BO_i-2.50) ); + (gp[3] - 2.0 * gp[7] * (BO_i-2.50)); const F_FLOAT decobdboua = -gp[10] * exphu * hulpov * (gp[3]*exphua1 + 25.0*gp[4]*exphuov*hulpov*(exphua1+exphub1)); const F_FLOAT decobdboub = -gp[10] * exphu * hulpov * @@ -3725,7 +3728,7 @@ void PairReaxCKokkos::FindBond(int &numbonds) copymode = 1; Kokkos::parallel_for(Kokkos::RangePolicy(0,nmax),*this); - bo_cut_bond = control->bg_cut; + bo_cut_bond = api->control->bg_cut; atomKK->sync(execution_space,TAG_MASK); tag = atomKK->k_tag.view(); diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index e754316ea0..e7e03520e0 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -60,6 +60,8 @@ #include "reaxc_reset_tools.h" #include "reaxc_tool_box.h" +#include "reaxff_api.h" + #if defined(_OPENMP) #include #endif @@ -89,8 +91,8 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) if (lmp->citeme) lmp->citeme->add(cite_pair_reax_c_omp); suffix_flag |= Suffix::OMP; - system->pair_ptr = this; - system->omp_active = 1; + api->system->pair_ptr = this; + api->system->omp_active = 1; num_nbrs_offset = nullptr; @@ -108,7 +110,7 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) PairReaxCOMP::~PairReaxCOMP() { if (setup_flag) { - reax_list * bonds = lists+BONDS; + reax_list * bonds = api->lists+BONDS; for (int i=0; inum_intrs; ++i) sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); } @@ -189,22 +191,22 @@ void PairReaxCOMP::compute(int eflag, int vflag) evdwl = ecoul = 0.0; ev_init(eflag,vflag); - if (vflag_global) control->virial = 1; - else control->virial = 0; + if (vflag_global) api->control->virial = 1; + else api->control->virial = 0; if (vflag_atom) error->all(FLERR,"Pair style reax/c/omp does not support " "computing per-atom stress"); - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + api->system->bigN = static_cast (atom->natoms); // all atoms in the system // setup data structures setup(); - Reset( system, control, data, workspace, &lists ); + Reset( api->system, api->control, api->data, api->workspace, &api->lists ); // Why not update workspace like in MPI-only code? // Using the MPI-only way messes up the hb energy @@ -218,7 +220,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) startTimeBase = MPI_Wtime(); #endif - Compute_ForcesOMP(system,control,data,workspace,&lists,out_control); + Compute_ForcesOMP(api->system,api->control,api->data,api->workspace,&api->lists,api->out_control); read_reax_forces(vflag); #ifdef OMP_TIMING @@ -229,63 +231,63 @@ void PairReaxCOMP::compute(int eflag, int vflag) #if defined(_OPENMP) #pragma omp parallel for schedule(static) #endif - for (int k = 0; k < system->N; ++k) { - num_bonds[k] = system->my_atoms[k].num_bonds; - num_hbonds[k] = system->my_atoms[k].num_hbonds; + for (int k = 0; k < api->system->N; ++k) { + num_bonds[k] = api->system->my_atoms[k].num_bonds; + num_hbonds[k] = api->system->my_atoms[k].num_hbonds; } // energies and pressure if (eflag_global) { - evdwl += data->my_en.e_bond; - evdwl += data->my_en.e_ov; - evdwl += data->my_en.e_un; - evdwl += data->my_en.e_lp; - evdwl += data->my_en.e_ang; - evdwl += data->my_en.e_pen; - evdwl += data->my_en.e_coa; - evdwl += data->my_en.e_hb; - evdwl += data->my_en.e_tor; - evdwl += data->my_en.e_con; - evdwl += data->my_en.e_vdW; + evdwl += api->data->my_en.e_bond; + evdwl += api->data->my_en.e_ov; + evdwl += api->data->my_en.e_un; + evdwl += api->data->my_en.e_lp; + evdwl += api->data->my_en.e_ang; + evdwl += api->data->my_en.e_pen; + evdwl += api->data->my_en.e_coa; + evdwl += api->data->my_en.e_hb; + evdwl += api->data->my_en.e_tor; + evdwl += api->data->my_en.e_con; + evdwl += api->data->my_en.e_vdW; - ecoul += data->my_en.e_ele; - ecoul += data->my_en.e_pol; + ecoul += api->data->my_en.e_ele; + ecoul += api->data->my_en.e_pol; // Store the different parts of the energy // in a list for output by compute pair command - pvector[0] = data->my_en.e_bond; - pvector[1] = data->my_en.e_ov + data->my_en.e_un; - pvector[2] = data->my_en.e_lp; + pvector[0] = api->data->my_en.e_bond; + pvector[1] = api->data->my_en.e_ov + api->data->my_en.e_un; + pvector[2] = api->data->my_en.e_lp; pvector[3] = 0.0; - pvector[4] = data->my_en.e_ang; - pvector[5] = data->my_en.e_pen; - pvector[6] = data->my_en.e_coa; - pvector[7] = data->my_en.e_hb; - pvector[8] = data->my_en.e_tor; - pvector[9] = data->my_en.e_con; - pvector[10] = data->my_en.e_vdW; - pvector[11] = data->my_en.e_ele; + pvector[4] = api->data->my_en.e_ang; + pvector[5] = api->data->my_en.e_pen; + pvector[6] = api->data->my_en.e_coa; + pvector[7] = api->data->my_en.e_hb; + pvector[8] = api->data->my_en.e_tor; + pvector[9] = api->data->my_en.e_con; + pvector[10] = api->data->my_en.e_vdW; + pvector[11] = api->data->my_en.e_ele; pvector[12] = 0.0; - pvector[13] = data->my_en.e_pol; + pvector[13] = api->data->my_en.e_pol; } if (vflag_fdotr) virial_fdotr_compute(); // Set internal timestep counter to that of LAMMPS - data->step = update->ntimestep; + api->data->step = update->ntimestep; - Output_Results( system, control, data, &lists, out_control, world ); + Output_Results( api->system, api->control, api->data, &api->lists, api->out_control, world ); // populate tmpid and tmpbo arrays for fix reax/c/species if (fixspecies_flag) { - if (system->N > nmax) { + if (api->system->N > nmax) { memory->destroy(tmpid); memory->destroy(tmpbo); - nmax = system->N; + nmax = api->system->N; memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid"); memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo"); } @@ -293,7 +295,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) #if defined(_OPENMP) #pragma omp parallel for collapse(2) schedule(static) default(shared) #endif - for (int i = 0; i < system->N; i++) + for (int i = 0; i < api->system->N; i++) for (int j = 0; j < MAXSPECBOND; j++) { tmpbo[i][j] = 0.0; tmpid[i][j] = 0; @@ -317,10 +319,10 @@ void PairReaxCOMP::init_style( ) if (!have_qeq && qeqflag == 1) error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - system->bigN = static_cast (atom->natoms); // all atoms in the system - system->wsize = comm->nprocs; + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + api->system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) error->all(FLERR,"Pair style reax/c/omp requires atom IDs"); @@ -343,20 +345,20 @@ void PairReaxCOMP::init_style( ) neighbor->requests[irequest]->newton = 2; neighbor->requests[irequest]->ghost = 1; - cutmax = MAX3(control->nonb_cut, control->hbond_cut, control->bond_cut); - if ((cutmax < 2.0*control->bond_cut) && (comm->me == 0)) + cutmax = MAX3(api->control->nonb_cut, api->control->hbond_cut, api->control->bond_cut); + if ((cutmax < 2.0*api->control->bond_cut) && (comm->me == 0)) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); for (int i = 0; i < LIST_N; ++i) - lists[i].allocated = 0; + api->lists[i].allocated = 0; if (fix_reax == nullptr) { modify->add_fix(fmt::format("{} all REAXC",fix_id)); fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; } - control->nthreads = comm->nthreads; + api->control->nthreads = comm->nthreads; } /* ---------------------------------------------------------------------- */ @@ -364,18 +366,18 @@ void PairReaxCOMP::init_style( ) void PairReaxCOMP::setup( ) { int oldN; - int mincap = system->mincap; - double safezone = system->safezone; + int mincap = api->system->mincap; + double safezone = api->system->safezone; - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - oldN = system->N; - system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + oldN = api->system->N; + api->system->bigN = static_cast (atom->natoms); // all atoms in the system - if (system->N > nmax) { + if (api->system->N > nmax) { memory->destroy(num_nbrs_offset); // Don't update nmax here. It is updated at end of compute(). - memory->create(num_nbrs_offset, system->N, "pair:num_nbrs_offset"); + memory->create(num_nbrs_offset, api->system->N, "pair:num_nbrs_offset"); } if (setup_flag == 0) { @@ -387,26 +389,26 @@ void PairReaxCOMP::setup( ) // determine the local and total capacity - system->local_cap = MAX( (int)(system->n * safezone), mincap ); - system->total_cap = MAX( (int)(system->N * safezone), mincap ); + api->system->local_cap = MAX( (int)(api->system->n * safezone), mincap ); + api->system->total_cap = MAX( (int)(api->system->N * safezone), mincap ); // initialize my data structures - PreAllocate_Space( system, control, workspace ); + PreAllocate_Space( api->system, api->control, api->workspace ); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); - if (!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - lists+FAR_NBRS)) + if (!Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + api->lists+FAR_NBRS)) error->all(FLERR,"Pair reax/c problem in far neighbor list"); write_reax_lists(); - InitializeOMP(system, control, data, workspace, &lists, out_control, world); + InitializeOMP(api->system, api->control, api->data, api->workspace, &api->lists, api->out_control, world); - for (int k = 0; k < system->N; ++k) { - num_bonds[k] = system->my_atoms[k].num_bonds; - num_hbonds[k] = system->my_atoms[k].num_hbonds; + for (int k = 0; k < api->system->N; ++k) { + num_bonds[k] = api->system->my_atoms[k].num_bonds; + num_hbonds[k] = api->system->my_atoms[k].num_hbonds; } } else { @@ -417,16 +419,16 @@ void PairReaxCOMP::setup( ) // reset the bond list info for new atoms - for (int k = oldN; k < system->N; ++k) - Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS ); + for (int k = oldN; k < api->system->N; ++k) + Set_End_Index( k, Start_Index( k, api->lists+BONDS ), api->lists+BONDS ); // estimate far neighbor list size // Not present in MPI-only version - workspace->realloc.num_far = estimate_reax_lists(); + api->workspace->realloc.num_far = estimate_reax_lists(); // check if I need to shrink/extend my data-structs - ReAllocate( system, control, data, workspace, &lists ); + ReAllocate( api->system, api->control, api->data, api->workspace, &api->lists ); } } @@ -437,21 +439,21 @@ void PairReaxCOMP::write_reax_atoms() int *num_bonds = fix_reax->num_bonds; int *num_hbonds = fix_reax->num_hbonds; - if (system->N > system->total_cap) + if (api->system->N > api->system->total_cap) error->all(FLERR,"Too many ghost atoms"); #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for (int i = 0; i < system->N; ++i) { - system->my_atoms[i].orig_id = atom->tag[i]; - system->my_atoms[i].type = map[atom->type[i]]; - system->my_atoms[i].x[0] = atom->x[i][0]; - system->my_atoms[i].x[1] = atom->x[i][1]; - system->my_atoms[i].x[2] = atom->x[i][2]; - system->my_atoms[i].q = atom->q[i]; - system->my_atoms[i].num_bonds = num_bonds[i]; - system->my_atoms[i].num_hbonds = num_hbonds[i]; + for (int i = 0; i < api->system->N; ++i) { + api->system->my_atoms[i].orig_id = atom->tag[i]; + api->system->my_atoms[i].type = map[atom->type[i]]; + api->system->my_atoms[i].x[0] = atom->x[i][0]; + api->system->my_atoms[i].x[1] = atom->x[i][1]; + api->system->my_atoms[i].x[2] = atom->x[i][2]; + api->system->my_atoms[i].q = atom->q[i]; + api->system->my_atoms[i].num_bonds = num_bonds[i]; + api->system->my_atoms[i].num_hbonds = num_hbonds[i]; } } @@ -463,7 +465,7 @@ int PairReaxCOMP::estimate_reax_lists() int *ilist = list->ilist; int *numneigh = list->numneigh; int numall = list->inum + list->gnum; - int mincap = system->mincap; + int mincap = api->system->mincap; // for good performance in the OpenMP implementation, each thread needs // to know where to place the neighbors of the atoms it is responsible for. @@ -502,7 +504,7 @@ int PairReaxCOMP::write_reax_lists() int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; - reax_list *far_nbrs = lists + FAR_NBRS; + reax_list *far_nbrs = api->lists + FAR_NBRS; far_neighbor_data *far_list = far_nbrs->select.far_nbr_list; int num_nbrs = 0; @@ -532,9 +534,9 @@ int PairReaxCOMP::write_reax_lists() Set_Start_Index( i, num_nbrs_offset[i], far_nbrs ); if (i < inum) - cutoff_sqr = control->nonb_cut*control->nonb_cut; + cutoff_sqr = SQR(api->control->nonb_cut); else - cutoff_sqr = control->bond_cut*control->bond_cut; + cutoff_sqr = SQR(api->control->bond_cut); num_mynbrs = 0; @@ -545,7 +547,7 @@ int PairReaxCOMP::write_reax_lists() if (d_sqr <= cutoff_sqr) { dist = sqrt( d_sqr ); - set_far_nbr( &far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); + set_far_nbr((ReaxFF::far_neighbor_data *) &far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); ++num_mynbrs; } } @@ -567,14 +569,14 @@ void PairReaxCOMP::read_reax_forces(int /* vflag */) #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for (int i = 0; i < system->N; ++i) { - system->my_atoms[i].f[0] = workspace->f[i][0]; - system->my_atoms[i].f[1] = workspace->f[i][1]; - system->my_atoms[i].f[2] = workspace->f[i][2]; + for (int i = 0; i < api->system->N; ++i) { + api->system->my_atoms[i].f[0] = api->workspace->f[i][0]; + api->system->my_atoms[i].f[1] = api->workspace->f[i][1]; + api->system->my_atoms[i].f[2] = api->workspace->f[i][2]; - atom->f[i][0] = -workspace->f[i][0]; - atom->f[i][1] = -workspace->f[i][1]; - atom->f[i][2] = -workspace->f[i][2]; + atom->f[i][0] = -api->workspace->f[i][0]; + atom->f[i][1] = -api->workspace->f[i][1]; + atom->f[i][2] = -api->workspace->f[i][2]; } } @@ -587,14 +589,14 @@ void PairReaxCOMP::FindBond() #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for (int i = 0; i < system->n; i++) { + for (int i = 0; i < api->system->n; i++) { int j, pj, nj; double bo_tmp; bond_data *bo_ij; nj = 0; - for (pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj) { - bo_ij = &( lists->select.bond_list[pj] ); + for (pj = Start_Index(i, api->lists); pj < End_Index(i, api->lists); ++pj) { + bo_ij = &( api->lists->select.bond_list[pj] ); j = bo_ij->nbr; if (j < i) continue; diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 2472fc3098..b4b28b587a 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -43,6 +43,8 @@ #include "reaxc_defs.h" #include "reaxc_types.h" +#include "reaxff_api.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -315,8 +317,8 @@ void FixQEqReax::allocate_matrix() double safezone; if (reaxflag) { - mincap = reaxc->system->mincap; - safezone = reaxc->system->safezone; + mincap = reaxc->api->system->mincap; + safezone = reaxc->api->system->safezone; } else { mincap = REAX_MIN_CAP; safezone = REAX_SAFE_ZONE; diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 26cd7870ff..62e8427894 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -29,6 +29,8 @@ #include "reaxc_types.h" #include "reaxc_defs.h" +#include "reaxff_api.h" + #include using namespace LAMMPS_NS; @@ -186,7 +188,7 @@ void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) inum = reaxc->list->inum; ilist = reaxc->list->ilist; bond_data *bo_ij; - bo_cut = reaxc->control->bg_cut; + bo_cut = reaxc->api->control->bg_cut; tagint *tag = atom->tag; @@ -194,8 +196,8 @@ void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) i = ilist[ii]; nj = 0; - for (pj = Start_Index(i, reaxc->lists); pj < End_Index(i, reaxc->lists); ++pj) { - bo_ij = &( reaxc->lists->select.bond_list[pj] ); + for (pj = Start_Index(i, reaxc->api->lists); pj < End_Index(i, reaxc->api->lists); ++pj) { + bo_ij = &( reaxc->api->lists->select.bond_list[pj] ); j = bo_ij->nbr; jtag = tag[j]; bo_tmp = bo_ij->bo_data.BO; @@ -223,8 +225,8 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) for (i = 0; i < nlocal; i++) { buf[j-1] = atom->tag[i]; buf[j+0] = atom->type[i]; - buf[j+1] = reaxc->workspace->total_bond_order[i]; - buf[j+2] = reaxc->workspace->nlp[i]; + buf[j+1] = reaxc->api->workspace->total_bond_order[i]; + buf[j+2] = reaxc->api->workspace->nlp[i]; buf[j+3] = atom->q[i]; buf[j+4] = numneigh[i]; numbonds = nint(buf[j+4]); @@ -258,7 +260,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, bigint ntimestep = update->ntimestep; double sbotmp, nlptmp, avqtmp, abotmp; - double cutof3 = reaxc->control->bg_cut; + double cutof3 = reaxc->api->control->bg_cut; MPI_Request irequest, irequest2; if (me == 0) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index e8a47658d1..87def7f06b 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -53,6 +53,8 @@ #include "reaxc_reset_tools.h" #include "reaxc_vector.h" +#include "reaxff_api.h" + using namespace LAMMPS_NS; static const char cite_pair_reax_c[] = @@ -81,38 +83,34 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) fix_id = utils::strdup("REAXC_" + std::to_string(instance_me)); - system = (reax_system *) - memory->smalloc(sizeof(reax_system),"reax:system"); - memset(system,0,sizeof(reax_system)); - control = (control_params *) - memory->smalloc(sizeof(control_params),"reax:control"); - memset(control,0,sizeof(control_params)); - data = (simulation_data *) - memory->smalloc(sizeof(simulation_data),"reax:data"); - workspace = (storage *) - memory->smalloc(sizeof(storage),"reax:storage"); - lists = (reax_list *) - memory->smalloc(LIST_N * sizeof(reax_list),"reax:lists"); - memset(lists,0,LIST_N * sizeof(reax_list)); - out_control = (output_controls *) - memory->smalloc(sizeof(output_controls),"reax:out_control"); - memset(out_control,0,sizeof(output_controls)); + api = new ReaxFF::API; - control->me = system->my_rank = comm->me; + api->system = new reax_system; + memset(api->system,0,sizeof(reax_system)); + api->control = new control_params; + memset(api->control,0,sizeof(control_params)); + api->out_control = new output_controls; + memset(api->out_control,0,sizeof(output_controls)); + api->data = new simulation_data; + api->workspace = new storage; + memory->create(api->lists, LIST_N,"reaxff:lists"); + memset(api->lists,0,LIST_N * sizeof(reax_list)); - system->num_nbrs = 0; - system->n = 0; // my atoms - system->N = 0; // mine + ghosts - system->bigN = 0; // all atoms in the system - system->local_cap = 0; - system->total_cap = 0; - system->my_atoms = nullptr; - system->pair_ptr = this; - system->error_ptr = error; - control->error_ptr = error; - control->lmp_ptr = lmp; + api->control->me = api->system->my_rank = comm->me; - system->omp_active = 0; + api->system->num_nbrs = 0; + api->system->n = 0; // my atoms + api->system->N = 0; // mine + ghosts + api->system->bigN = 0; // all atoms in the system + api->system->local_cap = 0; + api->system->total_cap = 0; + api->system->my_atoms = nullptr; + api->system->pair_ptr = this; + api->system->error_ptr = error; + api->control->error_ptr = error; + api->control->lmp_ptr = lmp; + + api->system->omp_active = 0; fix_reax = nullptr; tmpid = nullptr; @@ -137,27 +135,27 @@ PairReaxC::~PairReaxC() delete[] fix_id; if (setup_flag) { - Close_Output_Files(system,out_control); + Close_Output_Files(api->system,api->out_control); // deallocate reax data-structures - if (control->tabulate) Deallocate_Lookup_Tables(system); + if (api->control->tabulate) Deallocate_Lookup_Tables(api->system); - if (control->hbond_cut > 0) Delete_List(lists+HBONDS); - Delete_List(lists+BONDS); - Delete_List(lists+THREE_BODIES); - Delete_List(lists+FAR_NBRS); + if (api->control->hbond_cut > 0) Delete_List(api->lists+HBONDS); + Delete_List(api->lists+BONDS); + Delete_List(api->lists+THREE_BODIES); + Delete_List(api->lists+FAR_NBRS); - DeAllocate_Workspace(control, workspace); - DeAllocate_System(system); + DeAllocate_Workspace(api->control, api->workspace); + DeAllocate_System(api->system); } - memory->destroy(system); - memory->destroy(control); - memory->destroy( data ); - memory->destroy( workspace ); - memory->destroy( lists ); - memory->destroy( out_control ); + delete api->system; + delete api->control; + delete api->out_control; + delete api->data; + delete api->workspace; + memory->destroy(api->lists); // deallocate interface storage if (allocated) { @@ -179,7 +177,7 @@ PairReaxC::~PairReaxC() /* ---------------------------------------------------------------------- */ -void PairReaxC::allocate( ) +void PairReaxC::allocate() { allocated = 1; int n = atom->ntypes; @@ -204,42 +202,42 @@ void PairReaxC::settings(int narg, char **arg) // read name of control file or use default controls if (strcmp(arg[0],"NULL") == 0) { - strcpy( control->sim_name, "simulate" ); - out_control->energy_update_freq = 0; - control->tabulate = 0; + strcpy(api->control->sim_name, "simulate"); + api->out_control->energy_update_freq = 0; + api->control->tabulate = 0; - control->bond_cut = 5.; - control->hbond_cut = 7.50; - control->thb_cut = 0.001; - control->thb_cutsq = 0.00001; - control->bg_cut = 0.3; + api->control->bond_cut = 5.; + api->control->hbond_cut = 7.50; + api->control->thb_cut = 0.001; + api->control->thb_cutsq = 0.00001; + api->control->bg_cut = 0.3; - control->nthreads = 1; + api->control->nthreads = 1; - out_control->write_steps = 0; - strcpy( out_control->traj_title, "default_title" ); - out_control->atom_info = 0; - out_control->bond_info = 0; - out_control->angle_info = 0; - } else Read_Control_File(arg[0], control, out_control); + api->out_control->write_steps = 0; + strcpy(api->out_control->traj_title, "default_title"); + api->out_control->atom_info = 0; + api->out_control->bond_info = 0; + api->out_control->angle_info = 0; + } else Read_Control_File(arg[0], api->control, api->out_control); } - MPI_Bcast(control,sizeof(control_params),MPI_CHAR,0,world); - MPI_Bcast(out_control,sizeof(output_controls),MPI_CHAR,0,world); + MPI_Bcast(api->control,sizeof(control_params),MPI_CHAR,0,world); + MPI_Bcast(api->out_control,sizeof(output_controls),MPI_CHAR,0,world); // must reset these to local values after broadcast - control->me = comm->me; - control->error_ptr = error; - control->lmp_ptr = lmp; + api->control->me = comm->me; + api->control->error_ptr = error; + api->control->lmp_ptr = lmp; // default values qeqflag = 1; - control->lgflag = 0; - control->enobondsflag = 1; - system->mincap = REAX_MIN_CAP; - system->minhbonds = REAX_MIN_HBONDS; - system->safezone = REAX_SAFE_ZONE; - system->saferzone = REAX_SAFER_ZONE; + api->control->lgflag = 0; + api->control->enobondsflag = 1; + api->system->mincap = REAX_MIN_CAP; + api->system->minhbonds = REAX_MIN_HBONDS; + api->system->safezone = REAX_SAFE_ZONE; + api->system->saferzone = REAX_SAFER_ZONE; // process optional keywords @@ -254,33 +252,33 @@ void PairReaxC::settings(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"enobonds") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - if (strcmp(arg[iarg+1],"yes") == 0) control->enobondsflag = 1; - else if (strcmp(arg[iarg+1],"no") == 0) control->enobondsflag = 0; + if (strcmp(arg[iarg+1],"yes") == 0) api->control->enobondsflag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) api->control->enobondsflag = 0; else error->all(FLERR,"Illegal pair_style reax/c command"); iarg += 2; } else if (strcmp(arg[iarg],"lgvdw") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - if (strcmp(arg[iarg+1],"yes") == 0) control->lgflag = 1; - else if (strcmp(arg[iarg+1],"no") == 0) control->lgflag = 0; + if (strcmp(arg[iarg+1],"yes") == 0) api->control->lgflag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) api->control->lgflag = 0; else error->all(FLERR,"Illegal pair_style reax/c command"); iarg += 2; } else if (strcmp(arg[iarg],"safezone") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->safezone = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (system->safezone < 0.0) + api->system->safezone = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (api->system->safezone < 0.0) error->all(FLERR,"Illegal pair_style reax/c safezone command"); - system->saferzone = system->safezone*1.2 + 0.2; + api->system->saferzone = api->system->safezone*1.2 + 0.2; iarg += 2; } else if (strcmp(arg[iarg],"mincap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->mincap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (system->mincap < 0) + api->system->mincap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (api->system->mincap < 0) error->all(FLERR,"Illegal pair_style reax/c mincap command"); iarg += 2; } else if (strcmp(arg[iarg],"minhbonds") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->minhbonds = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (system->minhbonds < 0) + api->system->minhbonds = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (api->system->minhbonds < 0) error->all(FLERR,"Illegal pair_style reax/c minhbonds command"); iarg += 2; } else error->all(FLERR,"Illegal pair_style reax/c command"); @@ -289,7 +287,7 @@ void PairReaxC::settings(int narg, char **arg) /* ---------------------------------------------------------------------- */ -void PairReaxC::coeff( int nargs, char **args ) +void PairReaxC::coeff(int nargs, char **args) { if (!allocated) allocate(); @@ -303,13 +301,13 @@ void PairReaxC::coeff( int nargs, char **args ) // read ffield file - Read_Force_Field(args[2], &(system->reax_param), control); + Read_Force_Field(args[2], &(api->system->reax_param), api->control); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if "NULL" int itmp = 0; - int nreax_types = system->reax_param.num_atom_types; + int nreax_types = api->system->reax_param.num_atom_types; for (int i = 3; i < nargs; i++) { if (strcmp(args[i],"NULL") == 0) { map[i-2] = -1; @@ -323,7 +321,7 @@ void PairReaxC::coeff( int nargs, char **args ) // pair_coeff element map for (int i = 3; i < nargs; i++) for (int j = 0; j < nreax_types; j++) - if (strcasecmp(args[i],system->reax_param.sbp[j].name) == 0) { + if (strcasecmp(args[i],api->system->reax_param.sbp[j].name) == 0) { map[i-2] = j; itmp ++; } @@ -352,7 +350,7 @@ void PairReaxC::coeff( int nargs, char **args ) /* ---------------------------------------------------------------------- */ -void PairReaxC::init_style( ) +void PairReaxC::init_style() { if (!atom->q_flag) error->all(FLERR,"Pair style reax/c requires atom attribute q"); @@ -364,10 +362,10 @@ void PairReaxC::init_style( ) if (!have_qeq && qeqflag == 1) error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - system->bigN = static_cast (atom->natoms); // all atoms in the system - system->wsize = comm->nprocs; + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + api->system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) error->all(FLERR,"Pair style reax/c requires atom IDs"); @@ -389,14 +387,14 @@ void PairReaxC::init_style( ) neighbor->requests[irequest]->newton = 2; neighbor->requests[irequest]->ghost = 1; - cutmax = MAX3(control->nonb_cut, control->hbond_cut, control->bond_cut); - if ((cutmax < 2.0*control->bond_cut) && (comm->me == 0)) + cutmax = MAX3(api->control->nonb_cut, api->control->hbond_cut, api->control->bond_cut); + if ((cutmax < 2.0*api->control->bond_cut) && (comm->me == 0)) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); for (int i = 0; i < LIST_N; ++i) - if (lists[i].allocated != 1) - lists[i].allocated = 0; + if (api->lists[i].allocated != 1) + api->lists[i].allocated = 0; if (fix_reax == nullptr) { modify->add_fix(fmt::format("{} all REAXC",fix_id)); @@ -406,16 +404,16 @@ void PairReaxC::init_style( ) /* ---------------------------------------------------------------------- */ -void PairReaxC::setup( ) +void PairReaxC::setup() { int oldN; - int mincap = system->mincap; - double safezone = system->safezone; + int mincap = api->system->mincap; + double safezone = api->system->safezone; - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - oldN = system->N; - system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + oldN = api->system->N; + api->system->bigN = static_cast (atom->natoms); // all atoms in the system if (setup_flag == 0) { @@ -426,28 +424,28 @@ void PairReaxC::setup( ) // determine the local and total capacity - system->local_cap = MAX( (int)(system->n * safezone), mincap ); - system->total_cap = MAX( (int)(system->N * safezone), mincap ); + api->system->local_cap = MAX((int)(api->system->n * safezone), mincap); + api->system->total_cap = MAX((int)(api->system->N * safezone), mincap); // initialize my data structures - PreAllocate_Space( system, control, workspace ); + PreAllocate_Space(api->system, api->control, api->workspace); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) error->all(FLERR,"Too many neighbors for pair style reax/c"); - if (!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - lists+FAR_NBRS)) + if (!Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + api->lists+FAR_NBRS)) error->all(FLERR,"Pair reax/c problem in far neighbor list"); - (lists+FAR_NBRS)->error_ptr=error; + (api->lists+FAR_NBRS)->error_ptr=error; write_reax_lists(); - system->wsize = comm->nprocs; - Initialize(system, control, data, workspace, &lists, out_control, world); - for (int k = 0; k < system->N; ++k) { - num_bonds[k] = system->my_atoms[k].num_bonds; - num_hbonds[k] = system->my_atoms[k].num_hbonds; + api->system->wsize = comm->nprocs; + Initialize(api->system, api->control, api->data, api->workspace, &api->lists, api->out_control, world); + for (int k = 0; k < api->system->N; ++k) { + num_bonds[k] = api->system->my_atoms[k].num_bonds; + num_hbonds[k] = api->system->my_atoms[k].num_hbonds; } } else { @@ -458,12 +456,12 @@ void PairReaxC::setup( ) // reset the bond list info for new atoms - for (int k = oldN; k < system->N; ++k) - Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS ); + for (int k = oldN; k < api->system->N; ++k) + Set_End_Index(k, Start_Index(k, api->lists+BONDS), api->lists+BONDS); // check if I need to shrink/extend my data-structs - ReAllocate( system, control, data, workspace, &lists ); + ReAllocate(api->system, api->control, api->data, api->workspace, &api->lists); } bigint local_ngroup = list->inum; @@ -496,47 +494,47 @@ void PairReaxC::compute(int eflag, int vflag) evdwl = ecoul = 0.0; ev_init(eflag,vflag); - if (vflag_global) control->virial = 1; - else control->virial = 0; + if (vflag_global) api->control->virial = 1; + else api->control->virial = 0; - system->n = atom->nlocal; // my atoms - system->N = atom->nlocal + atom->nghost; // mine + ghosts - system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + api->system->bigN = static_cast (atom->natoms); // all atoms in the system // setup data structures setup(); - Reset( system, control, data, workspace, &lists ); - workspace->realloc.num_far = write_reax_lists(); + Reset(api->system, api->control, api->data, api->workspace, &api->lists); + api->workspace->realloc.num_far = write_reax_lists(); // forces - Compute_Forces(system,control,data,workspace,&lists,out_control); + Compute_Forces(api->system,api->control,api->data,api->workspace,&api->lists,api->out_control); read_reax_forces(vflag); - for (int k = 0; k < system->N; ++k) { - num_bonds[k] = system->my_atoms[k].num_bonds; - num_hbonds[k] = system->my_atoms[k].num_hbonds; + for (int k = 0; k < api->system->N; ++k) { + num_bonds[k] = api->system->my_atoms[k].num_bonds; + num_hbonds[k] = api->system->my_atoms[k].num_hbonds; } // energies and pressure if (eflag_global) { - evdwl += data->my_en.e_bond; - evdwl += data->my_en.e_ov; - evdwl += data->my_en.e_un; - evdwl += data->my_en.e_lp; - evdwl += data->my_en.e_ang; - evdwl += data->my_en.e_pen; - evdwl += data->my_en.e_coa; - evdwl += data->my_en.e_hb; - evdwl += data->my_en.e_tor; - evdwl += data->my_en.e_con; - evdwl += data->my_en.e_vdW; + evdwl += api->data->my_en.e_bond; + evdwl += api->data->my_en.e_ov; + evdwl += api->data->my_en.e_un; + evdwl += api->data->my_en.e_lp; + evdwl += api->data->my_en.e_ang; + evdwl += api->data->my_en.e_pen; + evdwl += api->data->my_en.e_coa; + evdwl += api->data->my_en.e_hb; + evdwl += api->data->my_en.e_tor; + evdwl += api->data->my_en.e_con; + evdwl += api->data->my_en.e_vdW; - ecoul += data->my_en.e_ele; - ecoul += data->my_en.e_pol; + ecoul += api->data->my_en.e_ele; + ecoul += api->data->my_en.e_pol; // eng_vdwl += evdwl; // eng_coul += ecoul; @@ -544,43 +542,43 @@ void PairReaxC::compute(int eflag, int vflag) // Store the different parts of the energy // in a list for output by compute pair command - pvector[0] = data->my_en.e_bond; - pvector[1] = data->my_en.e_ov + data->my_en.e_un; - pvector[2] = data->my_en.e_lp; + pvector[0] = api->data->my_en.e_bond; + pvector[1] = api->data->my_en.e_ov + api->data->my_en.e_un; + pvector[2] = api->data->my_en.e_lp; pvector[3] = 0.0; - pvector[4] = data->my_en.e_ang; - pvector[5] = data->my_en.e_pen; - pvector[6] = data->my_en.e_coa; - pvector[7] = data->my_en.e_hb; - pvector[8] = data->my_en.e_tor; - pvector[9] = data->my_en.e_con; - pvector[10] = data->my_en.e_vdW; - pvector[11] = data->my_en.e_ele; + pvector[4] = api->data->my_en.e_ang; + pvector[5] = api->data->my_en.e_pen; + pvector[6] = api->data->my_en.e_coa; + pvector[7] = api->data->my_en.e_hb; + pvector[8] = api->data->my_en.e_tor; + pvector[9] = api->data->my_en.e_con; + pvector[10] = api->data->my_en.e_vdW; + pvector[11] = api->data->my_en.e_ele; pvector[12] = 0.0; - pvector[13] = data->my_en.e_pol; + pvector[13] = api->data->my_en.e_pol; } if (vflag_fdotr) virial_fdotr_compute(); // Set internal timestep counter to that of LAMMPS - data->step = update->ntimestep; + api->data->step = update->ntimestep; - Output_Results(system, control, data, &lists, out_control, world); + Output_Results(api->system, api->control, api->data, &api->lists, api->out_control, world); // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; if (fixspecies_flag) { - if (system->N > nmax) { + if (api->system->N > nmax) { memory->destroy(tmpid); memory->destroy(tmpbo); - nmax = system->N; + nmax = api->system->N; memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid"); memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo"); } - for (i = 0; i < system->N; i ++) + for (i = 0; i < api->system->N; i ++) for (j = 0; j < MAXSPECBOND; j ++) { tmpbo[i][j] = 0.0; tmpid[i][j] = 0; @@ -597,24 +595,24 @@ void PairReaxC::write_reax_atoms() int *num_bonds = fix_reax->num_bonds; int *num_hbonds = fix_reax->num_hbonds; - if (system->N > system->total_cap) + if (api->system->N > api->system->total_cap) error->all(FLERR,"Too many ghost atoms"); - for (int i = 0; i < system->N; ++i) { - system->my_atoms[i].orig_id = atom->tag[i]; - system->my_atoms[i].type = map[atom->type[i]]; - system->my_atoms[i].x[0] = atom->x[i][0]; - system->my_atoms[i].x[1] = atom->x[i][1]; - system->my_atoms[i].x[2] = atom->x[i][2]; - system->my_atoms[i].q = atom->q[i]; - system->my_atoms[i].num_bonds = num_bonds[i]; - system->my_atoms[i].num_hbonds = num_hbonds[i]; + for (int i = 0; i < api->system->N; ++i) { + api->system->my_atoms[i].orig_id = atom->tag[i]; + api->system->my_atoms[i].type = map[atom->type[i]]; + api->system->my_atoms[i].x[0] = atom->x[i][0]; + api->system->my_atoms[i].x[1] = atom->x[i][1]; + api->system->my_atoms[i].x[2] = atom->x[i][2]; + api->system->my_atoms[i].q = atom->q[i]; + api->system->my_atoms[i].num_bonds = num_bonds[i]; + api->system->my_atoms[i].num_hbonds = num_hbonds[i]; } } /* ---------------------------------------------------------------------- */ -void PairReaxC::get_distance( rvec xj, rvec xi, double *d_sqr, rvec *dvec ) +void PairReaxC::get_distance(rvec xj, rvec xi, double *d_sqr, rvec *dvec) { (*dvec)[0] = xj[0] - xi[0]; (*dvec)[1] = xj[1] - xi[1]; @@ -624,13 +622,13 @@ void PairReaxC::get_distance( rvec xj, rvec xi, double *d_sqr, rvec *dvec ) /* ---------------------------------------------------------------------- */ -void PairReaxC::set_far_nbr( far_neighbor_data *fdest, - int j, double d, rvec dvec ) +void PairReaxC::set_far_nbr(ReaxFF::far_neighbor_data *fdest, + int j, double d, rvec dvec) { fdest->nbr = j; fdest->d = d; - rvec_Copy( fdest->dvec, dvec ); - ivec_MakeZero( fdest->rel_box ); + rvec_Copy(fdest->dvec, dvec); + ivec_MakeZero(fdest->rel_box); } /* ---------------------------------------------------------------------- */ @@ -644,8 +642,8 @@ int PairReaxC::estimate_reax_lists() rvec dvec; double **x; - int mincap = system->mincap; - double safezone = system->safezone; + int mincap = api->system->mincap; + double safezone = api->system->safezone; x = atom->x; ilist = list->ilist; @@ -654,7 +652,7 @@ int PairReaxC::estimate_reax_lists() num_nbrs = 0; num_marked = 0; - marked = (int*) calloc( system->N, sizeof(int) ); + marked = (int*) calloc(api->system->N, sizeof(int)); int numall = list->inum + list->gnum; @@ -667,14 +665,14 @@ int PairReaxC::estimate_reax_lists() for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) { j = jlist[itr_j]; j &= NEIGHMASK; - get_distance( x[j], x[i], &d_sqr, &dvec ); + get_distance(x[j], x[i], &d_sqr, &dvec); - if (d_sqr <= SQR(control->nonb_cut)) + if (d_sqr <= SQR(api->control->nonb_cut)) ++num_nbrs; } } - free( marked ); + free(marked); return static_cast (MAX(num_nbrs*safezone, mincap*REAX_MIN_NBRS)); } @@ -697,40 +695,40 @@ int PairReaxC::write_reax_lists() numneigh = list->numneigh; firstneigh = list->firstneigh; - far_nbrs = lists + FAR_NBRS; + far_nbrs = api->lists + FAR_NBRS; far_list = far_nbrs->select.far_nbr_list; num_nbrs = 0; int inum = list->inum; - dist = (double*) calloc( system->N, sizeof(double) ); + dist = (double*) calloc(api->system->N, sizeof(double)); int numall = list->inum + list->gnum; for (itr_i = 0; itr_i < numall; ++itr_i) { i = ilist[itr_i]; jlist = firstneigh[i]; - Set_Start_Index( i, num_nbrs, far_nbrs ); + Set_Start_Index(i, num_nbrs, far_nbrs); if (i < inum) - cutoff_sqr = control->nonb_cut*control->nonb_cut; + cutoff_sqr = SQR(api->control->nonb_cut); else - cutoff_sqr = control->bond_cut*control->bond_cut; + cutoff_sqr = SQR(api->control->bond_cut); for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) { j = jlist[itr_j]; j &= NEIGHMASK; - get_distance( x[j], x[i], &d_sqr, &dvec ); + get_distance(x[j], x[i], &d_sqr, &dvec); if (d_sqr <= (cutoff_sqr)) { - dist[j] = sqrt( d_sqr ); - set_far_nbr( &far_list[num_nbrs], j, dist[j], dvec ); + dist[j] = sqrt(d_sqr); + set_far_nbr((ReaxFF::far_neighbor_data *)&far_list[num_nbrs], j, dist[j], dvec); ++num_nbrs; } } - Set_End_Index( i, num_nbrs, far_nbrs ); + Set_End_Index(i, num_nbrs, far_nbrs); } - free( dist ); + free(dist); return num_nbrs; } @@ -739,14 +737,14 @@ int PairReaxC::write_reax_lists() void PairReaxC::read_reax_forces(int /*vflag*/) { - for (int i = 0; i < system->N; ++i) { - system->my_atoms[i].f[0] = workspace->f[i][0]; - system->my_atoms[i].f[1] = workspace->f[i][1]; - system->my_atoms[i].f[2] = workspace->f[i][2]; + for (int i = 0; i < api->system->N; ++i) { + api->system->my_atoms[i].f[0] = api->workspace->f[i][0]; + api->system->my_atoms[i].f[1] = api->workspace->f[i][1]; + api->system->my_atoms[i].f[2] = api->workspace->f[i][2]; - atom->f[i][0] += -workspace->f[i][0]; - atom->f[i][1] += -workspace->f[i][1]; - atom->f[i][2] += -workspace->f[i][2]; + atom->f[i][0] += -api->workspace->f[i][0]; + atom->f[i][1] += -api->workspace->f[i][1]; + atom->f[i][2] += -api->workspace->f[i][2]; } } @@ -758,19 +756,19 @@ void *PairReaxC::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"chi") == 0 && chi) { for (int i = 1; i <= atom->ntypes; i++) - if (map[i] >= 0) chi[i] = system->reax_param.sbp[map[i]].chi; + if (map[i] >= 0) chi[i] = api->system->reax_param.sbp[map[i]].chi; else chi[i] = 0.0; return (void *) chi; } if (strcmp(str,"eta") == 0 && eta) { for (int i = 1; i <= atom->ntypes; i++) - if (map[i] >= 0) eta[i] = system->reax_param.sbp[map[i]].eta; + if (map[i] >= 0) eta[i] = api->system->reax_param.sbp[map[i]].eta; else eta[i] = 0.0; return (void *) eta; } if (strcmp(str,"gamma") == 0 && gamma) { for (int i = 1; i <= atom->ntypes; i++) - if (map[i] >= 0) gamma[i] = system->reax_param.sbp[map[i]].gamma; + if (map[i] >= 0) gamma[i] = api->system->reax_param.sbp[map[i]].gamma; else gamma[i] = 0.0; return (void *) gamma; } @@ -784,22 +782,22 @@ double PairReaxC::memory_usage() double bytes = 0.0; // From pair_reax_c - bytes += (double)1.0 * system->N * sizeof(int); - bytes += (double)1.0 * system->N * sizeof(double); + bytes += (double)1.0 * api->system->N * sizeof(int); + bytes += (double)1.0 * api->system->N * sizeof(double); // From reaxc_allocate: BO - bytes += (double)1.0 * system->total_cap * sizeof(reax_atom); - bytes += (double)19.0 * system->total_cap * sizeof(double); - bytes += (double)3.0 * system->total_cap * sizeof(int); + bytes += (double)1.0 * api->system->total_cap * sizeof(reax_atom); + bytes += (double)19.0 * api->system->total_cap * sizeof(double); + bytes += (double)3.0 * api->system->total_cap * sizeof(int); // From reaxc_lists - bytes += (double)2.0 * lists->n * sizeof(int); - bytes += (double)lists->num_intrs * sizeof(three_body_interaction_data); - bytes += (double)lists->num_intrs * sizeof(bond_data); - bytes += (double)lists->num_intrs * sizeof(dbond_data); - bytes += (double)lists->num_intrs * sizeof(dDelta_data); - bytes += (double)lists->num_intrs * sizeof(far_neighbor_data); - bytes += (double)lists->num_intrs * sizeof(hbond_data); + bytes += (double)2.0 * api->lists->n * sizeof(int); + bytes += (double)api->lists->num_intrs * sizeof(three_body_interaction_data); + bytes += (double)api->lists->num_intrs * sizeof(bond_data); + bytes += (double)api->lists->num_intrs * sizeof(dbond_data); + bytes += (double)api->lists->num_intrs * sizeof(dDelta_data); + bytes += (double)api->lists->num_intrs * sizeof(far_neighbor_data); + bytes += (double)api->lists->num_intrs * sizeof(hbond_data); if (fixspecies_flag) bytes += (double)2 * nmax * MAXSPECBOND * sizeof(double); @@ -817,10 +815,10 @@ void PairReaxC::FindBond() bond_data *bo_ij; bo_cut = 0.10; - for (i = 0; i < system->n; i++) { + for (i = 0; i < api->system->n; i++) { nj = 0; - for (pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj) { - bo_ij = &( lists->select.bond_list[pj] ); + for (pj = Start_Index(i, api->lists); pj < End_Index(i, api->lists); ++pj) { + bo_ij = &(api->lists->select.bond_list[pj]); j = bo_ij->nbr; if (j < i) continue; diff --git a/src/USER-REAXC/pair_reaxc.h b/src/USER-REAXC/pair_reaxc.h index 5283824116..9372f23ff4 100644 --- a/src/USER-REAXC/pair_reaxc.h +++ b/src/USER-REAXC/pair_reaxc.h @@ -32,14 +32,10 @@ PairStyle(reax/c,PairReaxC) #include "pair.h" -// forward declarations -struct control_params; -struct reax_system; -struct output_controls; -struct simulation_data; -struct storage; -struct reax_list; -struct far_neighbor_data; +namespace ReaxFF { + struct API; + struct far_neighbor_data; +} namespace LAMMPS_NS { @@ -57,12 +53,7 @@ class PairReaxC : public Pair { int **tmpid; double **tmpbo,**tmpr; - control_params *control; - reax_system *system; - output_controls *out_control; - simulation_data *data; - storage *workspace; - reax_list *lists; + ReaxFF::API *api; bigint ngroup; typedef double rvec[3]; @@ -83,7 +74,7 @@ protected: void create_fix(); void write_reax_atoms(); void get_distance(rvec, rvec, double *, rvec *); - void set_far_nbr(far_neighbor_data *, int, double, rvec); + void set_far_nbr(ReaxFF::far_neighbor_data *, int, double, rvec); int estimate_reax_lists(); int write_reax_lists(); void read_reax_forces(int); @@ -91,7 +82,6 @@ protected: int nmax; void FindBond(); double memory_usage(); - }; } diff --git a/src/USER-REAXC/reaxc_ffield.h b/src/USER-REAXC/reaxc_ffield.h index d334047ab5..f7a97f0636 100644 --- a/src/USER-REAXC/reaxc_ffield.h +++ b/src/USER-REAXC/reaxc_ffield.h @@ -24,8 +24,8 @@ . ----------------------------------------------------------------------*/ -#ifndef __FFIELD_H_ -#define __FFIELD_H_ +#ifndef LMP_REAXC_FFIELD_H +#define LMP_REAXC_FFIELD_H #include "reaxc_types.h" diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 6c8c1e079d..a4678d52c5 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -111,7 +111,7 @@ void Write_Header(reax_system *system, control_params *control, output_controls /* only the master node writes into trajectory header */ if (system->my_rank == MASTER_NODE) { std::string buffer(""); - + /* to skip the header */ buffer += fmtline("chars_to_skip_header:",(NUM_HEADER_LINES-1) * HEADER_LINE_LEN); @@ -167,7 +167,7 @@ void Write_Header(reax_system *system, control_params *control, output_controls buffer += fmtline("molecular_analysis_frequency:", 0); /* dump out the buffer */ - + fputs(buffer.c_str(),out_control->strj); } } @@ -324,13 +324,13 @@ void Write_Atoms(reax_system *system, output_controls *out_control, /* fill in buffer */ out_control->buffer[0] = 0; - + for (i = 0; i < system->n; ++i) { std::string buffer(""); p_atom = &(system->my_atoms[i]); buffer += fmt::format("{:9}{:10.3f}{:10.3f}{:10.3f}",p_atom->orig_id, p_atom->x[0], p_atom->x[1],p_atom->x[2]); - + switch (out_control->atom_info) { case OPT_ATOM_BASIC: buffer += fmt::format("{:10.3f}\n",p_atom->q); diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 94adf6c3f7..cd9b1be9c9 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -325,6 +325,15 @@ struct far_neighbor_data { rvec dvec; }; +namespace ReaxFF { + struct far_neighbor_data { + int nbr; + ivec rel_box; + double d; + rvec dvec; + }; +} + struct hbond_data { int nbr; int scl; diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h new file mode 100644 index 0000000000..489a7b487e --- /dev/null +++ b/src/USER-REAXC/reaxff_api.h @@ -0,0 +1,38 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Hasan Metin Aktulga, Purdue University + (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + + Heavily modified and adapted for LAMMPS by the LAMMPS developers. +------------------------------------------------------------------------- */ + +#ifndef LMP_REAXFF_API_H +#define LMP_REAXFF_API_H + +#include "reaxc_types.h" + +namespace ReaxFF +{ + struct API { + control_params *control; + reax_system *system; + output_controls *out_control; + simulation_data *data; + storage *workspace; + reax_list *lists; + }; +} + +#endif From b96d1ac1a5c859a760c60e5059c70188f05e4183 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Apr 2021 16:45:46 -0400 Subject: [PATCH 025/119] first step of adopting a ReaxFF namespace and reorganizing the ReaxFF headers --- src/KOKKOS/pair_reaxc_kokkos.cpp | 7 +- src/KOKKOS/pair_reaxc_kokkos.h | 7 +- src/USER-OMP/pair_reaxc_omp.cpp | 15 +- src/USER-OMP/reaxff_omp.h | 75 +++++ src/USER-REAXC/fix_qeq_reax.cpp | 9 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 7 +- src/USER-REAXC/pair_reaxc.cpp | 20 +- src/USER-REAXC/reaxff_api.h | 115 +++++++- src/USER-REAXC/reaxff_defs.h | 107 +++++++ src/USER-REAXC/reaxff_inline.h | 88 ++++++ src/USER-REAXC/reaxff_types.h | 453 +++++++++++++++++++++++++++++ 11 files changed, 855 insertions(+), 48 deletions(-) create mode 100644 src/USER-OMP/reaxff_omp.h create mode 100644 src/USER-REAXC/reaxff_defs.h create mode 100644 src/USER-REAXC/reaxff_inline.h create mode 100644 src/USER-REAXC/reaxff_types.h diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 4ef82776d8..deb1dc74fd 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -28,19 +28,16 @@ #include "neigh_request.h" #include "neighbor.h" -#include "reaxc_defs.h" -#include "reaxc_lookup.h" -#include "reaxc_tool_box.h" - #include "reaxff_api.h" #include - #define TEAMSIZE 128 /* ---------------------------------------------------------------------- */ +using namespace ReaxFF; + namespace LAMMPS_NS { using namespace MathConst; using namespace MathSpecial; diff --git a/src/KOKKOS/pair_reaxc_kokkos.h b/src/KOKKOS/pair_reaxc_kokkos.h index d54f275d6f..19b2f53f35 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.h +++ b/src/KOKKOS/pair_reaxc_kokkos.h @@ -26,7 +26,6 @@ PairStyle(reax/c/kk/host,PairReaxCKokkos) #include "pair_kokkos.h" #include "pair_reaxc.h" #include "neigh_list_kokkos.h" -#include "reaxc_types.h" #define C_ele 332.06371 #define SMALL 0.0001 @@ -36,12 +35,14 @@ PairStyle(reax/c/kk/host,PairReaxCKokkos) #define SQR(x) ((x)*(x)) +#include "reaxff_inline.h" + namespace LAMMPS_NS { template struct LR_lookup_table_kk { - typedef Kokkos::DualView tdual_cubic_spline_coef_1d; + typedef Kokkos::DualView tdual_cubic_spline_coef_1d; typedef typename tdual_cubic_spline_coef_1d::t_dev t_cubic_spline_coef_1d; double dx, inv_dx; @@ -338,7 +339,7 @@ class PairReaxCKokkos : public PairReaxC { void init_md(); int Init_Lookup_Tables(); void Deallocate_Lookup_Tables(); - void LR_vdW_Coulomb( int i, int j, double r_ij, LR_data *lr ); + void LR_vdW_Coulomb( int i, int j, double r_ij, ReaxFF::LR_data *lr ); typedef Kokkos::DualView tdual_int_1d; Kokkos::DualView k_params_sing; diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index e7e03520e0..ac1ddd17a6 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -49,18 +49,8 @@ #include "memory.h" #include "error.h" - -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_allocate.h" -#include "reaxc_forces_omp.h" -#include "reaxc_init_md_omp.h" -#include "reaxc_io_tools.h" -#include "reaxc_list.h" -#include "reaxc_reset_tools.h" -#include "reaxc_tool_box.h" - #include "reaxff_api.h" +#include "reaxff_omp.h" #if defined(_OPENMP) #include @@ -68,6 +58,7 @@ #include "suffix.h" using namespace LAMMPS_NS; +using namespace ReaxFF; #ifdef OMP_TIMING double ompTimingData[LASTTIMINGINDEX]; @@ -547,7 +538,7 @@ int PairReaxCOMP::write_reax_lists() if (d_sqr <= cutoff_sqr) { dist = sqrt( d_sqr ); - set_far_nbr((ReaxFF::far_neighbor_data *) &far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); + set_far_nbr(&far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); ++num_mynbrs; } } diff --git a/src/USER-OMP/reaxff_omp.h b/src/USER-OMP/reaxff_omp.h new file mode 100644 index 0000000000..f6ca7116ca --- /dev/null +++ b/src/USER-OMP/reaxff_omp.h @@ -0,0 +1,75 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Hasan Metin Aktulga, Purdue University + (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + + Heavily modified and adapted for LAMMPS by the LAMMPS developers. +------------------------------------------------------------------------- */ + +#ifndef LMP_REAXFF_OMP_H +#define LMP_REAXFF_OMP_H + +#include "reaxff_types.h" + +namespace ReaxFF +{ + // uncomment to enabled collecting ReaxFF OpenMP timing data + // #define OMP_TIMING 1 + +#ifdef OMP_TIMING + // pkcoff timing fields + enum { COMPUTEINDEX=0, + COMPUTEWLINDEX, + COMPUTEBFINDEX, + COMPUTEQEQINDEX, + COMPUTENBFINDEX, + COMPUTEIFINDEX, + COMPUTETFINDEX, + COMPUTEBOINDEX, + COMPUTEBONDSINDEX, + COMPUTEATOMENERGYINDEX, + COMPUTEVALENCEANGLESBOINDEX, + COMPUTETORSIONANGLESBOINDEX, + COMPUTEHBONDSINDEX, + COMPUTECG1INDEX, + COMPUTECG2INDEX, + COMPUTECGCOMPUTEINDEX, + COMPUTECALCQINDEX, + COMPUTEINITMVINDEX, + COMPUTEMVCOMPINDEX, + LASTTIMINGINDEX + }; + + extern double ompTimingData[LASTTIMINGINDEX]; + extern int ompTimingCount[LASTTIMINGINDEX]; + extern int ompTimingCGCount[LASTTIMINGINDEX]; +#endif + + // exported Functions + + // forces OpenMP + + extern void Compute_ForcesOMP(reax_system *, control_params *, + simulation_data *, storage *, + reax_list **, output_controls *); + + // init md OpenMP + + extern void InitializeOMP(reax_system *, control_params *, + simulation_data *, storage *, reax_list **, + output_controls *, MPI_Comm); +} + +#endif diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index b4b28b587a..f37fa4ba4a 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -31,20 +31,17 @@ #include "neigh_request.h" #include "neighbor.h" #include "pair.h" -#include "pair_reaxc.h" #include "respa.h" #include "text_file_reader.h" #include "tokenizer.h" #include "update.h" +#include "pair_reaxc.h" +#include "reaxff_api.h" + #include #include -#include "reaxc_defs.h" -#include "reaxc_types.h" - -#include "reaxff_api.h" - using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 62e8427894..c741259810 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -22,19 +22,16 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" -#include "pair_reaxc.h" #include "update.h" -#include "reaxc_list.h" -#include "reaxc_types.h" -#include "reaxc_defs.h" - +#include "pair_reaxc.h" #include "reaxff_api.h" #include using namespace LAMMPS_NS; using namespace FixConst; +using namespace ReaxFF; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 87def7f06b..a1772f9551 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -40,22 +40,10 @@ #include #include // for strcasecmp() -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_allocate.h" -#include "reaxc_control.h" -#include "reaxc_ffield.h" -#include "reaxc_forces.h" -#include "reaxc_init_md.h" -#include "reaxc_io_tools.h" -#include "reaxc_list.h" -#include "reaxc_lookup.h" -#include "reaxc_reset_tools.h" -#include "reaxc_vector.h" - #include "reaxff_api.h" using namespace LAMMPS_NS; +using namespace ReaxFF; static const char cite_pair_reax_c[] = "pair reax/c command:\n\n" @@ -83,7 +71,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) fix_id = utils::strdup("REAXC_" + std::to_string(instance_me)); - api = new ReaxFF::API; + api = new API; api->system = new reax_system; memset(api->system,0,sizeof(reax_system)); @@ -622,7 +610,7 @@ void PairReaxC::get_distance(rvec xj, rvec xi, double *d_sqr, rvec *dvec) /* ---------------------------------------------------------------------- */ -void PairReaxC::set_far_nbr(ReaxFF::far_neighbor_data *fdest, +void PairReaxC::set_far_nbr(far_neighbor_data *fdest, int j, double d, rvec dvec) { fdest->nbr = j; @@ -721,7 +709,7 @@ int PairReaxC::write_reax_lists() if (d_sqr <= (cutoff_sqr)) { dist[j] = sqrt(d_sqr); - set_far_nbr((ReaxFF::far_neighbor_data *)&far_list[num_nbrs], j, dist[j], dvec); + set_far_nbr(&far_list[num_nbrs], j, dist[j], dvec); ++num_nbrs; } } diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index 489a7b487e..19f345636f 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -21,10 +21,13 @@ #ifndef LMP_REAXFF_API_H #define LMP_REAXFF_API_H -#include "reaxc_types.h" +#include "reaxff_types.h" + +#include namespace ReaxFF { + // per instance data struct API { control_params *control; reax_system *system; @@ -33,6 +36,116 @@ namespace ReaxFF storage *workspace; reax_list *lists; }; + + // exported Functions + + // allocate + + extern void DeAllocate_System(reax_system *); + extern void DeAllocate_Workspace(control_params *, storage *); + extern int PreAllocate_Space(reax_system *, control_params *, storage *); + extern void ReAllocate(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + + // control + + extern void Read_Control_File(const char *, control_params *, output_controls *); + + // ffield + + extern void Read_Force_Field(const char *, reax_interaction *, control_params *); + + // forces + + extern void Compute_Forces(reax_system *, control_params *, simulation_data *, + storage *, reax_list **, output_controls *); + + // init md + + extern void Initialize(reax_system *, control_params *, simulation_data *, + storage *, reax_list **, output_controls *, MPI_Comm); + + // io tools + + extern void Close_Output_Files(reax_system *, output_controls *); + extern void Output_Results(reax_system *, control_params *, simulation_data *, + reax_list **, output_controls *, MPI_Comm); + + // lists + + inline int Start_Index(int i, reax_list *l) { return l->index[i]; } + inline int End_Index(int i, reax_list *l) { return l->end_index[i]; } + inline void Set_Start_Index(int i, int val, reax_list *l) { + l->index[i] = val; + } + inline void Set_End_Index(int i, int val, reax_list *l) { + l->end_index[i] = val; + } + extern void Delete_List(reax_list*); + extern int Make_List(int, int, int, reax_list *); + + // lookup + + extern void Deallocate_Lookup_Tables(reax_system *); + extern void Natural_Cubic_Spline(LAMMPS_NS::Error*, const double *, + const double *, cubic_spline_coef *, + unsigned int); + extern void Complete_Cubic_Spline(LAMMPS_NS::Error*, const double *, + const double *, double v0, double vlast, + cubic_spline_coef *coef, unsigned int n); + + // reset tools + + extern void Reset(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + + // toolbox + + extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const char *); + extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const char *); + extern void sfree(LAMMPS_NS::Error *, void *, const char *); + + // vector + + inline void rvec_Add(rvec ret, rvec v) { + ret[0] += v[0]; ret[1] += v[1]; ret[2] += v[2]; + } + + inline void rvec_Copy(rvec dest, rvec src) { + dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; + } + + inline void rvec_Cross(rvec ret, rvec v1, rvec v2) + { + ret[0] = v1[1] * v2[2] - v1[2] * v2[1]; + ret[1] = v1[2] * v2[0] - v1[0] * v2[2]; + ret[2] = v1[0] * v2[1] - v1[1] * v2[0]; + } + + inline double rvec_Dot(rvec v1, rvec v2) { + return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; + } + + inline double rvec_Norm( rvec v ) { + return sqrt( SQR(v[0]) + SQR(v[1]) + SQR(v[2]) ); + } + + inline void rvec_Scale(rvec ret, double c, rvec v) { + ret[0] = c * v[0]; ret[1] = c * v[1]; ret[2] = c * v[2]; + } + + inline void rvec_ScaledAdd(rvec ret, double c, rvec v) { + ret[0] += c * v[0], ret[1] += c * v[1], ret[2] += c * v[2]; + } + + inline void rvec_ScaledSum(rvec ret, double c1, rvec v1 ,double c2, rvec v2) + { + ret[0] = c1 * v1[0] + c2 * v2[0]; + ret[1] = c1 * v1[1] + c2 * v2[1]; + ret[2] = c1 * v1[2] + c2 * v2[2]; + } + + inline void ivec_MakeZero(ivec v) { v[0] = v[1] = v[2] = 0; } } #endif diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h new file mode 100644 index 0000000000..3bd3ad899b --- /dev/null +++ b/src/USER-REAXC/reaxff_defs.h @@ -0,0 +1,107 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Hasan Metin Aktulga, Purdue University + (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + + Heavily modified and adapted for LAMMPS by the LAMMPS developers. +------------------------------------------------------------------------- */ + +#ifndef LMP_REAXFF_DEFS_H +#define LMP_REAXFF_DEFS_H + +#if defined(__IBMC__) +#define inline __inline__ +#endif /*IBMC*/ + +#ifndef SUCCESS +#define SUCCESS 1 +#endif +#ifndef FAILURE +#define FAILURE 0 +#endif + +#define SQR(x) ((x)*(x)) +#define CUBE(x) ((x)*(x)*(x)) +#define DEG2RAD(a) ((a)*constPI/180.0) +#define RAD2DEG(a) ((a)*180.0/constPI) +#define MAX3(x,y,z) MAX( MAX(x,y), z) + +#define constPI 3.14159265 +#define C_ele 332.06371 +//#define K_B 503.398008 // kcal/mol/K +#define K_B 0.831687 // amu A^2 / ps^2 / K +#define F_CONV 1e6 / 48.88821291 / 48.88821291 // --> amu A / ps^2 +#define E_CONV 0.002391 // amu A^2 / ps^2 --> kcal/mol +#define EV_to_KCALpMOL 14.400000 // ElectronVolt --> KCAL per MOLe +#define KCALpMOL_to_EV 23.02 // 23.060549 //KCAL per MOLe --> ElectronVolt +#define ECxA_to_DEBYE 4.803204 // elem. charge * Ang -> debye +#define CAL_to_JOULES 4.184000 // CALories --> JOULES +#define JOULES_to_CAL 1/4.184000 // JOULES --> CALories +#define AMU_to_GRAM 1.6605e-24 +#define ANG_to_CM 1e-8 +#define AVOGNR 6.0221367e23 +#define P_CONV 1e-24 * AVOGNR * JOULES_to_CAL + +#define MAX_STR 1024 +#define MAX_LINE 1024 +#define MAX_TOKENS 1024 +#define MAX_TOKEN_LEN 1024 + +#define NUM_INTRS 10 +#define ALMOST_ZERO 1e-10 +#define NEG_INF -1e10 +#define NO_BOND 1e-3 // 0.001 +#define HB_THRESHOLD 1e-2 // 0.01 + +#define REAX_MIN_CAP 50 +#define REAX_MIN_NBRS 100 +#define MIN_HENTRIES 100 +#define MAX_BONDS 30 +#define MIN_BONDS 25 +#define REAX_MIN_HBONDS 25 +#define MIN_3BODIES 1000 +#define REAX_SAFE_ZONE 1.2 +#define REAX_SAFER_ZONE 1.4 +#define DANGER_ZONE 0.90 +#define LOOSE_ZONE 0.75 +#define MAX_3BODY_PARAM 5 +#define MAX_4BODY_PARAM 5 + +#define MASTER_NODE 0 + +#define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ +#define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ + +/************* crucial for reaxff_types.h *********/ + +#define REAX_MAX_STR 1024 +#define REAX_MAX_3BODY_PARAM 5 +#define REAX_MAX_4BODY_PARAM 5 +#define REAX_MAX_ATOM_TYPES 25 + +namespace ReaxFF +{ + /******************* ENUMERATORS *************************/ + + enum lists { BONDS, OLD_BONDS, THREE_BODIES, + HBONDS, FAR_NBRS, DBOS, DDELTAS, LIST_N }; + + enum message_tags {NONE, INIT_DESCS, ATOM_LINES, BOND_LINES, ANGLE_LINES}; + + enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, + TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; +} + +#endif diff --git a/src/USER-REAXC/reaxff_inline.h b/src/USER-REAXC/reaxff_inline.h new file mode 100644 index 0000000000..9a4a2159f6 --- /dev/null +++ b/src/USER-REAXC/reaxff_inline.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Hasan Metin Aktulga, Purdue University + (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + + Heavily modified and adapted for LAMMPS by the LAMMPS developers. +------------------------------------------------------------------------- */ + +#ifndef LMP_REAXFF_INLINE_H +#define LMP_REAXFF_INLINE_H + +#include "accelerator_kokkos.h" // for LAMMPS_INLINE + +namespace ReaxFF +{ + struct LR_data + { + double H; + double e_vdW, CEvd; + double e_ele, CEclmb; + + LAMMPS_INLINE + LR_data() {} + + LAMMPS_INLINE + void operator = (const LR_data& rhs) { + H = rhs.H; + e_vdW = rhs.e_vdW; + CEvd = rhs.CEvd; + e_ele = rhs.e_ele; + CEclmb = rhs.CEclmb; + } + LAMMPS_INLINE + void operator = (const LR_data& rhs) volatile { + H = rhs.H; + e_vdW = rhs.e_vdW; + CEvd = rhs.CEvd; + e_ele = rhs.e_ele; + CEclmb = rhs.CEclmb; + } + }; + + struct cubic_spline_coef + { + double a, b, c, d; + + LAMMPS_INLINE + cubic_spline_coef() {} + + LAMMPS_INLINE + cubic_spline_coef(const cubic_spline_coef &_c) { + a = _c.a; + b = _c.b; + c = _c.c; + d = _c.d; + } + + LAMMPS_INLINE + void operator=(const cubic_spline_coef &rhs) { + a = rhs.a; + b = rhs.b; + c = rhs.c; + d = rhs.d; + } + + LAMMPS_INLINE + void operator=(const cubic_spline_coef &rhs) volatile { + a = rhs.a; + b = rhs.b; + c = rhs.c; + d = rhs.d; + } + }; +} + +#endif diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h new file mode 100644 index 0000000000..eef3aaca4b --- /dev/null +++ b/src/USER-REAXC/reaxff_types.h @@ -0,0 +1,453 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Hasan Metin Aktulga, Purdue University + (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + + Heavily modified and adapted for LAMMPS by the LAMMPS developers. +------------------------------------------------------------------------- */ + +#ifndef LMP_REAXFF_TYPES_H +#define LMP_REAXFF_TYPES_H + +#include "lmptype.h" + +#include "reaxff_defs.h" +#include "reaxff_inline.h" + +// forward declarations +namespace LAMMPS_NS { + class Error; + class LAMMPS; + class Pair; +} + +namespace ReaxFF +{ + /********************** TYPE DEFINITIONS ********************/ + typedef int ivec[3]; + typedef double rvec[3]; + typedef double rvec2[2]; + + // import LAMMPS' definition of tagint and bigint + typedef LAMMPS_NS::tagint rc_tagint; + typedef LAMMPS_NS::bigint rc_bigint; + + struct global_parameters + { + int n_global; + double* l; + int vdw_type; + }; + + struct single_body_parameters + { + char name[4]; // two character atom name + double r_s; + double valency; // Valency of the atom + double mass; // Mass of atom + double r_vdw; + double epsilon; + double gamma; + double r_pi; + double valency_e; + double nlp_opt; + + /* Line two in field file */ + double alpha; + double gamma_w; + double valency_boc; + double p_ovun5; + double chi; + double eta; + int p_hbond; // 1 for H, 2 for hbonding atoms (O,S,P,N), 0 for others + + /* Line three in field file */ + double r_pi_pi; + double p_lp2; + double b_o_131; + double b_o_132; + double b_o_133; + + /* Line four in the field file */ + double p_ovun2; + double p_val3; + double valency_val; + double p_val5; + double rcore2; + double ecore2; + double acore2; + + /* Line five in the ffield file, only for lgvdw yes */ + double lgcij; + double lgre; + + }; + + /* Two Body Parameters */ + struct two_body_parameters { + /* Bond Order parameters */ + double p_bo1,p_bo2,p_bo3,p_bo4,p_bo5,p_bo6; + double r_s, r_p, r_pp; // r_o distances in BO formula + double p_boc3, p_boc4, p_boc5; + + /* Bond Energy parameters */ + double p_be1, p_be2; + double De_s, De_p, De_pp; + + /* Over/Under coordination parameters */ + double p_ovun1; + + /* Van der Waal interaction parameters */ + double D; + double alpha; + double r_vdW; + double gamma_w; + double rcore, ecore, acore; + double lgcij, lgre; + + /* electrostatic parameters */ + double gamma; // note: this parameter is gamma^-3 and not gamma. + + double v13cor, ovc; + }; + + /* 3-body parameters */ + struct three_body_parameters { + /* valence angle */ + double theta_00; + double p_val1, p_val2, p_val4, p_val7; + + /* penalty */ + double p_pen1; + + /* 3-body conjugation */ + double p_coa1; + }; + + struct three_body_header + { + int cnt; + three_body_parameters prm[REAX_MAX_3BODY_PARAM]; + }; + + /* hydrogen-bond parameters */ + struct hbond_parameters + { + double r0_hb, p_hb1, p_hb2, p_hb3; + }; + + /* 4-body parameters */ + struct four_body_parameters + { + double V1, V2, V3; + + /* torsion angle */ + double p_tor1; + + /* 4-body conjugation */ + double p_cot1; + }; + + struct four_body_header + { + int cnt; + four_body_parameters prm[REAX_MAX_4BODY_PARAM]; + }; + + struct reax_interaction + { + int num_atom_types; + global_parameters gp; + single_body_parameters *sbp; + two_body_parameters **tbp; + three_body_header ***thbp; + hbond_parameters ***hbp; + four_body_header ****fbp; + }; + + struct reax_atom + { + rc_tagint orig_id; + int type; + char name[8]; + + rvec x; // position + rvec v; // velocity + rvec f; // force + double q; // charge + + int Hindex; + int num_bonds; + int num_hbonds; + }; + + struct LR_lookup_table; // forward declaration + struct reax_system + { + reax_interaction reax_param; + + rc_bigint bigN; + int n, N, numH; + int local_cap, total_cap, Hcap; + int wsize, my_rank, num_nbrs; + reax_atom *my_atoms; + + LAMMPS_NS::Error *error_ptr; + LAMMPS_NS::Pair *pair_ptr; + int my_bonds; + int mincap,minhbonds; + double safezone, saferzone; + + LR_lookup_table **LR; + + int omp_active; + }; + + /* system control parameters */ + struct control_params + { + char sim_name[REAX_MAX_STR]; + int nthreads; + + double bond_cut; + double nonb_cut, nonb_low; + double hbond_cut; + + double bg_cut; + double bo_cut; + double thb_cut; + double thb_cutsq; + + int tabulate; + int virial; + + int lgflag; + int enobondsflag; + LAMMPS_NS::Error *error_ptr; + LAMMPS_NS::LAMMPS *lmp_ptr; + int me; + }; + + struct energy_data + { + double e_bond; // Total bond energy + double e_ov; // Total over coordination + double e_un; // Total under coordination energy + double e_lp; // Total under coordination energy + double e_ang; // Total valance angle energy + double e_pen; // Total penalty energy + double e_coa; // Total three body conjgation energy + double e_hb; // Total Hydrogen bond energy + double e_tor; // Total torsional energy + double e_con; // Total four body conjugation energy + double e_vdW; // Total van der Waals energy + double e_ele; // Total electrostatics energy + double e_pol; // Polarization energy + }; + + struct simulation_data + { + rc_bigint step; + + energy_data my_en; // per MPI rank energies + energy_data sys_en; // global energies + }; + + struct three_body_interaction_data + { + int thb; + int pthb; // pointer to the third body on the central atom's nbrlist + double theta, cos_theta; + rvec dcos_di, dcos_dj, dcos_dk; + }; + + struct far_neighbor_data { + int nbr; + ivec rel_box; + double d; + rvec dvec; + }; + + namespace ReaxFF { + struct far_neighbor_data { + int nbr; + ivec rel_box; + double d; + rvec dvec; + }; + } + + struct hbond_data { + int nbr; + int scl; + far_neighbor_data *ptr; + }; + + struct dDelta_data { + int wrt; + rvec dVal; + }; + + struct dbond_data { + int wrt; + rvec dBO, dBOpi, dBOpi2; + }; + + struct bond_order_data { + double BO, BO_s, BO_pi, BO_pi2; + double Cdbo, Cdbopi, Cdbopi2; + double C1dbo, C2dbo, C3dbo; + double C1dbopi, C2dbopi, C3dbopi, C4dbopi; + double C1dbopi2, C2dbopi2, C3dbopi2, C4dbopi2; + rvec dBOp, dln_BOp_s, dln_BOp_pi, dln_BOp_pi2; + double *CdboReduction; + }; + + struct bond_data { + int nbr; + int sym_index; + int dbond_index; + ivec rel_box; + // rvec ext_factor; + double d; + rvec dvec; + bond_order_data bo_data; + }; + + struct sparse_matrix_entry { + int j; + double val; + }; + + struct sparse_matrix { + int cap, n, m; + int *start, *end; + sparse_matrix_entry *entries; + }; + + struct reallocate_data { + int num_far; + int H, Htop; + int hbonds, num_hbonds; + int bonds, num_bonds; + int num_3body; + }; + + struct storage + { + int allocated; + + /* bond order related storage */ + double *total_bond_order; + double *Deltap, *Deltap_boc; + double *Delta, *Delta_lp, *Delta_lp_temp, *Delta_e, *Delta_boc, *Delta_val; + double *dDelta_lp, *dDelta_lp_temp; + double *nlp, *nlp_temp, *Clp, *vlpex; + rvec *dDeltap_self; + int *bond_mark; + + /* QEq storage */ + sparse_matrix *H, *L, *U; + double *Hdia_inv, *b_s, *b_t, *b_prc, *b_prm, *s, *t; + rvec2 *b, *x; + + /* CG storage */ + double *r, *d, *q, *p; + rvec2 *r2, *d2, *q2, *p2; + /* Taper */ + double Tap[8]; //Tap7, Tap6, Tap5, Tap4, Tap3, Tap2, Tap1, Tap0; + + /* force calculations */ + double *CdDelta; // coefficient of dDelta + rvec *f; + + /* omp */ + rvec *forceReduction; + double *CdDeltaReduction; + int *valence_angle_atom_myoffset; + + reallocate_data realloc; + }; + + union list_type + { + void *v; + three_body_interaction_data *three_body_list; + bond_data *bond_list; + dbond_data *dbo_list; + dDelta_data *dDelta_list; + far_neighbor_data *far_nbr_list; + hbond_data *hbond_list; + }; + + struct reax_list + { + int allocated; + + int n; + int num_intrs; + + int *index; + int *end_index; + + int type; + list_type select; + class LAMMPS_NS::Error *error_ptr; + }; + + struct output_controls + { + FILE *strj; + int atom_line_len; + int bond_line_len; + int angle_line_len; + int write_atoms; + int write_bonds; + int write_angles; + int buffer_len; + char *buffer; + + int write_steps; + char traj_title[81]; + int atom_info; + int bond_info; + int angle_info; + + int energy_update_freq; + }; + + struct LR_lookup_table + { + double xmin, xmax; + int n; + double dx, inv_dx; + double a; + double m; + double c; + + LR_data *y; + cubic_spline_coef *H; + cubic_spline_coef *vdW, *CEvd; + cubic_spline_coef *ele, *CEclmb; + }; + +/* function pointer defs */ + + typedef void (*interaction_function) (reax_system *, control_params *, + simulation_data *, storage *, + reax_list **, output_controls *); +} + +#endif From a46c901be6958844b07a647ade5aa40e9c48c1bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Apr 2021 16:59:23 -0400 Subject: [PATCH 026/119] remove unused data structure members --- src/USER-REAXC/reaxc_allocate.cpp | 74 +------------------------------ src/USER-REAXC/reaxc_defs.h | 2 - src/USER-REAXC/reaxc_types.h | 46 ------------------- src/USER-REAXC/reaxff_types.h | 18 -------- 4 files changed, 1 insertion(+), 139 deletions(-) diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 3f0a251a97..3d68bb6944 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -110,8 +110,6 @@ void DeAllocate_System( reax_system *system ) /************* workspace *************/ void DeAllocate_Workspace( control_params * control, storage *workspace ) { - int i; - if (!workspace->allocated) return; @@ -136,39 +134,6 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) sfree(control->error_ptr, workspace->vlpex, "vlpex" ); sfree(control->error_ptr, workspace->bond_mark, "bond_mark" ); - /* QEq storage */ - sfree(control->error_ptr, workspace->Hdia_inv, "Hdia_inv" ); - sfree(control->error_ptr, workspace->b_s, "b_s" ); - sfree(control->error_ptr, workspace->b_t, "b_t" ); - sfree(control->error_ptr, workspace->b_prc, "b_prc" ); - sfree(control->error_ptr, workspace->b_prm, "b_prm" ); - sfree(control->error_ptr, workspace->s, "s" ); - sfree(control->error_ptr, workspace->t, "t" ); - sfree(control->error_ptr, workspace->b, "b" ); - sfree(control->error_ptr, workspace->x, "x" ); - - /* GMRES storage */ - for (i = 0; i < RESTART+1; ++i) { - sfree(control->error_ptr, workspace->h[i], "h[i]" ); - sfree(control->error_ptr, workspace->v[i], "v[i]" ); - } - sfree(control->error_ptr, workspace->h, "h" ); - sfree(control->error_ptr, workspace->v, "v" ); - sfree(control->error_ptr, workspace->y, "y" ); - sfree(control->error_ptr, workspace->z, "z" ); - sfree(control->error_ptr, workspace->g, "g" ); - sfree(control->error_ptr, workspace->hs, "hs" ); - sfree(control->error_ptr, workspace->hc, "hc" ); - /* CG storage */ - sfree(control->error_ptr, workspace->r, "r" ); - sfree(control->error_ptr, workspace->d, "d" ); - sfree(control->error_ptr, workspace->q, "q" ); - sfree(control->error_ptr, workspace->p, "p" ); - sfree(control->error_ptr, workspace->r2, "r2" ); - sfree(control->error_ptr, workspace->d2, "d2" ); - sfree(control->error_ptr, workspace->q2, "q2" ); - sfree(control->error_ptr, workspace->p2, "p2" ); - /* force related storage */ sfree(control->error_ptr, workspace->f, "f" ); sfree(control->error_ptr, workspace->CdDelta, "CdDelta" ); @@ -181,10 +146,9 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) #endif } - void Allocate_Workspace( control_params *control, storage *workspace, int total_cap) { - int i, total_real, total_rvec; + int total_real, total_rvec; workspace->allocated = 1; total_real = total_cap * sizeof(double); @@ -212,42 +176,6 @@ void Allocate_Workspace( control_params *control, storage *workspace, int total_ workspace->bond_mark = (int*) scalloc(control->error_ptr, total_cap, sizeof(int), "bond_mark"); - /* QEq storage */ - workspace->Hdia_inv = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "Hdia_inv"); - workspace->b_s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_s"); - workspace->b_t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_t"); - workspace->b_prc = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prc"); - workspace->b_prm = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prm"); - workspace->s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "s"); - workspace->t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "t"); - workspace->b = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "b"); - workspace->x = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "x"); - - /* GMRES storage */ - workspace->y = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "y"); - workspace->z = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "z"); - workspace->g = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "g"); - workspace->h = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "h"); - workspace->hs = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hs"); - workspace->hc = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hc"); - workspace->v = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "v"); - - for (i = 0; i < RESTART+1; ++i) { - workspace->h[i] = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "h[i]"); - workspace->v[i] = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "v[i]"); - } - - /* CG storage */ - workspace->r = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "r"); - workspace->d = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "d"); - workspace->q = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "q"); - workspace->p = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "p"); - workspace->r2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "r2"); - workspace->d2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "d2"); - workspace->q2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "q2"); - workspace->p2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "p2"); - /* force related storage */ workspace->f = (rvec*) scalloc(control->error_ptr, total_cap, sizeof(rvec), "f"); workspace->CdDelta = (double*) diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h index 6df4460fb9..5f1fc0fd6f 100644 --- a/src/USER-REAXC/reaxc_defs.h +++ b/src/USER-REAXC/reaxc_defs.h @@ -89,8 +89,6 @@ #define MASTER_NODE 0 -#define RESTART 30 - #define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ #define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index cd9b1be9c9..66516d52a0 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -39,40 +39,6 @@ namespace LAMMPS_NS { class Pair; } -#if defined LMP_USER_OMP -#define OMP_TIMING 0 - -#ifdef OMP_TIMING -// pkcoff timing fields -enum { - COMPUTEINDEX=0, - COMPUTEWLINDEX, - COMPUTEBFINDEX, - COMPUTEQEQINDEX, - COMPUTENBFINDEX, - COMPUTEIFINDEX, - COMPUTETFINDEX, - COMPUTEBOINDEX, - COMPUTEBONDSINDEX, - COMPUTEATOMENERGYINDEX, - COMPUTEVALENCEANGLESBOINDEX, - COMPUTETORSIONANGLESBOINDEX, - COMPUTEHBONDSINDEX, - COMPUTECG1INDEX, - COMPUTECG2INDEX, - COMPUTECGCOMPUTEINDEX, - COMPUTECALCQINDEX, - COMPUTEINITMVINDEX, - COMPUTEMVCOMPINDEX, - LASTTIMINGINDEX -}; - -extern double ompTimingData[LASTTIMINGINDEX]; -extern int ompTimingCount[LASTTIMINGINDEX]; -extern int ompTimingCGCount[LASTTIMINGINDEX]; -#endif -#endif - /************* SOME DEFS - crucial for reax_types.h *********/ #define REAX_MAX_STR 1024 @@ -403,18 +369,6 @@ struct storage rvec *dDeltap_self; int *bond_mark; - /* QEq storage */ - sparse_matrix *H, *L, *U; - double *Hdia_inv, *b_s, *b_t, *b_prc, *b_prm, *s, *t; - rvec2 *b, *x; - - /* GMRES storage */ - double *y, *z, *g; - double *hc, *hs; - double **h, **v; - /* CG storage */ - double *r, *d, *q, *p; - rvec2 *r2, *d2, *q2, *p2; /* Taper */ double Tap[8]; //Tap7, Tap6, Tap5, Tap4, Tap3, Tap2, Tap1, Tap0; diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index eef3aaca4b..544e67fbf2 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -280,15 +280,6 @@ namespace ReaxFF rvec dvec; }; - namespace ReaxFF { - struct far_neighbor_data { - int nbr; - ivec rel_box; - double d; - rvec dvec; - }; - } - struct hbond_data { int nbr; int scl; @@ -320,7 +311,6 @@ namespace ReaxFF int sym_index; int dbond_index; ivec rel_box; - // rvec ext_factor; double d; rvec dvec; bond_order_data bo_data; @@ -358,14 +348,6 @@ namespace ReaxFF rvec *dDeltap_self; int *bond_mark; - /* QEq storage */ - sparse_matrix *H, *L, *U; - double *Hdia_inv, *b_s, *b_t, *b_prc, *b_prm, *s, *t; - rvec2 *b, *x; - - /* CG storage */ - double *r, *d, *q, *p; - rvec2 *r2, *d2, *q2, *p2; /* Taper */ double Tap[8]; //Tap7, Tap6, Tap5, Tap4, Tap3, Tap2, Tap1, Tap0; From 81458fe132958c8a93b4228b9bc464b2f7d88660 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Apr 2021 16:59:49 -0400 Subject: [PATCH 027/119] convert control file reader to ReaxFF namespace --- src/USER-REAXC/reaxc_control.cpp | 188 +++++++++++++++---------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index fe238ddb3c..aacb043600 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -24,9 +24,7 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_control.h" -#include "reaxc_defs.h" -#include "reaxc_tool_box.h" +#include "reaxff_api.h" #include "error.h" #include "utils.h" @@ -42,107 +40,109 @@ using LAMMPS_NS::utils::sfgets; using LAMMPS_NS::utils::logmesg; using LAMMPS_NS::ValueTokenizer; -static std::unordered_set ignored_keywords = { - "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", - "restart_format", "restart_freq", "reposition_atoms", - "restrict_bonds", "remove_CoM_vel", "debug_level", "reneighbor", - "vlist_buffer", "ghost_cutoff", "qeq_freq", "q_err", "ilu_refactor", - "ilu_droptol", "temp_init", "temp_final", "t_mass", "t_mode", "t_rate", - "t_freq", "pressure", "p_mass", "pt_mass", "compress", "press_mode", - "geo_format", "traj_compress", "traj_method", "molecular_analysis", - "ignore", "dipole_anal", "freq_dipole_anal", "diffusion_coef", - "freq_diffusion_coef", "restrict_type" -}; +namespace ReaxFF { + static std::unordered_set ignored_keywords = { + "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", + "restart_format", "restart_freq", "reposition_atoms", + "restrict_bonds", "remove_CoM_vel", "debug_level", "reneighbor", + "vlist_buffer", "ghost_cutoff", "qeq_freq", "q_err", "ilu_refactor", + "ilu_droptol", "temp_init", "temp_final", "t_mass", "t_mode", "t_rate", + "t_freq", "pressure", "p_mass", "pt_mass", "compress", "press_mode", + "geo_format", "traj_compress", "traj_method", "molecular_analysis", + "ignore", "dipole_anal", "freq_dipole_anal", "diffusion_coef", + "freq_diffusion_coef", "restrict_type" + }; -class parser_error : public std::exception { - std::string message; -public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } -}; + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; -void Read_Control_File(const char *control_file, control_params *control, - output_controls *out_control) -{ - FILE *fp; - char line[MAX_LINE]; - auto error = control->error_ptr; - auto lmp = control->lmp_ptr; + void Read_Control_File(const char *control_file, control_params *control, + output_controls *out_control) + { + FILE *fp; + char line[MAX_LINE]; + auto error = control->error_ptr; + auto lmp = control->lmp_ptr; - /* open control file */ - fp = fopen(control_file, "r"); - if (!fp) - error->one(FLERR,fmt::format("The control file {} cannot be opened: {}", - control_file, getsyserror())); - /* assign default values */ - strcpy(control->sim_name, "simulate"); - control->nthreads = 1; - control->tabulate = 0; - control->virial = 0; - control->bond_cut = 5.0; - control->bg_cut = 0.3; - control->thb_cut = 0.001; - control->thb_cutsq = 0.00001; - control->hbond_cut = 7.5; + /* open control file */ + fp = fopen(control_file, "r"); + if (!fp) + error->one(FLERR,fmt::format("The control file {} cannot be opened: {}", + control_file, getsyserror())); + /* assign default values */ + strcpy(control->sim_name, "simulate"); + control->nthreads = 1; + control->tabulate = 0; + control->virial = 0; + control->bond_cut = 5.0; + control->bg_cut = 0.3; + control->thb_cut = 0.001; + control->thb_cutsq = 0.00001; + control->hbond_cut = 7.5; - out_control->write_steps = 0; - out_control->energy_update_freq = 0; - strcpy(out_control->traj_title, "default_title"); - out_control->atom_info = 0; - out_control->bond_info = 0; - out_control->angle_info = 0; + out_control->write_steps = 0; + out_control->energy_update_freq = 0; + strcpy(out_control->traj_title, "default_title"); + out_control->atom_info = 0; + out_control->bond_info = 0; + out_control->angle_info = 0; - /* read control parameters file */ - while (fgets(line, MAX_LINE, fp)) { - ValueTokenizer values(line); + /* read control parameters file */ + while (fgets(line, MAX_LINE, fp)) { + ValueTokenizer values(line); - // empty line - if (values.count() == 0) continue; + // empty line + if (values.count() == 0) continue; - try { - auto keyword = values.next_string(); + try { + auto keyword = values.next_string(); - if (!values.has_next()) - throw parser_error(fmt::format("No value(s) for control parameter: {}\n",keyword)); + if (!values.has_next()) + throw parser_error(fmt::format("No value(s) for control parameter: {}\n",keyword)); - if (ignored_keywords.find(keyword) != ignored_keywords.end()) { - logmesg(lmp,fmt::format("Ignoring inactive control parameter: {}\n",keyword)); - } else if (keyword == "simulation_name") { - strcpy(control->sim_name, values.next_string().c_str()); - } else if (keyword == "energy_update_freq") { - out_control->energy_update_freq = values.next_int(); - } else if (keyword == "nbrhood_cutoff") { - control->bond_cut = values.next_double(); - } else if (keyword == "bond_graph_cutoff") { - control->bg_cut = values.next_double(); - } else if (keyword == "thb_cutoff") { - control->thb_cut = values.next_double(); - } else if (keyword == "thb_cutoff_sq") { - control->thb_cutsq = values.next_double(); - } else if (keyword == "hbond_cutoff") { - control->hbond_cut = values.next_double(); - } else if (keyword == "tabulate_long_range") { - control->tabulate = values.next_int(); - } else if (keyword == "write_freq") { - out_control->write_steps = values.next_int(); - } else if (keyword == "traj_title") { - strcpy(out_control->traj_title, values.next_string().c_str()); - } else if (keyword == "atom_info") { - out_control->atom_info += values.next_int() * 4; - } else if (keyword == "atom_velocities") { - out_control->atom_info += values.next_int() * 2; - } else if (keyword == "atom_forces") { - out_control->atom_info += values.next_int() * 1; - } else if (keyword == "bond_info") { - out_control->bond_info = values.next_int(); - } else if (keyword == "angle_info") { - out_control->angle_info = values.next_int(); - } else { - throw parser_error(fmt::format("Unknown parameter {} in control file", keyword)); + if (ignored_keywords.find(keyword) != ignored_keywords.end()) { + logmesg(lmp,fmt::format("Ignoring inactive control parameter: {}\n",keyword)); + } else if (keyword == "simulation_name") { + strcpy(control->sim_name, values.next_string().c_str()); + } else if (keyword == "energy_update_freq") { + out_control->energy_update_freq = values.next_int(); + } else if (keyword == "nbrhood_cutoff") { + control->bond_cut = values.next_double(); + } else if (keyword == "bond_graph_cutoff") { + control->bg_cut = values.next_double(); + } else if (keyword == "thb_cutoff") { + control->thb_cut = values.next_double(); + } else if (keyword == "thb_cutoff_sq") { + control->thb_cutsq = values.next_double(); + } else if (keyword == "hbond_cutoff") { + control->hbond_cut = values.next_double(); + } else if (keyword == "tabulate_long_range") { + control->tabulate = values.next_int(); + } else if (keyword == "write_freq") { + out_control->write_steps = values.next_int(); + } else if (keyword == "traj_title") { + strcpy(out_control->traj_title, values.next_string().c_str()); + } else if (keyword == "atom_info") { + out_control->atom_info += values.next_int() * 4; + } else if (keyword == "atom_velocities") { + out_control->atom_info += values.next_int() * 2; + } else if (keyword == "atom_forces") { + out_control->atom_info += values.next_int() * 1; + } else if (keyword == "bond_info") { + out_control->bond_info = values.next_int(); + } else if (keyword == "angle_info") { + out_control->angle_info = values.next_int(); + } else { + throw parser_error(fmt::format("Unknown parameter {} in control file", keyword)); + } + } catch (std::exception &e) { + error->one(FLERR, e.what()); } - } catch (std::exception &e) { - error->one(FLERR, e.what()); } + fclose(fp); } - fclose(fp); } From 224c59384605fb94917974174f76fcb563272c31 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 02:18:35 -0400 Subject: [PATCH 028/119] convert USER-REAXC to use a ReaxFF namespace also bundle exported functions in fewer header files --- src/KOKKOS/fix_reaxc_species_kokkos.cpp | 16 +- src/USER-OMP/fix_qeq_reax_omp.cpp | 18 +- src/USER-OMP/pair_reaxc_omp.cpp | 33 +- src/USER-OMP/reaxc_bond_orders_omp.cpp | 1126 +++++++++--------- src/USER-OMP/reaxc_bond_orders_omp.h | 43 - src/USER-OMP/reaxc_bonds_omp.cpp | 238 ++-- src/USER-OMP/reaxc_bonds_omp.h | 37 - src/USER-OMP/reaxc_forces_omp.cpp | 759 ++++++------ src/USER-OMP/reaxc_forces_omp.h | 38 - src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 322 +++-- src/USER-OMP/reaxc_hydrogen_bonds_omp.h | 37 - src/USER-OMP/reaxc_init_md_omp.cpp | 163 ++- src/USER-OMP/reaxc_init_md_omp.h | 38 - src/USER-OMP/reaxc_multi_body_omp.cpp | 408 ++++--- src/USER-OMP/reaxc_multi_body_omp.h | 37 - src/USER-OMP/reaxc_nonbonded_omp.cpp | 563 +++++---- src/USER-OMP/reaxc_nonbonded_omp.h | 40 - src/USER-OMP/reaxc_torsion_angles_omp.cpp | 671 +++++------ src/USER-OMP/reaxc_torsion_angles_omp.h | 38 - src/USER-OMP/reaxc_valence_angles_omp.cpp | 872 +++++++------- src/USER-OMP/reaxc_valence_angles_omp.h | 39 - src/USER-OMP/reaxff_omp.h | 95 +- src/USER-REAXC/fix_reaxc_species.cpp | 6 +- src/USER-REAXC/pair_reaxc.cpp | 5 +- src/USER-REAXC/reaxc_allocate.cpp | 534 ++++----- src/USER-REAXC/reaxc_allocate.h | 41 - src/USER-REAXC/reaxc_bond_orders.cpp | 964 ++++++++------- src/USER-REAXC/reaxc_bond_orders.h | 45 - src/USER-REAXC/reaxc_bonds.cpp | 181 +-- src/USER-REAXC/reaxc_bonds.h | 34 - src/USER-REAXC/reaxc_control.h | 34 - src/USER-REAXC/reaxc_defs.h | 105 -- src/USER-REAXC/reaxc_ffield.cpp | 1295 +++++++++++---------- src/USER-REAXC/reaxc_ffield.h | 34 - src/USER-REAXC/reaxc_forces.cpp | 667 +++++------ src/USER-REAXC/reaxc_forces.h | 40 - src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 254 ++-- src/USER-REAXC/reaxc_hydrogen_bonds.h | 35 - src/USER-REAXC/reaxc_init_md.cpp | 295 +++-- src/USER-REAXC/reaxc_init_md.h | 35 - src/USER-REAXC/reaxc_io_tools.cpp | 99 +- src/USER-REAXC/reaxc_io_tools.h | 37 - src/USER-REAXC/reaxc_list.cpp | 193 ++- src/USER-REAXC/reaxc_list.h | 66 -- src/USER-REAXC/reaxc_lookup.cpp | 444 ++++--- src/USER-REAXC/reaxc_lookup.h | 47 - src/USER-REAXC/reaxc_multi_body.cpp | 31 +- src/USER-REAXC/reaxc_multi_body.h | 35 - src/USER-REAXC/reaxc_nonbonded.cpp | 676 ++++++----- src/USER-REAXC/reaxc_nonbonded.h | 43 - src/USER-REAXC/reaxc_reset_tools.cpp | 215 ++-- src/USER-REAXC/reaxc_reset_tools.h | 39 - src/USER-REAXC/reaxc_system_props.cpp | 66 -- src/USER-REAXC/reaxc_system_props.h | 35 - src/USER-REAXC/reaxc_tool_box.cpp | 153 +-- src/USER-REAXC/reaxc_tool_box.h | 40 - src/USER-REAXC/reaxc_torsion_angles.cpp | 831 +++++++------ src/USER-REAXC/reaxc_torsion_angles.h | 35 - src/USER-REAXC/reaxc_traj.cpp | 937 ++++++++------- src/USER-REAXC/reaxc_traj.h | 38 - src/USER-REAXC/reaxc_types.h | 513 -------- src/USER-REAXC/reaxc_valence_angles.cpp | 614 +++++----- src/USER-REAXC/reaxc_valence_angles.h | 39 - src/USER-REAXC/reaxc_vector.cpp | 130 --- src/USER-REAXC/reaxc_vector.h | 50 - src/USER-REAXC/reaxff_api.h | 104 +- src/USER-REAXC/reaxff_defs.h | 1 - src/USER-REAXC/reaxff_types.h | 13 +- 68 files changed, 6766 insertions(+), 8993 deletions(-) delete mode 100644 src/USER-OMP/reaxc_bond_orders_omp.h delete mode 100644 src/USER-OMP/reaxc_bonds_omp.h delete mode 100644 src/USER-OMP/reaxc_forces_omp.h delete mode 100644 src/USER-OMP/reaxc_hydrogen_bonds_omp.h delete mode 100644 src/USER-OMP/reaxc_init_md_omp.h delete mode 100644 src/USER-OMP/reaxc_multi_body_omp.h delete mode 100644 src/USER-OMP/reaxc_nonbonded_omp.h delete mode 100644 src/USER-OMP/reaxc_torsion_angles_omp.h delete mode 100644 src/USER-OMP/reaxc_valence_angles_omp.h delete mode 100644 src/USER-REAXC/reaxc_allocate.h delete mode 100644 src/USER-REAXC/reaxc_bond_orders.h delete mode 100644 src/USER-REAXC/reaxc_bonds.h delete mode 100644 src/USER-REAXC/reaxc_control.h delete mode 100644 src/USER-REAXC/reaxc_defs.h delete mode 100644 src/USER-REAXC/reaxc_ffield.h delete mode 100644 src/USER-REAXC/reaxc_forces.h delete mode 100644 src/USER-REAXC/reaxc_hydrogen_bonds.h delete mode 100644 src/USER-REAXC/reaxc_init_md.h delete mode 100644 src/USER-REAXC/reaxc_io_tools.h delete mode 100644 src/USER-REAXC/reaxc_list.h delete mode 100644 src/USER-REAXC/reaxc_lookup.h delete mode 100644 src/USER-REAXC/reaxc_multi_body.h delete mode 100644 src/USER-REAXC/reaxc_nonbonded.h delete mode 100644 src/USER-REAXC/reaxc_reset_tools.h delete mode 100644 src/USER-REAXC/reaxc_system_props.cpp delete mode 100644 src/USER-REAXC/reaxc_system_props.h delete mode 100644 src/USER-REAXC/reaxc_tool_box.h delete mode 100644 src/USER-REAXC/reaxc_torsion_angles.h delete mode 100644 src/USER-REAXC/reaxc_traj.h delete mode 100644 src/USER-REAXC/reaxc_types.h delete mode 100644 src/USER-REAXC/reaxc_valence_angles.h delete mode 100644 src/USER-REAXC/reaxc_vector.cpp delete mode 100644 src/USER-REAXC/reaxc_vector.h diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxc_species_kokkos.cpp index 0a225a641d..5a0907fb07 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_species_kokkos.cpp @@ -16,18 +16,20 @@ ------------------------------------------------------------------------- */ #include "fix_reaxc_species_kokkos.h" + #include "atom.h" -#include "fix_ave_atom.h" -#include "reaxc_defs.h" -#include "pair_reaxc_kokkos.h" -#include "neigh_list.h" -#include "neigh_request.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" #include "input.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list.h" +#include "neigh_request.h" + +#include "fix_ave_atom.h" +#include "pair_reaxc_kokkos.h" +#include "reaxff_defs.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 66760b8aa3..3f09fa7353 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -33,16 +33,17 @@ #include "fix_qeq_reax_omp.h" -#include -#include "pair_reaxc.h" #include "atom.h" #include "comm.h" +#include "error.h" +#include "memory.h" #include "neigh_list.h" #include "update.h" -#include "memory.h" -#include "error.h" -#include "reaxc_defs.h" -#include "reaxc_types.h" + +#include "pair_reaxc.h" +#include "reaxff_defs.h" + +#include #if defined(_OPENMP) #include @@ -51,11 +52,6 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define EV_TO_KCAL_PER_MOL 14.4 -#define SQR(x) ((x)*(x)) -#define CUBE(x) ((x)*(x)*(x)) -#define MIN_NBRS 100 - /* ---------------------------------------------------------------------- */ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index ac1ddd17a6..5693bef5e6 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -197,7 +197,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) setup(); - Reset( api->system, api->control, api->data, api->workspace, &api->lists ); + Reset(api->system, api->control, api->data, api->workspace, &api->lists); // Why not update workspace like in MPI-only code? // Using the MPI-only way messes up the hb energy @@ -270,7 +270,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) api->data->step = update->ntimestep; - Output_Results( api->system, api->control, api->data, &api->lists, api->out_control, world ); + Output_Results(api->system, api->control, api->data, &api->lists, api->out_control, world); // populate tmpid and tmpbo arrays for fix reax/c/species @@ -298,7 +298,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::init_style( ) +void PairReaxCOMP::init_style() { if (!atom->q_flag) error->all(FLERR,"Pair reax/c/omp requires atom attribute q"); @@ -354,7 +354,7 @@ void PairReaxCOMP::init_style( ) /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::setup( ) +void PairReaxCOMP::setup() { int oldN; int mincap = api->system->mincap; @@ -380,12 +380,12 @@ void PairReaxCOMP::setup( ) // determine the local and total capacity - api->system->local_cap = MAX( (int)(api->system->n * safezone), mincap ); - api->system->total_cap = MAX( (int)(api->system->N * safezone), mincap ); + api->system->local_cap = MAX((int)(api->system->n * safezone), mincap); + api->system->total_cap = MAX((int)(api->system->N * safezone), mincap); // initialize my data structures - PreAllocate_Space( api->system, api->control, api->workspace ); + PreAllocate_Space(api->system, api->workspace); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); @@ -395,7 +395,8 @@ void PairReaxCOMP::setup( ) write_reax_lists(); - InitializeOMP(api->system, api->control, api->data, api->workspace, &api->lists, api->out_control, world); + InitializeOMP(api->system, api->control, api->data, api->workspace, + &api->lists, api->out_control, world); for (int k = 0; k < api->system->N; ++k) { num_bonds[k] = api->system->my_atoms[k].num_bonds; @@ -411,7 +412,7 @@ void PairReaxCOMP::setup( ) // reset the bond list info for new atoms for (int k = oldN; k < api->system->N; ++k) - Set_End_Index( k, Start_Index( k, api->lists+BONDS ), api->lists+BONDS ); + Set_End_Index(k, Start_Index(k, api->lists+BONDS), api->lists+BONDS); // estimate far neighbor list size // Not present in MPI-only version @@ -419,7 +420,7 @@ void PairReaxCOMP::setup( ) // check if I need to shrink/extend my data-structs - ReAllocate( api->system, api->control, api->data, api->workspace, &api->lists ); + ReAllocate(api->system, api->control, api->data, api->workspace, &api->lists); } } @@ -522,7 +523,7 @@ int PairReaxCOMP::write_reax_lists() for (itr_i = 0; itr_i < numall; ++itr_i) { i = ilist[itr_i]; jlist = firstneigh[i]; - Set_Start_Index( i, num_nbrs_offset[i], far_nbrs ); + Set_Start_Index(i, num_nbrs_offset[i], far_nbrs); if (i < inum) cutoff_sqr = SQR(api->control->nonb_cut); @@ -534,15 +535,15 @@ int PairReaxCOMP::write_reax_lists() for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) { j = jlist[itr_j]; j &= NEIGHMASK; - get_distance( x[j], x[i], &d_sqr, &dvec ); + get_distance(x[j], x[i], &d_sqr, &dvec); if (d_sqr <= cutoff_sqr) { - dist = sqrt( d_sqr ); - set_far_nbr(&far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); + dist = sqrt(d_sqr); + set_far_nbr(&far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec); ++num_mynbrs; } } - Set_End_Index( i, num_nbrs_offset[i] + num_mynbrs, far_nbrs ); + Set_End_Index(i, num_nbrs_offset[i] + num_mynbrs, far_nbrs); } #ifdef OMP_TIMING @@ -587,7 +588,7 @@ void PairReaxCOMP::FindBond() nj = 0; for (pj = Start_Index(i, api->lists); pj < End_Index(i, api->lists); ++pj) { - bo_ij = &( api->lists->select.bond_list[pj] ); + bo_ij = &(api->lists->select.bond_list[pj]); j = bo_ij->nbr; if (j < i) continue; diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index a2abb60f27..745290fa37 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -26,692 +26,622 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_bond_orders_omp.h" -#include "reaxc_bond_orders.h" +#include "reaxff_omp.h" #include "fix_omp.h" -#include "reaxc_defs.h" #include "pair_reaxc_omp.h" -#include "reaxc_types.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" -#include #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; -void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) { - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - int pk, k, j; +namespace ReaxFF { + void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, + storage *workspace, reax_list **lists) { + reax_list *bonds = (*lists) + BONDS; + bond_data *nbr_j, *nbr_k; + bond_order_data *bo_ij, *bo_ji; + dbond_coefficients coef; + int pk, k, j; - PairReaxCOMP *pair_reax_ptr = static_cast(system->pair_ptr); + PairReaxCOMP *pair_reax_ptr = static_cast(system->pair_ptr); -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - long reductionOffset = (system->N * tid); + int tid = get_tid(); + ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + long reductionOffset = (system->N * tid); - /* Virial Tallying variables */ - rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; + /* Virial Tallying variables */ + rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + /* Initializations */ + nbr_j = &(bonds->select.bond_list[pj]); + j = nbr_j->nbr; + bo_ij = &(nbr_j->bo_data); + bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); - double c = bo_ij->Cdbo + bo_ji->Cdbo; - coef.C1dbo = bo_ij->C1dbo * c; - coef.C2dbo = bo_ij->C2dbo * c; - coef.C3dbo = bo_ij->C3dbo * c; + double c = bo_ij->Cdbo + bo_ji->Cdbo; + coef.C1dbo = bo_ij->C1dbo * c; + coef.C2dbo = bo_ij->C2dbo * c; + coef.C3dbo = bo_ij->C3dbo * c; - c = bo_ij->Cdbopi + bo_ji->Cdbopi; - coef.C1dbopi = bo_ij->C1dbopi * c; - coef.C2dbopi = bo_ij->C2dbopi * c; - coef.C3dbopi = bo_ij->C3dbopi * c; - coef.C4dbopi = bo_ij->C4dbopi * c; + c = bo_ij->Cdbopi + bo_ji->Cdbopi; + coef.C1dbopi = bo_ij->C1dbopi * c; + coef.C2dbopi = bo_ij->C2dbopi * c; + coef.C3dbopi = bo_ij->C3dbopi * c; + coef.C4dbopi = bo_ij->C4dbopi * c; - c = bo_ij->Cdbopi2 + bo_ji->Cdbopi2; - coef.C1dbopi2 = bo_ij->C1dbopi2 * c; - coef.C2dbopi2 = bo_ij->C2dbopi2 * c; - coef.C3dbopi2 = bo_ij->C3dbopi2 * c; - coef.C4dbopi2 = bo_ij->C4dbopi2 * c; + c = bo_ij->Cdbopi2 + bo_ji->Cdbopi2; + coef.C1dbopi2 = bo_ij->C1dbopi2 * c; + coef.C2dbopi2 = bo_ij->C2dbopi2 * c; + coef.C3dbopi2 = bo_ij->C3dbopi2 * c; + coef.C4dbopi2 = bo_ij->C4dbopi2 * c; - c = workspace->CdDelta[i] + workspace->CdDelta[j]; - coef.C1dDelta = bo_ij->C1dbo * c; - coef.C2dDelta = bo_ij->C2dbo * c; - coef.C3dDelta = bo_ij->C3dbo * c; + c = workspace->CdDelta[i] + workspace->CdDelta[j]; + coef.C1dDelta = bo_ij->C1dbo * c; + coef.C2dDelta = bo_ij->C2dbo * c; + coef.C3dDelta = bo_ij->C3dbo * c; - // The same "c" refactoring here can be replicated below in Add_dBond_to_Forces_NPTOMP(), but - // I'd prefer to wait for a test to verify changes before doing so (just to be safe). + c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp ); - // forces on i - // rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); - // rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] ); - // rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); - // rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]); - // rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - // rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] ); + c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_ScaledAdd( temp, c, workspace->dDeltap_self[i] ); - c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); + rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); - rvec_ScaledAdd( temp, c, workspace->dDeltap_self[i] ); - - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - - rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fi_tmp, -1.0, temp); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, - fi_tmp[0],fi_tmp[1],fi_tmp[2], - delij[0],delij[1],delij[2],thr); - } - - // forces on j - // rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); - // rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]); - // rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); - // rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]); - // rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - // rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); - // rvec_ScaledAdd( temp, coef.C4dbopi2, workspace->dDeltap_self[j]); - - - c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp ); - - c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); - rvec_ScaledAdd( temp, c, workspace->dDeltap_self[j] ); - - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - - - rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fj_tmp, -1.0, temp); - rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, - fj_tmp[0],fj_tmp[1],fj_tmp[2], - delji[0],delji[1],delji[2],thr); - } - - // forces on k: i neighbor - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); - - const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); - rvec_Scale(temp, c, nbr_k->bo_data.dBOp); - - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + rvec_Scale(fi_tmp, -1.0, temp); + rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, + fi_tmp[0],fi_tmp[1],fi_tmp[2], + delij[0],delij[1],delij[2],thr); + } - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); + c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp ); + + c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_ScaledAdd( temp, c, workspace->dDeltap_self[j] ); + + rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); + rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); + + + rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fj_tmp, -1.0, temp); + rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, + fj_tmp[0],fj_tmp[1],fj_tmp[2], + delji[0],delji[1],delji[2],thr); + } + + // forces on k: i neighbor + for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); + + const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + + rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delki[0],delki[1],delki[2],thr); + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delkj[0],delkj[1],delkj[2],thr); + } + } + + // forces on k: j neighbor + for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); + // rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + + const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + + rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delki[0],delki[1],delki[2],thr); + + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delkj[0],delkj[1],delkj[2],thr); + } } } - // forces on k: j neighbor - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; +/* ---------------------------------------------------------------------- */ - // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); - // rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + void Add_dBond_to_Forces_NPTOMP(reax_system *system, int i, int pj, + storage *workspace, reax_list **lists) { + reax_list *bonds = (*lists) + BONDS; + bond_data *nbr_j, *nbr_k; + bond_order_data *bo_ij, *bo_ji; + dbond_coefficients coef; + rvec temp; + int pk, k, j; - const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); - rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + int tid = get_tid(); + long reductionOffset = (system->N * tid); - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + /* Initializations */ + nbr_j = &(bonds->select.bond_list[pj]); + j = nbr_j->nbr; + bo_ij = &(nbr_j->bo_data); + bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); + coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); + coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + + + /************************************ + * forces related to atom i * + * first neighbors of atom i * + ************************************/ + for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ + rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ + rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ + + /* force */ + rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); } - } -} -/* ---------------------------------------------------------------------- */ + /* then atom i itself */ + rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ + rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ + rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ + rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ + rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ + rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ + rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ -void Add_dBond_to_Forces_NPTOMP(reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) { - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - rvec temp; - int pk, k, j; - -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - long reductionOffset = (system->N * tid); - - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); - - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - - - /************************************ - * forces related to atom i * - * first neighbors of atom i * - ************************************/ - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ - rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ + rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ + rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ + rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); - } + rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); - /* then atom i itself */ - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ + for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ + rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ + rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ + rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); + /* force */ + rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + } - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; + /* then atom j itself */ + rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ + rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ + rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ + rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ + rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ + rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ + rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + + rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ + rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ + rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); } - /* then atom j itself */ - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ +/* ---------------------------------------------------------------------- */ - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + int BOp_OMP( storage * /* workspace */, reax_list *bonds, double bo_cut, + int i, int btop_i, far_neighbor_data *nbr_pj, + single_body_parameters * /* sbp_i */, single_body_parameters * /* sbp_j */, + two_body_parameters *twbp, + int btop_j, double C12, double C34, double C56, double BO, double BO_s, double BO_pi, double BO_pi2) { + int j; + double rr2; + double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; + bond_data *ibond, *jbond; + bond_order_data *bo_ij, *bo_ji; - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ - rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ + j = nbr_pj->nbr; + rr2 = 1.0 / SQR(nbr_pj->d); - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); -} + // Top portion of BOp() moved to reaxc_forces_omp.cpp::Init_Forces_noQEq_OMP() + + /* Initially BO values are the uncorrected ones, page 1 */ + + /****** bonds i-j and j-i ******/ + ibond = &( bonds->select.bond_list[btop_i] ); + jbond = &( bonds->select.bond_list[btop_j] ); + + ibond->nbr = j; + jbond->nbr = i; + ibond->d = nbr_pj->d; + jbond->d = nbr_pj->d; + rvec_Copy( ibond->dvec, nbr_pj->dvec ); + rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); + ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); + ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); + ibond->dbond_index = btop_i; + jbond->dbond_index = btop_i; + ibond->sym_index = btop_j; + jbond->sym_index = btop_i; + + bo_ij = &( ibond->bo_data ); + bo_ji = &( jbond->bo_data ); + bo_ji->BO = bo_ij->BO = BO; + bo_ji->BO_s = bo_ij->BO_s = BO_s; + bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; + bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; + + /* Bond Order page2-3, derivative of total bond order prime */ + Cln_BOp_s = twbp->p_bo2 * C12 * rr2; + Cln_BOp_pi = twbp->p_bo4 * C34 * rr2; + Cln_BOp_pi2 = twbp->p_bo6 * C56 * rr2; + + /* Only dln_BOp_xx wrt. dr_i is stored here, note that + dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ + rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec); + rvec_Scale(bo_ij->dln_BOp_pi,-bo_ij->BO_pi*Cln_BOp_pi,ibond->dvec); + rvec_Scale(bo_ij->dln_BOp_pi2, + -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); + rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); + rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); + rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); + + rvec_Scale( bo_ij->dBOp, + -(bo_ij->BO_s * Cln_BOp_s + + bo_ij->BO_pi * Cln_BOp_pi + + bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); + rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); + + bo_ij->BO_s -= bo_cut; + bo_ij->BO -= bo_cut; + bo_ji->BO_s -= bo_cut; + bo_ji->BO -= bo_cut; + + bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0; + bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0; + + return 1; + } /* ---------------------------------------------------------------------- */ -int BOp_OMP( storage * /* workspace */, reax_list *bonds, double bo_cut, - int i, int btop_i, far_neighbor_data *nbr_pj, - single_body_parameters * /* sbp_i */, single_body_parameters * /* sbp_j */, - two_body_parameters *twbp, - int btop_j, double C12, double C34, double C56, double BO, double BO_s, double BO_pi, double BO_pi2) { - int j; - double rr2; - double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; - bond_data *ibond, *jbond; - bond_order_data *bo_ij, *bo_ji; - - j = nbr_pj->nbr; - rr2 = 1.0 / SQR(nbr_pj->d); - - // Top portion of BOp() moved to reaxc_forces_omp.cpp::Init_Forces_noQEq_OMP() - - /* Initially BO values are the uncorrected ones, page 1 */ - - /****** bonds i-j and j-i ******/ - ibond = &( bonds->select.bond_list[btop_i] ); - jbond = &( bonds->select.bond_list[btop_j] ); - - ibond->nbr = j; - jbond->nbr = i; - ibond->d = nbr_pj->d; - jbond->d = nbr_pj->d; - rvec_Copy( ibond->dvec, nbr_pj->dvec ); - rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); - ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); - ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); - ibond->dbond_index = btop_i; - jbond->dbond_index = btop_i; - ibond->sym_index = btop_j; - jbond->sym_index = btop_i; - - bo_ij = &( ibond->bo_data ); - bo_ji = &( jbond->bo_data ); - bo_ji->BO = bo_ij->BO = BO; - bo_ji->BO_s = bo_ij->BO_s = BO_s; - bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; - bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; - - /* Bond Order page2-3, derivative of total bond order prime */ - Cln_BOp_s = twbp->p_bo2 * C12 * rr2; - Cln_BOp_pi = twbp->p_bo4 * C34 * rr2; - Cln_BOp_pi2 = twbp->p_bo6 * C56 * rr2; - - /* Only dln_BOp_xx wrt. dr_i is stored here, note that - dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ - rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec); - rvec_Scale(bo_ij->dln_BOp_pi,-bo_ij->BO_pi*Cln_BOp_pi,ibond->dvec); - rvec_Scale(bo_ij->dln_BOp_pi2, - -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); - rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); - rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); - rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); - - rvec_Scale( bo_ij->dBOp, - -(bo_ij->BO_s * Cln_BOp_s + - bo_ij->BO_pi * Cln_BOp_pi + - bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); - rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); - - bo_ij->BO_s -= bo_cut; - bo_ij->BO -= bo_cut; - bo_ji->BO_s -= bo_cut; - bo_ji->BO -= bo_cut; - - bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0; - bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0; - - return 1; -} - -/* ---------------------------------------------------------------------- */ - -void BOOMP( reax_system *system, control_params * /* control */, simulation_data * /* data */, - storage *workspace, reax_list **lists, output_controls * /* out_control */) -{ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - double p_lp1 = system->reax_param.gp.l[15]; - double p_boc1 = system->reax_param.gp.l[0]; - double p_boc2 = system->reax_param.gp.l[1]; - reax_list *bonds = (*lists) + BONDS; + void BOOMP( reax_system *system, control_params * /* control */, simulation_data * /* data */, + storage *workspace, reax_list **lists, output_controls * /* out_control */) + { + double p_lp1 = system->reax_param.gp.l[15]; + double p_boc1 = system->reax_param.gp.l[0]; + double p_boc2 = system->reax_param.gp.l[1]; + reax_list *bonds = (*lists) + BONDS; #if defined(_OPENMP) #pragma omp parallel default(shared) #endif - { - int i, j, pj, type_i, type_j; - int start_i, end_i, sym_index; - double val_i, Deltap_i, Deltap_boc_i; - double val_j, Deltap_j, Deltap_boc_j; - double f1, f2, f3, f4, f5, f4f5, exp_f4, exp_f5; - double exp_p1i, exp_p2i, exp_p1j, exp_p2j, explp1; - double temp, u1_ij, u1_ji, Cf1A_ij, Cf1B_ij, Cf1_ij, Cf1_ji; - double Cf45_ij, Cf45_ji; //u_ij, u_ji - double A0_ij, A1_ij, A2_ij, A2_ji, A3_ij, A3_ji; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - bond_order_data *bo_ij, *bo_ji; + { + int i, j, pj, type_i, type_j; + int start_i, end_i, sym_index; + double val_i, Deltap_i, Deltap_boc_i; + double val_j, Deltap_j, Deltap_boc_j; + double f1, f2, f3, f4, f5, f4f5, exp_f4, exp_f5; + double exp_p1i, exp_p2i, exp_p1j, exp_p2j, explp1; + double temp, u1_ij, u1_ji, Cf1A_ij, Cf1B_ij, Cf1_ij, Cf1_ji; + double Cf45_ij, Cf45_ji; //u_ij, u_ji + double A0_ij, A1_ij, A2_ij, A2_ji, A3_ij, A3_ji; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + bond_order_data *bo_ij, *bo_ji; - /* Calculate Deltaprime, Deltaprime_boc values */ + /* Calculate Deltaprime, Deltaprime_boc values */ #if defined(_OPENMP) #pragma omp for schedule(static) #endif - for (i = 0; i < system->N; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[type_i]); - workspace->Deltap[i] = workspace->total_bond_order[i] - sbp_i->valency; - workspace->Deltap_boc[i] = - workspace->total_bond_order[i] - sbp_i->valency_val; + for (i = 0; i < system->N; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[type_i]); + workspace->Deltap[i] = workspace->total_bond_order[i] - sbp_i->valency; + workspace->Deltap_boc[i] = + workspace->total_bond_order[i] - sbp_i->valency_val; - workspace->total_bond_order[i] = 0; - } - - // Wait till initialization complete -#if defined(_OPENMP) -#pragma omp barrier -#endif - - /* Corrected Bond Order calculations */ -#if defined(_OPENMP) -#pragma omp for schedule(guided) -#endif - for (i = 0; i < system->N; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[type_i]); - val_i = sbp_i->valency; - Deltap_i = workspace->Deltap[i]; - Deltap_boc_i = workspace->Deltap_boc[i]; - start_i = Start_Index(i, bonds); - end_i = End_Index(i, bonds); - - for (pj = start_i; pj < end_i; ++pj) { - j = bonds->select.bond_list[pj].nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - bo_ij = &( bonds->select.bond_list[pj].bo_data ); - - if (i < j || workspace->bond_mark[j] > 3) { - twbp = &( system->reax_param.tbp[type_i][type_j] ); - - if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { - bo_ij->C1dbo = 1.000000; - bo_ij->C2dbo = 0.000000; - bo_ij->C3dbo = 0.000000; - - bo_ij->C1dbopi = 1.000000; - bo_ij->C2dbopi = 0.000000; - bo_ij->C3dbopi = 0.000000; - bo_ij->C4dbopi = 0.000000; - - bo_ij->C1dbopi2 = 1.000000; - bo_ij->C2dbopi2 = 0.000000; - bo_ij->C3dbopi2 = 0.000000; - bo_ij->C4dbopi2 = 0.000000; - - } - else { - val_j = system->reax_param.sbp[type_j].valency; - Deltap_j = workspace->Deltap[j]; - Deltap_boc_j = workspace->Deltap_boc[j]; - - /* on page 1 */ - if (twbp->ovc >= 0.001) { - /* Correction for overcoordination */ - exp_p1i = exp( -p_boc1 * Deltap_i ); - exp_p2i = exp( -p_boc2 * Deltap_i ); - exp_p1j = exp( -p_boc1 * Deltap_j ); - exp_p2j = exp( -p_boc2 * Deltap_j ); - - f2 = exp_p1i + exp_p1j; - f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); - f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + - ( val_j + f2 )/( val_j + f2 + f3 ) ); - - /* Now come the derivates */ - /* Bond Order pages 5-7, derivative of f1 */ - temp = f2 + f3; - u1_ij = val_i + temp; - u1_ji = val_j + temp; - Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + - 1.0 / SQR( u1_ji )); - Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + - ( u1_ji - f3 ) / SQR( u1_ji )); - - Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - - ((val_i+f2) / SQR(u1_ij)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) ) + - -p_boc1 * exp_p1i / u1_ji - - ((val_j+f2) / SQR(u1_ji)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) )); - - - Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + - Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); - } - else { - /* No overcoordination correction! */ - f1 = 1.0; - Cf1_ij = Cf1_ji = 0.0; - } - - if (twbp->v13cor >= 0.001) { - /* Correction for 1-3 bond orders */ - exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - - Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); - exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - - Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); - - f4 = 1. / (1. + exp_f4); - f5 = 1. / (1. + exp_f5); - f4f5 = f4 * f5; - - /* Bond Order pages 8-9, derivative of f4 and f5 */ - Cf45_ij = -f4 * exp_f4; - Cf45_ji = -f5 * exp_f5; - } - else { - f4 = f5 = f4f5 = 1.0; - Cf45_ij = Cf45_ji = 0.0; - } - - /* Bond Order page 10, derivative of total bond order */ - A0_ij = f1 * f4f5; - A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO * - (Cf45_ij + Cf45_ji); - A2_ij = Cf1_ij / f1 + twbp->p_boc3 * Cf45_ij; - A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji; - A3_ij = A2_ij + Cf1_ij / f1; - A3_ji = A2_ji + Cf1_ji / f1; - - /* find corrected bond orders and their derivative coef */ - bo_ij->BO = bo_ij->BO * A0_ij; - bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; - bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; - bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); - - bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; - bo_ij->C2dbo = bo_ij->BO * A2_ij; - bo_ij->C3dbo = bo_ij->BO * A2_ji; - - bo_ij->C1dbopi = f1*f1*f4*f5; - bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij; - bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij; - bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji; - - bo_ij->C1dbopi2 = f1*f1*f4*f5; - bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij; - bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij; - bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji; - } - - /* neglect bonds that are < 1e-10 */ - if (bo_ij->BO < 1e-10) - bo_ij->BO = 0.0; - if (bo_ij->BO_s < 1e-10) - bo_ij->BO_s = 0.0; - if (bo_ij->BO_pi < 1e-10) - bo_ij->BO_pi = 0.0; - if (bo_ij->BO_pi2 < 1e-10) - bo_ij->BO_pi2 = 0.0; - - workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO - } - // else { - // /* We only need to update bond orders from bo_ji - // everything else is set in uncorrected_bo calculations */ - // sym_index = bonds->select.bond_list[pj].sym_index; - // bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); - // bo_ij->BO = bo_ji->BO; - // bo_ij->BO_s = bo_ji->BO_s; - // bo_ij->BO_pi = bo_ji->BO_pi; - // bo_ij->BO_pi2 = bo_ji->BO_pi2; - - // workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO - // } + workspace->total_bond_order[i] = 0; } - } - - // Wait for bo_ij to be updated + // Wait till initialization complete #if defined(_OPENMP) #pragma omp barrier #endif - // Try to combine the following for-loop back into the for-loop above - /*-------------------------*/ + + /* Corrected Bond Order calculations */ #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < system->N; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - start_i = Start_Index(i, bonds); - end_i = End_Index(i, bonds); - - for (pj = start_i; pj < end_i; ++pj) { - j = bonds->select.bond_list[pj].nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - - if (i < j || workspace->bond_mark[j] > 3) { - // Computed in previous for-loop - } else { - /* We only need to update bond orders from bo_ji - everything else is set in uncorrected_bo calculations */ - sym_index = bonds->select.bond_list[pj].sym_index; + for (i = 0; i < system->N; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[type_i]); + val_i = sbp_i->valency; + Deltap_i = workspace->Deltap[i]; + Deltap_boc_i = workspace->Deltap_boc[i]; + start_i = Start_Index(i, bonds); + end_i = End_Index(i, bonds); + for (pj = start_i; pj < end_i; ++pj) { + j = bonds->select.bond_list[pj].nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; bo_ij = &( bonds->select.bond_list[pj].bo_data ); - bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); - bo_ij->BO = bo_ji->BO; - bo_ij->BO_s = bo_ji->BO_s; - bo_ij->BO_pi = bo_ji->BO_pi; - bo_ij->BO_pi2 = bo_ji->BO_pi2; - workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO + if (i < j || workspace->bond_mark[j] > 3) { + twbp = &( system->reax_param.tbp[type_i][type_j] ); + + if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { + bo_ij->C1dbo = 1.000000; + bo_ij->C2dbo = 0.000000; + bo_ij->C3dbo = 0.000000; + + bo_ij->C1dbopi = 1.000000; + bo_ij->C2dbopi = 0.000000; + bo_ij->C3dbopi = 0.000000; + bo_ij->C4dbopi = 0.000000; + + bo_ij->C1dbopi2 = 1.000000; + bo_ij->C2dbopi2 = 0.000000; + bo_ij->C3dbopi2 = 0.000000; + bo_ij->C4dbopi2 = 0.000000; + + } else { + val_j = system->reax_param.sbp[type_j].valency; + Deltap_j = workspace->Deltap[j]; + Deltap_boc_j = workspace->Deltap_boc[j]; + + /* on page 1 */ + if (twbp->ovc >= 0.001) { + /* Correction for overcoordination */ + exp_p1i = exp( -p_boc1 * Deltap_i ); + exp_p2i = exp( -p_boc2 * Deltap_i ); + exp_p1j = exp( -p_boc1 * Deltap_j ); + exp_p2j = exp( -p_boc2 * Deltap_j ); + + f2 = exp_p1i + exp_p1j; + f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); + f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + + ( val_j + f2 )/( val_j + f2 + f3 ) ); + + /* Now come the derivates */ + /* Bond Order pages 5-7, derivative of f1 */ + temp = f2 + f3; + u1_ij = val_i + temp; + u1_ji = val_j + temp; + Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + + 1.0 / SQR( u1_ji )); + Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + + ( u1_ji - f3 ) / SQR( u1_ji )); + + Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - + ((val_i+f2) / SQR(u1_ij)) * + ( -p_boc1 * exp_p1i + + exp_p2i / ( exp_p2i + exp_p2j ) ) + + -p_boc1 * exp_p1i / u1_ji - + ((val_j+f2) / SQR(u1_ji)) * + ( -p_boc1 * exp_p1i + + exp_p2i / ( exp_p2i + exp_p2j ) )); + + + Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + + Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); + } else { + /* No overcoordination correction! */ + f1 = 1.0; + Cf1_ij = Cf1_ji = 0.0; + } + + if (twbp->v13cor >= 0.001) { + /* Correction for 1-3 bond orders */ + exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); + exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); + + f4 = 1. / (1. + exp_f4); + f5 = 1. / (1. + exp_f5); + f4f5 = f4 * f5; + + /* Bond Order pages 8-9, derivative of f4 and f5 */ + Cf45_ij = -f4 * exp_f4; + Cf45_ji = -f5 * exp_f5; + } else { + f4 = f5 = f4f5 = 1.0; + Cf45_ij = Cf45_ji = 0.0; + } + + /* Bond Order page 10, derivative of total bond order */ + A0_ij = f1 * f4f5; + A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO * + (Cf45_ij + Cf45_ji); + A2_ij = Cf1_ij / f1 + twbp->p_boc3 * Cf45_ij; + A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji; + A3_ij = A2_ij + Cf1_ij / f1; + A3_ji = A2_ji + Cf1_ji / f1; + + /* find corrected bond orders and their derivative coef */ + bo_ij->BO = bo_ij->BO * A0_ij; + bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; + bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; + bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); + + bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; + bo_ij->C2dbo = bo_ij->BO * A2_ij; + bo_ij->C3dbo = bo_ij->BO * A2_ji; + + bo_ij->C1dbopi = f1*f1*f4*f5; + bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij; + bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij; + bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji; + + bo_ij->C1dbopi2 = f1*f1*f4*f5; + bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij; + bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij; + bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji; + } + + /* neglect bonds that are < 1e-10 */ + if (bo_ij->BO < 1e-10) + bo_ij->BO = 0.0; + if (bo_ij->BO_s < 1e-10) + bo_ij->BO_s = 0.0; + if (bo_ij->BO_pi < 1e-10) + bo_ij->BO_pi = 0.0; + if (bo_ij->BO_pi2 < 1e-10) + bo_ij->BO_pi2 = 0.0; + + workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO + } } } - } - - /*-------------------------*/ - - // Need to wait for total_bond_order to be accumulated. + // Wait for bo_ij to be updated #if defined(_OPENMP) #pragma omp barrier #endif - /* Calculate some helper variables that are used at many places - throughout force calculations */ + // Try to combine the following for-loop back into the for-loop above + /*-------------------------*/ #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (j = 0; j < system->N; ++j) { - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[ type_j ]); + for (i = 0; i < system->N; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + start_i = Start_Index(i, bonds); + end_i = End_Index(i, bonds); - workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; - workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; - workspace->Delta_boc[j] = workspace->total_bond_order[j] - - sbp_j->valency_boc; - workspace->Delta_val[j] = workspace->total_bond_order[j] - - sbp_j->valency_val; + for (pj = start_i; pj < end_i; ++pj) { + j = bonds->select.bond_list[pj].nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; - workspace->vlpex[j] = workspace->Delta_e[j] - - 2.0 * (int)(workspace->Delta_e[j]/2.0); - explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j])); - workspace->nlp[j] = explp1 - (int)(workspace->Delta_e[j] / 2.0); - workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j]; - workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]); - workspace->dDelta_lp[j] = workspace->Clp[j]; + if (i < j || workspace->bond_mark[j] > 3) { + // Computed in previous for-loop + } else { + /* We only need to update bond orders from bo_ji + everything else is set in uncorrected_bo calculations */ + sym_index = bonds->select.bond_list[pj].sym_index; + + bo_ij = &( bonds->select.bond_list[pj].bo_data ); + bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); + bo_ij->BO = bo_ji->BO; + bo_ij->BO_s = bo_ji->BO_s; + bo_ij->BO_pi = bo_ji->BO_pi; + bo_ij->BO_pi2 = bo_ji->BO_pi2; + + workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO + } + } - if (sbp_j->mass > 21.0) { - workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency); - workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; - workspace->dDelta_lp_temp[j] = 0.; } - else { - workspace->nlp_temp[j] = workspace->nlp[j]; - workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; - workspace->dDelta_lp_temp[j] = workspace->Clp[j]; - } - } - } // parallel region - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEBOINDEX] += (endTimeBase-startTimeBase); + /*-------------------------*/ + // Need to wait for total_bond_order to be accumulated. +#if defined(_OPENMP) +#pragma omp barrier #endif + /* Calculate some helper variables that are used at many places + throughout force calculations */ +#if defined(_OPENMP) +#pragma omp for schedule(guided) +#endif + for (j = 0; j < system->N; ++j) { + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + sbp_j = &(system->reax_param.sbp[ type_j ]); + + workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; + workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; + workspace->Delta_boc[j] = workspace->total_bond_order[j] - + sbp_j->valency_boc; + workspace->Delta_val[j] = workspace->total_bond_order[j] - + sbp_j->valency_val; + + workspace->vlpex[j] = workspace->Delta_e[j] - + 2.0 * (int)(workspace->Delta_e[j]/2.0); + explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j])); + workspace->nlp[j] = explp1 - (int)(workspace->Delta_e[j] / 2.0); + workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j]; + workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]); + workspace->dDelta_lp[j] = workspace->Clp[j]; + + if (sbp_j->mass > 21.0) { + workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency); + workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; + workspace->dDelta_lp_temp[j] = 0.; + } + else { + workspace->nlp_temp[j] = workspace->nlp[j]; + workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; + workspace->dDelta_lp_temp[j] = workspace->Clp[j]; + } + } + + } // parallel region + } } diff --git a/src/USER-OMP/reaxc_bond_orders_omp.h b/src/USER-OMP/reaxc_bond_orders_omp.h deleted file mode 100644 index 1711a9ca0c..0000000000 --- a/src/USER-OMP/reaxc_bond_orders_omp.h +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __BOND_ORDERS_OMP_H_ -#define __BOND_ORDERS_OMP_H_ - -#include "reaxc_types.h" - -void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); -void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **); - -int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *, - single_body_parameters *, single_body_parameters *, two_body_parameters *, - int, double, double, double, double, double, double, double); - -void BOOMP(reax_system *, control_params *, simulation_data *, - storage *, reax_list **, output_controls *); -#endif diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp index 30d50a4e70..0cc0f995fb 100644 --- a/src/USER-OMP/reaxc_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_bonds_omp.cpp @@ -26,163 +26,145 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_bonds_omp.h" -#include -#include -#include "fix_omp.h" -#include "reaxc_defs.h" -#include "pair_reaxc_omp.h" -#include "reaxc_list.h" +#include "reaxff_omp.h" -#if defined(_OPENMP) -#include -#endif +#include "fix_omp.h" +#include "pair_reaxc_omp.h" +#include "reaxff_api.h" + +#include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -void BondsOMP( reax_system *system, control_params * /* control */, - simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /* out_control */) -{ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - const int natoms = system->n; - reax_list *bonds = (*lists) + BONDS; - const double gp3 = system->reax_param.gp.l[3]; - const double gp4 = system->reax_param.gp.l[4]; - const double gp7 = system->reax_param.gp.l[7]; - const double gp10 = system->reax_param.gp.l[10]; - const int gp37 = (int) system->reax_param.gp.l[37]; - double total_Ebond = 0.0; +namespace ReaxFF { + void BondsOMP(reax_system *system, simulation_data *data, + storage *workspace, reax_list **lists) + { + const int natoms = system->n; + reax_list *bonds = (*lists) + BONDS; + const double gp3 = system->reax_param.gp.l[3]; + const double gp4 = system->reax_param.gp.l[4]; + const double gp7 = system->reax_param.gp.l[7]; + const double gp10 = system->reax_param.gp.l[10]; + const int gp37 = (int) system->reax_param.gp.l[37]; + double total_Ebond = 0.0; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+: total_Ebond) #endif - { - int i, j, pj; - int start_i, end_i; - int type_i, type_j; - double ebond, pow_BOs_be2, exp_be12, CEbo; - double exphu, exphua1, exphub1, exphuov, hulpov, estriph; - double decobdbo, decobdboua, decobdboub; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - bond_order_data *bo_ij; + { + int i, j, pj; + int start_i, end_i; + int type_i, type_j; + double ebond, pow_BOs_be2, exp_be12, CEbo; + double exphu, exphua1, exphub1, exphuov, hulpov, estriph; + double decobdbo, decobdboua, decobdboub; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + bond_order_data *bo_ij; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - long reductionOffset = (system->N * tid); + int tid = get_tid(); + long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, - system->pair_ptr->vflag_either, system->N, - system->pair_ptr->eatom, - system->pair_ptr->vatom, nullptr, thr); + pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, + system->pair_ptr->vflag_either, system->N, + system->pair_ptr->eatom, + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < natoms; ++i) { - start_i = Start_Index(i, bonds); - end_i = End_Index(i, bonds); + for (i = 0; i < natoms; ++i) { + start_i = Start_Index(i, bonds); + end_i = End_Index(i, bonds); - for (pj = start_i; pj < end_i; ++pj) { - j = bonds->select.bond_list[pj].nbr; + for (pj = start_i; pj < end_i; ++pj) { + j = bonds->select.bond_list[pj].nbr; - if (system->my_atoms[i].orig_id > system->my_atoms[j].orig_id) continue; + if (system->my_atoms[i].orig_id > system->my_atoms[j].orig_id) continue; - if (system->my_atoms[i].orig_id == system->my_atoms[j].orig_id) { - if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && - system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && - system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && - system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; - } + if (system->my_atoms[i].orig_id == system->my_atoms[j].orig_id) { + if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && + system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; + } - /* set the pointers */ - type_i = system->my_atoms[i].type; - type_j = system->my_atoms[j].type; - sbp_i = &( system->reax_param.sbp[type_i] ); - sbp_j = &( system->reax_param.sbp[type_j] ); - twbp = &( system->reax_param.tbp[type_i][type_j] ); - bo_ij = &( bonds->select.bond_list[pj].bo_data ); + /* set the pointers */ + type_i = system->my_atoms[i].type; + type_j = system->my_atoms[j].type; + sbp_i = &(system->reax_param.sbp[type_i]); + sbp_j = &(system->reax_param.sbp[type_j]); + twbp = &(system->reax_param.tbp[type_i][type_j]); + bo_ij = &(bonds->select.bond_list[pj].bo_data); - /* calculate the constants */ - if (bo_ij->BO_s == 0.0) pow_BOs_be2 = 0.0; - else pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); - exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); - CEbo = -twbp->De_s * exp_be12 * - ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); + /* calculate the constants */ + if (bo_ij->BO_s == 0.0) pow_BOs_be2 = 0.0; + else pow_BOs_be2 = pow(bo_ij->BO_s, twbp->p_be2); + exp_be12 = exp(twbp->p_be1 * (1.0 - pow_BOs_be2)); + CEbo = -twbp->De_s * exp_be12 * + (1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2); - /* calculate the Bond Energy */ - total_Ebond += ebond = - -twbp->De_s * bo_ij->BO_s * exp_be12 - -twbp->De_p * bo_ij->BO_pi - -twbp->De_pp * bo_ij->BO_pi2; - - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, - ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - - /* calculate derivatives of Bond Orders */ - bo_ij->Cdbo += CEbo; - bo_ij->Cdbopi -= (CEbo + twbp->De_p); - bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); - - /* Stabilisation terminal triple bond */ - if (bo_ij->BO >= 1.00) { - if (gp37 == 2 || - (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || - (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { - exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); - exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); - exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); - exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); - hulpov = 1.0 / (1.0 + 25.0 * exphuov); - - estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); - total_Ebond += estriph; - - decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * - ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); - decobdboua = -gp10 * exphu * hulpov * - (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); - decobdboub = -gp10 * exphu * hulpov * - (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); + /* calculate the Bond Energy */ + total_Ebond += ebond = + -twbp->De_s * bo_ij->BO_s * exp_be12 + -twbp->De_p * bo_ij->BO_pi + -twbp->De_pp * bo_ij->BO_pi2; /* tally into per-atom energy */ if (system->pair_ptr->evflag) pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, - estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - bo_ij->Cdbo += decobdbo; - workspace->CdDelta[i] += decobdboua; - workspace->CdDeltaReduction[reductionOffset+j] += decobdboub; + /* calculate derivatives of Bond Orders */ + bo_ij->Cdbo += CEbo; + bo_ij->Cdbopi -= (CEbo + twbp->De_p); + bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); + + /* Stabilisation terminal triple bond */ + if (bo_ij->BO >= 1.00) { + if (gp37 == 2 || + (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || + (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { + exphu = exp(-gp7 * SQR(bo_ij->BO - 2.50)); + exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); + exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); + exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); + hulpov = 1.0 / (1.0 + 25.0 * exphuov); + + estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); + total_Ebond += estriph; + + decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * + (gp3 - 2.0 * gp7 * (bo_ij->BO-2.50)); + decobdboua = -gp10 * exphu * hulpov * + (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); + decobdboub = -gp10 * exphu * hulpov * + (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, + estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + + bo_ij->Cdbo += decobdbo; + workspace->CdDelta[i] += decobdboua; + workspace->CdDeltaReduction[reductionOffset+j] += decobdboub; + } + } } - } - } - } // for (i) + } // for (i) - } // omp - - data->my_en.e_bond += total_Ebond; - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEBONDSINDEX] += (endTimeBase-startTimeBase); -#endif + } // omp + data->my_en.e_bond += total_Ebond; + } } diff --git a/src/USER-OMP/reaxc_bonds_omp.h b/src/USER-OMP/reaxc_bonds_omp.h deleted file mode 100644 index e5fb0f99e1..0000000000 --- a/src/USER-OMP/reaxc_bonds_omp.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __BONDS_OMP_H_ -#define __BONDS_OMP_H_ - -#include "reaxc_types.h" - -void BondsOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index aff543225d..566edf7d05 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -26,440 +26,348 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_forces_omp.h" +#include "reaxff_omp.h" #include "error.h" #include "fix_omp.h" #include "pair_reaxc_omp.h" -#include "reaxc_defs.h" -#include "reaxc_bond_orders_omp.h" -#include "reaxc_bonds_omp.h" -#include "reaxc_hydrogen_bonds_omp.h" -#include "reaxc_list.h" -#include "reaxc_multi_body_omp.h" -#include "reaxc_nonbonded_omp.h" -#include "reaxc_torsion_angles_omp.h" -#include "reaxc_valence_angles_omp.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" -#include #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; -// Functions defined in reaxc_forces.cpp -extern interaction_function Interaction_Functions[]; -extern double Compute_H(double, double, double*); -extern double Compute_tabH(double, int, int); -extern void Dummy_Interaction(reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*); - +namespace ReaxFF { /* ---------------------------------------------------------------------- */ -void Init_Force_FunctionsOMP( control_params *control ) -{ - Interaction_Functions[0] = BOOMP; - Interaction_Functions[1] = BondsOMP; //Dummy_Interaction; - Interaction_Functions[2] = Atom_EnergyOMP; //Dummy_Interaction; - Interaction_Functions[3] = Valence_AnglesOMP; //Dummy_Interaction; - Interaction_Functions[4] = Torsion_AnglesOMP; //Dummy_Interaction; - if (control->hbond_cut > 0) - Interaction_Functions[5] = Hydrogen_BondsOMP; - else Interaction_Functions[5] = Dummy_Interaction; - Interaction_Functions[6] = Dummy_Interaction; //empty - Interaction_Functions[7] = Dummy_Interaction; //empty - Interaction_Functions[8] = Dummy_Interaction; //empty - Interaction_Functions[9] = Dummy_Interaction; //empty -} + void Compute_Bonded_ForcesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) + { -/* ---------------------------------------------------------------------- */ - -// Only difference with MPI-only version is inclusion of OMP_TIMING statements -void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ - int i; - -#ifdef OMP_TIMING - double startTimeBase, endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - /* Implement all force calls as function pointers */ - for (i = 0; i < NUM_INTRS; i++) { - (Interaction_Functions[i])( system, control, data, workspace, - lists, out_control ); + BOOMP(system, control, data, workspace, lists, out_control); + BondsOMP(system, data, workspace, lists); + Atom_EnergyOMP(system, data, workspace, lists); + Valence_AnglesOMP(system, control, data, workspace, lists); + Torsion_AnglesOMP(system, control, data, workspace, lists); + if (control->hbond_cut > 0) + Hydrogen_BondsOMP(system, control, data, workspace, lists); } -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEBFINDEX] += (endTimeBase-startTimeBase); -#endif - -} - // Only difference with MPI-only version is inclusion of OMP_TIMING statements -void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ - /* van der Waals and Coulomb interactions */ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif + void Compute_NonBonded_ForcesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) + { + /* van der Waals and Coulomb interactions */ - if (control->tabulate == 0) - vdW_Coulomb_Energy_OMP( system, control, data, workspace, - lists, out_control ); - else - Tabulated_vdW_Coulomb_Energy_OMP( system, control, data, workspace, - lists, out_control ); - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTENBFINDEX] += (endTimeBase-startTimeBase); -#endif -} + if (control->tabulate == 0) + vdW_Coulomb_Energy_OMP(system, control, data, workspace, lists); + else + Tabulated_vdW_Coulomb_Energy_OMP(system, control, data, workspace, lists); + } /* ---------------------------------------------------------------------- */ /* this version of Compute_Total_Force computes forces from coefficients accumulated by all interaction functions. Saves enormous time & space! */ -void Compute_Total_ForceOMP(reax_system *system, control_params *control, - storage *workspace, reax_list **lists) -{ -#ifdef OMP_TIMING - double startTimeBase,endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - int natoms = system->N; - int nthreads = control->nthreads; - long totalReductionSize = (bigint)system->N * nthreads; - reax_list *bonds = (*lists) + BONDS; + void Compute_Total_ForceOMP(reax_system *system, control_params *control, + storage *workspace, reax_list **lists) + { + int natoms = system->N; + int nthreads = control->nthreads; + long totalReductionSize = (bigint)system->N * nthreads; + reax_list *bonds = (*lists) + BONDS; #if defined(_OPENMP) #pragma omp parallel default(shared) //LMP_DEFAULT_NONE #endif - { - int i, j, k, pj, pk, start_j, end_j; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - bond_order_data *bo_jk; + { + int i, j, k, pj, pk, start_j, end_j; - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + int tid = get_tid(); + bond_order_data *bo_jk; - pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, - system->pair_ptr->vatom, nullptr, thr); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + + pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) -#endif - for (i = 0; i < system->N; ++i) { - for (j = 0; j < nthreads; ++j) - workspace->CdDelta[i] += workspace->CdDeltaReduction[system->N*j+i]; - } - -#if defined(_OPENMP) -#pragma omp for schedule(dynamic,50) -#endif - for (j = 0; j < system->N; ++j) { - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); - - for (pk = start_j; pk < end_j; ++pk) { - bo_jk = &( bonds->select.bond_list[pk].bo_data ); - for (k = 0; k < nthreads; ++k) - bo_jk->Cdbo += bo_jk->CdboReduction[k]; - } - } - - if (control->virial == 0) { - -#if defined(_OPENMP) -#pragma omp for schedule(dynamic,50) #endif for (i = 0; i < system->N; ++i) { - const int startj = Start_Index(i, bonds); - const int endj = End_Index(i, bonds); - for (pj = startj; pj < endj; ++pj) - if (i < bonds->select.bond_list[pj].nbr) - Add_dBond_to_ForcesOMP( system, i, pj, workspace, lists ); + for (j = 0; j < nthreads; ++j) + workspace->CdDelta[i] += workspace->CdDeltaReduction[system->N*j+i]; } - } else { - #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for (i = 0; i < system->N; ++i) { - const int startj = Start_Index(i, bonds); - const int endj = End_Index(i, bonds); - for (pj = startj; pj < endj; ++pj) - if (i < bonds->select.bond_list[pj].nbr) - Add_dBond_to_Forces_NPTOMP(system, i, pj, workspace, lists ); + for (j = 0; j < system->N; ++j) { + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); + + for (pk = start_j; pk < end_j; ++pk) { + bo_jk = &(bonds->select.bond_list[pk].bo_data); + for (k = 0; k < nthreads; ++k) + bo_jk->Cdbo += bo_jk->CdboReduction[k]; + } } - } // if (virial == 0) + if (control->virial == 0) { - pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, 0, 1, thr); +#if defined(_OPENMP) +#pragma omp for schedule(dynamic,50) +#endif + for (i = 0; i < system->N; ++i) { + const int startj = Start_Index(i, bonds); + const int endj = End_Index(i, bonds); + for (pj = startj; pj < endj; ++pj) + if (i < bonds->select.bond_list[pj].nbr) + Add_dBond_to_ForcesOMP(system, i, pj, workspace, lists); + } + + } else { + +#if defined(_OPENMP) +#pragma omp for schedule(dynamic,50) +#endif + for (i = 0; i < system->N; ++i) { + const int startj = Start_Index(i, bonds); + const int endj = End_Index(i, bonds); + for (pj = startj; pj < endj; ++pj) + if (i < bonds->select.bond_list[pj].nbr) + Add_dBond_to_Forces_NPTOMP(system, i, pj, workspace, lists); + } + + } // if (virial == 0) + + pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, 0, 1, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < system->N; ++i) { - for (j = 0; j < nthreads; ++j) - rvec_Add( workspace->f[i], workspace->forceReduction[system->N*j+i] ); - } + for (i = 0; i < system->N; ++i) { + for (j = 0; j < nthreads; ++j) + rvec_Add(workspace->f[i], workspace->forceReduction[system->N*j+i]); + } #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < totalReductionSize; i++) { - workspace->forceReduction[i][0] = 0; - workspace->forceReduction[i][1] = 0; - workspace->forceReduction[i][2] = 0; - workspace->CdDeltaReduction[i] = 0; - } - } // parallel region - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTETFINDEX] += (endTimeBase-startTimeBase); -#endif -} + for (i = 0; i < totalReductionSize; i++) { + workspace->forceReduction[i][0] = 0; + workspace->forceReduction[i][1] = 0; + workspace->forceReduction[i][2] = 0; + workspace->CdDeltaReduction[i] = 0; + } + } // parallel region + } /* ---------------------------------------------------------------------- */ -void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list **lists, - int step, int n, int N, int numH) -{ - int comp, Hindex; - reax_list *bonds, *hbonds; - double saferzone = system->saferzone; + void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list **lists, + int step, int n, int N, int numH) + { + int comp, Hindex; + reax_list *bonds, *hbonds; + double saferzone = system->saferzone; #if defined(_OPENMP) #pragma omp parallel default(shared) private(comp,Hindex) #endif - { + { - /* bond list */ - if (N > 0) { - bonds = *lists + BONDS; + /* bond list */ + if (N > 0) { + bonds = *lists + BONDS; #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (int i = 0; i < N; ++i) { - system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); + for (int i = 0; i < N; ++i) { + system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); - if (i < N-1) - comp = Start_Index(i+1, bonds); - else comp = bonds->num_intrs; + if (i < N-1) + comp = Start_Index(i+1, bonds); + else comp = bonds->num_intrs; - if (End_Index(i, bonds) > comp) - system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " - "i={} end(i)={} str(i+1)={}\n", - step,i,End_Index(i,bonds),comp)); - } - } - - - /* hbonds list */ - if (numH > 0) { - hbonds = *lists + HBONDS; - -#if defined(_OPENMP) -#pragma omp for schedule(guided) -#endif - for (int i = 0; i < n; ++i) { - Hindex = system->my_atoms[i].Hindex; - if (Hindex > -1) { - system->my_atoms[i].num_hbonds = - (int)(MAX(Num_Entries(Hindex,hbonds)*saferzone,system->minhbonds)); - - if (Hindex < numH-1) - comp = Start_Index(Hindex+1, hbonds); - else comp = hbonds->num_intrs; - - if (End_Index(Hindex, hbonds) > comp) - system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " - "H={} end(H)={} str(H+1)={}\n", - step, Hindex,End_Index(Hindex,hbonds),comp)); + if (End_Index(i, bonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " + "i={} end(i)={} str(i+1)={}\n", + step,i,End_Index(i,bonds),comp)); + } } - } - } - - } // omp parallel -} -void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists) { -#ifdef OMP_TIMING - double startTimeBase, endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - int j, pj; - int start_i, end_i; - int type_i, type_j; - int ihb, jhb, ihb_top, jhb_top; - double cutoff; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - far_neighbor_data *nbr_pj; - reax_atom *atom_i, *atom_j; - reax_list *far_nbrs = *lists + FAR_NBRS; - reax_list *bonds = *lists + BONDS; - reax_list *hbonds = *lists + HBONDS; - int num_bonds = 0; - int num_hbonds = 0; - int btop_i = 0; - - // We will use CdDeltaReduction as a temporary (double) buffer to accumulate total_bond_order - // This is safe because CdDeltaReduction is currently zeroed and its accumulation doesn't start until BondsOMP() - double * tmp_bond_order = workspace->CdDeltaReduction; - - // We do the same with forceReduction as a temporary (rvec) buffer to accumulate dDeltap_self - // This is safe because forceReduction is currently zeroed and its accumulation does start until Hydrogen_BondsOMP() - rvec * tmp_ddelta = workspace->forceReduction; - - /* uncorrected bond orders */ - cutoff = control->bond_cut; + /* hbonds list */ + if (numH > 0) { + hbonds = *lists + HBONDS; #if defined(_OPENMP) -#pragma omp parallel default(shared) \ - private(atom_i, type_i, start_i, end_i, sbp_i, btop_i, ihb, ihb_top, \ +#pragma omp for schedule(guided) +#endif + for (int i = 0; i < n; ++i) { + Hindex = system->my_atoms[i].Hindex; + if (Hindex > -1) { + system->my_atoms[i].num_hbonds = + (int)(MAX(Num_Entries(Hindex,hbonds)*saferzone,system->minhbonds)); + + if (Hindex < numH-1) + comp = Start_Index(Hindex+1, hbonds); + else comp = hbonds->num_intrs; + + if (End_Index(Hindex, hbonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " + "H={} end(H)={} str(H+1)={}\n", + step, Hindex,End_Index(Hindex,hbonds),comp)); + } + } + } + + } // omp parallel + } + + + void Init_Forces_noQEq_OMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) { + int j, pj; + int start_i, end_i; + int type_i, type_j; + int ihb, jhb, ihb_top, jhb_top; + double cutoff; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + far_neighbor_data *nbr_pj; + reax_atom *atom_i, *atom_j; + reax_list *far_nbrs = *lists + FAR_NBRS; + reax_list *bonds = *lists + BONDS; + reax_list *hbonds = *lists + HBONDS; + int num_bonds = 0; + int num_hbonds = 0; + int btop_i = 0; + + // We will use CdDeltaReduction as a temporary (double) buffer to accumulate total_bond_order + // This is safe because CdDeltaReduction is currently zeroed and its accumulation doesn't start until BondsOMP() + double * tmp_bond_order = workspace->CdDeltaReduction; + + // We do the same with forceReduction as a temporary (rvec) buffer to accumulate dDeltap_self + // This is safe because forceReduction is currently zeroed and its accumulation does start until Hydrogen_BondsOMP() + rvec * tmp_ddelta = workspace->forceReduction; + + /* uncorrected bond orders */ + cutoff = control->bond_cut; + +#if defined(_OPENMP) +#pragma omp parallel default(shared) \ + private(atom_i, type_i, start_i, end_i, sbp_i, btop_i, ihb, ihb_top, \ atom_j, type_j, pj, sbp_j, nbr_pj, jhb, twbp) #endif - { + { - int nthreads = control->nthreads; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - long reductionOffset = (bigint)system->N * tid; - long totalReductionSize = (bigint)system->N * nthreads; + int nthreads = control->nthreads; + int tid = get_tid(); + long reductionOffset = (bigint)system->N * tid; + long totalReductionSize = (bigint)system->N * nthreads; #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) reduction(+:num_bonds) #endif - for (int i = 0; i < system->N; ++i) { - atom_i = &(system->my_atoms[i]); - type_i = atom_i->type; - sbp_i = &(system->reax_param.sbp[type_i]); + for (int i = 0; i < system->N; ++i) { + atom_i = &(system->my_atoms[i]); + type_i = atom_i->type; + sbp_i = &(system->reax_param.sbp[type_i]); - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); - if (nbr_pj->d <= cutoff) { - int j = nbr_pj->nbr; - atom_j = &(system->my_atoms[j]); - type_j = atom_j->type; - sbp_j = &(system->reax_param.sbp[type_j]); - twbp = &(system->reax_param.tbp[type_i][type_j]); + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + if (nbr_pj->d <= cutoff) { + int j = nbr_pj->nbr; + atom_j = &(system->my_atoms[j]); + type_j = atom_j->type; + sbp_j = &(system->reax_param.sbp[type_j]); + twbp = &(system->reax_param.tbp[type_i][type_j]); -// #pragma omp critical -// { -// btop_i = End_Index(i, bonds); -// if (BOp(workspace, bonds, control->bo_cut, i, btop_i, nbr_pj, sbp_i, sbp_j, twbp)) { -// num_bonds++; -// btop_i++; -// Set_End_Index(i, btop_i, bonds); -// } + // Trying to minimize time spent in critical section by moving initial part of BOp() + // outside of critical section. -// } + // Start top portion of BOp() + double C12, C34, C56; + double BO, BO_s, BO_pi, BO_pi2; + double bo_cut = control->bo_cut; - // Trying to minimize time spent in critical section by moving initial part of BOp() - // outside of critical section. + if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { + C12 = twbp->p_bo1 * pow(nbr_pj->d / twbp->r_s, twbp->p_bo2); + BO_s = (1.0 + bo_cut) * exp(C12); + } + else BO_s = C12 = 0.0; - // Start top portion of BOp() - double C12, C34, C56; - double BO, BO_s, BO_pi, BO_pi2; - double bo_cut = control->bo_cut; + if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { + C34 = twbp->p_bo3 * pow(nbr_pj->d / twbp->r_p, twbp->p_bo4); + BO_pi = exp(C34); + } + else BO_pi = C34 = 0.0; - if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { - C12 = twbp->p_bo1 * pow( nbr_pj->d / twbp->r_s, twbp->p_bo2 ); - BO_s = (1.0 + bo_cut) * exp( C12 ); - } - else BO_s = C12 = 0.0; + if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { + C56 = twbp->p_bo5 * pow(nbr_pj->d / twbp->r_pp, twbp->p_bo6); + BO_pi2= exp(C56); + } + else BO_pi2 = C56 = 0.0; - if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { - C34 = twbp->p_bo3 * pow( nbr_pj->d / twbp->r_p, twbp->p_bo4 ); - BO_pi = exp( C34 ); - } - else BO_pi = C34 = 0.0; + /* Initially BO values are the uncorrected ones, page 1 */ + BO = BO_s + BO_pi + BO_pi2; + // End top portion of BOp() - if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { - C56 = twbp->p_bo5 * pow( nbr_pj->d / twbp->r_pp, twbp->p_bo6 ); - BO_pi2= exp( C56 ); - } - else BO_pi2 = C56 = 0.0; + if (BO >= bo_cut) { + int btop_j; - /* Initially BO values are the uncorrected ones, page 1 */ - BO = BO_s + BO_pi + BO_pi2; - // End top portion of BOp() - - if (BO >= bo_cut) { - int btop_j; - - // Update indices in critical section + // Update indices in critical section #if defined(_OPENMP) #pragma omp critical #endif - { - btop_i = End_Index( i, bonds ); - btop_j = End_Index( j, bonds ); - Set_End_Index( j, btop_j+1, bonds ); - Set_End_Index( i, btop_i+1, bonds ); - } // omp critical + { + btop_i = End_Index(i, bonds); + btop_j = End_Index(j, bonds); + Set_End_Index(j, btop_j+1, bonds); + Set_End_Index(i, btop_i+1, bonds); + } // omp critical - // Finish remaining BOp() work - BOp_OMP(workspace, bonds, bo_cut, - i , btop_i, nbr_pj, sbp_i, sbp_j, twbp, btop_j, - C12, C34, C56, BO, BO_s, BO_pi, BO_pi2); + // Finish remaining BOp() work + BOp_OMP(workspace, bonds, bo_cut, + i , btop_i, nbr_pj, sbp_i, sbp_j, twbp, btop_j, + C12, C34, C56, BO, BO_s, BO_pi, BO_pi2); - bond_data * ibond = &(bonds->select.bond_list[btop_i]); - bond_order_data * bo_ij = &(ibond->bo_data); + bond_data * ibond = &(bonds->select.bond_list[btop_i]); + bond_order_data * bo_ij = &(ibond->bo_data); - bond_data * jbond = &(bonds->select.bond_list[btop_j]); - bond_order_data * bo_ji = &(jbond->bo_data); + bond_data * jbond = &(bonds->select.bond_list[btop_j]); + bond_order_data * bo_ji = &(jbond->bo_data); - workspace->total_bond_order[i] += bo_ij->BO; - tmp_bond_order[reductionOffset + j] += bo_ji->BO; + workspace->total_bond_order[i] += bo_ij->BO; + tmp_bond_order[reductionOffset + j] += bo_ji->BO; - rvec_Add(workspace->dDeltap_self[i], bo_ij->dBOp); - rvec_Add(tmp_ddelta[reductionOffset + j], bo_ji->dBOp); + rvec_Add(workspace->dDeltap_self[i], bo_ij->dBOp); + rvec_Add(tmp_ddelta[reductionOffset + j], bo_ji->dBOp); - btop_i++; - num_bonds++; - } // if (BO>=bo_cut) + btop_i++; + num_bonds++; + } // if (BO>=bo_cut) - } // if (cutoff) + } // if (cutoff) - } // for (pj) - } // for (i) + } // for (pj) + } // for (i) - // Need to wait for all indices and tmp arrays accumulated. + // Need to wait for all indices and tmp arrays accumulated. #if defined(_OPENMP) #pragma omp barrier #endif @@ -467,126 +375,123 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for (int i=0; iN; i++) - for (int t=0; tN + i; - workspace->dDeltap_self[i][0] += tmp_ddelta[indx][0]; - workspace->dDeltap_self[i][1] += tmp_ddelta[indx][1]; - workspace->dDeltap_self[i][2] += tmp_ddelta[indx][2]; - workspace->total_bond_order[i] += tmp_bond_order[indx]; - } + for (int i=0; iN; i++) + for (int t=0; tN + i; + workspace->dDeltap_self[i][0] += tmp_ddelta[indx][0]; + workspace->dDeltap_self[i][1] += tmp_ddelta[indx][1]; + workspace->dDeltap_self[i][2] += tmp_ddelta[indx][2]; + workspace->total_bond_order[i] += tmp_bond_order[indx]; + } - /* hydrogen bond list */ - if (control->hbond_cut > 0) { - cutoff = control->hbond_cut; + /* hydrogen bond list */ + if (control->hbond_cut > 0) { + cutoff = control->hbond_cut; #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) reduction(+ : num_hbonds) #endif - for (int i = 0; i < system->n; ++i) { - atom_i = &(system->my_atoms[i]); - type_i = atom_i->type; - sbp_i = &(system->reax_param.sbp[type_i]); - ihb = sbp_i->p_hbond; + for (int i = 0; i < system->n; ++i) { + atom_i = &(system->my_atoms[i]); + type_i = atom_i->type; + sbp_i = &(system->reax_param.sbp[type_i]); + ihb = sbp_i->p_hbond; #if defined(_OPENMP) #pragma omp critical #endif - { + { - if (ihb == 1 || ihb == 2) { - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); + if (ihb == 1 || ihb == 2) { + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); - j = nbr_pj->nbr; - atom_j = &(system->my_atoms[j]); - type_j = atom_j->type; - if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[type_j]); - jhb = sbp_j->p_hbond; + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + atom_j = &(system->my_atoms[j]); + type_j = atom_j->type; + if (type_j < 0) continue; + sbp_j = &(system->reax_param.sbp[type_j]); + jhb = sbp_j->p_hbond; - if (nbr_pj->d <= control->hbond_cut) { - int iflag = 0; - int jflag = 0; + if (nbr_pj->d <= control->hbond_cut) { + int iflag = 0; + int jflag = 0; - if (ihb==1 && jhb==2) iflag = 1; - else if (jn && ihb == 2 && jhb == 1) jflag = 1; + if (ihb==1 && jhb==2) iflag = 1; + else if (jn && ihb == 2 && jhb == 1) jflag = 1; - if (iflag || jflag) { - if (iflag) { - ihb_top = End_Index(atom_i->Hindex, hbonds); - Set_End_Index(atom_i->Hindex, ihb_top+1, hbonds); - } else if (jflag) { - jhb_top = End_Index(atom_j->Hindex, hbonds); - Set_End_Index(atom_j->Hindex, jhb_top+1, hbonds); - } + if (iflag || jflag) { + if (iflag) { + ihb_top = End_Index(atom_i->Hindex, hbonds); + Set_End_Index(atom_i->Hindex, ihb_top+1, hbonds); + } else if (jflag) { + jhb_top = End_Index(atom_j->Hindex, hbonds); + Set_End_Index(atom_j->Hindex, jhb_top+1, hbonds); + } - if (iflag) { - hbonds->select.hbond_list[ihb_top].nbr = j; - hbonds->select.hbond_list[ihb_top].scl = 1; - hbonds->select.hbond_list[ihb_top].ptr = nbr_pj; - } else if (jflag) { - hbonds->select.hbond_list[jhb_top].nbr = i; - hbonds->select.hbond_list[jhb_top].scl = -1; - hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; - } + if (iflag) { + hbonds->select.hbond_list[ihb_top].nbr = j; + hbonds->select.hbond_list[ihb_top].scl = 1; + hbonds->select.hbond_list[ihb_top].ptr = nbr_pj; + } else if (jflag) { + hbonds->select.hbond_list[jhb_top].nbr = i; + hbonds->select.hbond_list[jhb_top].scl = -1; + hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; + } - num_hbonds++; - } // if (iflag || jflag) + num_hbonds++; + } // if (iflag || jflag) - } - } - } + } + } + } - } // omp critical - } + } // omp critical + } - } // if (control->hbond > 0) + } // if (control->hbond > 0) - // Zero buffers for others to use as intended. + // Zero buffers for others to use as intended. #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (int i=0; irealloc.num_bonds = num_bonds; + workspace->realloc.num_hbonds = num_hbonds; + + Validate_ListsOMP(system, workspace, lists, data->step, + system->n, system->N, system->numH); + } - } // omp - - workspace->realloc.num_bonds = num_bonds; - workspace->realloc.num_hbonds = num_hbonds; - - Validate_ListsOMP( system, workspace, lists, data->step, - system->n, system->N, system->numH); - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEIFINDEX] += (endTimeBase-startTimeBase); -#endif -} - /* ---------------------------------------------------------------------- */ -void Compute_ForcesOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ - // Init Forces - Init_Forces_noQEq_OMP( system, control, data, workspace, lists); + void Compute_ForcesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) + { + // Init Forces + Init_Forces_noQEq_OMP(system, control, data, workspace, lists); - // Bonded Interactions - Compute_Bonded_ForcesOMP( system, control, data, workspace, - lists, out_control ); + // Bonded Interactions + Compute_Bonded_ForcesOMP(system, control, data, workspace, + lists, out_control); - // Nonbonded Interactions - Compute_NonBonded_ForcesOMP( system, control, data, workspace, - lists, out_control); + // Nonbonded Interactions + Compute_NonBonded_ForcesOMP(system, control, data, workspace, + lists, out_control); - // Total Force - Compute_Total_ForceOMP( system, control, workspace, lists); + // Total Force + Compute_Total_ForceOMP(system, control, workspace, lists); + } } diff --git a/src/USER-OMP/reaxc_forces_omp.h b/src/USER-OMP/reaxc_forces_omp.h deleted file mode 100644 index e2065d8305..0000000000 --- a/src/USER-OMP/reaxc_forces_omp.h +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __FORCES_OMP_H_ -#define __FORCES_OMP_H_ - -#include "reaxc_types.h" -#include - -void Init_Force_FunctionsOMP( control_params* ); -void Compute_ForcesOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*); -#endif diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index b21b8b7cac..b2bd04d82a 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -26,220 +26,202 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_hydrogen_bonds_omp.h" +#include "reaxff_omp.h" #include "fix_omp.h" #include "pair_reaxc_omp.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_valence_angles.h" // To access Calculate_Theta() -#include "reaxc_valence_angles_omp.h" // To access Calculate_dCos_ThetaOMP() -#include "reaxc_vector.h" -#include +#include "reaxff_api.h" + #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; -/* ---------------------------------------------------------------------- */ +namespace ReaxFF { + + /* ---------------------------------------------------------------------- */ -void Hydrogen_BondsOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /* out_control */) -{ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif + void Hydrogen_BondsOMP( reax_system *system, control_params *control, + simulation_data *data, storage *workspace, reax_list **lists) + { - const int nthreads = control->nthreads; + const int nthreads = control->nthreads; #if defined(_OPENMP) #pragma omp parallel default(shared) //LMP_DEFAULT_NONE #endif - { - int i, j, k, pi, pk; - int type_i, type_j, type_k; - int start_j, end_j, hb_start_j, hb_end_j; - int hblist[MAX_BONDS]; - int itr, top; - int num_hb_intrs = 0; - ivec rel_jk; - double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; - double e_hb, e_hb_thr = 0.0, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; - rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force; - hbond_parameters *hbp; - bond_order_data *bo_ij; - bond_data *pbond_ij; - far_neighbor_data *nbr_jk; - reax_list *bonds, *hbonds; - bond_data *bond_list; - hbond_data *hbond_list; + { + int i, j, k, pi, pk; + int type_i, type_j, type_k; + int start_j, end_j, hb_start_j, hb_end_j; + int hblist[MAX_BONDS]; + int itr, top; + int num_hb_intrs = 0; + ivec rel_jk; + double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; + double e_hb, e_hb_thr = 0.0, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; + rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; + rvec dvec_jk, force; + hbond_parameters *hbp; + bond_order_data *bo_ij; + bond_data *pbond_ij; + far_neighbor_data *nbr_jk; + reax_list *bonds, *hbonds; + bond_data *bond_list; + hbond_data *hbond_list; - // tally variables - double fi_tmp[3], fk_tmp[3], delij[3], delkj[3]; + // tally variables + double fi_tmp[3], fk_tmp[3], delij[3], delkj[3]; - bonds = (*lists) + BONDS; - bond_list = bonds->select.bond_list; - hbonds = (*lists) + HBONDS; - hbond_list = hbonds->select.hbond_list; + bonds = (*lists) + BONDS; + bond_list = bonds->select.bond_list; + hbonds = (*lists) + HBONDS; + hbond_list = hbonds->select.hbond_list; - int natoms = system->n; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - const int idelta = 1 + natoms/nthreads; - int ifrom = tid*idelta; - int ito = ((ifrom + idelta) > natoms) ? natoms : ifrom + idelta; + int natoms = system->n; + int tid = get_tid(); - long reductionOffset = (system->N * tid); + const int idelta = 1 + natoms/nthreads; + int ifrom = tid*idelta; + int ito = ((ifrom + idelta) > natoms) ? natoms : ifrom + idelta; - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + long reductionOffset = (system->N * tid); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); - /* loops below discover the Hydrogen bonds between i-j-k triplets. - here j is H atom and there has to be some bond between i and j. - Hydrogen bond is between j and k. - so in this function i->X, j->H, k->Z when we map - variables onto the ones in the handout.*/ - // for (j = 0; j < system->n; ++j) - for (j = ifrom; j < ito; ++j) { - /* j has to be of type H */ - if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { - /*set j's variables */ - type_j = system->my_atoms[j].type; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); - hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); - hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); - if (type_j < 0) continue; + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - top = 0; - for (pi = start_j; pi < end_j; ++pi) { - pbond_ij = &( bond_list[pi] ); - i = pbond_ij->nbr; - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - bo_ij = &(pbond_ij->bo_data); + /* loops below discover the Hydrogen bonds between i-j-k triplets. + here j is H atom and there has to be some bond between i and j. + Hydrogen bond is between j and k. + so in this function i->X, j->H, k->Z when we map + variables onto the ones in the handout.*/ + // for (j = 0; j < system->n; ++j) + for (j = ifrom; j < ito; ++j) { + /* j has to be of type H */ + if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { + /*set j's variables */ + type_j = system->my_atoms[j].type; + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); + hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); + hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); + if (type_j < 0) continue; - if ( system->reax_param.sbp[type_i].p_hbond == 2 && - bo_ij->BO >= HB_THRESHOLD ) - hblist[top++] = pi; - } - - for (pk = hb_start_j; pk < hb_end_j; ++pk) { - /* set k's varibles */ - k = hbond_list[pk].nbr; - type_k = system->my_atoms[k].type; - if (type_k < 0) continue; - nbr_jk = hbond_list[pk].ptr; - r_jk = nbr_jk->d; - rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - - for (itr = 0; itr < top; ++itr) { - pi = hblist[itr]; - pbond_ij = &( bonds->select.bond_list[pi] ); - i = pbond_ij->nbr; - - if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { - bo_ij = &(pbond_ij->bo_data); + top = 0; + for (pi = start_j; pi < end_j; ++pi) { + pbond_ij = &( bond_list[pi] ); + i = pbond_ij->nbr; type_i = system->my_atoms[i].type; if (type_i < 0) continue; - hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); - ++num_hb_intrs; + bo_ij = &(pbond_ij->bo_data); - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &theta, &cos_theta ); - /* the derivative of cos(theta) */ - Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &dcos_theta_di, &dcos_theta_dj, - &dcos_theta_dk ); + if ( system->reax_param.sbp[type_i].p_hbond == 2 && + bo_ij->BO >= HB_THRESHOLD ) + hblist[top++] = pi; + } - /* hydrogen bond energy*/ - sin_theta2 = sin( theta/2.0 ); - sin_xhz4 = SQR(sin_theta2); - sin_xhz4 *= sin_xhz4; - cos_xhz1 = ( 1.0 - cos_theta ); - exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); - exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + - r_jk / hbp->r0_hb - 2.0 ) ); + for (pk = hb_start_j; pk < hb_end_j; ++pk) { + /* set k's varibles */ + k = hbond_list[pk].nbr; + type_k = system->my_atoms[k].type; + if (type_k < 0) continue; + nbr_jk = hbond_list[pk].ptr; + r_jk = nbr_jk->d; + rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - e_hb_thr += e_hb = hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; + for (itr = 0; itr < top; ++itr) { + pi = hblist[itr]; + pbond_ij = &( bonds->select.bond_list[pi] ); + i = pbond_ij->nbr; - CEhb1 = hbp->p_hb1 * hbp->p_hb2 * exp_hb2 * exp_hb3 * sin_xhz4; - CEhb2 = -hbp->p_hb1/2.0 * (1.0 - exp_hb2) * exp_hb3 * cos_xhz1; - CEhb3 = -hbp->p_hb3 * - (-hbp->r0_hb / SQR(r_jk) + 1.0 / hbp->r0_hb) * e_hb; + if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { + bo_ij = &(pbond_ij->bo_data); + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); + ++num_hb_intrs; - /* hydrogen bond forces */ - bo_ij->Cdbo += CEhb1; // dbo term + Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &theta, &cos_theta ); + /* the derivative of cos(theta) */ + Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &dcos_theta_di, &dcos_theta_dj, + &dcos_theta_dk ); - if (control->virial == 0) { - // dcos terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk ); - // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk ); - } - else { - /* for pressure coupling, terms that are not related to bond order - derivatives are added directly into pressure vector/tensor */ - rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms - rvec_Add(workspace->forceReduction[reductionOffset+i], force ); + /* hydrogen bond energy*/ + sin_theta2 = sin( theta/2.0 ); + sin_xhz4 = SQR(sin_theta2); + sin_xhz4 *= sin_xhz4; + cos_xhz1 = ( 1.0 - cos_theta ); + exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); + exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + + r_jk / hbp->r0_hb - 2.0 ) ); + + e_hb_thr += e_hb = hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; + + CEhb1 = hbp->p_hb1 * hbp->p_hb2 * exp_hb2 * exp_hb3 * sin_xhz4; + CEhb2 = -hbp->p_hb1/2.0 * (1.0 - exp_hb2) * exp_hb3 * cos_xhz1; + CEhb3 = -hbp->p_hb3 * + (-hbp->r0_hb / SQR(r_jk) + 1.0 / hbp->r0_hb) * e_hb; + + /* hydrogen bond forces */ + bo_ij->Cdbo += CEhb1; // dbo term + + if (control->virial == 0) { + // dcos terms + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk ); + // dr terms + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk ); + } + else { + /* for pressure coupling, terms that are not related to bond order + derivatives are added directly into pressure vector/tensor */ + rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms + rvec_Add(workspace->forceReduction[reductionOffset+i], force ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); - ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); - rvec_Scale( force, +CEhb2, dcos_theta_dk ); - rvec_Add(workspace->forceReduction[reductionOffset+k], force ); - // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk ); + ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); + rvec_Scale( force, +CEhb2, dcos_theta_dk ); + rvec_Add(workspace->forceReduction[reductionOffset+k], force ); + // dr terms + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk ); - rvec_Scale( force, CEhb3/r_jk, dvec_jk ); - rvec_Add(workspace->forceReduction[reductionOffset+k], force ); - } + rvec_Scale( force, CEhb3/r_jk, dvec_jk ); + rvec_Add(workspace->forceReduction[reductionOffset+k], force ); + } - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - rvec_ScaledSum( delij, 1., system->my_atoms[j].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, - -1., system->my_atoms[k].x ); + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + rvec_ScaledSum( delij, 1., system->my_atoms[j].x, + -1., system->my_atoms[i].x ); + rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, + -1., system->my_atoms[k].x ); - rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); - rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); - rvec_ScaledAdd(fk_tmp, CEhb3/r_jk, dvec_jk); + rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); + rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); + rvec_ScaledAdd(fk_tmp, CEhb3/r_jk, dvec_jk); - pair_reax_ptr->ev_tally3_thr_proxy(system->pair_ptr,i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj,thr); + pair_reax_ptr->ev_tally3_thr_proxy(system->pair_ptr,i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj,thr); + } + } } } + } } - - } - } #if defined(_OPENMP) #pragma omp critical #endif - { - data->my_en.e_hb += e_hb_thr; + { + data->my_en.e_hb += e_hb_thr; + } + } } } - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEHBONDSINDEX] += (endTimeBase-startTimeBase); -#endif -} diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.h b/src/USER-OMP/reaxc_hydrogen_bonds_omp.h deleted file mode 100644 index 8c3d04448a..0000000000 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __HBONDS_OMP_H_ -#define __HBONDS_OMP_H_ - -#include "reaxc_types.h" - -void Hydrogen_BondsOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index d20ab954fe..94458d2691 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -26,114 +26,97 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_init_md_omp.h" +#include "reaxff_omp.h" -#include "reaxc_defs.h" -#include "reaxc_forces.h" -#include "reaxc_forces_omp.h" -#include "reaxc_io_tools.h" -#include "reaxc_list.h" -#include "reaxc_lookup.h" -#include "reaxc_tool_box.h" #include "error.h" -#include "fmt/format.h" + +#include "reaxff_api.h" #include -// Functions defined in reaxc_init_md.cpp -extern void Init_System(reax_system*, control_params*); -extern void Init_Simulation_Data(control_params*, simulation_data*); -extern void Init_Workspace(reax_system*, control_params*, storage*); - /* ---------------------------------------------------------------------- */ -int Init_ListsOMP(reax_system *system, control_params *control, - reax_list **lists) -{ - int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; - int *hb_top, *bond_top; +namespace ReaxFF { + int Init_ListsOMP(reax_system *system, control_params *control, + reax_list **lists) + { + int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; + int *hb_top, *bond_top; - int mincap = system->mincap; - double safezone = system->safezone; - double saferzone = system->saferzone; - LAMMPS_NS::Error *error = system->error_ptr; + int mincap = system->mincap; + double safezone = system->safezone; + double saferzone = system->saferzone; + auto error = system->error_ptr; - bond_top = (int*) calloc(system->total_cap, sizeof(int)); - hb_top = (int*) calloc(system->local_cap, sizeof(int)); - Estimate_Storages(system, control, lists, - &Htop, hb_top, bond_top, &num_3body); + bond_top = (int*) calloc(system->total_cap, sizeof(int)); + hb_top = (int*) calloc(system->local_cap, sizeof(int)); + Estimate_Storages(system, control, lists, + &Htop, hb_top, bond_top, &num_3body); - if (control->hbond_cut > 0) { - /* init H indexes */ - total_hbonds = 0; - for (i = 0; i < system->n; ++i) { - system->my_atoms[i].num_hbonds = hb_top[i]; - total_hbonds += hb_top[i]; + if (control->hbond_cut > 0) { + /* init H indexes */ + total_hbonds = 0; + for (i = 0; i < system->n; ++i) { + system->my_atoms[i].num_hbonds = hb_top[i]; + total_hbonds += hb_top[i]; + } + total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); + + if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, + *lists+HBONDS)) { + error->one(FLERR, "Not enough space for hbonds list. Terminating!"); + } } - total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS)) { - error->one(FLERR, "Not enough space for hbonds list. Terminating!"); + total_bonds = 0; + for (i = 0; i < system->N; ++i) { + system->my_atoms[i].num_bonds = bond_top[i]; + total_bonds += bond_top[i]; } + bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); + + if (!Make_List(system->total_cap, bond_cap, TYP_BOND, + *lists+BONDS)) { + error->one(FLERR, "Not enough space for bonds list. Terminating!\n"); + } + + int nthreads = control->nthreads; + reax_list *bonds = (*lists)+BONDS; + + for (i = 0; i < bonds->num_intrs; ++i) + bonds->select.bond_list[i].bo_data.CdboReduction = + (double*) smalloc(error, sizeof(double)*nthreads, "CdboReduction"); + + /* 3bodies list */ + cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); + if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, + *lists+THREE_BODIES)) { + + error->one(FLERR, "Problem in initializing angles list. Terminating!"); + } + + free(hb_top); + free(bond_top); + + return SUCCESS; } - total_bonds = 0; - for (i = 0; i < system->N; ++i) { - system->my_atoms[i].num_bonds = bond_top[i]; - total_bonds += bond_top[i]; - } - bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - - if (!Make_List(system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS)) { - error->one(FLERR, "Not enough space for bonds list. Terminating!\n"); - } - - int nthreads = control->nthreads; - reax_list *bonds = (*lists)+BONDS; - - for (i = 0; i < bonds->num_intrs; ++i) - bonds->select.bond_list[i].bo_data.CdboReduction = - (double*) smalloc(error, sizeof(double)*nthreads, "CdboReduction"); - - /* 3bodies list */ - cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES)) { - - error->one(FLERR, "Problem in initializing angles list. Terminating!"); - } - - free(hb_top); - free(bond_top); - - return SUCCESS; -} - /* ---------------------------------------------------------------------- */ // The only difference with the MPI-only function is calls to Init_ListsOMP and Init_Force_FunctionsOMP(). -void InitializeOMP(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm world) -{ - char msg[MAX_STR]; - LAMMPS_NS::Error *error = system->error_ptr; + void InitializeOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control, + MPI_Comm world) + { + Init_System(system,control); + Init_Simulation_Data(data); + Init_Workspace(system,control,workspace); + Init_ListsOMP(system,control,lists); - Init_System(system,control); - Init_Simulation_Data(control,data); - Init_Workspace(system,control,workspace); - Init_ListsOMP(system,control,lists); + Init_Output_Files(system,control,out_control,world); - Init_Output_Files(system,control,out_control,world); - - if (control->tabulate) - if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Could not create lookup " - "table. Terminating.",msg)); - - Init_Force_FunctionsOMP(control); + if (control->tabulate) + Init_Lookup_Tables(system,control,workspace,world); + } } - diff --git a/src/USER-OMP/reaxc_init_md_omp.h b/src/USER-OMP/reaxc_init_md_omp.h deleted file mode 100644 index 422e2aa452..0000000000 --- a/src/USER-OMP/reaxc_init_md_omp.h +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __INIT_MD_OMP_H_ -#define __INIT_MD_OMP_H_ - -#include "reaxc_types.h" - -#include - -void InitializeOMP( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*, MPI_Comm ); -#endif diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp index e2af2d96ad..2ec73e738b 100644 --- a/src/USER-OMP/reaxc_multi_body_omp.cpp +++ b/src/USER-OMP/reaxc_multi_body_omp.cpp @@ -26,266 +26,248 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_multi_body_omp.h" +#include "reaxff_omp.h" #include "fix_omp.h" #include "pair_reaxc_omp.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" +#include "reaxff_api.h" #include #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -void Atom_EnergyOMP( reax_system *system, control_params * /* control */, - simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /* out_control */) -{ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif +namespace ReaxFF { + void Atom_EnergyOMP(reax_system *system, simulation_data *data, + storage *workspace, reax_list **lists) + { + /* Initialize parameters */ + const double p_lp3 = system->reax_param.gp.l[5]; + const double p_ovun3 = system->reax_param.gp.l[32]; + const double p_ovun4 = system->reax_param.gp.l[31]; + const double p_ovun6 = system->reax_param.gp.l[6]; + const double p_ovun7 = system->reax_param.gp.l[8]; + const double p_ovun8 = system->reax_param.gp.l[9]; - /* Initialize parameters */ - const double p_lp3 = system->reax_param.gp.l[5]; - const double p_ovun3 = system->reax_param.gp.l[32]; - const double p_ovun4 = system->reax_param.gp.l[31]; - const double p_ovun6 = system->reax_param.gp.l[6]; - const double p_ovun7 = system->reax_param.gp.l[8]; - const double p_ovun8 = system->reax_param.gp.l[9]; + reax_list *bonds = (*lists) + BONDS; - reax_list *bonds = (*lists) + BONDS; - - double total_Elp = 0.0; - double total_Eun = 0.0; - double total_Eov = 0.0; + double total_Elp = 0.0; + double total_Eun = 0.0; + double total_Eov = 0.0; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+:total_Elp, total_Eun, total_Eov) #endif -{ - int i, j, pj, type_i, type_j; - double Delta_lpcorr, dfvl; - double e_lp, expvd2, inv_expvd2, dElp, CElp, DlpVi; - double e_lph, Di, vov3, deahu2dbo, deahu2dsbo; - double e_ov, CEover1, CEover2, CEover3, CEover4; - double exp_ovun1, exp_ovun2, sum_ovun1, sum_ovun2; - double exp_ovun2n, exp_ovun6, exp_ovun8; - double inv_exp_ovun1, inv_exp_ovun2, inv_exp_ovun2n, inv_exp_ovun8; - double e_un, CEunder1, CEunder2, CEunder3, CEunder4; - double eng_tmp; - double p_lp2, p_ovun2, p_ovun5; - int numbonds; + { + int i, j, pj, type_i, type_j; + double Delta_lpcorr, dfvl; + double e_lp, expvd2, inv_expvd2, dElp, CElp, DlpVi; + double e_lph, Di, vov3, deahu2dbo, deahu2dsbo; + double e_ov, CEover1, CEover2, CEover3, CEover4; + double exp_ovun1, exp_ovun2, sum_ovun1, sum_ovun2; + double exp_ovun2n, exp_ovun6, exp_ovun8; + double inv_exp_ovun1, inv_exp_ovun2, inv_exp_ovun2n, inv_exp_ovun8; + double e_un, CEunder1, CEunder2, CEunder3, CEunder4; + double eng_tmp; + double p_lp2, p_ovun2, p_ovun5; + int numbonds; - single_body_parameters *sbp_i; - two_body_parameters *twbp; - bond_data *pbond; - bond_order_data *bo_ij; + single_body_parameters *sbp_i; + two_body_parameters *twbp; + bond_data *pbond; + bond_order_data *bo_ij; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif + int tid = get_tid(); - long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + long reductionOffset = (system->N * tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for ( i = 0; i < system->n; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + for (i = 0; i < system->n; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[ type_i ]); - /* lone-pair Energy */ - p_lp2 = sbp_i->p_lp2; - expvd2 = exp( -75 * workspace->Delta_lp[i] ); - inv_expvd2 = 1. / (1. + expvd2 ); + /* lone-pair Energy */ + p_lp2 = sbp_i->p_lp2; + expvd2 = exp(-75 * workspace->Delta_lp[i]); + inv_expvd2 = 1. / (1. + expvd2); - numbonds = 0; - e_lp = 0.0; - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) - numbonds ++; + numbonds = 0; + e_lp = 0.0; + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) + numbonds ++; - /* calculate the energy */ - if (numbonds > 0) - total_Elp += e_lp = - p_lp2 * workspace->Delta_lp[i] * inv_expvd2; + /* calculate the energy */ + if (numbonds > 0) + total_Elp += e_lp = + p_lp2 * workspace->Delta_lp[i] * inv_expvd2; - dElp = p_lp2 * inv_expvd2 + - 75 * p_lp2 * workspace->Delta_lp[i] * expvd2 * SQR(inv_expvd2); - CElp = dElp * workspace->dDelta_lp[i]; + dElp = p_lp2 * inv_expvd2 + + 75 * p_lp2 * workspace->Delta_lp[i] * expvd2 * SQR(inv_expvd2); + CElp = dElp * workspace->dDelta_lp[i]; - if (numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term + if (numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, - e_lp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, + e_lp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - /* correction for C2 */ - if (p_lp3 > 0.001 && !strcmp(system->reax_param.sbp[type_i].name, "C")) - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - j = bonds->select.bond_list[pj].nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; + /* correction for C2 */ + if (p_lp3 > 0.001 && !strcmp(system->reax_param.sbp[type_i].name, "C")) + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { + j = bonds->select.bond_list[pj].nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; - if (!strcmp( system->reax_param.sbp[type_j].name, "C" )) { - twbp = &( system->reax_param.tbp[type_i][type_j]); - bo_ij = &( bonds->select.bond_list[pj].bo_data ); - Di = workspace->Delta[i]; - vov3 = bo_ij->BO - Di - 0.040*pow(Di, 4.); + if (!strcmp(system->reax_param.sbp[type_j].name, "C")) { + twbp = &(system->reax_param.tbp[type_i][type_j]); + bo_ij = &(bonds->select.bond_list[pj].bo_data); + Di = workspace->Delta[i]; + vov3 = bo_ij->BO - Di - 0.040*pow(Di, 4.); - if (vov3 > 3.) { - total_Elp += e_lph = p_lp3 * SQR(vov3-3.0); + if (vov3 > 3.) { + total_Elp += e_lph = p_lp3 * SQR(vov3-3.0); - deahu2dbo = 2.*p_lp3*(vov3 - 3.); - deahu2dsbo = 2.*p_lp3*(vov3 - 3.)*(-1. - 0.16*pow(Di, 3.)); + deahu2dbo = 2.*p_lp3*(vov3 - 3.); + deahu2dsbo = 2.*p_lp3*(vov3 - 3.)*(-1. - 0.16*pow(Di, 3.)); - bo_ij->Cdbo += deahu2dbo; - workspace->CdDelta[i] += deahu2dsbo; + bo_ij->Cdbo += deahu2dbo; + workspace->CdDelta[i] += deahu2dsbo; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, system->n, 1, - e_lph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, system->n, 1, + e_lph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + } + } } - } } - } #if defined(_OPENMP) #pragma omp barrier #pragma omp for schedule(guided) #endif - for (i = 0; i < system->n; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + for (i = 0; i < system->n; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[ type_i ]); - /* over-coordination energy */ - if (sbp_i->mass > 21.0) - dfvl = 0.0; - else dfvl = 1.0; // only for 1st-row elements + /* over-coordination energy */ + if (sbp_i->mass > 21.0) + dfvl = 0.0; + else dfvl = 1.0; // only for 1st-row elements - p_ovun2 = sbp_i->p_ovun2; - sum_ovun1 = sum_ovun2 = 0; - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - j = bonds->select.bond_list[pj].nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - bo_ij = &(bonds->select.bond_list[pj].bo_data); - twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); + p_ovun2 = sbp_i->p_ovun2; + sum_ovun1 = sum_ovun2 = 0; + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { + j = bonds->select.bond_list[pj].nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + bo_ij = &(bonds->select.bond_list[pj].bo_data); + twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); - sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; - sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); + sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; + sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* + (bo_ij->BO_pi + bo_ij->BO_pi2); + } + + exp_ovun1 = p_ovun3 * exp(p_ovun4 * sum_ovun2); + inv_exp_ovun1 = 1.0 / (1 + exp_ovun1); + Delta_lpcorr = workspace->Delta[i] - + (dfvl * workspace->Delta_lp_temp[i]) * inv_exp_ovun1; + + exp_ovun2 = exp(p_ovun2 * Delta_lpcorr); + inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2); + + DlpVi = 1.0 / (Delta_lpcorr + sbp_i->valency + 1e-8); + CEover1 = Delta_lpcorr * DlpVi * inv_exp_ovun2; + + total_Eov += e_ov = sum_ovun1 * CEover1; + + CEover2 = sum_ovun1 * DlpVi * inv_exp_ovun2 * + (1.0 - Delta_lpcorr * (DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2)); + + CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1); + + CEover4 = CEover2 * (dfvl * workspace->Delta_lp_temp[i]) * + p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1); + + + /* under-coordination potential */ + p_ovun2 = sbp_i->p_ovun2; + p_ovun5 = sbp_i->p_ovun5; + + exp_ovun2n = 1.0 / exp_ovun2; + exp_ovun6 = exp(p_ovun6 * Delta_lpcorr); + exp_ovun8 = p_ovun7 * exp(p_ovun8 * sum_ovun2); + inv_exp_ovun2n = 1.0 / (1.0 + exp_ovun2n); + inv_exp_ovun8 = 1.0 / (1.0 + exp_ovun8); + + numbonds = 0; + e_un = 0.0; + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) + numbonds ++; + + if (numbonds > 0) total_Eun += e_un = + -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; + + CEunder1 = inv_exp_ovun2n * + (p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + + p_ovun2 * e_un * exp_ovun2n); + CEunder2 = -e_un * p_ovun8 * exp_ovun8 * inv_exp_ovun8; + CEunder3 = CEunder1 * (1.0 - dfvl*workspace->dDelta_lp[i]*inv_exp_ovun1); + CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) * + p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2; + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) { + eng_tmp = e_ov; + if (numbonds > 0) eng_tmp+= e_un; + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, + eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + } + + /* forces */ + workspace->CdDelta[i] += CEover3; // OvCoor - 2nd term + if (numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term + + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { + pbond = &(bonds->select.bond_list[pj]); + j = pbond->nbr; + bo_ij = &(pbond->bo_data); + twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] + [system->my_atoms[pbond->nbr].type]); + + bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s; // OvCoor-1st + workspace->CdDeltaReduction[reductionOffset+j] += + CEover4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // OvCoor-3a + + bo_ij->Cdbopi += CEover4 * + (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b + bo_ij->Cdbopi2 += CEover4 * + (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b + + workspace->CdDeltaReduction[reductionOffset+j] += + CEunder4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // UnCoor - 2a + + bo_ij->Cdbopi += CEunder4 * + (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b + bo_ij->Cdbopi2 += CEunder4 * + (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b + } + } } - exp_ovun1 = p_ovun3 * exp( p_ovun4 * sum_ovun2 ); - inv_exp_ovun1 = 1.0 / (1 + exp_ovun1); - Delta_lpcorr = workspace->Delta[i] - - (dfvl * workspace->Delta_lp_temp[i]) * inv_exp_ovun1; - - exp_ovun2 = exp( p_ovun2 * Delta_lpcorr ); - inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2); - - DlpVi = 1.0 / (Delta_lpcorr + sbp_i->valency + 1e-8); - CEover1 = Delta_lpcorr * DlpVi * inv_exp_ovun2; - - total_Eov += e_ov = sum_ovun1 * CEover1; - - CEover2 = sum_ovun1 * DlpVi * inv_exp_ovun2 * - (1.0 - Delta_lpcorr * ( DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2 )); - - CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1 ); - - CEover4 = CEover2 * (dfvl * workspace->Delta_lp_temp[i]) * - p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1); - - - /* under-coordination potential */ - p_ovun2 = sbp_i->p_ovun2; - p_ovun5 = sbp_i->p_ovun5; - - exp_ovun2n = 1.0 / exp_ovun2; - exp_ovun6 = exp( p_ovun6 * Delta_lpcorr ); - exp_ovun8 = p_ovun7 * exp(p_ovun8 * sum_ovun2); - inv_exp_ovun2n = 1.0 / (1.0 + exp_ovun2n); - inv_exp_ovun8 = 1.0 / (1.0 + exp_ovun8); - - numbonds = 0; - e_un = 0.0; - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) - numbonds ++; - - if (numbonds > 0) total_Eun += e_un = - -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; - - CEunder1 = inv_exp_ovun2n * - ( p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + - p_ovun2 * e_un * exp_ovun2n ); - CEunder2 = -e_un * p_ovun8 * exp_ovun8 * inv_exp_ovun8; - CEunder3 = CEunder1 * (1.0 - dfvl*workspace->dDelta_lp[i]*inv_exp_ovun1); - CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) * - p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2; - - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) { - eng_tmp = e_ov; - if (numbonds > 0) eng_tmp+= e_un; - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, - eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - } - - /* forces */ - workspace->CdDelta[i] += CEover3; // OvCoor - 2nd term - if (numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term - - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - pbond = &(bonds->select.bond_list[pj]); - j = pbond->nbr; - bo_ij = &(pbond->bo_data); - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] - [system->my_atoms[pbond->nbr].type]); - - bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s; // OvCoor-1st - workspace->CdDeltaReduction[reductionOffset+j] += - CEover4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // OvCoor-3a - - bo_ij->Cdbopi += CEover4 * - (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b - bo_ij->Cdbopi2 += CEover4 * - (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b - - workspace->CdDeltaReduction[reductionOffset+j] += - CEunder4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // UnCoor - 2a - - bo_ij->Cdbopi += CEunder4 * - (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b - bo_ij->Cdbopi2 += CEunder4 * - (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b - } + data->my_en.e_lp += total_Elp; + data->my_en.e_ov += total_Eov; + data->my_en.e_un += total_Eun; } - } - - data->my_en.e_lp += total_Elp; - data->my_en.e_ov += total_Eov; - data->my_en.e_un += total_Eun; - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEATOMENERGYINDEX] += (endTimeBase-startTimeBase); -#endif } diff --git a/src/USER-OMP/reaxc_multi_body_omp.h b/src/USER-OMP/reaxc_multi_body_omp.h deleted file mode 100644 index 772aafbb31..0000000000 --- a/src/USER-OMP/reaxc_multi_body_omp.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __MULTI_BODY_OMP_H_ -#define __MULTI_BODY_OMP_H_ - -#include "reaxc_types.h" - -void Atom_EnergyOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index f4a4e988bc..496e5476b0 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -26,357 +26,342 @@ . ----------------------------------------------------------------------*/ +#include "reaxff_omp.h" + #include "pair_reaxc_omp.h" - -#include "reaxc_types.h" -#include "reaxc_nonbonded.h" -#include "reaxc_nonbonded_omp.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" - -#include "reaxc_defs.h" +#include "reaxff_api.h" #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /* out_control */ ) -{ - int natoms = system->n; - reax_list *far_nbrs = (*lists) + FAR_NBRS; - double p_vdW1 = system->reax_param.gp.l[28]; - double p_vdW1i = 1.0 / p_vdW1; - double total_EvdW = 0.; - double total_Eele = 0.; +namespace ReaxFF { + void vdW_Coulomb_Energy_OMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int natoms = system->n; + reax_list *far_nbrs = (*lists) + FAR_NBRS; + double p_vdW1 = system->reax_param.gp.l[28]; + double p_vdW1i = 1.0 / p_vdW1; + double total_EvdW = 0.; + double total_Eele = 0.; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+: total_EvdW, total_Eele) #endif - { -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - int i, j, pj; - int start_i, end_i, orig_i, orig_j, flag; - double powr_vdW1, powgi_vdW1; - double tmp, r_ij, fn13, exp1, exp2; - double Tap, dTap, dfn13, CEvd, CEclmb, de_core; - double dr3gamij_1, dr3gamij_3; - double e_ele, e_vdW, e_core; - const double SMALL = 0.0001; - double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp; - two_body_parameters *twbp; - far_neighbor_data *nbr_pj; + { + int tid = get_tid(); + int i, j, pj; + int start_i, end_i, orig_i, orig_j, flag; + double powr_vdW1, powgi_vdW1; + double tmp, r_ij, fn13, exp1, exp2; + double Tap, dTap, dfn13, CEvd, CEclmb, de_core; + double dr3gamij_1, dr3gamij_3; + double e_ele, e_vdW, e_core; + const double SMALL = 0.0001; + double e_lg, de_lg, r_ij5, r_ij6, re6; + rvec temp; + two_body_parameters *twbp; + far_neighbor_data *nbr_pj; - // Tallying variables: - double pe_vdw, f_tmp, delij[3]; + // Tallying variables: + double pe_vdw, f_tmp, delij[3]; - long reductionOffset = (system->N * tid); + long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - e_core = 0; - e_vdW = 0; - e_lg = 0; - de_lg = 0.0; + e_core = 0; + e_vdW = 0; + e_lg = 0; + de_lg = 0.0; #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < natoms; ++i) { - if (system->my_atoms[i].type < 0) continue; - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); - orig_i = system->my_atoms[i].orig_id; + for (i = 0; i < natoms; ++i) { + if (system->my_atoms[i].type < 0) continue; + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); + orig_i = system->my_atoms[i].orig_id; - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); - j = nbr_pj->nbr; - orig_j = system->my_atoms[j].orig_id; + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + orig_j = system->my_atoms[j].orig_id; - flag = 0; - if (nbr_pj->d <= control->nonb_cut) { - if (j < natoms) flag = 1; - else if (orig_i < orig_j) flag = 1; - else if (orig_i == orig_j) { - if (nbr_pj->dvec[2] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[2]) < SMALL) { - if (nbr_pj->dvec[1] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) - flag = 1; + flag = 0; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; + else if (orig_i < orig_j) flag = 1; + else if (orig_i == orig_j) { + if (nbr_pj->dvec[2] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[2]) < SMALL) { + if (nbr_pj->dvec[1] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) + flag = 1; + } + } } - } - } - if (flag) { + if (flag) { - r_ij = nbr_pj->d; - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] - [ system->my_atoms[j].type ]); + r_ij = nbr_pj->d; + twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] + [ system->my_atoms[j].type ]); - /* Calculate Taper and its derivative */ - // Tap = nbr_pj->Tap; -- precomputed during compte_H - Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; - Tap = Tap * r_ij + workspace->Tap[5]; - Tap = Tap * r_ij + workspace->Tap[4]; - Tap = Tap * r_ij + workspace->Tap[3]; - Tap = Tap * r_ij + workspace->Tap[2]; - Tap = Tap * r_ij + workspace->Tap[1]; - Tap = Tap * r_ij + workspace->Tap[0]; + /* Calculate Taper and its derivative */ + // Tap = nbr_pj->Tap; -- precomputed during compte_H + Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; + Tap = Tap * r_ij + workspace->Tap[5]; + Tap = Tap * r_ij + workspace->Tap[4]; + Tap = Tap * r_ij + workspace->Tap[3]; + Tap = Tap * r_ij + workspace->Tap[2]; + Tap = Tap * r_ij + workspace->Tap[1]; + Tap = Tap * r_ij + workspace->Tap[0]; - dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; - dTap = dTap * r_ij + 5*workspace->Tap[5]; - dTap = dTap * r_ij + 4*workspace->Tap[4]; - dTap = dTap * r_ij + 3*workspace->Tap[3]; - dTap = dTap * r_ij + 2*workspace->Tap[2]; - dTap += workspace->Tap[1]/r_ij; + dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; + dTap = dTap * r_ij + 5*workspace->Tap[5]; + dTap = dTap * r_ij + 4*workspace->Tap[4]; + dTap = dTap * r_ij + 3*workspace->Tap[3]; + dTap = dTap * r_ij + 2*workspace->Tap[2]; + dTap += workspace->Tap[1]/r_ij; - /*vdWaals Calculations*/ - if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) - { // shielding - powr_vdW1 = pow(r_ij, p_vdW1); - powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); + /*vdWaals Calculations*/ + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + { // shielding + powr_vdW1 = pow(r_ij, p_vdW1); + powgi_vdW1 = pow(1.0 / twbp->gamma_w, p_vdW1); - fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i ); - exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); + fn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i); + exp1 = exp(twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); - e_vdW = twbp->D * (exp1 - 2.0 * exp2); - total_EvdW += Tap * e_vdW; + e_vdW = twbp->D * (exp1 - 2.0 * exp2); + total_EvdW += Tap * e_vdW; - dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) * - pow(r_ij, p_vdW1 - 2.0); + dfn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) * + pow(r_ij, p_vdW1 - 2.0); - CEvd = dTap * e_vdW - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; - } - else { // no shielding - exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); + CEvd = dTap * e_vdW - + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; + } + else { // no shielding + exp1 = exp(twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); - e_vdW = twbp->D * (exp1 - 2.0 * exp2); - total_EvdW += Tap * e_vdW; + e_vdW = twbp->D * (exp1 - 2.0 * exp2); + total_EvdW += Tap * e_vdW; - CEvd = dTap * e_vdW - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; - } - - if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) - { // innner wall - e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); - total_EvdW += Tap * e_core; - - de_core = -(twbp->acore/twbp->rcore) * e_core; - CEvd += dTap * e_core + Tap * de_core / r_ij; - - // lg correction, only if lgvdw is yes - if (control->lgflag) { - r_ij5 = pow( r_ij, 5.0 ); - r_ij6 = pow( r_ij, 6.0 ); - re6 = pow( twbp->lgre, 6.0 ); - - e_lg = -(twbp->lgcij/( r_ij6 + re6 )); - total_EvdW += Tap * e_lg; - - de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ; - CEvd += dTap * e_lg + Tap * de_lg / r_ij; + CEvd = dTap * e_vdW - + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + { // innner wall + e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); + total_EvdW += Tap * e_core; + + de_core = -(twbp->acore/twbp->rcore) * e_core; + CEvd += dTap * e_core + Tap * de_core / r_ij; + + // lg correction, only if lgvdw is yes + if (control->lgflag) { + r_ij5 = pow(r_ij, 5.0); + r_ij6 = pow(r_ij, 6.0); + re6 = pow(twbp->lgre, 6.0); + + e_lg = -(twbp->lgcij/(r_ij6 + re6)); + total_EvdW += Tap * e_lg; + + de_lg = -6.0 * e_lg * r_ij5 / (r_ij6 + re6) ; + CEvd += dTap * e_lg + Tap * de_lg / r_ij; + } + + } + + /*Coulomb Calculations*/ + dr3gamij_1 = (r_ij * r_ij * r_ij + twbp->gamma); + dr3gamij_3 = pow(dr3gamij_1 , 0.33333333333333); + + tmp = Tap / dr3gamij_3; + total_Eele += e_ele = + C_ele * system->my_atoms[i].q * system->my_atoms[j].q * tmp; + + CEclmb = C_ele * system->my_atoms[i].q * system->my_atoms[j].q * + (dTap - Tap * r_ij / dr3gamij_1) / dr3gamij_3; + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + pe_vdw = Tap * (e_vdW + e_core + e_lg); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + f_tmp = -(CEvd + CEclmb); + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, + 1, pe_vdw, e_ele, f_tmp, + delij[0], delij[1], delij[2], thr); + } + + if (control->virial == 0) { + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], + +(CEvd + CEclmb), nbr_pj->dvec); + } else { /* NPT, iNPT or sNPT */ + /* for pressure coupling, terms not related to bond order + derivatives are added directly into pressure vector/tensor */ + + rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); + rvec_ScaledAdd(workspace->f[reductionOffset+i], -1., temp); + rvec_Add(workspace->forceReduction[reductionOffset+j], temp); + } } - - /*Coulomb Calculations*/ - dr3gamij_1 = ( r_ij * r_ij * r_ij + twbp->gamma ); - dr3gamij_3 = pow( dr3gamij_1 , 0.33333333333333 ); - - tmp = Tap / dr3gamij_3; - total_Eele += e_ele = - C_ele * system->my_atoms[i].q * system->my_atoms[j].q * tmp; - - CEclmb = C_ele * system->my_atoms[i].q * system->my_atoms[j].q * - ( dTap - Tap * r_ij / dr3gamij_1 ) / dr3gamij_3; - - /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { - pe_vdw = Tap * (e_vdW + e_core + e_lg); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - f_tmp = -(CEvd + CEclmb); - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, - 1, pe_vdw, e_ele, f_tmp, - delij[0], delij[1], delij[2], thr); - } - - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+j], - +(CEvd + CEclmb), nbr_pj->dvec ); - } else { /* NPT, iNPT or sNPT */ - /* for pressure coupling, terms not related to bond order - derivatives are added directly into pressure vector/tensor */ - - rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); - rvec_ScaledAdd( workspace->f[reductionOffset+i], -1., temp ); - rvec_Add( workspace->forceReduction[reductionOffset+j], temp); - } } } - } - pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, - system->pair_ptr->vflag_either, thr); - } // parallel region + pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, + system->pair_ptr->vflag_either, thr); + } // parallel region - data->my_en.e_vdW = total_EvdW; - data->my_en.e_ele = total_Eele; + data->my_en.e_vdW = total_EvdW; + data->my_en.e_ele = total_Eele; - Compute_Polarization_Energy( system, data ); -} + Compute_Polarization_Energy(system, data); + } /* ---------------------------------------------------------------------- */ -void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, - output_controls * /* out_control */) { + void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) { - double SMALL = 0.0001; - int natoms = system->n; - reax_list *far_nbrs = (*lists) + FAR_NBRS; - double total_EvdW = 0.; - double total_Eele = 0.; + double SMALL = 0.0001; + int natoms = system->n; + reax_list *far_nbrs = (*lists) + FAR_NBRS; + double total_EvdW = 0.; + double total_Eele = 0.; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+:total_EvdW, total_Eele) #endif - { - int i, j, pj, r; - int type_i, type_j, tmin, tmax; - int start_i, end_i, orig_i, orig_j, flag; - double r_ij, base, dif; - double e_vdW, e_ele; - double CEvd, CEclmb; - double f_tmp, delij[3]; - rvec temp; - far_neighbor_data *nbr_pj; - LR_lookup_table *t; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); - #else - int tid = 0; -#endif - long froffset = (system->N * tid); - LR_lookup_table ** & LR = system->LR; + { + int i, j, pj, r; + int type_i, type_j, tmin, tmax; + int start_i, end_i, orig_i, orig_j, flag; + double r_ij, base, dif; + double e_vdW, e_ele; + double CEvd, CEclmb; + double f_tmp, delij[3]; + rvec temp; + far_neighbor_data *nbr_pj; + LR_lookup_table *t; - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + int tid = get_tid(); + long froffset = (system->N * tid); + LR_lookup_table ** & LR = system->LR; + + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (i = 0; i < natoms; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - start_i = Start_Index(i,far_nbrs); - end_i = End_Index(i,far_nbrs); - orig_i = system->my_atoms[i].orig_id; + for (i = 0; i < natoms; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + start_i = Start_Index(i,far_nbrs); + end_i = End_Index(i,far_nbrs); + orig_i = system->my_atoms[i].orig_id; - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); - j = nbr_pj->nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - orig_j = system->my_atoms[j].orig_id; + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + orig_j = system->my_atoms[j].orig_id; - flag = 0; - if (nbr_pj->d <= control->nonb_cut) { - if (j < natoms) flag = 1; - else if (orig_i < orig_j) flag = 1; - else if (orig_i == orig_j) { - if (nbr_pj->dvec[2] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[2]) < SMALL) { - if (nbr_pj->dvec[1] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) - flag = 1; + flag = 0; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; + else if (orig_i < orig_j) flag = 1; + else if (orig_i == orig_j) { + if (nbr_pj->dvec[2] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[2]) < SMALL) { + if (nbr_pj->dvec[1] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) + flag = 1; + } + } + + } + + if (flag) { + + r_ij = nbr_pj->d; + tmin = MIN(type_i, type_j); + tmax = MAX(type_i, type_j); + t = &(LR[tmin][tmax]); + + /* Cubic Spline Interpolation */ + r = (int)(r_ij * t->inv_dx); + if (r == 0) ++r; + base = (double)(r+1) * t->dx; + dif = r_ij - base; + + e_vdW = ((t->vdW[r].d*dif + t->vdW[r].c)*dif + t->vdW[r].b)*dif + + t->vdW[r].a; + + e_ele = ((t->ele[r].d*dif + t->ele[r].c)*dif + t->ele[r].b)*dif + + t->ele[r].a; + e_ele *= system->my_atoms[i].q * system->my_atoms[j].q; + + total_EvdW += e_vdW; + total_Eele += e_ele; + + CEvd = ((t->CEvd[r].d*dif + t->CEvd[r].c)*dif + t->CEvd[r].b)*dif + + t->CEvd[r].a; + + CEclmb = ((t->CEclmb[r].d*dif+t->CEclmb[r].c)*dif+t->CEclmb[r].b)*dif + + t->CEclmb[r].a; + CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + f_tmp = -(CEvd + CEclmb); + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, e_vdW, e_ele, + f_tmp, delij[0], delij[1], delij[2], thr); + } + + if (control->virial == 0) { + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->forceReduction[froffset+j], + +(CEvd + CEclmb), nbr_pj->dvec); + } else { // NPT, iNPT or sNPT + /* for pressure coupling, terms not related to bond order derivatives + are added directly into pressure vector/tensor */ + rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); + + rvec_ScaledAdd(workspace->f[i], -1., temp); + rvec_Add(workspace->forceReduction[froffset+j], temp); + } } } - } - if (flag) { + pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, + system->pair_ptr->vflag_either, thr); + } // end omp parallel - r_ij = nbr_pj->d; - tmin = MIN( type_i, type_j ); - tmax = MAX( type_i, type_j ); - t = &( LR[tmin][tmax] ); + data->my_en.e_vdW = total_EvdW; + data->my_en.e_ele = total_Eele; - /* Cubic Spline Interpolation */ - r = (int)(r_ij * t->inv_dx); - if (r == 0) ++r; - base = (double)(r+1) * t->dx; - dif = r_ij - base; - - e_vdW = ((t->vdW[r].d*dif + t->vdW[r].c)*dif + t->vdW[r].b)*dif + - t->vdW[r].a; - - e_ele = ((t->ele[r].d*dif + t->ele[r].c)*dif + t->ele[r].b)*dif + - t->ele[r].a; - e_ele *= system->my_atoms[i].q * system->my_atoms[j].q; - - total_EvdW += e_vdW; - total_Eele += e_ele; - - CEvd = ((t->CEvd[r].d*dif + t->CEvd[r].c)*dif + t->CEvd[r].b)*dif + - t->CEvd[r].a; - - CEclmb = ((t->CEclmb[r].d*dif+t->CEclmb[r].c)*dif+t->CEclmb[r].b)*dif + - t->CEclmb[r].a; - CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; - - /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - f_tmp = -(CEvd + CEclmb); - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, e_vdW, e_ele, - f_tmp, delij[0], delij[1], delij[2], thr); - } - - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); - rvec_ScaledAdd( workspace->forceReduction[froffset+j], - +(CEvd + CEclmb), nbr_pj->dvec ); - } else { // NPT, iNPT or sNPT - /* for pressure coupling, terms not related to bond order derivatives - are added directly into pressure vector/tensor */ - rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); - - rvec_ScaledAdd( workspace->f[i], -1., temp ); - rvec_Add( workspace->forceReduction[froffset+j], temp ); - } - } - } + Compute_Polarization_Energy(system, data); } - - pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, - system->pair_ptr->vflag_either, thr); - } // end omp parallel - - data->my_en.e_vdW = total_EvdW; - data->my_en.e_ele = total_Eele; - - Compute_Polarization_Energy( system, data ); } diff --git a/src/USER-OMP/reaxc_nonbonded_omp.h b/src/USER-OMP/reaxc_nonbonded_omp.h deleted file mode 100644 index a5d895533a..0000000000 --- a/src/USER-OMP/reaxc_nonbonded_omp.h +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __NONBONDED_OMP_H_ -#define __NONBONDED_OMP_H_ - -#include "reaxc_types.h" - -void vdW_Coulomb_Energy_OMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -void Tabulated_vdW_Coulomb_Energy_OMP( reax_system*, control_params*, - simulation_data*, storage*, - reax_list**, output_controls* ); -#endif diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index 642efd836e..f8c8d4262c 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -26,436 +26,411 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_torsion_angles_omp.h" +#include "reaxff_omp.h" #include "fix_omp.h" #include "pair_reaxc_omp.h" - -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" #include -#if defined(_OPENMP) -#include -#endif - #define MIN_SINE 1e-10 using namespace LAMMPS_NS; -// Functions defined in reaxc_torsion_angles.cpp -extern double Calculate_Omega(rvec, double, rvec, double, rvec, double, rvec, double, - three_body_interaction_data*, three_body_interaction_data*, - rvec, rvec, rvec, rvec, output_controls*); - -/* ---------------------------------------------------------------------- */ - -void Torsion_AnglesOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control ) -{ -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - int natoms = system->n; - reax_list *bonds = (*lists) + BONDS; - reax_list *thb_intrs = (*lists) + THREE_BODIES; - double p_tor2 = system->reax_param.gp.l[23]; - double p_tor3 = system->reax_param.gp.l[24]; - double p_tor4 = system->reax_param.gp.l[25]; - double p_cot2 = system->reax_param.gp.l[27]; - double total_Etor = 0; - double total_Econ = 0; - int nthreads = control->nthreads; +namespace ReaxFF { + + /* ---------------------------------------------------------------------- */ + void Torsion_AnglesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int natoms = system->n; + reax_list *bonds = (*lists) + BONDS; + reax_list *thb_intrs = (*lists) + THREE_BODIES; + double p_tor2 = system->reax_param.gp.l[23]; + double p_tor3 = system->reax_param.gp.l[24]; + double p_tor4 = system->reax_param.gp.l[25]; + double p_cot2 = system->reax_param.gp.l[27]; + double total_Etor = 0; + double total_Econ = 0; + int nthreads = control->nthreads; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+: total_Etor, total_Econ) #endif - { - int i, j, k, l, pi, pj, pk, pl, pij, plk; - int type_i, type_j, type_k, type_l; - int start_j, end_j; - int start_pj, end_pj, start_pk, end_pk; - int num_frb_intrs = 0; + { + int i, j, k, l, pi, pj, pk, pl, pij, plk; + int type_i, type_j, type_k, type_l; + int start_j, end_j; + int start_pj, end_pj, start_pk, end_pk; + int num_frb_intrs = 0; - double Delta_j, Delta_k; - double r_ij, r_jk, r_kl, r_li; - double BOA_ij, BOA_jk, BOA_kl; + double Delta_j, Delta_k; + double r_ij, r_jk, r_kl, r_li; + double BOA_ij, BOA_jk, BOA_kl; - double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl; - double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv; - double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl; - double fn10, f11_DjDk, dfn11, fn12; - double theta_ijk, theta_jkl; - double sin_ijk, sin_jkl; - double cos_ijk, cos_jkl; - double tan_ijk_i, tan_jkl_i; - double omega, cos_omega, cos2omega, cos3omega; - rvec dcos_omega_di, dcos_omega_dj, dcos_omega_dk, dcos_omega_dl; - double CV, cmn, CEtors1, CEtors2, CEtors3, CEtors4; - double CEtors5, CEtors6, CEtors7, CEtors8, CEtors9; - double Cconj, CEconj1, CEconj2, CEconj3; - double CEconj4, CEconj5, CEconj6; - double e_tor, e_con; - rvec dvec_li; - rvec force; - ivec rel_box_jl; - four_body_header *fbh; - four_body_parameters *fbp; - bond_data *pbond_ij, *pbond_jk, *pbond_kl; - bond_order_data *bo_ij, *bo_jk, *bo_kl; - three_body_interaction_data *p_ijk, *p_jkl; + double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl; + double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv; + double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl; + double fn10, f11_DjDk, dfn11, fn12; + double theta_ijk, theta_jkl; + double sin_ijk, sin_jkl; + double cos_ijk, cos_jkl; + double tan_ijk_i, tan_jkl_i; + double omega, cos_omega, cos2omega, cos3omega; + rvec dcos_omega_di, dcos_omega_dj, dcos_omega_dk, dcos_omega_dl; + double CV, cmn, CEtors1, CEtors2, CEtors3, CEtors4; + double CEtors5, CEtors6, CEtors7, CEtors8, CEtors9; + double Cconj, CEconj1, CEconj2, CEconj3; + double CEconj4, CEconj5, CEconj6; + double e_tor, e_con; + rvec dvec_li; + rvec force; + ivec rel_box_jl; + four_body_header *fbh; + four_body_parameters *fbp; + bond_data *pbond_ij, *pbond_jk, *pbond_kl; + bond_order_data *bo_ij, *bo_jk, *bo_kl; + three_body_interaction_data *p_ijk, *p_jkl; - // Virial tallying variables - double delil[3], deljl[3], delkl[3]; - double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; + // Virial tallying variables + double delil[3], deljl[3], delkl[3]; + double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + int tid = get_tid(); + + long reductionOffset = (system->N * tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) #pragma omp for schedule(static) #endif - for (j = 0; j < system->N; ++j) { - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); + for (j = 0; j < system->N; ++j) { + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); - for (pk = start_j; pk < end_j; ++pk) { - bo_jk = &( bonds->select.bond_list[pk].bo_data ); - for (k = 0; k < nthreads; ++k) - bo_jk->CdboReduction[k] = 0.; - } - } + for (pk = start_j; pk < end_j; ++pk) { + bo_jk = &(bonds->select.bond_list[pk].bo_data); + for (k = 0; k < nthreads; ++k) + bo_jk->CdboReduction[k] = 0.; + } + } #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for (j = 0; j < natoms; ++j) { - type_j = system->my_atoms[j].type; - Delta_j = workspace->Delta_boc[j]; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); + for (j = 0; j < natoms; ++j) { + type_j = system->my_atoms[j].type; + Delta_j = workspace->Delta_boc[j]; + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); - for (pk = start_j; pk < end_j; ++pk) { - pbond_jk = &( bonds->select.bond_list[pk] ); - k = pbond_jk->nbr; - bo_jk = &( pbond_jk->bo_data ); - BOA_jk = bo_jk->BO - control->thb_cut; + for (pk = start_j; pk < end_j; ++pk) { + pbond_jk = &(bonds->select.bond_list[pk]); + k = pbond_jk->nbr; + bo_jk = &(pbond_jk->bo_data); + BOA_jk = bo_jk->BO - control->thb_cut; - /* see if there are any 3-body interactions involving j&k - where j is the central atom. Otherwise there is no point in - trying to form a 4-body interaction out of this neighborhood */ - if (system->my_atoms[j].orig_id < system->my_atoms[k].orig_id && - bo_jk->BO > control->thb_cut/*0*/ && Num_Entries(pk, thb_intrs)) { - pj = pbond_jk->sym_index; // pj points to j on k's list + /* see if there are any 3-body interactions involving j&k + where j is the central atom. Otherwise there is no point in + trying to form a 4-body interaction out of this neighborhood */ + if (system->my_atoms[j].orig_id < system->my_atoms[k].orig_id && + bo_jk->BO > control->thb_cut/*0*/ && Num_Entries(pk, thb_intrs)) { + pj = pbond_jk->sym_index; // pj points to j on k's list - /* do the same check as above: - are there any 3-body interactions involving k&j - where k is the central atom */ - if (Num_Entries(pj, thb_intrs)) { - type_k = system->my_atoms[k].type; - Delta_k = workspace->Delta_boc[k]; - r_jk = pbond_jk->d; + /* do the same check as above: + are there any 3-body interactions involving k&j + where k is the central atom */ + if (Num_Entries(pj, thb_intrs)) { + type_k = system->my_atoms[k].type; + Delta_k = workspace->Delta_boc[k]; + r_jk = pbond_jk->d; - start_pk = Start_Index(pk, thb_intrs ); - end_pk = End_Index(pk, thb_intrs ); - start_pj = Start_Index(pj, thb_intrs ); - end_pj = End_Index(pj, thb_intrs ); + start_pk = Start_Index(pk, thb_intrs); + end_pk = End_Index(pk, thb_intrs); + start_pj = Start_Index(pj, thb_intrs); + end_pj = End_Index(pj, thb_intrs); - exp_tor2_jk = exp( -p_tor2 * BOA_jk ); - exp_cot2_jk = exp( -p_cot2 * SQR(BOA_jk - 1.5) ); - exp_tor3_DjDk = exp( -p_tor3 * (Delta_j + Delta_k) ); - exp_tor4_DjDk = exp( p_tor4 * (Delta_j + Delta_k) ); - exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); - f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; + exp_tor2_jk = exp(-p_tor2 * BOA_jk); + exp_cot2_jk = exp(-p_cot2 * SQR(BOA_jk - 1.5)); + exp_tor3_DjDk = exp(-p_tor3 * (Delta_j + Delta_k)); + exp_tor4_DjDk = exp(p_tor4 * (Delta_j + Delta_k)); + exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); + f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; - /* pick i up from j-k interaction where j is the central atom */ - for (pi = start_pk; pi < end_pk; ++pi) { - p_ijk = &( thb_intrs->select.three_body_list[pi] ); - pij = p_ijk->pthb; // pij is pointer to i on j's bond_list - pbond_ij = &( bonds->select.bond_list[pij] ); - bo_ij = &( pbond_ij->bo_data ); + /* pick i up from j-k interaction where j is the central atom */ + for (pi = start_pk; pi < end_pk; ++pi) { + p_ijk = &(thb_intrs->select.three_body_list[pi]); + pij = p_ijk->pthb; // pij is pointer to i on j's bond_list + pbond_ij = &(bonds->select.bond_list[pij]); + bo_ij = &(pbond_ij->bo_data); - if (bo_ij->BO > control->thb_cut/*0*/) { - i = p_ijk->thb; - type_i = system->my_atoms[i].type; - r_ij = pbond_ij->d; - BOA_ij = bo_ij->BO - control->thb_cut; + if (bo_ij->BO > control->thb_cut/*0*/) { + i = p_ijk->thb; + type_i = system->my_atoms[i].type; + r_ij = pbond_ij->d; + BOA_ij = bo_ij->BO - control->thb_cut; - theta_ijk = p_ijk->theta; - sin_ijk = sin( theta_ijk ); - cos_ijk = cos( theta_ijk ); - //tan_ijk_i = 1. / tan( theta_ijk ); - if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) - tan_ijk_i = cos_ijk / MIN_SINE; - else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) - tan_ijk_i = cos_ijk / -MIN_SINE; - else tan_ijk_i = cos_ijk / sin_ijk; + theta_ijk = p_ijk->theta; + sin_ijk = sin(theta_ijk); + cos_ijk = cos(theta_ijk); + //tan_ijk_i = 1. / tan(theta_ijk); + if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) + tan_ijk_i = cos_ijk / MIN_SINE; + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) + tan_ijk_i = cos_ijk / -MIN_SINE; + else tan_ijk_i = cos_ijk / sin_ijk; - exp_tor2_ij = exp( -p_tor2 * BOA_ij ); - exp_cot2_ij = exp( -p_cot2 * SQR(BOA_ij -1.5) ); + exp_tor2_ij = exp(-p_tor2 * BOA_ij); + exp_cot2_ij = exp(-p_cot2 * SQR(BOA_ij -1.5)); - /* pick l up from j-k interaction where k is the central atom */ - for (pl = start_pj; pl < end_pj; ++pl) { - p_jkl = &( thb_intrs->select.three_body_list[pl] ); - l = p_jkl->thb; - plk = p_jkl->pthb; //pointer to l on k's bond_list! - pbond_kl = &( bonds->select.bond_list[plk] ); - bo_kl = &( pbond_kl->bo_data ); - type_l = system->my_atoms[l].type; - fbh = &(system->reax_param.fbp[type_i][type_j] - [type_k][type_l]); - fbp = &(system->reax_param.fbp[type_i][type_j] - [type_k][type_l].prm[0]); + /* pick l up from j-k interaction where k is the central atom */ + for (pl = start_pj; pl < end_pj; ++pl) { + p_jkl = &(thb_intrs->select.three_body_list[pl]); + l = p_jkl->thb; + plk = p_jkl->pthb; //pointer to l on k's bond_list! + pbond_kl = &(bonds->select.bond_list[plk]); + bo_kl = &(pbond_kl->bo_data); + type_l = system->my_atoms[l].type; + fbh = &(system->reax_param.fbp[type_i][type_j] + [type_k][type_l]); + fbp = &(system->reax_param.fbp[type_i][type_j] + [type_k][type_l].prm[0]); - if (i != l && fbh->cnt && - bo_kl->BO > control->thb_cut/*0*/ && - bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { - ++num_frb_intrs; - //fprintf(stderr, - // "%5d: %6d %6d %6d %6d\n", num_frb_intrs, - // system->my_atoms[i].orig_id,system->my_atoms[j].orig_id, - // system->my_atoms[k].orig_id,system->my_atoms[l].orig_id); + if (i != l && fbh->cnt && + bo_kl->BO > control->thb_cut/*0*/ && + bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { + ++num_frb_intrs; + //fprintf(stderr, + // "%5d: %6d %6d %6d %6d\n", num_frb_intrs, + // system->my_atoms[i].orig_id,system->my_atoms[j].orig_id, + // system->my_atoms[k].orig_id,system->my_atoms[l].orig_id); - r_kl = pbond_kl->d; - BOA_kl = bo_kl->BO - control->thb_cut; + r_kl = pbond_kl->d; + BOA_kl = bo_kl->BO - control->thb_cut; - theta_jkl = p_jkl->theta; - sin_jkl = sin( theta_jkl ); - cos_jkl = cos( theta_jkl ); - //tan_jkl_i = 1. / tan( theta_jkl ); - if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) - tan_jkl_i = cos_jkl / MIN_SINE; - else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) - tan_jkl_i = cos_jkl / -MIN_SINE; - else tan_jkl_i = cos_jkl /sin_jkl; + theta_jkl = p_jkl->theta; + sin_jkl = sin(theta_jkl); + cos_jkl = cos(theta_jkl); + //tan_jkl_i = 1. / tan(theta_jkl); + if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) + tan_jkl_i = cos_jkl / MIN_SINE; + else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) + tan_jkl_i = cos_jkl / -MIN_SINE; + else tan_jkl_i = cos_jkl /sin_jkl; - rvec_ScaledSum( dvec_li, 1., system->my_atoms[i].x, - -1., system->my_atoms[l].x ); - r_li = rvec_Norm( dvec_li ); + rvec_ScaledSum(dvec_li, 1., system->my_atoms[i].x, + -1., system->my_atoms[l].x); + r_li = rvec_Norm(dvec_li); - /* omega and its derivative */ - omega = Calculate_Omega( pbond_ij->dvec, r_ij, - pbond_jk->dvec, r_jk, - pbond_kl->dvec, r_kl, - dvec_li, r_li, - p_ijk, p_jkl, - dcos_omega_di, dcos_omega_dj, - dcos_omega_dk, dcos_omega_dl, - out_control ); + /* omega and its derivative */ + omega = Calculate_Omega(pbond_ij->dvec, r_ij, + pbond_jk->dvec, r_jk, + pbond_kl->dvec, r_kl, + dvec_li, r_li, + p_ijk, p_jkl, + dcos_omega_di, dcos_omega_dj, + dcos_omega_dk, dcos_omega_dl); - cos_omega = cos( omega ); - cos2omega = cos( 2. * omega ); - cos3omega = cos( 3. * omega ); - /* end omega calculations */ + cos_omega = cos(omega); + cos2omega = cos(2. * omega); + cos3omega = cos(3. * omega); + /* end omega calculations */ - /* torsion energy */ - exp_tor1 = exp( fbp->p_tor1 * - SQR(2.0 - bo_jk->BO_pi - f11_DjDk) ); - exp_tor2_kl = exp( -p_tor2 * BOA_kl ); - exp_cot2_kl = exp( -p_cot2 * SQR(BOA_kl - 1.5) ); - fn10 = (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * - (1.0 - exp_tor2_kl); + /* torsion energy */ + exp_tor1 = exp(fbp->p_tor1 * + SQR(2.0 - bo_jk->BO_pi - f11_DjDk)); + exp_tor2_kl = exp(-p_tor2 * BOA_kl); + exp_cot2_kl = exp(-p_cot2 * SQR(BOA_kl - 1.5)); + fn10 = (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * + (1.0 - exp_tor2_kl); - CV = 0.5 * ( fbp->V1 * (1.0 + cos_omega) + - fbp->V2 * exp_tor1 * (1.0 - cos2omega) + - fbp->V3 * (1.0 + cos3omega) ); + CV = 0.5 * (fbp->V1 * (1.0 + cos_omega) + + fbp->V2 * exp_tor1 * (1.0 - cos2omega) + + fbp->V3 * (1.0 + cos3omega)); - total_Etor += e_tor = fn10 * sin_ijk * sin_jkl * CV; + total_Etor += e_tor = fn10 * sin_ijk * sin_jkl * CV; - dfn11 = (-p_tor3 * exp_tor3_DjDk + - (p_tor3 * exp_tor3_DjDk - p_tor4 * exp_tor4_DjDk) * - (2.0 + exp_tor3_DjDk) * exp_tor34_inv) * - exp_tor34_inv; + dfn11 = (-p_tor3 * exp_tor3_DjDk + + (p_tor3 * exp_tor3_DjDk - p_tor4 * exp_tor4_DjDk) * + (2.0 + exp_tor3_DjDk) * exp_tor34_inv) * + exp_tor34_inv; - CEtors1 = sin_ijk * sin_jkl * CV; + CEtors1 = sin_ijk * sin_jkl * CV; - CEtors2 = -fn10 * 2.0 * fbp->p_tor1 * fbp->V2 * exp_tor1 * - (2.0 - bo_jk->BO_pi - f11_DjDk) * (1.0 - SQR(cos_omega)) * - sin_ijk * sin_jkl; - CEtors3 = CEtors2 * dfn11; + CEtors2 = -fn10 * 2.0 * fbp->p_tor1 * fbp->V2 * exp_tor1 * + (2.0 - bo_jk->BO_pi - f11_DjDk) * (1.0 - SQR(cos_omega)) * + sin_ijk * sin_jkl; + CEtors3 = CEtors2 * dfn11; - CEtors4 = CEtors1 * p_tor2 * exp_tor2_ij * - (1.0 - exp_tor2_jk) * (1.0 - exp_tor2_kl); - CEtors5 = CEtors1 * p_tor2 * - (1.0 - exp_tor2_ij) * exp_tor2_jk * (1.0 - exp_tor2_kl); - CEtors6 = CEtors1 * p_tor2 * - (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * exp_tor2_kl; + CEtors4 = CEtors1 * p_tor2 * exp_tor2_ij * + (1.0 - exp_tor2_jk) * (1.0 - exp_tor2_kl); + CEtors5 = CEtors1 * p_tor2 * + (1.0 - exp_tor2_ij) * exp_tor2_jk * (1.0 - exp_tor2_kl); + CEtors6 = CEtors1 * p_tor2 * + (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * exp_tor2_kl; - cmn = -fn10 * CV; - CEtors7 = cmn * sin_jkl * tan_ijk_i; - CEtors8 = cmn * sin_ijk * tan_jkl_i; + cmn = -fn10 * CV; + CEtors7 = cmn * sin_jkl * tan_ijk_i; + CEtors8 = cmn * sin_ijk * tan_jkl_i; - CEtors9 = fn10 * sin_ijk * sin_jkl * - (0.5 * fbp->V1 - 2.0 * fbp->V2 * exp_tor1 * cos_omega + - 1.5 * fbp->V3 * (cos2omega + 2.0 * SQR(cos_omega))); - /* end of torsion energy */ + CEtors9 = fn10 * sin_ijk * sin_jkl * + (0.5 * fbp->V1 - 2.0 * fbp->V2 * exp_tor1 * cos_omega + + 1.5 * fbp->V3 * (cos2omega + 2.0 * SQR(cos_omega))); + /* end of torsion energy */ - /* 4-body conjugation energy */ - fn12 = exp_cot2_ij * exp_cot2_jk * exp_cot2_kl; - //data->my_en.e_con += e_con = - total_Econ += e_con = - fbp->p_cot1 * fn12 * - (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); + /* 4-body conjugation energy */ + fn12 = exp_cot2_ij * exp_cot2_jk * exp_cot2_kl; + //data->my_en.e_con += e_con = + total_Econ += e_con = + fbp->p_cot1 * fn12 * + (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); - Cconj = -2.0 * fn12 * fbp->p_cot1 * p_cot2 * - (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); + Cconj = -2.0 * fn12 * fbp->p_cot1 * p_cot2 * + (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); - CEconj1 = Cconj * (BOA_ij - 1.5e0); - CEconj2 = Cconj * (BOA_jk - 1.5e0); - CEconj3 = Cconj * (BOA_kl - 1.5e0); + CEconj1 = Cconj * (BOA_ij - 1.5e0); + CEconj2 = Cconj * (BOA_jk - 1.5e0); + CEconj3 = Cconj * (BOA_kl - 1.5e0); - CEconj4 = -fbp->p_cot1 * fn12 * - (SQR(cos_omega) - 1.0) * sin_jkl * tan_ijk_i; - CEconj5 = -fbp->p_cot1 * fn12 * - (SQR(cos_omega) - 1.0) * sin_ijk * tan_jkl_i; - CEconj6 = 2.0 * fbp->p_cot1 * fn12 * - cos_omega * sin_ijk * sin_jkl; - /* end 4-body conjugation energy */ + CEconj4 = -fbp->p_cot1 * fn12 * + (SQR(cos_omega) - 1.0) * sin_jkl * tan_ijk_i; + CEconj5 = -fbp->p_cot1 * fn12 * + (SQR(cos_omega) - 1.0) * sin_ijk * tan_jkl_i; + CEconj6 = 2.0 * fbp->p_cot1 * fn12 * + cos_omega * sin_ijk * sin_jkl; + /* end 4-body conjugation energy */ - /* FORCES */ - bo_jk->Cdbopi += CEtors2; - workspace->CdDelta[j] += CEtors3; - //workspace->CdDelta[k] += CEtors3; - workspace->CdDeltaReduction[reductionOffset+k] += CEtors3; - bo_ij->Cdbo += (CEtors4 + CEconj1); - bo_jk->Cdbo += (CEtors5 + CEconj2); - //bo_kl->Cdbo += (CEtors6 + CEconj3); - bo_kl->CdboReduction[tid] += (CEtors6 + CEconj3); + /* FORCES */ + bo_jk->Cdbopi += CEtors2; + workspace->CdDelta[j] += CEtors3; + //workspace->CdDelta[k] += CEtors3; + workspace->CdDeltaReduction[reductionOffset+k] += CEtors3; + bo_ij->Cdbo += (CEtors4 + CEconj1); + bo_jk->Cdbo += (CEtors5 + CEconj2); + //bo_kl->Cdbo += (CEtors6 + CEconj3); + bo_kl->CdboReduction[tid] += (CEtors6 + CEconj3); - if (control->virial == 0) { - /* dcos_theta_ijk */ - rvec_ScaledAdd( workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+i], - CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k], - CEtors7 + CEconj4, p_ijk->dcos_di ); + if (control->virial == 0) { + /* dcos_theta_ijk */ + rvec_ScaledAdd(workspace->f[j], + CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], + CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors7 + CEconj4, p_ijk->dcos_di); - /* dcos_theta_jkl */ - rvec_ScaledAdd( workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k], - CEtors8 + CEconj5, p_jkl->dcos_dj ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+l], - CEtors8 + CEconj5, p_jkl->dcos_dk ); + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], + CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], + CEtors8 + CEconj5, p_jkl->dcos_dk); - /* dcos_omega */ - rvec_ScaledAdd( workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+i], - CEtors9 + CEconj6, dcos_omega_di ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k], - CEtors9 + CEconj6, dcos_omega_dk ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+l], - CEtors9 + CEconj6, dcos_omega_dl ); - } - else { - ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); + /* dcos_omega */ + rvec_ScaledAdd(workspace->f[j], + CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], + CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors9 + CEconj6, dcos_omega_dk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], + CEtors9 + CEconj6, dcos_omega_dl); + } + else { + ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); - /* dcos_theta_ijk */ - rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_Add( workspace->forceReduction[reductionOffset+i], force ); + /* dcos_theta_ijk */ + rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_Add(workspace->forceReduction[reductionOffset+i], force); - rvec_ScaledAdd( workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj ); + rvec_ScaledAdd(workspace->f[j], + CEtors7 + CEconj4, p_ijk->dcos_dj); - rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di ); - rvec_Add( workspace->forceReduction[reductionOffset+k], force ); + rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_di); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); - /* dcos_theta_jkl */ - rvec_ScaledAdd( workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di ); + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], + CEtors8 + CEconj5, p_jkl->dcos_di); - rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj ); - rvec_Add( workspace->forceReduction[reductionOffset+k], force ); + rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); - rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk ); - rvec_Add( workspace->forceReduction[reductionOffset+l], force ); + rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dk); + rvec_Add(workspace->forceReduction[reductionOffset+l], force); - /* dcos_omega */ - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di ); - rvec_Add( workspace->forceReduction[reductionOffset+i], force ); + /* dcos_omega */ + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_di); + rvec_Add(workspace->forceReduction[reductionOffset+i], force); - rvec_ScaledAdd( workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj ); + rvec_ScaledAdd(workspace->f[j], + CEtors9 + CEconj6, dcos_omega_dj); - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dk ); - rvec_Add( workspace->forceReduction[reductionOffset+k], force ); + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dk); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dl ); - rvec_Add( workspace->forceReduction[reductionOffset+i], force ); - } + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dl); + rvec_Add(workspace->forceReduction[reductionOffset+i], force); + } - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - // acquire vectors - rvec_ScaledSum( delil, 1., system->my_atoms[l].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( deljl, 1., system->my_atoms[l].x, - -1., system->my_atoms[j].x ); - rvec_ScaledSum( delkl, 1., system->my_atoms[l].x, - -1., system->my_atoms[k].x ); - // dcos_theta_ijk - rvec_Scale( fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_Scale( fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj ); - rvec_Scale( fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di ); + // acquire vectors + rvec_ScaledSum(delil, 1., system->my_atoms[l].x, + -1., system->my_atoms[i].x); + rvec_ScaledSum(deljl, 1., system->my_atoms[l].x, + -1., system->my_atoms[j].x); + rvec_ScaledSum(delkl, 1., system->my_atoms[l].x, + -1., system->my_atoms[k].x); + // dcos_theta_ijk + rvec_Scale(fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_Scale(fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_Scale(fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di); - // dcos_theta_jkl - rvec_ScaledAdd( fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di ); - rvec_ScaledAdd( fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj ); + // dcos_theta_jkl + rvec_ScaledAdd(fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj); - // dcos_omega - rvec_ScaledAdd( fi_tmp, CEtors9 + CEconj6, dcos_omega_di ); - rvec_ScaledAdd( fj_tmp, CEtors9 + CEconj6, dcos_omega_dj ); - rvec_ScaledAdd( fk_tmp, CEtors9 + CEconj6, dcos_omega_dk ); + // dcos_omega + rvec_ScaledAdd(fi_tmp, CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(fj_tmp, CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(fk_tmp, CEtors9 + CEconj6, dcos_omega_dk); - // tally - eng_tmp = e_tor + e_con; + // tally + eng_tmp = e_tor + e_con; - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, k, system->n, 1, - eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + if (system->pair_ptr->evflag) + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, k, system->n, 1, + eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - // NEED TO MAKE AN OMP VERSION OF THIS CALL! - if (system->pair_ptr->vflag_atom) - system->pair_ptr->v_tally4(i, j, k, l, fi_tmp, fj_tmp, fk_tmp, - delil, deljl, delkl ); - } + // NEED TO MAKE AN OMP VERSION OF THIS CALL! + if (system->pair_ptr->vflag_atom) + system->pair_ptr->v_tally4(i, j, k, l, fi_tmp, fj_tmp, fk_tmp, + delil, deljl, delkl); + } - } // pl check ends - } // pl loop ends - } // pi check ends - } // pi loop ends - } // k-j neighbor check ends - } // jmy_en.e_tor = total_Etor; - data->my_en.e_con = total_Econ; - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTETORSIONANGLESBOINDEX] += (endTimeBase-startTimeBase); -#endif + data->my_en.e_tor = total_Etor; + data->my_en.e_con = total_Econ; + } } diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.h b/src/USER-OMP/reaxc_torsion_angles_omp.h deleted file mode 100644 index 62cb760f41..0000000000 --- a/src/USER-OMP/reaxc_torsion_angles_omp.h +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __TORSION_ANGLES_OMP_H_ -#define __TORSION_ANGLES_OMP_H_ - -#include "reaxc_types.h" -#include "reaxc_torsion_angles.h" - -void Torsion_AnglesOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 167f647790..4719fcfbab 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -26,583 +26,561 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_valence_angles_omp.h" +#include "reaxff_omp.h" #include "error.h" #include "fix_omp.h" #include "pair_reaxc_omp.h" - -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_valence_angles.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" #include -#if defined(_OPENMP) -#include -#endif - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -void Calculate_dCos_ThetaOMP( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, - rvec* dcos_theta_di, - rvec* dcos_theta_dj, - rvec* dcos_theta_dk ) -{ - double sqr_d_ji = SQR(d_ji); - double sqr_d_jk = SQR(d_jk); - double inv_dists = 1.0 / (d_ji * d_jk); - double inv_dists3 = inv_dists * inv_dists * inv_dists; - double dot_dvecs = dvec_ji[0]*dvec_jk[0] + dvec_ji[1]*dvec_jk[1] + dvec_ji[2]*dvec_jk[2]; - double Cdot_inv3 = dot_dvecs * inv_dists3; +namespace ReaxFF { + void Calculate_dCos_ThetaOMP(rvec dvec_ji, double d_ji, rvec dvec_jk, + double d_jk, rvec *dcos_theta_di, + rvec *dcos_theta_dj, rvec *dcos_theta_dk) + { + double sqr_d_ji = SQR(d_ji); + double sqr_d_jk = SQR(d_jk); + double inv_dists = 1.0 / (d_ji * d_jk); + double inv_dists3 = inv_dists * inv_dists * inv_dists; + double dot_dvecs = dvec_ji[0]*dvec_jk[0] + dvec_ji[1]*dvec_jk[1] + dvec_ji[2]*dvec_jk[2]; + double Cdot_inv3 = dot_dvecs * inv_dists3; - double csqr_jk = Cdot_inv3 * sqr_d_jk; - double csqr_ji = Cdot_inv3 * sqr_d_ji; + double csqr_jk = Cdot_inv3 * sqr_d_jk; + double csqr_ji = Cdot_inv3 * sqr_d_ji; - // Try to help compiler out by unrolling - // x-component - double dinv_jk = dvec_jk[0] * inv_dists; - double dinv_ji = dvec_ji[0] * inv_dists; + // Try to help compiler out by unrolling + // x-component + double dinv_jk = dvec_jk[0] * inv_dists; + double dinv_ji = dvec_ji[0] * inv_dists; - double cdev_ji = csqr_jk * dvec_ji[0]; - double cdev_jk = csqr_ji * dvec_jk[0]; + double cdev_ji = csqr_jk * dvec_ji[0]; + double cdev_jk = csqr_ji * dvec_jk[0]; - (*dcos_theta_di)[0] = dinv_jk - cdev_ji; - (*dcos_theta_dj)[0] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; - (*dcos_theta_dk)[0] = dinv_ji - cdev_jk; + (*dcos_theta_di)[0] = dinv_jk - cdev_ji; + (*dcos_theta_dj)[0] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; + (*dcos_theta_dk)[0] = dinv_ji - cdev_jk; - // y-component - dinv_jk = dvec_jk[1] * inv_dists; - dinv_ji = dvec_ji[1] * inv_dists; + // y-component + dinv_jk = dvec_jk[1] * inv_dists; + dinv_ji = dvec_ji[1] * inv_dists; - cdev_ji = csqr_jk * dvec_ji[1]; - cdev_jk = csqr_ji * dvec_jk[1]; + cdev_ji = csqr_jk * dvec_ji[1]; + cdev_jk = csqr_ji * dvec_jk[1]; - (*dcos_theta_di)[1] = dinv_jk - cdev_ji; - (*dcos_theta_dj)[1] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; - (*dcos_theta_dk)[1] = dinv_ji - cdev_jk; + (*dcos_theta_di)[1] = dinv_jk - cdev_ji; + (*dcos_theta_dj)[1] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; + (*dcos_theta_dk)[1] = dinv_ji - cdev_jk; - // z-component - dinv_jk = dvec_jk[2] * inv_dists; - dinv_ji = dvec_ji[2] * inv_dists; + // z-component + dinv_jk = dvec_jk[2] * inv_dists; + dinv_ji = dvec_ji[2] * inv_dists; - cdev_ji = csqr_jk * dvec_ji[2]; - cdev_jk = csqr_ji * dvec_jk[2]; + cdev_ji = csqr_jk * dvec_ji[2]; + cdev_jk = csqr_ji * dvec_jk[2]; - (*dcos_theta_di)[2] = dinv_jk - cdev_ji; - (*dcos_theta_dj)[2] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; - (*dcos_theta_dk)[2] = dinv_ji - cdev_jk; -} + (*dcos_theta_di)[2] = dinv_jk - cdev_ji; + (*dcos_theta_dj)[2] = -(dinv_jk + dinv_ji) + cdev_ji + cdev_jk; + (*dcos_theta_dk)[2] = dinv_ji - cdev_jk; + } -/* ---------------------------------------------------------------------- */ + /* ---------------------------------------------------------------------- */ -/* this is a 3-body interaction in which the main role is - played by j which sits in the middle of the other two. */ -void Valence_AnglesOMP( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /* out_control */) -{ + /* this is a 3-body interaction in which the main role is + played by j which sits in the middle of the other two. */ + void Valence_AnglesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + reax_list *bonds = (*lists) + BONDS; + reax_list *thb_intrs = (*lists) + THREE_BODIES; -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif + // Precompute and store valence_angle offsets for OpenMP code. + int * _my_offset = workspace->valence_angle_atom_myoffset; - reax_list *bonds = (*lists) + BONDS; - reax_list *thb_intrs = (*lists) + THREE_BODIES; + /* global parameters used in these calculations */ + double p_val6 = system->reax_param.gp.l[14]; + double p_val8 = system->reax_param.gp.l[33]; + double p_val9 = system->reax_param.gp.l[16]; + double p_val10 = system->reax_param.gp.l[17]; + double total_Eang = 0; + double total_Epen = 0; + double total_Ecoa = 0; - // Precompute and store valence_angle offsets for OpenMP code. - int * _my_offset = workspace->valence_angle_atom_myoffset; - - /* global parameters used in these calculations */ - double p_val6 = system->reax_param.gp.l[14]; - double p_val8 = system->reax_param.gp.l[33]; - double p_val9 = system->reax_param.gp.l[16]; - double p_val10 = system->reax_param.gp.l[17]; - double total_Eang = 0; - double total_Epen = 0; - double total_Ecoa = 0; - - int nthreads = control->nthreads; - int num_thb_intrs = 0; - int TWICE = 2; + int nthreads = control->nthreads; + int num_thb_intrs = 0; + int TWICE = 2; #if defined(_OPENMP) #pragma omp parallel default(shared) reduction(+:total_Eang, total_Epen, total_Ecoa, num_thb_intrs) #endif - { - int i, j, pi, k, pk, t; - int type_i, type_j, type_k; - int start_j, end_j, start_pk, end_pk; - int cnt, my_offset; + { + int i, j, pi, k, pk, t; + int type_i, type_j, type_k; + int start_j, end_j, start_pk, end_pk; + int cnt, my_offset; - double temp, temp_bo_jt, pBOjt7; - double p_val1, p_val2, p_val3, p_val4, p_val5, p_val7; - double p_pen1, p_pen2, p_pen3, p_pen4; - double p_coa1, p_coa2, p_coa3, p_coa4; - double trm8, expval6, expval7, expval2theta, expval12theta, exp3ij, exp3jk; - double exp_pen2ij, exp_pen2jk, exp_pen3, exp_pen4, trm_pen34, exp_coa2; - double dSBO1, dSBO2, SBO, SBO2, CSBO2, SBOp, prod_SBO, vlpadj; - double CEval1, CEval2, CEval3, CEval4, CEval5, CEval6, CEval7, CEval8; - double CEpen1, CEpen2, CEpen3; - double e_ang, e_coa, e_pen; - double CEcoa1, CEcoa2, CEcoa3, CEcoa4, CEcoa5; - double Cf7ij, Cf7jk, Cf8j, Cf9j; - double f7_ij, f7_jk, f8_Dj, f9_Dj; - double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; - double BOA_ij, BOA_jk; - rvec force; + double temp, temp_bo_jt, pBOjt7; + double p_val1, p_val2, p_val3, p_val4, p_val5, p_val7; + double p_pen1, p_pen2, p_pen3, p_pen4; + double p_coa1, p_coa2, p_coa3, p_coa4; + double trm8, expval6, expval7, expval2theta, expval12theta, exp3ij, exp3jk; + double exp_pen2ij, exp_pen2jk, exp_pen3, exp_pen4, trm_pen34, exp_coa2; + double dSBO1, dSBO2, SBO, SBO2, CSBO2, SBOp, prod_SBO, vlpadj; + double CEval1, CEval2, CEval3, CEval4, CEval5, CEval6, CEval7, CEval8; + double CEpen1, CEpen2, CEpen3; + double e_ang, e_coa, e_pen; + double CEcoa1, CEcoa2, CEcoa3, CEcoa4, CEcoa5; + double Cf7ij, Cf7jk, Cf8j, Cf9j; + double f7_ij, f7_jk, f8_Dj, f9_Dj; + double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; + double BOA_ij, BOA_jk; + rvec force; - // Tallying variables - double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; - double delij[3], delkj[3]; + // Tallying variables + double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; + double delij[3], delkj[3]; - three_body_header *thbh; - three_body_parameters *thbp; - three_body_interaction_data *p_ijk, *p_kji; - bond_data *pbond_ij, *pbond_jk, *pbond_jt; - bond_order_data *bo_ij, *bo_jk, *bo_jt; + three_body_header *thbh; + three_body_parameters *thbp; + three_body_interaction_data *p_ijk, *p_kji; + bond_data *pbond_ij, *pbond_jk, *pbond_jt; + bond_order_data *bo_ij, *bo_jk, *bo_jt; -#if defined(_OPENMP) - int tid = omp_get_thread_num(); -#else - int tid = 0; -#endif - long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); - class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + int tid = get_tid(); - // Run through a minimal for (jN * tid); + class PairReaxCOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); + class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - const int per_thread = thb_intrs->num_intrs / nthreads; + // Run through a minimal for (jnum_intrs / nthreads; #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for (j = 0; j < system->N; ++j) { - type_j = system->my_atoms[j].type; - _my_offset[j] = 0; - if (type_j < 0) continue; + for (j = 0; j < system->N; ++j) { + type_j = system->my_atoms[j].type; + _my_offset[j] = 0; + if (type_j < 0) continue; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); - // Always point to start of workspace to count angles - my_offset = tid * per_thread; + // Always point to start of workspace to count angles + my_offset = tid * per_thread; - for (pi = start_j; pi < end_j; ++pi) { - Set_Start_Index( pi, my_offset, thb_intrs ); - pbond_ij = &(bonds->select.bond_list[pi]); - bo_ij = &(pbond_ij->bo_data); - BOA_ij = bo_ij->BO - control->thb_cut; + for (pi = start_j; pi < end_j; ++pi) { + Set_Start_Index(pi, my_offset, thb_intrs); + pbond_ij = &(bonds->select.bond_list[pi]); + bo_ij = &(pbond_ij->bo_data); + BOA_ij = bo_ij->BO - control->thb_cut; - if (BOA_ij > 0.0) { - i = pbond_ij->nbr; + if (BOA_ij > 0.0) { + i = pbond_ij->nbr; - /* first copy 3-body intrs from previously computed ones where i>k. - in the second for-loop below, - we compute only new 3-body intrs where i < k */ - for (pk = start_j; pk < pi; ++pk) { - start_pk = Start_Index( pk, thb_intrs ); - end_pk = End_Index( pk, thb_intrs ); + /* first copy 3-body intrs from previously computed ones where i>k. + in the second for-loop below, + we compute only new 3-body intrs where i < k */ + for (pk = start_j; pk < pi; ++pk) { + start_pk = Start_Index(pk, thb_intrs); + end_pk = End_Index(pk, thb_intrs); - for (t = start_pk; t < end_pk; ++t) - if (thb_intrs->select.three_body_list[t].thb == i) { + for (t = start_pk; t < end_pk; ++t) + if (thb_intrs->select.three_body_list[t].thb == i) { - p_ijk = &(thb_intrs->select.three_body_list[my_offset] ); - p_ijk->thb = bonds->select.bond_list[pk].nbr; + p_ijk = &(thb_intrs->select.three_body_list[my_offset]); + p_ijk->thb = bonds->select.bond_list[pk].nbr; - ++my_offset; - break; - } - } // for (pk) + ++my_offset; + break; + } + } // for (pk) - /* and this is the second for loop mentioned above */ - for (pk = pi+1; pk < end_j; ++pk) { - pbond_jk = &(bonds->select.bond_list[pk]); - k = pbond_jk->nbr; + /* and this is the second for loop mentioned above */ + for (pk = pi+1; pk < end_j; ++pk) { + pbond_jk = &(bonds->select.bond_list[pk]); + k = pbond_jk->nbr; - if (j >= system->n && i >= system->n && k >= system->n) continue; + if (j >= system->n && i >= system->n && k >= system->n) continue; - p_ijk = &( thb_intrs->select.three_body_list[my_offset] ); - p_ijk->thb = k; + p_ijk = &(thb_intrs->select.three_body_list[my_offset]); + p_ijk->thb = k; - ++my_offset; // add this to the list of 3-body interactions - } // for (pk) - } // if () + ++my_offset; // add this to the list of 3-body interactions + } // for (pk) + } // if () - Set_End_Index(pi, my_offset, thb_intrs ); - } // for (pi) + Set_End_Index(pi, my_offset, thb_intrs); + } // for (pi) - // Confirm that thb_intrs->num_intrs / nthreads is enough to hold all angles from a single atom - if (my_offset >= (tid+1)*per_thread) - control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " - "angle_list for atom {}:\n" - " nthreads={} tid={} my_offset={} per_thread={}\n" - " num_intrs={} N={}",data->step,j,nthreads,tid, - my_offset,per_thread,thb_intrs->num_intrs,system->N)); - // Number of angles owned by this atom - _my_offset[j] = my_offset - tid * per_thread; - } // for (j) + // Confirm that thb_intrs->num_intrs / nthreads is enough to hold all angles from a single atom + if (my_offset >= (tid+1)*per_thread) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list for atom {}:\n" + " nthreads={} tid={} my_offset={} per_thread={}\n" + " num_intrs={} N={}",data->step,j,nthreads,tid, + my_offset,per_thread,thb_intrs->num_intrs,system->N)); + // Number of angles owned by this atom + _my_offset[j] = my_offset - tid * per_thread; + } // for (j) - // Wait for all threads to finish counting angles + // Wait for all threads to finish counting angles #if defined(_OPENMP) && !defined(__NVCC__) #pragma omp barrier #endif - // Master thread uses angle counts to compute offsets - // This can be threaded + // Master thread uses angle counts to compute offsets + // This can be threaded #if defined(_OPENMP) && !defined(__NVCC__) #pragma omp master #endif - { - int current_count = 0; - int m = _my_offset[0]; - _my_offset[0] = current_count; - for (j=1; jN; j++) { - current_count+= m; - m = _my_offset[j]; - _my_offset[j] = current_count; + { + int current_count = 0; + int m = _my_offset[0]; + _my_offset[0] = current_count; + for (j=1; jN; j++) { + current_count+= m; + m = _my_offset[j]; + _my_offset[j] = current_count; + } + _my_offset[system->N] = current_count + m; // Used to test if last particle has any angles } - _my_offset[system->N] = current_count + m; // Used to test if last particle has any angles - } - // All threads wait till master thread finished computing offsets + // All threads wait till master thread finished computing offsets #if defined(_OPENMP) && !defined(__NVCC__) #pragma omp barrier #endif - // Original loop, but now using precomputed offsets - // Safe to use all threads available, regardless of threads tasked above - // We also now skip over atoms that have no angles assigned + // Original loop, but now using precomputed offsets + // Safe to use all threads available, regardless of threads tasked above + // We also now skip over atoms that have no angles assigned #if defined(_OPENMP) #pragma omp for schedule(dynamic,50)//(dynamic,chunksize)//(guided) #endif - for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; + for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; - // Skip if no angles for this atom - if (_my_offset[j] == _my_offset[j+1]) continue; + // Skip if no angles for this atom + if (_my_offset[j] == _my_offset[j+1]) continue; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); - type_j = system->my_atoms[j].type; + type_j = system->my_atoms[j].type; - my_offset = _my_offset[j]; + my_offset = _my_offset[j]; - p_val3 = system->reax_param.sbp[ type_j ].p_val3; - p_val5 = system->reax_param.sbp[ type_j ].p_val5; + p_val3 = system->reax_param.sbp[ type_j ].p_val3; + p_val5 = system->reax_param.sbp[ type_j ].p_val5; - SBOp = 0, prod_SBO = 1; - for (t = start_j; t < end_j; ++t) { - bo_jt = &(bonds->select.bond_list[t].bo_data); - SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); - temp = SQR( bo_jt->BO ); - temp *= temp; - temp *= temp; - prod_SBO *= exp( -temp ); - } + SBOp = 0, prod_SBO = 1; + for (t = start_j; t < end_j; ++t) { + bo_jt = &(bonds->select.bond_list[t].bo_data); + SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); + temp = SQR(bo_jt->BO); + temp *= temp; + temp *= temp; + prod_SBO *= exp(-temp); + } - // modifications to match Adri's code - 09/01/09 - if (workspace->vlpex[j] >= 0) { - vlpadj = 0; - dSBO2 = prod_SBO - 1; - } else { - vlpadj = workspace->nlp[j]; - dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]); - } + // modifications to match Adri's code - 09/01/09 + if (workspace->vlpex[j] >= 0) { + vlpadj = 0; + dSBO2 = prod_SBO - 1; + } else { + vlpadj = workspace->nlp[j]; + dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]); + } - SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); - dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj ); + SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); + dSBO1 = -8 * prod_SBO * (workspace->Delta_boc[j] + p_val8 * vlpadj); - if (SBO <= 0) - SBO2 = 0, CSBO2 = 0; - else if (SBO > 0 && SBO <= 1) { - SBO2 = pow( SBO, p_val9 ); - CSBO2 = p_val9 * pow( SBO, p_val9 - 1 ); - } - else if (SBO > 1 && SBO < 2) { - SBO2 = 2 - pow( 2-SBO, p_val9 ); - CSBO2 = p_val9 * pow( 2 - SBO, p_val9 - 1 ); - } - else - SBO2 = 2, CSBO2 = 0; + if (SBO <= 0) + SBO2 = 0, CSBO2 = 0; + else if (SBO > 0 && SBO <= 1) { + SBO2 = pow(SBO, p_val9); + CSBO2 = p_val9 * pow(SBO, p_val9 - 1); + } + else if (SBO > 1 && SBO < 2) { + SBO2 = 2 - pow(2-SBO, p_val9); + CSBO2 = p_val9 * pow(2 - SBO, p_val9 - 1); + } + else + SBO2 = 2, CSBO2 = 0; - expval6 = exp( p_val6 * workspace->Delta_boc[j] ); + expval6 = exp(p_val6 * workspace->Delta_boc[j]); - for (pi = start_j; pi < end_j; ++pi) { - Set_Start_Index( pi, my_offset, thb_intrs ); - pbond_ij = &(bonds->select.bond_list[pi]); - bo_ij = &(pbond_ij->bo_data); - BOA_ij = bo_ij->BO - control->thb_cut; + for (pi = start_j; pi < end_j; ++pi) { + Set_Start_Index(pi, my_offset, thb_intrs); + pbond_ij = &(bonds->select.bond_list[pi]); + bo_ij = &(pbond_ij->bo_data); + BOA_ij = bo_ij->BO - control->thb_cut; - if (BOA_ij > 0.0) { - i = pbond_ij->nbr; - type_i = system->my_atoms[i].type; + if (BOA_ij > 0.0) { + i = pbond_ij->nbr; + type_i = system->my_atoms[i].type; - /* first copy 3-body intrs from previously computed ones where i>k. - in the second for-loop below, - we compute only new 3-body intrs where i < k */ - for (pk = start_j; pk < pi; ++pk) { - start_pk = Start_Index( pk, thb_intrs ); - end_pk = End_Index( pk, thb_intrs ); + /* first copy 3-body intrs from previously computed ones where i>k. + in the second for-loop below, + we compute only new 3-body intrs where i < k */ + for (pk = start_j; pk < pi; ++pk) { + start_pk = Start_Index(pk, thb_intrs); + end_pk = End_Index(pk, thb_intrs); - for (t = start_pk; t < end_pk; ++t) - if (thb_intrs->select.three_body_list[t].thb == i) { - p_ijk = &(thb_intrs->select.three_body_list[my_offset] ); - p_kji = &(thb_intrs->select.three_body_list[t]); + for (t = start_pk; t < end_pk; ++t) + if (thb_intrs->select.three_body_list[t].thb == i) { + p_ijk = &(thb_intrs->select.three_body_list[my_offset]); + p_kji = &(thb_intrs->select.three_body_list[t]); - p_ijk->thb = bonds->select.bond_list[pk].nbr; - p_ijk->pthb = pk; - p_ijk->theta = p_kji->theta; - rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk ); - rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj ); - rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di ); + p_ijk->thb = bonds->select.bond_list[pk].nbr; + p_ijk->pthb = pk; + p_ijk->theta = p_kji->theta; + rvec_Copy(p_ijk->dcos_di, p_kji->dcos_dk); + rvec_Copy(p_ijk->dcos_dj, p_kji->dcos_dj); + rvec_Copy(p_ijk->dcos_dk, p_kji->dcos_di); - ++my_offset; - ++num_thb_intrs; - break; - } - } // for (pk) + ++my_offset; + ++num_thb_intrs; + break; + } + } // for (pk) - /* and this is the second for loop mentioned above */ - for (pk = pi+1; pk < end_j; ++pk) { - pbond_jk = &(bonds->select.bond_list[pk]); - bo_jk = &(pbond_jk->bo_data); - BOA_jk = bo_jk->BO - control->thb_cut; - k = pbond_jk->nbr; - type_k = system->my_atoms[k].type; - p_ijk = &( thb_intrs->select.three_body_list[my_offset] ); + /* and this is the second for loop mentioned above */ + for (pk = pi+1; pk < end_j; ++pk) { + pbond_jk = &(bonds->select.bond_list[pk]); + bo_jk = &(pbond_jk->bo_data); + BOA_jk = bo_jk->BO - control->thb_cut; + k = pbond_jk->nbr; + type_k = system->my_atoms[k].type; + p_ijk = &(thb_intrs->select.three_body_list[my_offset]); - // Fix by Sudhir - // if (BOA_jk <= 0) continue; - if (j >= system->n && i >= system->n && k >= system->n) continue; + // Fix by Sudhir + // if (BOA_jk <= 0) continue; + if (j >= system->n && i >= system->n && k >= system->n) continue; - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, - pbond_jk->dvec, pbond_jk->d, - &theta, &cos_theta ); + Calculate_Theta(pbond_ij->dvec, pbond_ij->d, + pbond_jk->dvec, pbond_jk->d, + &theta, &cos_theta); - Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d, - pbond_jk->dvec, pbond_jk->d, - &(p_ijk->dcos_di), &(p_ijk->dcos_dj), - &(p_ijk->dcos_dk) ); - p_ijk->thb = k; - p_ijk->pthb = pk; - p_ijk->theta = theta; + Calculate_dCos_ThetaOMP(pbond_ij->dvec, pbond_ij->d, + pbond_jk->dvec, pbond_jk->d, + &(p_ijk->dcos_di), &(p_ijk->dcos_dj), + &(p_ijk->dcos_dk)); + p_ijk->thb = k; + p_ijk->pthb = pk; + p_ijk->theta = theta; - sin_theta = sin( theta ); - if (sin_theta < 1.0e-5) - sin_theta = 1.0e-5; + sin_theta = sin(theta); + if (sin_theta < 1.0e-5) + sin_theta = 1.0e-5; - ++my_offset; // add this to the list of 3-body interactions - ++num_thb_intrs; + ++my_offset; // add this to the list of 3-body interactions + ++num_thb_intrs; - if ((j < system->n) && (BOA_jk > 0.0) && - (bo_ij->BO > control->thb_cut) && - (bo_jk->BO > control->thb_cut) && - (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { - thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] ); + if ((j < system->n) && (BOA_jk > 0.0) && + (bo_ij->BO > control->thb_cut) && + (bo_jk->BO > control->thb_cut) && + (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { + thbh = &(system->reax_param.thbp[ type_i ][ type_j ][ type_k ]); - for (cnt = 0; cnt < thbh->cnt; ++cnt) { + for (cnt = 0; cnt < thbh->cnt; ++cnt) { - if (fabs(thbh->prm[cnt].p_val1) > 0.001) { - thbp = &( thbh->prm[cnt] ); + if (fabs(thbh->prm[cnt].p_val1) > 0.001) { + thbp = &(thbh->prm[cnt]); - /* ANGLE ENERGY */ - p_val1 = thbp->p_val1; - p_val2 = thbp->p_val2; - p_val4 = thbp->p_val4; - p_val7 = thbp->p_val7; - theta_00 = thbp->theta_00; + /* ANGLE ENERGY */ + p_val1 = thbp->p_val1; + p_val2 = thbp->p_val2; + p_val4 = thbp->p_val4; + p_val7 = thbp->p_val7; + theta_00 = thbp->theta_00; - exp3ij = exp( -p_val3 * pow( BOA_ij, p_val4 ) ); - f7_ij = 1.0 - exp3ij; - Cf7ij = p_val3 * p_val4 * pow( BOA_ij, p_val4 - 1.0 ) * exp3ij; + exp3ij = exp(-p_val3 * pow(BOA_ij, p_val4)); + f7_ij = 1.0 - exp3ij; + Cf7ij = p_val3 * p_val4 * pow(BOA_ij, p_val4 - 1.0) * exp3ij; - exp3jk = exp( -p_val3 * pow( BOA_jk, p_val4 ) ); - f7_jk = 1.0 - exp3jk; - Cf7jk = p_val3 * p_val4 * pow( BOA_jk, p_val4 - 1.0 ) * exp3jk; + exp3jk = exp(-p_val3 * pow(BOA_jk, p_val4)); + f7_jk = 1.0 - exp3jk; + Cf7jk = p_val3 * p_val4 * pow(BOA_jk, p_val4 - 1.0) * exp3jk; - expval7 = exp( -p_val7 * workspace->Delta_boc[j] ); - trm8 = 1.0 + expval6 + expval7; - f8_Dj = p_val5 - ( (p_val5 - 1.0) * (2.0 + expval6) / trm8 ); - Cf8j = ( (1.0 - p_val5) / SQR(trm8) ) * - ( p_val6 * expval6 * trm8 - - (2.0 + expval6) * ( p_val6*expval6 - p_val7*expval7 ) ); + expval7 = exp(-p_val7 * workspace->Delta_boc[j]); + trm8 = 1.0 + expval6 + expval7; + f8_Dj = p_val5 - ((p_val5 - 1.0) * (2.0 + expval6) / trm8); + Cf8j = ((1.0 - p_val5) / SQR(trm8)) * + (p_val6 * expval6 * trm8 - + (2.0 + expval6) * (p_val6*expval6 - p_val7*expval7)); - theta_0 = 180.0 - theta_00 * (1.0 - - exp(-p_val10 * (2.0 - SBO2))); - theta_0 = DEG2RAD( theta_0 ); + theta_0 = 180.0 - theta_00 * (1.0 - + exp(-p_val10 * (2.0 - SBO2))); + theta_0 = DEG2RAD(theta_0); - expval2theta = exp( -p_val2 * SQR(theta_0 - theta) ); - if (p_val1 >= 0) - expval12theta = p_val1 * (1.0 - expval2theta); - else // To avoid linear Me-H-Me angles (6/6/06) - expval12theta = p_val1 * -expval2theta; + expval2theta = exp(-p_val2 * SQR(theta_0 - theta)); + if (p_val1 >= 0) + expval12theta = p_val1 * (1.0 - expval2theta); + else // To avoid linear Me-H-Me angles (6/6/06) + expval12theta = p_val1 * -expval2theta; - CEval1 = Cf7ij * f7_jk * f8_Dj * expval12theta; - CEval2 = Cf7jk * f7_ij * f8_Dj * expval12theta; - CEval3 = Cf8j * f7_ij * f7_jk * expval12theta; - CEval4 = -2.0 * p_val1 * p_val2 * f7_ij * f7_jk * f8_Dj * - expval2theta * (theta_0 - theta); + CEval1 = Cf7ij * f7_jk * f8_Dj * expval12theta; + CEval2 = Cf7jk * f7_ij * f8_Dj * expval12theta; + CEval3 = Cf8j * f7_ij * f7_jk * expval12theta; + CEval4 = -2.0 * p_val1 * p_val2 * f7_ij * f7_jk * f8_Dj * + expval2theta * (theta_0 - theta); - Ctheta_0 = p_val10 * DEG2RAD(theta_00) * - exp( -p_val10 * (2.0 - SBO2) ); + Ctheta_0 = p_val10 * DEG2RAD(theta_00) * + exp(-p_val10 * (2.0 - SBO2)); - CEval5 = -CEval4 * Ctheta_0 * CSBO2; - CEval6 = CEval5 * dSBO1; - CEval7 = CEval5 * dSBO2; - CEval8 = -CEval4 / sin_theta; + CEval5 = -CEval4 * Ctheta_0 * CSBO2; + CEval6 = CEval5 * dSBO1; + CEval7 = CEval5 * dSBO2; + CEval8 = -CEval4 / sin_theta; - total_Eang += e_ang = - f7_ij * f7_jk * f8_Dj * expval12theta; - /* END ANGLE ENERGY*/ + total_Eang += e_ang = + f7_ij * f7_jk * f8_Dj * expval12theta; + /* END ANGLE ENERGY*/ - /* PENALTY ENERGY */ - p_pen1 = thbp->p_pen1; - p_pen2 = system->reax_param.gp.l[19]; - p_pen3 = system->reax_param.gp.l[20]; - p_pen4 = system->reax_param.gp.l[21]; + /* PENALTY ENERGY */ + p_pen1 = thbp->p_pen1; + p_pen2 = system->reax_param.gp.l[19]; + p_pen3 = system->reax_param.gp.l[20]; + p_pen4 = system->reax_param.gp.l[21]; - exp_pen2ij = exp( -p_pen2 * SQR( BOA_ij - 2.0 ) ); - exp_pen2jk = exp( -p_pen2 * SQR( BOA_jk - 2.0 ) ); - exp_pen3 = exp( -p_pen3 * workspace->Delta[j] ); - exp_pen4 = exp( p_pen4 * workspace->Delta[j] ); - trm_pen34 = 1.0 + exp_pen3 + exp_pen4; - f9_Dj = ( 2.0 + exp_pen3 ) / trm_pen34; - Cf9j = ( -p_pen3 * exp_pen3 * trm_pen34 - - (2.0 + exp_pen3) * ( -p_pen3 * exp_pen3 + - p_pen4 * exp_pen4 ) ) / - SQR( trm_pen34 ); + exp_pen2ij = exp(-p_pen2 * SQR(BOA_ij - 2.0)); + exp_pen2jk = exp(-p_pen2 * SQR(BOA_jk - 2.0)); + exp_pen3 = exp(-p_pen3 * workspace->Delta[j]); + exp_pen4 = exp( p_pen4 * workspace->Delta[j]); + trm_pen34 = 1.0 + exp_pen3 + exp_pen4; + f9_Dj = (2.0 + exp_pen3) / trm_pen34; + Cf9j = (-p_pen3 * exp_pen3 * trm_pen34 - + (2.0 + exp_pen3) * (-p_pen3 * exp_pen3 + + p_pen4 * exp_pen4)) / + SQR(trm_pen34); - total_Epen += e_pen = - p_pen1 * f9_Dj * exp_pen2ij * exp_pen2jk; + total_Epen += e_pen = + p_pen1 * f9_Dj * exp_pen2ij * exp_pen2jk; - CEpen1 = e_pen * Cf9j / f9_Dj; - temp = -2.0 * p_pen2 * e_pen; - CEpen2 = temp * (BOA_ij - 2.0); - CEpen3 = temp * (BOA_jk - 2.0); - /* END PENALTY ENERGY */ + CEpen1 = e_pen * Cf9j / f9_Dj; + temp = -2.0 * p_pen2 * e_pen; + CEpen2 = temp * (BOA_ij - 2.0); + CEpen3 = temp * (BOA_jk - 2.0); + /* END PENALTY ENERGY */ - /* COALITION ENERGY */ - p_coa1 = thbp->p_coa1; - p_coa2 = system->reax_param.gp.l[2]; - p_coa3 = system->reax_param.gp.l[38]; - p_coa4 = system->reax_param.gp.l[30]; + /* COALITION ENERGY */ + p_coa1 = thbp->p_coa1; + p_coa2 = system->reax_param.gp.l[2]; + p_coa3 = system->reax_param.gp.l[38]; + p_coa4 = system->reax_param.gp.l[30]; - exp_coa2 = exp( p_coa2 * workspace->Delta_val[j] ); - total_Ecoa += e_coa = - p_coa1 / (1. + exp_coa2) * - exp( -p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij) ) * - exp( -p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk) ) * - exp( -p_coa4 * SQR(BOA_ij - 1.5) ) * - exp( -p_coa4 * SQR(BOA_jk - 1.5) ); + exp_coa2 = exp(p_coa2 * workspace->Delta_val[j]); + total_Ecoa += e_coa = + p_coa1 / (1. + exp_coa2) * + exp(-p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij)) * + exp(-p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk)) * + exp(-p_coa4 * SQR(BOA_ij - 1.5)) * + exp(-p_coa4 * SQR(BOA_jk - 1.5)); - CEcoa1 = -2 * p_coa4 * (BOA_ij - 1.5) * e_coa; - CEcoa2 = -2 * p_coa4 * (BOA_jk - 1.5) * e_coa; - CEcoa3 = -p_coa2 * exp_coa2 * e_coa / (1 + exp_coa2); - CEcoa4 = -2 * p_coa3 * - (workspace->total_bond_order[i]-BOA_ij) * e_coa; - CEcoa5 = -2 * p_coa3 * - (workspace->total_bond_order[k]-BOA_jk) * e_coa; - /* END COALITION ENERGY */ + CEcoa1 = -2 * p_coa4 * (BOA_ij - 1.5) * e_coa; + CEcoa2 = -2 * p_coa4 * (BOA_jk - 1.5) * e_coa; + CEcoa3 = -p_coa2 * exp_coa2 * e_coa / (1 + exp_coa2); + CEcoa4 = -2 * p_coa3 * + (workspace->total_bond_order[i]-BOA_ij) * e_coa; + CEcoa5 = -2 * p_coa3 * + (workspace->total_bond_order[k]-BOA_jk) * e_coa; + /* END COALITION ENERGY */ - /* FORCES */ - bo_ij->Cdbo += (CEval1 + CEpen2 + (CEcoa1 - CEcoa4)); - bo_jk->Cdbo += (CEval2 + CEpen3 + (CEcoa2 - CEcoa5)); - workspace->CdDelta[j] += ((CEval3 + CEval7) + CEpen1 + CEcoa3); - workspace->CdDeltaReduction[reductionOffset+i] += CEcoa4; - workspace->CdDeltaReduction[reductionOffset+k] += CEcoa5; + /* FORCES */ + bo_ij->Cdbo += (CEval1 + CEpen2 + (CEcoa1 - CEcoa4)); + bo_jk->Cdbo += (CEval2 + CEpen3 + (CEcoa2 - CEcoa5)); + workspace->CdDelta[j] += ((CEval3 + CEval7) + CEpen1 + CEcoa3); + workspace->CdDeltaReduction[reductionOffset+i] += CEcoa4; + workspace->CdDeltaReduction[reductionOffset+k] += CEcoa5; - for (t = start_j; t < end_j; ++t) { - pbond_jt = &( bonds->select.bond_list[t] ); - bo_jt = &(pbond_jt->bo_data); - temp_bo_jt = bo_jt->BO; - temp = CUBE( temp_bo_jt ); - pBOjt7 = temp * temp * temp_bo_jt; + for (t = start_j; t < end_j; ++t) { + pbond_jt = &(bonds->select.bond_list[t]); + bo_jt = &(pbond_jt->bo_data); + temp_bo_jt = bo_jt->BO; + temp = CUBE(temp_bo_jt); + pBOjt7 = temp * temp * temp_bo_jt; - bo_jt->Cdbo += (CEval6 * pBOjt7); - bo_jt->Cdbopi += CEval5; - bo_jt->Cdbopi2 += CEval5; - } + bo_jt->Cdbo += (CEval6 * pBOjt7); + bo_jt->Cdbopi += CEval5; + bo_jt->Cdbopi2 += CEval5; + } - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+i], - CEval8, p_ijk->dcos_di ); - rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k], - CEval8, p_ijk->dcos_dk ); - } else { - /* terms not related to bond order derivatives are - added directly into forces and pressure vector/tensor */ - rvec_Scale( force, CEval8, p_ijk->dcos_di ); - rvec_Add( workspace->forceReduction[reductionOffset+i], force ); + if (control->virial == 0) { + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], + CEval8, p_ijk->dcos_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEval8, p_ijk->dcos_dk); + } else { + /* terms not related to bond order derivatives are + added directly into forces and pressure vector/tensor */ + rvec_Scale(force, CEval8, p_ijk->dcos_di); + rvec_Add(workspace->forceReduction[reductionOffset+i], force); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - rvec_Scale( force, CEval8, p_ijk->dcos_dk ); - rvec_Add( workspace->forceReduction[reductionOffset+k], force ); - } + rvec_Scale(force, CEval8, p_ijk->dcos_dk); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); + } - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - /* Acquire vectors */ - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[k].x, - -1., system->my_atoms[j].x ); + /* Acquire vectors */ + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[k].x, + -1., system->my_atoms[j].x); - rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di ); - rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj ); - rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk ); + rvec_Scale(fi_tmp, -CEval8, p_ijk->dcos_di); + rvec_Scale(fj_tmp, -CEval8, p_ijk->dcos_dj); + rvec_Scale(fk_tmp, -CEval8, p_ijk->dcos_dk); - eng_tmp = e_ang + e_pen + e_coa; + eng_tmp = e_ang + e_pen + e_coa; - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, j, system->N, 1, - eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - if (system->pair_ptr->vflag_atom) - // NEED TO MAKE AN OMP VERSION OF THIS CALL! - system->pair_ptr->v_tally3( i, j, k, fi_tmp, fk_tmp, delij, delkj); - } + if (system->pair_ptr->evflag) + pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, j, system->N, 1, + eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + if (system->pair_ptr->vflag_atom) + // NEED TO MAKE AN OMP VERSION OF THIS CALL! + system->pair_ptr->v_tally3(i, j, k, fi_tmp, fk_tmp, delij, delkj); + } - } // if (p_val1>0.001) - } // for (cnt) - } // if (j0) - } // for (pk) - } // if (BOA_ij>0) + } // if (p_val1>0.001) + } // for (cnt) + } // if (j0) + } // for (pk) + } // if (BOA_ij>0) - Set_End_Index(pi, my_offset, thb_intrs ); - } // for (pi) - } // for (j) - } // end omp parallel + Set_End_Index(pi, my_offset, thb_intrs); + } // for (pi) + } // for (j) + } // end omp parallel - data->my_en.e_ang = total_Eang; - data->my_en.e_pen = total_Epen; - data->my_en.e_coa = total_Ecoa; + data->my_en.e_ang = total_Eang; + data->my_en.e_pen = total_Epen; + data->my_en.e_coa = total_Ecoa; - if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { - workspace->realloc.num_3body = num_thb_intrs * TWICE; - if (num_thb_intrs > thb_intrs->num_intrs) - control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " - "angle_list: top={}, max={}", - data->step, num_thb_intrs, - thb_intrs->num_intrs)); + if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { + workspace->realloc.num_3body = num_thb_intrs * TWICE; + if (num_thb_intrs > thb_intrs->num_intrs) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list: top={}, max={}", + data->step, num_thb_intrs, + thb_intrs->num_intrs)); + } } - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEVALENCEANGLESBOINDEX] += (endTimeBase-startTimeBase); -#endif } diff --git a/src/USER-OMP/reaxc_valence_angles_omp.h b/src/USER-OMP/reaxc_valence_angles_omp.h deleted file mode 100644 index 5a8d992b0d..0000000000 --- a/src/USER-OMP/reaxc_valence_angles_omp.h +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd - - Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __VALENCE_ANGLES_OMP_H_ -#define __VALENCE_ANGLES_OMP_H_ - -#include "reaxc_types.h" - -void Valence_AnglesOMP( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -void Calculate_dCos_ThetaOMP( rvec, double, rvec, double, rvec*, rvec*, rvec* ); - -#endif diff --git a/src/USER-OMP/reaxff_omp.h b/src/USER-OMP/reaxff_omp.h index f6ca7116ca..630fe07a43 100644 --- a/src/USER-OMP/reaxff_omp.h +++ b/src/USER-OMP/reaxff_omp.h @@ -23,53 +23,84 @@ #include "reaxff_types.h" -namespace ReaxFF -{ - // uncomment to enabled collecting ReaxFF OpenMP timing data - // #define OMP_TIMING 1 - -#ifdef OMP_TIMING - // pkcoff timing fields - enum { COMPUTEINDEX=0, - COMPUTEWLINDEX, - COMPUTEBFINDEX, - COMPUTEQEQINDEX, - COMPUTENBFINDEX, - COMPUTEIFINDEX, - COMPUTETFINDEX, - COMPUTEBOINDEX, - COMPUTEBONDSINDEX, - COMPUTEATOMENERGYINDEX, - COMPUTEVALENCEANGLESBOINDEX, - COMPUTETORSIONANGLESBOINDEX, - COMPUTEHBONDSINDEX, - COMPUTECG1INDEX, - COMPUTECG2INDEX, - COMPUTECGCOMPUTEINDEX, - COMPUTECALCQINDEX, - COMPUTEINITMVINDEX, - COMPUTEMVCOMPINDEX, - LASTTIMINGINDEX - }; - - extern double ompTimingData[LASTTIMINGINDEX]; - extern int ompTimingCount[LASTTIMINGINDEX]; - extern int ompTimingCGCount[LASTTIMINGINDEX]; +#if defined(_OPENMP) +#include #endif +namespace ReaxFF +{ // exported Functions + // bond orders OpenMP + + extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **); + extern void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **); + extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *, + single_body_parameters *, single_body_parameters *, + two_body_parameters *, int, double, double, double, + double, double, double, double); + + extern void BOOMP(reax_system *, control_params *, simulation_data *, + storage *, reax_list **, output_controls *); + + // bonds OpenMP + + extern void BondsOMP(reax_system *, simulation_data *, + storage *, reax_list **); + // forces OpenMP extern void Compute_ForcesOMP(reax_system *, control_params *, simulation_data *, storage *, reax_list **, output_controls *); + // hydrogen bonds + + extern void Hydrogen_BondsOMP(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); + // init md OpenMP extern void InitializeOMP(reax_system *, control_params *, simulation_data *, storage *, reax_list **, output_controls *, MPI_Comm); + + // multi body + + extern void Atom_EnergyOMP(reax_system *, simulation_data *, storage *, reax_list **); + + // nonbonded + + extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); + extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *, + simulation_data *, storage *, + reax_list **); + extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, + int, int, double, LR_data *); + + // torsion angles + + extern void Torsion_AnglesOMP(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); + + // valence angles + + extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *); + extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, + rvec *, rvec *, rvec *); + extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + + // OpenMP helpers + + inline int get_tid() { +#if defined(_OPENMP) + return omp_get_thread_num(); +#else + return 0; +#endif + } } #endif diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 8128b23662..2f7029e960 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -28,12 +28,12 @@ #include "modify.h" #include "neigh_list.h" #include "neighbor.h" -#include "pair_reaxc.h" #include "update.h" -#include +#include "pair_reaxc.h" +#include "reaxff_defs.h" -#include "reaxc_defs.h" +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index a1772f9551..aa445d765d 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -417,7 +417,7 @@ void PairReaxC::setup() // initialize my data structures - PreAllocate_Space(api->system, api->control, api->workspace); + PreAllocate_Space(api->system, api->workspace); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); @@ -430,7 +430,8 @@ void PairReaxC::setup() write_reax_lists(); api->system->wsize = comm->nprocs; - Initialize(api->system, api->control, api->data, api->workspace, &api->lists, api->out_control, world); + Initialize(api->system, api->control, api->data, api->workspace, + &api->lists, api->out_control, world); for (int k = 0; k < api->system->N; ++k) { num_bonds[k] = api->system->my_atoms[k].num_bonds; num_hbonds[k] = api->system->my_atoms[k].num_hbonds; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 3d68bb6944..143da54849 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -24,344 +24,312 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_allocate.h" -#include -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_tool_box.h" - -#if defined(LMP_USER_OMP) && defined(_OPENMP) -#include -#endif +#include "reaxff_api.h" #include "error.h" -/* allocate space for my_atoms - important: we cannot know the exact number of atoms that will fall into a - process's box throughout the whole simulation. therefore - we need to make upper bound estimates for various data structures */ -int PreAllocate_Space( reax_system *system, control_params * /*control*/, - storage * workspace ) -{ - int mincap = system->mincap; - double safezone = system->safezone; +namespace ReaxFF { - // determine the local and total capacity + /* allocate space for my_atoms + important: we cannot know the exact number of atoms that will fall into a + process's box throughout the whole simulation. therefore + we need to make upper bound estimates for various data structures */ + void PreAllocate_Space(reax_system *system, storage * workspace) + { + const int mincap = system->mincap; + const double safezone = system->safezone; - system->local_cap = MAX( (int)(system->n * safezone), mincap ); - system->total_cap = MAX( (int)(system->N * safezone), mincap ); + // determine the local and total capacity - system->my_atoms = (reax_atom*) - scalloc(system->error_ptr, system->total_cap, sizeof(reax_atom), "my_atoms"); + system->local_cap = MAX((int)(system->n * safezone), mincap); + system->total_cap = MAX((int)(system->N * safezone), mincap); - // Nullify some arrays only used in omp styles - // Should be safe to do here since called in pair->setup(); -#ifdef LMP_USER_OMP - workspace->CdDeltaReduction = nullptr; - workspace->forceReduction = nullptr; - workspace->valence_angle_atom_myoffset = nullptr; -#else - LMP_UNUSED_PARAM(workspace); -#endif + system->my_atoms = (reax_atom*) scalloc(system->error_ptr, + system->total_cap, sizeof(reax_atom), "my_atoms"); - return SUCCESS; -} + // Nullify some arrays only used in omp styles + // Should be safe to do here since called in pair->setup(); + workspace->CdDeltaReduction = nullptr; + workspace->forceReduction = nullptr; + workspace->valence_angle_atom_myoffset = nullptr; + } -/************* system *************/ + /************* system *************/ -void DeAllocate_System( reax_system *system ) -{ - int i, j, k; - int ntypes; - reax_interaction *ff_params; + void DeAllocate_System(reax_system *system) + { + int i, j, k; + int ntypes; + reax_interaction *ff_params; + auto error = system->error_ptr; - // deallocate the atom list - sfree(system->error_ptr, system->my_atoms, "system->my_atoms" ); + // deallocate the atom list + sfree(error, system->my_atoms, "system->my_atoms"); - // deallocate the ffield parameters storage - ff_params = &(system->reax_param); - ntypes = ff_params->num_atom_types; + // deallocate the ffield parameters storage + ff_params = &(system->reax_param); + ntypes = ff_params->num_atom_types; - sfree(system->error_ptr, ff_params->gp.l, "ff:globals" ); + sfree(error, ff_params->gp.l, "ff:globals"); - for (i = 0; i < ntypes; ++i) { - for (j = 0; j < ntypes; ++j) { - for (k = 0; k < ntypes; ++k) { - sfree(system->error_ptr, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); + for (i = 0; i < ntypes; ++i) { + for (j = 0; j < ntypes; ++j) { + for (k = 0; k < ntypes; ++k) { + sfree(error, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]"); + } + sfree(error, ff_params->fbp[i][j], "ff:fbp[i,j]"); + sfree(error, ff_params->thbp[i][j], "ff:thbp[i,j]"); + sfree(error, ff_params->hbp[i][j], "ff:hbp[i,j]"); } - sfree(system->error_ptr, ff_params->fbp[i][j], "ff:fbp[i,j]" ); - sfree(system->error_ptr, ff_params->thbp[i][j], "ff:thbp[i,j]" ); - sfree(system->error_ptr, ff_params->hbp[i][j], "ff:hbp[i,j]" ); + sfree(error, ff_params->fbp[i], "ff:fbp[i]"); + sfree(error, ff_params->thbp[i], "ff:thbp[i]"); + sfree(error, ff_params->hbp[i], "ff:hbp[i]"); + sfree(error, ff_params->tbp[i], "ff:tbp[i]"); } - sfree(system->error_ptr, ff_params->fbp[i], "ff:fbp[i]" ); - sfree(system->error_ptr, ff_params->thbp[i], "ff:thbp[i]" ); - sfree(system->error_ptr, ff_params->hbp[i], "ff:hbp[i]" ); - sfree(system->error_ptr, ff_params->tbp[i], "ff:tbp[i]" ); + sfree(error, ff_params->fbp, "ff:fbp"); + sfree(error, ff_params->thbp, "ff:thbp"); + sfree(error, ff_params->hbp, "ff:hbp"); + sfree(error, ff_params->tbp, "ff:tbp"); + sfree(error, ff_params->sbp, "ff:sbp"); } - sfree(system->error_ptr, ff_params->fbp, "ff:fbp" ); - sfree(system->error_ptr, ff_params->thbp, "ff:thbp" ); - sfree(system->error_ptr, ff_params->hbp, "ff:hbp" ); - sfree(system->error_ptr, ff_params->tbp, "ff:tbp" ); - sfree(system->error_ptr, ff_params->sbp, "ff:sbp" ); -} + /************* workspace *************/ + void DeAllocate_Workspace(control_params *control, storage *workspace) + { + if (!workspace->allocated) + return; -/************* workspace *************/ -void DeAllocate_Workspace( control_params * control, storage *workspace ) -{ - if (!workspace->allocated) - return; + workspace->allocated = 0; + auto error = control->error_ptr; - workspace->allocated = 0; + /* bond order storage */ + sfree(error, workspace->total_bond_order, "total_bo"); + sfree(error, workspace->Deltap, "Deltap"); + sfree(error, workspace->Deltap_boc, "Deltap_boc"); + sfree(error, workspace->dDeltap_self, "dDeltap_self"); + sfree(error, workspace->Delta, "Delta"); + sfree(error, workspace->Delta_lp, "Delta_lp"); + sfree(error, workspace->Delta_lp_temp, "Delta_lp_temp"); + sfree(error, workspace->dDelta_lp, "dDelta_lp"); + sfree(error, workspace->dDelta_lp_temp, "dDelta_lp_temp"); + sfree(error, workspace->Delta_e, "Delta_e"); + sfree(error, workspace->Delta_boc, "Delta_boc"); + sfree(error, workspace->Delta_val, "Delta_val"); + sfree(error, workspace->nlp, "nlp"); + sfree(error, workspace->nlp_temp, "nlp_temp"); + sfree(error, workspace->Clp, "Clp"); + sfree(error, workspace->vlpex, "vlpex"); + sfree(error, workspace->bond_mark, "bond_mark"); - /* bond order storage */ - sfree(control->error_ptr, workspace->total_bond_order, "total_bo" ); - sfree(control->error_ptr, workspace->Deltap, "Deltap" ); - sfree(control->error_ptr, workspace->Deltap_boc, "Deltap_boc" ); - sfree(control->error_ptr, workspace->dDeltap_self, "dDeltap_self" ); - sfree(control->error_ptr, workspace->Delta, "Delta" ); - sfree(control->error_ptr, workspace->Delta_lp, "Delta_lp" ); - sfree(control->error_ptr, workspace->Delta_lp_temp, "Delta_lp_temp" ); - sfree(control->error_ptr, workspace->dDelta_lp, "dDelta_lp" ); - sfree(control->error_ptr, workspace->dDelta_lp_temp, "dDelta_lp_temp" ); - sfree(control->error_ptr, workspace->Delta_e, "Delta_e" ); - sfree(control->error_ptr, workspace->Delta_boc, "Delta_boc" ); - sfree(control->error_ptr, workspace->Delta_val, "Delta_val" ); - sfree(control->error_ptr, workspace->nlp, "nlp" ); - sfree(control->error_ptr, workspace->nlp_temp, "nlp_temp" ); - sfree(control->error_ptr, workspace->Clp, "Clp" ); - sfree(control->error_ptr, workspace->vlpex, "vlpex" ); - sfree(control->error_ptr, workspace->bond_mark, "bond_mark" ); + /* force related storage */ + sfree(error, workspace->f, "f"); + sfree(error, workspace->CdDelta, "CdDelta"); - /* force related storage */ - sfree(control->error_ptr, workspace->f, "f" ); - sfree(control->error_ptr, workspace->CdDelta, "CdDelta" ); + /* reductions */ - /* reductions */ -#ifdef LMP_USER_OMP - if (workspace->CdDeltaReduction) sfree(control->error_ptr, workspace->CdDeltaReduction, "cddelta_reduce" ); - if (workspace->forceReduction) sfree(control->error_ptr, workspace->forceReduction, "f_reduce" ); - if (workspace->valence_angle_atom_myoffset) sfree(control->error_ptr, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); -#endif -} - -void Allocate_Workspace( control_params *control, storage *workspace, int total_cap) -{ - int total_real, total_rvec; - - workspace->allocated = 1; - total_real = total_cap * sizeof(double); - total_rvec = total_cap * sizeof(rvec); - - /* bond order related storage */ - workspace->total_bond_order = (double*) smalloc(control->error_ptr, total_real, "total_bo"); - workspace->Deltap = (double*) smalloc(control->error_ptr, total_real, "Deltap"); - workspace->Deltap_boc = (double*) smalloc(control->error_ptr, total_real, "Deltap_boc"); - workspace->dDeltap_self = (rvec*) smalloc(control->error_ptr, total_rvec, "dDeltap_self"); - workspace->Delta = (double*) smalloc(control->error_ptr, total_real, "Delta"); - workspace->Delta_lp = (double*) smalloc(control->error_ptr, total_real, "Delta_lp"); - workspace->Delta_lp_temp = (double*) - smalloc(control->error_ptr, total_real, "Delta_lp_temp"); - workspace->dDelta_lp = (double*) smalloc(control->error_ptr, total_real, "dDelta_lp"); - workspace->dDelta_lp_temp = (double*) - smalloc(control->error_ptr, total_real, "dDelta_lp_temp"); - workspace->Delta_e = (double*) smalloc(control->error_ptr, total_real, "Delta_e"); - workspace->Delta_boc = (double*) smalloc(control->error_ptr, total_real, "Delta_boc"); - workspace->Delta_val = (double*) smalloc(control->error_ptr, total_real, "Delta_val"); - workspace->nlp = (double*) smalloc(control->error_ptr, total_real, "nlp"); - workspace->nlp_temp = (double*) smalloc(control->error_ptr, total_real, "nlp_temp"); - workspace->Clp = (double*) smalloc(control->error_ptr, total_real, "Clp"); - workspace->vlpex = (double*) smalloc(control->error_ptr, total_real, "vlpex"); - workspace->bond_mark = (int*) - scalloc(control->error_ptr, total_cap, sizeof(int), "bond_mark"); - - /* force related storage */ - workspace->f = (rvec*) scalloc(control->error_ptr, total_cap, sizeof(rvec), "f"); - workspace->CdDelta = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "CdDelta"); - - // storage for reductions with multiple threads -#ifdef LMP_USER_OMP - workspace->CdDeltaReduction = (double *) scalloc(control->error_ptr, sizeof(double), (rc_bigint)total_cap*control->nthreads, - "cddelta_reduce"); - - workspace->forceReduction = (rvec *) scalloc(control->error_ptr, sizeof(rvec), (rc_bigint)total_cap*control->nthreads, - "forceReduction"); - - workspace->valence_angle_atom_myoffset = (int *) scalloc(control->error_ptr, sizeof(int), total_cap, "valence_angle_atom_myoffset"); -#else - LMP_UNUSED_PARAM(control); -#endif -} - - -static void Reallocate_Neighbor_List( reax_list *far_nbrs, int n, - int num_intrs ) -{ - Delete_List( far_nbrs); - if (!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs )) { - far_nbrs->error_ptr->one(FLERR,"Problem in initializing far neighbors list"); + if (workspace->CdDeltaReduction) + sfree(error, workspace->CdDeltaReduction, "cddelta_reduce"); + if (workspace->forceReduction) + sfree(error, workspace->forceReduction, "f_reduce"); + if (workspace->valence_angle_atom_myoffset) + sfree(error, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); + } + + void Allocate_Workspace(control_params *control, storage *workspace, int total_cap) + { + int total_real, total_rvec; + auto error = control->error_ptr; + + workspace->allocated = 1; + total_real = total_cap * sizeof(double); + total_rvec = total_cap * sizeof(rvec); + + /* bond order related storage */ + workspace->total_bond_order = (double*) smalloc(error, total_real, "total_bo"); + workspace->Deltap = (double*) smalloc(error, total_real, "Deltap"); + workspace->Deltap_boc = (double*) smalloc(error, total_real, "Deltap_boc"); + workspace->dDeltap_self = (rvec*) smalloc(error, total_rvec, "dDeltap_self"); + workspace->Delta = (double*) smalloc(error, total_real, "Delta"); + workspace->Delta_lp = (double*) smalloc(error, total_real, "Delta_lp"); + workspace->Delta_lp_temp = (double*) smalloc(error, total_real, "Delta_lp_temp"); + workspace->dDelta_lp = (double*) smalloc(error, total_real, "dDelta_lp"); + workspace->dDelta_lp_temp = (double*) smalloc(error, total_real, "dDelta_lp_temp"); + workspace->Delta_e = (double*) smalloc(error, total_real, "Delta_e"); + workspace->Delta_boc = (double*) smalloc(error, total_real, "Delta_boc"); + workspace->Delta_val = (double*) smalloc(error, total_real, "Delta_val"); + workspace->nlp = (double*) smalloc(error, total_real, "nlp"); + workspace->nlp_temp = (double*) smalloc(error, total_real, "nlp_temp"); + workspace->Clp = (double*) smalloc(error, total_real, "Clp"); + workspace->vlpex = (double*) smalloc(error, total_real, "vlpex"); + workspace->bond_mark = (int*) scalloc(error, total_cap, sizeof(int), "bond_mark"); + + /* force related storage */ + workspace->f = (rvec*) scalloc(error, total_cap, sizeof(rvec), "f"); + workspace->CdDelta = (double*) scalloc(error, total_cap, sizeof(double), "CdDelta"); + + // storage for reductions with multiple threads + + workspace->CdDeltaReduction = (double *) scalloc(error, + sizeof(double), (rc_bigint)total_cap*control->nthreads, "cddelta_reduce"); + workspace->forceReduction = (rvec *) scalloc(error, + sizeof(rvec), (rc_bigint)total_cap*control->nthreads, "forceReduction"); + workspace->valence_angle_atom_myoffset = (int *) scalloc(error, + sizeof(int), total_cap, "valence_angle_atom_myoffset"); } -} -static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds ) -{ - int i, total_hbonds; - - int mincap = system->mincap; - double saferzone = system->saferzone; - - total_hbonds = 0; - for (i = 0; i < system->n; ++i) - if ((system->my_atoms[i].Hindex) >= 0) { - total_hbonds += system->my_atoms[i].num_hbonds; + static void Reallocate_Neighbor_List(reax_list *far_nbrs, int n, int num_intrs) + { + Delete_List(far_nbrs); + if (!Make_List(n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs)) { + far_nbrs->error_ptr->one(FLERR,"Problem in initializing far neighbors list"); } - total_hbonds = (int)(MAX(total_hbonds*saferzone, mincap*system->minhbonds)); - - Delete_List( hbonds); - if (!Make_List( system->Hcap, total_hbonds, TYP_HBOND, hbonds )) { - hbonds->error_ptr->one(FLERR, "Not enough space for hydrogen bonds list"); } - return total_hbonds; -} + static int Reallocate_HBonds_List(reax_system *system, reax_list *hbonds) + { + int i, total_hbonds; + int mincap = system->mincap; + double saferzone = system->saferzone; -static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, - int *total_bonds, int *est_3body ) -{ - int i; + total_hbonds = 0; + for (i = 0; i < system->n; ++i) + if ((system->my_atoms[i].Hindex) >= 0) { + total_hbonds += system->my_atoms[i].num_hbonds; + } + total_hbonds = (int)(MAX(total_hbonds*saferzone, mincap*system->minhbonds)); - int mincap = system->mincap; - double safezone = system->safezone; + Delete_List(hbonds); + if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, hbonds)) { + hbonds->error_ptr->one(FLERR, "Not enough space for hydrogen bonds list"); + } - *total_bonds = 0; - *est_3body = 0; - for (i = 0; i < system->N; ++i) { - *est_3body += SQR(system->my_atoms[i].num_bonds); - *total_bonds += system->my_atoms[i].num_bonds; - } - *total_bonds = (int)(MAX( *total_bonds * safezone, mincap*MIN_BONDS )); - -#ifdef LMP_USER_OMP - if (system->omp_active) - for (i = 0; i < bonds->num_intrs; ++i) - sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); -#endif - - Delete_List( bonds); - if (!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds)) { - bonds->error_ptr->one(FLERR, "Not enough space for bonds list"); + return total_hbonds; } -#ifdef LMP_USER_OMP -#if defined(_OPENMP) - int nthreads = omp_get_num_threads(); -#else - int nthreads = 1; -#endif + static int Reallocate_Bonds_List(control_params *control, reax_system *system, + reax_list *bonds, int *total_bonds, int *est_3body) + { + int i; - if (system->omp_active) - for (i = 0; i < bonds->num_intrs; ++i) - bonds->select.bond_list[i].bo_data.CdboReduction = - (double*) smalloc(system->error_ptr, sizeof(double)*nthreads, "CdboReduction"); -#endif + int mincap = system->mincap; + double safezone = system->safezone; - return SUCCESS; -} + *total_bonds = 0; + *est_3body = 0; + for (i = 0; i < system->N; ++i) { + *est_3body += SQR(system->my_atoms[i].num_bonds); + *total_bonds += system->my_atoms[i].num_bonds; + } + *total_bonds = (int)(MAX(*total_bonds * safezone, mincap*MIN_BONDS)); + if (system->omp_active) + for (i = 0; i < bonds->num_intrs; ++i) + sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); -void ReAllocate( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, reax_list **lists ) -{ - auto error = system->error_ptr; - int num_bonds, est_3body, Hflag; - int newsize; - reallocate_data *wsr; - reax_list *far_nbrs; + Delete_List(bonds); + if (!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds)) { + bonds->error_ptr->one(FLERR, "Not enough space for bonds list"); + } - int mincap = system->mincap; - double safezone = system->safezone; - double saferzone = system->saferzone; + if (system->omp_active) + for (i = 0; i < bonds->num_intrs; ++i) + bonds->select.bond_list[i].bo_data.CdboReduction = + (double*) smalloc(system->error_ptr, sizeof(double)*control->nthreads, "CdboReduction"); - wsr = &(workspace->realloc); - - if ( system->n >= DANGER_ZONE * system->local_cap || - (0 && system->n <= LOOSE_ZONE * system->local_cap)) { - system->local_cap = MAX( (int)(system->n * safezone), mincap ); + return SUCCESS; } - int Nflag = 0; - if ( system->N >= DANGER_ZONE * system->total_cap || - (0 && system->N <= LOOSE_ZONE * system->total_cap)) { - Nflag = 1; - system->total_cap = MAX( (int)(system->N * safezone), mincap ); - } + void ReAllocate(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, reax_list **lists) + { + int num_bonds, est_3body, Hflag; + int newsize; + reax_list *far_nbrs; - if (Nflag) { - /* system */ - system->my_atoms = (reax_atom *)::realloc(system->my_atoms, - system->total_cap*sizeof(reax_atom)); - /* workspace */ - DeAllocate_Workspace(control, workspace); - Allocate_Workspace(control, workspace, system->total_cap); - } + int mincap = system->mincap; + double safezone = system->safezone; + double saferzone = system->saferzone; - /* far neighbors */ + auto error = system->error_ptr; + reallocate_data *wsr = &(workspace->realloc); - far_nbrs = *lists + FAR_NBRS; + if (system->n >= DANGER_ZONE * system->local_cap || + (0 && system->n <= LOOSE_ZONE * system->local_cap)) { + system->local_cap = MAX((int)(system->n * safezone), mincap); + } - if (Nflag || wsr->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { - if (wsr->num_far > far_nbrs->num_intrs) - error->one(FLERR,fmt::format("step{}: ran out of space on far_nbrs: top={}, max={}", + int Nflag = 0; + if (system->N >= DANGER_ZONE * system->total_cap || + (0 && system->N <= LOOSE_ZONE * system->total_cap)) { + Nflag = 1; + system->total_cap = MAX((int)(system->N * safezone), mincap); + } + + if (Nflag) { + /* system */ + system->my_atoms = (reax_atom *)::realloc(system->my_atoms, + system->total_cap*sizeof(reax_atom)); + /* workspace */ + DeAllocate_Workspace(control, workspace); + Allocate_Workspace(control, workspace, system->total_cap); + } + + /* far neighbors */ + + far_nbrs = *lists + FAR_NBRS; + + if (Nflag || wsr->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { + if (wsr->num_far > far_nbrs->num_intrs) + error->one(FLERR,fmt::format("step{}: ran out of space on far_nbrs: top={}, max={}", data->step, wsr->num_far, far_nbrs->num_intrs)); - newsize = static_cast - (MAX( wsr->num_far*safezone, mincap*REAX_MIN_NBRS)); + newsize = static_cast + (MAX(wsr->num_far*safezone, mincap*REAX_MIN_NBRS)); - Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize); - wsr->num_far = 0; - } - - /* hydrogen bonds list */ - if (control->hbond_cut > 0) { - Hflag = 0; - if ( system->numH >= DANGER_ZONE * system->Hcap || - (0 && system->numH <= LOOSE_ZONE * system->Hcap)) { - Hflag = 1; - system->Hcap = int(MAX( system->numH * saferzone, mincap )); + Reallocate_Neighbor_List(far_nbrs, system->total_cap, newsize); + wsr->num_far = 0; } - if (Hflag || wsr->hbonds) { - Reallocate_HBonds_List( system, (*lists)+HBONDS); - wsr->hbonds = 0; + /* hydrogen bonds list */ + if (control->hbond_cut > 0) { + Hflag = 0; + if (system->numH >= DANGER_ZONE * system->Hcap || + (0 && system->numH <= LOOSE_ZONE * system->Hcap)) { + Hflag = 1; + system->Hcap = int(MAX(system->numH * saferzone, mincap)); + } + + if (Hflag || wsr->hbonds) { + Reallocate_HBonds_List(system, (*lists)+HBONDS); + wsr->hbonds = 0; + } } - } - /* bonds list */ - num_bonds = est_3body = -1; - if (Nflag || wsr->bonds) { - Reallocate_Bonds_List( system, (*lists)+BONDS, &num_bonds, - &est_3body); - wsr->bonds = 0; - wsr->num_3body = MAX( wsr->num_3body, est_3body ) * 2; - } - - /* 3-body list */ - if (wsr->num_3body > 0) { - Delete_List( (*lists)+THREE_BODIES); - - if (num_bonds == -1) - num_bonds = ((*lists)+BONDS)->num_intrs; - - wsr->num_3body = (int)(MAX(wsr->num_3body*safezone, MIN_3BODIES)); - - if ( !Make_List( num_bonds, wsr->num_3body, TYP_THREE_BODY, - (*lists)+THREE_BODIES )) { - error->one(FLERR, "Problem in initializing angles list"); + /* bonds list */ + num_bonds = est_3body = -1; + if (Nflag || wsr->bonds) { + Reallocate_Bonds_List(control, system, (*lists)+BONDS, &num_bonds, &est_3body); + wsr->bonds = 0; + wsr->num_3body = MAX(wsr->num_3body, est_3body) * 2; + } + + /* 3-body list */ + if (wsr->num_3body > 0) { + Delete_List((*lists)+THREE_BODIES); + + if (num_bonds == -1) + num_bonds = ((*lists)+BONDS)->num_intrs; + + wsr->num_3body = (int)(MAX(wsr->num_3body*safezone, MIN_3BODIES)); + + if (!Make_List(num_bonds, wsr->num_3body, TYP_THREE_BODY, + (*lists)+THREE_BODIES)) { + error->one(FLERR, "Problem in initializing angles list"); + } + wsr->num_3body = -1; } - wsr->num_3body = -1; } } diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h deleted file mode 100644 index 7229927b57..0000000000 --- a/src/USER-REAXC/reaxc_allocate.h +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __ALLOCATE_H_ -#define __ALLOCATE_H_ - -#include "reaxc_types.h" - -int PreAllocate_Space(reax_system *, control_params *, storage *); - -void DeAllocate_System(reax_system *); - -void Allocate_Workspace(control_params *, storage *, int); -void DeAllocate_Workspace(control_params *, storage *); - -void ReAllocate(reax_system *, control_params *, simulation_data *, - storage*, reax_list**); -#endif diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index 0c26784ccb..ae6fc3b823 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -24,555 +24,543 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_bond_orders.h" -#include +#include "reaxff_api.h" + #include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" -void Add_dBond_to_Forces_NPT( int i, int pj, - storage *workspace, reax_list **lists ) -{ - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - rvec temp; - int pk, k, j; +#include - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); +namespace ReaxFF { + void Add_dBond_to_Forces_NPT( int i, int pj, storage *workspace, reax_list **lists ) + { + reax_list *bonds = (*lists) + BONDS; + bond_data *nbr_j, *nbr_k; + bond_order_data *bo_ij, *bo_ji; + dbond_coefficients coef; + rvec temp; + int pk, k, j; - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + /* Initializations */ + nbr_j = &(bonds->select.bond_list[pj]); + j = nbr_j->nbr; + bo_ij = &(nbr_j->bo_data); + bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; + coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ - rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ + for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ + rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ + rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ + + /* force */ + rvec_Add( workspace->f[k], temp ); + } + + /* then atom i itself */ + rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ + rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ + rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ + rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ + rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ + rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ + rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ + + rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ + rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ + rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ /* force */ - rvec_Add( workspace->f[k], temp ); - } + rvec_Add( workspace->f[i], temp ); - /* then atom i itself */ - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ + for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ + rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ + rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ + rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ - /* force */ - rvec_Add( workspace->f[i], temp ); + /* force */ + rvec_Add( workspace->f[k], temp ); + } - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; + /* then atom j itself */ + rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ + rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ + rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ + rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ + rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ + rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ + rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + + rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ + rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ + rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ /* force */ - rvec_Add( workspace->f[k], temp ); + rvec_Add( workspace->f[j], temp ); } - /* then atom j itself */ - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ + void Add_dBond_to_Forces( reax_system *system, int i, int pj, + storage *workspace, reax_list **lists ) + { + reax_list *bonds = (*lists) + BONDS; + bond_data *nbr_j, *nbr_k; + bond_order_data *bo_ij, *bo_ji; + dbond_coefficients coef; + int pk, k, j; - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + /* Virial Tallying variables */ + rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ - rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ + /* Initializations */ + nbr_j = &(bonds->select.bond_list[pj]); + j = nbr_j->nbr; + bo_ij = &(nbr_j->bo_data); + bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); - /* force */ - rvec_Add( workspace->f[j], temp ); -} + coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); -void Add_dBond_to_Forces( reax_system *system, int i, int pj, - storage *workspace, reax_list **lists ) -{ - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - int pk, k, j; + coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - /* Virial Tallying variables */ - rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; + coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - - // forces on i - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] ); - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]); - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] ); - rvec_Add( workspace->f[i], temp ); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fi_tmp, -1.0, temp); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); - system->pair_ptr->v_tally(i,fi_tmp,delij); - } - - // forces on j - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]); - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]); - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C4dbopi2, workspace->dDeltap_self[j]); - rvec_Add( workspace->f[j], temp ); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fj_tmp, -1.0, temp); - rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); - system->pair_ptr->v_tally(j,fj_tmp,delji); - } - - // forces on k: i neighbor - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); - rvec_Add( workspace->f[k], temp ); + // forces on i + rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); + rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] ); + rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); + rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]); + rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); + rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] ); + rvec_Add( workspace->f[i], temp ); if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - system->pair_ptr->v_tally(k,fk_tmp,delki); - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - system->pair_ptr->v_tally(k,fk_tmp,delkj); + rvec_Scale(fi_tmp, -1.0, temp); + rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); + system->pair_ptr->v_tally(i,fi_tmp,delij); + } + + // forces on j + rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); + rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]); + rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); + rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]); + rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); + rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); + rvec_ScaledAdd( temp, coef.C4dbopi2, workspace->dDeltap_self[j]); + rvec_Add( workspace->f[j], temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fj_tmp, -1.0, temp); + rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); + system->pair_ptr->v_tally(j,fj_tmp,delji); + } + + // forces on k: i neighbor + for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); + rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); + rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); + rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); + rvec_Add( workspace->f[k], temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + system->pair_ptr->v_tally(k,fk_tmp,delki); + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + system->pair_ptr->v_tally(k,fk_tmp,delkj); + } + } + + // forces on k: j neighbor + for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); + rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); + rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); + rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + rvec_Add( workspace->f[k], temp ); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + system->pair_ptr->v_tally(k,fk_tmp,delki); + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + system->pair_ptr->v_tally(k,fk_tmp,delkj); + } } } - // forces on k: j neighbor - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; + int BOp(storage *workspace, reax_list *bonds, double bo_cut, + int i, int btop_i, far_neighbor_data *nbr_pj, + single_body_parameters *sbp_i, single_body_parameters *sbp_j, + two_body_parameters *twbp) { + int j, btop_j; + double r2, C12, C34, C56; + double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; + double BO, BO_s, BO_pi, BO_pi2; + bond_data *ibond, *jbond; + bond_order_data *bo_ij, *bo_ji; - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); - rvec_Add( workspace->f[k], temp ); + j = nbr_pj->nbr; + r2 = SQR(nbr_pj->d); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - system->pair_ptr->v_tally(k,fk_tmp,delki); - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - system->pair_ptr->v_tally(k,fk_tmp,delkj); + if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { + C12 = twbp->p_bo1 * pow( nbr_pj->d / twbp->r_s, twbp->p_bo2 ); + BO_s = (1.0 + bo_cut) * exp( C12 ); + } else BO_s = C12 = 0.0; + + if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { + C34 = twbp->p_bo3 * pow( nbr_pj->d / twbp->r_p, twbp->p_bo4 ); + BO_pi = exp( C34 ); + } else BO_pi = C34 = 0.0; + + if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { + C56 = twbp->p_bo5 * pow( nbr_pj->d / twbp->r_pp, twbp->p_bo6 ); + BO_pi2= exp( C56 ); + } else BO_pi2 = C56 = 0.0; + + /* Initially BO values are the uncorrected ones, page 1 */ + BO = BO_s + BO_pi + BO_pi2; + + if (BO >= bo_cut) { + /****** bonds i-j and j-i ******/ + ibond = &( bonds->select.bond_list[btop_i] ); + btop_j = End_Index( j, bonds ); + jbond = &(bonds->select.bond_list[btop_j]); + + ibond->nbr = j; + jbond->nbr = i; + ibond->d = nbr_pj->d; + jbond->d = nbr_pj->d; + rvec_Copy( ibond->dvec, nbr_pj->dvec ); + rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); + ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); + ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); + ibond->dbond_index = btop_i; + jbond->dbond_index = btop_i; + ibond->sym_index = btop_j; + jbond->sym_index = btop_i; + Set_End_Index( j, btop_j+1, bonds ); + + bo_ij = &( ibond->bo_data ); + bo_ji = &( jbond->bo_data ); + bo_ji->BO = bo_ij->BO = BO; + bo_ji->BO_s = bo_ij->BO_s = BO_s; + bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; + bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; + + /* Bond Order page2-3, derivative of total bond order prime */ + Cln_BOp_s = twbp->p_bo2 * C12 / r2; + Cln_BOp_pi = twbp->p_bo4 * C34 / r2; + Cln_BOp_pi2 = twbp->p_bo6 * C56 / r2; + + /* Only dln_BOp_xx wrt. dr_i is stored here, note that + dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ + rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec); + rvec_Scale(bo_ij->dln_BOp_pi,-bo_ij->BO_pi*Cln_BOp_pi,ibond->dvec); + rvec_Scale(bo_ij->dln_BOp_pi2, + -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); + rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); + rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); + rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); + + rvec_Scale( bo_ij->dBOp, + -(bo_ij->BO_s * Cln_BOp_s + + bo_ij->BO_pi * Cln_BOp_pi + + bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); + rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); + + rvec_Add( workspace->dDeltap_self[i], bo_ij->dBOp ); + rvec_Add( workspace->dDeltap_self[j], bo_ji->dBOp ); + + bo_ij->BO_s -= bo_cut; + bo_ij->BO -= bo_cut; + bo_ji->BO_s -= bo_cut; + bo_ji->BO -= bo_cut; + workspace->total_bond_order[i] += bo_ij->BO; //currently total_BOp + workspace->total_bond_order[j] += bo_ji->BO; //currently total_BOp + bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0; + bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0; + + return 1; } + + return 0; } -} + + void BO(reax_system *system, control_params * /*control*/, simulation_data * /*data*/, + storage *workspace, reax_list **lists, output_controls * /*out_control*/ ) + { + int i, j, pj, type_i, type_j; + int start_i, end_i, sym_index; + double val_i, Deltap_i, Deltap_boc_i; + double val_j, Deltap_j, Deltap_boc_j; + double f1, f2, f3, f4, f5, f4f5, exp_f4, exp_f5; + double exp_p1i, exp_p2i, exp_p1j, exp_p2j; + double temp, u1_ij, u1_ji, Cf1A_ij, Cf1B_ij, Cf1_ij, Cf1_ji; + double Cf45_ij, Cf45_ji, p_lp1; //u_ij, u_ji + double A0_ij, A1_ij, A2_ij, A2_ji, A3_ij, A3_ji; + double explp1, p_boc1, p_boc2; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + bond_order_data *bo_ij, *bo_ji; + reax_list *bonds = (*lists) + BONDS; + + p_boc1 = system->reax_param.gp.l[0]; + p_boc2 = system->reax_param.gp.l[1]; + + /* Calculate Deltaprime, Deltaprime_boc values */ + for (i = 0; i < system->N; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[type_i]); + workspace->Deltap[i] = workspace->total_bond_order[i] - sbp_i->valency; + workspace->Deltap_boc[i] = + workspace->total_bond_order[i] - sbp_i->valency_val; + + workspace->total_bond_order[i] = 0; + } + + /* Corrected Bond Order calculations */ + for (i = 0; i < system->N; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + sbp_i = &(system->reax_param.sbp[type_i]); + val_i = sbp_i->valency; + Deltap_i = workspace->Deltap[i]; + Deltap_boc_i = workspace->Deltap_boc[i]; + start_i = Start_Index(i, bonds); + end_i = End_Index(i, bonds); + + for (pj = start_i; pj < end_i; ++pj) { + j = bonds->select.bond_list[pj].nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + bo_ij = &( bonds->select.bond_list[pj].bo_data ); + // fprintf( stderr, "\tj:%d - ubo: %8.3f\n", j+1, bo_ij->BO ); + + if (i < j || workspace->bond_mark[j] > 3) { + twbp = &( system->reax_param.tbp[type_i][type_j] ); + + if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { + bo_ij->C1dbo = 1.000000; + bo_ij->C2dbo = 0.000000; + bo_ij->C3dbo = 0.000000; + + bo_ij->C1dbopi = 1.000000; + bo_ij->C2dbopi = 0.000000; + bo_ij->C3dbopi = 0.000000; + bo_ij->C4dbopi = 0.000000; + + bo_ij->C1dbopi2 = 1.000000; + bo_ij->C2dbopi2 = 0.000000; + bo_ij->C3dbopi2 = 0.000000; + bo_ij->C4dbopi2 = 0.000000; + + } else { + val_j = system->reax_param.sbp[type_j].valency; + Deltap_j = workspace->Deltap[j]; + Deltap_boc_j = workspace->Deltap_boc[j]; + + /* on page 1 */ + if (twbp->ovc >= 0.001) { + /* Correction for overcoordination */ + exp_p1i = exp( -p_boc1 * Deltap_i ); + exp_p2i = exp( -p_boc2 * Deltap_i ); + exp_p1j = exp( -p_boc1 * Deltap_j ); + exp_p2j = exp( -p_boc2 * Deltap_j ); + + f2 = exp_p1i + exp_p1j; + f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); + f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + + ( val_j + f2 )/( val_j + f2 + f3 ) ); + + temp = f2 + f3; + u1_ij = val_i + temp; + u1_ji = val_j + temp; + Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + + 1.0 / SQR( u1_ji )); + Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + + ( u1_ji - f3 ) / SQR( u1_ji )); + + Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - + ((val_i+f2) / SQR(u1_ij)) * + ( -p_boc1 * exp_p1i + + exp_p2i / ( exp_p2i + exp_p2j ) ) + + -p_boc1 * exp_p1i / u1_ji - + ((val_j+f2) / SQR(u1_ji)) * + ( -p_boc1 * exp_p1i + + exp_p2i / ( exp_p2i + exp_p2j ) )); -int BOp( storage *workspace, reax_list *bonds, double bo_cut, - int i, int btop_i, far_neighbor_data *nbr_pj, - single_body_parameters *sbp_i, single_body_parameters *sbp_j, - two_body_parameters *twbp) { - int j, btop_j; - double r2, C12, C34, C56; - double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; - double BO, BO_s, BO_pi, BO_pi2; - bond_data *ibond, *jbond; - bond_order_data *bo_ij, *bo_ji; + Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + + Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); - j = nbr_pj->nbr; - r2 = SQR(nbr_pj->d); + } else { + /* No overcoordination correction! */ + f1 = 1.0; + Cf1_ij = Cf1_ji = 0.0; + } - if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { - C12 = twbp->p_bo1 * pow( nbr_pj->d / twbp->r_s, twbp->p_bo2 ); - BO_s = (1.0 + bo_cut) * exp( C12 ); - } - else BO_s = C12 = 0.0; + if (twbp->v13cor >= 0.001) { + /* Correction for 1-3 bond orders */ + exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); + exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); - if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { - C34 = twbp->p_bo3 * pow( nbr_pj->d / twbp->r_p, twbp->p_bo4 ); - BO_pi = exp( C34 ); - } - else BO_pi = C34 = 0.0; + f4 = 1. / (1. + exp_f4); + f5 = 1. / (1. + exp_f5); + f4f5 = f4 * f5; - if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { - C56 = twbp->p_bo5 * pow( nbr_pj->d / twbp->r_pp, twbp->p_bo6 ); - BO_pi2= exp( C56 ); - } - else BO_pi2 = C56 = 0.0; + /* Bond Order pages 8-9, derivative of f4 and f5 */ + Cf45_ij = -f4 * exp_f4; + Cf45_ji = -f5 * exp_f5; + } else { + f4 = f5 = f4f5 = 1.0; + Cf45_ij = Cf45_ji = 0.0; + } - /* Initially BO values are the uncorrected ones, page 1 */ - BO = BO_s + BO_pi + BO_pi2; + /* Bond Order page 10, derivative of total bond order */ + A0_ij = f1 * f4f5; + A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO * + (Cf45_ij + Cf45_ji); + A2_ij = Cf1_ij / f1 + twbp->p_boc3 * Cf45_ij; + A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji; + A3_ij = A2_ij + Cf1_ij / f1; + A3_ji = A2_ji + Cf1_ji / f1; - if (BO >= bo_cut) { - /****** bonds i-j and j-i ******/ - ibond = &( bonds->select.bond_list[btop_i] ); - btop_j = End_Index( j, bonds ); - jbond = &(bonds->select.bond_list[btop_j]); + /* find corrected bond orders and their derivative coef */ + bo_ij->BO = bo_ij->BO * A0_ij; + bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; + bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; + bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); - ibond->nbr = j; - jbond->nbr = i; - ibond->d = nbr_pj->d; - jbond->d = nbr_pj->d; - rvec_Copy( ibond->dvec, nbr_pj->dvec ); - rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); - ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); - ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); - ibond->dbond_index = btop_i; - jbond->dbond_index = btop_i; - ibond->sym_index = btop_j; - jbond->sym_index = btop_i; - Set_End_Index( j, btop_j+1, bonds ); + bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; + bo_ij->C2dbo = bo_ij->BO * A2_ij; + bo_ij->C3dbo = bo_ij->BO * A2_ji; - bo_ij = &( ibond->bo_data ); - bo_ji = &( jbond->bo_data ); - bo_ji->BO = bo_ij->BO = BO; - bo_ji->BO_s = bo_ij->BO_s = BO_s; - bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; - bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; + bo_ij->C1dbopi = f1*f1*f4*f5; + bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij; + bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij; + bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji; - /* Bond Order page2-3, derivative of total bond order prime */ - Cln_BOp_s = twbp->p_bo2 * C12 / r2; - Cln_BOp_pi = twbp->p_bo4 * C34 / r2; - Cln_BOp_pi2 = twbp->p_bo6 * C56 / r2; + bo_ij->C1dbopi2 = f1*f1*f4*f5; + bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij; + bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij; + bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji; + } - /* Only dln_BOp_xx wrt. dr_i is stored here, note that - dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ - rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec); - rvec_Scale(bo_ij->dln_BOp_pi,-bo_ij->BO_pi*Cln_BOp_pi,ibond->dvec); - rvec_Scale(bo_ij->dln_BOp_pi2, - -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); - rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); - rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); - rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); + /* neglect bonds that are < 1e-10 */ + if (bo_ij->BO < 1e-10) + bo_ij->BO = 0.0; + if (bo_ij->BO_s < 1e-10) + bo_ij->BO_s = 0.0; + if (bo_ij->BO_pi < 1e-10) + bo_ij->BO_pi = 0.0; + if (bo_ij->BO_pi2 < 1e-10) + bo_ij->BO_pi2 = 0.0; - rvec_Scale( bo_ij->dBOp, - -(bo_ij->BO_s * Cln_BOp_s + - bo_ij->BO_pi * Cln_BOp_pi + - bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); - rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); - - rvec_Add( workspace->dDeltap_self[i], bo_ij->dBOp ); - rvec_Add( workspace->dDeltap_self[j], bo_ji->dBOp ); - - bo_ij->BO_s -= bo_cut; - bo_ij->BO -= bo_cut; - bo_ji->BO_s -= bo_cut; - bo_ji->BO -= bo_cut; - workspace->total_bond_order[i] += bo_ij->BO; //currently total_BOp - workspace->total_bond_order[j] += bo_ji->BO; //currently total_BOp - bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0; - bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0; - - return 1; - } - - return 0; -} - - -void BO( reax_system *system, control_params * /*control*/, simulation_data * /*data*/, - storage *workspace, reax_list **lists, output_controls * /*out_control*/ ) -{ - int i, j, pj, type_i, type_j; - int start_i, end_i, sym_index; - double val_i, Deltap_i, Deltap_boc_i; - double val_j, Deltap_j, Deltap_boc_j; - double f1, f2, f3, f4, f5, f4f5, exp_f4, exp_f5; - double exp_p1i, exp_p2i, exp_p1j, exp_p2j; - double temp, u1_ij, u1_ji, Cf1A_ij, Cf1B_ij, Cf1_ij, Cf1_ji; - double Cf45_ij, Cf45_ji, p_lp1; //u_ij, u_ji - double A0_ij, A1_ij, A2_ij, A2_ji, A3_ij, A3_ji; - double explp1, p_boc1, p_boc2; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - bond_order_data *bo_ij, *bo_ji; - reax_list *bonds = (*lists) + BONDS; - - p_boc1 = system->reax_param.gp.l[0]; - p_boc2 = system->reax_param.gp.l[1]; - - /* Calculate Deltaprime, Deltaprime_boc values */ - for (i = 0; i < system->N; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[type_i]); - workspace->Deltap[i] = workspace->total_bond_order[i] - sbp_i->valency; - workspace->Deltap_boc[i] = - workspace->total_bond_order[i] - sbp_i->valency_val; - - workspace->total_bond_order[i] = 0; - } - - /* Corrected Bond Order calculations */ - for (i = 0; i < system->N; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[type_i]); - val_i = sbp_i->valency; - Deltap_i = workspace->Deltap[i]; - Deltap_boc_i = workspace->Deltap_boc[i]; - start_i = Start_Index(i, bonds); - end_i = End_Index(i, bonds); - - for (pj = start_i; pj < end_i; ++pj) { - j = bonds->select.bond_list[pj].nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - bo_ij = &( bonds->select.bond_list[pj].bo_data ); - // fprintf( stderr, "\tj:%d - ubo: %8.3f\n", j+1, bo_ij->BO ); - - if (i < j || workspace->bond_mark[j] > 3) { - twbp = &( system->reax_param.tbp[type_i][type_j] ); - - if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { - bo_ij->C1dbo = 1.000000; - bo_ij->C2dbo = 0.000000; - bo_ij->C3dbo = 0.000000; - - bo_ij->C1dbopi = 1.000000; - bo_ij->C2dbopi = 0.000000; - bo_ij->C3dbopi = 0.000000; - bo_ij->C4dbopi = 0.000000; - - bo_ij->C1dbopi2 = 1.000000; - bo_ij->C2dbopi2 = 0.000000; - bo_ij->C3dbopi2 = 0.000000; - bo_ij->C4dbopi2 = 0.000000; + workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO } else { - val_j = system->reax_param.sbp[type_j].valency; - Deltap_j = workspace->Deltap[j]; - Deltap_boc_j = workspace->Deltap_boc[j]; - - /* on page 1 */ - if (twbp->ovc >= 0.001) { - /* Correction for overcoordination */ - exp_p1i = exp( -p_boc1 * Deltap_i ); - exp_p2i = exp( -p_boc2 * Deltap_i ); - exp_p1j = exp( -p_boc1 * Deltap_j ); - exp_p2j = exp( -p_boc2 * Deltap_j ); - - f2 = exp_p1i + exp_p1j; - f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); - f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + - ( val_j + f2 )/( val_j + f2 + f3 ) ); - - temp = f2 + f3; - u1_ij = val_i + temp; - u1_ji = val_j + temp; - Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + - 1.0 / SQR( u1_ji )); - Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + - ( u1_ji - f3 ) / SQR( u1_ji )); - - Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - - ((val_i+f2) / SQR(u1_ij)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) ) + - -p_boc1 * exp_p1i / u1_ji - - ((val_j+f2) / SQR(u1_ji)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) )); - - - Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + - Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); - - } - else { - /* No overcoordination correction! */ - f1 = 1.0; - Cf1_ij = Cf1_ji = 0.0; - } - - if (twbp->v13cor >= 0.001) { - /* Correction for 1-3 bond orders */ - exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - - Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); - exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - - Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); - - f4 = 1. / (1. + exp_f4); - f5 = 1. / (1. + exp_f5); - f4f5 = f4 * f5; - - /* Bond Order pages 8-9, derivative of f4 and f5 */ - Cf45_ij = -f4 * exp_f4; - Cf45_ji = -f5 * exp_f5; - } - else { - f4 = f5 = f4f5 = 1.0; - Cf45_ij = Cf45_ji = 0.0; - } - - /* Bond Order page 10, derivative of total bond order */ - A0_ij = f1 * f4f5; - A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO * - (Cf45_ij + Cf45_ji); - A2_ij = Cf1_ij / f1 + twbp->p_boc3 * Cf45_ij; - A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji; - A3_ij = A2_ij + Cf1_ij / f1; - A3_ji = A2_ji + Cf1_ji / f1; - - /* find corrected bond orders and their derivative coef */ - bo_ij->BO = bo_ij->BO * A0_ij; - bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; - bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; - bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); - - bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; - bo_ij->C2dbo = bo_ij->BO * A2_ij; - bo_ij->C3dbo = bo_ij->BO * A2_ji; - - bo_ij->C1dbopi = f1*f1*f4*f5; - bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij; - bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij; - bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji; - - bo_ij->C1dbopi2 = f1*f1*f4*f5; - bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij; - bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij; - bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji; + /* We only need to update bond orders from bo_ji + everything else is set in uncorrected_bo calculations */ + sym_index = bonds->select.bond_list[pj].sym_index; + bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); + bo_ij->BO = bo_ji->BO; + bo_ij->BO_s = bo_ji->BO_s; + bo_ij->BO_pi = bo_ji->BO_pi; + bo_ij->BO_pi2 = bo_ji->BO_pi2; + workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO } + } - /* neglect bonds that are < 1e-10 */ - if (bo_ij->BO < 1e-10) - bo_ij->BO = 0.0; - if (bo_ij->BO_s < 1e-10) - bo_ij->BO_s = 0.0; - if (bo_ij->BO_pi < 1e-10) - bo_ij->BO_pi = 0.0; - if (bo_ij->BO_pi2 < 1e-10) - bo_ij->BO_pi2 = 0.0; + } - workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO + p_lp1 = system->reax_param.gp.l[15]; + for (j = 0; j < system->N; ++j) { + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + sbp_j = &(system->reax_param.sbp[ type_j ]); + workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; + workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; + workspace->Delta_boc[j] = workspace->total_bond_order[j] - + sbp_j->valency_boc; + workspace->Delta_val[j] = workspace->total_bond_order[j] - + sbp_j->valency_val; + + workspace->vlpex[j] = workspace->Delta_e[j] - + 2.0 * (int)(workspace->Delta_e[j]/2.0); + explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j])); + workspace->nlp[j] = explp1 - (int)(workspace->Delta_e[j] / 2.0); + workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j]; + workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]); + workspace->dDelta_lp[j] = workspace->Clp[j]; + + if (sbp_j->mass > 21.0) { + workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency); + workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; + workspace->dDelta_lp_temp[j] = 0.; } else { - /* We only need to update bond orders from bo_ji - everything else is set in uncorrected_bo calculations */ - sym_index = bonds->select.bond_list[pj].sym_index; - bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); - bo_ij->BO = bo_ji->BO; - bo_ij->BO_s = bo_ji->BO_s; - bo_ij->BO_pi = bo_ji->BO_pi; - bo_ij->BO_pi2 = bo_ji->BO_pi2; - - workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO + workspace->nlp_temp[j] = workspace->nlp[j]; + workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; + workspace->dDelta_lp_temp[j] = workspace->Clp[j]; } } - } - - p_lp1 = system->reax_param.gp.l[15]; - for (j = 0; j < system->N; ++j) { - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[ type_j ]); - - workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; - workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; - workspace->Delta_boc[j] = workspace->total_bond_order[j] - - sbp_j->valency_boc; - workspace->Delta_val[j] = workspace->total_bond_order[j] - - sbp_j->valency_val; - - workspace->vlpex[j] = workspace->Delta_e[j] - - 2.0 * (int)(workspace->Delta_e[j]/2.0); - explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j])); - workspace->nlp[j] = explp1 - (int)(workspace->Delta_e[j] / 2.0); - workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j]; - workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]); - workspace->dDelta_lp[j] = workspace->Clp[j]; - - if (sbp_j->mass > 21.0) { - workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency); - workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; - workspace->dDelta_lp_temp[j] = 0.; - } - else { - workspace->nlp_temp[j] = workspace->nlp[j]; - workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; - workspace->dDelta_lp_temp[j] = workspace->Clp[j]; - } - - } - } diff --git a/src/USER-REAXC/reaxc_bond_orders.h b/src/USER-REAXC/reaxc_bond_orders.h deleted file mode 100644 index 09137a7afb..0000000000 --- a/src/USER-REAXC/reaxc_bond_orders.h +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __BOND_ORDERS_H_ -#define __BOND_ORDERS_H_ - -#include "reaxc_types.h" - -typedef struct{ - double C1dbo, C2dbo, C3dbo; - double C1dbopi, C2dbopi, C3dbopi, C4dbopi; - double C1dbopi2, C2dbopi2, C3dbopi2, C4dbopi2; - double C1dDelta, C2dDelta, C3dDelta; -}dbond_coefficients; - -void Add_dBond_to_Forces( reax_system*, int, int, storage*, reax_list** ); -void Add_dBond_to_Forces_NPT( int, int, storage*, reax_list** ); -int BOp(storage*, reax_list*, double, int, int, far_neighbor_data*, - single_body_parameters*, single_body_parameters*, two_body_parameters*); -void BO( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); -#endif diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index c706a2fd79..a06700bb3b 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -24,112 +24,113 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_bonds.h" -#include +#include "reaxff_api.h" + #include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -void Bonds( reax_system *system, control_params * /*control*/, - simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/ ) -{ - int i, j, pj, natoms; - int start_i, end_i; - int type_i, type_j; - double ebond, pow_BOs_be2, exp_be12, CEbo; - double gp3, gp4, gp7, gp10, gp37; - double exphu, exphua1, exphub1, exphuov, hulpov, estriph; - double decobdbo, decobdboua, decobdboub; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - bond_order_data *bo_ij; - reax_list *bonds; +#include - bonds = (*lists) + BONDS; - gp3 = system->reax_param.gp.l[3]; - gp4 = system->reax_param.gp.l[4]; - gp7 = system->reax_param.gp.l[7]; - gp10 = system->reax_param.gp.l[10]; - gp37 = (int) system->reax_param.gp.l[37]; - natoms = system->n; +namespace ReaxFF { + void Bonds(reax_system *system, simulation_data *data, + storage *workspace, reax_list **lists) + { + int i, j, pj, natoms; + int start_i, end_i; + int type_i, type_j; + double ebond, pow_BOs_be2, exp_be12, CEbo; + double gp3, gp4, gp7, gp10, gp37; + double exphu, exphua1, exphub1, exphuov, hulpov, estriph; + double decobdbo, decobdboua, decobdboub; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + bond_order_data *bo_ij; + reax_list *bonds; - for (i = 0; i < natoms; ++i) { - start_i = Start_Index(i, bonds); - end_i = End_Index(i, bonds); + bonds = (*lists) + BONDS; + gp3 = system->reax_param.gp.l[3]; + gp4 = system->reax_param.gp.l[4]; + gp7 = system->reax_param.gp.l[7]; + gp10 = system->reax_param.gp.l[10]; + gp37 = (int) system->reax_param.gp.l[37]; + natoms = system->n; - for (pj = start_i; pj < end_i; ++pj) { - j = bonds->select.bond_list[pj].nbr; + for (i = 0; i < natoms; ++i) { + start_i = Start_Index(i, bonds); + end_i = End_Index(i, bonds); - if (system->my_atoms[i].orig_id > system->my_atoms[j].orig_id) - continue; - if (system->my_atoms[i].orig_id == system->my_atoms[j].orig_id) { - if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && - system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && - system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && - system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; - } + for (pj = start_i; pj < end_i; ++pj) { + j = bonds->select.bond_list[pj].nbr; - /* set the pointers */ - type_i = system->my_atoms[i].type; - type_j = system->my_atoms[j].type; - sbp_i = &( system->reax_param.sbp[type_i] ); - sbp_j = &( system->reax_param.sbp[type_j] ); - twbp = &( system->reax_param.tbp[type_i][type_j] ); - bo_ij = &( bonds->select.bond_list[pj].bo_data ); + if (system->my_atoms[i].orig_id > system->my_atoms[j].orig_id) + continue; + if (system->my_atoms[i].orig_id == system->my_atoms[j].orig_id) { + if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && + system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; + } - /* calculate the constants */ - if (bo_ij->BO_s == 0.0) pow_BOs_be2 = 0.0; - else pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); - exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); - CEbo = -twbp->De_s * exp_be12 * - ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); + /* set the pointers */ + type_i = system->my_atoms[i].type; + type_j = system->my_atoms[j].type; + sbp_i = &( system->reax_param.sbp[type_i] ); + sbp_j = &( system->reax_param.sbp[type_j] ); + twbp = &( system->reax_param.tbp[type_i][type_j] ); + bo_ij = &( bonds->select.bond_list[pj].bo_data ); - /* calculate the Bond Energy */ - data->my_en.e_bond += ebond = - -twbp->De_s * bo_ij->BO_s * exp_be12 - -twbp->De_p * bo_ij->BO_pi - -twbp->De_pp * bo_ij->BO_pi2; + /* calculate the constants */ + if (bo_ij->BO_s == 0.0) pow_BOs_be2 = 0.0; + else pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); + exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); + CEbo = -twbp->De_s * exp_be12 * + ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(i,j,natoms,1,ebond,0.0,0.0,0.0,0.0,0.0); + /* calculate the Bond Energy */ + data->my_en.e_bond += ebond = + -twbp->De_s * bo_ij->BO_s * exp_be12 + -twbp->De_p * bo_ij->BO_pi + -twbp->De_pp * bo_ij->BO_pi2; - /* calculate derivatives of Bond Orders */ - bo_ij->Cdbo += CEbo; - bo_ij->Cdbopi -= (CEbo + twbp->De_p); - bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) + system->pair_ptr->ev_tally(i,j,natoms,1,ebond,0.0,0.0,0.0,0.0,0.0); - /* Stabilisation terminal triple bond */ - if (bo_ij->BO >= 1.00) { - if ( gp37 == 2 || - (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || - (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { - exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); - exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); - exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); - exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); - hulpov = 1.0 / (1.0 + 25.0 * exphuov); + /* calculate derivatives of Bond Orders */ + bo_ij->Cdbo += CEbo; + bo_ij->Cdbopi -= (CEbo + twbp->De_p); + bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); - estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); - data->my_en.e_bond += estriph; + /* Stabilisation terminal triple bond */ + if (bo_ij->BO >= 1.00) { + if ( gp37 == 2 || + (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || + (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { + exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); + exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); + exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); + exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); + hulpov = 1.0 / (1.0 + 25.0 * exphuov); - decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * - ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); - decobdboua = -gp10 * exphu * hulpov * - (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); - decobdboub = -gp10 * exphu * hulpov * - (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); + estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); + data->my_en.e_bond += estriph; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(i,j,natoms,1,estriph,0.0,0.0,0.0,0.0,0.0); + decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * + ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); + decobdboua = -gp10 * exphu * hulpov * + (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); + decobdboub = -gp10 * exphu * hulpov * + (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); - bo_ij->Cdbo += decobdbo; - workspace->CdDelta[i] += decobdboua; - workspace->CdDelta[j] += decobdboub; + /* tally into per-atom energy */ + if (system->pair_ptr->evflag) + system->pair_ptr->ev_tally(i,j,natoms,1,estriph,0.0,0.0,0.0,0.0,0.0); + + bo_ij->Cdbo += decobdbo; + workspace->CdDelta[i] += decobdboua; + workspace->CdDelta[j] += decobdboub; + } } } } diff --git a/src/USER-REAXC/reaxc_bonds.h b/src/USER-REAXC/reaxc_bonds.h deleted file mode 100644 index a4a1fb0b44..0000000000 --- a/src/USER-REAXC/reaxc_bonds.h +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __BONDS_H_ -#define __BONDS_H_ - -#include "reaxc_types.h" - -void Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); -#endif diff --git a/src/USER-REAXC/reaxc_control.h b/src/USER-REAXC/reaxc_control.h deleted file mode 100644 index 5739d97574..0000000000 --- a/src/USER-REAXC/reaxc_control.h +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __CONTROL_H_ -#define __CONTROL_H_ - -#include "reaxc_types.h" - -void Read_Control_File(const char *, control_params *, output_controls *); - -#endif diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h deleted file mode 100644 index 5f1fc0fd6f..0000000000 --- a/src/USER-REAXC/reaxc_defs.h +++ /dev/null @@ -1,105 +0,0 @@ - - -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef LMP_REAXC_DEFS_H -#define LMP_REAXC_DEFS_H - -#if defined(__IBMC__) -#define inline __inline__ -#endif /*IBMC*/ - -#ifndef SUCCESS -#define SUCCESS 1 -#endif -#ifndef FAILURE -#define FAILURE 0 -#endif - -#define SQR(x) ((x)*(x)) -#define CUBE(x) ((x)*(x)*(x)) -#define DEG2RAD(a) ((a)*constPI/180.0) -#define RAD2DEG(a) ((a)*180.0/constPI) -#define MAX3(x,y,z) MAX( MAX(x,y), z) - -#define constPI 3.14159265 -#define C_ele 332.06371 -//#define K_B 503.398008 // kcal/mol/K -#define K_B 0.831687 // amu A^2 / ps^2 / K -#define F_CONV 1e6 / 48.88821291 / 48.88821291 // --> amu A / ps^2 -#define E_CONV 0.002391 // amu A^2 / ps^2 --> kcal/mol -#define EV_to_KCALpMOL 14.400000 // ElectronVolt --> KCAL per MOLe -#define KCALpMOL_to_EV 23.02 // 23.060549 //KCAL per MOLe --> ElectronVolt -#define ECxA_to_DEBYE 4.803204 // elem. charge * Ang -> debye -#define CAL_to_JOULES 4.184000 // CALories --> JOULES -#define JOULES_to_CAL 1/4.184000 // JOULES --> CALories -#define AMU_to_GRAM 1.6605e-24 -#define ANG_to_CM 1e-8 -#define AVOGNR 6.0221367e23 -#define P_CONV 1e-24 * AVOGNR * JOULES_to_CAL - -#define MAX_STR 1024 -#define MAX_LINE 1024 -#define MAX_TOKENS 1024 -#define MAX_TOKEN_LEN 1024 - -#define NUM_INTRS 10 -#define ALMOST_ZERO 1e-10 -#define NEG_INF -1e10 -#define NO_BOND 1e-3 // 0.001 -#define HB_THRESHOLD 1e-2 // 0.01 - -#define REAX_MIN_CAP 50 -#define REAX_MIN_NBRS 100 -#define MIN_HENTRIES 100 -#define MAX_BONDS 30 -#define MIN_BONDS 25 -#define REAX_MIN_HBONDS 25 -#define MIN_3BODIES 1000 -#define REAX_SAFE_ZONE 1.2 -#define REAX_SAFER_ZONE 1.4 -#define DANGER_ZONE 0.90 -#define LOOSE_ZONE 0.75 -#define MAX_3BODY_PARAM 5 -#define MAX_4BODY_PARAM 5 - -#define MASTER_NODE 0 - -#define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ -#define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ - -/******************* ENUMERATIONS *************************/ - -enum lists { BONDS, OLD_BONDS, THREE_BODIES, - HBONDS, FAR_NBRS, DBOS, DDELTAS, LIST_N }; - -enum message_tags {NONE, INIT_DESCS, ATOM_LINES, BOND_LINES, ANGLE_LINES}; - -enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, - TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; - -#endif diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index a48ba93e85..88381040c2 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -24,7 +24,7 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_ffield.h" +#include "reaxff_api.h" #include #include @@ -32,717 +32,720 @@ #include #include #include -#include "reaxc_defs.h" #include "error.h" -#include "reaxc_tool_box.h" + #include "utils.h" using LAMMPS_NS::utils::open_potential; using LAMMPS_NS::utils::getsyserror; -void Read_Force_Field(const char *filename, reax_interaction *reax, - control_params *control ) -{ - char *s; - char **tmp; - char ****tor_flag; - int c, i, j, k, l, m, n, o, p, cnt; - int lgflag = control->lgflag; - int errorflag = 1; - double val; - int me = control->me; +namespace ReaxFF { + extern int Tokenize(char* s, char*** tok); + + void Read_Force_Field(const char *filename, reax_interaction *reax, + control_params *control) + { + char *s; + char **tmp; + char ****tor_flag; + int c, i, j, k, l, m, n, o, p, cnt; + int lgflag = control->lgflag; + int errorflag = 1; + double val; + int me = control->me; - FILE *fp = open_potential(filename,control->lmp_ptr,nullptr); - if (!fp) - control->error_ptr->all(FLERR,fmt::format("Cannot open ReaxFF potential " - "file {}: {}",filename, - getsyserror())); - s = (char*) malloc(sizeof(char)*MAX_LINE); - tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); - for (i=0; i < MAX_TOKENS; i++) - tmp[i] = (char*) malloc(sizeof(char)*MAX_TOKEN_LEN); + FILE *fp = open_potential(filename,control->lmp_ptr,nullptr); + if (!fp) + control->error_ptr->all(FLERR,fmt::format("Cannot open ReaxFF potential " + "file {}: {}",filename, + getsyserror())); + s = (char*) malloc(sizeof(char)*MAX_LINE); + tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); + for (i=0; i < MAX_TOKENS; i++) + tmp[i] = (char*) malloc(sizeof(char)*MAX_TOKEN_LEN); - /* reading first header comment */ - fgets( s, MAX_LINE, fp ); + /* reading first header comment */ + fgets(s, MAX_LINE, fp); - /* line 2 is number of global parameters */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); + /* line 2 is number of global parameters */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); - /* reading the number of global parameters */ - n = atoi(tmp[0]); - if (n < 1) { - if (me == 0) - control->error_ptr->warning( FLERR, "Number of globals in ffield file is 0. The file will not be read." ); - fclose(fp); - free(s); - free(tmp); - return; - } + /* reading the number of global parameters */ + n = atoi(tmp[0]); + if (n < 1) { + if (me == 0) + control->error_ptr->warning(FLERR, "Number of globals in ffield file is 0. The file will not be read."); + fclose(fp); + free(s); + free(tmp); + return; + } - reax->gp.n_global = n; - reax->gp.l = (double*) malloc(sizeof(double)*n); + reax->gp.n_global = n; + reax->gp.l = (double*) malloc(sizeof(double)*n); - /* see reax_types.h for mapping between l[i] and the lambdas used in ff */ - for (i=0; i < n; i++) { + /* see reax_types.h for mapping between l[i] and the lambdas used in ff */ + for (i=0; i < n; i++) { + fgets(s,MAX_LINE,fp); + c = Tokenize(s,&tmp); + + val = (double) atof(tmp[0]); + reax->gp.l[i] = val; + } + + control->bo_cut = 0.01 * reax->gp.l[29]; + control->nonb_low = reax->gp.l[11]; + control->nonb_cut = reax->gp.l[12]; + + /* next line is number of atom types and some comments */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + reax->num_atom_types = atoi(tmp[0]); + + /* 3 lines of comments */ + fgets(s,MAX_LINE,fp); + fgets(s,MAX_LINE,fp); fgets(s,MAX_LINE,fp); - c = Tokenize(s,&tmp); - val = (double) atof(tmp[0]); - reax->gp.l[i] = val; - } + /* Allocating structures in reax_interaction */ + reax->sbp = (single_body_parameters*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(single_body_parameters), "sbp"); + reax->tbp = (two_body_parameters**) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters*), "tbp"); + reax->thbp= (three_body_header***) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header**), "thbp"); + reax->hbp = (hbond_parameters***) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters**), "hbp"); + reax->fbp = (four_body_header****) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header***), "fbp"); + tor_flag = (char****) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char***), "tor_flag"); - control->bo_cut = 0.01 * reax->gp.l[29]; - control->nonb_low = reax->gp.l[11]; - control->nonb_cut = reax->gp.l[12]; + for (i = 0; i < reax->num_atom_types; i++) { + reax->tbp[i] = (two_body_parameters*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]"); + reax->thbp[i]= (three_body_header**) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]"); + reax->hbp[i] = (hbond_parameters**) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]"); + reax->fbp[i] = (four_body_header***) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]"); + tor_flag[i] = (char***) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char**), "tor_flag[i]"); - /* next line is number of atom types and some comments */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - reax->num_atom_types = atoi(tmp[0]); + for (j = 0; j < reax->num_atom_types; j++) { + reax->thbp[i][j]= (three_body_header*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]"); + reax->hbp[i][j] = (hbond_parameters*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]"); + reax->fbp[i][j] = (four_body_header**) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]"); + tor_flag[i][j] = (char**) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]"); - /* 3 lines of comments */ - fgets(s,MAX_LINE,fp); - fgets(s,MAX_LINE,fp); - fgets(s,MAX_LINE,fp); - - /* Allocating structures in reax_interaction */ - reax->sbp = (single_body_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(single_body_parameters), "sbp"); - reax->tbp = (two_body_parameters**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters*), "tbp"); - reax->thbp= (three_body_header***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header**), "thbp"); - reax->hbp = (hbond_parameters***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters**), "hbp"); - reax->fbp = (four_body_header****) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header***), "fbp"); - tor_flag = (char****) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char***), "tor_flag"); - - for (i = 0; i < reax->num_atom_types; i++) { - reax->tbp[i] = (two_body_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]"); - reax->thbp[i]= (three_body_header**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]"); - reax->hbp[i] = (hbond_parameters**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]"); - reax->fbp[i] = (four_body_header***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]"); - tor_flag[i] = (char***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char**), "tor_flag[i]"); - - for (j = 0; j < reax->num_atom_types; j++) { - reax->thbp[i][j]= (three_body_header*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]"); - reax->hbp[i][j] = (hbond_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]"); - reax->fbp[i][j] = (four_body_header**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]"); - tor_flag[i][j] = (char**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]"); - - for (k=0; k < reax->num_atom_types; k++) { - reax->fbp[i][j][k] = (four_body_header*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]"); - tor_flag[i][j][k] = (char*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]"); + for (k=0; k < reax->num_atom_types; k++) { + reax->fbp[i][j][k] = (four_body_header*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]"); + tor_flag[i][j][k] = (char*) + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]"); + } } } - } - reax->gp.vdw_type = 0; + reax->gp.vdw_type = 0; - char errmsg[1024]; + char errmsg[1024]; - for (i = 0; i < reax->num_atom_types; i++) { - /* line one */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); + for (i = 0; i < reax->num_atom_types; i++) { + /* line one */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); - /* Sanity checks */ - if (c == 2 && !lgflag) + /* Sanity checks */ + if (c == 2 && !lgflag) control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); - if (c < 9) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - for (j = 0; j < (int)(strlen(tmp[0])); ++j) - reax->sbp[i].name[j] = toupper( tmp[0][j] ); - - val = atof(tmp[1]); reax->sbp[i].r_s = val; - val = atof(tmp[2]); reax->sbp[i].valency = val; - val = atof(tmp[3]); reax->sbp[i].mass = val; - val = atof(tmp[4]); reax->sbp[i].r_vdw = val; - val = atof(tmp[5]); reax->sbp[i].epsilon = val; - val = atof(tmp[6]); reax->sbp[i].gamma = val; - val = atof(tmp[7]); reax->sbp[i].r_pi = val; - val = atof(tmp[8]); reax->sbp[i].valency_e = val; - reax->sbp[i].nlp_opt = 0.5 * (reax->sbp[i].valency_e-reax->sbp[i].valency); - - /* line two */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].alpha = val; - val = atof(tmp[1]); reax->sbp[i].gamma_w = val; - val = atof(tmp[2]); reax->sbp[i].valency_boc= val; - val = atof(tmp[3]); reax->sbp[i].p_ovun5 = val; - val = atof(tmp[4]); - val = atof(tmp[5]); reax->sbp[i].chi = val; - val = atof(tmp[6]); reax->sbp[i].eta = 2.0 * val; - val = atof(tmp[7]); reax->sbp[i].p_hbond = (int) val; - - /* line 3 */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; - val = atof(tmp[1]); reax->sbp[i].p_lp2 = val; - val = atof(tmp[2]); - val = atof(tmp[3]); reax->sbp[i].b_o_131 = val; - val = atof(tmp[4]); reax->sbp[i].b_o_132 = val; - val = atof(tmp[5]); reax->sbp[i].b_o_133 = val; - val = atof(tmp[6]); - val = atof(tmp[7]); - - /* line 4 */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; - val = atof(tmp[1]); reax->sbp[i].p_val3 = val; - val = atof(tmp[2]); - val = atof(tmp[3]); reax->sbp[i].valency_val= val; - val = atof(tmp[4]); reax->sbp[i].p_val5 = val; - val = atof(tmp[5]); reax->sbp[i].rcore2 = val; - val = atof(tmp[6]); reax->sbp[i].ecore2 = val; - val = atof(tmp[7]); reax->sbp[i].acore2 = val; - - /* line 5, only if lgvdw is yes */ - if (lgflag) { - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - - /* Sanity check */ - if (c > 2) { - control->error_ptr->all(FLERR,"Force field file incompatible with 'lgvdw yes'"); - } - - val = atof(tmp[0]); reax->sbp[i].lgcij = val; - val = atof(tmp[1]); reax->sbp[i].lgre = val; - } - - if (reax->sbp[i].rcore2>0.01 && reax->sbp[i].acore2>0.01) { // Inner-wall - if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 3) { - if (errorflag && (me == 0)) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals-parameters for element %s " - "indicate inner wall+shielding, but earlier " - "atoms indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - errorflag = 0; - } else { - reax->gp.vdw_type = 3; - } - } else { // No shielding vdWaals parameters present - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 2) { - if (me == 0) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals-parameters for element %s " - "indicate inner wall without shielding, but earlier " - "atoms indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - } else { - reax->gp.vdw_type = 2; - } - } - } else { // No Inner wall parameters present - if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 1) { - if (me == 0) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals parameters for element %s " - "indicate shielding without inner wall, but earlier " - "elements indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - } else { - reax->gp.vdw_type = 1; - } - } else { - char errmsg[256]; - snprintf(errmsg, 256, "Inconsistent vdWaals-parameters: " - "No shielding or inner-wall set for element %s", - reax->sbp[i].name); + if (c < 9) { + snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); control->error_ptr->all(FLERR, errmsg); } - } - } - /* Equate vval3 to valf for first-row elements (25/10/2004) */ - for (i = 0; i < reax->num_atom_types; i++) - if ( reax->sbp[i].mass < 21 && - reax->sbp[i].valency_val != reax->sbp[i].valency_boc) { - if (me == 0) { - char errmsg[256]; - snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); + for (j = 0; j < (int)(strlen(tmp[0])); ++j) + reax->sbp[i].name[j] = toupper(tmp[0][j]); + + val = atof(tmp[1]); reax->sbp[i].r_s = val; + val = atof(tmp[2]); reax->sbp[i].valency = val; + val = atof(tmp[3]); reax->sbp[i].mass = val; + val = atof(tmp[4]); reax->sbp[i].r_vdw = val; + val = atof(tmp[5]); reax->sbp[i].epsilon = val; + val = atof(tmp[6]); reax->sbp[i].gamma = val; + val = atof(tmp[7]); reax->sbp[i].r_pi = val; + val = atof(tmp[8]); reax->sbp[i].valency_e = val; + reax->sbp[i].nlp_opt = 0.5 * (reax->sbp[i].valency_e-reax->sbp[i].valency); + + /* line two */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + + /* Sanity check */ + if (c < 8) { + snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); + control->error_ptr->all(FLERR, errmsg); + } + + val = atof(tmp[0]); reax->sbp[i].alpha = val; + val = atof(tmp[1]); reax->sbp[i].gamma_w = val; + val = atof(tmp[2]); reax->sbp[i].valency_boc= val; + val = atof(tmp[3]); reax->sbp[i].p_ovun5 = val; + val = atof(tmp[4]); + val = atof(tmp[5]); reax->sbp[i].chi = val; + val = atof(tmp[6]); reax->sbp[i].eta = 2.0 * val; + val = atof(tmp[7]); reax->sbp[i].p_hbond = (int) val; + + /* line 3 */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + + /* Sanity check */ + if (c < 8) { + snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); + control->error_ptr->all(FLERR, errmsg); + } + + val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; + val = atof(tmp[1]); reax->sbp[i].p_lp2 = val; + val = atof(tmp[2]); + val = atof(tmp[3]); reax->sbp[i].b_o_131 = val; + val = atof(tmp[4]); reax->sbp[i].b_o_132 = val; + val = atof(tmp[5]); reax->sbp[i].b_o_133 = val; + val = atof(tmp[6]); + val = atof(tmp[7]); + + /* line 4 */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + + /* Sanity check */ + if (c < 8) { + snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); + control->error_ptr->all(FLERR, errmsg); + } + + val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; + val = atof(tmp[1]); reax->sbp[i].p_val3 = val; + val = atof(tmp[2]); + val = atof(tmp[3]); reax->sbp[i].valency_val= val; + val = atof(tmp[4]); reax->sbp[i].p_val5 = val; + val = atof(tmp[5]); reax->sbp[i].rcore2 = val; + val = atof(tmp[6]); reax->sbp[i].ecore2 = val; + val = atof(tmp[7]); reax->sbp[i].acore2 = val; + + /* line 5, only if lgvdw is yes */ + if (lgflag) { + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + + /* Sanity check */ + if (c > 2) { + control->error_ptr->all(FLERR,"Force field file incompatible with 'lgvdw yes'"); + } + + val = atof(tmp[0]); reax->sbp[i].lgcij = val; + val = atof(tmp[1]); reax->sbp[i].lgre = val; + } + + if (reax->sbp[i].rcore2>0.01 && reax->sbp[i].acore2>0.01) { // Inner-wall + if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals + if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 3) { + if (errorflag && (me == 0)) { + char errmsg[512]; + snprintf(errmsg, 512, "VdWaals-parameters for element %s " + "indicate inner wall+shielding, but earlier " + "atoms indicate different vdWaals-method. " + "This may cause division-by-zero errors. " + "Keeping vdWaals-setting for earlier atoms.", + reax->sbp[i].name); + control->error_ptr->warning(FLERR,errmsg); + } + errorflag = 0; + } else { + reax->gp.vdw_type = 3; + } + } else { // No shielding vdWaals parameters present + if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 2) { + if (me == 0) { + char errmsg[512]; + snprintf(errmsg, 512, "VdWaals-parameters for element %s " + "indicate inner wall without shielding, but earlier " + "atoms indicate different vdWaals-method. " + "This may cause division-by-zero errors. " + "Keeping vdWaals-setting for earlier atoms.", + reax->sbp[i].name); + control->error_ptr->warning(FLERR,errmsg); + } + } else { + reax->gp.vdw_type = 2; + } + } + } else { // No Inner wall parameters present + if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals + if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 1) { + if (me == 0) { + char errmsg[512]; + snprintf(errmsg, 512, "VdWaals parameters for element %s " + "indicate shielding without inner wall, but earlier " + "elements indicate different vdWaals-method. " + "This may cause division-by-zero errors. " + "Keeping vdWaals-setting for earlier atoms.", + reax->sbp[i].name); + control->error_ptr->warning(FLERR,errmsg); + } + } else { + reax->gp.vdw_type = 1; + } + } else { + char errmsg[256]; + snprintf(errmsg, 256, "Inconsistent vdWaals-parameters: " + "No shielding or inner-wall set for element %s", + reax->sbp[i].name); + control->error_ptr->all(FLERR, errmsg); + } } - reax->sbp[i].valency_val = reax->sbp[i].valency_boc; } - /* next line is number of two body combination and some comments */ - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); + /* Equate vval3 to valf for first-row elements (25/10/2004) */ + for (i = 0; i < reax->num_atom_types; i++) + if (reax->sbp[i].mass < 21 && + reax->sbp[i].valency_val != reax->sbp[i].valency_boc) { + if (me == 0) { + char errmsg[256]; + snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", + reax->sbp[i].name); + control->error_ptr->warning(FLERR,errmsg); + } + reax->sbp[i].valency_val = reax->sbp[i].valency_boc; + } - if (c == 2 && !lgflag) { + /* next line is number of two body combination and some comments */ + fgets(s,MAX_LINE,fp); + c=Tokenize(s,&tmp); + + if (c == 2 && !lgflag) { control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); } - l = atoi(tmp[0]); + l = atoi(tmp[0]); - /* a line of comments */ - fgets(s,MAX_LINE,fp); - - for (i=0; i < l; i++) { - /* line 1 */ + /* a line of comments */ fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - if ((c < 10) || (j < 0) || (k < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types) { - - val = atof(tmp[2]); reax->tbp[j][k].De_s = val; - reax->tbp[k][j].De_s = val; - val = atof(tmp[3]); reax->tbp[j][k].De_p = val; - reax->tbp[k][j].De_p = val; - val = atof(tmp[4]); reax->tbp[j][k].De_pp = val; - reax->tbp[k][j].De_pp = val; - val = atof(tmp[5]); reax->tbp[j][k].p_be1 = val; - reax->tbp[k][j].p_be1 = val; - val = atof(tmp[6]); reax->tbp[j][k].p_bo5 = val; - reax->tbp[k][j].p_bo5 = val; - val = atof(tmp[7]); reax->tbp[j][k].v13cor = val; - reax->tbp[k][j].v13cor = val; - - val = atof(tmp[8]); reax->tbp[j][k].p_bo6 = val; - reax->tbp[k][j].p_bo6 = val; - val = atof(tmp[9]); reax->tbp[j][k].p_ovun1 = val; - reax->tbp[k][j].p_ovun1 = val; - - /* line 2 */ + for (i=0; i < l; i++) { + /* line 1 */ fgets(s,MAX_LINE,fp); c=Tokenize(s,&tmp); - if (c < 8) + + j = atoi(tmp[0]) - 1; + k = atoi(tmp[1]) - 1; + if ((c < 10) || (j < 0) || (k < 0)) control->error_ptr->all(FLERR, "Inconsistent force field file"); - val = atof(tmp[0]); reax->tbp[j][k].p_be2 = val; - reax->tbp[k][j].p_be2 = val; - val = atof(tmp[1]); reax->tbp[j][k].p_bo3 = val; - reax->tbp[k][j].p_bo3 = val; - val = atof(tmp[2]); reax->tbp[j][k].p_bo4 = val; - reax->tbp[k][j].p_bo4 = val; - val = atof(tmp[3]); + if (j < reax->num_atom_types && k < reax->num_atom_types) { - val = atof(tmp[4]); reax->tbp[j][k].p_bo1 = val; - reax->tbp[k][j].p_bo1 = val; - val = atof(tmp[5]); reax->tbp[j][k].p_bo2 = val; - reax->tbp[k][j].p_bo2 = val; - val = atof(tmp[6]); reax->tbp[j][k].ovc = val; - reax->tbp[k][j].ovc = val; + val = atof(tmp[2]); reax->tbp[j][k].De_s = val; + reax->tbp[k][j].De_s = val; + val = atof(tmp[3]); reax->tbp[j][k].De_p = val; + reax->tbp[k][j].De_p = val; + val = atof(tmp[4]); reax->tbp[j][k].De_pp = val; + reax->tbp[k][j].De_pp = val; + val = atof(tmp[5]); reax->tbp[j][k].p_be1 = val; + reax->tbp[k][j].p_be1 = val; + val = atof(tmp[6]); reax->tbp[j][k].p_bo5 = val; + reax->tbp[k][j].p_bo5 = val; + val = atof(tmp[7]); reax->tbp[j][k].v13cor = val; + reax->tbp[k][j].v13cor = val; - val = atof(tmp[7]); - } - } + val = atof(tmp[8]); reax->tbp[j][k].p_bo6 = val; + reax->tbp[k][j].p_bo6 = val; + val = atof(tmp[9]); reax->tbp[j][k].p_ovun1 = val; + reax->tbp[k][j].p_ovun1 = val; - for (i=0; i < reax->num_atom_types; i++) - for (j=i; j < reax->num_atom_types; j++) { - reax->tbp[i][j].r_s = 0.5 * - (reax->sbp[i].r_s + reax->sbp[j].r_s); - reax->tbp[j][i].r_s = 0.5 * - (reax->sbp[j].r_s + reax->sbp[i].r_s); + /* line 2 */ + fgets(s,MAX_LINE,fp); + c=Tokenize(s,&tmp); + if (c < 8) + control->error_ptr->all(FLERR, "Inconsistent force field file"); - reax->tbp[i][j].r_p = 0.5 * - (reax->sbp[i].r_pi + reax->sbp[j].r_pi); - reax->tbp[j][i].r_p = 0.5 * - (reax->sbp[j].r_pi + reax->sbp[i].r_pi); + val = atof(tmp[0]); reax->tbp[j][k].p_be2 = val; + reax->tbp[k][j].p_be2 = val; + val = atof(tmp[1]); reax->tbp[j][k].p_bo3 = val; + reax->tbp[k][j].p_bo3 = val; + val = atof(tmp[2]); reax->tbp[j][k].p_bo4 = val; + reax->tbp[k][j].p_bo4 = val; + val = atof(tmp[3]); - reax->tbp[i][j].r_pp = 0.5 * - (reax->sbp[i].r_pi_pi + reax->sbp[j].r_pi_pi); - reax->tbp[j][i].r_pp = 0.5 * - (reax->sbp[j].r_pi_pi + reax->sbp[i].r_pi_pi); - - - reax->tbp[i][j].p_boc3 = - sqrt(reax->sbp[i].b_o_132 * - reax->sbp[j].b_o_132); - reax->tbp[j][i].p_boc3 = - sqrt(reax->sbp[j].b_o_132 * - reax->sbp[i].b_o_132); - - reax->tbp[i][j].p_boc4 = - sqrt(reax->sbp[i].b_o_131 * - reax->sbp[j].b_o_131); - reax->tbp[j][i].p_boc4 = - sqrt(reax->sbp[j].b_o_131 * - reax->sbp[i].b_o_131); - - reax->tbp[i][j].p_boc5 = - sqrt(reax->sbp[i].b_o_133 * - reax->sbp[j].b_o_133); - reax->tbp[j][i].p_boc5 = - sqrt(reax->sbp[j].b_o_133 * - reax->sbp[i].b_o_133); - - - reax->tbp[i][j].D = - sqrt(reax->sbp[i].epsilon * - reax->sbp[j].epsilon); - - reax->tbp[j][i].D = - sqrt(reax->sbp[j].epsilon * - reax->sbp[i].epsilon); - - reax->tbp[i][j].alpha = - sqrt(reax->sbp[i].alpha * - reax->sbp[j].alpha); - - reax->tbp[j][i].alpha = - sqrt(reax->sbp[j].alpha * - reax->sbp[i].alpha); - - reax->tbp[i][j].r_vdW = - 2.0 * sqrt(reax->sbp[i].r_vdw * reax->sbp[j].r_vdw); - - reax->tbp[j][i].r_vdW = - 2.0 * sqrt(reax->sbp[j].r_vdw * reax->sbp[i].r_vdw); - - reax->tbp[i][j].gamma_w = - sqrt(reax->sbp[i].gamma_w * - reax->sbp[j].gamma_w); - - reax->tbp[j][i].gamma_w = - sqrt(reax->sbp[j].gamma_w * - reax->sbp[i].gamma_w); - - reax->tbp[i][j].gamma = - pow(reax->sbp[i].gamma * - reax->sbp[j].gamma,-1.5); - - reax->tbp[j][i].gamma = - pow(reax->sbp[j].gamma * - reax->sbp[i].gamma,-1.5); - - // additions for additional vdWaals interaction types - inner core - - reax->tbp[i][j].rcore = reax->tbp[j][i].rcore = - sqrt( reax->sbp[i].rcore2 * reax->sbp[j].rcore2 ); - - reax->tbp[i][j].ecore = reax->tbp[j][i].ecore = - sqrt( reax->sbp[i].ecore2 * reax->sbp[j].ecore2 ); - - reax->tbp[i][j].acore = reax->tbp[j][i].acore = - sqrt( reax->sbp[i].acore2 * reax->sbp[j].acore2 ); - - // additions for additional vdWalls interaction types lg correction - - reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = - sqrt( reax->sbp[i].lgcij * reax->sbp[j].lgcij ); - - reax->tbp[i][j].lgre = reax->tbp[j][i].lgre = 2.0 * reax->gp.l[35] * - sqrt( reax->sbp[i].lgre*reax->sbp[j].lgre ); - - } - - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - l = atoi(tmp[0]); - - for (i=0; i < l; i++) { - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - - if ((c < (lgflag ? 9 : 8)) || (j < 0) || (k < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types) { - val = atof(tmp[2]); - if (val > 0.0) { - reax->tbp[j][k].D = val; - reax->tbp[k][j].D = val; - } - - val = atof(tmp[3]); - if (val > 0.0) { - reax->tbp[j][k].r_vdW = 2 * val; - reax->tbp[k][j].r_vdW = 2 * val; - } - - val = atof(tmp[4]); - if (val > 0.0) { - reax->tbp[j][k].alpha = val; - reax->tbp[k][j].alpha = val; - } - - val = atof(tmp[5]); - if (val > 0.0) { - reax->tbp[j][k].r_s = val; - reax->tbp[k][j].r_s = val; - } - - val = atof(tmp[6]); - if (val > 0.0) { - reax->tbp[j][k].r_p = val; - reax->tbp[k][j].r_p = val; - } - - val = atof(tmp[7]); - if (val > 0.0) { - reax->tbp[j][k].r_pp = val; - reax->tbp[k][j].r_pp = val; - } - - if (lgflag) { - val = atof(tmp[8]); - if (val >= 0.0) { - reax->tbp[j][k].lgcij = val; - reax->tbp[k][j].lgcij = val; - } - } - } - } - - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - reax->thbp[i][j][k].cnt = 0; - - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - l = atoi( tmp[0] ); - - for (i = 0; i < l; i++) { - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - if ((c < 10) || (j < 0) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types && - m < reax->num_atom_types) { - cnt = reax->thbp[j][k][m].cnt; - reax->thbp[j][k][m].cnt++; - reax->thbp[m][k][j].cnt++; - - val = atof(tmp[3]); - reax->thbp[j][k][m].prm[cnt].theta_00 = val; - reax->thbp[m][k][j].prm[cnt].theta_00 = val; - - val = atof(tmp[4]); - reax->thbp[j][k][m].prm[cnt].p_val1 = val; - reax->thbp[m][k][j].prm[cnt].p_val1 = val; - - val = atof(tmp[5]); - reax->thbp[j][k][m].prm[cnt].p_val2 = val; - reax->thbp[m][k][j].prm[cnt].p_val2 = val; - - val = atof(tmp[6]); - reax->thbp[j][k][m].prm[cnt].p_coa1 = val; - reax->thbp[m][k][j].prm[cnt].p_coa1 = val; - - val = atof(tmp[7]); - reax->thbp[j][k][m].prm[cnt].p_val7 = val; - reax->thbp[m][k][j].prm[cnt].p_val7 = val; - - val = atof(tmp[8]); - reax->thbp[j][k][m].prm[cnt].p_pen1 = val; - reax->thbp[m][k][j].prm[cnt].p_pen1 = val; - - val = atof(tmp[9]); - reax->thbp[j][k][m].prm[cnt].p_val4 = val; - reax->thbp[m][k][j].prm[cnt].p_val4 = val; - } - } - - /* clear all entries first */ - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - for (m = 0; m < reax->num_atom_types; ++m) { - reax->fbp[i][j][k][m].cnt = 0; - tor_flag[i][j][k][m] = 0; - } - - /* next line is number of 4-body params and some comments */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - l = atoi( tmp[0] ); - - for (i = 0; i < l; i++) { - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - n = atoi(tmp[3]) - 1; - if ((c < 9) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j >= 0 && n >= 0) { // this means the entry is not in compact form - if (j < reax->num_atom_types && k < reax->num_atom_types && - m < reax->num_atom_types && n < reax->num_atom_types) { - tor_flag[j][k][m][n] = 1; - tor_flag[n][m][k][j] = 1; - - reax->fbp[j][k][m][n].cnt = 1; - reax->fbp[n][m][k][j].cnt = 1; - - val = atof(tmp[4]); - reax->fbp[j][k][m][n].prm[0].V1 = val; - reax->fbp[n][m][k][j].prm[0].V1 = val; - - val = atof(tmp[5]); - reax->fbp[j][k][m][n].prm[0].V2 = val; - reax->fbp[n][m][k][j].prm[0].V2 = val; - - val = atof(tmp[6]); - reax->fbp[j][k][m][n].prm[0].V3 = val; - reax->fbp[n][m][k][j].prm[0].V3 = val; + val = atof(tmp[4]); reax->tbp[j][k].p_bo1 = val; + reax->tbp[k][j].p_bo1 = val; + val = atof(tmp[5]); reax->tbp[j][k].p_bo2 = val; + reax->tbp[k][j].p_bo2 = val; + val = atof(tmp[6]); reax->tbp[j][k].ovc = val; + reax->tbp[k][j].ovc = val; val = atof(tmp[7]); - reax->fbp[j][k][m][n].prm[0].p_tor1 = val; - reax->fbp[n][m][k][j].prm[0].p_tor1 = val; + } + } + + for (i=0; i < reax->num_atom_types; i++) + for (j=i; j < reax->num_atom_types; j++) { + reax->tbp[i][j].r_s = 0.5 * + (reax->sbp[i].r_s + reax->sbp[j].r_s); + reax->tbp[j][i].r_s = 0.5 * + (reax->sbp[j].r_s + reax->sbp[i].r_s); + + reax->tbp[i][j].r_p = 0.5 * + (reax->sbp[i].r_pi + reax->sbp[j].r_pi); + reax->tbp[j][i].r_p = 0.5 * + (reax->sbp[j].r_pi + reax->sbp[i].r_pi); + + reax->tbp[i][j].r_pp = 0.5 * + (reax->sbp[i].r_pi_pi + reax->sbp[j].r_pi_pi); + reax->tbp[j][i].r_pp = 0.5 * + (reax->sbp[j].r_pi_pi + reax->sbp[i].r_pi_pi); + + + reax->tbp[i][j].p_boc3 = + sqrt(reax->sbp[i].b_o_132 * + reax->sbp[j].b_o_132); + reax->tbp[j][i].p_boc3 = + sqrt(reax->sbp[j].b_o_132 * + reax->sbp[i].b_o_132); + + reax->tbp[i][j].p_boc4 = + sqrt(reax->sbp[i].b_o_131 * + reax->sbp[j].b_o_131); + reax->tbp[j][i].p_boc4 = + sqrt(reax->sbp[j].b_o_131 * + reax->sbp[i].b_o_131); + + reax->tbp[i][j].p_boc5 = + sqrt(reax->sbp[i].b_o_133 * + reax->sbp[j].b_o_133); + reax->tbp[j][i].p_boc5 = + sqrt(reax->sbp[j].b_o_133 * + reax->sbp[i].b_o_133); + + + reax->tbp[i][j].D = + sqrt(reax->sbp[i].epsilon * + reax->sbp[j].epsilon); + + reax->tbp[j][i].D = + sqrt(reax->sbp[j].epsilon * + reax->sbp[i].epsilon); + + reax->tbp[i][j].alpha = + sqrt(reax->sbp[i].alpha * + reax->sbp[j].alpha); + + reax->tbp[j][i].alpha = + sqrt(reax->sbp[j].alpha * + reax->sbp[i].alpha); + + reax->tbp[i][j].r_vdW = + 2.0 * sqrt(reax->sbp[i].r_vdw * reax->sbp[j].r_vdw); + + reax->tbp[j][i].r_vdW = + 2.0 * sqrt(reax->sbp[j].r_vdw * reax->sbp[i].r_vdw); + + reax->tbp[i][j].gamma_w = + sqrt(reax->sbp[i].gamma_w * + reax->sbp[j].gamma_w); + + reax->tbp[j][i].gamma_w = + sqrt(reax->sbp[j].gamma_w * + reax->sbp[i].gamma_w); + + reax->tbp[i][j].gamma = + pow(reax->sbp[i].gamma * + reax->sbp[j].gamma,-1.5); + + reax->tbp[j][i].gamma = + pow(reax->sbp[j].gamma * + reax->sbp[i].gamma,-1.5); + + // additions for additional vdWaals interaction types - inner core + + reax->tbp[i][j].rcore = reax->tbp[j][i].rcore = + sqrt(reax->sbp[i].rcore2 * reax->sbp[j].rcore2); + + reax->tbp[i][j].ecore = reax->tbp[j][i].ecore = + sqrt(reax->sbp[i].ecore2 * reax->sbp[j].ecore2); + + reax->tbp[i][j].acore = reax->tbp[j][i].acore = + sqrt(reax->sbp[i].acore2 * reax->sbp[j].acore2); + + // additions for additional vdWalls interaction types lg correction + + reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = + sqrt(reax->sbp[i].lgcij * reax->sbp[j].lgcij); + + reax->tbp[i][j].lgre = reax->tbp[j][i].lgre = 2.0 * reax->gp.l[35] * + sqrt(reax->sbp[i].lgre*reax->sbp[j].lgre); + + } + + fgets(s,MAX_LINE,fp); + c=Tokenize(s,&tmp); + l = atoi(tmp[0]); + + for (i=0; i < l; i++) { + fgets(s,MAX_LINE,fp); + c=Tokenize(s,&tmp); + + j = atoi(tmp[0]) - 1; + k = atoi(tmp[1]) - 1; + + if ((c < (lgflag ? 9 : 8)) || (j < 0) || (k < 0)) + control->error_ptr->all(FLERR, "Inconsistent force field file"); + + if (j < reax->num_atom_types && k < reax->num_atom_types) { + val = atof(tmp[2]); + if (val > 0.0) { + reax->tbp[j][k].D = val; + reax->tbp[k][j].D = val; + } + + val = atof(tmp[3]); + if (val > 0.0) { + reax->tbp[j][k].r_vdW = 2 * val; + reax->tbp[k][j].r_vdW = 2 * val; + } + + val = atof(tmp[4]); + if (val > 0.0) { + reax->tbp[j][k].alpha = val; + reax->tbp[k][j].alpha = val; + } + + val = atof(tmp[5]); + if (val > 0.0) { + reax->tbp[j][k].r_s = val; + reax->tbp[k][j].r_s = val; + } + + val = atof(tmp[6]); + if (val > 0.0) { + reax->tbp[j][k].r_p = val; + reax->tbp[k][j].r_p = val; + } + + val = atof(tmp[7]); + if (val > 0.0) { + reax->tbp[j][k].r_pp = val; + reax->tbp[k][j].r_pp = val; + } + + if (lgflag) { + val = atof(tmp[8]); + if (val >= 0.0) { + reax->tbp[j][k].lgcij = val; + reax->tbp[k][j].lgcij = val; + } + } + } + } + + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) + reax->thbp[i][j][k].cnt = 0; + + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + l = atoi(tmp[0]); + + for (i = 0; i < l; i++) { + fgets(s,MAX_LINE,fp); + c=Tokenize(s,&tmp); + + j = atoi(tmp[0]) - 1; + k = atoi(tmp[1]) - 1; + m = atoi(tmp[2]) - 1; + if ((c < 10) || (j < 0) || (k < 0) || (m < 0)) + control->error_ptr->all(FLERR, "Inconsistent force field file"); + + if (j < reax->num_atom_types && k < reax->num_atom_types && + m < reax->num_atom_types) { + cnt = reax->thbp[j][k][m].cnt; + reax->thbp[j][k][m].cnt++; + reax->thbp[m][k][j].cnt++; + + val = atof(tmp[3]); + reax->thbp[j][k][m].prm[cnt].theta_00 = val; + reax->thbp[m][k][j].prm[cnt].theta_00 = val; + + val = atof(tmp[4]); + reax->thbp[j][k][m].prm[cnt].p_val1 = val; + reax->thbp[m][k][j].prm[cnt].p_val1 = val; + + val = atof(tmp[5]); + reax->thbp[j][k][m].prm[cnt].p_val2 = val; + reax->thbp[m][k][j].prm[cnt].p_val2 = val; + + val = atof(tmp[6]); + reax->thbp[j][k][m].prm[cnt].p_coa1 = val; + reax->thbp[m][k][j].prm[cnt].p_coa1 = val; + + val = atof(tmp[7]); + reax->thbp[j][k][m].prm[cnt].p_val7 = val; + reax->thbp[m][k][j].prm[cnt].p_val7 = val; val = atof(tmp[8]); - reax->fbp[j][k][m][n].prm[0].p_cot1 = val; - reax->fbp[n][m][k][j].prm[0].p_cot1 = val; + reax->thbp[j][k][m].prm[cnt].p_pen1 = val; + reax->thbp[m][k][j].prm[cnt].p_pen1 = val; + + val = atof(tmp[9]); + reax->thbp[j][k][m].prm[cnt].p_val4 = val; + reax->thbp[m][k][j].prm[cnt].p_val4 = val; } - } else { /* This means the entry is of the form 0-X-Y-0 */ - if (k < reax->num_atom_types && m < reax->num_atom_types) - for (p = 0; p < reax->num_atom_types; p++) - for (o = 0; o < reax->num_atom_types; o++) { - reax->fbp[p][k][m][o].cnt = 1; - reax->fbp[o][m][k][p].cnt = 1; + } - if (tor_flag[p][k][m][o] == 0) { - reax->fbp[p][k][m][o].prm[0].V1 = atof(tmp[4]); - reax->fbp[p][k][m][o].prm[0].V2 = atof(tmp[5]); - reax->fbp[p][k][m][o].prm[0].V3 = atof(tmp[6]); - reax->fbp[p][k][m][o].prm[0].p_tor1 = atof(tmp[7]); - reax->fbp[p][k][m][o].prm[0].p_cot1 = atof(tmp[8]); - } - - if (tor_flag[o][m][k][p] == 0) { - reax->fbp[o][m][k][p].prm[0].V1 = atof(tmp[4]); - reax->fbp[o][m][k][p].prm[0].V2 = atof(tmp[5]); - reax->fbp[o][m][k][p].prm[0].V3 = atof(tmp[6]); - reax->fbp[o][m][k][p].prm[0].p_tor1 = atof(tmp[7]); - reax->fbp[o][m][k][p].prm[0].p_cot1 = atof(tmp[8]); - } + /* clear all entries first */ + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) + for (m = 0; m < reax->num_atom_types; ++m) { + reax->fbp[i][j][k][m].cnt = 0; + tor_flag[i][j][k][m] = 0; } - } - } - /* next line is number of hydrogen bond params and some comments */ - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); - l = atoi( tmp[0] ); + /* next line is number of 4-body params and some comments */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + l = atoi(tmp[0]); - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - reax->hbp[i][j][k].r0_hb = -1.0; + for (i = 0; i < l; i++) { + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); - for (i = 0; i < l; i++) { - fgets( s, MAX_LINE, fp ); - c = Tokenize( s, &tmp ); + j = atoi(tmp[0]) - 1; + k = atoi(tmp[1]) - 1; + m = atoi(tmp[2]) - 1; + n = atoi(tmp[3]) - 1; + if ((c < 9) || (k < 0) || (m < 0)) + control->error_ptr->all(FLERR, "Inconsistent force field file"); - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - if ((c < 7) || (j < 0) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); + if (j >= 0 && n >= 0) { // this means the entry is not in compact form + if (j < reax->num_atom_types && k < reax->num_atom_types && + m < reax->num_atom_types && n < reax->num_atom_types) { + tor_flag[j][k][m][n] = 1; + tor_flag[n][m][k][j] = 1; - if (j < reax->num_atom_types && m < reax->num_atom_types) { - val = atof(tmp[3]); - reax->hbp[j][k][m].r0_hb = val; + reax->fbp[j][k][m][n].cnt = 1; + reax->fbp[n][m][k][j].cnt = 1; - val = atof(tmp[4]); - reax->hbp[j][k][m].p_hb1 = val; + val = atof(tmp[4]); + reax->fbp[j][k][m][n].prm[0].V1 = val; + reax->fbp[n][m][k][j].prm[0].V1 = val; - val = atof(tmp[5]); - reax->hbp[j][k][m].p_hb2 = val; + val = atof(tmp[5]); + reax->fbp[j][k][m][n].prm[0].V2 = val; + reax->fbp[n][m][k][j].prm[0].V2 = val; - val = atof(tmp[6]); - reax->hbp[j][k][m].p_hb3 = val; - } - } + val = atof(tmp[6]); + reax->fbp[j][k][m][n].prm[0].V3 = val; + reax->fbp[n][m][k][j].prm[0].V3 = val; - /* deallocate helper storage */ - for (i = 0; i < MAX_TOKENS; i++) - free( tmp[i] ); - free( tmp ); - free( s ); + val = atof(tmp[7]); + reax->fbp[j][k][m][n].prm[0].p_tor1 = val; + reax->fbp[n][m][k][j].prm[0].p_tor1 = val; + val = atof(tmp[8]); + reax->fbp[j][k][m][n].prm[0].p_cot1 = val; + reax->fbp[n][m][k][j].prm[0].p_cot1 = val; + } + } else { /* This means the entry is of the form 0-X-Y-0 */ + if (k < reax->num_atom_types && m < reax->num_atom_types) + for (p = 0; p < reax->num_atom_types; p++) + for (o = 0; o < reax->num_atom_types; o++) { + reax->fbp[p][k][m][o].cnt = 1; + reax->fbp[o][m][k][p].cnt = 1; - /* deallocate tor_flag */ - for (i = 0; i < reax->num_atom_types; i++) { - for (j = 0; j < reax->num_atom_types; j++) { - for (k = 0; k < reax->num_atom_types; k++) { - free( tor_flag[i][j][k] ); + if (tor_flag[p][k][m][o] == 0) { + reax->fbp[p][k][m][o].prm[0].V1 = atof(tmp[4]); + reax->fbp[p][k][m][o].prm[0].V2 = atof(tmp[5]); + reax->fbp[p][k][m][o].prm[0].V3 = atof(tmp[6]); + reax->fbp[p][k][m][o].prm[0].p_tor1 = atof(tmp[7]); + reax->fbp[p][k][m][o].prm[0].p_cot1 = atof(tmp[8]); + } + + if (tor_flag[o][m][k][p] == 0) { + reax->fbp[o][m][k][p].prm[0].V1 = atof(tmp[4]); + reax->fbp[o][m][k][p].prm[0].V2 = atof(tmp[5]); + reax->fbp[o][m][k][p].prm[0].V3 = atof(tmp[6]); + reax->fbp[o][m][k][p].prm[0].p_tor1 = atof(tmp[7]); + reax->fbp[o][m][k][p].prm[0].p_cot1 = atof(tmp[8]); + } + } } - free( tor_flag[i][j] ); } - free( tor_flag[i] ); + + /* next line is number of hydrogen bond params and some comments */ + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + l = atoi(tmp[0]); + + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) + reax->hbp[i][j][k].r0_hb = -1.0; + + for (i = 0; i < l; i++) { + fgets(s, MAX_LINE, fp); + c = Tokenize(s, &tmp); + + j = atoi(tmp[0]) - 1; + k = atoi(tmp[1]) - 1; + m = atoi(tmp[2]) - 1; + if ((c < 7) || (j < 0) || (k < 0) || (m < 0)) + control->error_ptr->all(FLERR, "Inconsistent force field file"); + + if (j < reax->num_atom_types && m < reax->num_atom_types) { + val = atof(tmp[3]); + reax->hbp[j][k][m].r0_hb = val; + + val = atof(tmp[4]); + reax->hbp[j][k][m].p_hb1 = val; + + val = atof(tmp[5]); + reax->hbp[j][k][m].p_hb2 = val; + + val = atof(tmp[6]); + reax->hbp[j][k][m].p_hb3 = val; + } + } + + /* deallocate helper storage */ + for (i = 0; i < MAX_TOKENS; i++) + free(tmp[i]); + free(tmp); + free(s); + + + /* deallocate tor_flag */ + for (i = 0; i < reax->num_atom_types; i++) { + for (j = 0; j < reax->num_atom_types; j++) { + for (k = 0; k < reax->num_atom_types; k++) { + free(tor_flag[i][j][k]); + } + free(tor_flag[i][j]); + } + free(tor_flag[i]); + } + free(tor_flag); + + // close file + + fclose(fp); } - free( tor_flag ); - - // close file - - fclose(fp); } diff --git a/src/USER-REAXC/reaxc_ffield.h b/src/USER-REAXC/reaxc_ffield.h deleted file mode 100644 index f7a97f0636..0000000000 --- a/src/USER-REAXC/reaxc_ffield.h +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef LMP_REAXC_FFIELD_H -#define LMP_REAXC_FFIELD_H - -#include "reaxc_types.h" - -void Read_Force_Field(const char *, reax_interaction *, control_params *); - -#endif diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 7e412afbd6..ebc042ebe5 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -24,410 +24,369 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_forces.h" +#include "reaxff_api.h" + #include #include #include -#include "reaxc_bond_orders.h" -#include "reaxc_bonds.h" -#include "reaxc_hydrogen_bonds.h" -#include "reaxc_list.h" -#include "reaxc_multi_body.h" -#include "reaxc_nonbonded.h" -#include "reaxc_torsion_angles.h" -#include "reaxc_valence_angles.h" -#include "reaxc_vector.h" #include "error.h" -interaction_function Interaction_Functions[NUM_INTRS]; - -void Dummy_Interaction(reax_system * /*system*/, control_params * /*control*/, - simulation_data * /*data*/, storage * /*workspace*/, - reax_list ** /*lists*/, output_controls * /*out_control*/ ) -{ -} - - -void Init_Force_Functions(control_params *control) -{ - Interaction_Functions[0] = BO; - Interaction_Functions[1] = Bonds; //Dummy_Interaction; - Interaction_Functions[2] = Atom_Energy; //Dummy_Interaction; - Interaction_Functions[3] = Valence_Angles; //Dummy_Interaction; - Interaction_Functions[4] = Torsion_Angles; //Dummy_Interaction; - if (control->hbond_cut > 0) - Interaction_Functions[5] = Hydrogen_Bonds; - else Interaction_Functions[5] = Dummy_Interaction; - Interaction_Functions[6] = Dummy_Interaction; //empty - Interaction_Functions[7] = Dummy_Interaction; //empty - Interaction_Functions[8] = Dummy_Interaction; //empty - Interaction_Functions[9] = Dummy_Interaction; //empty -} - - -void Compute_Bonded_Forces(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ - int i; - - /* Implement all force calls as function pointers */ - for (i = 0; i < NUM_INTRS; i++) { - (Interaction_Functions[i])( system, control, data, workspace, - lists, out_control ); +namespace ReaxFF { + + static void Compute_Bonded_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) + { + BO(system, control, data, workspace, lists, out_control); + Bonds(system, data, workspace, lists); + Atom_Energy(system, control, data, workspace, lists); + Valence_Angles(system, control, data, workspace, lists); + Torsion_Angles(system, control, data, workspace, lists); + if (control->hbond_cut > 0) + Hydrogen_Bonds(system, control, data, workspace, lists); } -} + static void Compute_NonBonded_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { -void Compute_NonBonded_Forces(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ + /* van der Waals and Coulomb interactions */ + if (control->tabulate == 0) + vdW_Coulomb_Energy(system, control, data, workspace, lists); + else + Tabulated_vdW_Coulomb_Energy(system, control, data, workspace, lists); + } - /* van der Waals and Coulomb interactions */ - if (control->tabulate == 0) - vdW_Coulomb_Energy( system, control, data, workspace, - lists, out_control ); - else - Tabulated_vdW_Coulomb_Energy( system, control, data, workspace, - lists, out_control ); -} + static void Compute_Total_Force(reax_system *system, control_params *control, + storage *workspace, reax_list **lists) + { + int i, pj; + reax_list *bonds = (*lists) + BONDS; + for (i = 0; i < system->N; ++i) + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) + if (i < bonds->select.bond_list[pj].nbr) { + if (control->virial == 0) + Add_dBond_to_Forces(system, i, pj, workspace, lists); + else + Add_dBond_to_Forces_NPT(i, pj, workspace, lists); + } -void Compute_Total_Force(reax_system *system, control_params *control, - storage *workspace, reax_list **lists) -{ - int i, pj; - reax_list *bonds = (*lists) + BONDS; + } - for (i = 0; i < system->N; ++i) - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) - if (i < bonds->select.bond_list[pj].nbr) { - if (control->virial == 0) - Add_dBond_to_Forces( system, i, pj, workspace, lists ); - else - Add_dBond_to_Forces_NPT( i, pj, workspace, lists ); + static void Validate_Lists(reax_system *system, reax_list **lists, + int step, int N, int numH) + { + int i, comp, Hindex; + reax_list *bonds, *hbonds; + + double saferzone = system->saferzone; + + /* bond list */ + if (N > 0) { + bonds = *lists + BONDS; + + for (i = 0; i < N; ++i) { + system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); + + if (i < N-1) + comp = Start_Index(i+1, bonds); + else comp = bonds->num_intrs; + + if (End_Index(i, bonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " + "i={} end(i)={} str(i+1)={}\n", + step,i,End_Index(i,bonds),comp)); } + } -} -void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **lists, - int step, int /*n*/, int N, int numH ) -{ - int i, comp, Hindex; - reax_list *bonds, *hbonds; + /* hbonds list */ + if (numH > 0) { + hbonds = *lists + HBONDS; - double saferzone = system->saferzone; + for (i = 0; i < N; ++i) { + Hindex = system->my_atoms[i].Hindex; + if (Hindex > -1) { + system->my_atoms[i].num_hbonds = + (int)(MAX(Num_Entries(Hindex, hbonds)*saferzone, system->minhbonds)); - /* bond list */ - if (N > 0) { - bonds = *lists + BONDS; + //if(Num_Entries(i, hbonds) >= + //(Start_Index(i+1,hbonds)-Start_Index(i,hbonds))*0.90/*DANGER_ZONE*/) { + // workspace->realloc.hbonds = 1; - for (i = 0; i < N; ++i) { - system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); + if (Hindex < numH-1) + comp = Start_Index(Hindex+1, hbonds); + else comp = hbonds->num_intrs; - if (i < N-1) - comp = Start_Index(i+1, bonds); - else comp = bonds->num_intrs; - - if (End_Index(i, bonds) > comp) - system->error_ptr->one(FLERR, fmt::format("step {}: bondchk failed: " - "i={} end(i)={} str(i+1)={}\n", - step,i,End_Index(i,bonds),comp)); + if (End_Index(Hindex, hbonds) > comp) + system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " + "H={} end(H)={} str(H+1)={}\n", + step, Hindex,End_Index(Hindex,hbonds),comp)); + } + } } } + static void Init_Forces_noQEq(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) { + int i, j, pj; + int start_i, end_i; + int type_i, type_j; + int btop_i, num_bonds, num_hbonds; + int ihb, jhb, ihb_top, jhb_top; + int local, flag; + double cutoff; + reax_list *far_nbrs, *bonds, *hbonds; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + far_neighbor_data *nbr_pj; + reax_atom *atom_i, *atom_j; - /* hbonds list */ - if (numH > 0) { + far_nbrs = *lists + FAR_NBRS; + bonds = *lists + BONDS; hbonds = *lists + HBONDS; - for (i = 0; i < N; ++i) { - Hindex = system->my_atoms[i].Hindex; - if (Hindex > -1) { - system->my_atoms[i].num_hbonds = - (int)(MAX(Num_Entries(Hindex, hbonds)*saferzone, system->minhbonds)); + for (i = 0; i < system->n; ++i) + workspace->bond_mark[i] = 0; + for (i = system->n; i < system->N; ++i) { + workspace->bond_mark[i] = 1000; // put ghost atoms to an infinite distance + } - //if( Num_Entries(i, hbonds) >= - //(Start_Index(i+1,hbonds)-Start_Index(i,hbonds))*0.90/*DANGER_ZONE*/) { - // workspace->realloc.hbonds = 1; + num_bonds = 0; + num_hbonds = 0; + btop_i = 0; - if (Hindex < numH-1) - comp = Start_Index(Hindex+1, hbonds); - else comp = hbonds->num_intrs; + for (i = 0; i < system->N; ++i) { + atom_i = &(system->my_atoms[i]); + type_i = atom_i->type; + if (type_i < 0) continue; + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); + btop_i = End_Index(i, bonds); + sbp_i = &(system->reax_param.sbp[type_i]); - if (End_Index(Hindex, hbonds) > comp) - system->error_ptr->one(FLERR, fmt::format("step {}: hbondchk failed: " - "H={} end(H)={} str(H+1)={}\n", - step, Hindex,End_Index(Hindex,hbonds),comp)); + if (i < system->n) { + local = 1; + cutoff = MAX(control->hbond_cut, control->bond_cut); + } else { + local = 0; + cutoff = control->bond_cut; } - } - } -} - -void Init_Forces_noQEq( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/) { - int i, j, pj; - int start_i, end_i; - int type_i, type_j; - int btop_i, num_bonds, num_hbonds; - int ihb, jhb, ihb_top, jhb_top; - int local, flag; - double cutoff; - reax_list *far_nbrs, *bonds, *hbonds; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - far_neighbor_data *nbr_pj; - reax_atom *atom_i, *atom_j; - - far_nbrs = *lists + FAR_NBRS; - bonds = *lists + BONDS; - hbonds = *lists + HBONDS; - - for (i = 0; i < system->n; ++i) - workspace->bond_mark[i] = 0; - for (i = system->n; i < system->N; ++i) { - workspace->bond_mark[i] = 1000; // put ghost atoms to an infinite distance - } - - num_bonds = 0; - num_hbonds = 0; - btop_i = 0; - - for (i = 0; i < system->N; ++i) { - atom_i = &(system->my_atoms[i]); - type_i = atom_i->type; - if (type_i < 0) continue; - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); - btop_i = End_Index( i, bonds ); - sbp_i = &(system->reax_param.sbp[type_i]); - - if (i < system->n) { - local = 1; - cutoff = MAX( control->hbond_cut, control->bond_cut ); - } else { - local = 0; - cutoff = control->bond_cut; - } - - ihb = -1; - ihb_top = -1; - if (local && control->hbond_cut > 0) { - ihb = sbp_i->p_hbond; - if (ihb == 1) - ihb_top = End_Index( atom_i->Hindex, hbonds ); - else ihb_top = -1; - } - - /* update i-j distance - check if j is within cutoff */ - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); - j = nbr_pj->nbr; - atom_j = &(system->my_atoms[j]); - - if (nbr_pj->d <= cutoff) - flag = 1; - else flag = 0; - - if (flag) { - type_j = atom_j->type; - if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[type_j]); - twbp = &(system->reax_param.tbp[type_i][type_j]); - - if (local) { - /* hydrogen bond lists */ - if (control->hbond_cut > 0 && (ihb==1 || ihb==2) && - nbr_pj->d <= control->hbond_cut) { - // fprintf( stderr, "%d %d\n", atom1, atom2 ); - jhb = sbp_j->p_hbond; - if (ihb == 1 && jhb == 2) { - hbonds->select.hbond_list[ihb_top].nbr = j; - hbonds->select.hbond_list[ihb_top].scl = 1; - hbonds->select.hbond_list[ihb_top].ptr = nbr_pj; - ++ihb_top; - ++num_hbonds; - } - else if (j < system->n && ihb == 2 && jhb == 1) { - jhb_top = End_Index( atom_j->Hindex, hbonds ); - hbonds->select.hbond_list[jhb_top].nbr = i; - hbonds->select.hbond_list[jhb_top].scl = -1; - hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; - Set_End_Index( atom_j->Hindex, jhb_top+1, hbonds ); - ++num_hbonds; - } - } - } - - if (//(workspace->bond_mark[i] < 3 || workspace->bond_mark[j] < 3) && - nbr_pj->d <= control->bond_cut && - BOp( workspace, bonds, control->bo_cut, - i , btop_i, nbr_pj, sbp_i, sbp_j, twbp )) { - num_bonds += 2; - ++btop_i; - - if (workspace->bond_mark[j] > workspace->bond_mark[i] + 1) - workspace->bond_mark[j] = workspace->bond_mark[i] + 1; - else if (workspace->bond_mark[i] > workspace->bond_mark[j] + 1) { - workspace->bond_mark[i] = workspace->bond_mark[j] + 1; - } - } - } - } - - Set_End_Index( i, btop_i, bonds ); - if (local && ihb == 1) - Set_End_Index( atom_i->Hindex, ihb_top, hbonds ); - } - - - workspace->realloc.num_bonds = num_bonds; - workspace->realloc.num_hbonds = num_hbonds; - - Validate_Lists( system, workspace, lists, data->step, - system->n, system->N, system->numH); -} - - -void Estimate_Storages( reax_system *system, control_params *control, - reax_list **lists, int *Htop, int *hb_top, - int *bond_top, int *num_3body ) -{ - int i, j, pj; - int start_i, end_i; - int type_i, type_j; - int ihb, jhb; - int local; - double cutoff; - double r_ij; - double C12, C34, C56; - double BO, BO_s, BO_pi, BO_pi2; - reax_list *far_nbrs; - single_body_parameters *sbp_i, *sbp_j; - two_body_parameters *twbp; - far_neighbor_data *nbr_pj; - reax_atom *atom_i, *atom_j; - - int mincap = system->mincap; - double safezone = system->safezone; - double saferzone = system->saferzone; - - far_nbrs = *lists + FAR_NBRS; - *Htop = 0; - memset( hb_top, 0, sizeof(int) * system->local_cap ); - memset( bond_top, 0, sizeof(int) * system->total_cap ); - *num_3body = 0; - - for (i = 0; i < system->N; ++i) { - atom_i = &(system->my_atoms[i]); - type_i = atom_i->type; - if (type_i < 0) continue; - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); - sbp_i = &(system->reax_param.sbp[type_i]); - - if (i < system->n) { - local = 1; - cutoff = control->nonb_cut; - ++(*Htop); - ihb = sbp_i->p_hbond; - } else { - local = 0; - cutoff = control->bond_cut; ihb = -1; - } + ihb_top = -1; + if (local && control->hbond_cut > 0) { + ihb = sbp_i->p_hbond; + if (ihb == 1) + ihb_top = End_Index(atom_i->Hindex, hbonds); + else ihb_top = -1; + } - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); - j = nbr_pj->nbr; - atom_j = &(system->my_atoms[j]); + /* update i-j distance - check if j is within cutoff */ + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + atom_j = &(system->my_atoms[j]); - if (nbr_pj->d <= cutoff) { - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - r_ij = nbr_pj->d; - sbp_j = &(system->reax_param.sbp[type_j]); - twbp = &(system->reax_param.tbp[type_i][type_j]); + if (nbr_pj->d <= cutoff) + flag = 1; + else flag = 0; - if (local) { - if (j < system->n || atom_i->orig_id < atom_j->orig_id) //tryQEq ||1 - ++(*Htop); + if (flag) { + type_j = atom_j->type; + if (type_j < 0) continue; + sbp_j = &(system->reax_param.sbp[type_j]); + twbp = &(system->reax_param.tbp[type_i][type_j]); - /* hydrogen bond lists */ - if (control->hbond_cut > 0.1 && (ihb==1 || ihb==2) && - nbr_pj->d <= control->hbond_cut) { - jhb = sbp_j->p_hbond; - if (ihb == 1 && jhb == 2) - ++hb_top[i]; - else if (j < system->n && ihb == 2 && jhb == 1) - ++hb_top[j]; + if (local) { + /* hydrogen bond lists */ + if (control->hbond_cut > 0 && (ihb==1 || ihb==2) && + nbr_pj->d <= control->hbond_cut) { + // fprintf(stderr, "%d %d\n", atom1, atom2); + jhb = sbp_j->p_hbond; + if (ihb == 1 && jhb == 2) { + hbonds->select.hbond_list[ihb_top].nbr = j; + hbonds->select.hbond_list[ihb_top].scl = 1; + hbonds->select.hbond_list[ihb_top].ptr = nbr_pj; + ++ihb_top; + ++num_hbonds; + } + else if (j < system->n && ihb == 2 && jhb == 1) { + jhb_top = End_Index(atom_j->Hindex, hbonds); + hbonds->select.hbond_list[jhb_top].nbr = i; + hbonds->select.hbond_list[jhb_top].scl = -1; + hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; + Set_End_Index(atom_j->Hindex, jhb_top+1, hbonds); + ++num_hbonds; + } + } + } + + if (//(workspace->bond_mark[i] < 3 || workspace->bond_mark[j] < 3) && + nbr_pj->d <= control->bond_cut && + BOp(workspace, bonds, control->bo_cut, + i , btop_i, nbr_pj, sbp_i, sbp_j, twbp)) { + num_bonds += 2; + ++btop_i; + + if (workspace->bond_mark[j] > workspace->bond_mark[i] + 1) + workspace->bond_mark[j] = workspace->bond_mark[i] + 1; + else if (workspace->bond_mark[i] > workspace->bond_mark[j] + 1) { + workspace->bond_mark[i] = workspace->bond_mark[j] + 1; + } } } + } - /* uncorrected bond orders */ - if (nbr_pj->d <= control->bond_cut) { - if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { - C12 = twbp->p_bo1 * pow( r_ij / twbp->r_s, twbp->p_bo2 ); - BO_s = (1.0 + control->bo_cut) * exp( C12 ); + Set_End_Index(i, btop_i, bonds); + if (local && ihb == 1) + Set_End_Index(atom_i->Hindex, ihb_top, hbonds); + } + + + workspace->realloc.num_bonds = num_bonds; + workspace->realloc.num_hbonds = num_hbonds; + + Validate_Lists(system, lists, data->step, system->N, system->numH); + } + + void Estimate_Storages(reax_system *system, control_params *control, + reax_list **lists, int *Htop, int *hb_top, + int *bond_top, int *num_3body) + { + int i, j, pj; + int start_i, end_i; + int type_i, type_j; + int ihb, jhb; + int local; + double cutoff; + double r_ij; + double C12, C34, C56; + double BO, BO_s, BO_pi, BO_pi2; + reax_list *far_nbrs; + single_body_parameters *sbp_i, *sbp_j; + two_body_parameters *twbp; + far_neighbor_data *nbr_pj; + reax_atom *atom_i, *atom_j; + + int mincap = system->mincap; + double safezone = system->safezone; + double saferzone = system->saferzone; + + far_nbrs = *lists + FAR_NBRS; + *Htop = 0; + memset(hb_top, 0, sizeof(int) * system->local_cap); + memset(bond_top, 0, sizeof(int) * system->total_cap); + *num_3body = 0; + + for (i = 0; i < system->N; ++i) { + atom_i = &(system->my_atoms[i]); + type_i = atom_i->type; + if (type_i < 0) continue; + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); + sbp_i = &(system->reax_param.sbp[type_i]); + + if (i < system->n) { + local = 1; + cutoff = control->nonb_cut; + ++(*Htop); + ihb = sbp_i->p_hbond; + } else { + local = 0; + cutoff = control->bond_cut; + ihb = -1; + } + + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + atom_j = &(system->my_atoms[j]); + + if (nbr_pj->d <= cutoff) { + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + r_ij = nbr_pj->d; + sbp_j = &(system->reax_param.sbp[type_j]); + twbp = &(system->reax_param.tbp[type_i][type_j]); + + if (local) { + if (j < system->n || atom_i->orig_id < atom_j->orig_id) //tryQEq ||1 + ++(*Htop); + + /* hydrogen bond lists */ + if (control->hbond_cut > 0.1 && (ihb==1 || ihb==2) && + nbr_pj->d <= control->hbond_cut) { + jhb = sbp_j->p_hbond; + if (ihb == 1 && jhb == 2) + ++hb_top[i]; + else if (j < system->n && ihb == 2 && jhb == 1) + ++hb_top[j]; + } } - else BO_s = C12 = 0.0; - if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { - C34 = twbp->p_bo3 * pow( r_ij / twbp->r_p, twbp->p_bo4 ); - BO_pi = exp( C34 ); - } - else BO_pi = C34 = 0.0; + /* uncorrected bond orders */ + if (nbr_pj->d <= control->bond_cut) { + if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { + C12 = twbp->p_bo1 * pow(r_ij / twbp->r_s, twbp->p_bo2); + BO_s = (1.0 + control->bo_cut) * exp(C12); + } + else BO_s = C12 = 0.0; - if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { - C56 = twbp->p_bo5 * pow( r_ij / twbp->r_pp, twbp->p_bo6 ); - BO_pi2= exp( C56 ); - } - else BO_pi2 = C56 = 0.0; + if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { + C34 = twbp->p_bo3 * pow(r_ij / twbp->r_p, twbp->p_bo4); + BO_pi = exp(C34); + } + else BO_pi = C34 = 0.0; - /* Initially BO values are the uncorrected ones, page 1 */ - BO = BO_s + BO_pi + BO_pi2; + if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { + C56 = twbp->p_bo5 * pow(r_ij / twbp->r_pp, twbp->p_bo6); + BO_pi2= exp(C56); + } + else BO_pi2 = C56 = 0.0; - if (BO >= control->bo_cut) { - ++bond_top[i]; - ++bond_top[j]; + /* Initially BO values are the uncorrected ones, page 1 */ + BO = BO_s + BO_pi + BO_pi2; + + if (BO >= control->bo_cut) { + ++bond_top[i]; + ++bond_top[j]; + } } } } } + + *Htop = (int)(MAX(*Htop * safezone, mincap * MIN_HENTRIES)); + for (i = 0; i < system->n; ++i) + hb_top[i] = (int)(MAX(hb_top[i] * saferzone, system->minhbonds)); + + for (i = 0; i < system->N; ++i) { + *num_3body += SQR(bond_top[i]); + bond_top[i] = MAX(bond_top[i] * 2, MIN_BONDS); + } + } - *Htop = (int)(MAX( *Htop * safezone, mincap * MIN_HENTRIES )); - for (i = 0; i < system->n; ++i) - hb_top[i] = (int)(MAX(hb_top[i] * saferzone, system->minhbonds)); + void Compute_Forces(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) + { - for (i = 0; i < system->N; ++i) { - *num_3body += SQR(bond_top[i]); - bond_top[i] = MAX( bond_top[i] * 2, MIN_BONDS ); + Init_Forces_noQEq(system, control, data, workspace, lists); + + /********* bonded interactions ************/ + Compute_Bonded_Forces(system, control, data, workspace, + lists, out_control); + + /********* nonbonded interactions ************/ + Compute_NonBonded_Forces(system, control, data, workspace, lists); + + /*********** total force ***************/ + Compute_Total_Force(system, control, workspace, lists); } - -} - - -void Compute_Forces(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) -{ - - Init_Forces_noQEq(system, control, data, workspace, - lists, out_control); - - /********* bonded interactions ************/ - Compute_Bonded_Forces(system, control, data, workspace, - lists, out_control); - - /********* nonbonded interactions ************/ - Compute_NonBonded_Forces(system, control, data, workspace, - lists, out_control); - - /*********** total force ***************/ - Compute_Total_Force(system, control, workspace, lists); } diff --git a/src/USER-REAXC/reaxc_forces.h b/src/USER-REAXC/reaxc_forces.h deleted file mode 100644 index b679a66650..0000000000 --- a/src/USER-REAXC/reaxc_forces.h +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __FORCES_H_ -#define __FORCES_H_ - -#include "reaxc_types.h" -#include "reaxc_defs.h" - -extern interaction_function Interaction_Functions[NUM_INTRS]; - -void Init_Force_Functions(control_params *); -void Compute_Forces( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*); -void Estimate_Storages( reax_system*, control_params*, reax_list**, - int*, int*, int*, int* ); -#endif diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index 4391bf769a..43362ac878 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -24,157 +24,157 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_hydrogen_bonds.h" +#include "reaxff_api.h" + #include + #include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_valence_angles.h" -#include "reaxc_vector.h" -void Hydrogen_Bonds( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) -{ - int i, j, k, pi, pk; - int type_i, type_j, type_k; - int start_j, end_j, hb_start_j, hb_end_j; - int hblist[MAX_BONDS]; - int itr, top; - int num_hb_intrs = 0; - ivec rel_jk; - double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; - double e_hb, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; - rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force; - hbond_parameters *hbp; - bond_order_data *bo_ij; - bond_data *pbond_ij; - far_neighbor_data *nbr_jk; - reax_list *bonds, *hbonds; - bond_data *bond_list; - hbond_data *hbond_list; +namespace ReaxFF { + void Hydrogen_Bonds(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int i, j, k, pi, pk; + int type_i, type_j, type_k; + int start_j, end_j, hb_start_j, hb_end_j; + int hblist[MAX_BONDS]; + int itr, top; + int num_hb_intrs = 0; + ivec rel_jk; + double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; + double e_hb, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; + rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; + rvec dvec_jk, force; + hbond_parameters *hbp; + bond_order_data *bo_ij; + bond_data *pbond_ij; + far_neighbor_data *nbr_jk; + reax_list *bonds, *hbonds; + bond_data *bond_list; + hbond_data *hbond_list; - // tally variables - double fi_tmp[3], fk_tmp[3], delij[3], delkj[3]; + // tally variables + double fi_tmp[3], fk_tmp[3], delij[3], delkj[3]; - bonds = (*lists) + BONDS; - bond_list = bonds->select.bond_list; - hbonds = (*lists) + HBONDS; - hbond_list = hbonds->select.hbond_list; + bonds = (*lists) + BONDS; + bond_list = bonds->select.bond_list; + hbonds = (*lists) + HBONDS; + hbond_list = hbonds->select.hbond_list; - for (j = 0; j < system->n; ++j) - if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { - type_j = system->my_atoms[j].type; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); - hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); - hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); - if (type_j < 0) continue; + for (j = 0; j < system->n; ++j) + if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { + type_j = system->my_atoms[j].type; + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); + hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); + hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); + if (type_j < 0) continue; - top = 0; - for (pi = start_j; pi < end_j; ++pi) { - pbond_ij = &( bond_list[pi] ); - i = pbond_ij->nbr; - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - bo_ij = &(pbond_ij->bo_data); - - if ( system->reax_param.sbp[type_i].p_hbond == 2 && - bo_ij->BO >= HB_THRESHOLD ) - hblist[top++] = pi; - } - - for (pk = hb_start_j; pk < hb_end_j; ++pk) { - /* set k's varibles */ - k = hbond_list[pk].nbr; - type_k = system->my_atoms[k].type; - if (type_k < 0) continue; - nbr_jk = hbond_list[pk].ptr; - r_jk = nbr_jk->d; - rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - - for (itr = 0; itr < top; ++itr) { - pi = hblist[itr]; - pbond_ij = &( bonds->select.bond_list[pi] ); + top = 0; + for (pi = start_j; pi < end_j; ++pi) { + pbond_ij = &( bond_list[pi] ); i = pbond_ij->nbr; + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + bo_ij = &(pbond_ij->bo_data); - if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { - bo_ij = &(pbond_ij->bo_data); - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); - if (hbp->r0_hb <= 0.0) continue; - ++num_hb_intrs; + if ( system->reax_param.sbp[type_i].p_hbond == 2 && + bo_ij->BO >= HB_THRESHOLD ) + hblist[top++] = pi; + } - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &theta, &cos_theta ); - /* the derivative of cos(theta) */ - Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &dcos_theta_di, &dcos_theta_dj, - &dcos_theta_dk ); + for (pk = hb_start_j; pk < hb_end_j; ++pk) { + /* set k's varibles */ + k = hbond_list[pk].nbr; + type_k = system->my_atoms[k].type; + if (type_k < 0) continue; + nbr_jk = hbond_list[pk].ptr; + r_jk = nbr_jk->d; + rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - /* hyrogen bond energy*/ - sin_theta2 = sin( theta/2.0 ); - sin_xhz4 = SQR(sin_theta2); - sin_xhz4 *= sin_xhz4; - cos_xhz1 = ( 1.0 - cos_theta ); - exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); - exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + - r_jk / hbp->r0_hb - 2.0 ) ); + for (itr = 0; itr < top; ++itr) { + pi = hblist[itr]; + pbond_ij = &( bonds->select.bond_list[pi] ); + i = pbond_ij->nbr; - data->my_en.e_hb += e_hb = - hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; + if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { + bo_ij = &(pbond_ij->bo_data); + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); + if (hbp->r0_hb <= 0.0) continue; + ++num_hb_intrs; - CEhb1 = hbp->p_hb1 * hbp->p_hb2 * exp_hb2 * exp_hb3 * sin_xhz4; - CEhb2 = -hbp->p_hb1/2.0 * (1.0 - exp_hb2) * exp_hb3 * cos_xhz1; - CEhb3 = -hbp->p_hb3 * - (-hbp->r0_hb / SQR(r_jk) + 1.0 / hbp->r0_hb) * e_hb; + Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &theta, &cos_theta ); + /* the derivative of cos(theta) */ + Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &dcos_theta_di, &dcos_theta_dj, + &dcos_theta_dk ); - /* hydrogen bond forces */ - bo_ij->Cdbo += CEhb1; // dbo term + /* hyrogen bond energy*/ + sin_theta2 = sin( theta/2.0 ); + sin_xhz4 = SQR(sin_theta2); + sin_xhz4 *= sin_xhz4; + cos_xhz1 = ( 1.0 - cos_theta ); + exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); + exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + + r_jk / hbp->r0_hb - 2.0 ) ); - if (control->virial == 0) { - // dcos terms - rvec_ScaledAdd( workspace->f[i], +CEhb2, dcos_theta_di ); - rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); - rvec_ScaledAdd( workspace->f[k], +CEhb2, dcos_theta_dk ); - // dr terms - rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); - rvec_ScaledAdd( workspace->f[k], +CEhb3/r_jk, dvec_jk ); - } - else { - rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms - rvec_Add( workspace->f[i], force ); + data->my_en.e_hb += e_hb = + hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; - rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); + CEhb1 = hbp->p_hb1 * hbp->p_hb2 * exp_hb2 * exp_hb3 * sin_xhz4; + CEhb2 = -hbp->p_hb1/2.0 * (1.0 - exp_hb2) * exp_hb3 * cos_xhz1; + CEhb3 = -hbp->p_hb3 * + (-hbp->r0_hb / SQR(r_jk) + 1.0 / hbp->r0_hb) * e_hb; - ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); - rvec_Scale( force, +CEhb2, dcos_theta_dk ); - rvec_Add( workspace->f[k], force ); + /* hydrogen bond forces */ + bo_ij->Cdbo += CEhb1; // dbo term - // dr terms - rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); + if (control->virial == 0) { + // dcos terms + rvec_ScaledAdd( workspace->f[i], +CEhb2, dcos_theta_di ); + rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); + rvec_ScaledAdd( workspace->f[k], +CEhb2, dcos_theta_dk ); + // dr terms + rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd( workspace->f[k], +CEhb3/r_jk, dvec_jk ); + } + else { + rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms + rvec_Add( workspace->f[i], force ); - rvec_Scale( force, CEhb3/r_jk, dvec_jk ); - rvec_Add( workspace->f[k], force ); - } + rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - rvec_ScaledSum( delij, 1., system->my_atoms[j].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, - -1., system->my_atoms[k].x ); + ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); + rvec_Scale( force, +CEhb2, dcos_theta_dk ); + rvec_Add( workspace->f[k], force ); - rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); - rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); - rvec_ScaledAdd(fk_tmp, CEhb3/r_jk, dvec_jk); + // dr terms + rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); - system->pair_ptr->ev_tally3(i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj); + rvec_Scale( force, CEhb3/r_jk, dvec_jk ); + rvec_Add( workspace->f[k], force ); + } + + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + rvec_ScaledSum( delij, 1., system->my_atoms[j].x, + -1., system->my_atoms[i].x ); + rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, + -1., system->my_atoms[k].x ); + + rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); + rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); + rvec_ScaledAdd(fk_tmp, CEhb3/r_jk, dvec_jk); + + system->pair_ptr->ev_tally3(i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj); + } } } } } - } + } } diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.h b/src/USER-REAXC/reaxc_hydrogen_bonds.h deleted file mode 100644 index 04d3d26d5c..0000000000 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __HBONDS_H_ -#define __HBONDS_H_ - -#include "reaxc_types.h" - -void Hydrogen_Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index beb7d1b87c..8704852a64 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -24,185 +24,174 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_init_md.h" +#include "reaxff_api.h" + #include #include #include #include -#include "reaxc_defs.h" -#include "reaxc_allocate.h" -#include "reaxc_forces.h" -#include "reaxc_io_tools.h" -#include "reaxc_list.h" -#include "reaxc_lookup.h" -#include "reaxc_reset_tools.h" -#include "reaxc_tool_box.h" #include "error.h" -#include "fmt/format.h" -void Init_System(reax_system *system, control_params *control) -{ - int i; - reax_atom *atom; +namespace ReaxFF { - int mincap = system->mincap; - double safezone = system->safezone; - double saferzone = system->saferzone; + void Init_System(reax_system *system, control_params *control) + { + int i; + reax_atom *atom; - // determine the local and total capacity + int mincap = system->mincap; + double safezone = system->safezone; + double saferzone = system->saferzone; - system->local_cap = MAX((int)(system->n * safezone), mincap); - system->total_cap = MAX((int)(system->N * safezone), mincap); + // determine the local and total capacity - /* estimate numH and Hcap */ - system->numH = 0; - if (control->hbond_cut > 0) - for (i = 0; i < system->n; ++i) { - atom = &(system->my_atoms[i]); - if (system->reax_param.sbp[ atom->type ].p_hbond == 1 && atom->type >= 0) - atom->Hindex = system->numH++; - else atom->Hindex = -1; + system->local_cap = MAX((int)(system->n * safezone), mincap); + system->total_cap = MAX((int)(system->N * safezone), mincap); + + /* estimate numH and Hcap */ + system->numH = 0; + if (control->hbond_cut > 0) + for (i = 0; i < system->n; ++i) { + atom = &(system->my_atoms[i]); + if (system->reax_param.sbp[ atom->type ].p_hbond == 1 && atom->type >= 0) + atom->Hindex = system->numH++; + else atom->Hindex = -1; + } + system->Hcap = (int)(MAX(system->numH * saferzone, mincap)); + } + + void Init_Simulation_Data(simulation_data *data) + { + Reset_Simulation_Data(data); + data->step = 0; + } + + static void Init_Taper(control_params *control, storage *workspace) + { + double d1, d7; + double swa, swa2, swa3; + double swb, swb2, swb3; + LAMMPS_NS::Error *error = control->error_ptr; + + swa = control->nonb_low; + swb = control->nonb_cut; + + if (fabs(swa) > 0.01 && control->me == 0) + error->warning(FLERR, "Non-zero lower Taper-radius cutoff"); + + if (swb < 0) { + error->all(FLERR,"Negative upper Taper-radius cutoff"); } - system->Hcap = (int)(MAX(system->numH * saferzone, mincap)); -} + else if (swb < 5 && control->me == 0) + error->warning(FLERR,fmt::format("Warning: very low Taper-radius cutoff: " + "{}\n", swb)); + d1 = swb - swa; + d7 = pow(d1, 7.0); + swa2 = SQR(swa); + swa3 = CUBE(swa); + swb2 = SQR(swb); + swb3 = CUBE(swb); - -void Init_Simulation_Data(control_params *control, simulation_data *data) -{ - Reset_Simulation_Data(data, control->virial); - data->step = 0; -} - -void Init_Taper(control_params *control, storage *workspace) -{ - double d1, d7; - double swa, swa2, swa3; - double swb, swb2, swb3; - LAMMPS_NS::Error *error = control->error_ptr; - - swa = control->nonb_low; - swb = control->nonb_cut; - - if (fabs(swa) > 0.01 && control->me == 0) - error->warning(FLERR, "Non-zero lower Taper-radius cutoff"); - - if (swb < 0) { - error->all(FLERR,"Negative upper Taper-radius cutoff"); + workspace->Tap[7] = 20.0 / d7; + workspace->Tap[6] = -70.0 * (swa + swb) / d7; + workspace->Tap[5] = 84.0 * (swa2 + 3.0*swa*swb + swb2) / d7; + workspace->Tap[4] = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3) / d7; + workspace->Tap[3] = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3) / d7; + workspace->Tap[2] =-210.0 * (swa3*swb2 + swa2*swb3) / d7; + workspace->Tap[1] = 140.0 * swa3 * swb3 / d7; + workspace->Tap[0] = (-35.0*swa3*swb2*swb2 + 21.0*swa2*swb3*swb2 - + 7.0*swa*swb3*swb3 + swb3*swb3*swb) / d7; } - else if (swb < 5 && control->me == 0) - error->warning(FLERR,fmt::format("Warning: very low Taper-radius cutoff: " - "{}\n", swb)); - d1 = swb - swa; - d7 = pow(d1, 7.0); - swa2 = SQR(swa); - swa3 = CUBE(swa); - swb2 = SQR(swb); - swb3 = CUBE(swb); - workspace->Tap[7] = 20.0 / d7; - workspace->Tap[6] = -70.0 * (swa + swb) / d7; - workspace->Tap[5] = 84.0 * (swa2 + 3.0*swa*swb + swb2) / d7; - workspace->Tap[4] = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3) / d7; - workspace->Tap[3] = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3) / d7; - workspace->Tap[2] =-210.0 * (swa3*swb2 + swa2*swb3) / d7; - workspace->Tap[1] = 140.0 * swa3 * swb3 / d7; - workspace->Tap[0] = (-35.0*swa3*swb2*swb2 + 21.0*swa2*swb3*swb2 - - 7.0*swa*swb3*swb3 + swb3*swb3*swb) / d7; -} + void Init_Workspace(reax_system *system, control_params *control, storage *workspace) + { + Allocate_Workspace(control, workspace,system->total_cap); -void Init_Workspace(reax_system *system, control_params *control, storage *workspace) -{ - Allocate_Workspace(control, workspace,system->total_cap); + memset(&(workspace->realloc), 0, sizeof(reallocate_data)); + Reset_Workspace(system, workspace); - memset(&(workspace->realloc), 0, sizeof(reallocate_data)); - Reset_Workspace(system, workspace); + /* Initialize the Taper function */ + Init_Taper(control, workspace); + } - /* Initialize the Taper function */ - Init_Taper(control, workspace); -} + static int Init_Lists(reax_system *system, control_params *control, reax_list **lists) + { + int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; + int *hb_top, *bond_top; -int Init_Lists(reax_system *system, control_params *control, reax_list **lists) -{ - int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; - int *hb_top, *bond_top; + int mincap = system->mincap; + double safezone = system->safezone; + double saferzone = system->saferzone; + LAMMPS_NS::Error *error = system->error_ptr; - int mincap = system->mincap; - double safezone = system->safezone; - double saferzone = system->saferzone; - LAMMPS_NS::Error *error = system->error_ptr; + bond_top = (int*) calloc(system->total_cap, sizeof(int)); + hb_top = (int*) calloc(system->local_cap, sizeof(int)); + Estimate_Storages(system, control, lists, + &Htop, hb_top, bond_top, &num_3body); - bond_top = (int*) calloc(system->total_cap, sizeof(int)); - hb_top = (int*) calloc(system->local_cap, sizeof(int)); - Estimate_Storages(system, control, lists, - &Htop, hb_top, bond_top, &num_3body); + if (control->hbond_cut > 0) { + /* init H indexes */ + total_hbonds = 0; + for (i = 0; i < system->n; ++i) { + system->my_atoms[i].num_hbonds = hb_top[i]; + total_hbonds += hb_top[i]; + } + total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if (control->hbond_cut > 0) { - /* init H indexes */ - total_hbonds = 0; - for (i = 0; i < system->n; ++i) { - system->my_atoms[i].num_hbonds = hb_top[i]; - total_hbonds += hb_top[i]; + if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, + *lists+HBONDS)) + error->one(FLERR, "Not enough space for hbonds list."); + + (*lists+HBONDS)->error_ptr = system->error_ptr; } - total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS)) - error->one(FLERR, "Not enough space for hbonds list."); + total_bonds = 0; + for (i = 0; i < system->N; ++i) { + system->my_atoms[i].num_bonds = bond_top[i]; + total_bonds += bond_top[i]; + } + bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - (*lists+HBONDS)->error_ptr = system->error_ptr; + if (!Make_List(system->total_cap, bond_cap, TYP_BOND, + *lists+BONDS)) + error->one(FLERR, "Not enough space for bonds list."); + + (*lists+BONDS)->error_ptr = system->error_ptr; + + /* 3bodies list */ + cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); + if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, + *lists+THREE_BODIES)) + error->one(FLERR,"Problem in initializing angles list."); + + (*lists+THREE_BODIES)->error_ptr = system->error_ptr; + + free(hb_top); + free(bond_top); + + return SUCCESS; } - total_bonds = 0; - for (i = 0; i < system->N; ++i) { - system->my_atoms[i].num_bonds = bond_top[i]; - total_bonds += bond_top[i]; + void Initialize(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control, + MPI_Comm world) + { + char msg[MAX_STR]; + LAMMPS_NS::Error *error = system->error_ptr; + + Init_System(system, control); + Init_Simulation_Data(data); + Init_Workspace(system, control, workspace); + + if (Init_Lists(system, control, lists) ==FAILURE) + error->one(FLERR,fmt::format("Error on: {}. System could not be " + "initialized. Terminating.",msg)); + + Init_Output_Files(system, control, out_control,world); + + if (control->tabulate) + Init_Lookup_Tables(system, control, workspace, world); } - bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - - if (!Make_List(system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS)) - error->one(FLERR, "Not enough space for bonds list."); - - (*lists+BONDS)->error_ptr = system->error_ptr; - - /* 3bodies list */ - cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES)) - error->one(FLERR,"Problem in initializing angles list."); - - (*lists+THREE_BODIES)->error_ptr = system->error_ptr; - - free(hb_top); - free(bond_top); - - return SUCCESS; -} - -void Initialize(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm world) -{ - char msg[MAX_STR]; - LAMMPS_NS::Error *error = system->error_ptr; - - Init_System(system,control); - Init_Simulation_Data(control,data); - Init_Workspace( system,control,workspace); - - if (Init_Lists(system, control, lists) ==FAILURE) - error->one(FLERR,fmt::format("Error on: {}. System could not be " - "initialized. Terminating.",msg)); - - Init_Output_Files(system,control,out_control,world); - - if (control->tabulate) - if (Init_Lookup_Tables(system,control,workspace,world,msg) == FAILURE) - error->one(FLERR,fmt::format("Error on: {}. Could not create lookup " - "table. Terminating.",msg)); - - - Init_Force_Functions(control); } diff --git a/src/USER-REAXC/reaxc_init_md.h b/src/USER-REAXC/reaxc_init_md.h deleted file mode 100644 index 4528ee95b1..0000000000 --- a/src/USER-REAXC/reaxc_init_md.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __INIT_MD_H_ -#define __INIT_MD_H_ - -#include "reaxc_types.h" -#include - -void Initialize(reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*, MPI_Comm); -#endif diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 2f5c6b8f65..6ca0b29b6e 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -24,43 +24,76 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_io_tools.h" -#include -#include -#include "reaxc_defs.h" -#include "reaxc_system_props.h" -#include "reaxc_traj.h" +#include "reaxff_api.h" -void Init_Output_Files(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world) -{ - if (out_control->write_steps > 0) - Init_Traj(system, control, out_control, world); -} +namespace ReaxFF { + void Collect_System_Energy(reax_system *system, simulation_data *data, + MPI_Comm comm) + { + double my_en[13], sys_en[13]; -/************************ close output files ************************/ -void Close_Output_Files(reax_system *system, output_controls *out_control) -{ - if (out_control->write_steps > 0) - End_Traj(system->my_rank, out_control); -} + my_en[0] = data->my_en.e_bond; + my_en[1] = data->my_en.e_ov; + my_en[2] = data->my_en.e_un; + my_en[3] = data->my_en.e_lp; + my_en[4] = data->my_en.e_ang; + my_en[5] = data->my_en.e_pen; + my_en[6] = data->my_en.e_coa; + my_en[7] = data->my_en.e_hb; + my_en[8] = data->my_en.e_tor; + my_en[9] = data->my_en.e_con; + my_en[10] = data->my_en.e_vdW; + my_en[11] = data->my_en.e_ele; + my_en[12] = data->my_en.e_pol; + MPI_Reduce( my_en, sys_en, 13, MPI_DOUBLE, MPI_SUM, MASTER_NODE, comm ); -void Output_Results(reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, MPI_Comm world) -{ - - if ((out_control->energy_update_freq > 0 && - data->step%out_control->energy_update_freq == 0) || - (out_control->write_steps > 0 && - data->step%out_control->write_steps == 0)) { - /* update system-wide energies */ - Compute_System_Energy(system, data, world); - - /* write current frame */ - if ( out_control->write_steps > 0 && data->step % out_control->write_steps == 0) { - Append_Frame( system, control, data, lists, out_control, world); + if (system->my_rank == MASTER_NODE) { + data->sys_en.e_bond = sys_en[0]; + data->sys_en.e_ov = sys_en[1]; + data->sys_en.e_un = sys_en[2]; + data->sys_en.e_lp = sys_en[3]; + data->sys_en.e_ang = sys_en[4]; + data->sys_en.e_pen = sys_en[5]; + data->sys_en.e_coa = sys_en[6]; + data->sys_en.e_hb = sys_en[7]; + data->sys_en.e_tor = sys_en[8]; + data->sys_en.e_con = sys_en[9]; + data->sys_en.e_vdW = sys_en[10]; + data->sys_en.e_ele = sys_en[11]; + data->sys_en.e_pol = sys_en[12]; } + } + + void Init_Output_Files(reax_system *system, control_params *control, + output_controls *out_control, MPI_Comm world) + { + if (out_control->write_steps > 0) + Init_Traj(system, control, out_control, world); } + /************************ close output files ************************/ + void Close_Output_Files(reax_system *system, output_controls *out_control) + { + if (out_control->write_steps > 0) + End_Traj(system->my_rank, out_control); + } + + void Output_Results(reax_system *system, control_params *control, + simulation_data *data, reax_list **lists, + output_controls *out_control, MPI_Comm world) + { + + if ((out_control->energy_update_freq > 0 && + data->step%out_control->energy_update_freq == 0) || + (out_control->write_steps > 0 && + data->step%out_control->write_steps == 0)) { + /* update system-wide energies */ + Collect_System_Energy(system, data, world); + + /* write current frame */ + if (out_control->write_steps > 0 && data->step % out_control->write_steps == 0) { + Append_Frame(system, control, data, lists, out_control, world); + } + } + } } diff --git a/src/USER-REAXC/reaxc_io_tools.h b/src/USER-REAXC/reaxc_io_tools.h deleted file mode 100644 index 8b69125032..0000000000 --- a/src/USER-REAXC/reaxc_io_tools.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __IO_TOOLS_H_ -#define __IO_TOOLS_H_ - -#include "reaxc_types.h" -#include - -void Init_Output_Files(reax_system *, control_params *, output_controls *, MPI_Comm); -void Close_Output_Files(reax_system *, output_controls *); -void Output_Results(reax_system *, control_params *, simulation_data *, - reax_list **, output_controls *, MPI_Comm); -#endif diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index b48a9a540e..94d4a0a4b5 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -24,121 +24,120 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_list.h" -#include "reaxc_defs.h" -#include "reaxc_tool_box.h" +#include "reaxff_api.h" #include "error.h" -/************* allocate list space ******************/ -int Make_List(int n, int num_intrs, int type, reax_list *l ) -{ - l->allocated = 1; +namespace ReaxFF { + + /************* allocate list space ******************/ + int Make_List(int n, int num_intrs, int type, reax_list *l) + { + l->allocated = 1; - l->n = n; - l->num_intrs = num_intrs; + l->n = n; + l->num_intrs = num_intrs; - if (l->index) sfree(l->error_ptr, l->index, "list:index"); - if (l->end_index) sfree(l->error_ptr, l->end_index, "list:end_index"); - l->index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:index"); - l->end_index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:end_index"); + if (l->index) sfree(l->error_ptr, l->index, "list:index"); + if (l->end_index) sfree(l->error_ptr, l->end_index, "list:end_index"); + l->index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:index"); + l->end_index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:end_index"); - l->type = type; + l->type = type; - switch(l->type) { - case TYP_VOID: - if (l->select.v) sfree(l->error_ptr, l->select.v, "list:v"); - l->select.v = (void*) smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(void*), "list:v"); - break; + switch(l->type) { + case TYP_VOID: + if (l->select.v) sfree(l->error_ptr, l->select.v, "list:v"); + l->select.v = (void*) smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(void*), "list:v"); + break; - case TYP_THREE_BODY: - if (l->select.three_body_list) sfree(l->error_ptr, l->select.three_body_list,"list:three_bodies"); - l->select.three_body_list = (three_body_interaction_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(three_body_interaction_data), - "list:three_bodies"); - break; + case TYP_THREE_BODY: + if (l->select.three_body_list) sfree(l->error_ptr, l->select.three_body_list,"list:three_bodies"); + l->select.three_body_list = (three_body_interaction_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(three_body_interaction_data), + "list:three_bodies"); + break; - case TYP_BOND: - if (l->select.bond_list) sfree(l->error_ptr, l->select.bond_list,"list:bonds"); - l->select.bond_list = (bond_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(bond_data), "list:bonds"); - break; + case TYP_BOND: + if (l->select.bond_list) sfree(l->error_ptr, l->select.bond_list,"list:bonds"); + l->select.bond_list = (bond_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(bond_data), "list:bonds"); + break; - case TYP_DBO: - if (l->select.dbo_list) sfree(l->error_ptr, l->select.dbo_list,"list:dbonds"); - l->select.dbo_list = (dbond_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dbond_data), "list:dbonds"); - break; + case TYP_DBO: + if (l->select.dbo_list) sfree(l->error_ptr, l->select.dbo_list,"list:dbonds"); + l->select.dbo_list = (dbond_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dbond_data), "list:dbonds"); + break; - case TYP_DDELTA: - if (l->select.dDelta_list) sfree(l->error_ptr, l->select.dDelta_list,"list:dDeltas"); - l->select.dDelta_list = (dDelta_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dDelta_data), "list:dDeltas"); - break; + case TYP_DDELTA: + if (l->select.dDelta_list) sfree(l->error_ptr, l->select.dDelta_list,"list:dDeltas"); + l->select.dDelta_list = (dDelta_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dDelta_data), "list:dDeltas"); + break; - case TYP_FAR_NEIGHBOR: - if (l->select.far_nbr_list) sfree(l->error_ptr, l->select.far_nbr_list,"list:far_nbrs"); - l->select.far_nbr_list = (far_neighbor_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(far_neighbor_data), "list:far_nbrs"); - break; + case TYP_FAR_NEIGHBOR: + if (l->select.far_nbr_list) sfree(l->error_ptr, l->select.far_nbr_list,"list:far_nbrs"); + l->select.far_nbr_list = (far_neighbor_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(far_neighbor_data), "list:far_nbrs"); + break; - case TYP_HBOND: - if (l->select.hbond_list) sfree(l->error_ptr, l->select.hbond_list,"list:hbonds"); - l->select.hbond_list = (hbond_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(hbond_data), "list:hbonds"); - break; + case TYP_HBOND: + if (l->select.hbond_list) sfree(l->error_ptr, l->select.hbond_list,"list:hbonds"); + l->select.hbond_list = (hbond_data*) + smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(hbond_data), "list:hbonds"); + break; - default: - l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); + default: + l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); + } + + return SUCCESS; } - return SUCCESS; -} + void Delete_List(reax_list *l) + { + if (l->allocated == 0) + return; + l->allocated = 0; + sfree(l->error_ptr, l->index, "list:index"); + sfree(l->error_ptr, l->end_index, "list:end_index"); + l->index = nullptr; + l->end_index = nullptr; -void Delete_List( reax_list *l ) -{ - if (l->allocated == 0) - return; - l->allocated = 0; + switch(l->type) { + case TYP_VOID: + sfree(l->error_ptr, l->select.v, "list:v"); + l->select.v = nullptr; + break; + case TYP_HBOND: + sfree(l->error_ptr, l->select.hbond_list, "list:hbonds"); + l->select.hbond_list = nullptr; + break; + case TYP_FAR_NEIGHBOR: + sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs"); + l->select.far_nbr_list = nullptr; + break; + case TYP_BOND: + sfree(l->error_ptr, l->select.bond_list, "list:bonds"); + l->select.bond_list = nullptr; + break; + case TYP_DBO: + sfree(l->error_ptr, l->select.dbo_list, "list:dbos"); + l->select.dbo_list = nullptr; + break; + case TYP_DDELTA: + sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas"); + l->select.dDelta_list = nullptr; + break; + case TYP_THREE_BODY: + sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies"); + l->select.three_body_list = nullptr; + break; - sfree(l->error_ptr, l->index, "list:index" ); - sfree(l->error_ptr, l->end_index, "list:end_index" ); - l->index = nullptr; - l->end_index = nullptr; - - switch(l->type) { - case TYP_VOID: - sfree(l->error_ptr, l->select.v, "list:v" ); - l->select.v = nullptr; - break; - case TYP_HBOND: - sfree(l->error_ptr, l->select.hbond_list, "list:hbonds" ); - l->select.hbond_list = nullptr; - break; - case TYP_FAR_NEIGHBOR: - sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs" ); - l->select.far_nbr_list = nullptr; - break; - case TYP_BOND: - sfree(l->error_ptr, l->select.bond_list, "list:bonds" ); - l->select.bond_list = nullptr; - break; - case TYP_DBO: - sfree(l->error_ptr, l->select.dbo_list, "list:dbos" ); - l->select.dbo_list = nullptr; - break; - case TYP_DDELTA: - sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas" ); - l->select.dDelta_list = nullptr; - break; - case TYP_THREE_BODY: - sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies" ); - l->select.three_body_list = nullptr; - break; - - default: - l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); + default: + l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); + } } } - diff --git a/src/USER-REAXC/reaxc_list.h b/src/USER-REAXC/reaxc_list.h deleted file mode 100644 index 1894f6cbbd..0000000000 --- a/src/USER-REAXC/reaxc_list.h +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __LIST_H_ -#define __LIST_H_ - -#include "reaxc_types.h" - -int Make_List( int, int, int, reax_list* ); -void Delete_List( reax_list* ); - -inline int Num_Entries(int,reax_list*); -inline int Start_Index( int, reax_list* ); -inline int End_Index( int, reax_list* ); -inline void Set_Start_Index(int,int,reax_list*); -inline void Set_End_Index(int,int,reax_list*); - -inline int Num_Entries( int i, reax_list *l ) -{ - return l->end_index[i] - l->index[i]; -} - -inline int Start_Index( int i, reax_list *l ) -{ - return l->index[i]; -} - -inline int End_Index( int i, reax_list *l ) -{ - return l->end_index[i]; -} - -inline void Set_Start_Index( int i, int val, reax_list *l ) -{ - l->index[i] = val; -} - -inline void Set_End_Index( int i, int val, reax_list *l ) -{ - l->end_index[i] = val; -} - -#endif diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index 7584c34b82..58eab80d17 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -24,270 +24,266 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_lookup.h" +#include "reaxff_api.h" + #include #include -#include "reaxc_nonbonded.h" -#include "reaxc_tool_box.h" -void Tridiagonal_Solve( const double *a, const double *b, - double *c, double *d, double *x, unsigned int n) { - int i; - double id; +namespace ReaxFF { + static void Tridiagonal_Solve(const double *a, const double *b, + double *c, double *d, double *x, unsigned int n) { + int i; + double id; - c[0] /= b[0]; /* Division by zero risk. */ - d[0] /= b[0]; /* Division by zero would imply a singular matrix. */ - for (i = 1; i < (int)n; i++) { - id = (b[i] - c[i-1] * a[i]); /* Division by zero risk. */ - c[i] /= id; /* Last value calculated is redundant. */ - d[i] = (d[i] - d[i-1] * a[i])/id; + c[0] /= b[0]; /* Division by zero risk. */ + d[0] /= b[0]; /* Division by zero would imply a singular matrix. */ + for (i = 1; i < (int)n; i++) { + id = (b[i] - c[i-1] * a[i]); /* Division by zero risk. */ + c[i] /= id; /* Last value calculated is redundant. */ + d[i] = (d[i] - d[i-1] * a[i])/id; + } + + x[n - 1] = d[n - 1]; + for (i = n - 2; i >= 0; i--) + x[i] = d[i] - c[i] * x[i + 1]; } - x[n - 1] = d[n - 1]; - for (i = n - 2; i >= 0; i--) - x[i] = d[i] - c[i] * x[i + 1]; -} + void Natural_Cubic_Spline(LAMMPS_NS::Error* error_ptr, const double *h, const double *f, + cubic_spline_coef *coef, unsigned int n) + { + int i; + double *a, *b, *c, *d, *v; + /* allocate space for the linear system */ + a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); -void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const double *f, - cubic_spline_coef *coef, unsigned int n ) -{ - int i; - double *a, *b, *c, *d, *v; + /* build the linear system */ + a[0] = a[1] = a[n-1] = 0; + for (i = 2; i < (int)n-1; ++i) + a[i] = h[i-1]; - /* allocate space for the linear system */ - a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + b[0] = b[n-1] = 0; + for (i = 1; i < (int)n-1; ++i) + b[i] = 2 * (h[i-1] + h[i]); - /* build the linear system */ - a[0] = a[1] = a[n-1] = 0; - for (i = 2; i < (int)n-1; ++i) - a[i] = h[i-1]; + c[0] = c[n-2] = c[n-1] = 0; + for (i = 1; i < (int)n-2; ++i) + c[i] = h[i]; - b[0] = b[n-1] = 0; - for (i = 1; i < (int)n-1; ++i) - b[i] = 2 * (h[i-1] + h[i]); + d[0] = d[n-1] = 0; + for (i = 1; i < (int)n-1; ++i) + d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); - c[0] = c[n-2] = c[n-1] = 0; - for (i = 1; i < (int)n-2; ++i) - c[i] = h[i]; + v[0] = 0; + v[n-1] = 0; + Tridiagonal_Solve(&(a[1]), &(b[1]), &(c[1]), &(d[1]), &(v[1]), n-2); - d[0] = d[n-1] = 0; - for (i = 1; i < (int)n-1; ++i) - d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); + for (i = 1; i < (int)n; ++i) { + coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); + coef[i-1].c = v[i]/2; + coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; + coef[i-1].a = f[i]; + } - v[0] = 0; - v[n-1] = 0; - Tridiagonal_Solve( &(a[1]), &(b[1]), &(c[1]), &(d[1]), &(v[1]), n-2 ); - - for (i = 1; i < (int)n; ++i) { - coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); - coef[i-1].c = v[i]/2; - coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; - coef[i-1].a = f[i]; + sfree(error_ptr, a, "cubic_spline:a"); + sfree(error_ptr, b, "cubic_spline:b"); + sfree(error_ptr, c, "cubic_spline:c"); + sfree(error_ptr, d, "cubic_spline:d"); + sfree(error_ptr, v, "cubic_spline:v"); } - sfree(error_ptr, a, "cubic_spline:a" ); - sfree(error_ptr, b, "cubic_spline:b" ); - sfree(error_ptr, c, "cubic_spline:c" ); - sfree(error_ptr, d, "cubic_spline:d" ); - sfree(error_ptr, v, "cubic_spline:v" ); -} + void Complete_Cubic_Spline(LAMMPS_NS::Error* error_ptr, const double *h, + const double *f, double v0, double vlast, + cubic_spline_coef *coef, unsigned int n) + { + int i; + double *a, *b, *c, *d, *v; + /* allocate space for the linear system */ + a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + /* build the linear system */ + a[0] = 0; + for (i = 1; i < (int)n; ++i) + a[i] = h[i-1]; -void Complete_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const double *f, double v0, double vlast, - cubic_spline_coef *coef, unsigned int n ) -{ - int i; - double *a, *b, *c, *d, *v; + b[0] = 2*h[0]; + for (i = 1; i < (int)n; ++i) + b[i] = 2 * (h[i-1] + h[i]); - /* allocate space for the linear system */ - a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); - v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a"); + c[n-1] = 0; + for (i = 0; i < (int)n-1; ++i) + c[i] = h[i]; - /* build the linear system */ - a[0] = 0; - for (i = 1; i < (int)n; ++i) - a[i] = h[i-1]; + d[0] = 6 * (f[1]-f[0])/h[0] - 6 * v0; + d[n-1] = 6 * vlast - 6 * (f[n-1]-f[n-2]/h[n-2]); + for (i = 1; i < (int)n-1; ++i) + d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); - b[0] = 2*h[0]; - for (i = 1; i < (int)n; ++i) - b[i] = 2 * (h[i-1] + h[i]); + Tridiagonal_Solve(&(a[0]), &(b[0]), &(c[0]), &(d[0]), &(v[0]), n); - c[n-1] = 0; - for (i = 0; i < (int)n-1; ++i) - c[i] = h[i]; + for (i = 1; i < (int)n; ++i) { + coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); + coef[i-1].c = v[i]/2; + coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; + coef[i-1].a = f[i]; + } - d[0] = 6 * (f[1]-f[0])/h[0] - 6 * v0; - d[n-1] = 6 * vlast - 6 * (f[n-1]-f[n-2]/h[n-2]); - for (i = 1; i < (int)n-1; ++i) - d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); - - Tridiagonal_Solve( &(a[0]), &(b[0]), &(c[0]), &(d[0]), &(v[0]), n ); - - for (i = 1; i < (int)n; ++i) { - coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); - coef[i-1].c = v[i]/2; - coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; - coef[i-1].a = f[i]; + sfree(error_ptr, a, "cubic_spline:a"); + sfree(error_ptr, b, "cubic_spline:b"); + sfree(error_ptr, c, "cubic_spline:c"); + sfree(error_ptr, d, "cubic_spline:d"); + sfree(error_ptr, v, "cubic_spline:v"); } - sfree(error_ptr, a, "cubic_spline:a" ); - sfree(error_ptr, b, "cubic_spline:b" ); - sfree(error_ptr, c, "cubic_spline:c" ); - sfree(error_ptr, d, "cubic_spline:d" ); - sfree(error_ptr, v, "cubic_spline:v" ); -} + void Init_Lookup_Tables(reax_system *system, control_params *control, + storage *workspace, MPI_Comm world) + { + int i, j, r; + int num_atom_types; + int existing_types[REAX_MAX_ATOM_TYPES], aggregated[REAX_MAX_ATOM_TYPES]; + double dr; + double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb; + double v0_vdw, v0_ele, vlast_vdw, vlast_ele; + LR_lookup_table ** & LR = system->LR; + /* initializations */ + v0_vdw = 0; + v0_ele = 0; + vlast_vdw = 0; + vlast_ele = 0; -int Init_Lookup_Tables(reax_system *system, control_params *control, - storage *workspace, MPI_Comm world, char * /*msg*/) -{ - int i, j, r; - int num_atom_types; - int existing_types[REAX_MAX_ATOM_TYPES], aggregated[REAX_MAX_ATOM_TYPES]; - double dr; - double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb; - double v0_vdw, v0_ele, vlast_vdw, vlast_ele; - LR_lookup_table ** & LR = system->LR; + num_atom_types = system->reax_param.num_atom_types; + dr = control->nonb_cut / control->tabulate; + h = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); + fh = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh"); + fvdw = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw"); + fCEvd = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd"); + fele = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele"); + fCEclmb = (double*) + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); - /* initializations */ - v0_vdw = 0; - v0_ele = 0; - vlast_vdw = 0; - vlast_ele = 0; + LR = (LR_lookup_table**) + scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR"); + for (i = 0; i < num_atom_types; ++i) + LR[i] = (LR_lookup_table*) + scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); - num_atom_types = system->reax_param.num_atom_types; - dr = control->nonb_cut / control->tabulate; - h = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); - fh = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh"); - fvdw = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw"); - fCEvd = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd"); - fele = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele"); - fCEclmb = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); + for (i = 0; i < REAX_MAX_ATOM_TYPES; ++i) + existing_types[i] = 0; + for (i = 0; i < system->n; ++i) + existing_types[ system->my_atoms[i].type ] = 1; - LR = (LR_lookup_table**) - scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR"); - for (i = 0; i < num_atom_types; ++i) - LR[i] = (LR_lookup_table*) - scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); + MPI_Allreduce(existing_types, aggregated, REAX_MAX_ATOM_TYPES, + MPI_INT, MPI_SUM, world); - for (i = 0; i < REAX_MAX_ATOM_TYPES; ++i) - existing_types[i] = 0; - for (i = 0; i < system->n; ++i) - existing_types[ system->my_atoms[i].type ] = 1; + for (i = 0; i < num_atom_types; ++i) { + if (aggregated[i]) { + for (j = i; j < num_atom_types; ++j) { + if (aggregated[j]) { + LR[i][j].xmin = 0; + LR[i][j].xmax = control->nonb_cut; + LR[i][j].n = control->tabulate + 2; + LR[i][j].dx = dr; + LR[i][j].inv_dx = control->tabulate / control->nonb_cut; + LR[i][j].y = (LR_data*) + smalloc(system->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y"); + LR[i][j].H = (cubic_spline_coef*) + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H"); + LR[i][j].vdW = (cubic_spline_coef*) + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW"); + LR[i][j].CEvd = (cubic_spline_coef*) + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd"); + LR[i][j].ele = (cubic_spline_coef*) + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele"); + LR[i][j].CEclmb = (cubic_spline_coef*) + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), + "lookup:LR[i,j].CEclmb"); - MPI_Allreduce(existing_types, aggregated, REAX_MAX_ATOM_TYPES, - MPI_INT, MPI_SUM, world); + for (r = 1; r <= control->tabulate; ++r) { + LR_vdW_Coulomb(system, workspace, control, i, j, r * dr, &(LR[i][j].y[r])); + h[r] = LR[i][j].dx; + fh[r] = LR[i][j].y[r].H; + fvdw[r] = LR[i][j].y[r].e_vdW; + fCEvd[r] = LR[i][j].y[r].CEvd; + fele[r] = LR[i][j].y[r].e_ele; + fCEclmb[r] = LR[i][j].y[r].CEclmb; + } - for (i = 0; i < num_atom_types; ++i) { - if (aggregated[i]) { - for (j = i; j < num_atom_types; ++j) { - if (aggregated[j]) { - LR[i][j].xmin = 0; - LR[i][j].xmax = control->nonb_cut; - LR[i][j].n = control->tabulate + 2; - LR[i][j].dx = dr; - LR[i][j].inv_dx = control->tabulate / control->nonb_cut; - LR[i][j].y = (LR_data*) - smalloc(system->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y"); - LR[i][j].H = (cubic_spline_coef*) - smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H"); - LR[i][j].vdW = (cubic_spline_coef*) - smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW"); - LR[i][j].CEvd = (cubic_spline_coef*) - smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd"); - LR[i][j].ele = (cubic_spline_coef*) - smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele"); - LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), - "lookup:LR[i,j].CEclmb"); - - for (r = 1; r <= control->tabulate; ++r) { - LR_vdW_Coulomb( system, workspace, control, i, j, r * dr, &(LR[i][j].y[r]) ); + // init the start-end points h[r] = LR[i][j].dx; - fh[r] = LR[i][j].y[r].H; - fvdw[r] = LR[i][j].y[r].e_vdW; - fCEvd[r] = LR[i][j].y[r].CEvd; - fele[r] = LR[i][j].y[r].e_ele; - fCEclmb[r] = LR[i][j].y[r].CEclmb; + v0_vdw = LR[i][j].y[1].CEvd; + v0_ele = LR[i][j].y[1].CEclmb; + fh[r] = fh[r-1]; + fvdw[r] = fvdw[r-1]; + fCEvd[r] = fCEvd[r-1]; + fele[r] = fele[r-1]; + fCEclmb[r] = fCEclmb[r-1]; + vlast_vdw = fCEvd[r-1]; + vlast_ele = fele[r-1]; + + Natural_Cubic_Spline(control->error_ptr, &h[1], &fh[1], + &(LR[i][j].H[1]), control->tabulate+1); + + Complete_Cubic_Spline(control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw, + &(LR[i][j].vdW[1]), control->tabulate+1); + + Natural_Cubic_Spline(control->error_ptr, &h[1], &fCEvd[1], + &(LR[i][j].CEvd[1]), control->tabulate+1); + + Complete_Cubic_Spline(control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele, + &(LR[i][j].ele[1]), control->tabulate+1); + + Natural_Cubic_Spline(control->error_ptr, &h[1], &fCEclmb[1], + &(LR[i][j].CEclmb[1]), control->tabulate+1); + } else { + LR[i][j].n = 0; } - - // init the start-end points - h[r] = LR[i][j].dx; - v0_vdw = LR[i][j].y[1].CEvd; - v0_ele = LR[i][j].y[1].CEclmb; - fh[r] = fh[r-1]; - fvdw[r] = fvdw[r-1]; - fCEvd[r] = fCEvd[r-1]; - fele[r] = fele[r-1]; - fCEclmb[r] = fCEclmb[r-1]; - vlast_vdw = fCEvd[r-1]; - vlast_ele = fele[r-1]; - - Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1], - &(LR[i][j].H[1]), control->tabulate+1); - - Complete_Cubic_Spline( control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw, - &(LR[i][j].vdW[1]), control->tabulate+1); - - Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEvd[1], - &(LR[i][j].CEvd[1]), control->tabulate+1); - - Complete_Cubic_Spline( control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele, - &(LR[i][j].ele[1]), control->tabulate+1); - - Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEclmb[1], - &(LR[i][j].CEclmb[1]), control->tabulate+1); - } else { - LR[i][j].n = 0; } } } + free(h); + free(fh); + free(fvdw); + free(fCEvd); + free(fele); + free(fCEclmb); } - free(h); - free(fh); - free(fvdw); - free(fCEvd); - free(fele); - free(fCEclmb); - return 1; + void Deallocate_Lookup_Tables(reax_system *system) + { + int i, j; + int ntypes; + LR_lookup_table ** & LR = system->LR; + + ntypes = system->reax_param.num_atom_types; + + for (i = 0; i < ntypes; ++i) { + for (j = i; j < ntypes; ++j) + if (LR[i][j].n) { + sfree(system->error_ptr, LR[i][j].y, "LR[i,j].y"); + sfree(system->error_ptr, LR[i][j].H, "LR[i,j].H"); + sfree(system->error_ptr, LR[i][j].vdW, "LR[i,j].vdW"); + sfree(system->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd"); + sfree(system->error_ptr, LR[i][j].ele, "LR[i,j].ele"); + sfree(system->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb"); + } + sfree(system->error_ptr, LR[i], "LR[i]"); + } + sfree(system->error_ptr, LR, "LR"); + } } - -void Deallocate_Lookup_Tables( reax_system *system ) -{ - int i, j; - int ntypes; - LR_lookup_table ** & LR = system->LR; - - ntypes = system->reax_param.num_atom_types; - - for (i = 0; i < ntypes; ++i) { - for (j = i; j < ntypes; ++j) - if (LR[i][j].n) { - sfree(system->error_ptr, LR[i][j].y, "LR[i,j].y" ); - sfree(system->error_ptr, LR[i][j].H, "LR[i,j].H" ); - sfree(system->error_ptr, LR[i][j].vdW, "LR[i,j].vdW" ); - sfree(system->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree(system->error_ptr, LR[i][j].ele, "LR[i,j].ele" ); - sfree(system->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); - } - sfree(system->error_ptr, LR[i], "LR[i]" ); - } - sfree(system->error_ptr, LR, "LR" ); -} diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h deleted file mode 100644 index 39b0b14ef1..0000000000 --- a/src/USER-REAXC/reaxc_lookup.h +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __LOOKUP_H_ -#define __LOOKUP_H_ - -#include "reaxc_types.h" -namespace LAMMPS_NS { class Error; } - -void Tridiagonal_Solve( const double *a, const double *b, - double *c, double *d, double *x, unsigned int n); - -void Natural_Cubic_Spline( LAMMPS_NS::Error*, const double *h, const double *f, - cubic_spline_coef *coef, unsigned int n ); - -void Complete_Cubic_Spline( LAMMPS_NS::Error*, const double *h, const double *f, - double v0, double vlast, cubic_spline_coef *coef, - unsigned int n ); - -int Init_Lookup_Tables(reax_system*, control_params*, storage*, MPI_Comm, char* ); - -void Deallocate_Lookup_Tables( reax_system* ); - -#endif diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index ab66e3352a..f2e629c65c 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -24,17 +24,18 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_multi_body.h" +#include "reaxff_api.h" + +#include "pair.h" + #include #include -#include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -void Atom_Energy( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/ ) -{ +namespace ReaxFF { + + void Atom_Energy(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, reax_list **lists) + { int i, j, pj, type_i, type_j; double Delta_lpcorr, dfvl; double e_lp, expvd2, inv_expvd2, dElp, CElp, DlpVi; @@ -67,7 +68,7 @@ void Atom_Energy( reax_system *system, control_params *control, /* set the parameter pointer */ type_i = system->my_atoms[i].type; if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + sbp_i = &(system->reax_param.sbp[type_i]); /* lone-pair Energy */ p_lp2 = sbp_i->p_lp2; @@ -126,11 +127,10 @@ void Atom_Energy( reax_system *system, control_params *control, } } - for (i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + sbp_i = &(system->reax_param.sbp[type_i]); /* over-coordination energy */ if (sbp_i->mass > 21.0) @@ -144,7 +144,7 @@ void Atom_Energy( reax_system *system, control_params *control, type_j = system->my_atoms[j].type; if (type_j < 0) continue; bo_ij = &(bonds->select.bond_list[pj].bo_data); - twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); + twbp = &(system->reax_param.tbp[type_i][type_j]); sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* @@ -218,10 +218,9 @@ void Atom_Energy( reax_system *system, control_params *control, pbond = &(bonds->select.bond_list[pj]); j = pbond->nbr; bo_ij = &(pbond->bo_data); - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] + twbp = &(system->reax_param.tbp[system->my_atoms[i].type] [system->my_atoms[pbond->nbr].type]); - bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s;// OvCoor-1st workspace->CdDelta[j] += CEover4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // OvCoor-3a @@ -230,15 +229,13 @@ void Atom_Energy( reax_system *system, control_params *control, bo_ij->Cdbopi2 += CEover4 * (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b - workspace->CdDelta[j] += CEunder4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // UnCoor - 2a bo_ij->Cdbopi += CEunder4 * (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b bo_ij->Cdbopi2 += CEunder4 * (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b - } - } } +} diff --git a/src/USER-REAXC/reaxc_multi_body.h b/src/USER-REAXC/reaxc_multi_body.h deleted file mode 100644 index a17c9f484e..0000000000 --- a/src/USER-REAXC/reaxc_multi_body.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __MULTI_BODY_H_ -#define __MULTI_BODY_H_ - -#include "reaxc_types.h" - -void Atom_Energy( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-REAXC/reaxc_nonbonded.cpp b/src/USER-REAXC/reaxc_nonbonded.cpp index c5a1f808c5..e4adf6c7b1 100644 --- a/src/USER-REAXC/reaxc_nonbonded.cpp +++ b/src/USER-REAXC/reaxc_nonbonded.cpp @@ -24,403 +24,399 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_nonbonded.h" -#include +#include "reaxff_api.h" + #include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_types.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" -void vdW_Coulomb_Energy( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) -{ - int i, j, pj, natoms; - int start_i, end_i, flag; - rc_tagint orig_i, orig_j; - double p_vdW1, p_vdW1i; - double powr_vdW1, powgi_vdW1; - double tmp, r_ij, fn13, exp1, exp2; - double Tap, dTap, dfn13, CEvd, CEclmb, de_core; - double dr3gamij_1, dr3gamij_3; - double e_ele, e_vdW, e_core, SMALL = 0.0001; - double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp; - two_body_parameters *twbp; - far_neighbor_data *nbr_pj; - reax_list *far_nbrs; +#include - // Tallying variables: - double pe_vdw, f_tmp, delij[3]; +namespace ReaxFF { + void Compute_Polarization_Energy(reax_system *system, simulation_data *data) + { + int i, type_i; + double q, en_tmp; - natoms = system->n; - far_nbrs = (*lists) + FAR_NBRS; - p_vdW1 = system->reax_param.gp.l[28]; - p_vdW1i = 1.0 / p_vdW1; - e_core = 0; - e_vdW = 0; - e_lg = de_lg = 0.0; + data->my_en.e_pol = 0.0; + for (i = 0; i < system->n; i++) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + q = system->my_atoms[i].q; - for (i = 0; i < natoms; ++i) { - if (system->my_atoms[i].type < 0) continue; - start_i = Start_Index(i, far_nbrs); - end_i = End_Index(i, far_nbrs); - orig_i = system->my_atoms[i].orig_id; - - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); - j = nbr_pj->nbr; - if (system->my_atoms[j].type < 0) continue; - orig_j = system->my_atoms[j].orig_id; - - flag = 0; - if (nbr_pj->d <= control->nonb_cut) { - if (j < natoms) flag = 1; - else if (orig_i < orig_j) flag = 1; - else if (orig_i == orig_j) { - if (nbr_pj->dvec[2] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[2]) < SMALL) { - if (nbr_pj->dvec[1] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) - flag = 1; - } - } - } - - if (flag) { - - r_ij = nbr_pj->d; - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] - [ system->my_atoms[j].type ]); - - Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; - Tap = Tap * r_ij + workspace->Tap[5]; - Tap = Tap * r_ij + workspace->Tap[4]; - Tap = Tap * r_ij + workspace->Tap[3]; - Tap = Tap * r_ij + workspace->Tap[2]; - Tap = Tap * r_ij + workspace->Tap[1]; - Tap = Tap * r_ij + workspace->Tap[0]; - - dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; - dTap = dTap * r_ij + 5*workspace->Tap[5]; - dTap = dTap * r_ij + 4*workspace->Tap[4]; - dTap = dTap * r_ij + 3*workspace->Tap[3]; - dTap = dTap * r_ij + 2*workspace->Tap[2]; - dTap += workspace->Tap[1]/r_ij; - - /*vdWaals Calculations*/ - if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) - { // shielding - powr_vdW1 = pow(r_ij, p_vdW1); - powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); - - fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i ); - exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); - - e_vdW = twbp->D * (exp1 - 2.0 * exp2); - data->my_en.e_vdW += Tap * e_vdW; - - dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) * - pow(r_ij, p_vdW1 - 2.0); - - CEvd = dTap * e_vdW - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; - } - else { // no shielding - exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - - e_vdW = twbp->D * (exp1 - 2.0 * exp2); - data->my_en.e_vdW += Tap * e_vdW; - - CEvd = dTap * e_vdW - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; - } - - if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) - { // inner wall - e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); - data->my_en.e_vdW += Tap * e_core; - - de_core = -(twbp->acore/twbp->rcore) * e_core; - CEvd += dTap * e_core + Tap * de_core / r_ij; - - // lg correction, only if lgvdw is yes - if (control->lgflag) { - r_ij5 = pow( r_ij, 5.0 ); - r_ij6 = pow( r_ij, 6.0 ); - re6 = pow( twbp->lgre, 6.0 ); - e_lg = -(twbp->lgcij/( r_ij6 + re6 )); - data->my_en.e_vdW += Tap * e_lg; - - de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ; - CEvd += dTap * e_lg + Tap * de_lg / r_ij; - } - - } - - /*Coulomb Calculations*/ - dr3gamij_1 = ( r_ij * r_ij * r_ij + twbp->gamma ); - dr3gamij_3 = pow( dr3gamij_1 , 0.33333333333333 ); - - tmp = Tap / dr3gamij_3; - data->my_en.e_ele += e_ele = - C_ele * system->my_atoms[i].q * system->my_atoms[j].q * tmp; - - CEclmb = C_ele * system->my_atoms[i].q * system->my_atoms[j].q * - ( dTap - Tap * r_ij / dr3gamij_1 ) / dr3gamij_3; + en_tmp = KCALpMOL_to_EV * (system->reax_param.sbp[type_i].chi * q + + (system->reax_param.sbp[type_i].eta / 2.) * SQR(q)); + data->my_en.e_pol += en_tmp; /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { - pe_vdw = Tap * (e_vdW + e_core + e_lg); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - f_tmp = -(CEvd + CEclmb); - system->pair_ptr->ev_tally(i,j,natoms,1,pe_vdw,e_ele, - f_tmp,delij[0],delij[1],delij[2]); - } - - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); - rvec_ScaledAdd( workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec ); - } else { /* NPT, iNPT or sNPT */ - rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); - - rvec_ScaledAdd( workspace->f[i], -1., temp ); - rvec_Add( workspace->f[j], temp ); - } - } + if (system->pair_ptr->evflag) + system->pair_ptr->ev_tally(i,i,system->n,1,0.0,en_tmp,0.0,0.0,0.0,0.0); } } - Compute_Polarization_Energy( system, data ); -} + void vdW_Coulomb_Energy(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int i, j, pj, natoms; + int start_i, end_i, flag; + rc_tagint orig_i, orig_j; + double p_vdW1, p_vdW1i; + double powr_vdW1, powgi_vdW1; + double tmp, r_ij, fn13, exp1, exp2; + double Tap, dTap, dfn13, CEvd, CEclmb, de_core; + double dr3gamij_1, dr3gamij_3; + double e_ele, e_vdW, e_core, SMALL = 0.0001; + double e_lg, de_lg, r_ij5, r_ij6, re6; + rvec temp; + two_body_parameters *twbp; + far_neighbor_data *nbr_pj; + reax_list *far_nbrs; + // Tallying variables: + double pe_vdw, f_tmp, delij[3]; + natoms = system->n; + far_nbrs = (*lists) + FAR_NBRS; + p_vdW1 = system->reax_param.gp.l[28]; + p_vdW1i = 1.0 / p_vdW1; + e_core = 0; + e_vdW = 0; + e_lg = de_lg = 0.0; -void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, - output_controls * /*out_control*/ ) -{ - int i, j, pj, r, natoms; - int type_i, type_j, tmin, tmax; - int start_i, end_i, flag; - rc_tagint orig_i, orig_j; - double r_ij, base, dif; - double e_vdW, e_ele; - double CEvd, CEclmb, SMALL = 0.0001; - double f_tmp, delij[3]; + for (i = 0; i < natoms; ++i) { + if (system->my_atoms[i].type < 0) continue; + start_i = Start_Index(i, far_nbrs); + end_i = End_Index(i, far_nbrs); + orig_i = system->my_atoms[i].orig_id; - rvec temp; - far_neighbor_data *nbr_pj; - reax_list *far_nbrs; - LR_lookup_table *t; - LR_lookup_table ** & LR = system->LR; + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + if (system->my_atoms[j].type < 0) continue; + orig_j = system->my_atoms[j].orig_id; - natoms = system->n; - far_nbrs = (*lists) + FAR_NBRS; + flag = 0; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; + else if (orig_i < orig_j) flag = 1; + else if (orig_i == orig_j) { + if (nbr_pj->dvec[2] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[2]) < SMALL) { + if (nbr_pj->dvec[1] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) + flag = 1; + } + } + } - e_ele = e_vdW = 0; + if (flag) { - for (i = 0; i < natoms; ++i) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - start_i = Start_Index(i,far_nbrs); - end_i = End_Index(i,far_nbrs); - orig_i = system->my_atoms[i].orig_id; + r_ij = nbr_pj->d; + twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] + [ system->my_atoms[j].type ]); - for (pj = start_i; pj < end_i; ++pj) { - nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); - j = nbr_pj->nbr; - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - orig_j = system->my_atoms[j].orig_id; + Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; + Tap = Tap * r_ij + workspace->Tap[5]; + Tap = Tap * r_ij + workspace->Tap[4]; + Tap = Tap * r_ij + workspace->Tap[3]; + Tap = Tap * r_ij + workspace->Tap[2]; + Tap = Tap * r_ij + workspace->Tap[1]; + Tap = Tap * r_ij + workspace->Tap[0]; - flag = 0; - if (nbr_pj->d <= control->nonb_cut) { - if (j < natoms) flag = 1; - else if (orig_i < orig_j) flag = 1; - else if (orig_i == orig_j) { - if (nbr_pj->dvec[2] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[2]) < SMALL) { - if (nbr_pj->dvec[1] > SMALL) flag = 1; - else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) - flag = 1; + dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; + dTap = dTap * r_ij + 5*workspace->Tap[5]; + dTap = dTap * r_ij + 4*workspace->Tap[4]; + dTap = dTap * r_ij + 3*workspace->Tap[3]; + dTap = dTap * r_ij + 2*workspace->Tap[2]; + dTap += workspace->Tap[1]/r_ij; + + /*vdWaals Calculations*/ + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + { // shielding + powr_vdW1 = pow(r_ij, p_vdW1); + powgi_vdW1 = pow(1.0 / twbp->gamma_w, p_vdW1); + + fn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i); + exp1 = exp(twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); + + e_vdW = twbp->D * (exp1 - 2.0 * exp2); + data->my_en.e_vdW += Tap * e_vdW; + + dfn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) * + pow(r_ij, p_vdW1 - 2.0); + + CEvd = dTap * e_vdW - + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; + } else { // no shielding + exp1 = exp(twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); + + e_vdW = twbp->D * (exp1 - 2.0 * exp2); + data->my_en.e_vdW += Tap * e_vdW; + + CEvd = dTap * e_vdW - + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; + } + + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + { // inner wall + e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); + data->my_en.e_vdW += Tap * e_core; + + de_core = -(twbp->acore/twbp->rcore) * e_core; + CEvd += dTap * e_core + Tap * de_core / r_ij; + + // lg correction, only if lgvdw is yes + if (control->lgflag) { + r_ij5 = pow(r_ij, 5.0); + r_ij6 = pow(r_ij, 6.0); + re6 = pow(twbp->lgre, 6.0); + e_lg = -(twbp->lgcij/(r_ij6 + re6)); + data->my_en.e_vdW += Tap * e_lg; + + de_lg = -6.0 * e_lg * r_ij5 / (r_ij6 + re6) ; + CEvd += dTap * e_lg + Tap * de_lg / r_ij; + } + + } + + /*Coulomb Calculations*/ + dr3gamij_1 = (r_ij * r_ij * r_ij + twbp->gamma); + dr3gamij_3 = pow(dr3gamij_1 , 0.33333333333333); + + tmp = Tap / dr3gamij_3; + data->my_en.e_ele += e_ele = + C_ele * system->my_atoms[i].q * system->my_atoms[j].q * tmp; + + CEclmb = C_ele * system->my_atoms[i].q * system->my_atoms[j].q * + (dTap - Tap * r_ij / dr3gamij_1) / dr3gamij_3; + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + pe_vdw = Tap * (e_vdW + e_core + e_lg); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + f_tmp = -(CEvd + CEclmb); + system->pair_ptr->ev_tally(i,j,natoms,1,pe_vdw,e_ele, + f_tmp,delij[0],delij[1],delij[2]); + } + + if (control->virial == 0) { + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); + } else { /* NPT, iNPT or sNPT */ + rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); + + rvec_ScaledAdd(workspace->f[i], -1., temp); + rvec_Add(workspace->f[j], temp); } } } + } - if (flag) { + Compute_Polarization_Energy(system, data); + } - r_ij = nbr_pj->d; - tmin = MIN( type_i, type_j ); - tmax = MAX( type_i, type_j ); - t = &( LR[tmin][tmax] ); + void Tabulated_vdW_Coulomb_Energy(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int i, j, pj, r, natoms; + int type_i, type_j, tmin, tmax; + int start_i, end_i, flag; + rc_tagint orig_i, orig_j; + double r_ij, base, dif; + double e_vdW, e_ele; + double CEvd, CEclmb, SMALL = 0.0001; + double f_tmp, delij[3]; - /* Cubic Spline Interpolation */ - r = (int)(r_ij * t->inv_dx); - if (r == 0) ++r; - base = (double)(r+1) * t->dx; - dif = r_ij - base; + rvec temp; + far_neighbor_data *nbr_pj; + reax_list *far_nbrs; + LR_lookup_table *t; + LR_lookup_table ** & LR = system->LR; - e_vdW = ((t->vdW[r].d*dif + t->vdW[r].c)*dif + t->vdW[r].b)*dif + - t->vdW[r].a; + natoms = system->n; + far_nbrs = (*lists) + FAR_NBRS; - e_ele = ((t->ele[r].d*dif + t->ele[r].c)*dif + t->ele[r].b)*dif + - t->ele[r].a; - e_ele *= system->my_atoms[i].q * system->my_atoms[j].q; + e_ele = e_vdW = 0; - data->my_en.e_vdW += e_vdW; - data->my_en.e_ele += e_ele; + for (i = 0; i < natoms; ++i) { + type_i = system->my_atoms[i].type; + if (type_i < 0) continue; + start_i = Start_Index(i,far_nbrs); + end_i = End_Index(i,far_nbrs); + orig_i = system->my_atoms[i].orig_id; - CEvd = ((t->CEvd[r].d*dif + t->CEvd[r].c)*dif + t->CEvd[r].b)*dif + - t->CEvd[r].a; + for (pj = start_i; pj < end_i; ++pj) { + nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); + j = nbr_pj->nbr; + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + orig_j = system->my_atoms[j].orig_id; - CEclmb = ((t->CEclmb[r].d*dif+t->CEclmb[r].c)*dif+t->CEclmb[r].b)*dif + - t->CEclmb[r].a; - CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; + flag = 0; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; + else if (orig_i < orig_j) flag = 1; + else if (orig_i == orig_j) { + if (nbr_pj->dvec[2] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[2]) < SMALL) { + if (nbr_pj->dvec[1] > SMALL) flag = 1; + else if (fabs(nbr_pj->dvec[1]) < SMALL && nbr_pj->dvec[0] > SMALL) + flag = 1; + } + } + } - /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - f_tmp = -(CEvd + CEclmb); - system->pair_ptr->ev_tally(i,j,natoms,1,e_vdW,e_ele, - f_tmp,delij[0],delij[1],delij[2]); - } + if (flag) { - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); - rvec_ScaledAdd( workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec ); - } else { // NPT, iNPT or sNPT - rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); + r_ij = nbr_pj->d; + tmin = MIN(type_i, type_j); + tmax = MAX(type_i, type_j); + t = &(LR[tmin][tmax]); - rvec_ScaledAdd( workspace->f[i], -1., temp ); - rvec_Add( workspace->f[j], temp ); - } + /* Cubic Spline Interpolation */ + r = (int)(r_ij * t->inv_dx); + if (r == 0) ++r; + base = (double)(r+1) * t->dx; + dif = r_ij - base; + + e_vdW = ((t->vdW[r].d*dif + t->vdW[r].c)*dif + t->vdW[r].b)*dif + + t->vdW[r].a; + + e_ele = ((t->ele[r].d*dif + t->ele[r].c)*dif + t->ele[r].b)*dif + + t->ele[r].a; + e_ele *= system->my_atoms[i].q * system->my_atoms[j].q; + + data->my_en.e_vdW += e_vdW; + data->my_en.e_ele += e_ele; + + CEvd = ((t->CEvd[r].d*dif + t->CEvd[r].c)*dif + t->CEvd[r].b)*dif + + t->CEvd[r].a; + + CEclmb = ((t->CEclmb[r].d*dif+t->CEclmb[r].c)*dif+t->CEclmb[r].b)*dif + + t->CEclmb[r].a; + CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; + + /* tally into per-atom energy */ + if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + f_tmp = -(CEvd + CEclmb); + system->pair_ptr->ev_tally(i,j,natoms,1,e_vdW,e_ele, + f_tmp,delij[0],delij[1],delij[2]); + } + + if (control->virial == 0) { + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); + } else { // NPT, iNPT or sNPT + rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); + + rvec_ScaledAdd(workspace->f[i], -1., temp); + rvec_Add(workspace->f[j], temp); + } + } } } + + Compute_Polarization_Energy(system, data); } - Compute_Polarization_Energy( system, data ); -} + void LR_vdW_Coulomb(reax_system *system, storage *workspace, + control_params *control, int i, int j, + double r_ij, LR_data *lr) + { + double p_vdW1 = system->reax_param.gp.l[28]; + double p_vdW1i = 1.0 / p_vdW1; + double powr_vdW1, powgi_vdW1; + double tmp, fn13, exp1, exp2; + double Tap, dTap, dfn13; + double dr3gamij_1, dr3gamij_3; + double e_core, de_core; + double e_lg, de_lg, r_ij5, r_ij6, re6; + two_body_parameters *twbp; + twbp = &(system->reax_param.tbp[i][j]); + e_core = 0; + de_core = 0; + e_lg = de_lg = 0.0; + /* calculate taper and its derivative */ + Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; + Tap = Tap * r_ij + workspace->Tap[5]; + Tap = Tap * r_ij + workspace->Tap[4]; + Tap = Tap * r_ij + workspace->Tap[3]; + Tap = Tap * r_ij + workspace->Tap[2]; + Tap = Tap * r_ij + workspace->Tap[1]; + Tap = Tap * r_ij + workspace->Tap[0]; -void Compute_Polarization_Energy( reax_system *system, simulation_data *data ) -{ - int i, type_i; - double q, en_tmp; + dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; + dTap = dTap * r_ij + 5*workspace->Tap[5]; + dTap = dTap * r_ij + 4*workspace->Tap[4]; + dTap = dTap * r_ij + 3*workspace->Tap[3]; + dTap = dTap * r_ij + 2*workspace->Tap[2]; + dTap += workspace->Tap[1]/r_ij; - data->my_en.e_pol = 0.0; - for (i = 0; i < system->n; i++) { - type_i = system->my_atoms[i].type; - if (type_i < 0) continue; - q = system->my_atoms[i].q; + /*vdWaals Calculations*/ + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + { // shielding + powr_vdW1 = pow(r_ij, p_vdW1); + powgi_vdW1 = pow(1.0 / twbp->gamma_w, p_vdW1); - en_tmp = KCALpMOL_to_EV * (system->reax_param.sbp[type_i].chi * q + - (system->reax_param.sbp[type_i].eta / 2.) * SQR(q)); - data->my_en.e_pol += en_tmp; + fn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i); + exp1 = exp(twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW)); - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(i,i,system->n,1,0.0,en_tmp,0.0,0.0,0.0,0.0); - } -} + lr->e_vdW = Tap * twbp->D * (exp1 - 2.0 * exp2); -void LR_vdW_Coulomb( reax_system *system, storage *workspace, - control_params *control, int i, int j, double r_ij, LR_data *lr ) -{ - double p_vdW1 = system->reax_param.gp.l[28]; - double p_vdW1i = 1.0 / p_vdW1; - double powr_vdW1, powgi_vdW1; - double tmp, fn13, exp1, exp2; - double Tap, dTap, dfn13; - double dr3gamij_1, dr3gamij_3; - double e_core, de_core; - double e_lg, de_lg, r_ij5, r_ij6, re6; - two_body_parameters *twbp; + dfn13 = pow(powr_vdW1 + powgi_vdW1, p_vdW1i-1.0) * pow(r_ij, p_vdW1-2.0); - twbp = &(system->reax_param.tbp[i][j]); - e_core = 0; - de_core = 0; - e_lg = de_lg = 0.0; - - /* calculate taper and its derivative */ - Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; - Tap = Tap * r_ij + workspace->Tap[5]; - Tap = Tap * r_ij + workspace->Tap[4]; - Tap = Tap * r_ij + workspace->Tap[3]; - Tap = Tap * r_ij + workspace->Tap[2]; - Tap = Tap * r_ij + workspace->Tap[1]; - Tap = Tap * r_ij + workspace->Tap[0]; - - dTap = 7*workspace->Tap[7] * r_ij + 6*workspace->Tap[6]; - dTap = dTap * r_ij + 5*workspace->Tap[5]; - dTap = dTap * r_ij + 4*workspace->Tap[4]; - dTap = dTap * r_ij + 3*workspace->Tap[3]; - dTap = dTap * r_ij + 2*workspace->Tap[2]; - dTap += workspace->Tap[1]/r_ij; - - /*vdWaals Calculations*/ - if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) - { // shielding - powr_vdW1 = pow(r_ij, p_vdW1); - powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); - - fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i ); - exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); + lr->CEvd = dTap * twbp->D * (exp1 - 2.0 * exp2) - + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; + } + else { // no shielding + exp1 = exp(twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); + exp2 = exp(0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW)); lr->e_vdW = Tap * twbp->D * (exp1 - 2.0 * exp2); - - dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i-1.0) * pow(r_ij, p_vdW1-2.0); - lr->CEvd = dTap * twbp->D * (exp1 - 2.0 * exp2) - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) * dfn13; + Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - else { // no shielding - exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); - lr->e_vdW = Tap * twbp->D * (exp1 - 2.0 * exp2); - lr->CEvd = dTap * twbp->D * (exp1 - 2.0 * exp2) - - Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; - } + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + { // inner wall + e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); + lr->e_vdW += Tap * e_core; - if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) - { // inner wall - e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); - lr->e_vdW += Tap * e_core; + de_core = -(twbp->acore/twbp->rcore) * e_core; + lr->CEvd += dTap * e_core + Tap * de_core / r_ij; - de_core = -(twbp->acore/twbp->rcore) * e_core; - lr->CEvd += dTap * e_core + Tap * de_core / r_ij; + // lg correction, only if lgvdw is yes + if (control->lgflag) { + r_ij5 = pow(r_ij, 5.0); + r_ij6 = pow(r_ij, 6.0); + re6 = pow(twbp->lgre, 6.0); + e_lg = -(twbp->lgcij/(r_ij6 + re6)); + lr->e_vdW += Tap * e_lg; - // lg correction, only if lgvdw is yes - if (control->lgflag) { - r_ij5 = pow( r_ij, 5.0 ); - r_ij6 = pow( r_ij, 6.0 ); - re6 = pow( twbp->lgre, 6.0 ); - e_lg = -(twbp->lgcij/( r_ij6 + re6 )); - lr->e_vdW += Tap * e_lg; + de_lg = -6.0 * e_lg * r_ij5 / (r_ij6 + re6) ; + lr->CEvd += dTap * e_lg + Tap * de_lg/r_ij; + } - de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ; - lr->CEvd += dTap * e_lg + Tap * de_lg/r_ij; } - } + /* Coulomb calculations */ + dr3gamij_1 = (r_ij * r_ij * r_ij + twbp->gamma); + dr3gamij_3 = pow(dr3gamij_1 , 0.33333333333333); - /* Coulomb calculations */ - dr3gamij_1 = ( r_ij * r_ij * r_ij + twbp->gamma ); - dr3gamij_3 = pow( dr3gamij_1 , 0.33333333333333 ); + tmp = Tap / dr3gamij_3; + lr->H = EV_to_KCALpMOL * tmp; + lr->e_ele = C_ele * tmp; - tmp = Tap / dr3gamij_3; - lr->H = EV_to_KCALpMOL * tmp; - lr->e_ele = C_ele * tmp; - - lr->CEclmb = C_ele * ( dTap - Tap * r_ij / dr3gamij_1 ) / dr3gamij_3; + lr->CEclmb = C_ele * (dTap - Tap * r_ij / dr3gamij_1) / dr3gamij_3; + } } + diff --git a/src/USER-REAXC/reaxc_nonbonded.h b/src/USER-REAXC/reaxc_nonbonded.h deleted file mode 100644 index 9a29d4d8c1..0000000000 --- a/src/USER-REAXC/reaxc_nonbonded.h +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __NONBONDED_H_ -#define __NONBONDED_H_ - -#include "reaxc_types.h" - -void vdW_Coulomb_Energy( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -void Tabulated_vdW_Coulomb_Energy( reax_system*, control_params*, - simulation_data*, storage*, - reax_list**, output_controls* ); - -void Compute_Polarization_Energy( reax_system*, simulation_data* ); - -void LR_vdW_Coulomb( reax_system*, storage*, control_params*, - int, int, double, LR_data* ); -#endif diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 5d3053fb37..a2276023a4 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -24,129 +24,124 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_reset_tools.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_tool_box.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" #include "error.h" #include #include -void Reset_Atoms( reax_system* system, control_params *control ) -{ - int i; - reax_atom *atom; +namespace ReaxFF { + + static void Reset_Atoms(reax_system* system, control_params *control) + { + int i; + reax_atom *atom; - system->numH = 0; - if (control->hbond_cut > 0) - for (i = 0; i < system->n; ++i) { - atom = &(system->my_atoms[i]); - if (atom->type < 0) continue; - if (system->reax_param.sbp[ atom->type ].p_hbond == 1) - atom->Hindex = system->numH++; - else atom->Hindex = -1; - } -} - - -void Reset_Energies( energy_data *en ) -{ - en->e_bond = 0; - en->e_ov = 0; - en->e_un = 0; - en->e_lp = 0; - en->e_ang = 0; - en->e_pen = 0; - en->e_coa = 0; - en->e_hb = 0; - en->e_tor = 0; - en->e_con = 0; - en->e_vdW = 0; - en->e_ele = 0; - en->e_pol = 0; -} - -void Reset_Simulation_Data( simulation_data* data, int /*virial*/ ) -{ - Reset_Energies( &data->my_en ); - Reset_Energies( &data->sys_en ); -} - -void Reset_Workspace( reax_system *system, storage *workspace ) -{ - memset( workspace->total_bond_order, 0, system->total_cap * sizeof( double ) ); - memset( workspace->dDeltap_self, 0, system->total_cap * sizeof( rvec ) ); - memset( workspace->CdDelta, 0, system->total_cap * sizeof( double ) ); - memset( workspace->f, 0, system->total_cap * sizeof( rvec ) ); - -} - -void Reset_Neighbor_Lists( reax_system *system, control_params *control, - storage *workspace, reax_list **lists ) -{ - int i, total_bonds, Hindex, total_hbonds; - reax_list *bonds, *hbonds; - - /* bonds list */ - if (system->N > 0) { - bonds = (*lists) + BONDS; - total_bonds = 0; - - /* reset start-end indexes */ - for (i = 0; i < system->N; ++i) { - Set_Start_Index( i, total_bonds, bonds ); - Set_End_Index( i, total_bonds, bonds ); - total_bonds += system->my_atoms[i].num_bonds; - } - - /* is reallocation needed? */ - if (total_bonds >= bonds->num_intrs * DANGER_ZONE) { - workspace->realloc.bonds = 1; - if (total_bonds >= bonds->num_intrs) - control->error_ptr->one(FLERR,fmt::format("Not enough space for bonds! " - "total={} allocated={}\n", - total_bonds, bonds->num_intrs)); - } + system->numH = 0; + if (control->hbond_cut > 0) + for (i = 0; i < system->n; ++i) { + atom = &(system->my_atoms[i]); + if (atom->type < 0) continue; + if (system->reax_param.sbp[ atom->type ].p_hbond == 1) + atom->Hindex = system->numH++; + else atom->Hindex = -1; + } } - if (control->hbond_cut > 0 && system->numH > 0) { - hbonds = (*lists) + HBONDS; - total_hbonds = 0; - /* reset start-end indexes */ - for (i = 0; i < system->n; ++i) { - Hindex = system->my_atoms[i].Hindex; - if (Hindex > -1) { - Set_Start_Index( Hindex, total_hbonds, hbonds ); - Set_End_Index( Hindex, total_hbonds, hbonds ); - total_hbonds += system->my_atoms[i].num_hbonds; + static void Reset_Energies(energy_data *en) + { + en->e_bond = 0; + en->e_ov = 0; + en->e_un = 0; + en->e_lp = 0; + en->e_ang = 0; + en->e_pen = 0; + en->e_coa = 0; + en->e_hb = 0; + en->e_tor = 0; + en->e_con = 0; + en->e_vdW = 0; + en->e_ele = 0; + en->e_pol = 0; + } + + void Reset_Simulation_Data(simulation_data* data) + { + Reset_Energies(&data->my_en); + Reset_Energies(&data->sys_en); + } + + void Reset_Workspace(reax_system *system, storage *workspace) + { + memset(workspace->total_bond_order, 0, system->total_cap * sizeof(double)); + memset(workspace->dDeltap_self, 0, system->total_cap * sizeof(rvec)); + memset(workspace->CdDelta, 0, system->total_cap * sizeof(double)); + memset(workspace->f, 0, system->total_cap * sizeof(rvec)); + + } + + static void Reset_Neighbor_Lists(reax_system *system, control_params *control, + storage *workspace, reax_list **lists) + { + int i, total_bonds, Hindex, total_hbonds; + reax_list *bonds, *hbonds; + + /* bonds list */ + if (system->N > 0) { + bonds = (*lists) + BONDS; + total_bonds = 0; + + /* reset start-end indexes */ + for (i = 0; i < system->N; ++i) { + Set_Start_Index(i, total_bonds, bonds); + Set_End_Index(i, total_bonds, bonds); + total_bonds += system->my_atoms[i].num_bonds; + } + + /* is reallocation needed? */ + if (total_bonds >= bonds->num_intrs * DANGER_ZONE) { + workspace->realloc.bonds = 1; + if (total_bonds >= bonds->num_intrs) + control->error_ptr->one(FLERR,fmt::format("Not enough space for bonds! " + "total={} allocated={}\n", + total_bonds, bonds->num_intrs)); } } - /* is reallocation needed? */ - if (total_hbonds >= hbonds->num_intrs * 0.90/*DANGER_ZONE*/) { - workspace->realloc.hbonds = 1; - if (total_hbonds >= hbonds->num_intrs) - control->error_ptr->one(FLERR,fmt::format("Not enough space for hbonds! " - "total={} allocated={}\n", - total_hbonds, hbonds->num_intrs)); + if (control->hbond_cut > 0 && system->numH > 0) { + hbonds = (*lists) + HBONDS; + total_hbonds = 0; + + /* reset start-end indexes */ + for (i = 0; i < system->n; ++i) { + Hindex = system->my_atoms[i].Hindex; + if (Hindex > -1) { + Set_Start_Index(Hindex, total_hbonds, hbonds); + Set_End_Index(Hindex, total_hbonds, hbonds); + total_hbonds += system->my_atoms[i].num_hbonds; + } + } + + /* is reallocation needed? */ + if (total_hbonds >= hbonds->num_intrs * 0.90/*DANGER_ZONE*/) { + workspace->realloc.hbonds = 1; + if (total_hbonds >= hbonds->num_intrs) + control->error_ptr->one(FLERR,fmt::format("Not enough space for hbonds! " + "total={} allocated={}\n", + total_hbonds, hbonds->num_intrs)); + } } } -} - - -void Reset( reax_system *system, control_params *control, simulation_data *data, - storage *workspace, reax_list **lists ) -{ - Reset_Atoms( system, control ); - - Reset_Simulation_Data( data, control->virial ); - - Reset_Workspace( system, workspace ); - - Reset_Neighbor_Lists( system, control, workspace, lists ); - + + + void Reset(reax_system *system, control_params *control, simulation_data *data, + storage *workspace, reax_list **lists) + { + Reset_Atoms(system, control); + Reset_Simulation_Data(data); + Reset_Workspace(system, workspace); + Reset_Neighbor_Lists(system, control, workspace, lists); + } } diff --git a/src/USER-REAXC/reaxc_reset_tools.h b/src/USER-REAXC/reaxc_reset_tools.h deleted file mode 100644 index 39cda0ac9b..0000000000 --- a/src/USER-REAXC/reaxc_reset_tools.h +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __RESET_TOOLS_H_ -#define __RESET_TOOLS_H_ - -#include "reaxc_types.h" - -void Reset_Pressures( simulation_data* ); -void Reset_Simulation_Data( simulation_data*, int ); -void Reset_Workspace( reax_system*, storage* ); -void Reset_Neighbor_Lists( reax_system*, control_params*, storage*, - reax_list** ); -void Reset( reax_system*, control_params*, simulation_data*, storage*, - reax_list** ); -#endif diff --git a/src/USER-REAXC/reaxc_system_props.cpp b/src/USER-REAXC/reaxc_system_props.cpp deleted file mode 100644 index de513e11de..0000000000 --- a/src/USER-REAXC/reaxc_system_props.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#include "reaxc_system_props.h" -#include -#include "reaxc_defs.h" - -void Compute_System_Energy( reax_system *system, simulation_data *data, - MPI_Comm comm ) -{ - double my_en[13], sys_en[13]; - - my_en[0] = data->my_en.e_bond; - my_en[1] = data->my_en.e_ov; - my_en[2] = data->my_en.e_un; - my_en[3] = data->my_en.e_lp; - my_en[4] = data->my_en.e_ang; - my_en[5] = data->my_en.e_pen; - my_en[6] = data->my_en.e_coa; - my_en[7] = data->my_en.e_hb; - my_en[8] = data->my_en.e_tor; - my_en[9] = data->my_en.e_con; - my_en[10] = data->my_en.e_vdW; - my_en[11] = data->my_en.e_ele; - my_en[12] = data->my_en.e_pol; - MPI_Reduce( my_en, sys_en, 13, MPI_DOUBLE, MPI_SUM, MASTER_NODE, comm ); - - if (system->my_rank == MASTER_NODE) { - data->sys_en.e_bond = sys_en[0]; - data->sys_en.e_ov = sys_en[1]; - data->sys_en.e_un = sys_en[2]; - data->sys_en.e_lp = sys_en[3]; - data->sys_en.e_ang = sys_en[4]; - data->sys_en.e_pen = sys_en[5]; - data->sys_en.e_coa = sys_en[6]; - data->sys_en.e_hb = sys_en[7]; - data->sys_en.e_tor = sys_en[8]; - data->sys_en.e_con = sys_en[9]; - data->sys_en.e_vdW = sys_en[10]; - data->sys_en.e_ele = sys_en[11]; - data->sys_en.e_pol = sys_en[12]; - } -} diff --git a/src/USER-REAXC/reaxc_system_props.h b/src/USER-REAXC/reaxc_system_props.h deleted file mode 100644 index 4d80e22966..0000000000 --- a/src/USER-REAXC/reaxc_system_props.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __SYSTEM_PROP_H_ -#define __SYSTEM_PROP_H_ - -#include "reaxc_types.h" -#include - -void Compute_System_Energy( reax_system*, simulation_data*, MPI_Comm ); - -#endif diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index abab3f2b43..ab8ba6317c 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -24,8 +24,7 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_tool_box.h" -#include "reaxc_defs.h" +#include "reaxff_api.h" #include #include @@ -33,93 +32,95 @@ #include "error.h" -int Tokenize( char* s, char*** tok ) -{ - char test[MAX_LINE]; - const char *sep = (const char *)"\t \n\r\f!="; - char *word; - int count=0; +namespace ReaxFF { + + int Tokenize(char* s, char*** tok) + { + char test[MAX_LINE]; + const char *sep = (const char *)"\t \n\r\f!="; + char *word; + int count=0; - strncpy( test, s, MAX_LINE-1); + strncpy(test, s, MAX_LINE-1); - for (word = strtok(test, sep); word; word = strtok(nullptr, sep)) { - strncpy( (*tok)[count], word, MAX_LINE ); - count++; + for (word = strtok(test, sep); word; word = strtok(nullptr, sep)) { + strncpy((*tok)[count], word, MAX_LINE); + count++; + } + + return count; } - return count; -} - /* safe malloc */ -void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) -{ - void *ptr; + void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name) + { + void *ptr; - if (n <= 0) { - auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. " - "returning NULL.", n, name); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); + if (n <= 0) { + auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. " + "returning NULL.", n, name); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); - return nullptr; + return nullptr; + } + + ptr = malloc(n); + if (ptr == nullptr) { + auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", + n, name); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); + } + + return ptr; } - ptr = malloc( n ); - if (ptr == nullptr) { - auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", - n, name); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); - } - - return ptr; -} - /* safe calloc */ -void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name ) -{ - void *ptr; + void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name) + { + void *ptr; - if (n <= 0) { - auto errmsg = fmt::format("Trying to allocate {} elements for array {}. " - "returning NULL.\n", n, name); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); - return nullptr; + if (n <= 0) { + auto errmsg = fmt::format("Trying to allocate {} elements for array {}. " + "returning NULL.\n", n, name); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); + return nullptr; + } + + if (size <= 0) { + auto errmsg = fmt::format("Elements size for array {} is {}. " + "returning NULL", name, size); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); + return nullptr; + } + + ptr = calloc(n, size); + if (ptr == nullptr) { + auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", + n*size, name); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); + } + + return ptr; } - if (size <= 0) { - auto errmsg = fmt::format("Elements size for array {} is {}. " - "returning NULL", name, size); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); - return nullptr; - } - ptr = calloc( n, size ); - if (ptr == nullptr) { - auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", - n*size, name); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); - } + /* safe free */ + void sfree(LAMMPS_NS::Error* error_ptr, void *ptr, const char *name) + { + if (ptr == nullptr) { + auto errmsg = fmt::format("Trying to free the already free()'d pointer {}", + name); + if (error_ptr) error_ptr->one(FLERR,errmsg); + else fputs(errmsg.c_str(),stderr); + return; + } - return ptr; + free(ptr); + ptr = nullptr; + } } - - -/* safe free */ -void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) -{ - if (ptr == nullptr) { - auto errmsg = fmt::format("Trying to free the already free()'d pointer {}", - name); - if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg.c_str(),stderr); - return; - } - - free(ptr); - ptr = nullptr; -} - diff --git a/src/USER-REAXC/reaxc_tool_box.h b/src/USER-REAXC/reaxc_tool_box.h deleted file mode 100644 index 773b4f3f3d..0000000000 --- a/src/USER-REAXC/reaxc_tool_box.h +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __TOOL_BOX_H_ -#define __TOOL_BOX_H_ - -#include "reaxc_types.h" -namespace LAMMPS_NS { class Error; } - -/* from io_tools.h */ -int Tokenize( char*, char*** ); - -/* from lammps */ -void *smalloc( LAMMPS_NS::Error*, rc_bigint, const char* ); -void *scalloc( LAMMPS_NS::Error*, rc_bigint, rc_bigint, const char* ); -void sfree( LAMMPS_NS::Error*, void*, const char* ); -#endif diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index 04e7bfcc1c..00019d5130 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -24,440 +24,435 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_torsion_angles.h" -#include +#include "reaxff_api.h" + #include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" + +#include #define MIN_SINE 1e-10 -double Calculate_Omega( rvec dvec_ij, double r_ij, - rvec dvec_jk, double r_jk, - rvec dvec_kl, double r_kl, - rvec dvec_li, double r_li, - three_body_interaction_data *p_ijk, - three_body_interaction_data *p_jkl, - rvec dcos_omega_di, rvec dcos_omega_dj, - rvec dcos_omega_dk, rvec dcos_omega_dl, - output_controls * /*out_control*/ ) -{ - double unnorm_cos_omega, unnorm_sin_omega, omega; - double sin_ijk, cos_ijk, sin_jkl, cos_jkl; - double htra, htrb, htrc, hthd, hthe, hnra, hnrc, hnhd, hnhe; - double arg, poem, tel; - rvec cross_jk_kl; +namespace ReaxFF { + double Calculate_Omega(rvec dvec_ij, double r_ij, rvec dvec_jk, double r_jk, + rvec dvec_kl, double r_kl, rvec dvec_li, double r_li, + three_body_interaction_data *p_ijk, + three_body_interaction_data *p_jkl, + rvec dcos_omega_di, rvec dcos_omega_dj, + rvec dcos_omega_dk, rvec dcos_omega_dl) + { + double unnorm_cos_omega, unnorm_sin_omega, omega; + double sin_ijk, cos_ijk, sin_jkl, cos_jkl; + double htra, htrb, htrc, hthd, hthe, hnra, hnrc, hnhd, hnhe; + double arg, poem, tel; + rvec cross_jk_kl; - sin_ijk = sin( p_ijk->theta ); - cos_ijk = cos( p_ijk->theta ); - sin_jkl = sin( p_jkl->theta ); - cos_jkl = cos( p_jkl->theta ); + sin_ijk = sin(p_ijk->theta); + cos_ijk = cos(p_ijk->theta); + sin_jkl = sin(p_jkl->theta); + cos_jkl = cos(p_jkl->theta); - /* omega */ - unnorm_cos_omega = -rvec_Dot(dvec_ij, dvec_jk) * rvec_Dot(dvec_jk, dvec_kl) + - SQR( r_jk ) * rvec_Dot( dvec_ij, dvec_kl ); + /* omega */ + unnorm_cos_omega = -rvec_Dot(dvec_ij, dvec_jk) * rvec_Dot(dvec_jk, dvec_kl) + + SQR(r_jk) * rvec_Dot(dvec_ij, dvec_kl); - rvec_Cross( cross_jk_kl, dvec_jk, dvec_kl ); - unnorm_sin_omega = -r_jk * rvec_Dot( dvec_ij, cross_jk_kl ); + rvec_Cross(cross_jk_kl, dvec_jk, dvec_kl); + unnorm_sin_omega = -r_jk * rvec_Dot(dvec_ij, cross_jk_kl); - omega = atan2( unnorm_sin_omega, unnorm_cos_omega ); + omega = atan2(unnorm_sin_omega, unnorm_cos_omega); - htra = r_ij + cos_ijk * ( r_kl * cos_jkl - r_jk ); - htrb = r_jk - r_ij * cos_ijk - r_kl * cos_jkl; - htrc = r_kl + cos_jkl * ( r_ij * cos_ijk - r_jk ); - hthd = r_ij * sin_ijk * ( r_jk - r_kl * cos_jkl ); - hthe = r_kl * sin_jkl * ( r_jk - r_ij * cos_ijk ); - hnra = r_kl * sin_ijk * sin_jkl; - hnrc = r_ij * sin_ijk * sin_jkl; - hnhd = r_ij * r_kl * cos_ijk * sin_jkl; - hnhe = r_ij * r_kl * sin_ijk * cos_jkl; + htra = r_ij + cos_ijk * (r_kl * cos_jkl - r_jk); + htrb = r_jk - r_ij * cos_ijk - r_kl * cos_jkl; + htrc = r_kl + cos_jkl * (r_ij * cos_ijk - r_jk); + hthd = r_ij * sin_ijk * (r_jk - r_kl * cos_jkl); + hthe = r_kl * sin_jkl * (r_jk - r_ij * cos_ijk); + hnra = r_kl * sin_ijk * sin_jkl; + hnrc = r_ij * sin_ijk * sin_jkl; + hnhd = r_ij * r_kl * cos_ijk * sin_jkl; + hnhe = r_ij * r_kl * sin_ijk * cos_jkl; - poem = 2.0 * r_ij * r_kl * sin_ijk * sin_jkl; - if (poem < 1e-20) poem = 1e-20; + poem = 2.0 * r_ij * r_kl * sin_ijk * sin_jkl; + if (poem < 1e-20) poem = 1e-20; - tel = SQR( r_ij ) + SQR( r_jk ) + SQR( r_kl ) - SQR( r_li ) - - 2.0 * ( r_ij * r_jk * cos_ijk - r_ij * r_kl * cos_ijk * cos_jkl + - r_jk * r_kl * cos_jkl ); + tel = SQR(r_ij) + SQR(r_jk) + SQR(r_kl) - SQR(r_li) - + 2.0 * (r_ij * r_jk * cos_ijk - r_ij * r_kl * cos_ijk * cos_jkl + + r_jk * r_kl * cos_jkl); - arg = tel / poem; - if (arg > 1.0) arg = 1.0; - if (arg < -1.0) arg = -1.0; + arg = tel / poem; + if (arg > 1.0) arg = 1.0; + if (arg < -1.0) arg = -1.0; - if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) sin_ijk = MIN_SINE; - else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) sin_ijk = -MIN_SINE; - if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) sin_jkl = MIN_SINE; - else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) sin_jkl = -MIN_SINE; + if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) sin_ijk = MIN_SINE; + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) sin_ijk = -MIN_SINE; + if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) sin_jkl = MIN_SINE; + else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) sin_jkl = -MIN_SINE; - // dcos_omega_di - rvec_ScaledSum( dcos_omega_di, (htra-arg*hnra)/r_ij, dvec_ij, -1., dvec_li ); - rvec_ScaledAdd( dcos_omega_di,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_dk ); - rvec_Scale( dcos_omega_di, 2.0 / poem, dcos_omega_di ); + // dcos_omega_di + rvec_ScaledSum(dcos_omega_di, (htra-arg*hnra)/r_ij, dvec_ij, -1., dvec_li); + rvec_ScaledAdd(dcos_omega_di,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_dk); + rvec_Scale(dcos_omega_di, 2.0 / poem, dcos_omega_di); - // dcos_omega_dj - rvec_ScaledSum( dcos_omega_dj,-(htra-arg*hnra)/r_ij, dvec_ij, - -htrb / r_jk, dvec_jk ); - rvec_ScaledAdd( dcos_omega_dj,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_dj ); - rvec_ScaledAdd( dcos_omega_dj,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_di ); - rvec_Scale( dcos_omega_dj, 2.0 / poem, dcos_omega_dj ); + // dcos_omega_dj + rvec_ScaledSum(dcos_omega_dj,-(htra-arg*hnra)/r_ij, dvec_ij, + -htrb / r_jk, dvec_jk); + rvec_ScaledAdd(dcos_omega_dj,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_dj); + rvec_ScaledAdd(dcos_omega_dj,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_di); + rvec_Scale(dcos_omega_dj, 2.0 / poem, dcos_omega_dj); - // dcos_omega_dk - rvec_ScaledSum( dcos_omega_dk,-(htrc-arg*hnrc)/r_kl, dvec_kl, - htrb / r_jk, dvec_jk ); - rvec_ScaledAdd( dcos_omega_dk,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_di ); - rvec_ScaledAdd( dcos_omega_dk,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_dj ); - rvec_Scale( dcos_omega_dk, 2.0 / poem, dcos_omega_dk ); + // dcos_omega_dk + rvec_ScaledSum(dcos_omega_dk,-(htrc-arg*hnrc)/r_kl, dvec_kl, + htrb / r_jk, dvec_jk); + rvec_ScaledAdd(dcos_omega_dk,-(hthd-arg*hnhd)/sin_ijk, p_ijk->dcos_di); + rvec_ScaledAdd(dcos_omega_dk,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_dj); + rvec_Scale(dcos_omega_dk, 2.0 / poem, dcos_omega_dk); - // dcos_omega_dl - rvec_ScaledSum( dcos_omega_dl, (htrc-arg*hnrc)/r_kl, dvec_kl, 1., dvec_li ); - rvec_ScaledAdd( dcos_omega_dl,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_dk ); - rvec_Scale( dcos_omega_dl, 2.0 / poem, dcos_omega_dl ); + // dcos_omega_dl + rvec_ScaledSum(dcos_omega_dl, (htrc-arg*hnrc)/r_kl, dvec_kl, 1., dvec_li); + rvec_ScaledAdd(dcos_omega_dl,-(hthe-arg*hnhe)/sin_jkl, p_jkl->dcos_dk); + rvec_Scale(dcos_omega_dl, 2.0 / poem, dcos_omega_dl); - return omega; -} - - - -void Torsion_Angles( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control ) -{ - int i, j, k, l, pi, pj, pk, pl, pij, plk, natoms; - int type_i, type_j, type_k, type_l; - int start_j, end_j; - int start_pj, end_pj, start_pk, end_pk; - int num_frb_intrs = 0; - - double Delta_j, Delta_k; - double r_ij, r_jk, r_kl, r_li; - double BOA_ij, BOA_jk, BOA_kl; - - double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl; - double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv; - double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl; - double fn10, f11_DjDk, dfn11, fn12; - double theta_ijk, theta_jkl; - double sin_ijk, sin_jkl; - double cos_ijk, cos_jkl; - double tan_ijk_i, tan_jkl_i; - double omega, cos_omega, cos2omega, cos3omega; - rvec dcos_omega_di, dcos_omega_dj, dcos_omega_dk, dcos_omega_dl; - double CV, cmn, CEtors1, CEtors2, CEtors3, CEtors4; - double CEtors5, CEtors6, CEtors7, CEtors8, CEtors9; - double Cconj, CEconj1, CEconj2, CEconj3; - double CEconj4, CEconj5, CEconj6; - double e_tor, e_con; - rvec dvec_li; - rvec force; - ivec rel_box_jl; - four_body_header *fbh; - four_body_parameters *fbp; - bond_data *pbond_ij, *pbond_jk, *pbond_kl; - bond_order_data *bo_ij, *bo_jk, *bo_kl; - three_body_interaction_data *p_ijk, *p_jkl; - double p_tor2 = system->reax_param.gp.l[23]; - double p_tor3 = system->reax_param.gp.l[24]; - double p_tor4 = system->reax_param.gp.l[25]; - double p_cot2 = system->reax_param.gp.l[27]; - reax_list *bonds = (*lists) + BONDS; - reax_list *thb_intrs = (*lists) + THREE_BODIES; - - // Virial tallying variables - double delil[3], deljl[3], delkl[3]; - double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; - - natoms = system->n; - - for (j = 0; j < natoms; ++j) { - type_j = system->my_atoms[j].type; - Delta_j = workspace->Delta_boc[j]; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); - - for (pk = start_j; pk < end_j; ++pk) { - pbond_jk = &( bonds->select.bond_list[pk] ); - k = pbond_jk->nbr; - bo_jk = &( pbond_jk->bo_data ); - BOA_jk = bo_jk->BO - control->thb_cut; - - if (system->my_atoms[j].orig_id > system->my_atoms[k].orig_id) - continue; - if (system->my_atoms[j].orig_id == system->my_atoms[k].orig_id) { - if (system->my_atoms[k].x[2] < system->my_atoms[j].x[2]) continue; - if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && - system->my_atoms[k].x[1] < system->my_atoms[j].x[1]) continue; - if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && - system->my_atoms[k].x[1] == system->my_atoms[j].x[1] && - system->my_atoms[k].x[0] < system->my_atoms[j].x[0]) continue; - } - - if (bo_jk->BO > control->thb_cut/*0*/ && Num_Entries(pk, thb_intrs)) { - pj = pbond_jk->sym_index; // pj points to j on k's list - - if (Num_Entries(pj, thb_intrs)) { - type_k = system->my_atoms[k].type; - Delta_k = workspace->Delta_boc[k]; - r_jk = pbond_jk->d; - - start_pk = Start_Index(pk, thb_intrs ); - end_pk = End_Index(pk, thb_intrs ); - start_pj = Start_Index(pj, thb_intrs ); - end_pj = End_Index(pj, thb_intrs ); - - exp_tor2_jk = exp( -p_tor2 * BOA_jk ); - exp_cot2_jk = exp( -p_cot2 * SQR(BOA_jk - 1.5) ); - exp_tor3_DjDk = exp( -p_tor3 * (Delta_j + Delta_k) ); - exp_tor4_DjDk = exp( p_tor4 * (Delta_j + Delta_k) ); - exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); - f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; - - for (pi = start_pk; pi < end_pk; ++pi) { - p_ijk = &( thb_intrs->select.three_body_list[pi] ); - pij = p_ijk->pthb; // pij is pointer to i on j's bond_list - pbond_ij = &( bonds->select.bond_list[pij] ); - bo_ij = &( pbond_ij->bo_data ); - - if (bo_ij->BO > control->thb_cut/*0*/) { - i = p_ijk->thb; - type_i = system->my_atoms[i].type; - r_ij = pbond_ij->d; - BOA_ij = bo_ij->BO - control->thb_cut; - - theta_ijk = p_ijk->theta; - sin_ijk = sin( theta_ijk ); - cos_ijk = cos( theta_ijk ); - //tan_ijk_i = 1. / tan( theta_ijk ); - if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) - tan_ijk_i = cos_ijk / MIN_SINE; - else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) - tan_ijk_i = cos_ijk / -MIN_SINE; - else tan_ijk_i = cos_ijk / sin_ijk; - - exp_tor2_ij = exp( -p_tor2 * BOA_ij ); - exp_cot2_ij = exp( -p_cot2 * SQR(BOA_ij -1.5) ); - - for (pl = start_pj; pl < end_pj; ++pl) { - p_jkl = &( thb_intrs->select.three_body_list[pl] ); - l = p_jkl->thb; - plk = p_jkl->pthb; //pointer to l on k's bond_list! - pbond_kl = &( bonds->select.bond_list[plk] ); - bo_kl = &( pbond_kl->bo_data ); - type_l = system->my_atoms[l].type; - fbh = &(system->reax_param.fbp[type_i][type_j] - [type_k][type_l]); - fbp = &(system->reax_param.fbp[type_i][type_j] - [type_k][type_l].prm[0]); - - if ( i != l && fbh->cnt && - bo_kl->BO > control->thb_cut/*0*/ && - bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { - ++num_frb_intrs; - r_kl = pbond_kl->d; - BOA_kl = bo_kl->BO - control->thb_cut; - - theta_jkl = p_jkl->theta; - sin_jkl = sin( theta_jkl ); - cos_jkl = cos( theta_jkl ); - //tan_jkl_i = 1. / tan( theta_jkl ); - if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) - tan_jkl_i = cos_jkl / MIN_SINE; - else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) - tan_jkl_i = cos_jkl / -MIN_SINE; - else tan_jkl_i = cos_jkl /sin_jkl; - - rvec_ScaledSum( dvec_li, 1., system->my_atoms[i].x, - -1., system->my_atoms[l].x ); - r_li = rvec_Norm( dvec_li ); - - - /* omega and its derivative */ - omega = Calculate_Omega( pbond_ij->dvec, r_ij, - pbond_jk->dvec, r_jk, - pbond_kl->dvec, r_kl, - dvec_li, r_li, - p_ijk, p_jkl, - dcos_omega_di, dcos_omega_dj, - dcos_omega_dk, dcos_omega_dl, - out_control ); - - cos_omega = cos( omega ); - cos2omega = cos( 2. * omega ); - cos3omega = cos( 3. * omega ); - /* end omega calculations */ - - /* torsion energy */ - exp_tor1 = exp( fbp->p_tor1 * - SQR(2.0 - bo_jk->BO_pi - f11_DjDk) ); - exp_tor2_kl = exp( -p_tor2 * BOA_kl ); - exp_cot2_kl = exp( -p_cot2 * SQR(BOA_kl - 1.5) ); - fn10 = (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * - (1.0 - exp_tor2_kl); - - CV = 0.5 * ( fbp->V1 * (1.0 + cos_omega) + - fbp->V2 * exp_tor1 * (1.0 - cos2omega) + - fbp->V3 * (1.0 + cos3omega) ); - - data->my_en.e_tor += e_tor = fn10 * sin_ijk * sin_jkl * CV; - - dfn11 = (-p_tor3 * exp_tor3_DjDk + - (p_tor3 * exp_tor3_DjDk - p_tor4 * exp_tor4_DjDk) * - (2.0 + exp_tor3_DjDk) * exp_tor34_inv) * - exp_tor34_inv; - - CEtors1 = sin_ijk * sin_jkl * CV; - - CEtors2 = -fn10 * 2.0 * fbp->p_tor1 * fbp->V2 * exp_tor1 * - (2.0 - bo_jk->BO_pi - f11_DjDk) * (1.0 - SQR(cos_omega)) * - sin_ijk * sin_jkl; - CEtors3 = CEtors2 * dfn11; - - CEtors4 = CEtors1 * p_tor2 * exp_tor2_ij * - (1.0 - exp_tor2_jk) * (1.0 - exp_tor2_kl); - CEtors5 = CEtors1 * p_tor2 * - (1.0 - exp_tor2_ij) * exp_tor2_jk * (1.0 - exp_tor2_kl); - CEtors6 = CEtors1 * p_tor2 * - (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * exp_tor2_kl; - - cmn = -fn10 * CV; - CEtors7 = cmn * sin_jkl * tan_ijk_i; - CEtors8 = cmn * sin_ijk * tan_jkl_i; - - CEtors9 = fn10 * sin_ijk * sin_jkl * - (0.5 * fbp->V1 - 2.0 * fbp->V2 * exp_tor1 * cos_omega + - 1.5 * fbp->V3 * (cos2omega + 2.0 * SQR(cos_omega))); - /* end of torsion energy */ - - /* 4-body conjugation energy */ - fn12 = exp_cot2_ij * exp_cot2_jk * exp_cot2_kl; - data->my_en.e_con += e_con = - fbp->p_cot1 * fn12 * - (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); - - Cconj = -2.0 * fn12 * fbp->p_cot1 * p_cot2 * - (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); - - CEconj1 = Cconj * (BOA_ij - 1.5e0); - CEconj2 = Cconj * (BOA_jk - 1.5e0); - CEconj3 = Cconj * (BOA_kl - 1.5e0); - - CEconj4 = -fbp->p_cot1 * fn12 * - (SQR(cos_omega) - 1.0) * sin_jkl * tan_ijk_i; - CEconj5 = -fbp->p_cot1 * fn12 * - (SQR(cos_omega) - 1.0) * sin_ijk * tan_jkl_i; - CEconj6 = 2.0 * fbp->p_cot1 * fn12 * - cos_omega * sin_ijk * sin_jkl; - /* end 4-body conjugation energy */ - - /* forces */ - bo_jk->Cdbopi += CEtors2; - workspace->CdDelta[j] += CEtors3; - workspace->CdDelta[k] += CEtors3; - bo_ij->Cdbo += (CEtors4 + CEconj1); - bo_jk->Cdbo += (CEtors5 + CEconj2); - bo_kl->Cdbo += (CEtors6 + CEconj3); - - if (control->virial == 0) { - /* dcos_theta_ijk */ - rvec_ScaledAdd( workspace->f[i], - CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_ScaledAdd( workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj ); - rvec_ScaledAdd( workspace->f[k], - CEtors7 + CEconj4, p_ijk->dcos_di ); - - /* dcos_theta_jkl */ - rvec_ScaledAdd( workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di ); - rvec_ScaledAdd( workspace->f[k], - CEtors8 + CEconj5, p_jkl->dcos_dj ); - rvec_ScaledAdd( workspace->f[l], - CEtors8 + CEconj5, p_jkl->dcos_dk ); - - /* dcos_omega */ - rvec_ScaledAdd( workspace->f[i], - CEtors9 + CEconj6, dcos_omega_di ); - rvec_ScaledAdd( workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj ); - rvec_ScaledAdd( workspace->f[k], - CEtors9 + CEconj6, dcos_omega_dk ); - rvec_ScaledAdd( workspace->f[l], - CEtors9 + CEconj6, dcos_omega_dl ); - } - else { - ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); - - /* dcos_theta_ijk */ - rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_Add( workspace->f[i], force ); - - rvec_ScaledAdd( workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj ); - - rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di ); - rvec_Add( workspace->f[k], force ); - - /* dcos_theta_jkl */ - rvec_ScaledAdd( workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di ); - - rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj ); - rvec_Add( workspace->f[k], force ); - - rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk ); - rvec_Add( workspace->f[l], force ); - - - /* dcos_omega */ - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di ); - rvec_Add( workspace->f[i], force ); - - rvec_ScaledAdd( workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj ); - - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dk ); - rvec_Add( workspace->f[k], force ); - - rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_dl ); - rvec_Add( workspace->f[l], force ); - } - - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - - // acquire vectors - rvec_ScaledSum( delil, 1., system->my_atoms[l].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( deljl, 1., system->my_atoms[l].x, - -1., system->my_atoms[j].x ); - rvec_ScaledSum( delkl, 1., system->my_atoms[l].x, - -1., system->my_atoms[k].x ); - // dcos_theta_ijk - rvec_Scale( fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk ); - rvec_Scale( fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj ); - rvec_Scale( fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di ); - - // dcos_theta_jkl - rvec_ScaledAdd( fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di ); - rvec_ScaledAdd( fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj ); - - // dcos_omega - rvec_ScaledAdd( fi_tmp, CEtors9 + CEconj6, dcos_omega_di ); - rvec_ScaledAdd( fj_tmp, CEtors9 + CEconj6, dcos_omega_dj ); - rvec_ScaledAdd( fk_tmp, CEtors9 + CEconj6, dcos_omega_dk ); - - // tally - eng_tmp = e_tor + e_con; - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(j,k,natoms,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); - if (system->pair_ptr->vflag_atom) - system->pair_ptr->v_tally4(i,j,k,l,fi_tmp,fj_tmp,fk_tmp,delil,deljl,delkl); - } - } // pl check ends - } // pl loop ends - } // pi check ends - } // pi loop ends - } // k-j neighbor check ends - } // j-k neighbor check ends - } // pk loop ends - } // j loop + return omega; + } + + void Torsion_Angles(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int i, j, k, l, pi, pj, pk, pl, pij, plk, natoms; + int type_i, type_j, type_k, type_l; + int start_j, end_j; + int start_pj, end_pj, start_pk, end_pk; + int num_frb_intrs = 0; + + double Delta_j, Delta_k; + double r_ij, r_jk, r_kl, r_li; + double BOA_ij, BOA_jk, BOA_kl; + + double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl; + double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv; + double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl; + double fn10, f11_DjDk, dfn11, fn12; + double theta_ijk, theta_jkl; + double sin_ijk, sin_jkl; + double cos_ijk, cos_jkl; + double tan_ijk_i, tan_jkl_i; + double omega, cos_omega, cos2omega, cos3omega; + rvec dcos_omega_di, dcos_omega_dj, dcos_omega_dk, dcos_omega_dl; + double CV, cmn, CEtors1, CEtors2, CEtors3, CEtors4; + double CEtors5, CEtors6, CEtors7, CEtors8, CEtors9; + double Cconj, CEconj1, CEconj2, CEconj3; + double CEconj4, CEconj5, CEconj6; + double e_tor, e_con; + rvec dvec_li; + rvec force; + ivec rel_box_jl; + four_body_header *fbh; + four_body_parameters *fbp; + bond_data *pbond_ij, *pbond_jk, *pbond_kl; + bond_order_data *bo_ij, *bo_jk, *bo_kl; + three_body_interaction_data *p_ijk, *p_jkl; + double p_tor2 = system->reax_param.gp.l[23]; + double p_tor3 = system->reax_param.gp.l[24]; + double p_tor4 = system->reax_param.gp.l[25]; + double p_cot2 = system->reax_param.gp.l[27]; + reax_list *bonds = (*lists) + BONDS; + reax_list *thb_intrs = (*lists) + THREE_BODIES; + + // Virial tallying variables + double delil[3], deljl[3], delkl[3]; + double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; + + natoms = system->n; + + for (j = 0; j < natoms; ++j) { + type_j = system->my_atoms[j].type; + Delta_j = workspace->Delta_boc[j]; + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); + + for (pk = start_j; pk < end_j; ++pk) { + pbond_jk = &(bonds->select.bond_list[pk]); + k = pbond_jk->nbr; + bo_jk = &(pbond_jk->bo_data); + BOA_jk = bo_jk->BO - control->thb_cut; + + if (system->my_atoms[j].orig_id > system->my_atoms[k].orig_id) + continue; + if (system->my_atoms[j].orig_id == system->my_atoms[k].orig_id) { + if (system->my_atoms[k].x[2] < system->my_atoms[j].x[2]) continue; + if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && + system->my_atoms[k].x[1] < system->my_atoms[j].x[1]) continue; + if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && + system->my_atoms[k].x[1] == system->my_atoms[j].x[1] && + system->my_atoms[k].x[0] < system->my_atoms[j].x[0]) continue; + } + + if (bo_jk->BO > control->thb_cut/*0*/ && Num_Entries(pk, thb_intrs)) { + pj = pbond_jk->sym_index; // pj points to j on k's list + + if (Num_Entries(pj, thb_intrs)) { + type_k = system->my_atoms[k].type; + Delta_k = workspace->Delta_boc[k]; + r_jk = pbond_jk->d; + + start_pk = Start_Index(pk, thb_intrs); + end_pk = End_Index(pk, thb_intrs); + start_pj = Start_Index(pj, thb_intrs); + end_pj = End_Index(pj, thb_intrs); + + exp_tor2_jk = exp(-p_tor2 * BOA_jk); + exp_cot2_jk = exp(-p_cot2 * SQR(BOA_jk - 1.5)); + exp_tor3_DjDk = exp(-p_tor3 * (Delta_j + Delta_k)); + exp_tor4_DjDk = exp(p_tor4 * (Delta_j + Delta_k)); + exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); + f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; + + for (pi = start_pk; pi < end_pk; ++pi) { + p_ijk = &(thb_intrs->select.three_body_list[pi]); + pij = p_ijk->pthb; // pij is pointer to i on j's bond_list + pbond_ij = &(bonds->select.bond_list[pij]); + bo_ij = &(pbond_ij->bo_data); + + if (bo_ij->BO > control->thb_cut/*0*/) { + i = p_ijk->thb; + type_i = system->my_atoms[i].type; + r_ij = pbond_ij->d; + BOA_ij = bo_ij->BO - control->thb_cut; + + theta_ijk = p_ijk->theta; + sin_ijk = sin(theta_ijk); + cos_ijk = cos(theta_ijk); + //tan_ijk_i = 1. / tan(theta_ijk); + if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) + tan_ijk_i = cos_ijk / MIN_SINE; + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) + tan_ijk_i = cos_ijk / -MIN_SINE; + else tan_ijk_i = cos_ijk / sin_ijk; + + exp_tor2_ij = exp(-p_tor2 * BOA_ij); + exp_cot2_ij = exp(-p_cot2 * SQR(BOA_ij -1.5)); + + for (pl = start_pj; pl < end_pj; ++pl) { + p_jkl = &(thb_intrs->select.three_body_list[pl]); + l = p_jkl->thb; + plk = p_jkl->pthb; //pointer to l on k's bond_list! + pbond_kl = &(bonds->select.bond_list[plk]); + bo_kl = &(pbond_kl->bo_data); + type_l = system->my_atoms[l].type; + fbh = &(system->reax_param.fbp[type_i][type_j] + [type_k][type_l]); + fbp = &(system->reax_param.fbp[type_i][type_j] + [type_k][type_l].prm[0]); + + if (i != l && fbh->cnt && + bo_kl->BO > control->thb_cut/*0*/ && + bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { + ++num_frb_intrs; + r_kl = pbond_kl->d; + BOA_kl = bo_kl->BO - control->thb_cut; + + theta_jkl = p_jkl->theta; + sin_jkl = sin(theta_jkl); + cos_jkl = cos(theta_jkl); + //tan_jkl_i = 1. / tan(theta_jkl); + if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) + tan_jkl_i = cos_jkl / MIN_SINE; + else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) + tan_jkl_i = cos_jkl / -MIN_SINE; + else tan_jkl_i = cos_jkl /sin_jkl; + + rvec_ScaledSum(dvec_li, 1., system->my_atoms[i].x, + -1., system->my_atoms[l].x); + r_li = rvec_Norm(dvec_li); + + + /* omega and its derivative */ + omega = Calculate_Omega(pbond_ij->dvec, r_ij, + pbond_jk->dvec, r_jk, + pbond_kl->dvec, r_kl, + dvec_li, r_li, + p_ijk, p_jkl, + dcos_omega_di, dcos_omega_dj, + dcos_omega_dk, dcos_omega_dl); + + cos_omega = cos(omega); + cos2omega = cos(2. * omega); + cos3omega = cos(3. * omega); + /* end omega calculations */ + + /* torsion energy */ + exp_tor1 = exp(fbp->p_tor1 * + SQR(2.0 - bo_jk->BO_pi - f11_DjDk)); + exp_tor2_kl = exp(-p_tor2 * BOA_kl); + exp_cot2_kl = exp(-p_cot2 * SQR(BOA_kl - 1.5)); + fn10 = (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * + (1.0 - exp_tor2_kl); + + CV = 0.5 * (fbp->V1 * (1.0 + cos_omega) + + fbp->V2 * exp_tor1 * (1.0 - cos2omega) + + fbp->V3 * (1.0 + cos3omega)); + + data->my_en.e_tor += e_tor = fn10 * sin_ijk * sin_jkl * CV; + + dfn11 = (-p_tor3 * exp_tor3_DjDk + + (p_tor3 * exp_tor3_DjDk - p_tor4 * exp_tor4_DjDk) * + (2.0 + exp_tor3_DjDk) * exp_tor34_inv) * + exp_tor34_inv; + + CEtors1 = sin_ijk * sin_jkl * CV; + + CEtors2 = -fn10 * 2.0 * fbp->p_tor1 * fbp->V2 * exp_tor1 * + (2.0 - bo_jk->BO_pi - f11_DjDk) * (1.0 - SQR(cos_omega)) * + sin_ijk * sin_jkl; + CEtors3 = CEtors2 * dfn11; + + CEtors4 = CEtors1 * p_tor2 * exp_tor2_ij * + (1.0 - exp_tor2_jk) * (1.0 - exp_tor2_kl); + CEtors5 = CEtors1 * p_tor2 * + (1.0 - exp_tor2_ij) * exp_tor2_jk * (1.0 - exp_tor2_kl); + CEtors6 = CEtors1 * p_tor2 * + (1.0 - exp_tor2_ij) * (1.0 - exp_tor2_jk) * exp_tor2_kl; + + cmn = -fn10 * CV; + CEtors7 = cmn * sin_jkl * tan_ijk_i; + CEtors8 = cmn * sin_ijk * tan_jkl_i; + + CEtors9 = fn10 * sin_ijk * sin_jkl * + (0.5 * fbp->V1 - 2.0 * fbp->V2 * exp_tor1 * cos_omega + + 1.5 * fbp->V3 * (cos2omega + 2.0 * SQR(cos_omega))); + /* end of torsion energy */ + + /* 4-body conjugation energy */ + fn12 = exp_cot2_ij * exp_cot2_jk * exp_cot2_kl; + data->my_en.e_con += e_con = + fbp->p_cot1 * fn12 * + (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); + + Cconj = -2.0 * fn12 * fbp->p_cot1 * p_cot2 * + (1.0 + (SQR(cos_omega) - 1.0) * sin_ijk * sin_jkl); + + CEconj1 = Cconj * (BOA_ij - 1.5e0); + CEconj2 = Cconj * (BOA_jk - 1.5e0); + CEconj3 = Cconj * (BOA_kl - 1.5e0); + + CEconj4 = -fbp->p_cot1 * fn12 * + (SQR(cos_omega) - 1.0) * sin_jkl * tan_ijk_i; + CEconj5 = -fbp->p_cot1 * fn12 * + (SQR(cos_omega) - 1.0) * sin_ijk * tan_jkl_i; + CEconj6 = 2.0 * fbp->p_cot1 * fn12 * + cos_omega * sin_ijk * sin_jkl; + /* end 4-body conjugation energy */ + + /* forces */ + bo_jk->Cdbopi += CEtors2; + workspace->CdDelta[j] += CEtors3; + workspace->CdDelta[k] += CEtors3; + bo_ij->Cdbo += (CEtors4 + CEconj1); + bo_jk->Cdbo += (CEtors5 + CEconj2); + bo_kl->Cdbo += (CEtors6 + CEconj3); + + if (control->virial == 0) { + /* dcos_theta_ijk */ + rvec_ScaledAdd(workspace->f[i], + CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_ScaledAdd(workspace->f[j], + CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->f[k], + CEtors7 + CEconj4, p_ijk->dcos_di); + + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], + CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(workspace->f[k], + CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_ScaledAdd(workspace->f[l], + CEtors8 + CEconj5, p_jkl->dcos_dk); + + /* dcos_omega */ + rvec_ScaledAdd(workspace->f[i], + CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(workspace->f[j], + CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(workspace->f[k], + CEtors9 + CEconj6, dcos_omega_dk); + rvec_ScaledAdd(workspace->f[l], + CEtors9 + CEconj6, dcos_omega_dl); + } + else { + ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); + + /* dcos_theta_ijk */ + rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_Add(workspace->f[i], force); + + rvec_ScaledAdd(workspace->f[j], + CEtors7 + CEconj4, p_ijk->dcos_dj); + + rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_di); + rvec_Add(workspace->f[k], force); + + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], + CEtors8 + CEconj5, p_jkl->dcos_di); + + rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_Add(workspace->f[k], force); + + rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dk); + rvec_Add(workspace->f[l], force); + + + /* dcos_omega */ + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_di); + rvec_Add(workspace->f[i], force); + + rvec_ScaledAdd(workspace->f[j], + CEtors9 + CEconj6, dcos_omega_dj); + + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dk); + rvec_Add(workspace->f[k], force); + + rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dl); + rvec_Add(workspace->f[l], force); + } + + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + + // acquire vectors + rvec_ScaledSum(delil, 1., system->my_atoms[l].x, + -1., system->my_atoms[i].x); + rvec_ScaledSum(deljl, 1., system->my_atoms[l].x, + -1., system->my_atoms[j].x); + rvec_ScaledSum(delkl, 1., system->my_atoms[l].x, + -1., system->my_atoms[k].x); + // dcos_theta_ijk + rvec_Scale(fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_Scale(fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_Scale(fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di); + + // dcos_theta_jkl + rvec_ScaledAdd(fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj); + + // dcos_omega + rvec_ScaledAdd(fi_tmp, CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(fj_tmp, CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(fk_tmp, CEtors9 + CEconj6, dcos_omega_dk); + + // tally + eng_tmp = e_tor + e_con; + if (system->pair_ptr->evflag) + system->pair_ptr->ev_tally(j,k,natoms,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); + if (system->pair_ptr->vflag_atom) + system->pair_ptr->v_tally4(i,j,k,l,fi_tmp,fj_tmp,fk_tmp,delil,deljl,delkl); + } + } // pl check ends + } // pl loop ends + } // pi check ends + } // pi loop ends + } // k-j neighbor check ends + } // j-k neighbor check ends + } // pk loop ends + } // j loop + } } diff --git a/src/USER-REAXC/reaxc_torsion_angles.h b/src/USER-REAXC/reaxc_torsion_angles.h deleted file mode 100644 index 755e8c6532..0000000000 --- a/src/USER-REAXC/reaxc_torsion_angles.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __TORSION_ANGLES_H_ -#define __TORSION_ANGLES_H_ - -#include "reaxc_types.h" - -void Torsion_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -#endif diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index a4678d52c5..f134713936 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -24,16 +24,11 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_traj.h" +#include "reaxff_api.h" -#include #include -#include #include -#include "reaxc_defs.h" -#include "reaxc_list.h" - #include "error.h" #define MAX_TRJ_LINE_LEN 120 @@ -52,519 +47,523 @@ #define BOND_FULL_LEN 69 #define ANGLE_BASIC_LEN 38 -enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; -enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; -enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; +namespace ReaxFF { + + enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; + enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; + enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; -std::string fmtline(const char *key, double val) -{ - return fmt::format("{:<37}{:<24.3f}\n",key,val); -} -std::string fmtline(const char *key, double val1, double val2, double val3) -{ - return fmt::format("{:<32}{:>9.3f},{:>9.3f},{:>9.3f}\n",key,val1,val2,val3); -} - -template -std::string fmtline(const char *key, T val) -{ - return fmt::format("{:<37}{:<24}\n",key,val); -} - -template -std::string fmtline(const char *key, T val1, T val2) -{ - return fmt::format("{:<36}{:<12},{:<12}\n",key,val1,val2); -} - -void Reallocate_Output_Buffer(LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space) -{ - if (out_control->buffer_len > 0) - free(out_control->buffer); - - out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); - out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (!out_control->buffer) - error_ptr->one(FLERR,fmt::format("Insufficient memory for required buffer " - "size {}", (req_space*REAX_SAFE_ZONE))); -} - -void Write_Skip_Line(output_controls *out_control, int my_rank, int skip, int num_section) -{ - if (my_rank == MASTER_NODE) - fmt::print(out_control->strj,fmtline("chars_to_skip_section:",skip,num_section)); -} - -void Write_Header(reax_system *system, control_params *control, output_controls *out_control) -{ - char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", - "xyz_q", - "xyz_q_fxfyfz", - "xyz_q_vxvyvz", - "detailed_atom_info" }; - char bond_formats[3][30] = { "none", - "basic_bond_info", - "detailed_bond_info" }; - char angle_formats[2][30] = { "none", "basic_angle_info" }; - - /* only the master node writes into trajectory header */ - if (system->my_rank == MASTER_NODE) { - std::string buffer(""); - - /* to skip the header */ - buffer += fmtline("chars_to_skip_header:",(NUM_HEADER_LINES-1) * HEADER_LINE_LEN); - - /* general simulation info */ - buffer += fmtline("simulation_name:", out_control->traj_title); - buffer += fmtline("number_of_atoms:", system->bigN); - buffer += fmtline("ensemble_type:", "(unknown)"); - buffer += fmtline("number_of_steps:", 0); - buffer += fmtline("timestep_length_(in_fs):", 0.0); - - /* restart info */ - buffer += fmtline("is_this_a_restart?:", "no"); - buffer += fmtline("write_restart_files?:", "no"); - buffer += fmtline("frequency_to_write_restarts:", 0); - - /* preferences */ - buffer += fmtline("tabulate_long_range_intrs?:",(control->tabulate ? "yes" : "no")); - buffer += fmtline("table_size:", control->tabulate); - buffer += fmtline("restrict_bonds?:", "no"); - buffer += fmtline("bond_restriction_length:", 0); - buffer += fmtline("reposition_atoms?:", "fit to periodic box"); - buffer += fmtline("remove_CoM_velocity?:", 0); - buffer += fmtline("bonded_intr_dist_cutoff:",control->bond_cut); - buffer += fmtline("nonbonded_intr_dist_cutoff:",control->nonb_cut); - buffer += fmtline("hbond_dist_cutoff:",control->hbond_cut); - buffer += fmtline("reax_bond_threshold:",control->bo_cut); - buffer += fmtline("physical_bond_threshold:", control->bg_cut); - buffer += fmtline("valence_angle_threshold:",control->thb_cut); - buffer += fmtline("QEq_tolerance:", 0.0); - - /* temperature controls */ - buffer += fmtline("initial_temperature:", 0.0); - buffer += fmtline("target_temperature:", 0.0); - buffer += fmtline("thermal_inertia:", 0.0); - buffer += fmtline("temperature_regime:", "(unknown)"); - buffer += fmtline("temperature_change_rate_(K/ps):", 0.0); - - /* pressure controls */ - buffer += fmtline("target_pressure_(GPa):", 0.0, 0.0, 0.0); - buffer += fmtline("virial_inertia:", 0.0, 0.0, 0.0); - - /* trajectory */ - buffer += fmtline("energy_dumping_freq:", out_control->energy_update_freq); - buffer += fmtline("trajectory_dumping_freq:",out_control->write_steps); - buffer += fmtline("compress_trajectory_output?:", "no"); - buffer += fmtline("trajectory_format:", "regular"); - buffer += fmtline("atom_info:", atom_formats[out_control->atom_info]); - buffer += fmtline("bond_info:", bond_formats[out_control->bond_info]); - buffer += fmtline("angle_info:", angle_formats[out_control->angle_info]); - - /* analysis */ - buffer += fmtline("molecular_analysis:", "no"); - buffer += fmtline("molecular_analysis_frequency:", 0); - - /* dump out the buffer */ - - fputs(buffer.c_str(),out_control->strj); - } -} - -void Write_Init_Desc(reax_system *system, output_controls *out_control, MPI_Comm world) -{ - int i, me, np, cnt, buffer_len, buffer_req; - reax_atom *p_atom; - MPI_Status status; - - me = system->my_rank; - np = system->wsize; - - /* skip info */ - Write_Skip_Line(out_control, me, system->bigN*INIT_DESC_LEN, system->bigN); - - if (me == MASTER_NODE) - buffer_req = system->bigN * INIT_DESC_LEN + 1; - else buffer_req = system->n * INIT_DESC_LEN + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - out_control->buffer[0] = 0; - for (i = 0; i < system->n; ++i) { - p_atom = &(system->my_atoms[i]); - auto buffer = fmt::format("{:9}{:3}{:9}{:10.3f}\n", - p_atom->orig_id, p_atom->type, p_atom->name, - system->reax_param.sbp[p_atom->type].mass); - strncpy(out_control->buffer + i*INIT_DESC_LEN, buffer.c_str(), INIT_DESC_LEN+1); + std::string fmtline(const char *key, double val) + { + return fmt::format("{:<37}{:<24.3f}\n",key,val); } - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np * INIT_DESCS + me, world); - } else { - buffer_len = system->n * INIT_DESC_LEN; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*INIT_DESCS+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); + std::string fmtline(const char *key, double val1, double val2, double val3) + { + return fmt::format("{:<32}{:>9.3f},{:>9.3f},{:>9.3f}\n",key,val1,val2,val3); } -} -void Init_Traj(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world) -{ - int atom_line_len[NR_OPT_ATOM] = { 0, 0, 0, 0, ATOM_BASIC_LEN, ATOM_wV_LEN, ATOM_wF_LEN, ATOM_FULL_LEN}; - int bond_line_len[NR_OPT_BOND] = { 0, BOND_BASIC_LEN, BOND_FULL_LEN }; - int angle_line_len[NR_OPT_ANGLE] = { 0, ANGLE_BASIC_LEN }; + template + std::string fmtline(const char *key, T val) + { + return fmt::format("{:<37}{:<24}\n",key,val); + } - /* generate trajectory name */ - auto fname = std::string(control->sim_name) + ".trj"; + template + std::string fmtline(const char *key, T val1, T val2) + { + return fmt::format("{:<36}{:<12},{:<12}\n",key,val1,val2); + } - /* how should I write atoms? */ - out_control->atom_line_len = atom_line_len[out_control->atom_info]; - out_control->write_atoms = (out_control->atom_line_len ? 1 : 0); - /* bonds? */ - out_control->bond_line_len = bond_line_len[out_control->bond_info]; - out_control->write_bonds = (out_control->bond_line_len ? 1 : 0); - /* angles? */ - out_control->angle_line_len = angle_line_len[out_control->angle_info]; - out_control->write_angles = (out_control->angle_line_len ? 1 : 0); + static void Reallocate_Output_Buffer(LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space) + { + if (out_control->buffer_len > 0) + free(out_control->buffer); - /* allocate line & buffer space */ - out_control->buffer_len = 0; - out_control->buffer = nullptr; + out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); + out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); + if (!out_control->buffer) + error_ptr->one(FLERR,fmt::format("Insufficient memory for required buffer " + "size {}", (req_space*REAX_SAFE_ZONE))); + } - /* write trajectory header and atom info, if applicable */ - if (system->my_rank == MASTER_NODE) - out_control->strj = fopen(fname.c_str(), "w"); + static void Write_Skip_Line(output_controls *out_control, int my_rank, int skip, int num_section) + { + if (my_rank == MASTER_NODE) + fmt::print(out_control->strj,fmtline("chars_to_skip_section:",skip,num_section)); + } - Write_Header(system, control, out_control); - Write_Init_Desc(system, out_control, world); -} + static void Write_Header(reax_system *system, control_params *control, output_controls *out_control) + { + char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", + "xyz_q", + "xyz_q_fxfyfz", + "xyz_q_vxvyvz", + "detailed_atom_info" }; + char bond_formats[3][30] = { "none", + "basic_bond_info", + "detailed_bond_info" }; + char angle_formats[2][30] = { "none", "basic_angle_info" }; -void Write_Frame_Header(reax_system *system, simulation_data *data, output_controls *out_control) -{ - const int me = system->my_rank; - /* frame header lengths */ - constexpr int num_frm_hdr_lines = 22; + /* only the master node writes into trajectory header */ + if (system->my_rank == MASTER_NODE) { + std::string buffer(""); - /* only the master node writes into trajectory header */ - if (me == MASTER_NODE) { - std::string buffer(""); + /* to skip the header */ + buffer += fmtline("chars_to_skip_header:",(NUM_HEADER_LINES-1) * HEADER_LINE_LEN); + + /* general simulation info */ + buffer += fmtline("simulation_name:", out_control->traj_title); + buffer += fmtline("number_of_atoms:", system->bigN); + buffer += fmtline("ensemble_type:", "(unknown)"); + buffer += fmtline("number_of_steps:", 0); + buffer += fmtline("timestep_length_(in_fs):", 0.0); + + /* restart info */ + buffer += fmtline("is_this_a_restart?:", "no"); + buffer += fmtline("write_restart_files?:", "no"); + buffer += fmtline("frequency_to_write_restarts:", 0); + + /* preferences */ + buffer += fmtline("tabulate_long_range_intrs?:",(control->tabulate ? "yes" : "no")); + buffer += fmtline("table_size:", control->tabulate); + buffer += fmtline("restrict_bonds?:", "no"); + buffer += fmtline("bond_restriction_length:", 0); + buffer += fmtline("reposition_atoms?:", "fit to periodic box"); + buffer += fmtline("remove_CoM_velocity?:", 0); + buffer += fmtline("bonded_intr_dist_cutoff:",control->bond_cut); + buffer += fmtline("nonbonded_intr_dist_cutoff:",control->nonb_cut); + buffer += fmtline("hbond_dist_cutoff:",control->hbond_cut); + buffer += fmtline("reax_bond_threshold:",control->bo_cut); + buffer += fmtline("physical_bond_threshold:", control->bg_cut); + buffer += fmtline("valence_angle_threshold:",control->thb_cut); + buffer += fmtline("QEq_tolerance:", 0.0); + + /* temperature controls */ + buffer += fmtline("initial_temperature:", 0.0); + buffer += fmtline("target_temperature:", 0.0); + buffer += fmtline("thermal_inertia:", 0.0); + buffer += fmtline("temperature_regime:", "(unknown)"); + buffer += fmtline("temperature_change_rate_(K/ps):", 0.0); + + /* pressure controls */ + buffer += fmtline("target_pressure_(GPa):", 0.0, 0.0, 0.0); + buffer += fmtline("virial_inertia:", 0.0, 0.0, 0.0); + + /* trajectory */ + buffer += fmtline("energy_dumping_freq:", out_control->energy_update_freq); + buffer += fmtline("trajectory_dumping_freq:",out_control->write_steps); + buffer += fmtline("compress_trajectory_output?:", "no"); + buffer += fmtline("trajectory_format:", "regular"); + buffer += fmtline("atom_info:", atom_formats[out_control->atom_info]); + buffer += fmtline("bond_info:", bond_formats[out_control->bond_info]); + buffer += fmtline("angle_info:", angle_formats[out_control->angle_info]); + + /* analysis */ + buffer += fmtline("molecular_analysis:", "no"); + buffer += fmtline("molecular_analysis_frequency:", 0); + + /* dump out the buffer */ + + fputs(buffer.c_str(),out_control->strj); + } + } + + static void Write_Init_Desc(reax_system *system, output_controls *out_control, MPI_Comm world) + { + int i, me, np, cnt, buffer_len, buffer_req; + reax_atom *p_atom; + MPI_Status status; + + me = system->my_rank; + np = system->wsize; /* skip info */ - buffer += fmtline("chars_to_skip_frame_header:", (num_frm_hdr_lines-1)*HEADER_LINE_LEN); + Write_Skip_Line(out_control, me, system->bigN*INIT_DESC_LEN, system->bigN); - /* step & time */ - buffer += fmtline("step:", data->step); - buffer += fmtline("time_in_ps:", 0.0); + if (me == MASTER_NODE) + buffer_req = system->bigN * INIT_DESC_LEN + 1; + else buffer_req = system->n * INIT_DESC_LEN + 1; - /* box info */ - buffer += fmtline("volume:", 0.0); - buffer += fmtline("box_dimensions:", 0.0, 0.0, 0.0); - buffer += fmtline("coordinate_angles:", 90.0, 90.0, 90.0); + if (buffer_req > out_control->buffer_len * DANGER_ZONE) + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - /* system T and P */ - buffer += fmtline("temperature:", 0.0); - buffer += fmtline("pressure:", 0.0); - - /* energies */ - double epot = data->sys_en.e_bond + data->sys_en.e_ov + data->sys_en.e_un - + data->sys_en.e_lp + data->sys_en.e_ang + data->sys_en.e_pen - + data->sys_en.e_coa + data->sys_en.e_hb + data->sys_en.e_tor - + data->sys_en.e_con + data->sys_en.e_vdW - + data->sys_en.e_ele + data->my_en.e_pol; - - buffer += fmtline("total_energy:", epot); - buffer += fmtline("total_kinetic:", 0.0); - buffer += fmtline("total_potential:", epot); - buffer += fmtline("bond_energy:", data->sys_en.e_bond); - buffer += fmtline("atom_energy:", data->sys_en.e_ov + data->sys_en.e_un); - buffer += fmtline("lone_pair_energy:", data->sys_en.e_lp); - buffer += fmtline("valence_angle_energy:", data->sys_en.e_ang + data->sys_en.e_pen); - buffer += fmtline("3-body_conjugation:", data->sys_en.e_coa); - buffer += fmtline("hydrogen_bond_energy:", data->sys_en.e_hb); - buffer += fmtline("torsion_angle_energy:", data->sys_en.e_tor); - buffer += fmtline("4-body_conjugation:", data->sys_en.e_con); - buffer += fmtline("vdWaals_energy:", data->sys_en.e_vdW); - buffer += fmtline("electrostatics_energy:", data->sys_en.e_ele); - buffer += fmtline("polarization_energy:", data->sys_en.e_pol); - - /* dump out the buffer */ - fputs(buffer.c_str(),out_control->strj); - } -} - -void Write_Atoms(reax_system *system, output_controls *out_control, - MPI_Comm world) -{ - int i, me, np, line_len, buffer_len, buffer_req, cnt; - MPI_Status status; - reax_atom *p_atom; - - me = system->my_rank; - np = system->wsize; - line_len = out_control->atom_line_len; - - Write_Skip_Line(out_control, me, system->bigN*line_len, system->bigN); - - if (me == MASTER_NODE) - buffer_req = system->bigN * line_len + 1; - else buffer_req = system->n * line_len + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - /* fill in buffer */ - out_control->buffer[0] = 0; - - for (i = 0; i < system->n; ++i) { - std::string buffer(""); - p_atom = &(system->my_atoms[i]); - buffer += fmt::format("{:9}{:10.3f}{:10.3f}{:10.3f}",p_atom->orig_id, - p_atom->x[0], p_atom->x[1],p_atom->x[2]); - - switch (out_control->atom_info) { - case OPT_ATOM_BASIC: - buffer += fmt::format("{:10.3f}\n",p_atom->q); - break; - case OPT_ATOM_wF: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); - break; - case OPT_ATOM_wV: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->v[0], p_atom->v[1], p_atom->v[2], p_atom->q); - break; - case OPT_ATOM_FULL: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->v[0], p_atom->v[1], p_atom->v[2], - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); - break; - default: - system->error_ptr->one(FLERR,"Write_traj_atoms: unknown atom trajectory format"); + out_control->buffer[0] = 0; + for (i = 0; i < system->n; ++i) { + p_atom = &(system->my_atoms[i]); + auto buffer = fmt::format("{:9}{:3}{:9}{:10.3f}\n", + p_atom->orig_id, p_atom->type, p_atom->name, + system->reax_param.sbp[p_atom->type].mass); + strncpy(out_control->buffer + i*INIT_DESC_LEN, buffer.c_str(), INIT_DESC_LEN+1); } - strncpy(out_control->buffer + i*line_len, buffer.c_str(), line_len+1); + if (me != MASTER_NODE) { + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np * INIT_DESCS + me, world); + } else { + buffer_len = system->n * INIT_DESC_LEN; + for (i = 0; i < np; ++i) + if (i != MASTER_NODE) { + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*INIT_DESCS+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); + buffer_len += cnt; + } + out_control->buffer[buffer_len] = 0; + fputs(out_control->buffer,out_control->strj); + } } - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ATOM_LINES+me, world); - } else { - buffer_len = system->n * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ATOM_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer, out_control->strj); - } -} - -void Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, + void Init_Traj(reax_system *system, control_params *control, output_controls *out_control, MPI_Comm world) -{ - int i, j, pj, me, np; - int my_bonds, num_bonds; - int line_len, buffer_len, buffer_req, cnt; - MPI_Status status; - bond_data *bo_ij; + { + int atom_line_len[NR_OPT_ATOM] = { 0, 0, 0, 0, ATOM_BASIC_LEN, ATOM_wV_LEN, ATOM_wF_LEN, ATOM_FULL_LEN}; + int bond_line_len[NR_OPT_BOND] = { 0, BOND_BASIC_LEN, BOND_FULL_LEN }; + int angle_line_len[NR_OPT_ANGLE] = { 0, ANGLE_BASIC_LEN }; - me = system->my_rank; - np = system->wsize; - line_len = out_control->bond_line_len; + /* generate trajectory name */ + auto fname = std::string(control->sim_name) + ".trj"; - /* count the number of bonds I will write */ - my_bonds = 0; - for (i=0; i < system->n; ++i) - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - j = bonds->select.bond_list[pj].nbr; - if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut) - ++my_bonds; - } + /* how should I write atoms? */ + out_control->atom_line_len = atom_line_len[out_control->atom_info]; + out_control->write_atoms = (out_control->atom_line_len ? 1 : 0); + /* bonds? */ + out_control->bond_line_len = bond_line_len[out_control->bond_info]; + out_control->write_bonds = (out_control->bond_line_len ? 1 : 0); + /* angles? */ + out_control->angle_line_len = angle_line_len[out_control->angle_info]; + out_control->write_angles = (out_control->angle_line_len ? 1 : 0); - /* allreduce - total number of bonds */ - MPI_Allreduce(&my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world); + /* allocate line & buffer space */ + out_control->buffer_len = 0; + out_control->buffer = nullptr; - Write_Skip_Line(out_control, me, num_bonds*line_len, num_bonds); + /* write trajectory header and atom info, if applicable */ + if (system->my_rank == MASTER_NODE) + out_control->strj = fopen(fname.c_str(), "w"); - if (me == MASTER_NODE) - buffer_req = num_bonds * line_len + 1; - else buffer_req = my_bonds * line_len + 1; + Write_Header(system, control, out_control); + Write_Init_Desc(system, out_control, world); + } - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); + static void Write_Frame_Header(reax_system *system, simulation_data *data, output_controls *out_control) + { + const int me = system->my_rank; + /* frame header lengths */ + constexpr int num_frm_hdr_lines = 22; - /* fill in the buffer */ - out_control->buffer[0] = 0; + /* only the master node writes into trajectory header */ + if (me == MASTER_NODE) { + std::string buffer(""); - my_bonds = 0; - for (i=0; i < system->n; ++i) { - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - bo_ij = &(bonds->select.bond_list[pj]); - j = bo_ij->nbr; + /* skip info */ + buffer += fmtline("chars_to_skip_frame_header:", (num_frm_hdr_lines-1)*HEADER_LINE_LEN); - if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bo_ij->bo_data.BO >= control->bg_cut) { - auto buffer = fmt::format("{:9}{:9}{:10.3f}{:10.3f}", system->my_atoms[i].orig_id, - system->my_atoms[j].orig_id,bo_ij->d,bo_ij->bo_data.BO); + /* step & time */ + buffer += fmtline("step:", data->step); + buffer += fmtline("time_in_ps:", 0.0); - switch (out_control->bond_info) { - case OPT_BOND_BASIC: - buffer += "\n"; - break; - case OPT_BOND_FULL: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}\n", bo_ij->bo_data.BO_s, - bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2); - break; - default: - system->error_ptr->one(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); - } - strncpy(out_control->buffer + my_bonds*line_len, buffer.c_str(), line_len+1); - ++my_bonds; - } + /* box info */ + buffer += fmtline("volume:", 0.0); + buffer += fmtline("box_dimensions:", 0.0, 0.0, 0.0); + buffer += fmtline("coordinate_angles:", 90.0, 90.0, 90.0); + + /* system T and P */ + buffer += fmtline("temperature:", 0.0); + buffer += fmtline("pressure:", 0.0); + + /* energies */ + double epot = data->sys_en.e_bond + data->sys_en.e_ov + data->sys_en.e_un + + data->sys_en.e_lp + data->sys_en.e_ang + data->sys_en.e_pen + + data->sys_en.e_coa + data->sys_en.e_hb + data->sys_en.e_tor + + data->sys_en.e_con + data->sys_en.e_vdW + + data->sys_en.e_ele + data->my_en.e_pol; + + buffer += fmtline("total_energy:", epot); + buffer += fmtline("total_kinetic:", 0.0); + buffer += fmtline("total_potential:", epot); + buffer += fmtline("bond_energy:", data->sys_en.e_bond); + buffer += fmtline("atom_energy:", data->sys_en.e_ov + data->sys_en.e_un); + buffer += fmtline("lone_pair_energy:", data->sys_en.e_lp); + buffer += fmtline("valence_angle_energy:", data->sys_en.e_ang + data->sys_en.e_pen); + buffer += fmtline("3-body_conjugation:", data->sys_en.e_coa); + buffer += fmtline("hydrogen_bond_energy:", data->sys_en.e_hb); + buffer += fmtline("torsion_angle_energy:", data->sys_en.e_tor); + buffer += fmtline("4-body_conjugation:", data->sys_en.e_con); + buffer += fmtline("vdWaals_energy:", data->sys_en.e_vdW); + buffer += fmtline("electrostatics_energy:", data->sys_en.e_ele); + buffer += fmtline("polarization_energy:", data->sys_en.e_pol); + + /* dump out the buffer */ + fputs(buffer.c_str(),out_control->strj); } } - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, np*BOND_LINES+me, world); - } else { - buffer_len = my_bonds * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*BOND_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; + static void Write_Atoms(reax_system *system, output_controls *out_control, + MPI_Comm world) + { + int i, me, np, line_len, buffer_len, buffer_req, cnt; + MPI_Status status; + reax_atom *p_atom; + + me = system->my_rank; + np = system->wsize; + line_len = out_control->atom_line_len; + + Write_Skip_Line(out_control, me, system->bigN*line_len, system->bigN); + + if (me == MASTER_NODE) + buffer_req = system->bigN * line_len + 1; + else buffer_req = system->n * line_len + 1; + + if (buffer_req > out_control->buffer_len * DANGER_ZONE) + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); + + /* fill in buffer */ + out_control->buffer[0] = 0; + + for (i = 0; i < system->n; ++i) { + std::string buffer(""); + p_atom = &(system->my_atoms[i]); + buffer += fmt::format("{:9}{:10.3f}{:10.3f}{:10.3f}",p_atom->orig_id, + p_atom->x[0], p_atom->x[1],p_atom->x[2]); + + switch (out_control->atom_info) { + case OPT_ATOM_BASIC: + buffer += fmt::format("{:10.3f}\n",p_atom->q); + break; + case OPT_ATOM_wF: + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); + break; + case OPT_ATOM_wV: + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->v[0], p_atom->v[1], p_atom->v[2], p_atom->q); + break; + case OPT_ATOM_FULL: + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", + p_atom->v[0], p_atom->v[1], p_atom->v[2], + p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); + break; + default: + system->error_ptr->one(FLERR,"Write_traj_atoms: unknown atom trajectory format"); } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); - } -} -void Write_Angles(reax_system *system, control_params *control, - reax_list *bonds, reax_list *thb_intrs, - output_controls *out_control, MPI_Comm world) -{ - int i, j, k, pi, pk, me, np; - int my_angles, num_angles; - int line_len, buffer_len, buffer_req, cnt; - bond_data *bo_ij, *bo_jk; - three_body_interaction_data *angle_ijk; - MPI_Status status; - - me = system->my_rank; - np = system->wsize; - line_len = out_control->angle_line_len; - - /* count the number of valence angles I will output */ - my_angles = 0; - for (j = 0; j < system->n; ++j) - for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { - bo_ij = &(bonds->select.bond_list[pi]); - i = bo_ij->nbr; - - if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index(pi, thb_intrs); - pk < End_Index(pi, thb_intrs); ++pk) { - angle_ijk = &(thb_intrs->select.three_body_list[pk]); - k = angle_ijk->thb; - bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - - if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut) // physical j&k bond - ++my_angles; - } + strncpy(out_control->buffer + i*line_len, buffer.c_str(), line_len+1); } - /* total number of valences */ - MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, world); - Write_Skip_Line(out_control, me, num_angles*line_len, num_angles); + if (me != MASTER_NODE) { + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np*ATOM_LINES+me, world); + } else { + buffer_len = system->n * line_len; + for (i = 0; i < np; ++i) + if (i != MASTER_NODE) { + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*ATOM_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); + buffer_len += cnt; + } + out_control->buffer[buffer_len] = 0; + fputs(out_control->buffer, out_control->strj); + } + } - if (me == MASTER_NODE) - buffer_req = num_angles * line_len + 1; - else buffer_req = my_angles * line_len + 1; + static void Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, + output_controls *out_control, MPI_Comm world) + { + int i, j, pj, me, np; + int my_bonds, num_bonds; + int line_len, buffer_len, buffer_req, cnt; + MPI_Status status; + bond_data *bo_ij; - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); + me = system->my_rank; + np = system->wsize; + line_len = out_control->bond_line_len; - /* fill in the buffer */ - my_angles = 0; - out_control->buffer[0] = 0; - for (j = 0; j < system->n; ++j) - for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { - bo_ij = &(bonds->select.bond_list[pi]); - i = bo_ij->nbr; + /* count the number of bonds I will write */ + my_bonds = 0; + for (i=0; i < system->n; ++i) + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { + j = bonds->select.bond_list[pj].nbr; + if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut) + ++my_bonds; + } - if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index(pi, thb_intrs); - pk < End_Index(pi, thb_intrs); ++pk) { - angle_ijk = &(thb_intrs->select.three_body_list[pk]); - k = angle_ijk->thb; - bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); + /* allreduce - total number of bonds */ + MPI_Allreduce(&my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world); - if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut) { // physical j&k bond - auto buffer = fmt::format("{:9}{:9}{:9}{:10.3f}\n", - system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, - system->my_atoms[k].orig_id, RAD2DEG(angle_ijk->theta)); + Write_Skip_Line(out_control, me, num_bonds*line_len, num_bonds); - strncpy(out_control->buffer + my_angles*line_len, buffer.c_str(), line_len+1); - ++my_angles; + if (me == MASTER_NODE) + buffer_req = num_bonds * line_len + 1; + else buffer_req = my_bonds * line_len + 1; + + if (buffer_req > out_control->buffer_len * DANGER_ZONE) + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); + + /* fill in the buffer */ + out_control->buffer[0] = 0; + + my_bonds = 0; + for (i=0; i < system->n; ++i) { + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { + bo_ij = &(bonds->select.bond_list[pj]); + j = bo_ij->nbr; + + if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + bo_ij->bo_data.BO >= control->bg_cut) { + auto buffer = fmt::format("{:9}{:9}{:10.3f}{:10.3f}", system->my_atoms[i].orig_id, + system->my_atoms[j].orig_id,bo_ij->d,bo_ij->bo_data.BO); + + switch (out_control->bond_info) { + case OPT_BOND_BASIC: + buffer += "\n"; + break; + case OPT_BOND_FULL: + buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}\n", bo_ij->bo_data.BO_s, + bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2); + break; + default: + system->error_ptr->one(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); } + strncpy(out_control->buffer + my_bonds*line_len, buffer.c_str(), line_len+1); + ++my_bonds; } + } } - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ANGLE_LINES+me, world); - } else { - buffer_len = my_angles * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ANGLE_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; + if (me != MASTER_NODE) { + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, np*BOND_LINES+me, world); + } else { + buffer_len = my_bonds * line_len; + for (i = 0; i < np; ++i) + if (i != MASTER_NODE) { + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*BOND_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); + buffer_len += cnt; + } + out_control->buffer[buffer_len] = 0; + fputs(out_control->buffer,out_control->strj); + } + } + + static void Write_Angles(reax_system *system, control_params *control, + reax_list *bonds, reax_list *thb_intrs, + output_controls *out_control, MPI_Comm world) + { + int i, j, k, pi, pk, me, np; + int my_angles, num_angles; + int line_len, buffer_len, buffer_req, cnt; + bond_data *bo_ij, *bo_jk; + three_body_interaction_data *angle_ijk; + MPI_Status status; + + me = system->my_rank; + np = system->wsize; + line_len = out_control->angle_line_len; + + /* count the number of valence angles I will output */ + my_angles = 0; + for (j = 0; j < system->n; ++j) + for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { + bo_ij = &(bonds->select.bond_list[pi]); + i = bo_ij->nbr; + + if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond + for (pk = Start_Index(pi, thb_intrs); + pk < End_Index(pi, thb_intrs); ++pk) { + angle_ijk = &(thb_intrs->select.three_body_list[pk]); + k = angle_ijk->thb; + bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); + + if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + bo_jk->bo_data.BO >= control->bg_cut) // physical j&k bond + ++my_angles; + } } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); + /* total number of valences */ + MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, world); + + Write_Skip_Line(out_control, me, num_angles*line_len, num_angles); + + if (me == MASTER_NODE) + buffer_req = num_angles * line_len + 1; + else buffer_req = my_angles * line_len + 1; + + if (buffer_req > out_control->buffer_len * DANGER_ZONE) + Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); + + /* fill in the buffer */ + my_angles = 0; + out_control->buffer[0] = 0; + for (j = 0; j < system->n; ++j) + for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { + bo_ij = &(bonds->select.bond_list[pi]); + i = bo_ij->nbr; + + if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond + for (pk = Start_Index(pi, thb_intrs); + pk < End_Index(pi, thb_intrs); ++pk) { + angle_ijk = &(thb_intrs->select.three_body_list[pk]); + k = angle_ijk->thb; + bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); + + if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + bo_jk->bo_data.BO >= control->bg_cut) { // physical j&k bond + auto buffer = fmt::format("{:9}{:9}{:9}{:10.3f}\n", + system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, + system->my_atoms[k].orig_id, RAD2DEG(angle_ijk->theta)); + + strncpy(out_control->buffer + my_angles*line_len, buffer.c_str(), line_len+1); + ++my_angles; + } + } + } + + if (me != MASTER_NODE) { + MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, + np*ANGLE_LINES+me, world); + } else { + buffer_len = my_angles * line_len; + for (i = 0; i < np; ++i) + if (i != MASTER_NODE) { + MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, + MPI_CHAR, i, np*ANGLE_LINES+i, world, &status); + MPI_Get_count(&status, MPI_CHAR, &cnt); + buffer_len += cnt; + } + out_control->buffer[buffer_len] = 0; + fputs(out_control->buffer,out_control->strj); + } + } + + void Append_Frame(reax_system *system, control_params *control, + simulation_data *data, reax_list **lists, + output_controls *out_control, MPI_Comm world) + { + Write_Frame_Header(system, data, out_control); + + if (out_control->write_atoms) + Write_Atoms(system, out_control, world); + + if (out_control->write_bonds) + Write_Bonds(system, control, (*lists + BONDS), out_control, world); + + if (out_control->write_angles) + Write_Angles(system, control, (*lists + BONDS), (*lists + THREE_BODIES), + out_control, world); + } + + void End_Traj(int my_rank, output_controls *out_control) + { + if (my_rank == MASTER_NODE) + fclose(out_control->strj); + + free(out_control->buffer); } } - -void Append_Frame(reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, MPI_Comm world) -{ - Write_Frame_Header(system, data, out_control); - - if (out_control->write_atoms) - Write_Atoms(system, out_control, world); - - if (out_control->write_bonds) - Write_Bonds(system, control, (*lists + BONDS), out_control, world); - - if (out_control->write_angles) - Write_Angles(system, control, (*lists + BONDS), (*lists + THREE_BODIES), - out_control, world); -} - -void End_Traj(int my_rank, output_controls *out_control) -{ - if (my_rank == MASTER_NODE) - fclose(out_control->strj); - - free(out_control->buffer); -} diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h deleted file mode 100644 index 93fa4a6771..0000000000 --- a/src/USER-REAXC/reaxc_traj.h +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef LMP_REAXC_TRAJ_H -#define LMP_REAXC_TRAJ_H - -#include "reaxc_types.h" -#include - -void Init_Traj(reax_system *, control_params *, output_controls *, MPI_Comm); -void End_Traj(int, output_controls *); - -void Append_Frame(reax_system *, control_params *, simulation_data *, - reax_list **, output_controls *, MPI_Comm); -#endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h deleted file mode 100644 index 66516d52a0..0000000000 --- a/src/USER-REAXC/reaxc_types.h +++ /dev/null @@ -1,513 +0,0 @@ -/*- -*- c++ -*- -------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef LMP_REAXC_TYPES_H -#define LMP_REAXC_TYPES_H - -#include "lmptype.h" -#include -#include -#include "accelerator_kokkos.h" - -// forward declarations -namespace LAMMPS_NS { - class Error; - class LAMMPS; - class Pair; -} - -/************* SOME DEFS - crucial for reax_types.h *********/ - -#define REAX_MAX_STR 1024 -#define REAX_MAX_3BODY_PARAM 5 -#define REAX_MAX_4BODY_PARAM 5 -#define REAX_MAX_ATOM_TYPES 25 - -/********************** TYPE DEFINITIONS ********************/ -typedef int ivec[3]; -typedef double rvec[3]; -typedef double rvec2[2]; - -// import LAMMPS' definition of tagint and bigint -typedef LAMMPS_NS::tagint rc_tagint; -typedef LAMMPS_NS::bigint rc_bigint; - -struct global_parameters -{ - int n_global; - double* l; - int vdw_type; -}; - -struct single_body_parameters -{ - char name[4]; // two character atom name - double r_s; - double valency; // Valency of the atom - double mass; // Mass of atom - double r_vdw; - double epsilon; - double gamma; - double r_pi; - double valency_e; - double nlp_opt; - - /* Line two in field file */ - double alpha; - double gamma_w; - double valency_boc; - double p_ovun5; - double chi; - double eta; - int p_hbond; // 1 for H, 2 for hbonding atoms (O,S,P,N), 0 for others - - /* Line three in field file */ - double r_pi_pi; - double p_lp2; - double b_o_131; - double b_o_132; - double b_o_133; - - /* Line four in the field file */ - double p_ovun2; - double p_val3; - double valency_val; - double p_val5; - double rcore2; - double ecore2; - double acore2; - - /* Line five in the ffield file, only for lgvdw yes */ - double lgcij; - double lgre; - -}; - -/* Two Body Parameters */ -struct two_body_parameters { - /* Bond Order parameters */ - double p_bo1,p_bo2,p_bo3,p_bo4,p_bo5,p_bo6; - double r_s, r_p, r_pp; // r_o distances in BO formula - double p_boc3, p_boc4, p_boc5; - - /* Bond Energy parameters */ - double p_be1, p_be2; - double De_s, De_p, De_pp; - - /* Over/Under coordination parameters */ - double p_ovun1; - - /* Van der Waal interaction parameters */ - double D; - double alpha; - double r_vdW; - double gamma_w; - double rcore, ecore, acore; - double lgcij, lgre; - - /* electrostatic parameters */ - double gamma; // note: this parameter is gamma^-3 and not gamma. - - double v13cor, ovc; -}; - -/* 3-body parameters */ -struct three_body_parameters { - /* valence angle */ - double theta_00; - double p_val1, p_val2, p_val4, p_val7; - - /* penalty */ - double p_pen1; - - /* 3-body conjugation */ - double p_coa1; -}; - -struct three_body_header -{ - int cnt; - three_body_parameters prm[REAX_MAX_3BODY_PARAM]; -}; - -/* hydrogen-bond parameters */ -struct hbond_parameters -{ - double r0_hb, p_hb1, p_hb2, p_hb3; -}; - -/* 4-body parameters */ -struct four_body_parameters -{ - double V1, V2, V3; - - /* torsion angle */ - double p_tor1; - - /* 4-body conjugation */ - double p_cot1; -}; - -struct four_body_header -{ - int cnt; - four_body_parameters prm[REAX_MAX_4BODY_PARAM]; -}; - -struct reax_interaction -{ - int num_atom_types; - global_parameters gp; - single_body_parameters *sbp; - two_body_parameters **tbp; - three_body_header ***thbp; - hbond_parameters ***hbp; - four_body_header ****fbp; -}; - -struct reax_atom -{ - rc_tagint orig_id; - int type; - char name[8]; - - rvec x; // position - rvec v; // velocity - rvec f; // force - double q; // charge - - int Hindex; - int num_bonds; - int num_hbonds; -}; - -struct LR_lookup_table; // forward declaration -struct reax_system -{ - reax_interaction reax_param; - - rc_bigint bigN; - int n, N, numH; - int local_cap, total_cap, Hcap; - int wsize, my_rank, num_nbrs; - reax_atom *my_atoms; - - LAMMPS_NS::Error *error_ptr; - LAMMPS_NS::Pair *pair_ptr; - int my_bonds; - int mincap,minhbonds; - double safezone, saferzone; - - LR_lookup_table **LR; - - int omp_active; -}; - -/* system control parameters */ -struct control_params -{ - char sim_name[REAX_MAX_STR]; - int nthreads; - - double bond_cut; - double nonb_cut, nonb_low; - double hbond_cut; - - double bg_cut; - double bo_cut; - double thb_cut; - double thb_cutsq; - - int tabulate; - int virial; - - int lgflag; - int enobondsflag; - LAMMPS_NS::Error *error_ptr; - LAMMPS_NS::LAMMPS *lmp_ptr; - int me; -}; - -struct energy_data -{ - double e_bond; // Total bond energy - double e_ov; // Total over coordination - double e_un; // Total under coordination energy - double e_lp; // Total under coordination energy - double e_ang; // Total valance angle energy - double e_pen; // Total penalty energy - double e_coa; // Total three body conjgation energy - double e_hb; // Total Hydrogen bond energy - double e_tor; // Total torsional energy - double e_con; // Total four body conjugation energy - double e_vdW; // Total van der Waals energy - double e_ele; // Total electrostatics energy - double e_pol; // Polarization energy -}; - -struct simulation_data -{ - rc_bigint step; - - energy_data my_en; // per MPI rank energies - energy_data sys_en; // global energies -}; - -struct three_body_interaction_data -{ - int thb; - int pthb; // pointer to the third body on the central atom's nbrlist - double theta, cos_theta; - rvec dcos_di, dcos_dj, dcos_dk; -}; - -struct far_neighbor_data { - int nbr; - ivec rel_box; - double d; - rvec dvec; -}; - -namespace ReaxFF { - struct far_neighbor_data { - int nbr; - ivec rel_box; - double d; - rvec dvec; - }; -} - -struct hbond_data { - int nbr; - int scl; - far_neighbor_data *ptr; -}; - -struct dDelta_data { - int wrt; - rvec dVal; -}; - -struct dbond_data { - int wrt; - rvec dBO, dBOpi, dBOpi2; -}; - -struct bond_order_data { - double BO, BO_s, BO_pi, BO_pi2; - double Cdbo, Cdbopi, Cdbopi2; - double C1dbo, C2dbo, C3dbo; - double C1dbopi, C2dbopi, C3dbopi, C4dbopi; - double C1dbopi2, C2dbopi2, C3dbopi2, C4dbopi2; - rvec dBOp, dln_BOp_s, dln_BOp_pi, dln_BOp_pi2; - double *CdboReduction; -}; - -struct bond_data { - int nbr; - int sym_index; - int dbond_index; - ivec rel_box; - // rvec ext_factor; - double d; - rvec dvec; - bond_order_data bo_data; -}; - -struct sparse_matrix_entry { - int j; - double val; -}; - -struct sparse_matrix { - int cap, n, m; - int *start, *end; - sparse_matrix_entry *entries; -}; - -struct reallocate_data { - int num_far; - int H, Htop; - int hbonds, num_hbonds; - int bonds, num_bonds; - int num_3body; -}; - -struct storage -{ - int allocated; - - /* bond order related storage */ - double *total_bond_order; - double *Deltap, *Deltap_boc; - double *Delta, *Delta_lp, *Delta_lp_temp, *Delta_e, *Delta_boc, *Delta_val; - double *dDelta_lp, *dDelta_lp_temp; - double *nlp, *nlp_temp, *Clp, *vlpex; - rvec *dDeltap_self; - int *bond_mark; - - /* Taper */ - double Tap[8]; //Tap7, Tap6, Tap5, Tap4, Tap3, Tap2, Tap1, Tap0; - - /* force calculations */ - double *CdDelta; // coefficient of dDelta - rvec *f; - - /* omp */ - rvec *forceReduction; - double *CdDeltaReduction; - int *valence_angle_atom_myoffset; - - reallocate_data realloc; -}; - -union list_type -{ - void *v; - three_body_interaction_data *three_body_list; - bond_data *bond_list; - dbond_data *dbo_list; - dDelta_data *dDelta_list; - far_neighbor_data *far_nbr_list; - hbond_data *hbond_list; -}; - -struct reax_list -{ - int allocated; - - int n; - int num_intrs; - - int *index; - int *end_index; - - int type; - list_type select; - class LAMMPS_NS::Error *error_ptr; -}; - -struct output_controls -{ - FILE *strj; - int atom_line_len; - int bond_line_len; - int angle_line_len; - int write_atoms; - int write_bonds; - int write_angles; - int buffer_len; - char *buffer; - - int write_steps; - char traj_title[81]; - int atom_info; - int bond_info; - int angle_info; - - int energy_update_freq; -}; - -struct LR_data -{ - double H; - double e_vdW, CEvd; - double e_ele, CEclmb; - - LAMMPS_INLINE - LR_data() {} - - LAMMPS_INLINE - void operator = (const LR_data& rhs) { - H = rhs.H; - e_vdW = rhs.e_vdW; - CEvd = rhs.CEvd; - e_ele = rhs.e_ele; - CEclmb = rhs.CEclmb; - } - LAMMPS_INLINE - void operator = (const LR_data& rhs) volatile { - H = rhs.H; - e_vdW = rhs.e_vdW; - CEvd = rhs.CEvd; - e_ele = rhs.e_ele; - CEclmb = rhs.CEclmb; - } -}; - -struct cubic_spline_coef -{ - double a, b, c, d; - - LAMMPS_INLINE - cubic_spline_coef() {} - - LAMMPS_INLINE - cubic_spline_coef(const cubic_spline_coef &_c) { - a = _c.a; - b = _c.b; - c = _c.c; - d = _c.d; - } - - LAMMPS_INLINE - void operator=(const cubic_spline_coef &rhs) { - a = rhs.a; - b = rhs.b; - c = rhs.c; - d = rhs.d; - } - - LAMMPS_INLINE - void operator=(const cubic_spline_coef &rhs) volatile { - a = rhs.a; - b = rhs.b; - c = rhs.c; - d = rhs.d; - } -}; - -struct LR_lookup_table -{ - double xmin, xmax; - int n; - double dx, inv_dx; - double a; - double m; - double c; - - LR_data *y; - cubic_spline_coef *H; - cubic_spline_coef *vdW, *CEvd; - cubic_spline_coef *ele, *CEclmb; -}; - -/* function pointer defs */ - -typedef void (*interaction_function) (reax_system *, control_params *, - simulation_data *, storage *, - reax_list **, output_controls *); -#endif diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index b363fd8e04..9c1bf15c4b 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -24,328 +24,317 @@ . ----------------------------------------------------------------------*/ -#include "reaxc_valence_angles.h" -#include -#include "pair.h" -#include "reaxc_defs.h" -#include "reaxc_list.h" -#include "reaxc_vector.h" +#include "reaxff_api.h" +#include + +#include "pair.h" #include "error.h" -static double Dot( double* v1, double* v2, int k ) -{ - double ret = 0.0; +namespace ReaxFF { + void Calculate_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, + double *theta, double *cos_theta ) + { + (*cos_theta) = rvec_Dot(dvec_ji,dvec_jk) / ( d_ji * d_jk ); + if (*cos_theta > 1.) *cos_theta = 1.0; + if (*cos_theta < -1.) *cos_theta = -1.0; - for (int i=0; i < k; ++i) - ret += v1[i] * v2[i]; - - return ret; -} - -void Calculate_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, - double *theta, double *cos_theta ) -{ - (*cos_theta) = Dot( dvec_ji, dvec_jk, 3 ) / ( d_ji * d_jk ); - if (*cos_theta > 1.) *cos_theta = 1.0; - if (*cos_theta < -1.) *cos_theta = -1.0; - - (*theta) = acos( *cos_theta ); -} - -void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, - rvec* dcos_theta_di, - rvec* dcos_theta_dj, - rvec* dcos_theta_dk ) -{ - int t; - double sqr_d_ji = SQR(d_ji); - double sqr_d_jk = SQR(d_jk); - double inv_dists = 1.0 / (d_ji * d_jk); - double inv_dists3 = pow( inv_dists, 3.0 ); - double dot_dvecs = Dot( dvec_ji, dvec_jk, 3 ); - double Cdot_inv3 = dot_dvecs * inv_dists3; - - for (t = 0; t < 3; ++t) { - (*dcos_theta_di)[t] = dvec_jk[t] * inv_dists - - Cdot_inv3 * sqr_d_jk * dvec_ji[t]; - (*dcos_theta_dj)[t] = -(dvec_jk[t] + dvec_ji[t]) * inv_dists + - Cdot_inv3 * ( sqr_d_jk * dvec_ji[t] + sqr_d_ji * dvec_jk[t] ); - (*dcos_theta_dk)[t] = dvec_ji[t] * inv_dists - - Cdot_inv3 * sqr_d_ji * dvec_jk[t]; + (*theta) = acos( *cos_theta ); } -} + void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, + rvec* dcos_theta_di, + rvec* dcos_theta_dj, + rvec* dcos_theta_dk ) + { + int t; + double sqr_d_ji = SQR(d_ji); + double sqr_d_jk = SQR(d_jk); + double inv_dists = 1.0 / (d_ji * d_jk); + double inv_dists3 = CUBE(inv_dists); + double dot_dvecs = rvec_Dot(dvec_ji,dvec_jk); + double Cdot_inv3 = dot_dvecs * inv_dists3; -void Valence_Angles( reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) -{ - int i, j, pi, k, pk, t; - int type_i, type_j, type_k; - int start_j, end_j, start_pk, end_pk; - int cnt, num_thb_intrs; - - double temp, temp_bo_jt, pBOjt7; - double p_val1, p_val2, p_val3, p_val4, p_val5; - double p_val6, p_val7, p_val8, p_val9, p_val10; - double p_pen1, p_pen2, p_pen3, p_pen4; - double p_coa1, p_coa2, p_coa3, p_coa4; - double trm8, expval6, expval7, expval2theta, expval12theta, exp3ij, exp3jk; - double exp_pen2ij, exp_pen2jk, exp_pen3, exp_pen4, trm_pen34, exp_coa2; - double dSBO1, dSBO2, SBO, SBO2, CSBO2, SBOp, prod_SBO, vlpadj; - double CEval1, CEval2, CEval3, CEval4, CEval5, CEval6, CEval7, CEval8; - double CEpen1, CEpen2, CEpen3; - double e_ang, e_coa, e_pen; - double CEcoa1, CEcoa2, CEcoa3, CEcoa4, CEcoa5; - double Cf7ij, Cf7jk, Cf8j, Cf9j; - double f7_ij, f7_jk, f8_Dj, f9_Dj; - double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; - double BOA_ij, BOA_jk; - rvec force; - - // Tallying variables - double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; - double delij[3], delkj[3]; - - three_body_header *thbh; - three_body_parameters *thbp; - three_body_interaction_data *p_ijk, *p_kji; - bond_data *pbond_ij, *pbond_jk, *pbond_jt; - bond_order_data *bo_ij, *bo_jk, *bo_jt; - reax_list *bonds = (*lists) + BONDS; - reax_list *thb_intrs = (*lists) + THREE_BODIES; - - /* global parameters used in these calculations */ - p_val6 = system->reax_param.gp.l[14]; - p_val8 = system->reax_param.gp.l[33]; - p_val9 = system->reax_param.gp.l[16]; - p_val10 = system->reax_param.gp.l[17]; - num_thb_intrs = 0; - - - for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N - type_j = system->my_atoms[j].type; - if (type_j < 0) continue; - start_j = Start_Index(j, bonds); - end_j = End_Index(j, bonds); - - p_val3 = system->reax_param.sbp[ type_j ].p_val3; - p_val5 = system->reax_param.sbp[ type_j ].p_val5; - - SBOp = 0, prod_SBO = 1; - for (t = start_j; t < end_j; ++t) { - bo_jt = &(bonds->select.bond_list[t].bo_data); - SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); - temp = SQR( bo_jt->BO ); - temp *= temp; - temp *= temp; - prod_SBO *= exp( -temp ); + for (t = 0; t < 3; ++t) { + (*dcos_theta_di)[t] = dvec_jk[t] * inv_dists - + Cdot_inv3 * sqr_d_jk * dvec_ji[t]; + (*dcos_theta_dj)[t] = -(dvec_jk[t] + dvec_ji[t]) * inv_dists + + Cdot_inv3 * ( sqr_d_jk * dvec_ji[t] + sqr_d_ji * dvec_jk[t] ); + (*dcos_theta_dk)[t] = dvec_ji[t] * inv_dists - + Cdot_inv3 * sqr_d_ji * dvec_jk[t]; } + } - if (workspace->vlpex[j] >= 0) { - vlpadj = 0; - dSBO2 = prod_SBO - 1; - } else { - vlpadj = workspace->nlp[j]; - dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]); - } - SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); - dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj ); + void Valence_Angles( reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) + { + int i, j, pi, k, pk, t; + int type_i, type_j, type_k; + int start_j, end_j, start_pk, end_pk; + int cnt, num_thb_intrs; - if (SBO <= 0) - SBO2 = 0, CSBO2 = 0; - else if (SBO > 0 && SBO <= 1) { + double temp, temp_bo_jt, pBOjt7; + double p_val1, p_val2, p_val3, p_val4, p_val5; + double p_val6, p_val7, p_val8, p_val9, p_val10; + double p_pen1, p_pen2, p_pen3, p_pen4; + double p_coa1, p_coa2, p_coa3, p_coa4; + double trm8, expval6, expval7, expval2theta, expval12theta, exp3ij, exp3jk; + double exp_pen2ij, exp_pen2jk, exp_pen3, exp_pen4, trm_pen34, exp_coa2; + double dSBO1, dSBO2, SBO, SBO2, CSBO2, SBOp, prod_SBO, vlpadj; + double CEval1, CEval2, CEval3, CEval4, CEval5, CEval6, CEval7, CEval8; + double CEpen1, CEpen2, CEpen3; + double e_ang, e_coa, e_pen; + double CEcoa1, CEcoa2, CEcoa3, CEcoa4, CEcoa5; + double Cf7ij, Cf7jk, Cf8j, Cf9j; + double f7_ij, f7_jk, f8_Dj, f9_Dj; + double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; + double BOA_ij, BOA_jk; + rvec force; + + // Tallying variables + double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; + double delij[3], delkj[3]; + + three_body_header *thbh; + three_body_parameters *thbp; + three_body_interaction_data *p_ijk, *p_kji; + bond_data *pbond_ij, *pbond_jk, *pbond_jt; + bond_order_data *bo_ij, *bo_jk, *bo_jt; + reax_list *bonds = (*lists) + BONDS; + reax_list *thb_intrs = (*lists) + THREE_BODIES; + + /* global parameters used in these calculations */ + p_val6 = system->reax_param.gp.l[14]; + p_val8 = system->reax_param.gp.l[33]; + p_val9 = system->reax_param.gp.l[16]; + p_val10 = system->reax_param.gp.l[17]; + num_thb_intrs = 0; + + + for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N + type_j = system->my_atoms[j].type; + if (type_j < 0) continue; + start_j = Start_Index(j, bonds); + end_j = End_Index(j, bonds); + + p_val3 = system->reax_param.sbp[ type_j ].p_val3; + p_val5 = system->reax_param.sbp[ type_j ].p_val5; + + SBOp = 0, prod_SBO = 1; + for (t = start_j; t < end_j; ++t) { + bo_jt = &(bonds->select.bond_list[t].bo_data); + SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); + temp = SQR( bo_jt->BO ); + temp *= temp; + temp *= temp; + prod_SBO *= exp( -temp ); + } + + if (workspace->vlpex[j] >= 0) { + vlpadj = 0; + dSBO2 = prod_SBO - 1; + } else { + vlpadj = workspace->nlp[j]; + dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]); + } + + SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); + dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj ); + + if (SBO <= 0) + SBO2 = 0, CSBO2 = 0; + else if (SBO > 0 && SBO <= 1) { SBO2 = pow( SBO, p_val9 ); CSBO2 = p_val9 * pow( SBO, p_val9 - 1 ); - } - else if (SBO > 1 && SBO < 2) { - SBO2 = 2 - pow( 2-SBO, p_val9 ); - CSBO2 = p_val9 * pow( 2 - SBO, p_val9 - 1 ); - } - else - SBO2 = 2, CSBO2 = 0; + } + else if (SBO > 1 && SBO < 2) { + SBO2 = 2 - pow( 2-SBO, p_val9 ); + CSBO2 = p_val9 * pow( 2 - SBO, p_val9 - 1 ); + } + else + SBO2 = 2, CSBO2 = 0; - expval6 = exp( p_val6 * workspace->Delta_boc[j] ); + expval6 = exp( p_val6 * workspace->Delta_boc[j] ); - for (pi = start_j; pi < end_j; ++pi) { - Set_Start_Index( pi, num_thb_intrs, thb_intrs ); - pbond_ij = &(bonds->select.bond_list[pi]); - bo_ij = &(pbond_ij->bo_data); - BOA_ij = bo_ij->BO - control->thb_cut; + for (pi = start_j; pi < end_j; ++pi) { + Set_Start_Index( pi, num_thb_intrs, thb_intrs ); + pbond_ij = &(bonds->select.bond_list[pi]); + bo_ij = &(pbond_ij->bo_data); + BOA_ij = bo_ij->BO - control->thb_cut; - if ( BOA_ij/*bo_ij->BO*/ > 0.0 && - ( j < system->n || pbond_ij->nbr < system->n )) { - i = pbond_ij->nbr; - type_i = system->my_atoms[i].type; + if ( BOA_ij/*bo_ij->BO*/ > 0.0 && + ( j < system->n || pbond_ij->nbr < system->n )) { + i = pbond_ij->nbr; + type_i = system->my_atoms[i].type; - for (pk = start_j; pk < pi; ++pk) { - start_pk = Start_Index( pk, thb_intrs ); - end_pk = End_Index( pk, thb_intrs ); + for (pk = start_j; pk < pi; ++pk) { + start_pk = Start_Index( pk, thb_intrs ); + end_pk = End_Index( pk, thb_intrs ); - for (t = start_pk; t < end_pk; ++t) - if (thb_intrs->select.three_body_list[t].thb == i) { - p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs] ); - p_kji = &(thb_intrs->select.three_body_list[t]); + for (t = start_pk; t < end_pk; ++t) + if (thb_intrs->select.three_body_list[t].thb == i) { + p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs] ); + p_kji = &(thb_intrs->select.three_body_list[t]); - p_ijk->thb = bonds->select.bond_list[pk].nbr; - p_ijk->pthb = pk; - p_ijk->theta = p_kji->theta; - rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk ); - rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj ); - rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di ); + p_ijk->thb = bonds->select.bond_list[pk].nbr; + p_ijk->pthb = pk; + p_ijk->theta = p_kji->theta; + rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk ); + rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj ); + rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di ); - ++num_thb_intrs; - break; - } - } + ++num_thb_intrs; + break; + } + } - for (pk = pi+1; pk < end_j; ++pk) { - pbond_jk = &(bonds->select.bond_list[pk]); - bo_jk = &(pbond_jk->bo_data); - BOA_jk = bo_jk->BO - control->thb_cut; - k = pbond_jk->nbr; - type_k = system->my_atoms[k].type; - p_ijk = &( thb_intrs->select.three_body_list[num_thb_intrs] ); + for (pk = pi+1; pk < end_j; ++pk) { + pbond_jk = &(bonds->select.bond_list[pk]); + bo_jk = &(pbond_jk->bo_data); + BOA_jk = bo_jk->BO - control->thb_cut; + k = pbond_jk->nbr; + type_k = system->my_atoms[k].type; + p_ijk = &( thb_intrs->select.three_body_list[num_thb_intrs] ); - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, - pbond_jk->dvec, pbond_jk->d, - &theta, &cos_theta ); + Calculate_Theta( pbond_ij->dvec, pbond_ij->d, + pbond_jk->dvec, pbond_jk->d, + &theta, &cos_theta ); - Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, - pbond_jk->dvec, pbond_jk->d, - &(p_ijk->dcos_di), &(p_ijk->dcos_dj), - &(p_ijk->dcos_dk) ); - p_ijk->thb = k; - p_ijk->pthb = pk; - p_ijk->theta = theta; + Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, + pbond_jk->dvec, pbond_jk->d, + &(p_ijk->dcos_di), &(p_ijk->dcos_dj), + &(p_ijk->dcos_dk) ); + p_ijk->thb = k; + p_ijk->pthb = pk; + p_ijk->theta = theta; - sin_theta = sin( theta ); - if (sin_theta < 1.0e-5) - sin_theta = 1.0e-5; + sin_theta = sin( theta ); + if (sin_theta < 1.0e-5) + sin_theta = 1.0e-5; - ++num_thb_intrs; + ++num_thb_intrs; - if ((j < system->n) && (BOA_jk > 0.0) && - (bo_ij->BO > control->thb_cut) && - (bo_jk->BO > control->thb_cut) && - (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { - thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] ); + if ((j < system->n) && (BOA_jk > 0.0) && + (bo_ij->BO > control->thb_cut) && + (bo_jk->BO > control->thb_cut) && + (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { + thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] ); - for (cnt = 0; cnt < thbh->cnt; ++cnt) { - if (fabs(thbh->prm[cnt].p_val1) > 0.001) { - thbp = &( thbh->prm[cnt] ); + for (cnt = 0; cnt < thbh->cnt; ++cnt) { + if (fabs(thbh->prm[cnt].p_val1) > 0.001) { + thbp = &( thbh->prm[cnt] ); - /* ANGLE ENERGY */ - p_val1 = thbp->p_val1; - p_val2 = thbp->p_val2; - p_val4 = thbp->p_val4; - p_val7 = thbp->p_val7; - theta_00 = thbp->theta_00; + /* ANGLE ENERGY */ + p_val1 = thbp->p_val1; + p_val2 = thbp->p_val2; + p_val4 = thbp->p_val4; + p_val7 = thbp->p_val7; + theta_00 = thbp->theta_00; - exp3ij = exp( -p_val3 * pow( BOA_ij, p_val4 ) ); - f7_ij = 1.0 - exp3ij; - Cf7ij = p_val3 * p_val4 * pow( BOA_ij, p_val4 - 1.0 ) * exp3ij; + exp3ij = exp( -p_val3 * pow( BOA_ij, p_val4 ) ); + f7_ij = 1.0 - exp3ij; + Cf7ij = p_val3 * p_val4 * pow( BOA_ij, p_val4 - 1.0 ) * exp3ij; - exp3jk = exp( -p_val3 * pow( BOA_jk, p_val4 ) ); - f7_jk = 1.0 - exp3jk; - Cf7jk = p_val3 * p_val4 * pow( BOA_jk, p_val4 - 1.0 ) * exp3jk; + exp3jk = exp( -p_val3 * pow( BOA_jk, p_val4 ) ); + f7_jk = 1.0 - exp3jk; + Cf7jk = p_val3 * p_val4 * pow( BOA_jk, p_val4 - 1.0 ) * exp3jk; - expval7 = exp( -p_val7 * workspace->Delta_boc[j] ); - trm8 = 1.0 + expval6 + expval7; - f8_Dj = p_val5 - ( (p_val5 - 1.0) * (2.0 + expval6) / trm8 ); - Cf8j = ( (1.0 - p_val5) / SQR(trm8) ) * - ( p_val6 * expval6 * trm8 - - (2.0 + expval6) * ( p_val6*expval6 - p_val7*expval7 ) ); + expval7 = exp( -p_val7 * workspace->Delta_boc[j] ); + trm8 = 1.0 + expval6 + expval7; + f8_Dj = p_val5 - ( (p_val5 - 1.0) * (2.0 + expval6) / trm8 ); + Cf8j = ( (1.0 - p_val5) / SQR(trm8) ) * + ( p_val6 * expval6 * trm8 - + (2.0 + expval6) * ( p_val6*expval6 - p_val7*expval7 ) ); - theta_0 = 180.0 - theta_00 * (1.0 - - exp(-p_val10 * (2.0 - SBO2))); - theta_0 = DEG2RAD( theta_0 ); + theta_0 = 180.0 - theta_00 * (1.0 - + exp(-p_val10 * (2.0 - SBO2))); + theta_0 = DEG2RAD( theta_0 ); - expval2theta = exp( -p_val2 * SQR(theta_0 - theta) ); - if (p_val1 >= 0) - expval12theta = p_val1 * (1.0 - expval2theta); - else // To avoid linear Me-H-Me angles (6/6/06) - expval12theta = p_val1 * -expval2theta; + expval2theta = exp( -p_val2 * SQR(theta_0 - theta) ); + if (p_val1 >= 0) + expval12theta = p_val1 * (1.0 - expval2theta); + else // To avoid linear Me-H-Me angles (6/6/06) + expval12theta = p_val1 * -expval2theta; - CEval1 = Cf7ij * f7_jk * f8_Dj * expval12theta; - CEval2 = Cf7jk * f7_ij * f8_Dj * expval12theta; - CEval3 = Cf8j * f7_ij * f7_jk * expval12theta; - CEval4 = -2.0 * p_val1 * p_val2 * f7_ij * f7_jk * f8_Dj * - expval2theta * (theta_0 - theta); + CEval1 = Cf7ij * f7_jk * f8_Dj * expval12theta; + CEval2 = Cf7jk * f7_ij * f8_Dj * expval12theta; + CEval3 = Cf8j * f7_ij * f7_jk * expval12theta; + CEval4 = -2.0 * p_val1 * p_val2 * f7_ij * f7_jk * f8_Dj * + expval2theta * (theta_0 - theta); - Ctheta_0 = p_val10 * DEG2RAD(theta_00) * - exp( -p_val10 * (2.0 - SBO2) ); + Ctheta_0 = p_val10 * DEG2RAD(theta_00) * + exp( -p_val10 * (2.0 - SBO2) ); - CEval5 = -CEval4 * Ctheta_0 * CSBO2; - CEval6 = CEval5 * dSBO1; - CEval7 = CEval5 * dSBO2; - CEval8 = -CEval4 / sin_theta; + CEval5 = -CEval4 * Ctheta_0 * CSBO2; + CEval6 = CEval5 * dSBO1; + CEval7 = CEval5 * dSBO2; + CEval8 = -CEval4 / sin_theta; - data->my_en.e_ang += e_ang = - f7_ij * f7_jk * f8_Dj * expval12theta; - /* END ANGLE ENERGY*/ + data->my_en.e_ang += e_ang = + f7_ij * f7_jk * f8_Dj * expval12theta; + /* END ANGLE ENERGY*/ - /* PENALTY ENERGY */ - p_pen1 = thbp->p_pen1; - p_pen2 = system->reax_param.gp.l[19]; - p_pen3 = system->reax_param.gp.l[20]; - p_pen4 = system->reax_param.gp.l[21]; + /* PENALTY ENERGY */ + p_pen1 = thbp->p_pen1; + p_pen2 = system->reax_param.gp.l[19]; + p_pen3 = system->reax_param.gp.l[20]; + p_pen4 = system->reax_param.gp.l[21]; - exp_pen2ij = exp( -p_pen2 * SQR( BOA_ij - 2.0 ) ); - exp_pen2jk = exp( -p_pen2 * SQR( BOA_jk - 2.0 ) ); - exp_pen3 = exp( -p_pen3 * workspace->Delta[j] ); - exp_pen4 = exp( p_pen4 * workspace->Delta[j] ); - trm_pen34 = 1.0 + exp_pen3 + exp_pen4; - f9_Dj = ( 2.0 + exp_pen3 ) / trm_pen34; - Cf9j = ( -p_pen3 * exp_pen3 * trm_pen34 - - (2.0 + exp_pen3) * ( -p_pen3 * exp_pen3 + - p_pen4 * exp_pen4 ) ) / - SQR( trm_pen34 ); + exp_pen2ij = exp( -p_pen2 * SQR( BOA_ij - 2.0 ) ); + exp_pen2jk = exp( -p_pen2 * SQR( BOA_jk - 2.0 ) ); + exp_pen3 = exp( -p_pen3 * workspace->Delta[j] ); + exp_pen4 = exp( p_pen4 * workspace->Delta[j] ); + trm_pen34 = 1.0 + exp_pen3 + exp_pen4; + f9_Dj = ( 2.0 + exp_pen3 ) / trm_pen34; + Cf9j = ( -p_pen3 * exp_pen3 * trm_pen34 - + (2.0 + exp_pen3) * ( -p_pen3 * exp_pen3 + + p_pen4 * exp_pen4 ) ) / + SQR( trm_pen34 ); - data->my_en.e_pen += e_pen = - p_pen1 * f9_Dj * exp_pen2ij * exp_pen2jk; + data->my_en.e_pen += e_pen = + p_pen1 * f9_Dj * exp_pen2ij * exp_pen2jk; - CEpen1 = e_pen * Cf9j / f9_Dj; - temp = -2.0 * p_pen2 * e_pen; - CEpen2 = temp * (BOA_ij - 2.0); - CEpen3 = temp * (BOA_jk - 2.0); - /* END PENALTY ENERGY */ + CEpen1 = e_pen * Cf9j / f9_Dj; + temp = -2.0 * p_pen2 * e_pen; + CEpen2 = temp * (BOA_ij - 2.0); + CEpen3 = temp * (BOA_jk - 2.0); + /* END PENALTY ENERGY */ - /* COALITION ENERGY */ - p_coa1 = thbp->p_coa1; - p_coa2 = system->reax_param.gp.l[2]; - p_coa3 = system->reax_param.gp.l[38]; - p_coa4 = system->reax_param.gp.l[30]; + /* COALITION ENERGY */ + p_coa1 = thbp->p_coa1; + p_coa2 = system->reax_param.gp.l[2]; + p_coa3 = system->reax_param.gp.l[38]; + p_coa4 = system->reax_param.gp.l[30]; - exp_coa2 = exp( p_coa2 * workspace->Delta_val[j] ); - data->my_en.e_coa += e_coa = - p_coa1 / (1. + exp_coa2) * - exp( -p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij) ) * - exp( -p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk) ) * - exp( -p_coa4 * SQR(BOA_ij - 1.5) ) * - exp( -p_coa4 * SQR(BOA_jk - 1.5) ); + exp_coa2 = exp( p_coa2 * workspace->Delta_val[j] ); + data->my_en.e_coa += e_coa = + p_coa1 / (1. + exp_coa2) * + exp( -p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij) ) * + exp( -p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk) ) * + exp( -p_coa4 * SQR(BOA_ij - 1.5) ) * + exp( -p_coa4 * SQR(BOA_jk - 1.5) ); - CEcoa1 = -2 * p_coa4 * (BOA_ij - 1.5) * e_coa; - CEcoa2 = -2 * p_coa4 * (BOA_jk - 1.5) * e_coa; - CEcoa3 = -p_coa2 * exp_coa2 * e_coa / (1 + exp_coa2); - CEcoa4 = -2 * p_coa3 * - (workspace->total_bond_order[i]-BOA_ij) * e_coa; - CEcoa5 = -2 * p_coa3 * - (workspace->total_bond_order[k]-BOA_jk) * e_coa; - /* END COALITION ENERGY */ + CEcoa1 = -2 * p_coa4 * (BOA_ij - 1.5) * e_coa; + CEcoa2 = -2 * p_coa4 * (BOA_jk - 1.5) * e_coa; + CEcoa3 = -p_coa2 * exp_coa2 * e_coa / (1 + exp_coa2); + CEcoa4 = -2 * p_coa3 * + (workspace->total_bond_order[i]-BOA_ij) * e_coa; + CEcoa5 = -2 * p_coa3 * + (workspace->total_bond_order[k]-BOA_jk) * e_coa; + /* END COALITION ENERGY */ - /* FORCES */ - bo_ij->Cdbo += (CEval1 + CEpen2 + (CEcoa1 - CEcoa4)); - bo_jk->Cdbo += (CEval2 + CEpen3 + (CEcoa2 - CEcoa5)); - workspace->CdDelta[j] += ((CEval3 + CEval7) + CEpen1 + CEcoa3); - workspace->CdDelta[i] += CEcoa4; - workspace->CdDelta[k] += CEcoa5; + /* FORCES */ + bo_ij->Cdbo += (CEval1 + CEpen2 + (CEcoa1 - CEcoa4)); + bo_jk->Cdbo += (CEval2 + CEpen3 + (CEcoa2 - CEcoa5)); + workspace->CdDelta[j] += ((CEval3 + CEval7) + CEpen1 + CEcoa3); + workspace->CdDelta[i] += CEcoa4; + workspace->CdDelta[k] += CEcoa5; - for (t = start_j; t < end_j; ++t) { + for (t = start_j; t < end_j; ++t) { pbond_jt = &( bonds->select.bond_list[t] ); bo_jt = &(pbond_jt->bo_data); temp_bo_jt = bo_jt->BO; @@ -355,58 +344,59 @@ void Valence_Angles( reax_system *system, control_params *control, bo_jt->Cdbo += (CEval6 * pBOjt7); bo_jt->Cdbopi += CEval5; bo_jt->Cdbopi2 += CEval5; - } + } - if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], CEval8, p_ijk->dcos_di ); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); - rvec_ScaledAdd( workspace->f[k], CEval8, p_ijk->dcos_dk ); - } else { - rvec_Scale( force, CEval8, p_ijk->dcos_di ); - rvec_Add( workspace->f[i], force ); + if (control->virial == 0) { + rvec_ScaledAdd( workspace->f[i], CEval8, p_ijk->dcos_di ); + rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); + rvec_ScaledAdd( workspace->f[k], CEval8, p_ijk->dcos_dk ); + } else { + rvec_Scale( force, CEval8, p_ijk->dcos_di ); + rvec_Add( workspace->f[i], force ); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); + rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); - rvec_Scale( force, CEval8, p_ijk->dcos_dk ); - rvec_Add( workspace->f[k], force ); - } + rvec_Scale( force, CEval8, p_ijk->dcos_dk ); + rvec_Add( workspace->f[k], force ); + } - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + /* tally into per-atom virials */ + if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - /* Acquire vectors */ - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[k].x, - -1., system->my_atoms[j].x ); + /* Acquire vectors */ + rvec_ScaledSum( delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x ); + rvec_ScaledSum( delkj, 1., system->my_atoms[k].x, + -1., system->my_atoms[j].x ); - rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di ); - rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj ); - rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk ); + rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di ); + rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj ); + rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk ); - eng_tmp = e_ang + e_pen + e_coa; + eng_tmp = e_ang + e_pen + e_coa; - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(j,j,system->N,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); - if (system->pair_ptr->vflag_atom) - system->pair_ptr->v_tally3(i,j,k,fi_tmp,fk_tmp,delij,delkj); + if (system->pair_ptr->evflag) + system->pair_ptr->ev_tally(j,j,system->N,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); + if (system->pair_ptr->vflag_atom) + system->pair_ptr->v_tally3(i,j,k,fi_tmp,fk_tmp,delij,delkj); + } } } } } } - } - Set_End_Index(pi, num_thb_intrs, thb_intrs ); + Set_End_Index(pi, num_thb_intrs, thb_intrs ); + } + } + + if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { + workspace->realloc.num_3body = num_thb_intrs; + if (num_thb_intrs > thb_intrs->num_intrs) + control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " + "angle_list: top={}, max={}", + data->step, num_thb_intrs, + thb_intrs->num_intrs)); } } - - if (num_thb_intrs >= thb_intrs->num_intrs * DANGER_ZONE) { - workspace->realloc.num_3body = num_thb_intrs; - if (num_thb_intrs > thb_intrs->num_intrs) - control->error_ptr->one(FLERR, fmt::format("step {}: ran out of space on " - "angle_list: top={}, max={}", - data->step, num_thb_intrs, - thb_intrs->num_intrs)); - } } diff --git a/src/USER-REAXC/reaxc_valence_angles.h b/src/USER-REAXC/reaxc_valence_angles.h deleted file mode 100644 index 31936ba190..0000000000 --- a/src/USER-REAXC/reaxc_valence_angles.h +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __VALENCE_ANGLES_H_ -#define __VALENCE_ANGLES_H_ - -#include "reaxc_types.h" - -void Valence_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); - -void Calculate_Theta( rvec, double, rvec, double, double*, double* ); - -void Calculate_dCos_Theta( rvec, double, rvec, double, rvec*, rvec*, rvec* ); - -#endif diff --git a/src/USER-REAXC/reaxc_vector.cpp b/src/USER-REAXC/reaxc_vector.cpp deleted file mode 100644 index 2f06b57c02..0000000000 --- a/src/USER-REAXC/reaxc_vector.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#include "reaxc_vector.h" -#include -#include "reaxc_defs.h" - -void rvec_Copy( rvec dest, rvec src ) -{ - dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; -} - - -void rvec_Scale( rvec ret, double c, rvec v ) -{ - ret[0] = c * v[0], ret[1] = c * v[1], ret[2] = c * v[2]; -} - - -void rvec_Add( rvec ret, rvec v ) -{ - ret[0] += v[0], ret[1] += v[1], ret[2] += v[2]; -} - - -void rvec_ScaledAdd( rvec ret, double c, rvec v ) -{ - ret[0] += c * v[0], ret[1] += c * v[1], ret[2] += c * v[2]; -} - - -void rvec_ScaledSum( rvec ret, double c1, rvec v1 ,double c2, rvec v2 ) -{ - ret[0] = c1 * v1[0] + c2 * v2[0]; - ret[1] = c1 * v1[1] + c2 * v2[1]; - ret[2] = c1 * v1[2] + c2 * v2[2]; -} - - -double rvec_Dot( rvec v1, rvec v2 ) -{ - return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; -} - - -void rvec_iMultiply( rvec r, ivec v1, rvec v2 ) -{ - r[0] = v1[0] * v2[0]; - r[1] = v1[1] * v2[1]; - r[2] = v1[2] * v2[2]; -} - - -void rvec_Cross( rvec ret, rvec v1, rvec v2 ) -{ - ret[0] = v1[1] * v2[2] - v1[2] * v2[1]; - ret[1] = v1[2] * v2[0] - v1[0] * v2[2]; - ret[2] = v1[0] * v2[1] - v1[1] * v2[0]; -} - - -double rvec_Norm_Sqr( rvec v ) -{ - return SQR(v[0]) + SQR(v[1]) + SQR(v[2]); -} - - -double rvec_Norm( rvec v ) -{ - return sqrt( SQR(v[0]) + SQR(v[1]) + SQR(v[2]) ); -} - - -void rvec_MakeZero( rvec v ) -{ - v[0] = v[1] = v[2] = 0.000000000000000e+00; -} - - -void ivec_MakeZero( ivec v ) -{ - v[0] = v[1] = v[2] = 0; -} - - -void ivec_Copy( ivec dest, ivec src ) -{ - dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; -} - - -void ivec_Scale( ivec dest, double C, ivec src ) -{ - dest[0] = (int)(C * src[0]); - dest[1] = (int)(C * src[1]); - dest[2] = (int)(C * src[2]); -} - - -void ivec_Sum( ivec dest, ivec v1, ivec v2 ) -{ - dest[0] = v1[0] + v2[0]; - dest[1] = v1[1] + v2[1]; - dest[2] = v1[2] + v2[2]; -} - - diff --git a/src/USER-REAXC/reaxc_vector.h b/src/USER-REAXC/reaxc_vector.h deleted file mode 100644 index 3dc36f96ef..0000000000 --- a/src/USER-REAXC/reaxc_vector.h +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#ifndef __VECTOR_H_ -#define __VECTOR_H_ - -#include "reaxc_types.h" - -void rvec_Copy( rvec, rvec ); -void rvec_Scale( rvec, double, rvec ); -void rvec_Add( rvec, rvec ); -void rvec_ScaledAdd( rvec, double, rvec ); -void rvec_ScaledSum( rvec, double, rvec, double, rvec ); -double rvec_Dot( rvec, rvec ); -void rvec_iMultiply( rvec, ivec, rvec ); -void rvec_Cross( rvec, rvec, rvec ); -double rvec_Norm_Sqr( rvec ); -double rvec_Norm( rvec ); -void rvec_MakeZero( rvec ); -void rvec_Random( rvec ); - -void ivec_MakeZero( ivec ); -void ivec_Copy( ivec, ivec ); -void ivec_Scale( ivec, double, ivec ); -void ivec_Sum( ivec, ivec, ivec ); - -#endif diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index 19f345636f..36579e83e4 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -39,14 +39,29 @@ namespace ReaxFF // exported Functions - // allocate + // allocate X + extern void Allocate_Workspace(control_params *, storage *, int); extern void DeAllocate_System(reax_system *); extern void DeAllocate_Workspace(control_params *, storage *); - extern int PreAllocate_Space(reax_system *, control_params *, storage *); + extern void PreAllocate_Space(reax_system *, storage *); extern void ReAllocate(reax_system *, control_params *, simulation_data *, storage *, reax_list **); + // bond orders + + extern void BO(reax_system *, control_params *, simulation_data *, + storage *, reax_list **, output_controls *); + extern int BOp(storage *, reax_list *, double, int, int, far_neighbor_data *, + single_body_parameters *, single_body_parameters *, + two_body_parameters *); + extern void Add_dBond_to_Forces(reax_system*, int, int, storage*, reax_list**); + extern void Add_dBond_to_Forces_NPT(int, int, storage*, reax_list**); + + // bonds + + extern void Bonds(reax_system *, simulation_data *, storage *, reax_list **); + // control extern void Read_Control_File(const char *, control_params *, output_controls *); @@ -59,20 +74,35 @@ namespace ReaxFF extern void Compute_Forces(reax_system *, control_params *, simulation_data *, storage *, reax_list **, output_controls *); + extern void Estimate_Storages(reax_system *, control_params *, reax_list **, + int *, int *, int *, int *); + // hydrogen bonds + + extern void Hydrogen_Bonds(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); // init md + extern void Init_System(reax_system *, control_params *); + extern void Init_Simulation_Data(simulation_data *); + extern void Init_Workspace(reax_system *, control_params *, storage *); extern void Initialize(reax_system *, control_params *, simulation_data *, storage *, reax_list **, output_controls *, MPI_Comm); // io tools + extern void Init_Output_Files(reax_system *, control_params *, + output_controls *, MPI_Comm); extern void Close_Output_Files(reax_system *, output_controls *); extern void Output_Results(reax_system *, control_params *, simulation_data *, reax_list **, output_controls *, MPI_Comm); + extern void Collect_System_Energy(reax_system *, simulation_data *, MPI_Comm); // lists + extern int Make_List(int, int, int, reax_list *); + extern void Delete_List(reax_list*); + inline int Start_Index(int i, reax_list *l) { return l->index[i]; } inline int End_Index(int i, reax_list *l) { return l->end_index[i]; } inline void Set_Start_Index(int i, int val, reax_list *l) { @@ -81,11 +111,14 @@ namespace ReaxFF inline void Set_End_Index(int i, int val, reax_list *l) { l->end_index[i] = val; } - extern void Delete_List(reax_list*); - extern int Make_List(int, int, int, reax_list *); + inline int Num_Entries(int i, reax_list *l) { + return l->end_index[i] - l->index[i]; + } // lookup + extern void Init_Lookup_Tables(reax_system *, control_params *, + storage *, MPI_Comm); extern void Deallocate_Lookup_Tables(reax_system *); extern void Natural_Cubic_Spline(LAMMPS_NS::Error*, const double *, const double *, cubic_spline_coef *, @@ -94,17 +127,60 @@ namespace ReaxFF const double *, double v0, double vlast, cubic_spline_coef *coef, unsigned int n); + // multi body + + extern void Atom_Energy(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + + // nonbonded + + extern void Compute_Polarization_Energy(reax_system *, simulation_data *); + extern void vdW_Coulomb_Energy(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); + extern void Tabulated_vdW_Coulomb_Energy(reax_system *, control_params *, + simulation_data *, storage *, + reax_list **); + extern void LR_vdW_Coulomb(reax_system *, storage *, control_params *, + int, int, double, LR_data *); + // reset tools extern void Reset(reax_system *, control_params *, simulation_data *, storage *, reax_list **); - + extern void Reset_Simulation_Data(simulation_data *); + extern void Reset_Workspace(reax_system *, storage *); + // toolbox extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const char *); extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const char *); extern void sfree(LAMMPS_NS::Error *, void *, const char *); + // torsion angles + + extern double Calculate_Omega(rvec, double, rvec, double, rvec, double, + rvec, double, three_body_interaction_data *, + three_body_interaction_data *, rvec, rvec, + rvec, rvec); + extern void Torsion_Angles(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + + // traj + + extern void Init_Traj(reax_system *, control_params *, + output_controls *, MPI_Comm); + extern void End_Traj(int, output_controls *); + extern void Append_Frame(reax_system *, control_params *, simulation_data *, + reax_list **, output_controls *, MPI_Comm); + + // valence angles + + extern void Calculate_Theta(rvec, double, rvec, double, double *, double *); + extern void Calculate_dCos_Theta(rvec, double, rvec, double, + rvec *, rvec *, rvec *); + extern void Valence_Angles(reax_system *, control_params *, simulation_data *, + storage *, reax_list **); + // vector inline void rvec_Add(rvec ret, rvec v) { @@ -146,6 +222,24 @@ namespace ReaxFF } inline void ivec_MakeZero(ivec v) { v[0] = v[1] = v[2] = 0; } + + inline void ivec_Copy(ivec dest, ivec src) { + dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; + } + + inline void ivec_Scale(ivec dest, double C, ivec src) + { + dest[0] = (int)(C * src[0]); + dest[1] = (int)(C * src[1]); + dest[2] = (int)(C * src[2]); + } + + inline void ivec_Sum(ivec dest, ivec v1, ivec v2) + { + dest[0] = v1[0] + v2[0]; + dest[1] = v1[1] + v2[1]; + dest[2] = v1[2] + v2[2]; + } } #endif diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index 3bd3ad899b..f8cc255fd9 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -59,7 +59,6 @@ #define MAX_TOKENS 1024 #define MAX_TOKEN_LEN 1024 -#define NUM_INTRS 10 #define ALMOST_ZERO 1e-10 #define NEG_INF -1e10 #define NO_BOND 1e-3 // 0.001 diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index 544e67fbf2..c04d886656 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -123,6 +123,13 @@ namespace ReaxFF double v13cor, ovc; }; + struct dbond_coefficients { + double C1dbo, C2dbo, C3dbo; + double C1dbopi, C2dbopi, C3dbopi, C4dbopi; + double C1dbopi2, C2dbopi2, C3dbopi2, C4dbopi2; + double C1dDelta, C2dDelta, C3dDelta; + }; + /* 3-body parameters */ struct three_body_parameters { /* valence angle */ @@ -424,12 +431,6 @@ namespace ReaxFF cubic_spline_coef *vdW, *CEvd; cubic_spline_coef *ele, *CEclmb; }; - -/* function pointer defs */ - - typedef void (*interaction_function) (reax_system *, control_params *, - simulation_data *, storage *, - reax_list **, output_controls *); } #endif From eb4d7efd32d22c684c1066ca54a9ee88eb48551c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 02:27:45 -0400 Subject: [PATCH 029/119] silence compiler warning --- src/SPIN/pair_spin_exchange_biquadratic.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/SPIN/pair_spin_exchange_biquadratic.cpp b/src/SPIN/pair_spin_exchange_biquadratic.cpp index a00d1cc8b0..3c5a95e3dd 100644 --- a/src/SPIN/pair_spin_exchange_biquadratic.cpp +++ b/src/SPIN/pair_spin_exchange_biquadratic.cpp @@ -473,16 +473,13 @@ double PairSpinExchangeBiquadratic::compute_energy(int i, int j, double rsq, { int *type = atom->type; int itype,jtype; - double Jex,Kex,ra,sdots; - double rj,rk,r2j,r2k; + double Jex,Kex,sdots; + double r2j,r2k; double energy = 0.0; itype = type[i]; jtype = type[j]; - ra = sqrt(rsq); - rj = ra/J3[itype][jtype]; r2j = rsq/J3[itype][jtype]/J3[itype][jtype]; - rk = ra/K3[itype][jtype]; r2k = rsq/K3[itype][jtype]/K3[itype][jtype]; Jex = 4.0*J1_mech[itype][jtype]*r2j; From dcdb5cc0e0657cca9f75cdee4067f57156c974f2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 02:28:32 -0400 Subject: [PATCH 030/119] whitespace fixes --- src/USER-OMP/reaxc_forces_omp.cpp | 29 ++++++++++------------- src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 2 +- src/USER-OMP/reaxc_torsion_angles_omp.cpp | 2 +- src/USER-OMP/reaxff_omp.h | 8 +++---- src/USER-REAXC/reaxc_ffield.cpp | 2 +- src/USER-REAXC/reaxc_forces.cpp | 2 +- src/USER-REAXC/reaxc_io_tools.cpp | 2 +- src/USER-REAXC/reaxc_list.cpp | 2 +- src/USER-REAXC/reaxc_multi_body.cpp | 2 +- src/USER-REAXC/reaxc_reset_tools.cpp | 2 +- src/USER-REAXC/reaxc_tool_box.cpp | 2 +- src/USER-REAXC/reaxc_traj.cpp | 2 +- src/USER-REAXC/reaxc_valence_angles.cpp | 2 +- src/USER-REAXC/reaxff_api.h | 8 +++---- src/USER-REAXC/reaxff_defs.h | 2 +- src/USER-REAXC/reaxff_inline.h | 2 +- src/USER-REAXC/reaxff_types.h | 2 +- 17 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 566edf7d05..29b70c10a4 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -41,9 +41,9 @@ using namespace LAMMPS_NS; namespace ReaxFF { /* ---------------------------------------------------------------------- */ - void Compute_Bonded_ForcesOMP(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + static void Compute_Bonded_ForcesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists, output_controls *out_control) { BOOMP(system, control, data, workspace, lists, out_control); @@ -55,10 +55,9 @@ namespace ReaxFF { Hydrogen_BondsOMP(system, control, data, workspace, lists); } -// Only difference with MPI-only version is inclusion of OMP_TIMING statements - void Compute_NonBonded_ForcesOMP(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + static void Compute_NonBonded_ForcesOMP(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, + reax_list **lists) { /* van der Waals and Coulomb interactions */ @@ -73,8 +72,8 @@ namespace ReaxFF { /* this version of Compute_Total_Force computes forces from coefficients accumulated by all interaction functions. Saves enormous time & space! */ - void Compute_Total_ForceOMP(reax_system *system, control_params *control, - storage *workspace, reax_list **lists) + static void Compute_Total_ForceOMP(reax_system *system, control_params *control, + storage *workspace, reax_list **lists) { int natoms = system->N; int nthreads = control->nthreads; @@ -172,7 +171,7 @@ namespace ReaxFF { /* ---------------------------------------------------------------------- */ - void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list **lists, + static void Validate_ListsOMP(reax_system *system, reax_list **lists, int step, int n, int N, int numH) { int comp, Hindex; @@ -469,9 +468,8 @@ namespace ReaxFF { workspace->realloc.num_bonds = num_bonds; workspace->realloc.num_hbonds = num_hbonds; - Validate_ListsOMP(system, workspace, lists, data->step, - system->n, system->N, system->numH); - + Validate_ListsOMP(system, lists, data->step, + system->n, system->N, system->numH); } /* ---------------------------------------------------------------------- */ @@ -485,11 +483,10 @@ namespace ReaxFF { // Bonded Interactions Compute_Bonded_ForcesOMP(system, control, data, workspace, - lists, out_control); + lists, out_control); // Nonbonded Interactions - Compute_NonBonded_ForcesOMP(system, control, data, workspace, - lists, out_control); + Compute_NonBonded_ForcesOMP(system, control, data, workspace, lists); // Total Force Compute_Total_ForceOMP(system, control, workspace, lists); diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index b2bd04d82a..8c9ffe577e 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; namespace ReaxFF { - + /* ---------------------------------------------------------------------- */ void Hydrogen_BondsOMP( reax_system *system, control_params *control, diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index f8c8d4262c..6f01d269eb 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; namespace ReaxFF { - + /* ---------------------------------------------------------------------- */ void Torsion_AnglesOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, diff --git a/src/USER-OMP/reaxff_omp.h b/src/USER-OMP/reaxff_omp.h index 630fe07a43..952b1a292e 100644 --- a/src/USER-OMP/reaxff_omp.h +++ b/src/USER-OMP/reaxff_omp.h @@ -27,7 +27,7 @@ #include #endif -namespace ReaxFF +namespace ReaxFF { // exported Functions @@ -42,9 +42,9 @@ namespace ReaxFF extern void BOOMP(reax_system *, control_params *, simulation_data *, storage *, reax_list **, output_controls *); - + // bonds OpenMP - + extern void BondsOMP(reax_system *, simulation_data *, storage *, reax_list **); @@ -55,7 +55,7 @@ namespace ReaxFF reax_list **, output_controls *); // hydrogen bonds - + extern void Hydrogen_BondsOMP(reax_system *, control_params *, simulation_data *, storage *, reax_list **); diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 88381040c2..b60022dd03 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -41,7 +41,7 @@ using LAMMPS_NS::utils::getsyserror; namespace ReaxFF { extern int Tokenize(char* s, char*** tok); - + void Read_Force_Field(const char *filename, reax_interaction *reax, control_params *control) { diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index ebc042ebe5..a2e01db478 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -33,7 +33,7 @@ #include "error.h" namespace ReaxFF { - + static void Compute_Bonded_Forces(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control) diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 6ca0b29b6e..d6fd4b3aa4 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -62,7 +62,7 @@ namespace ReaxFF { data->sys_en.e_ele = sys_en[11]; data->sys_en.e_pol = sys_en[12]; } - } + } void Init_Output_Files(reax_system *system, control_params *control, output_controls *out_control, MPI_Comm world) diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 94d4a0a4b5..db57aa4f40 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -29,7 +29,7 @@ #include "error.h" namespace ReaxFF { - + /************* allocate list space ******************/ int Make_List(int n, int num_intrs, int type, reax_list *l) { diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index f2e629c65c..09fb848a08 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -32,7 +32,7 @@ #include namespace ReaxFF { - + void Atom_Energy(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists) { diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index a2276023a4..bb0fc1eb5a 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -32,7 +32,7 @@ #include namespace ReaxFF { - + static void Reset_Atoms(reax_system* system, control_params *control) { int i; diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index ab8ba6317c..bfaa6b94aa 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -33,7 +33,7 @@ #include "error.h" namespace ReaxFF { - + int Tokenize(char* s, char*** tok) { char test[MAX_LINE]; diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index f134713936..91afc9e8d1 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -48,7 +48,7 @@ #define ANGLE_BASIC_LEN 38 namespace ReaxFF { - + enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index 9c1bf15c4b..e1a535e193 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -31,7 +31,7 @@ #include "pair.h" #include "error.h" -namespace ReaxFF { +namespace ReaxFF { void Calculate_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, double *theta, double *cos_theta ) { diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index 36579e83e4..c52fa8a711 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -25,7 +25,7 @@ #include -namespace ReaxFF +namespace ReaxFF { // per instance data struct API { @@ -61,7 +61,7 @@ namespace ReaxFF // bonds extern void Bonds(reax_system *, simulation_data *, storage *, reax_list **); - + // control extern void Read_Control_File(const char *, control_params *, output_controls *); @@ -78,7 +78,7 @@ namespace ReaxFF int *, int *, int *, int *); // hydrogen bonds - + extern void Hydrogen_Bonds(reax_system *, control_params *, simulation_data *, storage *, reax_list **); // init md @@ -149,7 +149,7 @@ namespace ReaxFF storage *, reax_list **); extern void Reset_Simulation_Data(simulation_data *); extern void Reset_Workspace(reax_system *, storage *); - + // toolbox extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const char *); diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index f8cc255fd9..b3d3d4acdd 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -90,7 +90,7 @@ #define REAX_MAX_4BODY_PARAM 5 #define REAX_MAX_ATOM_TYPES 25 -namespace ReaxFF +namespace ReaxFF { /******************* ENUMERATORS *************************/ diff --git a/src/USER-REAXC/reaxff_inline.h b/src/USER-REAXC/reaxff_inline.h index 9a4a2159f6..ba9927e5d3 100644 --- a/src/USER-REAXC/reaxff_inline.h +++ b/src/USER-REAXC/reaxff_inline.h @@ -23,7 +23,7 @@ #include "accelerator_kokkos.h" // for LAMMPS_INLINE -namespace ReaxFF +namespace ReaxFF { struct LR_data { diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index c04d886656..56bbbe43b7 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -33,7 +33,7 @@ namespace LAMMPS_NS { class Pair; } -namespace ReaxFF +namespace ReaxFF { /********************** TYPE DEFINITIONS ********************/ typedef int ivec[3]; From 1c6db4b0cb745ede9d4127fffde9dbc2ac98e5f3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 02:51:18 -0400 Subject: [PATCH 031/119] some more smaller tweaks --- src/USER-OMP/pair_reaxc_omp.cpp | 4 +- src/USER-OMP/reaxc_init_md_omp.cpp | 22 +++------- src/USER-REAXC/pair_reaxc.cpp | 5 +-- src/USER-REAXC/reaxc_allocate.cpp | 66 +++++++++++++----------------- src/USER-REAXC/reaxc_init_md.cpp | 32 +++------------ src/USER-REAXC/reaxc_list.cpp | 4 +- src/USER-REAXC/reaxff_api.h | 2 +- src/USER-REAXC/reaxff_defs.h | 7 ---- 8 files changed, 44 insertions(+), 98 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 5693bef5e6..0f8ae18009 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -389,9 +389,7 @@ void PairReaxCOMP::setup() write_reax_atoms(); int num_nbrs = estimate_reax_lists(); - if (!Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - api->lists+FAR_NBRS)) - error->all(FLERR,"Pair reax/c problem in far neighbor list"); + Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, api->lists+FAR_NBRS); write_reax_lists(); diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index 94458d2691..eb81fe8280 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -37,8 +37,8 @@ /* ---------------------------------------------------------------------- */ namespace ReaxFF { - int Init_ListsOMP(reax_system *system, control_params *control, - reax_list **lists) + static void Init_ListsOMP(reax_system *system, control_params *control, + reax_list **lists) { int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int *hb_top, *bond_top; @@ -62,10 +62,7 @@ namespace ReaxFF { } total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS)) { - error->one(FLERR, "Not enough space for hbonds list. Terminating!"); - } + Make_List(system->Hcap, total_hbonds, TYP_HBOND,*lists+HBONDS); } total_bonds = 0; @@ -75,10 +72,7 @@ namespace ReaxFF { } bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - if (!Make_List(system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS)) { - error->one(FLERR, "Not enough space for bonds list. Terminating!\n"); - } + Make_List(system->total_cap, bond_cap, TYP_BOND,*lists+BONDS); int nthreads = control->nthreads; reax_list *bonds = (*lists)+BONDS; @@ -89,16 +83,10 @@ namespace ReaxFF { /* 3bodies list */ cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES)) { - - error->one(FLERR, "Problem in initializing angles list. Terminating!"); - } + Make_List(bond_cap, cap_3body, TYP_THREE_BODY,*lists+THREE_BODIES); free(hb_top); free(bond_top); - - return SUCCESS; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index aa445d765d..26c7428245 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -423,9 +423,8 @@ void PairReaxC::setup() int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) error->all(FLERR,"Too many neighbors for pair style reax/c"); - if (!Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - api->lists+FAR_NBRS)) - error->all(FLERR,"Pair reax/c problem in far neighbor list"); + Make_List(api->system->total_cap, num_nbrs, + TYP_FAR_NEIGHBOR, api->lists+FAR_NBRS); (api->lists+FAR_NBRS)->error_ptr=error; write_reax_lists(); diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 143da54849..9ee2a1d3a1 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -65,13 +65,13 @@ namespace ReaxFF { auto error = system->error_ptr; // deallocate the atom list - sfree(error, system->my_atoms, "system->my_atoms"); + sfree(error, system->my_atoms, "system->my_atoms"); // deallocate the ffield parameters storage ff_params = &(system->reax_param); ntypes = ff_params->num_atom_types; - sfree(error, ff_params->gp.l, "ff:globals"); + sfree(error, ff_params->gp.l, "ff:globals"); for (i = 0; i < ntypes; ++i) { for (j = 0; j < ntypes; ++j) { @@ -104,27 +104,27 @@ namespace ReaxFF { auto error = control->error_ptr; /* bond order storage */ - sfree(error, workspace->total_bond_order, "total_bo"); - sfree(error, workspace->Deltap, "Deltap"); - sfree(error, workspace->Deltap_boc, "Deltap_boc"); - sfree(error, workspace->dDeltap_self, "dDeltap_self"); - sfree(error, workspace->Delta, "Delta"); - sfree(error, workspace->Delta_lp, "Delta_lp"); - sfree(error, workspace->Delta_lp_temp, "Delta_lp_temp"); - sfree(error, workspace->dDelta_lp, "dDelta_lp"); - sfree(error, workspace->dDelta_lp_temp, "dDelta_lp_temp"); - sfree(error, workspace->Delta_e, "Delta_e"); - sfree(error, workspace->Delta_boc, "Delta_boc"); - sfree(error, workspace->Delta_val, "Delta_val"); - sfree(error, workspace->nlp, "nlp"); - sfree(error, workspace->nlp_temp, "nlp_temp"); - sfree(error, workspace->Clp, "Clp"); - sfree(error, workspace->vlpex, "vlpex"); - sfree(error, workspace->bond_mark, "bond_mark"); + sfree(error, workspace->total_bond_order, "total_bo"); + sfree(error, workspace->Deltap, "Deltap"); + sfree(error, workspace->Deltap_boc, "Deltap_boc"); + sfree(error, workspace->dDeltap_self, "dDeltap_self"); + sfree(error, workspace->Delta, "Delta"); + sfree(error, workspace->Delta_lp, "Delta_lp"); + sfree(error, workspace->Delta_lp_temp, "Delta_lp_temp"); + sfree(error, workspace->dDelta_lp, "dDelta_lp"); + sfree(error, workspace->dDelta_lp_temp, "dDelta_lp_temp"); + sfree(error, workspace->Delta_e, "Delta_e"); + sfree(error, workspace->Delta_boc, "Delta_boc"); + sfree(error, workspace->Delta_val, "Delta_val"); + sfree(error, workspace->nlp, "nlp"); + sfree(error, workspace->nlp_temp, "nlp_temp"); + sfree(error, workspace->Clp, "Clp"); + sfree(error, workspace->vlpex, "vlpex"); + sfree(error, workspace->bond_mark, "bond_mark"); /* force related storage */ - sfree(error, workspace->f, "f"); - sfree(error, workspace->CdDelta, "CdDelta"); + sfree(error, workspace->f, "f"); + sfree(error, workspace->CdDelta, "CdDelta"); /* reductions */ @@ -182,9 +182,7 @@ namespace ReaxFF { static void Reallocate_Neighbor_List(reax_list *far_nbrs, int n, int num_intrs) { Delete_List(far_nbrs); - if (!Make_List(n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs)) { - far_nbrs->error_ptr->one(FLERR,"Problem in initializing far neighbors list"); - } + Make_List(n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs); } static int Reallocate_HBonds_List(reax_system *system, reax_list *hbonds) @@ -202,15 +200,13 @@ namespace ReaxFF { total_hbonds = (int)(MAX(total_hbonds*saferzone, mincap*system->minhbonds)); Delete_List(hbonds); - if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, hbonds)) { - hbonds->error_ptr->one(FLERR, "Not enough space for hydrogen bonds list"); - } + Make_List(system->Hcap, total_hbonds, TYP_HBOND, hbonds); return total_hbonds; } - static int Reallocate_Bonds_List(control_params *control, reax_system *system, - reax_list *bonds, int *total_bonds, int *est_3body) + static void Reallocate_Bonds_List(control_params *control, reax_system *system, + reax_list *bonds, int *total_bonds, int *est_3body) { int i; @@ -230,16 +226,12 @@ namespace ReaxFF { sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); Delete_List(bonds); - if (!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds)) { - bonds->error_ptr->one(FLERR, "Not enough space for bonds list"); - } + Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds); if (system->omp_active) for (i = 0; i < bonds->num_intrs; ++i) bonds->select.bond_list[i].bo_data.CdboReduction = (double*) smalloc(system->error_ptr, sizeof(double)*control->nthreads, "CdboReduction"); - - return SUCCESS; } void ReAllocate(reax_system *system, control_params *control, @@ -325,10 +317,8 @@ namespace ReaxFF { wsr->num_3body = (int)(MAX(wsr->num_3body*safezone, MIN_3BODIES)); - if (!Make_List(num_bonds, wsr->num_3body, TYP_THREE_BODY, - (*lists)+THREE_BODIES)) { - error->one(FLERR, "Problem in initializing angles list"); - } + Make_List(num_bonds, wsr->num_3body, TYP_THREE_BODY, + (*lists)+THREE_BODIES); wsr->num_3body = -1; } } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 8704852a64..adc9bc137d 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -115,7 +115,7 @@ namespace ReaxFF { Init_Taper(control, workspace); } - static int Init_Lists(reax_system *system, control_params *control, reax_list **lists) + static void Init_Lists(reax_system *system, control_params *control, reax_list **lists) { int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int *hb_top, *bond_top; @@ -123,7 +123,6 @@ namespace ReaxFF { int mincap = system->mincap; double safezone = system->safezone; double saferzone = system->saferzone; - LAMMPS_NS::Error *error = system->error_ptr; bond_top = (int*) calloc(system->total_cap, sizeof(int)); hb_top = (int*) calloc(system->local_cap, sizeof(int)); @@ -139,10 +138,7 @@ namespace ReaxFF { } total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS)) - error->one(FLERR, "Not enough space for hbonds list."); - + Make_List(system->Hcap, total_hbonds, TYP_HBOND,*lists+HBONDS); (*lists+HBONDS)->error_ptr = system->error_ptr; } @@ -153,24 +149,16 @@ namespace ReaxFF { } bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - if (!Make_List(system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS)) - error->one(FLERR, "Not enough space for bonds list."); - + Make_List(system->total_cap, bond_cap, TYP_BOND,*lists+BONDS); (*lists+BONDS)->error_ptr = system->error_ptr; /* 3bodies list */ cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES)) - error->one(FLERR,"Problem in initializing angles list."); - + Make_List(bond_cap, cap_3body, TYP_THREE_BODY,*lists+THREE_BODIES); (*lists+THREE_BODIES)->error_ptr = system->error_ptr; free(hb_top); free(bond_top); - - return SUCCESS; } void Initialize(reax_system *system, control_params *control, @@ -178,19 +166,11 @@ namespace ReaxFF { reax_list **lists, output_controls *out_control, MPI_Comm world) { - char msg[MAX_STR]; - LAMMPS_NS::Error *error = system->error_ptr; - Init_System(system, control); Init_Simulation_Data(data); Init_Workspace(system, control, workspace); - - if (Init_Lists(system, control, lists) ==FAILURE) - error->one(FLERR,fmt::format("Error on: {}. System could not be " - "initialized. Terminating.",msg)); - - Init_Output_Files(system, control, out_control,world); - + Init_Lists(system, control, lists); + Init_Output_Files(system, control, out_control, world); if (control->tabulate) Init_Lookup_Tables(system, control, workspace, world); } diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index db57aa4f40..1063328f8e 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -31,7 +31,7 @@ namespace ReaxFF { /************* allocate list space ******************/ - int Make_List(int n, int num_intrs, int type, reax_list *l) + void Make_List(int n, int num_intrs, int type, reax_list *l) { l->allocated = 1; @@ -91,8 +91,6 @@ namespace ReaxFF { default: l->error_ptr->all(FLERR,fmt::format("No list type {} defined", l->type)); } - - return SUCCESS; } void Delete_List(reax_list *l) diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index c52fa8a711..dda2161c86 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -100,7 +100,7 @@ namespace ReaxFF // lists - extern int Make_List(int, int, int, reax_list *); + extern void Make_List(int, int, int, reax_list *); extern void Delete_List(reax_list*); inline int Start_Index(int i, reax_list *l) { return l->index[i]; } diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index b3d3d4acdd..917255c5f0 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -25,13 +25,6 @@ #define inline __inline__ #endif /*IBMC*/ -#ifndef SUCCESS -#define SUCCESS 1 -#endif -#ifndef FAILURE -#define FAILURE 0 -#endif - #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) #define DEG2RAD(a) ((a)*constPI/180.0) From 3b55872a18c4a69be5848526e525909269cf93d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 03:06:21 -0400 Subject: [PATCH 032/119] updates for legacy build system --- src/.gitignore | 33 +++++++++------------------------ src/Purge.list | 34 ++++++++++++++++++++++++++++++++++ src/USER-OMP/Install.sh | 2 ++ 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index 96a89ae667..818b9bfcae 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -544,6 +544,8 @@ /fix_bond_react.h /fix_bond_swap.cpp /fix_bond_swap.h +/fix_charge_regulation.cpp +/fix_charge_regulation.h /fix_client_md.cpp /fix_client_md.h /fix_cmap.cpp @@ -804,6 +806,8 @@ /gridcomm.h /group_ndx.cpp /group_ndx.h +/gz_file_writer.cpp +/gz_file_writer.h /ndx_group.cpp /ndx_group.h /hyper.cpp @@ -1178,6 +1182,7 @@ /python_impl.cpp /python_impl.h /python_compat.h +/python_utils.h /fix_python_move.cpp /fix_python_move.h /fix_python_invoke.cpp @@ -1189,49 +1194,29 @@ /reader_molfile.cpp /reader_molfile.h /reaxc_allocate.cpp -/reaxc_allocate.h /reaxc_basic_comm.cpp -/reaxc_basic_comm.h /reaxc_bond_orders.cpp -/reaxc_bond_orders.h /reaxc_bonds.cpp -/reaxc_bonds.h /reaxc_control.cpp -/reaxc_control.h -/reaxc_defs.h /reaxc_ffield.cpp /reaxc_ffield.h /reaxc_forces.cpp -/reaxc_forces.h /reaxc_hydrogen_bonds.cpp -/reaxc_hydrogen_bonds.h /reaxc_init_md.cpp -/reaxc_init_md.h /reaxc_io_tools.cpp -/reaxc_io_tools.h /reaxc_list.cpp -/reaxc_list.h /reaxc_lookup.cpp -/reaxc_lookup.h /reaxc_multi_body.cpp -/reaxc_multi_body.h /reaxc_nonbonded.cpp -/reaxc_nonbonded.h /reaxc_reset_tools.cpp -/reaxc_reset_tools.h -/reaxc_system_props.cpp -/reaxc_system_props.h /reaxc_tool_box.cpp -/reaxc_tool_box.h /reaxc_torsion_angles.cpp -/reaxc_torsion_angles.h /reaxc_traj.cpp -/reaxc_traj.h -/reaxc_types.h /reaxc_valence_angles.cpp -/reaxc_valence_angles.h -/reaxc_vector.cpp -/reaxc_vector.h +/reaxff_api.h +/reaxff_defs.h +/reaxff_inline.h +/reaxff_types.h /remap.cpp /remap.h /remap_wrap.cpp diff --git a/src/Purge.list b/src/Purge.list index 2853ce2a7c..17f7291a38 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -51,6 +51,40 @@ lmpinstalledpkgs.h lmpgitversion.h mliap_model_python_couple.cpp mliap_model_python_couple.h +# removed on 17 Apr 2021 +reaxc_allocate.h +reaxc_bond_orders.h +reaxc_bonds.h +reaxc_control.h +reaxc_defs.h +reaxc_ffield.h +reaxc_forces.h +reaxc_hydrogen_bonds.h +reaxc_init_md.h +reaxc_io_tools.h +reaxc_list.h +reaxc_lookup.h +reaxc_multi_body.h +reaxc_nonbonded.h +reaxc_reset_tools.h +reaxc_system_props.h +reaxc_system_props.cpp +reaxc_tool_box.h +reaxc_torsion_angles.h +reaxc_traj.h +reaxc_types.h +reaxc_valence_angles.h +reaxc_vector.h +reaxc_vector.cpp +reaxc_bond_orders_omp.h +reaxc_bonds_omp.h +reaxc_forces_omp.h +reaxc_hydrogen_bonds_omp.h +reaxc_init_md_omp.h +reaxc_multi_body_omp.h +reaxc_nonbonded_omp.h +reaxc_torsion_angles_omp.h +reaxc_valence_angles_omp.h # removed on 9 Sep 2020 mergesort.h # renamed on 8 May 2020 diff --git a/src/USER-OMP/Install.sh b/src/USER-OMP/Install.sh index bb4ef6c3aa..6d9423033e 100755 --- a/src/USER-OMP/Install.sh +++ b/src/USER-OMP/Install.sh @@ -37,10 +37,12 @@ done for file in *_omp.h; do test $file = thr_omp.h && continue + test $file = reaxff_omp.h && continue dep=${file%_omp.h}.h action $file $dep done +action reaxff_omp.h reaxff_api.h action thr_omp.h action thr_omp.cpp action thr_data.h From 04c5b23d90a10c7392b215bd436d8030fbe94aa1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 15:41:45 -0400 Subject: [PATCH 033/119] add custom constructor for TextFileReader that uses an already opened file descriptor --- src/text_file_reader.cpp | 14 +++++++++++++- src/text_file_reader.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 7a6e914639..57aaaf6bb5 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -41,7 +41,7 @@ using namespace LAMMPS_NS; * \param filetype Description of file type for error messages */ TextFileReader::TextFileReader(const std::string &filename, const std::string &filetype) - : filename(filename), filetype(filetype), ignore_comments(true) + : filetype(filetype), ignore_comments(true) { fp = fopen(filename.c_str(), "r"); @@ -51,6 +51,18 @@ TextFileReader::TextFileReader(const std::string &filename, const std::string &f } } +/** + * \overload + * + * \param fp File descriptor of the already opened file + * \param filetype Description of file type for error messages */ + +TextFileReader::TextFileReader(FILE *fp, const std::string &filetype) + : filetype(filetype), fp(fp), ignore_comments(true) +{ + if (fp == nullptr) throw FileReaderException("Invalid file descriptor"); +} + /** Closes the file */ TextFileReader::~TextFileReader() { diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 0da21e4581..1b978fabfa 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -25,7 +25,6 @@ namespace LAMMPS_NS { class TextFileReader { - std::string filename; std::string filetype; static constexpr int MAXLINE = 1024; char line[MAXLINE]; @@ -35,6 +34,8 @@ namespace LAMMPS_NS bool ignore_comments; //!< Controls whether comments are ignored TextFileReader(const std::string &filename, const std::string &filetype); + TextFileReader(FILE *fp, const std::string &filetype); + ~TextFileReader(); void skip_line(); From 87e74bc721f0f2288a201403acad1bbad357f77f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 15:42:22 -0400 Subject: [PATCH 034/119] small tweaks for better alignment and access to the LAMMPS Memory class --- src/USER-REAXC/pair_reaxc.cpp | 1 + src/USER-REAXC/reaxff_types.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 26c7428245..c387c1b203 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -94,6 +94,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) api->system->total_cap = 0; api->system->my_atoms = nullptr; api->system->pair_ptr = this; + api->system->mem_ptr = memory; api->system->error_ptr = error; api->control->error_ptr = error; api->control->lmp_ptr = lmp; diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index 56bbbe43b7..fc88e43dca 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -30,6 +30,7 @@ namespace LAMMPS_NS { class Error; class LAMMPS; + class Memory; class Pair; } @@ -47,8 +48,8 @@ namespace ReaxFF struct global_parameters { int n_global; - double* l; int vdw_type; + double *l; }; struct single_body_parameters @@ -213,6 +214,8 @@ namespace ReaxFF LAMMPS_NS::Error *error_ptr; LAMMPS_NS::Pair *pair_ptr; + LAMMPS_NS::Memory *mem_ptr; + int my_bonds; int mincap,minhbonds; double safezone, saferzone; From f0ef44a496a74b8a0237ed3bae8e259b5be3b43a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 18:23:36 -0400 Subject: [PATCH 035/119] fix small memory leak --- src/USER-REAXC/pair_reaxc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c387c1b203..db2cfb3811 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -145,6 +145,7 @@ PairReaxC::~PairReaxC() delete api->data; delete api->workspace; memory->destroy(api->lists); + delete api; // deallocate interface storage if (allocated) { From 545f551c9d76303fb364efff891d85166085d64e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Apr 2021 18:27:23 -0400 Subject: [PATCH 036/119] modernize force field parser for ReaxFF --- src/USER-REAXC/pair_reaxc.cpp | 2 +- src/USER-REAXC/reaxc_allocate.cpp | 36 +- src/USER-REAXC/reaxc_ffield.cpp | 1293 +++++++++++++---------------- src/USER-REAXC/reaxff_api.h | 3 +- src/text_file_reader.h | 4 +- 5 files changed, 610 insertions(+), 728 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index db2cfb3811..3525b40b1d 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -291,7 +291,7 @@ void PairReaxC::coeff(int nargs, char **args) // read ffield file - Read_Force_Field(args[2], &(api->system->reax_param), api->control); + Read_Force_Field(args[2], &(api->system->reax_param), api->control, world); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if "NULL" diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 9ee2a1d3a1..b79c5fe57c 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -27,6 +27,8 @@ #include "reaxff_api.h" #include "error.h" +#include "memory.h" +#include "pair.h" namespace ReaxFF { @@ -59,39 +61,19 @@ namespace ReaxFF { void DeAllocate_System(reax_system *system) { - int i, j, k; - int ntypes; - reax_interaction *ff_params; auto error = system->error_ptr; + auto memory = system->mem_ptr; // deallocate the atom list sfree(error, system->my_atoms, "system->my_atoms"); // deallocate the ffield parameters storage - ff_params = &(system->reax_param); - ntypes = ff_params->num_atom_types; - - sfree(error, ff_params->gp.l, "ff:globals"); - - for (i = 0; i < ntypes; ++i) { - for (j = 0; j < ntypes; ++j) { - for (k = 0; k < ntypes; ++k) { - sfree(error, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]"); - } - sfree(error, ff_params->fbp[i][j], "ff:fbp[i,j]"); - sfree(error, ff_params->thbp[i][j], "ff:thbp[i,j]"); - sfree(error, ff_params->hbp[i][j], "ff:hbp[i,j]"); - } - sfree(error, ff_params->fbp[i], "ff:fbp[i]"); - sfree(error, ff_params->thbp[i], "ff:thbp[i]"); - sfree(error, ff_params->hbp[i], "ff:hbp[i]"); - sfree(error, ff_params->tbp[i], "ff:tbp[i]"); - } - sfree(error, ff_params->fbp, "ff:fbp"); - sfree(error, ff_params->thbp, "ff:thbp"); - sfree(error, ff_params->hbp, "ff:hbp"); - sfree(error, ff_params->tbp, "ff:tbp"); - sfree(error, ff_params->sbp, "ff:sbp"); + memory->destroy(system->reax_param.gp.l); + memory->destroy(system->reax_param.sbp); + memory->destroy(system->reax_param.tbp); + memory->destroy(system->reax_param.thbp); + memory->destroy(system->reax_param.hbp); + memory->destroy(system->reax_param.fbp); } /************* workspace *************/ diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index b60022dd03..3cbb4a6f82 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -26,726 +26,625 @@ #include "reaxff_api.h" -#include +#include "error.h" +#include "memory.h" +#include "text_file_reader.h" +#include "utils.h" + #include #include -#include -#include -#include -#include "error.h" - -#include "utils.h" +#include using LAMMPS_NS::utils::open_potential; using LAMMPS_NS::utils::getsyserror; namespace ReaxFF { + + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; + extern int Tokenize(char* s, char*** tok); void Read_Force_Field(const char *filename, reax_interaction *reax, - control_params *control) + control_params *control, MPI_Comm world) { - char *s; - char **tmp; char ****tor_flag; - int c, i, j, k, l, m, n, o, p, cnt; - int lgflag = control->lgflag; - int errorflag = 1; - double val; - int me = control->me; + auto error = control->error_ptr; + auto lmp = control->lmp_ptr; + auto memory = control->lmp_ptr->memory; - FILE *fp = open_potential(filename,control->lmp_ptr,nullptr); - if (!fp) - control->error_ptr->all(FLERR,fmt::format("Cannot open ReaxFF potential " - "file {}: {}",filename, - getsyserror())); - s = (char*) malloc(sizeof(char)*MAX_LINE); - tmp = (char**) malloc(sizeof(char*)*MAX_TOKENS); - for (i=0; i < MAX_TOKENS; i++) - tmp[i] = (char*) malloc(sizeof(char)*MAX_TOKEN_LEN); + // read and parse the force field only on rank 0 - /* reading first header comment */ - fgets(s, MAX_LINE, fp); +#define THROW_ERROR(txt) \ + throw parser_error(fmt::format("{}:{}: {}",filename,lineno,txt)) - /* line 2 is number of global parameters */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); + if (control->me == 0) { + FILE *fp = LAMMPS_NS::utils::open_potential(filename, lmp, nullptr); + if (!fp) + error->one(FLERR,fmt::format("The ReaxFF parameter file {} cannot be opened: {}", + filename, getsyserror())); + LAMMPS_NS::TextFileReader reader(fp, "ReaxFF parameter"); - /* reading the number of global parameters */ - n = atoi(tmp[0]); - if (n < 1) { - if (me == 0) - control->error_ptr->warning(FLERR, "Number of globals in ffield file is 0. The file will not be read."); - fclose(fp); - free(s); - free(tmp); - return; + try { + int i,j,k,l,m,n,lineno = 0; + + // skip header comment line + + reader.skip_line(); + ++lineno; + + // set some defaults + + reax->gp.vdw_type = 0; + + // get number of global parameters + + auto values = reader.next_values(0); + n = values.next_int(); + reax->gp.n_global = n; + ++lineno; + + if (n < 1) + THROW_ERROR("Invalid number of global parameters"); + + memory->create(reax->gp.l,n,"reaxff:gp.l"); + + // see reaxff_types.h for mapping between l[i] and the lambdas used in ff + + for (i = 0; i < n; ++i) { + values = reader.next_values(0); + ++lineno; + reax->gp.l[i] = values.next_double(); + } + + // next line is number of atom types followed by 3 lines of comments + + values = reader.next_values(0); + n = values.next_int(); + reax->num_atom_types = n; + reader.skip_line(); + reader.skip_line(); + reader.skip_line(); + lineno += 4; + + // allocate and clear storage for ffield data + + memory->create(reax->sbp,n,"reaxff:sbp"); + memory->create(reax->tbp,n,n,"reaxff:tbp"); + memory->create(reax->thbp,n,n,n,"reaxff:thbp"); + memory->create(reax->hbp,n,n,n,"reaxff:hbp"); + memory->create(reax->fbp,n,n,n,n,"reaxff:fbp"); + memory->create(tor_flag,n,n,n,n,"reaxff:tor_flag"); + memset(&(reax->sbp[0]),0,sizeof(single_body_parameters)*n); + memset(&(reax->tbp[0][0]),0,sizeof(two_body_parameters)*n*n); + memset(&(reax->thbp[0][0][0]),0,sizeof(three_body_header)*n*n*n); + memset(&(reax->hbp[0][0][0]),0,sizeof(hbond_parameters)*n*n*n); + memset(&(reax->fbp[0][0][0][0]),0,sizeof(four_body_header)*n*n*n*n); + memset(&tor_flag[0][0][0][0],0,sizeof(char)*n*n*n*n); + + // atomic parameters + // four lines per atom type, or 5 if lgvdw != 0 + // the first starts with the symbol and has 9 words + // the next three have 8 words + // the fifth will have 2 words, if present + + const int lgflag = control->lgflag; + const int ntypes = n; + for (i = 0; i < ntypes; ++i) { + + // line one + + values = reader.next_values(0); + ++lineno; + + if ((values.count() < 8) && !lgflag) + THROW_ERROR("This force field file requires using 'lgvdw yes'"); + if (values.count() < 9) + THROW_ERROR("Invalid force field file format"); + + auto element = values.next_string(); + int len = MIN(element.size(),3); + for (j = 0; j < len; ++j) + reax->sbp[i].name[j] = toupper(element[j]); + reax->sbp[i].name[j] = '\0'; + + reax->sbp[i].r_s = values.next_double(); + reax->sbp[i].valency = values.next_double(); + reax->sbp[i].mass = values.next_double(); + reax->sbp[i].r_vdw = values.next_double(); + reax->sbp[i].epsilon = values.next_double(); + reax->sbp[i].gamma = values.next_double(); + reax->sbp[i].r_pi = values.next_double(); + reax->sbp[i].valency_e = values.next_double(); + reax->sbp[i].nlp_opt = 0.5 * (reax->sbp[i].valency_e-reax->sbp[i].valency); + + // line two + + values = reader.next_values(0); + ++lineno; + if (values.count() < 8) + THROW_ERROR("Invalid force field file format"); + + reax->sbp[i].alpha = values.next_double(); + reax->sbp[i].gamma_w = values.next_double(); + reax->sbp[i].valency_boc= values.next_double(); + reax->sbp[i].p_ovun5 = values.next_double(); + values.skip(); + reax->sbp[i].chi = values.next_double(); + reax->sbp[i].eta = 2.0*values.next_double(); + reax->sbp[i].p_hbond = (int) values.next_double(); + + // line three + + values = reader.next_values(0); + ++lineno; + if (values.count() < 8) + THROW_ERROR("Invalid force field file format"); + + reax->sbp[i].r_pi_pi = values.next_double(); + reax->sbp[i].p_lp2 = values.next_double(); + values.skip(); + reax->sbp[i].b_o_131 = values.next_double(); + reax->sbp[i].b_o_132 = values.next_double(); + reax->sbp[i].b_o_133 = values.next_double(); + + // line four + + values = reader.next_values(0); + ++lineno; + if (values.count() < 8) + THROW_ERROR("Invalid force field file format"); + + reax->sbp[i].p_ovun2 = values.next_double(); + reax->sbp[i].p_val3 = values.next_double(); + values.skip(); + reax->sbp[i].valency_val= values.next_double(); + reax->sbp[i].p_val5 = values.next_double(); + reax->sbp[i].rcore2 = values.next_double(); + reax->sbp[i].ecore2 = values.next_double(); + reax->sbp[i].acore2 = values.next_double(); + + // read line five only when lgflag != 0 + + if (lgflag) { + values = reader.next_values(0); + ++lineno; + if (values.count() < 2) + THROW_ERROR("Invalid force field file format"); + reax->sbp[i].lgcij = values.next_double(); + reax->sbp[i].lgre = values.next_double(); + } else reax->sbp[i].lgcij = reax->sbp[i].lgre = 0.0; + + // van der Waals settings check: + + // Inner-wall? + if ((reax->sbp[i].rcore2 > 0.01) && (reax->sbp[i].acore2 > 0.01)) { + // Shielding van der Waals? + if (reax->sbp[i].gamma_w > 0.5) { + if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 3) { + const auto errmsg + = fmt::format("Van der Waals parameters for element {} " + "indicate inner wall+shielding, but earlier " + "atoms indicate a different van der Waals " + "method. This may cause division-by-zero " + "errors. Keeping van der Waals setting for " + "earlier atoms.",reax->sbp[i].name); + error->warning(FLERR,errmsg); + } else { + reax->gp.vdw_type = 3; + } + } else { // No shielding van der Waals parameters present + if ((reax->gp.vdw_type != 0) && (reax->gp.vdw_type != 2)) { + const auto errmsg + = fmt::format("Van der Waals parameters for element {} " + "indicate inner wall withou shielding, but " + "earlier atoms indicate a different van der " + "Waals-method. This may cause division-by-" + "zero errors. Keeping van der Waals setting " + "for earlier atoms.", reax->sbp[i].name); + error->warning(FLERR,errmsg); + } else { + reax->gp.vdw_type = 2; + } + } + } else { // No Inner wall parameters present + if (reax->sbp[i].gamma_w > 0.5) { // Shielding vdWaals + if ((reax->gp.vdw_type != 0) && (reax->gp.vdw_type != 1)) { + const auto errmsg + = fmt::format("Van der Waals parameters for element {} " + "indicate shielding without inner wall, but " + "earlier elements indicate a different van der " + "Waals method. This may cause division-by-zero " + "errors. Keeping van der Waals setting for " + "earlier atoms.", reax->sbp[i].name); + error->warning(FLERR,errmsg); + } else { + reax->gp.vdw_type = 1; + } + } else { + error->one(FLERR,fmt::format("Inconsistent van der Waals " + "parameters: No shielding or inner " + "wall set for element {}", + reax->sbp[i].name)); + } + } + } + + /* Equate vval3 to valf for first-row elements (25/10/2004) */ + for (i = 0; i < ntypes; i++) { + if ((reax->sbp[i].mass < 21) && + (reax->sbp[i].valency_val != reax->sbp[i].valency_boc)) { + error->warning(FLERR,fmt::format("Changed valency_val to valency" + "_boc for {}", reax->sbp[i].name)); + reax->sbp[i].valency_val = reax->sbp[i].valency_boc; + } + } + + // next line is number of two body parameters followed by 1 comment line + + values = reader.next_values(0); + n = values.next_int(); + reader.skip_line(); + lineno += 2; + + for (i = 0; i < n; ++i) { + + // first line + + values = reader.next_values(0); + ++lineno; + if (values.count() < 10) + THROW_ERROR("Invalid force field file format"); + + j = values.next_int() - 1; + k = values.next_int() - 1; + + if ((j < 0) || (k < 0)) + THROW_ERROR("Inconsistent force field file"); + + if ((j < ntypes) && (k < ntypes)) { + reax->tbp[j][k].De_s = reax->tbp[k][j].De_s = values.next_double(); + reax->tbp[j][k].De_p = reax->tbp[k][j].De_p = values.next_double(); + reax->tbp[j][k].De_pp = reax->tbp[k][j].De_pp = values.next_double(); + reax->tbp[j][k].p_be1 = reax->tbp[k][j].p_be1 = values.next_double(); + reax->tbp[j][k].p_bo5 = reax->tbp[k][j].p_bo5 = values.next_double(); + reax->tbp[j][k].v13cor = reax->tbp[k][j].v13cor = values.next_double(); + reax->tbp[j][k].p_bo6 = reax->tbp[k][j].p_bo6 = values.next_double(); + reax->tbp[j][k].p_ovun1 = reax->tbp[k][j].p_ovun1 = values.next_double(); + } + + // second line + + values = reader.next_values(0); + ++lineno; + if (values.count() < 8) + THROW_ERROR("Invalid force field file format"); + + if ((j < ntypes) && (k < ntypes)) { + reax->tbp[j][k].p_be2 = reax->tbp[k][j].p_be2 = values.next_double(); + reax->tbp[j][k].p_bo3 = reax->tbp[k][j].p_bo3 = values.next_double(); + reax->tbp[j][k].p_bo4 = reax->tbp[k][j].p_bo4 = values.next_double(); + values.skip(); + reax->tbp[j][k].p_bo1 = reax->tbp[k][j].p_bo1 = values.next_double(); + reax->tbp[j][k].p_bo2 = reax->tbp[k][j].p_bo2 = values.next_double(); + reax->tbp[j][k].ovc = reax->tbp[k][j].ovc = values.next_double(); + } + } + + for (i=0; i < ntypes; ++i) { + for (j=i; j < ntypes; ++j) { + reax->tbp[i][j].r_s = reax->tbp[j][i].r_s = + 0.5*(reax->sbp[j].r_s + reax->sbp[i].r_s); + + reax->tbp[i][j].r_p = reax->tbp[j][i].r_p = + 0.5*(reax->sbp[j].r_pi + reax->sbp[i].r_pi); + + reax->tbp[i][j].r_pp = reax->tbp[j][i].r_pp = + 0.5*(reax->sbp[j].r_pi_pi + reax->sbp[i].r_pi_pi); + + reax->tbp[i][j].p_boc3 = reax->tbp[j][i].p_boc3 = + sqrt(reax->sbp[j].b_o_132 * reax->sbp[i].b_o_132); + + reax->tbp[i][j].p_boc4 = reax->tbp[j][i].p_boc4 = + sqrt(reax->sbp[j].b_o_131 * reax->sbp[i].b_o_131); + + reax->tbp[i][j].p_boc5 = reax->tbp[j][i].p_boc5 = + sqrt(reax->sbp[j].b_o_133 * reax->sbp[i].b_o_133); + + reax->tbp[i][j].D = reax->tbp[j][i].D = + sqrt(reax->sbp[j].epsilon * reax->sbp[i].epsilon); + + reax->tbp[i][j].alpha = reax->tbp[j][i].alpha = + sqrt(reax->sbp[j].alpha * reax->sbp[i].alpha); + + reax->tbp[i][j].r_vdW = reax->tbp[j][i].r_vdW = + 2.0*sqrt(reax->sbp[j].r_vdw * reax->sbp[i].r_vdw); + + reax->tbp[i][j].gamma_w = reax->tbp[j][i].gamma_w = + sqrt(reax->sbp[j].gamma_w * reax->sbp[i].gamma_w); + + reax->tbp[i][j].gamma = reax->tbp[j][i].gamma = + pow(reax->sbp[j].gamma * reax->sbp[i].gamma,-1.5); + + // additions for additional vdWaals interaction types - inner core + + reax->tbp[i][j].rcore = reax->tbp[j][i].rcore = + sqrt(reax->sbp[i].rcore2 * reax->sbp[j].rcore2); + + reax->tbp[i][j].ecore = reax->tbp[j][i].ecore = + sqrt(reax->sbp[i].ecore2 * reax->sbp[j].ecore2); + + reax->tbp[i][j].acore = reax->tbp[j][i].acore = + sqrt(reax->sbp[i].acore2 * reax->sbp[j].acore2); + + // additions for additional vdWalls interaction types lg correction + + reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = + sqrt(reax->sbp[i].lgcij * reax->sbp[j].lgcij); + + reax->tbp[i][j].lgre = reax->tbp[j][i].lgre + = 2.0 * reax->gp.l[35] * sqrt(reax->sbp[i].lgre*reax->sbp[j].lgre); + } + } + + // next line is number of two body off-diagonal parameters + + values = reader.next_values(0); + n = values.next_int(); + ++lineno; + + double val; + for (i = 0; i < n; ++i) { + values = reader.next_values(0); + ++lineno; + if ((int)values.count() < 8 + lgflag) + THROW_ERROR("Invalid force field file format"); + + j = values.next_int() - 1; + k = values.next_int() - 1; + + if ((j < 0) || (k < 0)) + THROW_ERROR("Inconsistent force field file"); + + if ((j < ntypes) && (k < ntypes)) { + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].D = reax->tbp[k][j].D = val; + + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].r_vdW = reax->tbp[k][j].r_vdW = 2*val; + + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].alpha = reax->tbp[k][j].alpha = val; + + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].r_s = reax->tbp[k][j].r_s = val; + + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].r_p = reax->tbp[k][j].r_p = val; + + val = values.next_double(); + if (val > 0.0) reax->tbp[j][k].r_pp = reax->tbp[k][j].r_pp = val; + + if (lgflag) { + val = values.next_double(); + if (val >= 0.0) reax->tbp[j][k].lgcij = reax->tbp[k][j].lgcij = val; + } + } + } + + // next line is number of three body parameters + + values = reader.next_values(0); + n = values.next_int(); + ++lineno; + + int cnt; + for (i = 0; i < n; ++i) { + values = reader.next_values(0); + ++lineno; + if (values.count() < 10) + THROW_ERROR("Invalid force field file format"); + + j = values.next_int() - 1; + k = values.next_int() - 1; + l = values.next_int() - 1; + + if ((j < 0) || (k < 0) || (l < 0)) + THROW_ERROR("Inconsistent force field file"); + + if ((j < ntypes) && (k < ntypes) && (l < ntypes)) { + + cnt = reax->thbp[j][k][l].cnt; + reax->thbp[j][k][l].cnt++; + reax->thbp[l][k][j].cnt++; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].theta_00 = val; + reax->thbp[l][k][j].prm[cnt].theta_00 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_val1 = val; + reax->thbp[l][k][j].prm[cnt].p_val1 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_val2 = val; + reax->thbp[l][k][j].prm[cnt].p_val2 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_coa1 = val; + reax->thbp[l][k][j].prm[cnt].p_coa1 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_val7 = val; + reax->thbp[l][k][j].prm[cnt].p_val7 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_pen1 = val; + reax->thbp[l][k][j].prm[cnt].p_pen1 = val; + + val = values.next_double(); + reax->thbp[j][k][l].prm[cnt].p_val4 = val; + reax->thbp[l][k][j].prm[cnt].p_val4 = val; + } + } + + // next line is number of four body parameters + + values = reader.next_values(0); + n = values.next_int(); + ++lineno; + + for (i = 0; i < n; ++i) { + values = reader.next_values(0); + ++lineno; + if (values.count() < 9) + THROW_ERROR("Invalid force field file format"); + + j = values.next_int() - 1; + k = values.next_int() - 1; + l = values.next_int() - 1; + m = values.next_int() - 1; + + if ((j < -1) || (k < 0) || (l < 0) || (m < -1)) + THROW_ERROR("Inconsistent force field file"); + + if ((j >= 0) && (m >= 0)) { // this means the entry is not in compact form + + if ((j < ntypes) && (k < ntypes) && (l < ntypes) && (m < ntypes)) { + + tor_flag[j][k][l][m] = 1; + tor_flag[m][l][k][j] = 1; + + reax->fbp[j][k][l][m].cnt = 1; + reax->fbp[m][l][k][j].cnt = 1; + + val = values.next_double(); + reax->fbp[j][k][l][m].prm[0].V1 = val; + reax->fbp[m][l][k][j].prm[0].V1 = val; + + val = values.next_double(); + reax->fbp[j][k][l][m].prm[0].V2 = val; + reax->fbp[m][l][k][j].prm[0].V2 = val; + + val = values.next_double(); + reax->fbp[j][k][l][m].prm[0].V3 = val; + reax->fbp[m][l][k][j].prm[0].V3 = val; + + val = values.next_double(); + reax->fbp[j][k][l][m].prm[0].p_tor1 = val; + reax->fbp[m][l][k][j].prm[0].p_tor1 = val; + + val = values.next_double(); + reax->fbp[j][k][l][m].prm[0].p_cot1 = val; + reax->fbp[m][l][k][j].prm[0].p_cot1 = val; + } + + } else { /* This means the entry is of the form 0-X-Y-0 */ + + if ((k < ntypes) && (l < ntypes)) { + const double val1 = values.next_double(); + const double val2 = values.next_double(); + const double val3 = values.next_double(); + const double val4 = values.next_double(); + const double val5 = values.next_double(); + + for (int p = 0; p < ntypes; ++p) { + for (int o = 0; o < ntypes; ++o) { + reax->fbp[p][k][l][o].cnt = 1; + reax->fbp[o][l][k][p].cnt = 1; + + if (tor_flag[p][k][l][o] == 0) { + reax->fbp[p][k][l][o].prm[0].V1 = val1; + reax->fbp[p][k][l][o].prm[0].V2 = val2; + reax->fbp[p][k][l][o].prm[0].V3 = val3; + reax->fbp[p][k][l][o].prm[0].p_tor1 = val4; + reax->fbp[p][k][l][o].prm[0].p_cot1 = val5; + } + + if (tor_flag[o][l][k][p] == 0) { + reax->fbp[o][l][k][p].prm[0].V1 = val1; + reax->fbp[o][l][k][p].prm[0].V2 = val2; + reax->fbp[o][l][k][p].prm[0].V3 = val3; + reax->fbp[o][l][k][p].prm[0].p_tor1 = val4; + reax->fbp[o][l][k][p].prm[0].p_cot1 = val5; + } + } + } + } + } + } + + // next line is number of hydrogen bond parameters + + values = reader.next_values(0); + n = values.next_int(); + ++lineno; + + for (i = 0; i < ntypes; ++i) + for (j = 0; j < ntypes; ++j) + for (k = 0; k < ntypes; ++k) + reax->hbp[i][j][k].r0_hb = -1.0; + + for (i = 0; i < n; ++i) { + values = reader.next_values(0); + ++lineno; + if (values.count() < 7) + THROW_ERROR("Invalid force field file format"); + + j = values.next_int() - 1; + k = values.next_int() - 1; + l = values.next_int() - 1; + + if ((j < 0) || (k < 0) || (l < 0)) + THROW_ERROR("Inconsistent force field file"); + + if ((j < ntypes) && (k < ntypes) && (l < ntypes)) { + reax->hbp[j][k][m].r0_hb = values.next_double(); + reax->hbp[j][k][m].p_hb1 = values.next_double(); + reax->hbp[j][k][m].p_hb2 = values.next_double(); + reax->hbp[j][k][m].p_hb3 = values.next_double(); + } + } + + memory->destroy(tor_flag); + } catch (std::exception &e) { + error->one(FLERR,e.what()); + } } - reax->gp.n_global = n; - reax->gp.l = (double*) malloc(sizeof(double)*n); + // broadcast global parameters and allocate list on ranks != 0 + MPI_Bcast(&reax->gp,sizeof(global_parameters),MPI_CHAR,0,world); + if (control->me != 0) memory->create(reax->gp.l,reax->gp.n_global,"reaxff:gp.l"); + MPI_Bcast(reax->gp.l,reax->gp.n_global,MPI_DOUBLE,0,world); - /* see reax_types.h for mapping between l[i] and the lambdas used in ff */ - for (i=0; i < n; i++) { - fgets(s,MAX_LINE,fp); - c = Tokenize(s,&tmp); - - val = (double) atof(tmp[0]); - reax->gp.l[i] = val; + // allocate storage for atom type based data + MPI_Bcast(&reax->num_atom_types,1,MPI_INT,0,world); + if (control->me != 0) { + const int n = reax->num_atom_types; + memory->create(reax->sbp,n,"reaxff:sbp"); + memory->create(reax->tbp,n,n,"reaxff:tbp"); + memory->create(reax->thbp,n,n,n,"reaxff:thbp"); + memory->create(reax->hbp,n,n,n,"reaxff:hbp"); + memory->create(reax->fbp,n,n,n,n,"reaxff:fbp"); } + // broadcast type specific force field data + const int n = reax->num_atom_types; + MPI_Bcast(&(reax->sbp[0]),sizeof(single_body_parameters)*n,MPI_CHAR,0,world); + MPI_Bcast(&(reax->tbp[0][0]),sizeof(two_body_parameters)*n*n,MPI_CHAR,0,world); + MPI_Bcast(&(reax->thbp[0][0][0]),sizeof(three_body_header)*n*n*n,MPI_CHAR,0,world); + MPI_Bcast(&(reax->hbp[0][0][0]),sizeof(hbond_parameters)*n*n*n,MPI_CHAR,0,world); + MPI_Bcast(&(reax->fbp[0][0][0][0]),sizeof(four_body_header)*n*n*n*n,MPI_CHAR,0,world); + + // apply parameters to various settings + control->bo_cut = 0.01 * reax->gp.l[29]; control->nonb_low = reax->gp.l[11]; control->nonb_cut = reax->gp.l[12]; - - /* next line is number of atom types and some comments */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - reax->num_atom_types = atoi(tmp[0]); - - /* 3 lines of comments */ - fgets(s,MAX_LINE,fp); - fgets(s,MAX_LINE,fp); - fgets(s,MAX_LINE,fp); - - /* Allocating structures in reax_interaction */ - reax->sbp = (single_body_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(single_body_parameters), "sbp"); - reax->tbp = (two_body_parameters**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters*), "tbp"); - reax->thbp= (three_body_header***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header**), "thbp"); - reax->hbp = (hbond_parameters***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters**), "hbp"); - reax->fbp = (four_body_header****) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header***), "fbp"); - tor_flag = (char****) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char***), "tor_flag"); - - for (i = 0; i < reax->num_atom_types; i++) { - reax->tbp[i] = (two_body_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]"); - reax->thbp[i]= (three_body_header**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]"); - reax->hbp[i] = (hbond_parameters**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]"); - reax->fbp[i] = (four_body_header***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]"); - tor_flag[i] = (char***) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char**), "tor_flag[i]"); - - for (j = 0; j < reax->num_atom_types; j++) { - reax->thbp[i][j]= (three_body_header*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]"); - reax->hbp[i][j] = (hbond_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]"); - reax->fbp[i][j] = (four_body_header**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]"); - tor_flag[i][j] = (char**) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]"); - - for (k=0; k < reax->num_atom_types; k++) { - reax->fbp[i][j][k] = (four_body_header*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]"); - tor_flag[i][j][k] = (char*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]"); - } - } - } - - reax->gp.vdw_type = 0; - - char errmsg[1024]; - - for (i = 0; i < reax->num_atom_types; i++) { - /* line one */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - /* Sanity checks */ - if (c == 2 && !lgflag) - control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); - - if (c < 9) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - for (j = 0; j < (int)(strlen(tmp[0])); ++j) - reax->sbp[i].name[j] = toupper(tmp[0][j]); - - val = atof(tmp[1]); reax->sbp[i].r_s = val; - val = atof(tmp[2]); reax->sbp[i].valency = val; - val = atof(tmp[3]); reax->sbp[i].mass = val; - val = atof(tmp[4]); reax->sbp[i].r_vdw = val; - val = atof(tmp[5]); reax->sbp[i].epsilon = val; - val = atof(tmp[6]); reax->sbp[i].gamma = val; - val = atof(tmp[7]); reax->sbp[i].r_pi = val; - val = atof(tmp[8]); reax->sbp[i].valency_e = val; - reax->sbp[i].nlp_opt = 0.5 * (reax->sbp[i].valency_e-reax->sbp[i].valency); - - /* line two */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].alpha = val; - val = atof(tmp[1]); reax->sbp[i].gamma_w = val; - val = atof(tmp[2]); reax->sbp[i].valency_boc= val; - val = atof(tmp[3]); reax->sbp[i].p_ovun5 = val; - val = atof(tmp[4]); - val = atof(tmp[5]); reax->sbp[i].chi = val; - val = atof(tmp[6]); reax->sbp[i].eta = 2.0 * val; - val = atof(tmp[7]); reax->sbp[i].p_hbond = (int) val; - - /* line 3 */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; - val = atof(tmp[1]); reax->sbp[i].p_lp2 = val; - val = atof(tmp[2]); - val = atof(tmp[3]); reax->sbp[i].b_o_131 = val; - val = atof(tmp[4]); reax->sbp[i].b_o_132 = val; - val = atof(tmp[5]); reax->sbp[i].b_o_133 = val; - val = atof(tmp[6]); - val = atof(tmp[7]); - - /* line 4 */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - /* Sanity check */ - if (c < 8) { - snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); - control->error_ptr->all(FLERR, errmsg); - } - - val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; - val = atof(tmp[1]); reax->sbp[i].p_val3 = val; - val = atof(tmp[2]); - val = atof(tmp[3]); reax->sbp[i].valency_val= val; - val = atof(tmp[4]); reax->sbp[i].p_val5 = val; - val = atof(tmp[5]); reax->sbp[i].rcore2 = val; - val = atof(tmp[6]); reax->sbp[i].ecore2 = val; - val = atof(tmp[7]); reax->sbp[i].acore2 = val; - - /* line 5, only if lgvdw is yes */ - if (lgflag) { - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - /* Sanity check */ - if (c > 2) { - control->error_ptr->all(FLERR,"Force field file incompatible with 'lgvdw yes'"); - } - - val = atof(tmp[0]); reax->sbp[i].lgcij = val; - val = atof(tmp[1]); reax->sbp[i].lgre = val; - } - - if (reax->sbp[i].rcore2>0.01 && reax->sbp[i].acore2>0.01) { // Inner-wall - if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 3) { - if (errorflag && (me == 0)) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals-parameters for element %s " - "indicate inner wall+shielding, but earlier " - "atoms indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - errorflag = 0; - } else { - reax->gp.vdw_type = 3; - } - } else { // No shielding vdWaals parameters present - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 2) { - if (me == 0) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals-parameters for element %s " - "indicate inner wall without shielding, but earlier " - "atoms indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - } else { - reax->gp.vdw_type = 2; - } - } - } else { // No Inner wall parameters present - if (reax->sbp[i].gamma_w>0.5) { // Shielding vdWaals - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 1) { - if (me == 0) { - char errmsg[512]; - snprintf(errmsg, 512, "VdWaals parameters for element %s " - "indicate shielding without inner wall, but earlier " - "elements indicate different vdWaals-method. " - "This may cause division-by-zero errors. " - "Keeping vdWaals-setting for earlier atoms.", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - } else { - reax->gp.vdw_type = 1; - } - } else { - char errmsg[256]; - snprintf(errmsg, 256, "Inconsistent vdWaals-parameters: " - "No shielding or inner-wall set for element %s", - reax->sbp[i].name); - control->error_ptr->all(FLERR, errmsg); - } - } - } - - /* Equate vval3 to valf for first-row elements (25/10/2004) */ - for (i = 0; i < reax->num_atom_types; i++) - if (reax->sbp[i].mass < 21 && - reax->sbp[i].valency_val != reax->sbp[i].valency_boc) { - if (me == 0) { - char errmsg[256]; - snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", - reax->sbp[i].name); - control->error_ptr->warning(FLERR,errmsg); - } - reax->sbp[i].valency_val = reax->sbp[i].valency_boc; - } - - /* next line is number of two body combination and some comments */ - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - if (c == 2 && !lgflag) { - control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); - } - - l = atoi(tmp[0]); - - /* a line of comments */ - fgets(s,MAX_LINE,fp); - - for (i=0; i < l; i++) { - /* line 1 */ - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - if ((c < 10) || (j < 0) || (k < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types) { - - val = atof(tmp[2]); reax->tbp[j][k].De_s = val; - reax->tbp[k][j].De_s = val; - val = atof(tmp[3]); reax->tbp[j][k].De_p = val; - reax->tbp[k][j].De_p = val; - val = atof(tmp[4]); reax->tbp[j][k].De_pp = val; - reax->tbp[k][j].De_pp = val; - val = atof(tmp[5]); reax->tbp[j][k].p_be1 = val; - reax->tbp[k][j].p_be1 = val; - val = atof(tmp[6]); reax->tbp[j][k].p_bo5 = val; - reax->tbp[k][j].p_bo5 = val; - val = atof(tmp[7]); reax->tbp[j][k].v13cor = val; - reax->tbp[k][j].v13cor = val; - - val = atof(tmp[8]); reax->tbp[j][k].p_bo6 = val; - reax->tbp[k][j].p_bo6 = val; - val = atof(tmp[9]); reax->tbp[j][k].p_ovun1 = val; - reax->tbp[k][j].p_ovun1 = val; - - /* line 2 */ - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - if (c < 8) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - val = atof(tmp[0]); reax->tbp[j][k].p_be2 = val; - reax->tbp[k][j].p_be2 = val; - val = atof(tmp[1]); reax->tbp[j][k].p_bo3 = val; - reax->tbp[k][j].p_bo3 = val; - val = atof(tmp[2]); reax->tbp[j][k].p_bo4 = val; - reax->tbp[k][j].p_bo4 = val; - val = atof(tmp[3]); - - val = atof(tmp[4]); reax->tbp[j][k].p_bo1 = val; - reax->tbp[k][j].p_bo1 = val; - val = atof(tmp[5]); reax->tbp[j][k].p_bo2 = val; - reax->tbp[k][j].p_bo2 = val; - val = atof(tmp[6]); reax->tbp[j][k].ovc = val; - reax->tbp[k][j].ovc = val; - - val = atof(tmp[7]); - } - } - - for (i=0; i < reax->num_atom_types; i++) - for (j=i; j < reax->num_atom_types; j++) { - reax->tbp[i][j].r_s = 0.5 * - (reax->sbp[i].r_s + reax->sbp[j].r_s); - reax->tbp[j][i].r_s = 0.5 * - (reax->sbp[j].r_s + reax->sbp[i].r_s); - - reax->tbp[i][j].r_p = 0.5 * - (reax->sbp[i].r_pi + reax->sbp[j].r_pi); - reax->tbp[j][i].r_p = 0.5 * - (reax->sbp[j].r_pi + reax->sbp[i].r_pi); - - reax->tbp[i][j].r_pp = 0.5 * - (reax->sbp[i].r_pi_pi + reax->sbp[j].r_pi_pi); - reax->tbp[j][i].r_pp = 0.5 * - (reax->sbp[j].r_pi_pi + reax->sbp[i].r_pi_pi); - - - reax->tbp[i][j].p_boc3 = - sqrt(reax->sbp[i].b_o_132 * - reax->sbp[j].b_o_132); - reax->tbp[j][i].p_boc3 = - sqrt(reax->sbp[j].b_o_132 * - reax->sbp[i].b_o_132); - - reax->tbp[i][j].p_boc4 = - sqrt(reax->sbp[i].b_o_131 * - reax->sbp[j].b_o_131); - reax->tbp[j][i].p_boc4 = - sqrt(reax->sbp[j].b_o_131 * - reax->sbp[i].b_o_131); - - reax->tbp[i][j].p_boc5 = - sqrt(reax->sbp[i].b_o_133 * - reax->sbp[j].b_o_133); - reax->tbp[j][i].p_boc5 = - sqrt(reax->sbp[j].b_o_133 * - reax->sbp[i].b_o_133); - - - reax->tbp[i][j].D = - sqrt(reax->sbp[i].epsilon * - reax->sbp[j].epsilon); - - reax->tbp[j][i].D = - sqrt(reax->sbp[j].epsilon * - reax->sbp[i].epsilon); - - reax->tbp[i][j].alpha = - sqrt(reax->sbp[i].alpha * - reax->sbp[j].alpha); - - reax->tbp[j][i].alpha = - sqrt(reax->sbp[j].alpha * - reax->sbp[i].alpha); - - reax->tbp[i][j].r_vdW = - 2.0 * sqrt(reax->sbp[i].r_vdw * reax->sbp[j].r_vdw); - - reax->tbp[j][i].r_vdW = - 2.0 * sqrt(reax->sbp[j].r_vdw * reax->sbp[i].r_vdw); - - reax->tbp[i][j].gamma_w = - sqrt(reax->sbp[i].gamma_w * - reax->sbp[j].gamma_w); - - reax->tbp[j][i].gamma_w = - sqrt(reax->sbp[j].gamma_w * - reax->sbp[i].gamma_w); - - reax->tbp[i][j].gamma = - pow(reax->sbp[i].gamma * - reax->sbp[j].gamma,-1.5); - - reax->tbp[j][i].gamma = - pow(reax->sbp[j].gamma * - reax->sbp[i].gamma,-1.5); - - // additions for additional vdWaals interaction types - inner core - - reax->tbp[i][j].rcore = reax->tbp[j][i].rcore = - sqrt(reax->sbp[i].rcore2 * reax->sbp[j].rcore2); - - reax->tbp[i][j].ecore = reax->tbp[j][i].ecore = - sqrt(reax->sbp[i].ecore2 * reax->sbp[j].ecore2); - - reax->tbp[i][j].acore = reax->tbp[j][i].acore = - sqrt(reax->sbp[i].acore2 * reax->sbp[j].acore2); - - // additions for additional vdWalls interaction types lg correction - - reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = - sqrt(reax->sbp[i].lgcij * reax->sbp[j].lgcij); - - reax->tbp[i][j].lgre = reax->tbp[j][i].lgre = 2.0 * reax->gp.l[35] * - sqrt(reax->sbp[i].lgre*reax->sbp[j].lgre); - - } - - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - l = atoi(tmp[0]); - - for (i=0; i < l; i++) { - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - - if ((c < (lgflag ? 9 : 8)) || (j < 0) || (k < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types) { - val = atof(tmp[2]); - if (val > 0.0) { - reax->tbp[j][k].D = val; - reax->tbp[k][j].D = val; - } - - val = atof(tmp[3]); - if (val > 0.0) { - reax->tbp[j][k].r_vdW = 2 * val; - reax->tbp[k][j].r_vdW = 2 * val; - } - - val = atof(tmp[4]); - if (val > 0.0) { - reax->tbp[j][k].alpha = val; - reax->tbp[k][j].alpha = val; - } - - val = atof(tmp[5]); - if (val > 0.0) { - reax->tbp[j][k].r_s = val; - reax->tbp[k][j].r_s = val; - } - - val = atof(tmp[6]); - if (val > 0.0) { - reax->tbp[j][k].r_p = val; - reax->tbp[k][j].r_p = val; - } - - val = atof(tmp[7]); - if (val > 0.0) { - reax->tbp[j][k].r_pp = val; - reax->tbp[k][j].r_pp = val; - } - - if (lgflag) { - val = atof(tmp[8]); - if (val >= 0.0) { - reax->tbp[j][k].lgcij = val; - reax->tbp[k][j].lgcij = val; - } - } - } - } - - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - reax->thbp[i][j][k].cnt = 0; - - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - l = atoi(tmp[0]); - - for (i = 0; i < l; i++) { - fgets(s,MAX_LINE,fp); - c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - if ((c < 10) || (j < 0) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && k < reax->num_atom_types && - m < reax->num_atom_types) { - cnt = reax->thbp[j][k][m].cnt; - reax->thbp[j][k][m].cnt++; - reax->thbp[m][k][j].cnt++; - - val = atof(tmp[3]); - reax->thbp[j][k][m].prm[cnt].theta_00 = val; - reax->thbp[m][k][j].prm[cnt].theta_00 = val; - - val = atof(tmp[4]); - reax->thbp[j][k][m].prm[cnt].p_val1 = val; - reax->thbp[m][k][j].prm[cnt].p_val1 = val; - - val = atof(tmp[5]); - reax->thbp[j][k][m].prm[cnt].p_val2 = val; - reax->thbp[m][k][j].prm[cnt].p_val2 = val; - - val = atof(tmp[6]); - reax->thbp[j][k][m].prm[cnt].p_coa1 = val; - reax->thbp[m][k][j].prm[cnt].p_coa1 = val; - - val = atof(tmp[7]); - reax->thbp[j][k][m].prm[cnt].p_val7 = val; - reax->thbp[m][k][j].prm[cnt].p_val7 = val; - - val = atof(tmp[8]); - reax->thbp[j][k][m].prm[cnt].p_pen1 = val; - reax->thbp[m][k][j].prm[cnt].p_pen1 = val; - - val = atof(tmp[9]); - reax->thbp[j][k][m].prm[cnt].p_val4 = val; - reax->thbp[m][k][j].prm[cnt].p_val4 = val; - } - } - - /* clear all entries first */ - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - for (m = 0; m < reax->num_atom_types; ++m) { - reax->fbp[i][j][k][m].cnt = 0; - tor_flag[i][j][k][m] = 0; - } - - /* next line is number of 4-body params and some comments */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - l = atoi(tmp[0]); - - for (i = 0; i < l; i++) { - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - n = atoi(tmp[3]) - 1; - if ((c < 9) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j >= 0 && n >= 0) { // this means the entry is not in compact form - if (j < reax->num_atom_types && k < reax->num_atom_types && - m < reax->num_atom_types && n < reax->num_atom_types) { - tor_flag[j][k][m][n] = 1; - tor_flag[n][m][k][j] = 1; - - reax->fbp[j][k][m][n].cnt = 1; - reax->fbp[n][m][k][j].cnt = 1; - - val = atof(tmp[4]); - reax->fbp[j][k][m][n].prm[0].V1 = val; - reax->fbp[n][m][k][j].prm[0].V1 = val; - - val = atof(tmp[5]); - reax->fbp[j][k][m][n].prm[0].V2 = val; - reax->fbp[n][m][k][j].prm[0].V2 = val; - - val = atof(tmp[6]); - reax->fbp[j][k][m][n].prm[0].V3 = val; - reax->fbp[n][m][k][j].prm[0].V3 = val; - - val = atof(tmp[7]); - reax->fbp[j][k][m][n].prm[0].p_tor1 = val; - reax->fbp[n][m][k][j].prm[0].p_tor1 = val; - - val = atof(tmp[8]); - reax->fbp[j][k][m][n].prm[0].p_cot1 = val; - reax->fbp[n][m][k][j].prm[0].p_cot1 = val; - } - } else { /* This means the entry is of the form 0-X-Y-0 */ - if (k < reax->num_atom_types && m < reax->num_atom_types) - for (p = 0; p < reax->num_atom_types; p++) - for (o = 0; o < reax->num_atom_types; o++) { - reax->fbp[p][k][m][o].cnt = 1; - reax->fbp[o][m][k][p].cnt = 1; - - if (tor_flag[p][k][m][o] == 0) { - reax->fbp[p][k][m][o].prm[0].V1 = atof(tmp[4]); - reax->fbp[p][k][m][o].prm[0].V2 = atof(tmp[5]); - reax->fbp[p][k][m][o].prm[0].V3 = atof(tmp[6]); - reax->fbp[p][k][m][o].prm[0].p_tor1 = atof(tmp[7]); - reax->fbp[p][k][m][o].prm[0].p_cot1 = atof(tmp[8]); - } - - if (tor_flag[o][m][k][p] == 0) { - reax->fbp[o][m][k][p].prm[0].V1 = atof(tmp[4]); - reax->fbp[o][m][k][p].prm[0].V2 = atof(tmp[5]); - reax->fbp[o][m][k][p].prm[0].V3 = atof(tmp[6]); - reax->fbp[o][m][k][p].prm[0].p_tor1 = atof(tmp[7]); - reax->fbp[o][m][k][p].prm[0].p_cot1 = atof(tmp[8]); - } - } - } - } - - /* next line is number of hydrogen bond params and some comments */ - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - l = atoi(tmp[0]); - - for (i = 0; i < reax->num_atom_types; ++i) - for (j = 0; j < reax->num_atom_types; ++j) - for (k = 0; k < reax->num_atom_types; ++k) - reax->hbp[i][j][k].r0_hb = -1.0; - - for (i = 0; i < l; i++) { - fgets(s, MAX_LINE, fp); - c = Tokenize(s, &tmp); - - j = atoi(tmp[0]) - 1; - k = atoi(tmp[1]) - 1; - m = atoi(tmp[2]) - 1; - if ((c < 7) || (j < 0) || (k < 0) || (m < 0)) - control->error_ptr->all(FLERR, "Inconsistent force field file"); - - if (j < reax->num_atom_types && m < reax->num_atom_types) { - val = atof(tmp[3]); - reax->hbp[j][k][m].r0_hb = val; - - val = atof(tmp[4]); - reax->hbp[j][k][m].p_hb1 = val; - - val = atof(tmp[5]); - reax->hbp[j][k][m].p_hb2 = val; - - val = atof(tmp[6]); - reax->hbp[j][k][m].p_hb3 = val; - } - } - - /* deallocate helper storage */ - for (i = 0; i < MAX_TOKENS; i++) - free(tmp[i]); - free(tmp); - free(s); - - - /* deallocate tor_flag */ - for (i = 0; i < reax->num_atom_types; i++) { - for (j = 0; j < reax->num_atom_types; j++) { - for (k = 0; k < reax->num_atom_types; k++) { - free(tor_flag[i][j][k]); - } - free(tor_flag[i][j]); - } - free(tor_flag[i]); - } - free(tor_flag); - - // close file - - fclose(fp); } +#undef THROW_ERROR } diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index dda2161c86..cafc3516fd 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -68,7 +68,8 @@ namespace ReaxFF // ffield - extern void Read_Force_Field(const char *, reax_interaction *, control_params *); + extern void Read_Force_Field(const char *, reax_interaction *, + control_params *, MPI_Comm); // forces diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 1b978fabfa..4467bca269 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -39,9 +39,9 @@ namespace LAMMPS_NS ~TextFileReader(); void skip_line(); - char * next_line(int nparams = 0); + char *next_line(int nparams = 0); - void next_dvector(double * list, int n); + void next_dvector(double *list, int n); ValueTokenizer next_values(int nparams, const std::string &separators = TOKENIZER_DEFAULT_SEPARATORS); }; From eaa064e01d26f576e673e2c2026e5a2958e9a0f9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 02:35:08 -0400 Subject: [PATCH 037/119] remove unused tokenizer function --- src/USER-REAXC/reaxc_ffield.cpp | 2 -- src/USER-REAXC/reaxc_tool_box.cpp | 22 ++-------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 3cbb4a6f82..db7b27c235 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -47,8 +47,6 @@ namespace ReaxFF { const char *what() const noexcept { return message.c_str(); } }; - extern int Tokenize(char* s, char*** tok); - void Read_Force_Field(const char *filename, reax_interaction *reax, control_params *control, MPI_Comm world) { diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index bfaa6b94aa..318e2d5813 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -34,24 +34,7 @@ namespace ReaxFF { - int Tokenize(char* s, char*** tok) - { - char test[MAX_LINE]; - const char *sep = (const char *)"\t \n\r\f!="; - char *word; - int count=0; - - strncpy(test, s, MAX_LINE-1); - - for (word = strtok(test, sep); word; word = strtok(nullptr, sep)) { - strncpy((*tok)[count], word, MAX_LINE); - count++; - } - - return count; - } - -/* safe malloc */ + /* safe malloc */ void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name) { void *ptr; @@ -76,7 +59,7 @@ namespace ReaxFF { return ptr; } -/* safe calloc */ + /* safe calloc */ void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name) { void *ptr; @@ -108,7 +91,6 @@ namespace ReaxFF { return ptr; } - /* safe free */ void sfree(LAMMPS_NS::Error* error_ptr, void *ptr, const char *name) { From ab3303ed7ba5f1ed457ce8c947f12c6e8d20670a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 02:45:23 -0400 Subject: [PATCH 038/119] fix indexing bug for hydrogen bond parameters --- src/USER-REAXC/reaxc_ffield.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index db7b27c235..8f857ea343 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -601,10 +601,10 @@ namespace ReaxFF { THROW_ERROR("Inconsistent force field file"); if ((j < ntypes) && (k < ntypes) && (l < ntypes)) { - reax->hbp[j][k][m].r0_hb = values.next_double(); - reax->hbp[j][k][m].p_hb1 = values.next_double(); - reax->hbp[j][k][m].p_hb2 = values.next_double(); - reax->hbp[j][k][m].p_hb3 = values.next_double(); + reax->hbp[j][k][l].r0_hb = values.next_double(); + reax->hbp[j][k][l].p_hb1 = values.next_double(); + reax->hbp[j][k][l].p_hb2 = values.next_double(); + reax->hbp[j][k][l].p_hb3 = values.next_double(); } } From 6f343aaeed608b44fcefef417bbaf8c1c0709a79 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:02:18 -0400 Subject: [PATCH 039/119] add UNITS keyword comments to fix qeq parameter files --- examples/qeq/param.qeq1 | 1 + examples/qeq/param.qeq2 | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/qeq/param.qeq1 b/examples/qeq/param.qeq1 index 9c8514b021..b49705194c 100644 --- a/examples/qeq/param.qeq1 +++ b/examples/qeq/param.qeq1 @@ -1,3 +1,4 @@ +# UNITS: real 1 5.3200 14.8732 1.0206 0.0 0.0 2 5.8678 14.0000 0.9000 0.0 0.0 3 8.5000 17.9978 1.0503 0.0 0.0 diff --git a/examples/qeq/param.qeq2 b/examples/qeq/param.qeq2 index 7e2fdeb8f2..1d77b7d3a6 100644 --- a/examples/qeq/param.qeq2 +++ b/examples/qeq/param.qeq2 @@ -1,2 +1,3 @@ +# UNITS: metal 1 0.00000 7.25028 0.01 0.772871 0.000000 2 11.26882 15.37920 0.01 0.243072 0.000000 From 6bc6da765792648f1f88fd373ba3334cf01c9b8c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:04:40 -0400 Subject: [PATCH 040/119] throw EOF exception in TextFileReader::next_values() if next_line() doesn't do it --- src/text_file_reader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 57aaaf6bb5..c1dbfb3db8 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -175,5 +175,8 @@ void TextFileReader::next_dvector(double * list, int n) { * \return ValueTokenizer object for read in text */ ValueTokenizer TextFileReader::next_values(int nparams, const std::string &separators) { - return ValueTokenizer(next_line(nparams), separators); + char *ptr = next_line(nparams); + if (ptr == nullptr) + throw EOFException(fmt::format("Missing line in {} file!", filetype)); + return ValueTokenizer(line, separators); } From 09d7fe2fcf4da52ed52a83995b37363ac0245f8b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:05:01 -0400 Subject: [PATCH 041/119] don't ignore comments in ReaxFF force field files --- src/USER-REAXC/reaxc_ffield.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 8f857ea343..67b11bee05 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -66,6 +66,7 @@ namespace ReaxFF { error->one(FLERR,fmt::format("The ReaxFF parameter file {} cannot be opened: {}", filename, getsyserror())); LAMMPS_NS::TextFileReader reader(fp, "ReaxFF parameter"); + reader.ignore_comments = false; try { int i,j,k,l,m,n,lineno = 0; From 242fc2d212d5026a34b914174d80d539ae55ee24 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:06:46 -0400 Subject: [PATCH 042/119] modernize parameter file parser in QEQ package --- src/QEQ/fix_qeq.cpp | 145 ++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 73 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index e592ed2af4..4504865303 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -24,16 +24,25 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" +#include "text_file_reader.h" #include "update.h" #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; #define MAXLINE 1024 +class parser_error : public std::exception { + std::string message; +public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } +}; + /* ---------------------------------------------------------------------- */ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : @@ -184,21 +193,21 @@ void FixQEq::deallocate_storage() memory->destroy(s); memory->destroy(t); - memory->destroy( Hdia_inv ); - memory->destroy( b_s ); - memory->destroy( b_t ); + memory->destroy(Hdia_inv); + memory->destroy(b_s); + memory->destroy(b_t); - memory->destroy( p ); - memory->destroy( q ); - memory->destroy( r ); - memory->destroy( d ); + memory->destroy(p); + memory->destroy(q); + memory->destroy(r); + memory->destroy(d); - memory->destroy( chizj ); - memory->destroy( qf ); - memory->destroy( q1 ); - memory->destroy( q2 ); + memory->destroy(chizj); + memory->destroy(qf); + memory->destroy(q1); + memory->destroy(q2); - memory->destroy( qv ); + memory->destroy(qv); } /* ---------------------------------------------------------------------- */ @@ -224,7 +233,7 @@ void FixQEq::allocate_matrix() safezone = SAFE_ZONE; nlocal = atom->nlocal; - n_cap = MAX( (int)(nlocal * safezone), mincap ); + n_cap = MAX((int)(nlocal * safezone), mincap); nall = atom->nlocal + atom->nghost; // determine the total space for the H matrix @@ -687,13 +696,7 @@ void FixQEq::vector_add( double* dest, double c, double* v, int k ) void FixQEq::read_file(char *file) { - int i; - int params_per_line = 6; - char **words = new char*[params_per_line+1]; - - int ntypes = atom->ntypes; - int *setflag = new int[ntypes+1]; - for (i=0; i <= ntypes; ++i) setflag[i] = 0; + const int ntypes = atom->ntypes; memory->create(chi,ntypes+1,"qeq:chi"); memory->create(eta,ntypes+1,"qeq:eta"); @@ -701,70 +704,66 @@ void FixQEq::read_file(char *file) memory->create(zeta,ntypes+1,"qeq:zeta"); memory->create(zcore,ntypes+1,"qeq:zcore"); - // open file on proc 0 - - FILE *fp; - if (comm->me == 0) { - fp = utils::open_potential(file,lmp,nullptr); - if (fp == nullptr) - error->one(FLERR,fmt::format("Cannot open fix qeq parameter file {}: {}", - file,utils::getsyserror())); - } - // read each line out of file, skipping blank lines or leading '#' // store line of params if all 3 element tags are in element list - int n,nwords,eof,nlo,nhi; - char line[MAXLINE],*ptr; - - eof = 0; - - while (1) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fp); - if (ptr == nullptr) { - eof = 1; - fclose(fp); - } else n = strlen(line) + 1; + if (comm->me == 0) { + int *setflag = new int[ntypes+1]; + for (int n=0; n <= ntypes; ++n) { + setflag[n] = 0; + chi[n] = eta[n] = gamma[n] = zeta[n] = zcore[n] = 0.0; } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - // strip comment, skip line if blank + try { + int nlo,nhi; + double val; - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = utils::count_words(line); - if (nwords == 0) continue; + FILE *fp = utils::open_potential(file,lmp,nullptr); + if (fp == nullptr) + throw parser_error(fmt::format("Cannot open fix qeq parameter file {}:" + " {}", file,utils::getsyserror())); + TextFileReader reader(fp, "qeq parameter"); - // must have 6 parameters per line. + while (1) { + auto values = reader.next_values(0); - if (nwords < 6) - error->all(FLERR,"Invalid fix qeq parameter file"); + if (values.count() == 0) continue; + if (values.count() < 6) + throw parser_error("Invalid qeq parameter file"); - // words = ptrs to first 6 words in line + auto word = values.next_string(); + utils::bounds(FLERR,word,1,ntypes,nlo,nhi,nullptr); + if ((nlo < 0) || (nhi < 0)) + throw parser_error("Invalid atom type range"); - for (n=0, words[n] = strtok(line," \t\n\r\f"); - n < 6; - words[++n] = strtok(nullptr," \t\n\r\f")); - - utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); - for (n=nlo; n <=nhi; ++n) { - chi[n] = utils::numeric(FLERR,words[1],false,lmp); - eta[n] = utils::numeric(FLERR,words[2],false,lmp); - gamma[n] = utils::numeric(FLERR,words[3],false,lmp); - zeta[n] = utils::numeric(FLERR,words[4],false,lmp); - zcore[n] = utils::numeric(FLERR,words[5],false,lmp); - setflag[n] = 1; + val = values.next_double(); + for (int n=nlo; n <= nhi; ++n) chi[n] = val; + val = values.next_double(); + for (int n=nlo; n <= nhi; ++n) eta[n] = val; + val = values.next_double(); + for (int n=nlo; n <= nhi; ++n) gamma[n] = val; + val = values.next_double(); + for (int n=nlo; n <= nhi; ++n) zeta[n] = val; + val = values.next_double(); + for (int n=nlo; n <= nhi; ++n) zcore[n] = val; + for (int n=nlo; n <= nhi; ++n) setflag[n] = 1; + } + } catch (EOFException &e) { + ; // catch and ignore to exit loop + } catch (std::exception &e) { + error->one(FLERR,e.what()); } + + for (int n=1; n <= ntypes; ++n) + if (setflag[n] == 0) + error->one(FLERR,fmt::format("Parameters for atom type {} missing in " + "qeq parameter file", n)); + delete[] setflag; } - // check if all types are set - for (n=1; n <= ntypes; ++n) - if (setflag[n] == 0) - error->all(FLERR,"Invalid fix qeq parameter file"); - - delete [] words; - delete [] setflag; + MPI_Bcast(chi,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(eta,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(gamma,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(zeta,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(zcore,ntypes+1,MPI_DOUBLE,0,world); } From 162e4e16a548667a2c2b5fbc62ae67fef8844688 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:15:58 -0400 Subject: [PATCH 043/119] fix incorrect indentation --- doc/src/Speed_kokkos.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Speed_kokkos.rst b/doc/src/Speed_kokkos.rst index 708678e537..8f9009aaca 100644 --- a/doc/src/Speed_kokkos.rst +++ b/doc/src/Speed_kokkos.rst @@ -27,7 +27,7 @@ GPUs) and HIP (for AMD GPUs). You choose the mode at build time to produce an executable compatible with a specific hardware. .. admonition:: C++14 support - :class: note + :class: note Kokkos requires using a compiler that supports the c++14 standard. For some compilers, it may be necessary to add a flag to enable c++14 support. From 238ed55313afb2b9d5c08fdabdde768b4b07567a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:33:06 -0400 Subject: [PATCH 044/119] small code tweaks and whitespace update --- src/USER-REAXC/fix_qeq_reax.cpp | 116 ++++++++++++++++---------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index f37fa4ba4a..9c5b3b2958 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -222,8 +222,10 @@ void FixQEqReax::pertype_parameters(char *arg) memory->create(gamma,ntypes+1,"qeq/reax:gamma"); if (comm->me == 0) { + chi[0] = eta[0] = gamma[0] = 0.0; try { TextFileReader reader(arg,"qeq/reax parameter"); + reader.ignore_comments = false; for (int i = 1; i <= ntypes; i++) { const char *line = reader.next_line(); if (!line) @@ -246,9 +248,9 @@ void FixQEqReax::pertype_parameters(char *arg) } } - MPI_Bcast(&chi[1],ntypes,MPI_DOUBLE,0,world); - MPI_Bcast(&eta[1],ntypes,MPI_DOUBLE,0,world); - MPI_Bcast(&gamma[1],ntypes,MPI_DOUBLE,0,world); + MPI_Bcast(chi,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(eta,ntypes+1,MPI_DOUBLE,0,world); + MPI_Bcast(gamma,ntypes+1,MPI_DOUBLE,0,world); } /* ---------------------------------------------------------------------- */ @@ -283,16 +285,16 @@ void FixQEqReax::deallocate_storage() memory->destroy(s); memory->destroy(t); - memory->destroy( Hdia_inv ); - memory->destroy( b_s ); - memory->destroy( b_t ); - memory->destroy( b_prc ); - memory->destroy( b_prm ); + memory->destroy(Hdia_inv); + memory->destroy(b_s); + memory->destroy(b_t); + memory->destroy(b_prc); + memory->destroy(b_prm); - memory->destroy( p ); - memory->destroy( q ); - memory->destroy( r ); - memory->destroy( d ); + memory->destroy(p); + memory->destroy(q); + memory->destroy(r); + memory->destroy(d); } /* ---------------------------------------------------------------------- */ @@ -322,7 +324,7 @@ void FixQEqReax::allocate_matrix() } n = atom->nlocal; - n_cap = MAX( (int)(n * safezone), mincap); + n_cap = MAX((int)(n * safezone), mincap); // determine the total space for the H matrix @@ -331,7 +333,7 @@ void FixQEqReax::allocate_matrix() i = ilist[ii]; m += numneigh[i]; } - m_cap = MAX( (int)(m * safezone), mincap * REAX_MIN_NBRS); + m_cap = MAX((int)(m * safezone), mincap * REAX_MIN_NBRS); H.n = n_cap; H.m = m_cap; @@ -345,10 +347,10 @@ void FixQEqReax::allocate_matrix() void FixQEqReax::deallocate_matrix() { - memory->destroy( H.firstnbr ); - memory->destroy( H.numnbrs ); - memory->destroy( H.jlist ); - memory->destroy( H.val ); + memory->destroy(H.firstnbr); + memory->destroy(H.numnbrs); + memory->destroy(H.jlist); + memory->destroy(H.val); } /* ---------------------------------------------------------------------- */ @@ -405,7 +407,7 @@ void FixQEqReax::init_shielding() for (i = 1; i <= ntypes; ++i) for (j = 1; j <= ntypes; ++j) - shld[i][j] = pow( gamma[i] * gamma[j], -1.5); + shld[i][j] = pow(gamma[i] * gamma[j], -1.5); } /* ---------------------------------------------------------------------- */ @@ -421,11 +423,11 @@ void FixQEqReax::init_taper() else if (swb < 5 && comm->me == 0) error->warning(FLERR,"Fix qeq/reax has very low Taper radius cutoff"); - d7 = pow( swb - swa, 7); - swa2 = SQR( swa); - swa3 = CUBE( swa); - swb2 = SQR( swb); - swb3 = CUBE( swb); + d7 = pow(swb - swa, 7); + swa2 = SQR(swa); + swa3 = CUBE(swa); + swb2 = SQR(swb); + swb3 = CUBE(swb); Tap[7] = 20.0 / d7; Tap[6] = -70.0 * (swa + swb) / d7; @@ -581,7 +583,7 @@ void FixQEqReax::init_matvec() b_t[i] = -1.0; /* quadratic extrapolation for s & t from previous solutions */ - t[i] = t_hist[i][2] + 3 * ( t_hist[i][0] - t_hist[i][1]); + t[i] = t_hist[i][2] + 3 * (t_hist[i][0] - t_hist[i][1]); /* cubic extrapolation for s & t from previous solutions */ s[i] = 4*(s_hist[i][0]+s_hist[i][2])-(6*s_hist[i][1]+s_hist[i][3]); @@ -589,9 +591,9 @@ void FixQEqReax::init_matvec() } pack_flag = 2; - comm->forward_comm_fix(this); //Dist_vector( s ); + comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 3; - comm->forward_comm_fix(this); //Dist_vector( t ); + comm->forward_comm_fix(this); //Dist_vector(t); } /* ---------------------------------------------------------------------- */ @@ -643,7 +645,7 @@ void FixQEqReax::compute_H() if (flag) { H.jlist[m_fill] = j; - H.val[m_fill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]]); + H.val[m_fill] = calculate_H(sqrt(r_sqr), shld[type[i]][type[j]]); m_fill++; } } @@ -658,7 +660,7 @@ void FixQEqReax::compute_H() /* ---------------------------------------------------------------------- */ -double FixQEqReax::calculate_H( double r, double gamma) +double FixQEqReax::calculate_H(double r, double gamma) { double Taper, denom; @@ -678,7 +680,7 @@ double FixQEqReax::calculate_H( double r, double gamma) /* ---------------------------------------------------------------------- */ -int FixQEqReax::CG( double *b, double *x) +int FixQEqReax::CG(double *b, double *x) { int i, j; double tmp, alpha, beta, b_norm; @@ -687,10 +689,10 @@ int FixQEqReax::CG( double *b, double *x) int jj; pack_flag = 1; - sparse_matvec( &H, x, q); - comm->reverse_comm_fix(this); //Coll_Vector( q ); + sparse_matvec(&H, x, q); + comm->reverse_comm_fix(this); //Coll_Vector(q); - vector_sum( r , 1., b, -1., q, nn); + vector_sum(r , 1., b, -1., q, nn); for (jj = 0; jj < nn; ++jj) { j = ilist[jj]; @@ -698,19 +700,19 @@ int FixQEqReax::CG( double *b, double *x) d[j] = r[j] * Hdia_inv[j]; //pre-condition } - b_norm = parallel_norm( b, nn); - sig_new = parallel_dot( r, d, nn); + b_norm = parallel_norm(b, nn); + sig_new = parallel_dot(r, d, nn); for (i = 1; i < imax && sqrt(sig_new) / b_norm > tolerance; ++i) { - comm->forward_comm_fix(this); //Dist_vector( d ); - sparse_matvec( &H, d, q ); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->forward_comm_fix(this); //Dist_vector(d); + sparse_matvec(&H, d, q); + comm->reverse_comm_fix(this); //Coll_vector(q); - tmp = parallel_dot( d, q, nn); + tmp = parallel_dot(d, q, nn); alpha = sig_new / tmp; - vector_add( x, alpha, d, nn ); - vector_add( r, -alpha, q, nn ); + vector_add(x, alpha, d, nn); + vector_add(r, -alpha, q, nn); // pre-conditioning for (jj = 0; jj < nn; ++jj) { @@ -720,10 +722,10 @@ int FixQEqReax::CG( double *b, double *x) } sig_old = sig_new; - sig_new = parallel_dot( r, p, nn); + sig_new = parallel_dot(r, p, nn); beta = sig_new / sig_old; - vector_sum( d, 1., p, beta, d, nn ); + vector_sum(d, 1., p, beta, d, nn); } if (i >= imax && comm->me == 0) @@ -736,7 +738,7 @@ int FixQEqReax::CG( double *b, double *x) /* ---------------------------------------------------------------------- */ -void FixQEqReax::sparse_matvec( sparse_matrix *A, double *x, double *b) +void FixQEqReax::sparse_matvec(sparse_matrix *A, double *x, double *b) { int i, j, itr_j; int ii; @@ -776,8 +778,8 @@ void FixQEqReax::calculate_Q() int ii; - s_sum = parallel_vector_acc( s, nn); - t_sum = parallel_vector_acc( t, nn); + s_sum = parallel_vector_acc(s, nn); + t_sum = parallel_vector_acc(t, nn); u = s_sum / t_sum; for (ii = 0; ii < nn; ++ii) { @@ -796,7 +798,7 @@ void FixQEqReax::calculate_Q() } pack_flag = 4; - comm->forward_comm_fix(this); //Dist_vector( atom->q ); + comm->forward_comm_fix(this); //Dist_vector(atom->q); } /* ---------------------------------------------------------------------- */ @@ -953,7 +955,7 @@ int FixQEqReax::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_norm( double *v, int n) +double FixQEqReax::parallel_norm(double *v, int n) { int i; double my_sum, norm_sqr; @@ -965,17 +967,17 @@ double FixQEqReax::parallel_norm( double *v, int n) for (ii = 0; ii < n; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) - my_sum += SQR( v[i]); + my_sum += SQR(v[i]); } - MPI_Allreduce( &my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); - return sqrt( norm_sqr); + return sqrt(norm_sqr); } /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_dot( double *v1, double *v2, int n) +double FixQEqReax::parallel_dot(double *v1, double *v2, int n) { int i; double my_dot, res; @@ -990,14 +992,14 @@ double FixQEqReax::parallel_dot( double *v1, double *v2, int n) my_dot += v1[i] * v2[i]; } - MPI_Allreduce( &my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world); return res; } /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_vector_acc( double *v, int n) +double FixQEqReax::parallel_vector_acc(double *v, int n) { int i; double my_acc, res; @@ -1012,14 +1014,14 @@ double FixQEqReax::parallel_vector_acc( double *v, int n) my_acc += v[i]; } - MPI_Allreduce( &my_acc, &res, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&my_acc, &res, 1, MPI_DOUBLE, MPI_SUM, world); return res; } /* ---------------------------------------------------------------------- */ -void FixQEqReax::vector_sum( double* dest, double c, double* v, +void FixQEqReax::vector_sum(double* dest, double c, double* v, double d, double* y, int k) { int kk; @@ -1033,7 +1035,7 @@ void FixQEqReax::vector_sum( double* dest, double c, double* v, /* ---------------------------------------------------------------------- */ -void FixQEqReax::vector_add( double* dest, double c, double* v, int k) +void FixQEqReax::vector_add(double* dest, double c, double* v, int k) { int kk; From ab8d78c8f49250464843cf20a3078dbaa3e9ce58 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 04:33:52 -0400 Subject: [PATCH 045/119] convert control file reader code to use text file reader class --- src/USER-REAXC/reaxc_control.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index aacb043600..f33cf9ca48 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -28,7 +28,7 @@ #include "error.h" #include "utils.h" -#include "tokenizer.h" +#include "text_file_reader.h" #include #include @@ -60,19 +60,14 @@ namespace ReaxFF { const char *what() const noexcept { return message.c_str(); } }; + // NOTE: this function is run on MPI rank 0 only + void Read_Control_File(const char *control_file, control_params *control, output_controls *out_control) { - FILE *fp; - char line[MAX_LINE]; auto error = control->error_ptr; auto lmp = control->lmp_ptr; - /* open control file */ - fp = fopen(control_file, "r"); - if (!fp) - error->one(FLERR,fmt::format("The control file {} cannot be opened: {}", - control_file, getsyserror())); /* assign default values */ strcpy(control->sim_name, "simulate"); control->nthreads = 1; @@ -92,13 +87,16 @@ namespace ReaxFF { out_control->angle_info = 0; /* read control parameters file */ - while (fgets(line, MAX_LINE, fp)) { - ValueTokenizer values(line); + try { + LAMMPS_NS::TextFileReader reader(control_file, "ReaxFF control"); + reader.ignore_comments = false; - // empty line - if (values.count() == 0) continue; + while (1) { + auto values = reader.next_values(0); + + // empty line + if (values.count() == 0) continue; - try { auto keyword = values.next_string(); if (!values.has_next()) @@ -139,10 +137,11 @@ namespace ReaxFF { } else { throw parser_error(fmt::format("Unknown parameter {} in control file", keyword)); } - } catch (std::exception &e) { - error->one(FLERR, e.what()); } + } catch (LAMMPS_NS::EOFException &) { + ; // catch and ignore + } catch (std::exception &e) { + error->one(FLERR, e.what()); } - fclose(fp); } } From 6c88baceb7ddef8053fe4adfa0fd728607b973b1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 05:16:41 -0400 Subject: [PATCH 046/119] remove support for writing "native" trajectory files from USER-REAXC --- src/.gitignore | 4 +- src/Purge.list | 2 + src/USER-OMP/pair_reaxc_omp.cpp | 8 +- src/USER-OMP/reaxc_bond_orders_omp.cpp | 3 +- src/USER-OMP/reaxc_forces_omp.cpp | 9 +- src/USER-OMP/reaxc_init_md_omp.cpp | 5 +- src/USER-OMP/reaxff_omp.h | 11 +- src/USER-REAXC/pair_reaxc.cpp | 25 +- src/USER-REAXC/reaxc_bond_orders.cpp | 5 +- src/USER-REAXC/reaxc_control.cpp | 47 +- src/USER-REAXC/reaxc_forces.cpp | 27 +- src/USER-REAXC/reaxc_init_md.cpp | 4 +- src/USER-REAXC/reaxc_io_tools.cpp | 99 ----- src/USER-REAXC/reaxc_reset_tools.cpp | 25 +- src/USER-REAXC/reaxc_traj.cpp | 569 ------------------------- src/USER-REAXC/reaxff_api.h | 39 +- src/USER-REAXC/reaxff_types.h | 24 -- 17 files changed, 61 insertions(+), 845 deletions(-) delete mode 100644 src/USER-REAXC/reaxc_io_tools.cpp delete mode 100644 src/USER-REAXC/reaxc_traj.cpp diff --git a/src/.gitignore b/src/.gitignore index 818b9bfcae..cb0b811521 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1199,11 +1199,9 @@ /reaxc_bonds.cpp /reaxc_control.cpp /reaxc_ffield.cpp -/reaxc_ffield.h /reaxc_forces.cpp /reaxc_hydrogen_bonds.cpp /reaxc_init_md.cpp -/reaxc_io_tools.cpp /reaxc_list.cpp /reaxc_lookup.cpp /reaxc_multi_body.cpp @@ -1211,11 +1209,11 @@ /reaxc_reset_tools.cpp /reaxc_tool_box.cpp /reaxc_torsion_angles.cpp -/reaxc_traj.cpp /reaxc_valence_angles.cpp /reaxff_api.h /reaxff_defs.h /reaxff_inline.h +/reaxff_omp.h /reaxff_types.h /remap.cpp /remap.h diff --git a/src/Purge.list b/src/Purge.list index 17f7291a38..39e43414cf 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -62,6 +62,7 @@ reaxc_forces.h reaxc_hydrogen_bonds.h reaxc_init_md.h reaxc_io_tools.h +reaxc_io_tools.cpp reaxc_list.h reaxc_lookup.h reaxc_multi_body.h @@ -72,6 +73,7 @@ reaxc_system_props.cpp reaxc_tool_box.h reaxc_torsion_angles.h reaxc_traj.h +reaxc_traj.cpp reaxc_types.h reaxc_valence_angles.h reaxc_vector.h diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 0f8ae18009..9bfd1a3722 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -211,7 +211,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) startTimeBase = MPI_Wtime(); #endif - Compute_ForcesOMP(api->system,api->control,api->data,api->workspace,&api->lists,api->out_control); + Compute_ForcesOMP(api->system,api->control,api->data,api->workspace,&api->lists); read_reax_forces(vflag); #ifdef OMP_TIMING @@ -270,8 +270,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) api->data->step = update->ntimestep; - Output_Results(api->system, api->control, api->data, &api->lists, api->out_control, world); - // populate tmpid and tmpbo arrays for fix reax/c/species if (fixspecies_flag) { @@ -393,8 +391,8 @@ void PairReaxCOMP::setup() write_reax_lists(); - InitializeOMP(api->system, api->control, api->data, api->workspace, - &api->lists, api->out_control, world); + InitializeOMP(api->system, api->control, api->data, + api->workspace, &api->lists, world); for (int k = 0; k < api->system->N; ++k) { num_bonds[k] = api->system->my_atoms[k].num_bonds; diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index 745290fa37..c3c1fb37df 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -366,8 +366,7 @@ namespace ReaxFF { /* ---------------------------------------------------------------------- */ - void BOOMP( reax_system *system, control_params * /* control */, simulation_data * /* data */, - storage *workspace, reax_list **lists, output_controls * /* out_control */) + void BOOMP( reax_system *system, storage *workspace, reax_list **lists) { double p_lp1 = system->reax_param.gp.l[15]; double p_boc1 = system->reax_param.gp.l[0]; diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 29b70c10a4..70bae4a761 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -43,10 +43,10 @@ namespace ReaxFF { static void Compute_Bonded_ForcesOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + reax_list **lists) { - BOOMP(system, control, data, workspace, lists, out_control); + BOOMP(system, workspace, lists); BondsOMP(system, data, workspace, lists); Atom_EnergyOMP(system, data, workspace, lists); Valence_AnglesOMP(system, control, data, workspace, lists); @@ -476,14 +476,13 @@ namespace ReaxFF { void Compute_ForcesOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + reax_list **lists) { // Init Forces Init_Forces_noQEq_OMP(system, control, data, workspace, lists); // Bonded Interactions - Compute_Bonded_ForcesOMP(system, control, data, workspace, - lists, out_control); + Compute_Bonded_ForcesOMP(system, control, data, workspace, lists); // Nonbonded Interactions Compute_NonBonded_ForcesOMP(system, control, data, workspace, lists); diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index eb81fe8280..cccee3afe8 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -94,16 +94,13 @@ namespace ReaxFF { // The only difference with the MPI-only function is calls to Init_ListsOMP and Init_Force_FunctionsOMP(). void InitializeOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm world) + reax_list **lists, MPI_Comm world) { Init_System(system,control); Init_Simulation_Data(data); Init_Workspace(system,control,workspace); Init_ListsOMP(system,control,lists); - Init_Output_Files(system,control,out_control,world); - if (control->tabulate) Init_Lookup_Tables(system,control,workspace,world); } diff --git a/src/USER-OMP/reaxff_omp.h b/src/USER-OMP/reaxff_omp.h index 952b1a292e..4188ac9bf7 100644 --- a/src/USER-OMP/reaxff_omp.h +++ b/src/USER-OMP/reaxff_omp.h @@ -40,8 +40,7 @@ namespace ReaxFF two_body_parameters *, int, double, double, double, double, double, double, double); - extern void BOOMP(reax_system *, control_params *, simulation_data *, - storage *, reax_list **, output_controls *); + extern void BOOMP(reax_system *, storage *, reax_list **); // bonds OpenMP @@ -51,8 +50,7 @@ namespace ReaxFF // forces OpenMP extern void Compute_ForcesOMP(reax_system *, control_params *, - simulation_data *, storage *, - reax_list **, output_controls *); + simulation_data *, storage *, reax_list **); // hydrogen bonds @@ -61,9 +59,8 @@ namespace ReaxFF // init md OpenMP - extern void InitializeOMP(reax_system *, control_params *, - simulation_data *, storage *, reax_list **, - output_controls *, MPI_Comm); + extern void InitializeOMP(reax_system *, control_params *, simulation_data *, + storage *, reax_list **,MPI_Comm); // multi body diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 3525b40b1d..565dc89eb0 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -77,8 +77,6 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) memset(api->system,0,sizeof(reax_system)); api->control = new control_params; memset(api->control,0,sizeof(control_params)); - api->out_control = new output_controls; - memset(api->out_control,0,sizeof(output_controls)); api->data = new simulation_data; api->workspace = new storage; memory->create(api->lists, LIST_N,"reaxff:lists"); @@ -124,7 +122,6 @@ PairReaxC::~PairReaxC() delete[] fix_id; if (setup_flag) { - Close_Output_Files(api->system,api->out_control); // deallocate reax data-structures @@ -141,7 +138,6 @@ PairReaxC::~PairReaxC() delete api->system; delete api->control; - delete api->out_control; delete api->data; delete api->workspace; memory->destroy(api->lists); @@ -192,8 +188,6 @@ void PairReaxC::settings(int narg, char **arg) // read name of control file or use default controls if (strcmp(arg[0],"NULL") == 0) { - strcpy(api->control->sim_name, "simulate"); - api->out_control->energy_update_freq = 0; api->control->tabulate = 0; api->control->bond_cut = 5.; @@ -204,15 +198,9 @@ void PairReaxC::settings(int narg, char **arg) api->control->nthreads = 1; - api->out_control->write_steps = 0; - strcpy(api->out_control->traj_title, "default_title"); - api->out_control->atom_info = 0; - api->out_control->bond_info = 0; - api->out_control->angle_info = 0; - } else Read_Control_File(arg[0], api->control, api->out_control); + } else Read_Control_File(arg[0], api->control); } MPI_Bcast(api->control,sizeof(control_params),MPI_CHAR,0,world); - MPI_Bcast(api->out_control,sizeof(output_controls),MPI_CHAR,0,world); // must reset these to local values after broadcast api->control->me = comm->me; @@ -431,8 +419,8 @@ void PairReaxC::setup() write_reax_lists(); api->system->wsize = comm->nprocs; - Initialize(api->system, api->control, api->data, api->workspace, - &api->lists, api->out_control, world); + Initialize(api->system, api->control, api->data, + api->workspace, &api->lists, world); for (int k = 0; k < api->system->N; ++k) { num_bonds[k] = api->system->my_atoms[k].num_bonds; num_hbonds[k] = api->system->my_atoms[k].num_hbonds; @@ -500,7 +488,7 @@ void PairReaxC::compute(int eflag, int vflag) // forces - Compute_Forces(api->system,api->control,api->data,api->workspace,&api->lists,api->out_control); + Compute_Forces(api->system,api->control,api->data,api->workspace,&api->lists); read_reax_forces(vflag); for (int k = 0; k < api->system->N; ++k) { @@ -526,9 +514,6 @@ void PairReaxC::compute(int eflag, int vflag) ecoul += api->data->my_en.e_ele; ecoul += api->data->my_en.e_pol; - // eng_vdwl += evdwl; - // eng_coul += ecoul; - // Store the different parts of the energy // in a list for output by compute pair command @@ -554,8 +539,6 @@ void PairReaxC::compute(int eflag, int vflag) api->data->step = update->ntimestep; - Output_Results(api->system, api->control, api->data, &api->lists, api->out_control, world); - // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index ae6fc3b823..f6e923406d 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -333,13 +333,10 @@ namespace ReaxFF { return 1; } - return 0; } - - void BO(reax_system *system, control_params * /*control*/, simulation_data * /*data*/, - storage *workspace, reax_list **lists, output_controls * /*out_control*/ ) + void BO(reax_system *system, storage *workspace, reax_list **lists) { int i, j, pj, type_i, type_j; int start_i, end_i, sym_index; diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index f33cf9ca48..05f6813d92 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -41,7 +41,7 @@ using LAMMPS_NS::utils::logmesg; using LAMMPS_NS::ValueTokenizer; namespace ReaxFF { - static std::unordered_set ignored_keywords = { + static std::unordered_set inactive_keywords = { "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", "restart_format", "restart_freq", "reposition_atoms", "restrict_bonds", "remove_CoM_vel", "debug_level", "reneighbor", @@ -50,8 +50,9 @@ namespace ReaxFF { "t_freq", "pressure", "p_mass", "pt_mass", "compress", "press_mode", "geo_format", "traj_compress", "traj_method", "molecular_analysis", "ignore", "dipole_anal", "freq_dipole_anal", "diffusion_coef", - "freq_diffusion_coef", "restrict_type" - }; + "freq_diffusion_coef", "restrict_type", "traj_title", "simulation_name", + "energy_update_freq", "atom_info", "atom_velocities", "atom_forces", + "bond_info", "angle_info" }; class parser_error : public std::exception { std::string message; @@ -62,14 +63,11 @@ namespace ReaxFF { // NOTE: this function is run on MPI rank 0 only - void Read_Control_File(const char *control_file, control_params *control, - output_controls *out_control) + void Read_Control_File(const char *control_file, control_params *control) { auto error = control->error_ptr; - auto lmp = control->lmp_ptr; /* assign default values */ - strcpy(control->sim_name, "simulate"); control->nthreads = 1; control->tabulate = 0; control->virial = 0; @@ -79,13 +77,6 @@ namespace ReaxFF { control->thb_cutsq = 0.00001; control->hbond_cut = 7.5; - out_control->write_steps = 0; - out_control->energy_update_freq = 0; - strcpy(out_control->traj_title, "default_title"); - out_control->atom_info = 0; - out_control->bond_info = 0; - out_control->angle_info = 0; - /* read control parameters file */ try { LAMMPS_NS::TextFileReader reader(control_file, "ReaxFF control"); @@ -102,12 +93,9 @@ namespace ReaxFF { if (!values.has_next()) throw parser_error(fmt::format("No value(s) for control parameter: {}\n",keyword)); - if (ignored_keywords.find(keyword) != ignored_keywords.end()) { - logmesg(lmp,fmt::format("Ignoring inactive control parameter: {}\n",keyword)); - } else if (keyword == "simulation_name") { - strcpy(control->sim_name, values.next_string().c_str()); - } else if (keyword == "energy_update_freq") { - out_control->energy_update_freq = values.next_int(); + if (inactive_keywords.find(keyword) != inactive_keywords.end()) { + error->warning(FLERR,fmt::format("Ignoring inactive control " + "parameter: {}",keyword)); } else if (keyword == "nbrhood_cutoff") { control->bond_cut = values.next_double(); } else if (keyword == "bond_graph_cutoff") { @@ -121,21 +109,12 @@ namespace ReaxFF { } else if (keyword == "tabulate_long_range") { control->tabulate = values.next_int(); } else if (keyword == "write_freq") { - out_control->write_steps = values.next_int(); - } else if (keyword == "traj_title") { - strcpy(out_control->traj_title, values.next_string().c_str()); - } else if (keyword == "atom_info") { - out_control->atom_info += values.next_int() * 4; - } else if (keyword == "atom_velocities") { - out_control->atom_info += values.next_int() * 2; - } else if (keyword == "atom_forces") { - out_control->atom_info += values.next_int() * 1; - } else if (keyword == "bond_info") { - out_control->bond_info = values.next_int(); - } else if (keyword == "angle_info") { - out_control->angle_info = values.next_int(); + if (values.next_int() > 0) + error->warning(FLERR,"Support for writing native trajectories has " + "been removed after LAMMPS version 8 April 2021"); } else { - throw parser_error(fmt::format("Unknown parameter {} in control file", keyword)); + throw parser_error(fmt::format("Unknown parameter {} in " + "control file", keyword)); } } } catch (LAMMPS_NS::EOFException &) { diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index a2e01db478..22b81633aa 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -34,11 +34,13 @@ namespace ReaxFF { - static void Compute_Bonded_Forces(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + static void Compute_Bonded_Forces(reax_system *system, + control_params *control, + simulation_data *data, + storage *workspace, + reax_list **lists) { - BO(system, control, data, workspace, lists, out_control); + BO(system, workspace, lists); Bonds(system, data, workspace, lists); Atom_Energy(system, control, data, workspace, lists); Valence_Angles(system, control, data, workspace, lists); @@ -47,8 +49,10 @@ namespace ReaxFF { Hydrogen_Bonds(system, control, data, workspace, lists); } - static void Compute_NonBonded_Forces(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, + static void Compute_NonBonded_Forces(reax_system *system, + control_params *control, + simulation_data *data, + storage *workspace, reax_list **lists) { @@ -60,7 +64,7 @@ namespace ReaxFF { } static void Compute_Total_Force(reax_system *system, control_params *control, - storage *workspace, reax_list **lists) + storage *workspace, reax_list **lists) { int i, pj; reax_list *bonds = (*lists) + BONDS; @@ -113,10 +117,6 @@ namespace ReaxFF { system->my_atoms[i].num_hbonds = (int)(MAX(Num_Entries(Hindex, hbonds)*saferzone, system->minhbonds)); - //if(Num_Entries(i, hbonds) >= - //(Start_Index(i+1,hbonds)-Start_Index(i,hbonds))*0.90/*DANGER_ZONE*/) { - // workspace->realloc.hbonds = 1; - if (Hindex < numH-1) comp = Start_Index(Hindex+1, hbonds); else comp = hbonds->num_intrs; @@ -374,14 +374,13 @@ namespace ReaxFF { void Compute_Forces(reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control) + reax_list **lists) { Init_Forces_noQEq(system, control, data, workspace, lists); /********* bonded interactions ************/ - Compute_Bonded_Forces(system, control, data, workspace, - lists, out_control); + Compute_Bonded_Forces(system, control, data, workspace, lists); /********* nonbonded interactions ************/ Compute_NonBonded_Forces(system, control, data, workspace, lists); diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index adc9bc137d..86a8677a02 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -163,14 +163,12 @@ namespace ReaxFF { void Initialize(reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - MPI_Comm world) + reax_list **lists, MPI_Comm world) { Init_System(system, control); Init_Simulation_Data(data); Init_Workspace(system, control, workspace); Init_Lists(system, control, lists); - Init_Output_Files(system, control, out_control, world); if (control->tabulate) Init_Lookup_Tables(system, control, workspace, world); } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp deleted file mode 100644 index d6fd4b3aa4..0000000000 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#include "reaxff_api.h" - -namespace ReaxFF { - void Collect_System_Energy(reax_system *system, simulation_data *data, - MPI_Comm comm) - { - double my_en[13], sys_en[13]; - - my_en[0] = data->my_en.e_bond; - my_en[1] = data->my_en.e_ov; - my_en[2] = data->my_en.e_un; - my_en[3] = data->my_en.e_lp; - my_en[4] = data->my_en.e_ang; - my_en[5] = data->my_en.e_pen; - my_en[6] = data->my_en.e_coa; - my_en[7] = data->my_en.e_hb; - my_en[8] = data->my_en.e_tor; - my_en[9] = data->my_en.e_con; - my_en[10] = data->my_en.e_vdW; - my_en[11] = data->my_en.e_ele; - my_en[12] = data->my_en.e_pol; - MPI_Reduce( my_en, sys_en, 13, MPI_DOUBLE, MPI_SUM, MASTER_NODE, comm ); - - if (system->my_rank == MASTER_NODE) { - data->sys_en.e_bond = sys_en[0]; - data->sys_en.e_ov = sys_en[1]; - data->sys_en.e_un = sys_en[2]; - data->sys_en.e_lp = sys_en[3]; - data->sys_en.e_ang = sys_en[4]; - data->sys_en.e_pen = sys_en[5]; - data->sys_en.e_coa = sys_en[6]; - data->sys_en.e_hb = sys_en[7]; - data->sys_en.e_tor = sys_en[8]; - data->sys_en.e_con = sys_en[9]; - data->sys_en.e_vdW = sys_en[10]; - data->sys_en.e_ele = sys_en[11]; - data->sys_en.e_pol = sys_en[12]; - } - } - - void Init_Output_Files(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world) - { - if (out_control->write_steps > 0) - Init_Traj(system, control, out_control, world); - } - - /************************ close output files ************************/ - void Close_Output_Files(reax_system *system, output_controls *out_control) - { - if (out_control->write_steps > 0) - End_Traj(system->my_rank, out_control); - } - - void Output_Results(reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, MPI_Comm world) - { - - if ((out_control->energy_update_freq > 0 && - data->step%out_control->energy_update_freq == 0) || - (out_control->write_steps > 0 && - data->step%out_control->write_steps == 0)) { - /* update system-wide energies */ - Collect_System_Energy(system, data, world); - - /* write current frame */ - if (out_control->write_steps > 0 && data->step % out_control->write_steps == 0) { - Append_Frame(system, control, data, lists, out_control, world); - } - } - } -} diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index bb0fc1eb5a..e7d8d4d024 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -49,28 +49,9 @@ namespace ReaxFF { } } - - static void Reset_Energies(energy_data *en) - { - en->e_bond = 0; - en->e_ov = 0; - en->e_un = 0; - en->e_lp = 0; - en->e_ang = 0; - en->e_pen = 0; - en->e_coa = 0; - en->e_hb = 0; - en->e_tor = 0; - en->e_con = 0; - en->e_vdW = 0; - en->e_ele = 0; - en->e_pol = 0; - } - void Reset_Simulation_Data(simulation_data* data) { - Reset_Energies(&data->my_en); - Reset_Energies(&data->sys_en); + memset(&data->my_en,0,sizeof(energy_data)); } void Reset_Workspace(reax_system *system, storage *workspace) @@ -136,8 +117,8 @@ namespace ReaxFF { } - void Reset(reax_system *system, control_params *control, simulation_data *data, - storage *workspace, reax_list **lists) + void Reset(reax_system *system, control_params *control, + simulation_data *data, storage *workspace, reax_list **lists) { Reset_Atoms(system, control); Reset_Simulation_Data(data); diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp deleted file mode 100644 index 91afc9e8d1..0000000000 --- a/src/USER-REAXC/reaxc_traj.cpp +++ /dev/null @@ -1,569 +0,0 @@ -/*---------------------------------------------------------------------- - PuReMD - Purdue ReaxFF Molecular Dynamics Program - - Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu - - Please cite the related publication: - H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, - "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details: - . - ----------------------------------------------------------------------*/ - -#include "reaxff_api.h" - -#include -#include - -#include "error.h" - -#define MAX_TRJ_LINE_LEN 120 -#define MAX_TRJ_BUFFER_SIZE (MAX_TRJ_LINE_LEN * 100) - -#define NUM_HEADER_LINES 37 -#define HEADER_LINE_LEN 62 -#define INIT_DESC_LEN 32 - -#define ATOM_BASIC_LEN 50 -#define ATOM_wV_LEN 80 -#define ATOM_wF_LEN 80 -#define ATOM_FULL_LEN 110 - -#define BOND_BASIC_LEN 39 -#define BOND_FULL_LEN 69 -#define ANGLE_BASIC_LEN 38 - -namespace ReaxFF { - - enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; - enum BOND_LINE_OPTS { OPT_NOBOND, OPT_BOND_BASIC, OPT_BOND_FULL, NR_OPT_BOND }; - enum ANGLE_LINE_OPTS { OPT_NOANGLE, OPT_ANGLE_BASIC, NR_OPT_ANGLE }; - - - std::string fmtline(const char *key, double val) - { - return fmt::format("{:<37}{:<24.3f}\n",key,val); - } - - std::string fmtline(const char *key, double val1, double val2, double val3) - { - return fmt::format("{:<32}{:>9.3f},{:>9.3f},{:>9.3f}\n",key,val1,val2,val3); - } - - template - std::string fmtline(const char *key, T val) - { - return fmt::format("{:<37}{:<24}\n",key,val); - } - - template - std::string fmtline(const char *key, T val1, T val2) - { - return fmt::format("{:<36}{:<12},{:<12}\n",key,val1,val2); - } - - static void Reallocate_Output_Buffer(LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space) - { - if (out_control->buffer_len > 0) - free(out_control->buffer); - - out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); - out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (!out_control->buffer) - error_ptr->one(FLERR,fmt::format("Insufficient memory for required buffer " - "size {}", (req_space*REAX_SAFE_ZONE))); - } - - static void Write_Skip_Line(output_controls *out_control, int my_rank, int skip, int num_section) - { - if (my_rank == MASTER_NODE) - fmt::print(out_control->strj,fmtline("chars_to_skip_section:",skip,num_section)); - } - - static void Write_Header(reax_system *system, control_params *control, output_controls *out_control) - { - char atom_formats[8][40] = { "none", "invalid", "invalid", "invalid", - "xyz_q", - "xyz_q_fxfyfz", - "xyz_q_vxvyvz", - "detailed_atom_info" }; - char bond_formats[3][30] = { "none", - "basic_bond_info", - "detailed_bond_info" }; - char angle_formats[2][30] = { "none", "basic_angle_info" }; - - /* only the master node writes into trajectory header */ - if (system->my_rank == MASTER_NODE) { - std::string buffer(""); - - /* to skip the header */ - buffer += fmtline("chars_to_skip_header:",(NUM_HEADER_LINES-1) * HEADER_LINE_LEN); - - /* general simulation info */ - buffer += fmtline("simulation_name:", out_control->traj_title); - buffer += fmtline("number_of_atoms:", system->bigN); - buffer += fmtline("ensemble_type:", "(unknown)"); - buffer += fmtline("number_of_steps:", 0); - buffer += fmtline("timestep_length_(in_fs):", 0.0); - - /* restart info */ - buffer += fmtline("is_this_a_restart?:", "no"); - buffer += fmtline("write_restart_files?:", "no"); - buffer += fmtline("frequency_to_write_restarts:", 0); - - /* preferences */ - buffer += fmtline("tabulate_long_range_intrs?:",(control->tabulate ? "yes" : "no")); - buffer += fmtline("table_size:", control->tabulate); - buffer += fmtline("restrict_bonds?:", "no"); - buffer += fmtline("bond_restriction_length:", 0); - buffer += fmtline("reposition_atoms?:", "fit to periodic box"); - buffer += fmtline("remove_CoM_velocity?:", 0); - buffer += fmtline("bonded_intr_dist_cutoff:",control->bond_cut); - buffer += fmtline("nonbonded_intr_dist_cutoff:",control->nonb_cut); - buffer += fmtline("hbond_dist_cutoff:",control->hbond_cut); - buffer += fmtline("reax_bond_threshold:",control->bo_cut); - buffer += fmtline("physical_bond_threshold:", control->bg_cut); - buffer += fmtline("valence_angle_threshold:",control->thb_cut); - buffer += fmtline("QEq_tolerance:", 0.0); - - /* temperature controls */ - buffer += fmtline("initial_temperature:", 0.0); - buffer += fmtline("target_temperature:", 0.0); - buffer += fmtline("thermal_inertia:", 0.0); - buffer += fmtline("temperature_regime:", "(unknown)"); - buffer += fmtline("temperature_change_rate_(K/ps):", 0.0); - - /* pressure controls */ - buffer += fmtline("target_pressure_(GPa):", 0.0, 0.0, 0.0); - buffer += fmtline("virial_inertia:", 0.0, 0.0, 0.0); - - /* trajectory */ - buffer += fmtline("energy_dumping_freq:", out_control->energy_update_freq); - buffer += fmtline("trajectory_dumping_freq:",out_control->write_steps); - buffer += fmtline("compress_trajectory_output?:", "no"); - buffer += fmtline("trajectory_format:", "regular"); - buffer += fmtline("atom_info:", atom_formats[out_control->atom_info]); - buffer += fmtline("bond_info:", bond_formats[out_control->bond_info]); - buffer += fmtline("angle_info:", angle_formats[out_control->angle_info]); - - /* analysis */ - buffer += fmtline("molecular_analysis:", "no"); - buffer += fmtline("molecular_analysis_frequency:", 0); - - /* dump out the buffer */ - - fputs(buffer.c_str(),out_control->strj); - } - } - - static void Write_Init_Desc(reax_system *system, output_controls *out_control, MPI_Comm world) - { - int i, me, np, cnt, buffer_len, buffer_req; - reax_atom *p_atom; - MPI_Status status; - - me = system->my_rank; - np = system->wsize; - - /* skip info */ - Write_Skip_Line(out_control, me, system->bigN*INIT_DESC_LEN, system->bigN); - - if (me == MASTER_NODE) - buffer_req = system->bigN * INIT_DESC_LEN + 1; - else buffer_req = system->n * INIT_DESC_LEN + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - out_control->buffer[0] = 0; - for (i = 0; i < system->n; ++i) { - p_atom = &(system->my_atoms[i]); - auto buffer = fmt::format("{:9}{:3}{:9}{:10.3f}\n", - p_atom->orig_id, p_atom->type, p_atom->name, - system->reax_param.sbp[p_atom->type].mass); - strncpy(out_control->buffer + i*INIT_DESC_LEN, buffer.c_str(), INIT_DESC_LEN+1); - } - - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np * INIT_DESCS + me, world); - } else { - buffer_len = system->n * INIT_DESC_LEN; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*INIT_DESCS+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); - } - } - - void Init_Traj(reax_system *system, control_params *control, - output_controls *out_control, MPI_Comm world) - { - int atom_line_len[NR_OPT_ATOM] = { 0, 0, 0, 0, ATOM_BASIC_LEN, ATOM_wV_LEN, ATOM_wF_LEN, ATOM_FULL_LEN}; - int bond_line_len[NR_OPT_BOND] = { 0, BOND_BASIC_LEN, BOND_FULL_LEN }; - int angle_line_len[NR_OPT_ANGLE] = { 0, ANGLE_BASIC_LEN }; - - /* generate trajectory name */ - auto fname = std::string(control->sim_name) + ".trj"; - - /* how should I write atoms? */ - out_control->atom_line_len = atom_line_len[out_control->atom_info]; - out_control->write_atoms = (out_control->atom_line_len ? 1 : 0); - /* bonds? */ - out_control->bond_line_len = bond_line_len[out_control->bond_info]; - out_control->write_bonds = (out_control->bond_line_len ? 1 : 0); - /* angles? */ - out_control->angle_line_len = angle_line_len[out_control->angle_info]; - out_control->write_angles = (out_control->angle_line_len ? 1 : 0); - - /* allocate line & buffer space */ - out_control->buffer_len = 0; - out_control->buffer = nullptr; - - /* write trajectory header and atom info, if applicable */ - if (system->my_rank == MASTER_NODE) - out_control->strj = fopen(fname.c_str(), "w"); - - Write_Header(system, control, out_control); - Write_Init_Desc(system, out_control, world); - } - - static void Write_Frame_Header(reax_system *system, simulation_data *data, output_controls *out_control) - { - const int me = system->my_rank; - /* frame header lengths */ - constexpr int num_frm_hdr_lines = 22; - - /* only the master node writes into trajectory header */ - if (me == MASTER_NODE) { - std::string buffer(""); - - /* skip info */ - buffer += fmtline("chars_to_skip_frame_header:", (num_frm_hdr_lines-1)*HEADER_LINE_LEN); - - /* step & time */ - buffer += fmtline("step:", data->step); - buffer += fmtline("time_in_ps:", 0.0); - - /* box info */ - buffer += fmtline("volume:", 0.0); - buffer += fmtline("box_dimensions:", 0.0, 0.0, 0.0); - buffer += fmtline("coordinate_angles:", 90.0, 90.0, 90.0); - - /* system T and P */ - buffer += fmtline("temperature:", 0.0); - buffer += fmtline("pressure:", 0.0); - - /* energies */ - double epot = data->sys_en.e_bond + data->sys_en.e_ov + data->sys_en.e_un - + data->sys_en.e_lp + data->sys_en.e_ang + data->sys_en.e_pen - + data->sys_en.e_coa + data->sys_en.e_hb + data->sys_en.e_tor - + data->sys_en.e_con + data->sys_en.e_vdW - + data->sys_en.e_ele + data->my_en.e_pol; - - buffer += fmtline("total_energy:", epot); - buffer += fmtline("total_kinetic:", 0.0); - buffer += fmtline("total_potential:", epot); - buffer += fmtline("bond_energy:", data->sys_en.e_bond); - buffer += fmtline("atom_energy:", data->sys_en.e_ov + data->sys_en.e_un); - buffer += fmtline("lone_pair_energy:", data->sys_en.e_lp); - buffer += fmtline("valence_angle_energy:", data->sys_en.e_ang + data->sys_en.e_pen); - buffer += fmtline("3-body_conjugation:", data->sys_en.e_coa); - buffer += fmtline("hydrogen_bond_energy:", data->sys_en.e_hb); - buffer += fmtline("torsion_angle_energy:", data->sys_en.e_tor); - buffer += fmtline("4-body_conjugation:", data->sys_en.e_con); - buffer += fmtline("vdWaals_energy:", data->sys_en.e_vdW); - buffer += fmtline("electrostatics_energy:", data->sys_en.e_ele); - buffer += fmtline("polarization_energy:", data->sys_en.e_pol); - - /* dump out the buffer */ - fputs(buffer.c_str(),out_control->strj); - } - } - - static void Write_Atoms(reax_system *system, output_controls *out_control, - MPI_Comm world) - { - int i, me, np, line_len, buffer_len, buffer_req, cnt; - MPI_Status status; - reax_atom *p_atom; - - me = system->my_rank; - np = system->wsize; - line_len = out_control->atom_line_len; - - Write_Skip_Line(out_control, me, system->bigN*line_len, system->bigN); - - if (me == MASTER_NODE) - buffer_req = system->bigN * line_len + 1; - else buffer_req = system->n * line_len + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - /* fill in buffer */ - out_control->buffer[0] = 0; - - for (i = 0; i < system->n; ++i) { - std::string buffer(""); - p_atom = &(system->my_atoms[i]); - buffer += fmt::format("{:9}{:10.3f}{:10.3f}{:10.3f}",p_atom->orig_id, - p_atom->x[0], p_atom->x[1],p_atom->x[2]); - - switch (out_control->atom_info) { - case OPT_ATOM_BASIC: - buffer += fmt::format("{:10.3f}\n",p_atom->q); - break; - case OPT_ATOM_wF: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); - break; - case OPT_ATOM_wV: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->v[0], p_atom->v[1], p_atom->v[2], p_atom->q); - break; - case OPT_ATOM_FULL: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}{:10.3f}\n", - p_atom->v[0], p_atom->v[1], p_atom->v[2], - p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q); - break; - default: - system->error_ptr->one(FLERR,"Write_traj_atoms: unknown atom trajectory format"); - } - - strncpy(out_control->buffer + i*line_len, buffer.c_str(), line_len+1); - } - - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ATOM_LINES+me, world); - } else { - buffer_len = system->n * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ATOM_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer, out_control->strj); - } - } - - static void Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, - output_controls *out_control, MPI_Comm world) - { - int i, j, pj, me, np; - int my_bonds, num_bonds; - int line_len, buffer_len, buffer_req, cnt; - MPI_Status status; - bond_data *bo_ij; - - me = system->my_rank; - np = system->wsize; - line_len = out_control->bond_line_len; - - /* count the number of bonds I will write */ - my_bonds = 0; - for (i=0; i < system->n; ++i) - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - j = bonds->select.bond_list[pj].nbr; - if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut) - ++my_bonds; - } - - /* allreduce - total number of bonds */ - MPI_Allreduce(&my_bonds, &num_bonds, 1, MPI_INT, MPI_SUM, world); - - Write_Skip_Line(out_control, me, num_bonds*line_len, num_bonds); - - if (me == MASTER_NODE) - buffer_req = num_bonds * line_len + 1; - else buffer_req = my_bonds * line_len + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - /* fill in the buffer */ - out_control->buffer[0] = 0; - - my_bonds = 0; - for (i=0; i < system->n; ++i) { - for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { - bo_ij = &(bonds->select.bond_list[pj]); - j = bo_ij->nbr; - - if (system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bo_ij->bo_data.BO >= control->bg_cut) { - auto buffer = fmt::format("{:9}{:9}{:10.3f}{:10.3f}", system->my_atoms[i].orig_id, - system->my_atoms[j].orig_id,bo_ij->d,bo_ij->bo_data.BO); - - switch (out_control->bond_info) { - case OPT_BOND_BASIC: - buffer += "\n"; - break; - case OPT_BOND_FULL: - buffer += fmt::format("{:10.3f}{:10.3f}{:10.3f}\n", bo_ij->bo_data.BO_s, - bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2); - break; - default: - system->error_ptr->one(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); - } - strncpy(out_control->buffer + my_bonds*line_len, buffer.c_str(), line_len+1); - ++my_bonds; - } - } - } - - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, np*BOND_LINES+me, world); - } else { - buffer_len = my_bonds * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*BOND_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); - } - } - - static void Write_Angles(reax_system *system, control_params *control, - reax_list *bonds, reax_list *thb_intrs, - output_controls *out_control, MPI_Comm world) - { - int i, j, k, pi, pk, me, np; - int my_angles, num_angles; - int line_len, buffer_len, buffer_req, cnt; - bond_data *bo_ij, *bo_jk; - three_body_interaction_data *angle_ijk; - MPI_Status status; - - me = system->my_rank; - np = system->wsize; - line_len = out_control->angle_line_len; - - /* count the number of valence angles I will output */ - my_angles = 0; - for (j = 0; j < system->n; ++j) - for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { - bo_ij = &(bonds->select.bond_list[pi]); - i = bo_ij->nbr; - - if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index(pi, thb_intrs); - pk < End_Index(pi, thb_intrs); ++pk) { - angle_ijk = &(thb_intrs->select.three_body_list[pk]); - k = angle_ijk->thb; - bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - - if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut) // physical j&k bond - ++my_angles; - } - } - /* total number of valences */ - MPI_Allreduce(&my_angles, &num_angles, 1, MPI_INT, MPI_SUM, world); - - Write_Skip_Line(out_control, me, num_angles*line_len, num_angles); - - if (me == MASTER_NODE) - buffer_req = num_angles * line_len + 1; - else buffer_req = my_angles * line_len + 1; - - if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer(system->error_ptr, out_control, buffer_req); - - /* fill in the buffer */ - my_angles = 0; - out_control->buffer[0] = 0; - for (j = 0; j < system->n; ++j) - for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { - bo_ij = &(bonds->select.bond_list[pi]); - i = bo_ij->nbr; - - if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for (pk = Start_Index(pi, thb_intrs); - pk < End_Index(pi, thb_intrs); ++pk) { - angle_ijk = &(thb_intrs->select.three_body_list[pk]); - k = angle_ijk->thb; - bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - - if (system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut) { // physical j&k bond - auto buffer = fmt::format("{:9}{:9}{:9}{:10.3f}\n", - system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, - system->my_atoms[k].orig_id, RAD2DEG(angle_ijk->theta)); - - strncpy(out_control->buffer + my_angles*line_len, buffer.c_str(), line_len+1); - ++my_angles; - } - } - } - - if (me != MASTER_NODE) { - MPI_Send(out_control->buffer, buffer_req-1, MPI_CHAR, MASTER_NODE, - np*ANGLE_LINES+me, world); - } else { - buffer_len = my_angles * line_len; - for (i = 0; i < np; ++i) - if (i != MASTER_NODE) { - MPI_Recv(out_control->buffer + buffer_len, buffer_req - buffer_len, - MPI_CHAR, i, np*ANGLE_LINES+i, world, &status); - MPI_Get_count(&status, MPI_CHAR, &cnt); - buffer_len += cnt; - } - out_control->buffer[buffer_len] = 0; - fputs(out_control->buffer,out_control->strj); - } - } - - void Append_Frame(reax_system *system, control_params *control, - simulation_data *data, reax_list **lists, - output_controls *out_control, MPI_Comm world) - { - Write_Frame_Header(system, data, out_control); - - if (out_control->write_atoms) - Write_Atoms(system, out_control, world); - - if (out_control->write_bonds) - Write_Bonds(system, control, (*lists + BONDS), out_control, world); - - if (out_control->write_angles) - Write_Angles(system, control, (*lists + BONDS), (*lists + THREE_BODIES), - out_control, world); - } - - void End_Traj(int my_rank, output_controls *out_control) - { - if (my_rank == MASTER_NODE) - fclose(out_control->strj); - - free(out_control->buffer); - } -} diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index cafc3516fd..819d7c0d3b 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -31,7 +31,6 @@ namespace ReaxFF struct API { control_params *control; reax_system *system; - output_controls *out_control; simulation_data *data; storage *workspace; reax_list *lists; @@ -39,7 +38,7 @@ namespace ReaxFF // exported Functions - // allocate X + // allocate extern void Allocate_Workspace(control_params *, storage *, int); extern void DeAllocate_System(reax_system *); @@ -50,8 +49,7 @@ namespace ReaxFF // bond orders - extern void BO(reax_system *, control_params *, simulation_data *, - storage *, reax_list **, output_controls *); + extern void BO(reax_system *, storage *, reax_list **); extern int BOp(storage *, reax_list *, double, int, int, far_neighbor_data *, single_body_parameters *, single_body_parameters *, two_body_parameters *); @@ -64,7 +62,7 @@ namespace ReaxFF // control - extern void Read_Control_File(const char *, control_params *, output_controls *); + extern void Read_Control_File(const char *, control_params *); // ffield @@ -73,8 +71,8 @@ namespace ReaxFF // forces - extern void Compute_Forces(reax_system *, control_params *, simulation_data *, - storage *, reax_list **, output_controls *); + extern void Compute_Forces(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); extern void Estimate_Storages(reax_system *, control_params *, reax_list **, int *, int *, int *, int *); @@ -88,16 +86,7 @@ namespace ReaxFF extern void Init_Simulation_Data(simulation_data *); extern void Init_Workspace(reax_system *, control_params *, storage *); extern void Initialize(reax_system *, control_params *, simulation_data *, - storage *, reax_list **, output_controls *, MPI_Comm); - - // io tools - - extern void Init_Output_Files(reax_system *, control_params *, - output_controls *, MPI_Comm); - extern void Close_Output_Files(reax_system *, output_controls *); - extern void Output_Results(reax_system *, control_params *, simulation_data *, - reax_list **, output_controls *, MPI_Comm); - extern void Collect_System_Energy(reax_system *, simulation_data *, MPI_Comm); + storage *, reax_list **, MPI_Comm); // lists @@ -163,24 +152,16 @@ namespace ReaxFF rvec, double, three_body_interaction_data *, three_body_interaction_data *, rvec, rvec, rvec, rvec); - extern void Torsion_Angles(reax_system *, control_params *, simulation_data *, - storage *, reax_list **); - - // traj - - extern void Init_Traj(reax_system *, control_params *, - output_controls *, MPI_Comm); - extern void End_Traj(int, output_controls *); - extern void Append_Frame(reax_system *, control_params *, simulation_data *, - reax_list **, output_controls *, MPI_Comm); + extern void Torsion_Angles(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); // valence angles extern void Calculate_Theta(rvec, double, rvec, double, double *, double *); extern void Calculate_dCos_Theta(rvec, double, rvec, double, rvec *, rvec *, rvec *); - extern void Valence_Angles(reax_system *, control_params *, simulation_data *, - storage *, reax_list **); + extern void Valence_Angles(reax_system *, control_params *, + simulation_data *, storage *, reax_list **); // vector diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index fc88e43dca..1a68116391 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -228,7 +228,6 @@ namespace ReaxFF /* system control parameters */ struct control_params { - char sim_name[REAX_MAX_STR]; int nthreads; double bond_cut; @@ -270,9 +269,7 @@ namespace ReaxFF struct simulation_data { rc_bigint step; - energy_data my_en; // per MPI rank energies - energy_data sys_en; // global energies }; struct three_body_interaction_data @@ -399,27 +396,6 @@ namespace ReaxFF class LAMMPS_NS::Error *error_ptr; }; - struct output_controls - { - FILE *strj; - int atom_line_len; - int bond_line_len; - int angle_line_len; - int write_atoms; - int write_bonds; - int write_angles; - int buffer_len; - char *buffer; - - int write_steps; - char traj_title[81]; - int atom_info; - int bond_info; - int angle_info; - - int energy_update_freq; - }; - struct LR_lookup_table { double xmin, xmax; From 0c88e571732622902de0fbc8cd278d69051f22d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 15:46:27 -0400 Subject: [PATCH 047/119] remove last remnants of OMP_TIMING code hack --- src/USER-OMP/fix_qeq_reax_omp.cpp | 84 +--------------------------- src/USER-OMP/pair_reaxc_omp.cpp | 92 ------------------------------- 2 files changed, 1 insertion(+), 175 deletions(-) diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 3f09fa7353..59a3c093e2 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -248,12 +248,6 @@ void FixQEqReaxOMP::init_storage() void FixQEqReaxOMP::pre_force(int /* vflag */) { - -#ifdef OMP_TIMING - double endTimeBase, startTimeBase, funcstartTimeBase; - funcstartTimeBase = MPI_Wtime(); -#endif - if (update->ntimestep % nevery) return; int n = atom->nlocal; @@ -279,69 +273,22 @@ void FixQEqReaxOMP::pre_force(int /* vflag */) if (n > n_cap*DANGER_ZONE || m_fill > m_cap*DANGER_ZONE) reallocate_matrix(); -#ifdef OMP_TIMING - startTimeBase = MPI_Wtime(); -#endif - init_matvec(); -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEINITMVINDEX] += (endTimeBase-startTimeBase); - startTimeBase = endTimeBase; -#endif - if (dual_enabled) { - matvecs = dual_CG(b_s, b_t, s, t); // OMP_TIMING inside dual_CG + matvecs = dual_CG(b_s, b_t, s, t); } else { matvecs_s = CG(b_s, s); // CG on s - parallel - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTECG1INDEX] += (endTimeBase-startTimeBase); - ompTimingCount[COMPUTECG1INDEX]++; - ompTimingCGCount[COMPUTECG1INDEX]+= matvecs_s; - startTimeBase = endTimeBase; -#endif - matvecs_t = CG(b_t, t); // CG on t - parallel - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTECG2INDEX] += (endTimeBase-startTimeBase); - ompTimingCount[COMPUTECG2INDEX]++; - ompTimingCGCount[COMPUTECG2INDEX]+= matvecs_t; - startTimeBase = endTimeBase; -#endif - } // if (dual_enabled) -#ifdef OMP_TIMING - startTimeBase = MPI_Wtime(); -#endif - calculate_Q(); - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTECALCQINDEX] += (endTimeBase-startTimeBase); -#endif - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEQEQINDEX] += (endTimeBase-funcstartTimeBase); -#endif } /* ---------------------------------------------------------------------- */ void FixQEqReaxOMP::init_matvec() { -#ifdef OMP_TIMING - long endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif - /* fill-in H matrix */ compute_H(); @@ -410,11 +357,6 @@ void FixQEqReaxOMP::init_matvec() comm->forward_comm_fix(this); //Dist_vector( s ); pack_flag = 3; comm->forward_comm_fix(this); //Dist_vector( t ); - -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEMVCOMPINDEX] += (long) (endTimeBase-startTimeBase); -#endif } /* ---------------------------------------------------------------------- */ @@ -685,12 +627,6 @@ void FixQEqReaxOMP::vector_add( double* dest, double c, double* v, int k) int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) { - -#ifdef OMP_TIMING - double endTimeBase, startTimeBase; - startTimeBase = MPI_Wtime(); -#endif - int i; double alpha_s, alpha_t, beta_s, beta_t, b_norm_s, b_norm_t; double sig_old_s, sig_old_t, sig_new_s, sig_new_t; @@ -836,15 +772,6 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) matvecs_s = matvecs_t = i; // The plus one makes consistent with count from CG() matvecs = i; - // Timing info for iterating s&t together -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTECG1INDEX] += (endTimeBase-startTimeBase); - ompTimingCount[COMPUTECG1INDEX]++; - ompTimingCGCount[COMPUTECG1INDEX]+= i; - startTimeBase = endTimeBase; -#endif - // If necessary, converge other system if (sqrt(sig_new_s)/b_norm_s > tolerance) { pack_flag = 2; @@ -861,15 +788,6 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) matvecs_t = i; } - // Timing info for remainder of s or t -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTECG2INDEX] += (endTimeBase-startTimeBase); - ompTimingCount[COMPUTECG2INDEX]++; - ompTimingCGCount[COMPUTECG2INDEX]+= i - matvecs; - startTimeBase = endTimeBase; -#endif - if ( i >= imax && comm->me == 0) error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " "after {} iterations at step {}", diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 9bfd1a3722..178c65a1b1 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -60,12 +60,6 @@ using namespace LAMMPS_NS; using namespace ReaxFF; -#ifdef OMP_TIMING -double ompTimingData[LASTTIMINGINDEX]; -int ompTimingCount[LASTTIMINGINDEX]; -int ompTimingCGCount[LASTTIMINGINDEX]; -#endif - static const char cite_pair_reax_c_omp[] = "pair reax/c/omp and fix qeq/reax/omp command:\n\n" "@Article{Aktulga17,\n" @@ -86,14 +80,6 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) api->system->omp_active = 1; num_nbrs_offset = nullptr; - -#ifdef OMP_TIMING - for (int i=0;iselect.bond_list[i].bo_data.CdboReduction, "CdboReduction"); } memory->destroy(num_nbrs_offset); - -#ifdef OMP_TIMING - int myrank; - - MPI_Comm_rank(world,&myrank); - - // Write screen output - if (timer->has_full() && myrank == 0 && screen) { - fprintf(screen,"\n\nWrite_Lists took %11.3lf seconds", ompTimingData[COMPUTEWLINDEX]); - - fprintf(screen,"\n\nCompute_Forces took %11.3lf seconds:", ompTimingData[COMPUTEINDEX]); - fprintf(screen,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]); - fprintf(screen,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]); - fprintf(screen,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]); - fprintf(screen,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]); - fprintf(screen,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]); - fprintf(screen,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]); - fprintf(screen,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]); - fprintf(screen,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]); - fprintf(screen,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]); - - fprintf(screen,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]); - fprintf(screen,"\n ->QEQ init: %11.3lf seconds", ompTimingData[COMPUTEINITMVINDEX]); - - double avg = double(ompTimingCGCount[COMPUTECG1INDEX]) / double(ompTimingCount[COMPUTECG1INDEX]); - fprintf(screen,"\n ->QEQ CG1: %11.3lf seconds with %4.1lf iterations on average.", ompTimingData[COMPUTECG1INDEX], avg); - - avg = double(ompTimingCGCount[COMPUTECG2INDEX]) / double(ompTimingCount[COMPUTECG2INDEX]); - fprintf(screen,"\n ->QEQ CG2: %11.3lf seconds with %4.1lf iterations on average.", ompTimingData[COMPUTECG2INDEX], avg); - fprintf(screen,"\n ->QEQ CalcQ: %11.3lf seconds\n", ompTimingData[COMPUTECALCQINDEX]); - } - - // Write logfile output - if (timer->has_full() && myrank == 0 && logfile) { - fprintf(logfile,"\n\nWrite_Lists took %11.3lf seconds", ompTimingData[COMPUTEWLINDEX]); - - fprintf(logfile,"\n\nCompute_Forces took %11.3lf seconds:", ompTimingData[COMPUTEINDEX]); - fprintf(logfile,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]); - fprintf(logfile,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]); - fprintf(logfile,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]); - fprintf(logfile,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]); - fprintf(logfile,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]); - fprintf(logfile,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]); - fprintf(logfile,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]); - fprintf(logfile,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]); - fprintf(logfile,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]); - - fprintf(logfile,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]); - fprintf(logfile,"\n ->QEQ init: %11.3lf seconds", ompTimingData[COMPUTEINITMVINDEX]); - - double avg = double(ompTimingCGCount[COMPUTECG1INDEX]) / double(ompTimingCount[COMPUTECG1INDEX]); - fprintf(logfile,"\n ->QEQ CG1: %11.3lf seconds with %4.1lf iterations on average.", ompTimingData[COMPUTECG1INDEX], avg); - - avg = double(ompTimingCGCount[COMPUTECG2INDEX]) / double(ompTimingCount[COMPUTECG2INDEX]); - fprintf(logfile,"\n ->QEQ CG2: %11.3lf seconds with %4.1lf iterations on average.", ompTimingData[COMPUTECG2INDEX], avg); - fprintf(logfile,"\n ->QEQ CalcQ: %11.3lf seconds\n", ompTimingData[COMPUTECALCQINDEX]); - } -#endif } /* ---------------------------------------------------------------------- */ @@ -206,19 +134,9 @@ void PairReaxCOMP::compute(int eflag, int vflag) // forces -#ifdef OMP_TIMING - double startTimeBase,endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - Compute_ForcesOMP(api->system,api->control,api->data,api->workspace,&api->lists); read_reax_forces(vflag); -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEINDEX] += (endTimeBase-startTimeBase); -#endif - #if defined(_OPENMP) #pragma omp parallel for schedule(static) #endif @@ -478,11 +396,6 @@ int PairReaxCOMP::estimate_reax_lists() int PairReaxCOMP::write_reax_lists() { -#ifdef OMP_TIMING - double startTimeBase, endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - int itr_i, itr_j, i, j, num_mynbrs; int *jlist; double d_sqr, dist, cutoff_sqr; @@ -542,11 +455,6 @@ int PairReaxCOMP::write_reax_lists() Set_End_Index(i, num_nbrs_offset[i] + num_mynbrs, far_nbrs); } -#ifdef OMP_TIMING - endTimeBase = MPI_Wtime(); - ompTimingData[COMPUTEWLINDEX] += (endTimeBase-startTimeBase); -#endif - return num_nbrs; } From 937bfe7dd83baefc71d38a9c89ea0f10fe2abc8e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 21:15:45 -0400 Subject: [PATCH 048/119] add some convenience variables to improve readability --- src/USER-REAXC/reaxc_ffield.cpp | 356 ++++++++++++++------------------ 1 file changed, 158 insertions(+), 198 deletions(-) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 67b11bee05..1a47b46f56 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -77,27 +77,28 @@ namespace ReaxFF { ++lineno; // set some defaults + auto gp = reax->gp; - reax->gp.vdw_type = 0; + gp.vdw_type = 0; // get number of global parameters auto values = reader.next_values(0); n = values.next_int(); - reax->gp.n_global = n; + gp.n_global = n; ++lineno; if (n < 1) THROW_ERROR("Invalid number of global parameters"); - memory->create(reax->gp.l,n,"reaxff:gp.l"); + memory->create(gp.l,n,"reaxff:gp.l"); // see reaxff_types.h for mapping between l[i] and the lambdas used in ff for (i = 0; i < n; ++i) { values = reader.next_values(0); ++lineno; - reax->gp.l[i] = values.next_double(); + gp.l[i] = values.next_double(); } // next line is number of atom types followed by 3 lines of comments @@ -111,18 +112,23 @@ namespace ReaxFF { lineno += 4; // allocate and clear storage for ffield data + auto sbp = reax->sbp; + auto tbp = reax->tbp; + auto thbp = reax->thbp; + auto hbp = reax->hbp; + auto fbp = reax->fbp; - memory->create(reax->sbp,n,"reaxff:sbp"); - memory->create(reax->tbp,n,n,"reaxff:tbp"); - memory->create(reax->thbp,n,n,n,"reaxff:thbp"); - memory->create(reax->hbp,n,n,n,"reaxff:hbp"); - memory->create(reax->fbp,n,n,n,n,"reaxff:fbp"); + memory->create(sbp,n,"reaxff:sbp"); + memory->create(tbp,n,n,"reaxff:tbp"); + memory->create(thbp,n,n,n,"reaxff:thbp"); + memory->create(hbp,n,n,n,"reaxff:hbp"); + memory->create(fbp,n,n,n,n,"reaxff:fbp"); memory->create(tor_flag,n,n,n,n,"reaxff:tor_flag"); - memset(&(reax->sbp[0]),0,sizeof(single_body_parameters)*n); - memset(&(reax->tbp[0][0]),0,sizeof(two_body_parameters)*n*n); - memset(&(reax->thbp[0][0][0]),0,sizeof(three_body_header)*n*n*n); - memset(&(reax->hbp[0][0][0]),0,sizeof(hbond_parameters)*n*n*n); - memset(&(reax->fbp[0][0][0][0]),0,sizeof(four_body_header)*n*n*n*n); + memset(&(sbp[0]),0,sizeof(single_body_parameters)*n); + memset(&(tbp[0][0]),0,sizeof(two_body_parameters)*n*n); + memset(&(thbp[0][0][0]),0,sizeof(three_body_header)*n*n*n); + memset(&(hbp[0][0][0]),0,sizeof(hbond_parameters)*n*n*n); + memset(&(fbp[0][0][0][0]),0,sizeof(four_body_header)*n*n*n*n); memset(&tor_flag[0][0][0][0],0,sizeof(char)*n*n*n*n); // atomic parameters @@ -133,6 +139,7 @@ namespace ReaxFF { const int lgflag = control->lgflag; const int ntypes = n; + for (i = 0; i < ntypes; ++i) { // line one @@ -146,20 +153,20 @@ namespace ReaxFF { THROW_ERROR("Invalid force field file format"); auto element = values.next_string(); - int len = MIN(element.size(),3); + int len = MIN(element.size(),3); // truncate stored element symbol if necessary for (j = 0; j < len; ++j) - reax->sbp[i].name[j] = toupper(element[j]); - reax->sbp[i].name[j] = '\0'; + sbp[i].name[j] = toupper(element[j]); + sbp[i].name[len] = '\0'; - reax->sbp[i].r_s = values.next_double(); - reax->sbp[i].valency = values.next_double(); - reax->sbp[i].mass = values.next_double(); - reax->sbp[i].r_vdw = values.next_double(); - reax->sbp[i].epsilon = values.next_double(); - reax->sbp[i].gamma = values.next_double(); - reax->sbp[i].r_pi = values.next_double(); - reax->sbp[i].valency_e = values.next_double(); - reax->sbp[i].nlp_opt = 0.5 * (reax->sbp[i].valency_e-reax->sbp[i].valency); + sbp[i].r_s = values.next_double(); + sbp[i].valency = values.next_double(); + sbp[i].mass = values.next_double(); + sbp[i].r_vdw = values.next_double(); + sbp[i].epsilon = values.next_double(); + sbp[i].gamma = values.next_double(); + sbp[i].r_pi = values.next_double(); + sbp[i].valency_e = values.next_double(); + sbp[i].nlp_opt = 0.5 * (sbp[i].valency_e-sbp[i].valency); // line two @@ -168,14 +175,14 @@ namespace ReaxFF { if (values.count() < 8) THROW_ERROR("Invalid force field file format"); - reax->sbp[i].alpha = values.next_double(); - reax->sbp[i].gamma_w = values.next_double(); - reax->sbp[i].valency_boc= values.next_double(); - reax->sbp[i].p_ovun5 = values.next_double(); + sbp[i].alpha = values.next_double(); + sbp[i].gamma_w = values.next_double(); + sbp[i].valency_boc= values.next_double(); + sbp[i].p_ovun5 = values.next_double(); values.skip(); - reax->sbp[i].chi = values.next_double(); - reax->sbp[i].eta = 2.0*values.next_double(); - reax->sbp[i].p_hbond = (int) values.next_double(); + sbp[i].chi = values.next_double(); + sbp[i].eta = 2.0*values.next_double(); + sbp[i].p_hbond = (int) values.next_double(); // line three @@ -184,12 +191,12 @@ namespace ReaxFF { if (values.count() < 8) THROW_ERROR("Invalid force field file format"); - reax->sbp[i].r_pi_pi = values.next_double(); - reax->sbp[i].p_lp2 = values.next_double(); + sbp[i].r_pi_pi = values.next_double(); + sbp[i].p_lp2 = values.next_double(); values.skip(); - reax->sbp[i].b_o_131 = values.next_double(); - reax->sbp[i].b_o_132 = values.next_double(); - reax->sbp[i].b_o_133 = values.next_double(); + sbp[i].b_o_131 = values.next_double(); + sbp[i].b_o_132 = values.next_double(); + sbp[i].b_o_133 = values.next_double(); // line four @@ -198,14 +205,14 @@ namespace ReaxFF { if (values.count() < 8) THROW_ERROR("Invalid force field file format"); - reax->sbp[i].p_ovun2 = values.next_double(); - reax->sbp[i].p_val3 = values.next_double(); + sbp[i].p_ovun2 = values.next_double(); + sbp[i].p_val3 = values.next_double(); values.skip(); - reax->sbp[i].valency_val= values.next_double(); - reax->sbp[i].p_val5 = values.next_double(); - reax->sbp[i].rcore2 = values.next_double(); - reax->sbp[i].ecore2 = values.next_double(); - reax->sbp[i].acore2 = values.next_double(); + sbp[i].valency_val= values.next_double(); + sbp[i].p_val5 = values.next_double(); + sbp[i].rcore2 = values.next_double(); + sbp[i].ecore2 = values.next_double(); + sbp[i].acore2 = values.next_double(); // read line five only when lgflag != 0 @@ -214,72 +221,72 @@ namespace ReaxFF { ++lineno; if (values.count() < 2) THROW_ERROR("Invalid force field file format"); - reax->sbp[i].lgcij = values.next_double(); - reax->sbp[i].lgre = values.next_double(); - } else reax->sbp[i].lgcij = reax->sbp[i].lgre = 0.0; + sbp[i].lgcij = values.next_double(); + sbp[i].lgre = values.next_double(); + } else sbp[i].lgcij = sbp[i].lgre = 0.0; // van der Waals settings check: // Inner-wall? - if ((reax->sbp[i].rcore2 > 0.01) && (reax->sbp[i].acore2 > 0.01)) { + if ((sbp[i].rcore2 > 0.01) && (sbp[i].acore2 > 0.01)) { // Shielding van der Waals? - if (reax->sbp[i].gamma_w > 0.5) { - if (reax->gp.vdw_type != 0 && reax->gp.vdw_type != 3) { + if (sbp[i].gamma_w > 0.5) { + if (gp.vdw_type != 0 && gp.vdw_type != 3) { const auto errmsg = fmt::format("Van der Waals parameters for element {} " "indicate inner wall+shielding, but earlier " "atoms indicate a different van der Waals " "method. This may cause division-by-zero " "errors. Keeping van der Waals setting for " - "earlier atoms.",reax->sbp[i].name); + "earlier atoms.",sbp[i].name); error->warning(FLERR,errmsg); } else { - reax->gp.vdw_type = 3; + gp.vdw_type = 3; } } else { // No shielding van der Waals parameters present - if ((reax->gp.vdw_type != 0) && (reax->gp.vdw_type != 2)) { + if ((gp.vdw_type != 0) && (gp.vdw_type != 2)) { const auto errmsg = fmt::format("Van der Waals parameters for element {} " "indicate inner wall withou shielding, but " "earlier atoms indicate a different van der " "Waals-method. This may cause division-by-" "zero errors. Keeping van der Waals setting " - "for earlier atoms.", reax->sbp[i].name); + "for earlier atoms.", sbp[i].name); error->warning(FLERR,errmsg); } else { - reax->gp.vdw_type = 2; + gp.vdw_type = 2; } } } else { // No Inner wall parameters present - if (reax->sbp[i].gamma_w > 0.5) { // Shielding vdWaals - if ((reax->gp.vdw_type != 0) && (reax->gp.vdw_type != 1)) { + if (sbp[i].gamma_w > 0.5) { // Shielding vdWaals + if ((gp.vdw_type != 0) && (gp.vdw_type != 1)) { const auto errmsg = fmt::format("Van der Waals parameters for element {} " "indicate shielding without inner wall, but " "earlier elements indicate a different van der " "Waals method. This may cause division-by-zero " "errors. Keeping van der Waals setting for " - "earlier atoms.", reax->sbp[i].name); + "earlier atoms.", sbp[i].name); error->warning(FLERR,errmsg); } else { - reax->gp.vdw_type = 1; + gp.vdw_type = 1; } } else { error->one(FLERR,fmt::format("Inconsistent van der Waals " "parameters: No shielding or inner " "wall set for element {}", - reax->sbp[i].name)); + sbp[i].name)); } } } /* Equate vval3 to valf for first-row elements (25/10/2004) */ for (i = 0; i < ntypes; i++) { - if ((reax->sbp[i].mass < 21) && - (reax->sbp[i].valency_val != reax->sbp[i].valency_boc)) { + if ((sbp[i].mass < 21) && + (sbp[i].valency_val != sbp[i].valency_boc)) { error->warning(FLERR,fmt::format("Changed valency_val to valency" - "_boc for {}", reax->sbp[i].name)); - reax->sbp[i].valency_val = reax->sbp[i].valency_boc; + "_boc for {}", sbp[i].name)); + sbp[i].valency_val = sbp[i].valency_boc; } } @@ -306,14 +313,14 @@ namespace ReaxFF { THROW_ERROR("Inconsistent force field file"); if ((j < ntypes) && (k < ntypes)) { - reax->tbp[j][k].De_s = reax->tbp[k][j].De_s = values.next_double(); - reax->tbp[j][k].De_p = reax->tbp[k][j].De_p = values.next_double(); - reax->tbp[j][k].De_pp = reax->tbp[k][j].De_pp = values.next_double(); - reax->tbp[j][k].p_be1 = reax->tbp[k][j].p_be1 = values.next_double(); - reax->tbp[j][k].p_bo5 = reax->tbp[k][j].p_bo5 = values.next_double(); - reax->tbp[j][k].v13cor = reax->tbp[k][j].v13cor = values.next_double(); - reax->tbp[j][k].p_bo6 = reax->tbp[k][j].p_bo6 = values.next_double(); - reax->tbp[j][k].p_ovun1 = reax->tbp[k][j].p_ovun1 = values.next_double(); + tbp[j][k].De_s = tbp[k][j].De_s = values.next_double(); + tbp[j][k].De_p = tbp[k][j].De_p = values.next_double(); + tbp[j][k].De_pp = tbp[k][j].De_pp = values.next_double(); + tbp[j][k].p_be1 = tbp[k][j].p_be1 = values.next_double(); + tbp[j][k].p_bo5 = tbp[k][j].p_bo5 = values.next_double(); + tbp[j][k].v13cor = tbp[k][j].v13cor = values.next_double(); + tbp[j][k].p_bo6 = tbp[k][j].p_bo6 = values.next_double(); + tbp[j][k].p_ovun1 = tbp[k][j].p_ovun1 = values.next_double(); } // second line @@ -324,69 +331,40 @@ namespace ReaxFF { THROW_ERROR("Invalid force field file format"); if ((j < ntypes) && (k < ntypes)) { - reax->tbp[j][k].p_be2 = reax->tbp[k][j].p_be2 = values.next_double(); - reax->tbp[j][k].p_bo3 = reax->tbp[k][j].p_bo3 = values.next_double(); - reax->tbp[j][k].p_bo4 = reax->tbp[k][j].p_bo4 = values.next_double(); + tbp[j][k].p_be2 = tbp[k][j].p_be2 = values.next_double(); + tbp[j][k].p_bo3 = tbp[k][j].p_bo3 = values.next_double(); + tbp[j][k].p_bo4 = tbp[k][j].p_bo4 = values.next_double(); values.skip(); - reax->tbp[j][k].p_bo1 = reax->tbp[k][j].p_bo1 = values.next_double(); - reax->tbp[j][k].p_bo2 = reax->tbp[k][j].p_bo2 = values.next_double(); - reax->tbp[j][k].ovc = reax->tbp[k][j].ovc = values.next_double(); + tbp[j][k].p_bo1 = tbp[k][j].p_bo1 = values.next_double(); + tbp[j][k].p_bo2 = tbp[k][j].p_bo2 = values.next_double(); + tbp[j][k].ovc = tbp[k][j].ovc = values.next_double(); } } for (i=0; i < ntypes; ++i) { for (j=i; j < ntypes; ++j) { - reax->tbp[i][j].r_s = reax->tbp[j][i].r_s = - 0.5*(reax->sbp[j].r_s + reax->sbp[i].r_s); - - reax->tbp[i][j].r_p = reax->tbp[j][i].r_p = - 0.5*(reax->sbp[j].r_pi + reax->sbp[i].r_pi); - - reax->tbp[i][j].r_pp = reax->tbp[j][i].r_pp = - 0.5*(reax->sbp[j].r_pi_pi + reax->sbp[i].r_pi_pi); - - reax->tbp[i][j].p_boc3 = reax->tbp[j][i].p_boc3 = - sqrt(reax->sbp[j].b_o_132 * reax->sbp[i].b_o_132); - - reax->tbp[i][j].p_boc4 = reax->tbp[j][i].p_boc4 = - sqrt(reax->sbp[j].b_o_131 * reax->sbp[i].b_o_131); - - reax->tbp[i][j].p_boc5 = reax->tbp[j][i].p_boc5 = - sqrt(reax->sbp[j].b_o_133 * reax->sbp[i].b_o_133); - - reax->tbp[i][j].D = reax->tbp[j][i].D = - sqrt(reax->sbp[j].epsilon * reax->sbp[i].epsilon); - - reax->tbp[i][j].alpha = reax->tbp[j][i].alpha = - sqrt(reax->sbp[j].alpha * reax->sbp[i].alpha); - - reax->tbp[i][j].r_vdW = reax->tbp[j][i].r_vdW = - 2.0*sqrt(reax->sbp[j].r_vdw * reax->sbp[i].r_vdw); - - reax->tbp[i][j].gamma_w = reax->tbp[j][i].gamma_w = - sqrt(reax->sbp[j].gamma_w * reax->sbp[i].gamma_w); - - reax->tbp[i][j].gamma = reax->tbp[j][i].gamma = - pow(reax->sbp[j].gamma * reax->sbp[i].gamma,-1.5); + tbp[i][j].r_s = tbp[j][i].r_s = 0.5*(sbp[j].r_s + sbp[i].r_s); + tbp[i][j].r_p = tbp[j][i].r_p = 0.5*(sbp[j].r_pi + sbp[i].r_pi); + tbp[i][j].r_pp = tbp[j][i].r_pp = 0.5*(sbp[j].r_pi_pi + sbp[i].r_pi_pi); + tbp[i][j].p_boc3 = tbp[j][i].p_boc3 = sqrt(sbp[j].b_o_132 * sbp[i].b_o_132); + tbp[i][j].p_boc4 = tbp[j][i].p_boc4 = sqrt(sbp[j].b_o_131 * sbp[i].b_o_131); + tbp[i][j].p_boc5 = tbp[j][i].p_boc5 = sqrt(sbp[j].b_o_133 * sbp[i].b_o_133); + tbp[i][j].D = tbp[j][i].D = sqrt(sbp[j].epsilon * sbp[i].epsilon); + tbp[i][j].alpha = tbp[j][i].alpha = sqrt(sbp[j].alpha * sbp[i].alpha); + tbp[i][j].r_vdW = tbp[j][i].r_vdW = 2.0*sqrt(sbp[j].r_vdw * sbp[i].r_vdw); + tbp[i][j].gamma_w = tbp[j][i].gamma_w = sqrt(sbp[j].gamma_w * sbp[i].gamma_w); + tbp[i][j].gamma = tbp[j][i].gamma = pow(sbp[j].gamma * sbp[i].gamma,-1.5); // additions for additional vdWaals interaction types - inner core - reax->tbp[i][j].rcore = reax->tbp[j][i].rcore = - sqrt(reax->sbp[i].rcore2 * reax->sbp[j].rcore2); - - reax->tbp[i][j].ecore = reax->tbp[j][i].ecore = - sqrt(reax->sbp[i].ecore2 * reax->sbp[j].ecore2); - - reax->tbp[i][j].acore = reax->tbp[j][i].acore = - sqrt(reax->sbp[i].acore2 * reax->sbp[j].acore2); + tbp[i][j].rcore = tbp[j][i].rcore = sqrt(sbp[i].rcore2 * sbp[j].rcore2); + tbp[i][j].ecore = tbp[j][i].ecore = sqrt(sbp[i].ecore2 * sbp[j].ecore2); + tbp[i][j].acore = tbp[j][i].acore = sqrt(sbp[i].acore2 * sbp[j].acore2); // additions for additional vdWalls interaction types lg correction - reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = - sqrt(reax->sbp[i].lgcij * reax->sbp[j].lgcij); - - reax->tbp[i][j].lgre = reax->tbp[j][i].lgre - = 2.0 * reax->gp.l[35] * sqrt(reax->sbp[i].lgre*reax->sbp[j].lgre); + tbp[i][j].lgcij = tbp[j][i].lgcij = sqrt(sbp[i].lgcij * sbp[j].lgcij); + tbp[i][j].lgre = tbp[j][i].lgre = 2.0*gp.l[35]*sqrt(sbp[i].lgre*sbp[j].lgre); } } @@ -411,26 +389,26 @@ namespace ReaxFF { if ((j < ntypes) && (k < ntypes)) { val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].D = reax->tbp[k][j].D = val; + if (val > 0.0) tbp[j][k].D = tbp[k][j].D = val; val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].r_vdW = reax->tbp[k][j].r_vdW = 2*val; + if (val > 0.0) tbp[j][k].r_vdW = tbp[k][j].r_vdW = 2*val; val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].alpha = reax->tbp[k][j].alpha = val; + if (val > 0.0) tbp[j][k].alpha = tbp[k][j].alpha = val; val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].r_s = reax->tbp[k][j].r_s = val; + if (val > 0.0) tbp[j][k].r_s = tbp[k][j].r_s = val; val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].r_p = reax->tbp[k][j].r_p = val; + if (val > 0.0) tbp[j][k].r_p = tbp[k][j].r_p = val; val = values.next_double(); - if (val > 0.0) reax->tbp[j][k].r_pp = reax->tbp[k][j].r_pp = val; + if (val > 0.0) tbp[j][k].r_pp = tbp[k][j].r_pp = val; if (lgflag) { val = values.next_double(); - if (val >= 0.0) reax->tbp[j][k].lgcij = reax->tbp[k][j].lgcij = val; + if (val >= 0.0) tbp[j][k].lgcij = tbp[k][j].lgcij = val; } } } @@ -457,37 +435,37 @@ namespace ReaxFF { if ((j < ntypes) && (k < ntypes) && (l < ntypes)) { - cnt = reax->thbp[j][k][l].cnt; - reax->thbp[j][k][l].cnt++; - reax->thbp[l][k][j].cnt++; + cnt = thbp[j][k][l].cnt; + thbp[j][k][l].cnt++; + thbp[l][k][j].cnt++; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].theta_00 = val; - reax->thbp[l][k][j].prm[cnt].theta_00 = val; + thbp[j][k][l].prm[cnt].theta_00 = val; + thbp[l][k][j].prm[cnt].theta_00 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_val1 = val; - reax->thbp[l][k][j].prm[cnt].p_val1 = val; + thbp[j][k][l].prm[cnt].p_val1 = val; + thbp[l][k][j].prm[cnt].p_val1 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_val2 = val; - reax->thbp[l][k][j].prm[cnt].p_val2 = val; + thbp[j][k][l].prm[cnt].p_val2 = val; + thbp[l][k][j].prm[cnt].p_val2 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_coa1 = val; - reax->thbp[l][k][j].prm[cnt].p_coa1 = val; + thbp[j][k][l].prm[cnt].p_coa1 = val; + thbp[l][k][j].prm[cnt].p_coa1 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_val7 = val; - reax->thbp[l][k][j].prm[cnt].p_val7 = val; + thbp[j][k][l].prm[cnt].p_val7 = val; + thbp[l][k][j].prm[cnt].p_val7 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_pen1 = val; - reax->thbp[l][k][j].prm[cnt].p_pen1 = val; + thbp[j][k][l].prm[cnt].p_pen1 = val; + thbp[l][k][j].prm[cnt].p_pen1 = val; val = values.next_double(); - reax->thbp[j][k][l].prm[cnt].p_val4 = val; - reax->thbp[l][k][j].prm[cnt].p_val4 = val; + thbp[j][k][l].prm[cnt].p_val4 = val; + thbp[l][k][j].prm[cnt].p_val4 = val; } } @@ -511,65 +489,48 @@ namespace ReaxFF { if ((j < -1) || (k < 0) || (l < 0) || (m < -1)) THROW_ERROR("Inconsistent force field file"); + const double val1 = values.next_double(); + const double val2 = values.next_double(); + const double val3 = values.next_double(); + const double val4 = values.next_double(); + const double val5 = values.next_double(); + if ((j >= 0) && (m >= 0)) { // this means the entry is not in compact form if ((j < ntypes) && (k < ntypes) && (l < ntypes) && (m < ntypes)) { - tor_flag[j][k][l][m] = 1; - tor_flag[m][l][k][j] = 1; + tor_flag[j][k][l][m] = tor_flag[m][l][k][j] = 1; + fbp[j][k][l][m].cnt = fbp[m][l][k][j].cnt = 1; - reax->fbp[j][k][l][m].cnt = 1; - reax->fbp[m][l][k][j].cnt = 1; - - val = values.next_double(); - reax->fbp[j][k][l][m].prm[0].V1 = val; - reax->fbp[m][l][k][j].prm[0].V1 = val; - - val = values.next_double(); - reax->fbp[j][k][l][m].prm[0].V2 = val; - reax->fbp[m][l][k][j].prm[0].V2 = val; - - val = values.next_double(); - reax->fbp[j][k][l][m].prm[0].V3 = val; - reax->fbp[m][l][k][j].prm[0].V3 = val; - - val = values.next_double(); - reax->fbp[j][k][l][m].prm[0].p_tor1 = val; - reax->fbp[m][l][k][j].prm[0].p_tor1 = val; - - val = values.next_double(); - reax->fbp[j][k][l][m].prm[0].p_cot1 = val; - reax->fbp[m][l][k][j].prm[0].p_cot1 = val; + fbp[j][k][l][m].prm[0].V1 = fbp[m][l][k][j].prm[0].V1 = val1; + fbp[j][k][l][m].prm[0].V2 = fbp[m][l][k][j].prm[0].V2 = val2; + fbp[j][k][l][m].prm[0].V3 = fbp[m][l][k][j].prm[0].V3 = val3; + fbp[j][k][l][m].prm[0].p_tor1 = fbp[m][l][k][j].prm[0].p_tor1 = val4; + fbp[j][k][l][m].prm[0].p_cot1 = fbp[m][l][k][j].prm[0].p_cot1 = val5; } } else { /* This means the entry is of the form 0-X-Y-0 */ if ((k < ntypes) && (l < ntypes)) { - const double val1 = values.next_double(); - const double val2 = values.next_double(); - const double val3 = values.next_double(); - const double val4 = values.next_double(); - const double val5 = values.next_double(); - for (int p = 0; p < ntypes; ++p) { for (int o = 0; o < ntypes; ++o) { - reax->fbp[p][k][l][o].cnt = 1; - reax->fbp[o][l][k][p].cnt = 1; if (tor_flag[p][k][l][o] == 0) { - reax->fbp[p][k][l][o].prm[0].V1 = val1; - reax->fbp[p][k][l][o].prm[0].V2 = val2; - reax->fbp[p][k][l][o].prm[0].V3 = val3; - reax->fbp[p][k][l][o].prm[0].p_tor1 = val4; - reax->fbp[p][k][l][o].prm[0].p_cot1 = val5; + fbp[p][k][l][o].cnt = 1; + fbp[p][k][l][o].prm[0].V1 = val1; + fbp[p][k][l][o].prm[0].V2 = val2; + fbp[p][k][l][o].prm[0].V3 = val3; + fbp[p][k][l][o].prm[0].p_tor1 = val4; + fbp[p][k][l][o].prm[0].p_cot1 = val5; } if (tor_flag[o][l][k][p] == 0) { - reax->fbp[o][l][k][p].prm[0].V1 = val1; - reax->fbp[o][l][k][p].prm[0].V2 = val2; - reax->fbp[o][l][k][p].prm[0].V3 = val3; - reax->fbp[o][l][k][p].prm[0].p_tor1 = val4; - reax->fbp[o][l][k][p].prm[0].p_cot1 = val5; + fbp[o][l][k][p].cnt = 1; + fbp[o][l][k][p].prm[0].V1 = val1; + fbp[o][l][k][p].prm[0].V2 = val2; + fbp[o][l][k][p].prm[0].V3 = val3; + fbp[o][l][k][p].prm[0].p_tor1 = val4; + fbp[o][l][k][p].prm[0].p_cot1 = val5; } } } @@ -586,7 +547,7 @@ namespace ReaxFF { for (i = 0; i < ntypes; ++i) for (j = 0; j < ntypes; ++j) for (k = 0; k < ntypes; ++k) - reax->hbp[i][j][k].r0_hb = -1.0; + hbp[i][j][k].r0_hb = -1.0; for (i = 0; i < n; ++i) { values = reader.next_values(0); @@ -602,10 +563,10 @@ namespace ReaxFF { THROW_ERROR("Inconsistent force field file"); if ((j < ntypes) && (k < ntypes) && (l < ntypes)) { - reax->hbp[j][k][l].r0_hb = values.next_double(); - reax->hbp[j][k][l].p_hb1 = values.next_double(); - reax->hbp[j][k][l].p_hb2 = values.next_double(); - reax->hbp[j][k][l].p_hb3 = values.next_double(); + hbp[j][k][l].r0_hb = values.next_double(); + hbp[j][k][l].p_hb1 = values.next_double(); + hbp[j][k][l].p_hb2 = values.next_double(); + hbp[j][k][l].p_hb3 = values.next_double(); } } @@ -622,8 +583,8 @@ namespace ReaxFF { // allocate storage for atom type based data MPI_Bcast(&reax->num_atom_types,1,MPI_INT,0,world); + const int n = reax->num_atom_types; if (control->me != 0) { - const int n = reax->num_atom_types; memory->create(reax->sbp,n,"reaxff:sbp"); memory->create(reax->tbp,n,n,"reaxff:tbp"); memory->create(reax->thbp,n,n,n,"reaxff:thbp"); @@ -632,14 +593,13 @@ namespace ReaxFF { } // broadcast type specific force field data - const int n = reax->num_atom_types; MPI_Bcast(&(reax->sbp[0]),sizeof(single_body_parameters)*n,MPI_CHAR,0,world); MPI_Bcast(&(reax->tbp[0][0]),sizeof(two_body_parameters)*n*n,MPI_CHAR,0,world); MPI_Bcast(&(reax->thbp[0][0][0]),sizeof(three_body_header)*n*n*n,MPI_CHAR,0,world); MPI_Bcast(&(reax->hbp[0][0][0]),sizeof(hbond_parameters)*n*n*n,MPI_CHAR,0,world); MPI_Bcast(&(reax->fbp[0][0][0][0]),sizeof(four_body_header)*n*n*n*n,MPI_CHAR,0,world); - // apply parameters to various settings + // apply global parameters to global control settings control->bo_cut = 0.01 * reax->gp.l[29]; control->nonb_low = reax->gp.l[11]; From e901fff8b61ef3034824f3f51898db57cf4dcc62 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 21:18:42 -0400 Subject: [PATCH 049/119] remove unused variable --- src/KOKKOS/pair_reaxc_kokkos.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index deb1dc74fd..04c70342ed 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -3063,7 +3063,6 @@ KOKKOS_INLINE_FUNCTION void PairReaxCKokkos::operator()(PairReaxComputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access::value>(); auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); auto a_CdDelta = v_CdDelta.template access::value>(); From f9d133dcbaeaa35e566b88b18e3ec1a7ee178ee4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 22:07:38 -0400 Subject: [PATCH 050/119] must use a reference for the shortcut to work --- src/USER-REAXC/reaxc_ffield.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 1a47b46f56..7e60682102 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -77,7 +77,7 @@ namespace ReaxFF { ++lineno; // set some defaults - auto gp = reax->gp; + auto &gp = reax->gp; gp.vdw_type = 0; @@ -112,11 +112,11 @@ namespace ReaxFF { lineno += 4; // allocate and clear storage for ffield data - auto sbp = reax->sbp; - auto tbp = reax->tbp; - auto thbp = reax->thbp; - auto hbp = reax->hbp; - auto fbp = reax->fbp; + auto &sbp = reax->sbp; + auto &tbp = reax->tbp; + auto &thbp = reax->thbp; + auto &hbp = reax->hbp; + auto &fbp = reax->fbp; memory->create(sbp,n,"reaxff:sbp"); memory->create(tbp,n,n,"reaxff:tbp"); From 43491b4220ad29370af72883854d834ecb8219d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 22:31:35 -0400 Subject: [PATCH 051/119] lift compile time limit to 25 atom types --- src/USER-REAXC/reaxc_lookup.cpp | 15 ++++++++------- src/USER-REAXC/reaxff_defs.h | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index 58eab80d17..c2013c0500 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -148,8 +148,6 @@ namespace ReaxFF { storage *workspace, MPI_Comm world) { int i, j, r; - int num_atom_types; - int existing_types[REAX_MAX_ATOM_TYPES], aggregated[REAX_MAX_ATOM_TYPES]; double dr; double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb; double v0_vdw, v0_ele, vlast_vdw, vlast_ele; @@ -161,7 +159,9 @@ namespace ReaxFF { vlast_vdw = 0; vlast_ele = 0; - num_atom_types = system->reax_param.num_atom_types; + const int num_atom_types = system->reax_param.num_atom_types; + int *existing_types = new int[num_atom_types]; + int *aggregated = new int[num_atom_types]; dr = control->nonb_cut / control->tabulate; h = (double*) smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); @@ -182,13 +182,12 @@ namespace ReaxFF { LR[i] = (LR_lookup_table*) scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); - for (i = 0; i < REAX_MAX_ATOM_TYPES; ++i) + for (i = 0; i < num_atom_types; ++i) existing_types[i] = 0; for (i = 0; i < system->n; ++i) - existing_types[ system->my_atoms[i].type ] = 1; + existing_types[system->my_atoms[i].type] = 1; - MPI_Allreduce(existing_types, aggregated, REAX_MAX_ATOM_TYPES, - MPI_INT, MPI_SUM, world); + MPI_Allreduce(existing_types, aggregated, num_atom_types, MPI_INT, MPI_SUM, world); for (i = 0; i < num_atom_types; ++i) { if (aggregated[i]) { @@ -261,6 +260,8 @@ namespace ReaxFF { free(fCEvd); free(fele); free(fCEclmb); + delete[] existing_types; + delete[] aggregated; } void Deallocate_Lookup_Tables(reax_system *system) diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index 917255c5f0..6b3e021707 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -81,7 +81,6 @@ #define REAX_MAX_STR 1024 #define REAX_MAX_3BODY_PARAM 5 #define REAX_MAX_4BODY_PARAM 5 -#define REAX_MAX_ATOM_TYPES 25 namespace ReaxFF { From c11e9cc84925f4b8889d093aeb328f77395295ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Apr 2021 22:59:55 -0400 Subject: [PATCH 052/119] remove unused defines and enumerators --- src/USER-REAXC/reaxff_defs.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index 6b3e021707..854871e5a7 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -33,28 +33,9 @@ #define constPI 3.14159265 #define C_ele 332.06371 -//#define K_B 503.398008 // kcal/mol/K -#define K_B 0.831687 // amu A^2 / ps^2 / K -#define F_CONV 1e6 / 48.88821291 / 48.88821291 // --> amu A / ps^2 -#define E_CONV 0.002391 // amu A^2 / ps^2 --> kcal/mol #define EV_to_KCALpMOL 14.400000 // ElectronVolt --> KCAL per MOLe #define KCALpMOL_to_EV 23.02 // 23.060549 //KCAL per MOLe --> ElectronVolt -#define ECxA_to_DEBYE 4.803204 // elem. charge * Ang -> debye -#define CAL_to_JOULES 4.184000 // CALories --> JOULES -#define JOULES_to_CAL 1/4.184000 // JOULES --> CALories -#define AMU_to_GRAM 1.6605e-24 -#define ANG_to_CM 1e-8 -#define AVOGNR 6.0221367e23 -#define P_CONV 1e-24 * AVOGNR * JOULES_to_CAL -#define MAX_STR 1024 -#define MAX_LINE 1024 -#define MAX_TOKENS 1024 -#define MAX_TOKEN_LEN 1024 - -#define ALMOST_ZERO 1e-10 -#define NEG_INF -1e10 -#define NO_BOND 1e-3 // 0.001 #define HB_THRESHOLD 1e-2 // 0.01 #define REAX_MIN_CAP 50 @@ -68,29 +49,17 @@ #define REAX_SAFER_ZONE 1.4 #define DANGER_ZONE 0.90 #define LOOSE_ZONE 0.75 -#define MAX_3BODY_PARAM 5 -#define MAX_4BODY_PARAM 5 - -#define MASTER_NODE 0 #define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ #define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ -/************* crucial for reaxff_types.h *********/ - -#define REAX_MAX_STR 1024 #define REAX_MAX_3BODY_PARAM 5 #define REAX_MAX_4BODY_PARAM 5 namespace ReaxFF { /******************* ENUMERATORS *************************/ - - enum lists { BONDS, OLD_BONDS, THREE_BODIES, - HBONDS, FAR_NBRS, DBOS, DDELTAS, LIST_N }; - - enum message_tags {NONE, INIT_DESCS, ATOM_LINES, BOND_LINES, ANGLE_LINES}; - + enum lists { BONDS, THREE_BODIES, HBONDS, FAR_NBRS, LIST_N }; enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; } From 6c4ad8ad35951268a9a5bcc99dd069c2450224a7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 19 Apr 2021 07:38:50 -0400 Subject: [PATCH 053/119] implement nowarn flag for qeq/reax fixes and add scalar compute function for number of qeq iterations make behavior handling the maximum number of iterations consistent across USER-REAXC, USER-OMP and KOKKOS package variants so that they all give the same results for the same number of iterations in serial and parallel --- doc/src/fix_qeq_reax.rst | 46 +++++++++++++++++++----------- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 14 +++++---- src/KOKKOS/fix_qeq_reax_kokkos.h | 4 +-- src/USER-OMP/fix_qeq_reax_omp.cpp | 31 ++++++++++---------- src/USER-REAXC/fix_qeq_reax.cpp | 27 ++++++++++++++---- src/USER-REAXC/fix_qeq_reax.h | 12 ++------ 6 files changed, 79 insertions(+), 55 deletions(-) diff --git a/doc/src/fix_qeq_reax.rst b/doc/src/fix_qeq_reax.rst index 8752888c4c..430a037d8d 100644 --- a/doc/src/fix_qeq_reax.rst +++ b/doc/src/fix_qeq_reax.rst @@ -24,10 +24,10 @@ Syntax .. parsed-literal:: - keyword = *dual* or *maxiter* + keyword = *dual* or *maxiter* or *nowarn* *dual* = process S and T matrix in parallel (only for qeq/reax/omp) *maxiter* N = limit the number of iterations to *N* - + *nowarn* = do not print a warning message if the maximum number of iterations was reached Examples """""""" @@ -40,13 +40,15 @@ Examples Description """"""""""" -Perform the charge equilibration (QEq) method as described in :ref:`(Rappe and Goddard) ` and formulated in :ref:`(Nakano) `. It is -typically used in conjunction with the ReaxFF force field model as -implemented in the :doc:`pair_style reax/c ` command, but -it can be used with any potential in LAMMPS, so long as it defines and -uses charges on each atom. The :doc:`fix qeq/comb ` -command should be used to perform charge equilibration with the :doc:`COMB potential `. For more technical details about the -charge equilibration performed by fix qeq/reax, see the +Perform the charge equilibration (QEq) method as described in +:ref:`(Rappe and Goddard) ` and formulated in :ref:`(Nakano) +`. It is typically used in conjunction with the ReaxFF force +field model as implemented in the :doc:`pair_style reax/c ` +command, but it can be used with any potential in LAMMPS, so long as it +defines and uses charges on each atom. The :doc:`fix qeq/comb +` command should be used to perform charge equilibration +with the :doc:`COMB potential `. For more technical details +about the charge equilibration performed by fix qeq/reax, see the :ref:`(Aktulga) ` paper. The QEq method minimizes the electrostatic energy of the system by @@ -79,12 +81,21 @@ the *qeq/reax/omp* style. Otherwise they are processed separately. The optional *maxiter* keyword allows changing the max number of iterations in the linear solver. The default value is 200. +The optional *nowarn* keyword silences the warning message printed +when the maximum number of iterations was reached. This can be +useful for comparing serial and parallel results where having the +same fixed number of QEq iterations is desired, which can be achieved +by using a very small tolerance and setting *maxiter* to the desired +number of iterations. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. No global scalar or vector or per-atom -quantities are stored by this fix for access by various :doc:`output commands `. No parameter of this fix can be used -with the *start/stop* keywords of the :doc:`run ` command. +No information about this fix is written to :doc:`binary restart files +`. This fix computes a global scalar (the number of +iterations) for access by various :doc:`output commands `. +No parameter of this fix can be used with the *start/stop* keywords of +the :doc:`run ` command. This fix is invoked during :doc:`energy minimization `. @@ -97,12 +108,13 @@ This fix is invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is part of the USER-REAXC package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. +Fix *qeq/reax* is part of the USER-REAXC package. It is only enabled if +LAMMPS was built with this package. See the :doc:`Build package +` doc page for more info. -This fix does not correctly handle interactions -involving multiple periodic images of the same atom. Hence, it should not -be used for periodic cell dimensions less than 10 angstroms. +This fix does not correctly handle interactions involving multiple +periodic images of the same atom. Hence, it should not be used for +periodic cell dimensions less than 10 angstroms. Related commands """""""""""""""" diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index fe1969c54f..1094d953b7 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -281,11 +281,11 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) // 1st cg solve over b_s, s - cg_solve1(); + matvecs = cg_solve1(); // 2nd cg solve over b_t, t - cg_solve2(); + matvecs += cg_solve2(); // calculate_Q(); @@ -721,7 +721,7 @@ void FixQEqReaxKokkos::matvec_item(int ii) const /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::cg_solve1() +int FixQEqReaxKokkos::cg_solve1() // b = b_s, x = s; { const int inum = list->inum; @@ -838,17 +838,18 @@ void FixQEqReaxKokkos::cg_solve1() Kokkos::parallel_for(inum,vecsum2_functor); } - if (loop >= imax && comm->me == 0) + if ((loop >= imax) && maxwarn && (comm->me == 0)) error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve1 convergence " "failed after {} iterations at step {}: " "{}", loop, update->ntimestep, sqrt(sig_new)/b_norm)); + return loop; } /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::cg_solve2() +int FixQEqReaxKokkos::cg_solve2() // b = b_t, x = t; { const int inum = list->inum; @@ -967,11 +968,12 @@ void FixQEqReaxKokkos::cg_solve2() Kokkos::parallel_for(inum,vecsum2_functor); } - if (loop >= imax && comm->me == 0) + if ((loop >= imax) && maxwarn && (comm->me == 0)) error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve2 convergence " "failed after {} iterations at step {}: " "{}", loop, update->ntimestep, sqrt(sig_new)/b_norm)); + return loop; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.h b/src/KOKKOS/fix_qeq_reax_kokkos.h index bbfeb00266..929a37748c 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.h +++ b/src/KOKKOS/fix_qeq_reax_kokkos.h @@ -224,8 +224,8 @@ class FixQEqReaxKokkos : public FixQEqReax, public KokkosBase { void init_hist(); void allocate_matrix(); void allocate_array(); - void cg_solve1(); - void cg_solve2(); + int cg_solve1(); + int cg_solve2(); void calculate_q(); int neighflag, pack_flag; diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 59a3c093e2..52e9565a46 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -280,6 +280,7 @@ void FixQEqReaxOMP::pre_force(int /* vflag */) } else { matvecs_s = CG(b_s, s); // CG on s - parallel matvecs_t = CG(b_t, t); // CG on t - parallel + matvecs = matvecs_s + matvecs_t; } // if (dual_enabled) calculate_Q(); @@ -461,7 +462,7 @@ int FixQEqReaxOMP::CG( double *b, double *x) } } - if (i >= imax && comm->me == 0) + if ((i >= imax) && maxwarn && (comm->me == 0)) error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); @@ -768,31 +769,31 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) } } - i++; - matvecs_s = matvecs_t = i; // The plus one makes consistent with count from CG() - matvecs = i; + matvecs_s = matvecs_t = i; - // If necessary, converge other system - if (sqrt(sig_new_s)/b_norm_s > tolerance) { + // If only one was converged and there are still iterations left, converge other system + if ((matvecs_s < imax) && (sqrt(sig_new_s)/b_norm_s > tolerance)) { pack_flag = 2; comm->forward_comm_fix(this); // x1 => s - i+= CG(b1, x1); - matvecs_s = i; - } - else if (sqrt(sig_new_t)/b_norm_t > tolerance) { + int saved_imax = imax; + imax -= matvecs_s; + matvecs_s += CG(b1, x1); + imax = saved_imax; + } else if ((matvecs_t < imax) && (sqrt(sig_new_t)/b_norm_t > tolerance)) { pack_flag = 3; comm->forward_comm_fix(this); // x2 => t - - i+= CG(b2, x2); - matvecs_t = i; + int saved_imax = imax; + imax -= matvecs_t; + matvecs_t += CG(b2, x2); + imax = saved_imax; } - if ( i >= imax && comm->me == 0) + if ((i >= imax) && maxwarn && (comm->me == 0)) error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); - return i; + return matvecs_s + matvecs_t; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 9c5b3b2958..493d9cd508 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -70,9 +70,14 @@ static const char cite_fix_qeq_reax[] = /* ---------------------------------------------------------------------- */ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pertype_option(nullptr) + Fix(lmp, narg, arg), matvecs(0), pertype_option(nullptr) { - if (narg<8 || narg>11) error->all(FLERR,"Illegal fix qeq/reax command"); + scalar_flag = 1; + extscalar = 0; + imax = 200; + maxwarn = 1; + + if ((narg < 8) || (narg > 12)) error->all(FLERR,"Illegal fix qeq/reax command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix qeq/reax command"); @@ -82,14 +87,15 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : tolerance = utils::numeric(FLERR,arg[6],false,lmp); pertype_option = utils::strdup(arg[7]); - // dual CG support only available for USER-OMP variant + // dual CG support is only available for USER-OMP variant // check for compatibility is in Fix::post_constructor() + dual_enabled = 0; - imax = 200; int iarg = 8; while (iarg < narg) { if (strcmp(arg[iarg],"dual") == 0) dual_enabled = 1; + else if (strcmp(arg[iarg],"nowarn") == 0) maxwarn = 0; else if (strcmp(arg[iarg],"maxiter") == 0) { if (iarg+1 > narg-1) error->all(FLERR,"Illegal fix qeq/reax command"); @@ -115,12 +121,14 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : b_prm = nullptr; // CG + p = nullptr; q = nullptr; r = nullptr; d = nullptr; // H matrix + H.firstnbr = nullptr; H.numnbrs = nullptr; H.jlist = nullptr; @@ -128,13 +136,13 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : // dual CG support // Update comm sizes for this fix + if (dual_enabled) comm_forward = comm_reverse = 2; else comm_forward = comm_reverse = 1; // perform initial allocation of atom-based arrays // register with Atom class - reaxc = nullptr; reaxc = (PairReaxC *) force->pair_match("^reax/c",0); s_hist = t_hist = nullptr; @@ -389,6 +397,13 @@ void FixQEqReax::init() /* ---------------------------------------------------------------------- */ +double FixQEqReax::compute_scalar() +{ + return matvecs/2.0; +} + +/* ---------------------------------------------------------------------- */ + void FixQEqReax::init_list(int /*id*/, NeighList *ptr) { list = ptr; @@ -728,7 +743,7 @@ int FixQEqReax::CG(double *b, double *x) vector_sum(d, 1., p, beta, d, nn); } - if (i >= imax && comm->me == 0) + if ((i >= imax) && maxwarn && (comm->me == 0)) error->warning(FLERR,fmt::format("Fix qeq/reax CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index 932f2e3679..9237e3e7ff 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -52,10 +52,11 @@ class FixQEqReax : public Fix { void min_setup_pre_force(int); void min_pre_force(int); - int matvecs; + virtual double compute_scalar(); protected: int nevery,reaxflag; + int matvecs; int nn, NN, m_fill; int n_cap, nmax, m_cap; int pack_flag; @@ -94,13 +95,7 @@ class FixQEqReax : public Fix { //CG storage double *p, *q, *r, *d; - int imax; - - //GMRES storage - //double *g,*y; - //double **v; - //double **h; - //double *hc, *hs; + int imax, maxwarn; char *pertype_option; // argument to determine how per-type info is obtained virtual void pertype_parameters(char*); @@ -120,7 +115,6 @@ class FixQEqReax : public Fix { virtual void calculate_Q(); virtual int CG(double*,double*); - //int GMRES(double*,double*); virtual void sparse_matvec(sparse_matrix*,double*,double*); virtual int pack_forward_comm(int, int *, double *, int, int *); From 799fb284c8c6d255f1c1c5ab56b8e7db4fe9b842 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:00:51 -0400 Subject: [PATCH 054/119] small updates to the QEQ package for better testing - add a "warn no/yes" keyword/value pair to allow turning of the convergence warning - add a scalar compute to retrieve the number of QEq itration from the fix - update the buck example input to run all QEq methods from a common restart - document changes --- doc/src/fix_qeq.rst | 19 +- examples/qeq/buck.inc | 22 + examples/qeq/in.qeq.buck | 75 ++- examples/qeq/log.20Apr21.qeq.buck.g++.1 | 650 ++++++++++++++++++++++++ examples/qeq/log.20Apr21.qeq.buck.g++.4 | 650 ++++++++++++++++++++++++ examples/qeq/log.27Nov18.qeq.buck.g++.1 | 118 ----- examples/qeq/log.27Nov18.qeq.buck.g++.4 | 118 ----- src/QEQ/fix_qeq.cpp | 15 +- src/QEQ/fix_qeq.h | 5 +- src/QEQ/fix_qeq_dynamic.cpp | 11 +- src/QEQ/fix_qeq_fire.cpp | 9 +- src/QEQ/fix_qeq_point.cpp | 11 +- src/QEQ/fix_qeq_shielded.cpp | 8 + src/QEQ/fix_qeq_slater.cpp | 7 + 14 files changed, 1446 insertions(+), 272 deletions(-) create mode 100644 examples/qeq/buck.inc create mode 100644 examples/qeq/log.20Apr21.qeq.buck.g++.1 create mode 100644 examples/qeq/log.20Apr21.qeq.buck.g++.4 delete mode 100644 examples/qeq/log.27Nov18.qeq.buck.g++.1 delete mode 100644 examples/qeq/log.27Nov18.qeq.buck.g++.4 diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index c655076ce8..7ea79a89ce 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -34,13 +34,14 @@ Syntax * maxiter = maximum iterations to perform charge equilibration * qfile = a filename with QEq parameters or *coul/streitz* or *reax/c* * zero or more keyword/value pairs may be appended -* keyword = *alpha* or *qdamp* or *qstep* +* keyword = *alpha* or *qdamp* or *qstep* or *warn* .. parsed-literal:: *alpha* value = Slater type orbital exponent (qeq/slater only) *qdamp* value = damping factor for damped dynamics charge solver (qeq/dynamic and qeq/fire only) *qstep* value = time step size for damped dynamics charge solver (qeq/dynamic and qeq/fire only) + *warn* value = do (=yes) or do not (=no) print a warning when the maximum number of iterations is reached Examples """""""" @@ -101,8 +102,8 @@ The QEq method minimizes the electrostatic energy of the system (or equalizes the derivative of energy with respect to charge of all the atoms) by adjusting the partial charge on individual atoms based on interactions with their neighbors within *cutoff*\ . It requires a few -parameters, in *metal* units, for each atom type which provided in a -file specified by *qfile*\ . The file has the following format +parameters in the appropriate units for each atom type which are read +from a file specified by *qfile*\ . The file has the following format .. parsed-literal:: @@ -112,7 +113,7 @@ file specified by *qfile*\ . The file has the following format Ntype chi eta gamma zeta qcore There have to be parameters given for every atom type. Wildcard entries -are possible using the same syntax as elsewhere in LAMMPS +are possible using the same type range syntax as for "coeff" commands (i.e., n\*m, n\*, \*m, \*). Later entries will overwrite previous ones. Empty lines or any text following the pound sign (#) are ignored. Each line starts with the atom type followed by five parameters. @@ -126,6 +127,14 @@ entries per line are required. * *zeta* = Slater type orbital exponent defined by the :ref:`Streitz-Mintmire ` potential in reverse distance units * *qcore* = charge of the nucleus defined by the :ref:`Streitz-Mintmire potential ` potential in charge units +The fix qeq styles will print a warning if the charges are not +equilibrated within *tolerance* by *maxiter* steps, unless the +*warn* keyword is used with "no" as argument. This latter option +may be useful for testing and benchmarking purposes, as it allows +to use a fixed number of QEq iterations when *tolerance* is set +to a small enough value to alway reach the *maxiter* limit. Turning +off warnings will avoid the excessive output in that case. + The *qeq/point* style describes partial charges on atoms as point charges. Interaction between a pair of charged particles is 1/r, which is the simplest description of the interaction between charges. @@ -229,7 +238,7 @@ Related commands Default """"""" -none +warn yes ---------- diff --git a/examples/qeq/buck.inc b/examples/qeq/buck.inc new file mode 100644 index 0000000000..af3fe3dfb6 --- /dev/null +++ b/examples/qeq/buck.inc @@ -0,0 +1,22 @@ + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve diff --git a/examples/qeq/in.qeq.buck b/examples/qeq/in.qeq.buck index 2258a9e2ae..4b74b44186 100644 --- a/examples/qeq/in.qeq.buck +++ b/examples/qeq/in.qeq.buck @@ -1,41 +1,68 @@ # This example demonstrates the use of various fix qeq variants with -# that defines and uses charges, in this case pair_style buck/coul/long +# a pair style using charges, in this case pair_style buck/coul/long units metal atom_style charge read_data data.aC -replicate 2 2 2 +#replicate 2 2 2 pair_style buck/coul/long 12.0 pair_coeff 2 2 1388.77 .3623188 175.0 pair_coeff 1 2 18003 .2052124 133.5381 pair_coeff 1 1 0 .1 0 -kspace_style ewald 1e-6 -neighbor 1.0 bin -neigh_modify delay 0 every 1 check yes +fix 2 all qeq/shielded 1 10 1.0e-20 10 param.qeq2 -group type1 type 1 -compute charge1 type1 property/atom q -compute q1 type1 reduce ave c_charge1 -group type2 type 2 -compute charge2 type2 property/atom q -compute q2 type2 reduce ave c_charge2 -variable qtot equal count(type1)*c_q1+count(type2)*c_q2 - -thermo_style custom step pe c_q1 c_q2 v_qtot -thermo 10 - -timestep 0.0001 +include buck.inc velocity all create 300.0 1281937 -fix 1 all nve +run 0 post no -#fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/slater 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/dynamic 1 10 1.0e-4 100 param.qeq2 -fix 2 all qeq/fire 1 10 1.0e-4 100 param.qeq2 +write_restart qeq.restart -run 100 +clear + +print "Using fix qeq/point" +read_restart qeq.restart +fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +run 100 + +clear + +print "Using fix qeq/shielded" +read_restart qeq.restart +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +run 100 + + +clear + +print "Using fix qeq/slater" +read_restart qeq.restart +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +run 100 + +clear + +print "Using fix qeq/dynamic" +read_restart qeq.restart +fix 2 all qeq/dynamic 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +run 100 + +clear + +print "Using fix qeq/fire" +read_restart qeq.restart +fix 2 all qeq/fire 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +run 100 diff --git a/examples/qeq/log.20Apr21.qeq.buck.g++.1 b/examples/qeq/log.20Apr21.qeq.buck.g++.1 new file mode 100644 index 0000000000..d5b41867b1 --- /dev/null +++ b/examples/qeq/log.20Apr21.qeq.buck.g++.1 @@ -0,0 +1,650 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# This example demonstrates the use of various fix qeq variants with +# a pair style using charges, in this case pair_style buck/coul/long + +units metal +atom_style charge + +read_data data.aC +Reading data file ... + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1200 atoms + read_data CPU = 0.009 seconds +#replicate 2 2 2 + +pair_style buck/coul/long 12.0 +pair_coeff 2 2 1388.77 .3623188 175.0 +pair_coeff 1 2 18003 .2052124 133.5381 +pair_coeff 1 1 0 .1 0 + +fix 2 all qeq/shielded 1 10 1.0e-20 10 param.qeq2 + +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +velocity all create 300.0 1281937 +run 0 post no +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.30705229 + grid = 48 48 54 + stencil order = 5 + estimated absolute RMS force accuracy = 1.8909403e-05 + estimated relative force accuracy = 1.3131854e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 184525 124416 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +WARNING: Fix qeq CG convergence failed (4.357840257025601e-19) after 10 iterations at step 0 (src/QEQ/fix_qeq.cpp:410) +WARNING: Fix qeq CG convergence failed (5.274094378414531e-18) after 10 iterations at step 0 (src/QEQ/fix_qeq.cpp:410) +Per MPI rank memory allocation (min/avg/max) = 38.75 | 38.75 | 38.75 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00327 0.76536977 -0.38268489 0.000000000000 10 +Loop time of 1.66893e-06 on 1 procs for 0 steps with 1200 atoms + + +write_restart qeq.restart +System init for write_restart ... +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/point" +Using fix qeq/point +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/point, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 24.69 | 24.69 | 24.69 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.17988 0.85228288 -0.42614144 -0.000000000000 3 + 10 -3452.03328 0.85475605 -0.42737803 -0.000000000000 8 + 20 -3497.57515 0.85994936 -0.42997468 0.000000000000 8 + 30 -3568.22095 0.86767937 -0.43383969 0.000000000001 8 + 40 -3633.24956 0.87335551 -0.43667775 0.000000000000 8 + 50 -3700.10219 0.87805056 -0.43902528 0.000000000000 8 + 60 -3784.36769 0.88402303 -0.44201151 -0.000000000000 8 + 70 -3877.51378 0.89008950 -0.44504475 0.000000000000 8 + 80 -3965.29722 0.89431515 -0.44715757 -0.000000000001 8 + 90 -4048.36764 0.89698588 -0.44849294 0.000000000000 8 + 100 -4118.65809 0.89719102 -0.44859551 0.000000000000 8 +Loop time of 11.5935 on 1 procs for 100 steps with 1200 atoms + +Performance: 0.075 ns/day, 322.041 hours/ns, 8.626 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.8257 | 2.8257 | 2.8257 | 0.0 | 24.37 +Kspace | 1.2136 | 1.2136 | 1.2136 | 0.0 | 10.47 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.015541 | 0.015541 | 0.015541 | 0.0 | 0.13 +Output | 0.0014489 | 0.0014489 | 0.0014489 | 0.0 | 0.01 +Modify | 7.5351 | 7.5351 | 7.5351 | 0.0 | 64.99 +Other | | 0.00206 | | | 0.02 + +Nlocal: 1200.00 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 8100.00 ave 8100 max 8100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 367600.0 ave 367600 max 367600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 735200.0 ave 735200 max 735200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/shielded" +Using fix qeq/shielded +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 24.69 | 24.69 | 24.69 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00309 0.76536977 -0.38268489 -0.000000000000 3 + 10 -2882.50998 0.76536972 -0.38268486 0.000000000000 2 + 20 -2893.89472 0.76536950 -0.38268475 0.000000000000 2 + 30 -2913.6181 0.76536875 -0.38268438 0.000000000001 1 + 40 -2942.24129 0.76536939 -0.38268470 -0.000000000001 1 + 50 -2980.18817 0.76536780 -0.38268390 0.000000000000 2 + 60 -3027.60957 0.76536804 -0.38268402 0.000000000000 2 + 70 -3084.12552 0.76536573 -0.38268287 0.000000000000 2 + 80 -3148.8697 0.76536550 -0.38268275 0.000000000001 1 + 90 -3220.43086 0.76536380 -0.38268190 0.000000000000 2 + 100 -3297.0618 0.76536251 -0.38268126 0.000000000000 2 +Loop time of 7.93936 on 1 procs for 100 steps with 1200 atoms + +Performance: 0.109 ns/day, 220.538 hours/ns, 12.595 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.8061 | 2.8061 | 2.8061 | 0.0 | 35.34 +Kspace | 1.2176 | 1.2176 | 1.2176 | 0.0 | 15.34 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.015528 | 0.015528 | 0.015528 | 0.0 | 0.20 +Output | 0.0014365 | 0.0014365 | 0.0014365 | 0.0 | 0.02 +Modify | 3.8966 | 3.8966 | 3.8966 | 0.0 | 49.08 +Other | | 0.002076 | | | 0.03 + +Nlocal: 1200.00 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 8100.00 ave 8100 max 8100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 367600.0 ave 367600 max 367600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 735200.0 ave 735200 max 735200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/slater" +Using fix qeq/slater +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 24.69 | 24.69 | 24.69 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00309 0.76536977 -0.38268489 -0.000000000000 3 + 10 -2882.50998 0.76536972 -0.38268486 0.000000000000 2 + 20 -2893.89472 0.76536950 -0.38268475 0.000000000000 2 + 30 -2913.6181 0.76536875 -0.38268438 0.000000000001 1 + 40 -2942.24129 0.76536939 -0.38268470 -0.000000000001 1 + 50 -2980.18817 0.76536780 -0.38268390 0.000000000000 2 + 60 -3027.60957 0.76536804 -0.38268402 0.000000000000 2 + 70 -3084.12552 0.76536573 -0.38268287 0.000000000000 2 + 80 -3148.8697 0.76536550 -0.38268275 0.000000000001 1 + 90 -3220.43086 0.76536380 -0.38268190 0.000000000000 2 + 100 -3297.0618 0.76536251 -0.38268126 0.000000000000 2 +Loop time of 7.9652 on 1 procs for 100 steps with 1200 atoms + +Performance: 0.108 ns/day, 221.256 hours/ns, 12.555 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.809 | 2.809 | 2.809 | 0.0 | 35.27 +Kspace | 1.2214 | 1.2214 | 1.2214 | 0.0 | 15.33 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.015635 | 0.015635 | 0.015635 | 0.0 | 0.20 +Output | 0.0014393 | 0.0014393 | 0.0014393 | 0.0 | 0.02 +Modify | 3.9157 | 3.9157 | 3.9157 | 0.0 | 49.16 +Other | | 0.002091 | | | 0.03 + +Nlocal: 1200.00 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 8100.00 ave 8100 max 8100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 367600.0 ave 367600 max 367600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 735200.0 ave 735200 max 735200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/dynamic" +Using fix qeq/dynamic +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/dynamic 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard + (2) fix qeq/dynamic, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 17.87 | 17.87 | 17.87 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.38094 0.85231286 -0.42615643 0.000000000001 43 + 10 -3452.05217 0.85475894 -0.42737947 -0.000000000001 17 + 20 -3497.8643 0.85999180 -0.42999590 -0.000000000007 22 + 30 -3568.53169 0.86772479 -0.43386239 -0.000000000006 22 + 40 -3633.43753 0.87338291 -0.43669146 -0.000000000006 22 + 50 -3700.27953 0.87807632 -0.43903816 -0.000000000005 22 + 60 -3784.4004 0.88402822 -0.44201411 0.000000000002 17 + 70 -3877.73706 0.89012201 -0.44506100 0.000000000002 22 + 80 -3965.36111 0.89432486 -0.44716243 0.000000000008 17 + 90 -4048.57901 0.89701688 -0.44850844 -0.000000000004 22 + 100 -4118.62736 0.89718691 -0.44859346 -0.000000000026 17 +Loop time of 18.5333 on 1 procs for 100 steps with 1200 atoms + +Performance: 0.047 ns/day, 514.815 hours/ns, 5.396 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.8268 | 2.8268 | 2.8268 | 0.0 | 15.25 +Kspace | 1.2138 | 1.2138 | 1.2138 | 0.0 | 6.55 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.015407 | 0.015407 | 0.015407 | 0.0 | 0.08 +Output | 0.0014303 | 0.0014303 | 0.0014303 | 0.0 | 0.01 +Modify | 14.474 | 14.474 | 14.474 | 0.0 | 78.10 +Other | | 0.001973 | | | 0.01 + +Nlocal: 1200.00 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 8100.00 ave 8100 max 8100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 367600.0 ave 367600 max 367600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 367600 +Ave neighs/atom = 306.33333 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/fire" +Using fix qeq/fire +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 1 by 1 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/fire 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 42772 21870 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard + (2) fix qeq/fire, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 17.87 | 17.87 | 17.87 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.06113 0.85226679 -0.42613339 0.000000000004 37 + 10 -3452.0494 0.85475813 -0.42737906 0.000000000001 10 + 20 -3497.83503 0.85998739 -0.42999370 0.000000000003 13 + 30 -3568.47507 0.86771599 -0.43385799 0.000000000004 13 + 40 -3633.35368 0.87337029 -0.43668514 0.000000000004 13 + 50 -3700.15601 0.87805847 -0.43902924 0.000000000005 13 + 60 -3784.32042 0.88401635 -0.44200818 0.000000000000 11 + 70 -3877.59818 0.89010162 -0.44505081 0.000000000000 13 + 80 -3965.28426 0.89431356 -0.44715678 0.000000000000 11 + 90 -4048.3338 0.89698069 -0.44849034 0.000000000001 13 + 100 -4118.63638 0.89718818 -0.44859409 0.000000000003 12 +Loop time of 13.0492 on 1 procs for 100 steps with 1200 atoms + +Performance: 0.066 ns/day, 362.479 hours/ns, 7.663 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.7996 | 2.7996 | 2.7996 | 0.0 | 21.45 +Kspace | 1.2141 | 1.2141 | 1.2141 | 0.0 | 9.30 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.015527 | 0.015527 | 0.015527 | 0.0 | 0.12 +Output | 0.0014405 | 0.0014405 | 0.0014405 | 0.0 | 0.01 +Modify | 9.0166 | 9.0166 | 9.0166 | 0.0 | 69.10 +Other | | 0.001981 | | | 0.02 + +Nlocal: 1200.00 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 8100.00 ave 8100 max 8100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 367600.0 ave 367600 max 367600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 367600 +Ave neighs/atom = 306.33333 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:01:00 diff --git a/examples/qeq/log.20Apr21.qeq.buck.g++.4 b/examples/qeq/log.20Apr21.qeq.buck.g++.4 new file mode 100644 index 0000000000..cafa94bae9 --- /dev/null +++ b/examples/qeq/log.20Apr21.qeq.buck.g++.4 @@ -0,0 +1,650 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# This example demonstrates the use of various fix qeq variants with +# a pair style using charges, in this case pair_style buck/coul/long + +units metal +atom_style charge + +read_data data.aC +Reading data file ... + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 1200 atoms + read_data CPU = 0.009 seconds +#replicate 2 2 2 + +pair_style buck/coul/long 12.0 +pair_coeff 2 2 1388.77 .3623188 175.0 +pair_coeff 1 2 18003 .2052124 133.5381 +pair_coeff 1 1 0 .1 0 + +fix 2 all qeq/shielded 1 10 1.0e-20 10 param.qeq2 + +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +velocity all create 300.0 1281937 +run 0 post no +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.30705229 + grid = 48 48 54 + stencil order = 5 + estimated absolute RMS force accuracy = 1.8909403e-05 + estimated relative force accuracy = 1.3131854e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 57970 32256 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +WARNING: Fix qeq CG convergence failed (4.299911728887494e-19) after 10 iterations at step 0 (src/QEQ/fix_qeq.cpp:410) +WARNING: Fix qeq CG convergence failed (5.273380778822746e-18) after 10 iterations at step 0 (src/QEQ/fix_qeq.cpp:410) +Per MPI rank memory allocation (min/avg/max) = 14.97 | 15.02 | 15.08 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00327 0.76536977 -0.38268489 0.000000000000 10 +Loop time of 3.33786e-06 on 4 procs for 0 steps with 1200 atoms + + +write_restart qeq.restart +System init for write_restart ... +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/point" +Using fix qeq/point +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/point, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.10 | 11.14 | 11.16 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.17988 0.85228288 -0.42614144 -0.000000000000 3 + 10 -3452.03328 0.85475605 -0.42737803 -0.000000000000 8 + 20 -3497.57515 0.85994936 -0.42997468 0.000000000000 8 + 30 -3568.22095 0.86767937 -0.43383969 0.000000000000 8 + 40 -3633.24956 0.87335551 -0.43667775 -0.000000000000 8 + 50 -3700.10219 0.87805056 -0.43902528 0.000000000000 8 + 60 -3784.36769 0.88402303 -0.44201151 0.000000000000 8 + 70 -3877.51378 0.89008950 -0.44504475 0.000000000000 8 + 80 -3965.29722 0.89431515 -0.44715757 0.000000000000 8 + 90 -4048.36764 0.89698588 -0.44849294 -0.000000000000 8 + 100 -4118.65809 0.89719102 -0.44859551 0.000000000000 8 +Loop time of 3.30911 on 4 procs for 100 steps with 1200 atoms + +Performance: 0.261 ns/day, 91.920 hours/ns, 30.220 timesteps/s +99.0% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.67613 | 0.68904 | 0.71562 | 1.9 | 20.82 +Kspace | 0.36056 | 0.3881 | 0.39892 | 2.6 | 11.73 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.013339 | 0.017982 | 0.019974 | 2.0 | 0.54 +Output | 0.0006721 | 0.00099713 | 0.0019572 | 0.0 | 0.03 +Modify | 2.2109 | 2.211 | 2.211 | 0.0 | 66.81 +Other | | 0.002041 | | | 0.06 + +Nlocal: 300.000 ave 300 max 300 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 4875.00 ave 4880 max 4870 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 91900.0 ave 91900 max 91900 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 183800.0 ave 183800 max 183800 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/shielded" +Using fix qeq/shielded +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.006 seconds +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.10 | 11.14 | 11.16 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00309 0.76536977 -0.38268489 0.000000000000 3 + 10 -2882.50998 0.76536972 -0.38268486 0.000000000000 2 + 20 -2893.89472 0.76536950 -0.38268475 -0.000000000000 2 + 30 -2913.6181 0.76536875 -0.38268438 -0.000000000000 1 + 40 -2942.24129 0.76536939 -0.38268470 0.000000000000 1 + 50 -2980.18817 0.76536780 -0.38268390 0.000000000000 2 + 60 -3027.60957 0.76536804 -0.38268402 -0.000000000000 2 + 70 -3084.12552 0.76536573 -0.38268287 0.000000000000 2 + 80 -3148.8697 0.76536550 -0.38268275 0.000000000000 1 + 90 -3220.43086 0.76536380 -0.38268190 0.000000000000 2 + 100 -3297.0618 0.76536251 -0.38268126 0.000000000000 2 +Loop time of 2.25559 on 4 procs for 100 steps with 1200 atoms + +Performance: 0.383 ns/day, 62.655 hours/ns, 44.334 timesteps/s +97.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.67442 | 0.69181 | 0.70907 | 2.0 | 30.67 +Kspace | 0.39381 | 0.41151 | 0.43023 | 2.6 | 18.24 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.012851 | 0.01426 | 0.015146 | 0.7 | 0.63 +Output | 0.00066686 | 0.00098681 | 0.0019395 | 0.0 | 0.04 +Modify | 1.1349 | 1.135 | 1.135 | 0.0 | 50.32 +Other | | 0.002035 | | | 0.09 + +Nlocal: 300.000 ave 300 max 300 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 4875.00 ave 4880 max 4870 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 91900.0 ave 91900 max 91900 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 183800.0 ave 183800 max 183800 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/slater" +Using fix qeq/slater +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.012 seconds +fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.10 | 11.14 | 11.16 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -2879.00309 0.76536977 -0.38268489 0.000000000000 3 + 10 -2882.50998 0.76536972 -0.38268486 0.000000000000 2 + 20 -2893.89472 0.76536950 -0.38268475 -0.000000000000 2 + 30 -2913.6181 0.76536875 -0.38268438 -0.000000000000 1 + 40 -2942.24129 0.76536939 -0.38268470 0.000000000000 1 + 50 -2980.18817 0.76536780 -0.38268390 0.000000000000 2 + 60 -3027.60957 0.76536804 -0.38268402 -0.000000000000 2 + 70 -3084.12552 0.76536573 -0.38268287 0.000000000000 2 + 80 -3148.8697 0.76536550 -0.38268275 0.000000000000 1 + 90 -3220.43086 0.76536380 -0.38268190 0.000000000000 2 + 100 -3297.0618 0.76536251 -0.38268126 0.000000000000 2 +Loop time of 2.39249 on 4 procs for 100 steps with 1200 atoms + +Performance: 0.361 ns/day, 66.458 hours/ns, 41.797 timesteps/s +96.0% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.6751 | 0.70301 | 0.71919 | 2.1 | 29.38 +Kspace | 0.45569 | 0.47315 | 0.49885 | 2.6 | 19.78 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.012967 | 0.018681 | 0.020909 | 2.4 | 0.78 +Output | 0.00066733 | 0.00099397 | 0.0019579 | 0.0 | 0.04 +Modify | 1.1945 | 1.1946 | 1.1947 | 0.0 | 49.93 +Other | | 0.002046 | | | 0.09 + +Nlocal: 300.000 ave 300 max 300 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 4875.00 ave 4880 max 4870 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 91900.0 ave 91900 max 91900 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 183800.0 ave 183800 max 183800 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 735200 +Ave neighs/atom = 612.66667 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/dynamic" +Using fix qeq/dynamic +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.002 seconds +fix 2 all qeq/dynamic 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard + (2) fix qeq/dynamic, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.195 | 9.246 | 9.278 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.38094 0.85231286 -0.42615643 -0.000000000001 43 + 10 -3452.05217 0.85475894 -0.42737947 -0.000000000003 17 + 20 -3497.8643 0.85999180 -0.42999590 0.000000000000 22 + 30 -3568.53169 0.86772479 -0.43386239 -0.000000000000 22 + 40 -3633.43753 0.87338291 -0.43669146 0.000000000006 22 + 50 -3700.27953 0.87807632 -0.43903816 0.000000000003 22 + 60 -3784.4004 0.88402822 -0.44201411 0.000000000009 17 + 70 -3877.73706 0.89012201 -0.44506100 0.000000000010 22 + 80 -3965.36111 0.89432486 -0.44716243 0.000000000011 17 + 90 -4048.57901 0.89701688 -0.44850844 0.000000000012 22 + 100 -4118.62736 0.89718691 -0.44859346 0.000000000013 17 +Loop time of 5.27704 on 4 procs for 100 steps with 1200 atoms + +Performance: 0.164 ns/day, 146.584 hours/ns, 18.950 timesteps/s +98.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.68437 | 0.69096 | 0.69826 | 0.7 | 13.09 +Kspace | 0.38484 | 0.38941 | 0.39524 | 0.7 | 7.38 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.012609 | 0.01529 | 0.016842 | 1.3 | 0.29 +Output | 0.00067735 | 0.0010006 | 0.0019588 | 1.7 | 0.02 +Modify | 4.1783 | 4.1783 | 4.1784 | 0.0 | 79.18 +Other | | 0.002027 | | | 0.04 + +Nlocal: 300.000 ave 300 max 300 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 4875.00 ave 4880 max 4870 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 91900.0 ave 93081 max 90719 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 367600 +Ave neighs/atom = 306.33333 +Neighbor list builds = 0 +Dangerous builds = 0 + +clear + using 1 OpenMP thread(s) per MPI task + +print "Using fix qeq/fire" +Using fix qeq/fire +read_restart qeq.restart +Reading restart file ... + restart file = 8 Apr 2021, LAMMPS = 8 Apr 2021 + restoring atom style charge from restart + orthogonal box = (0.0000000 0.0000000 0.0000000) to (25.158320 25.158320 28.020256) + 1 by 2 by 2 MPI processor grid + restoring pair style buck/coul/long from restart + 1200 atoms + read_restart CPU = 0.001 seconds +fix 2 all qeq/fire 1 10 1.0e-3 100 param.qeq2 +include buck.inc + +kspace_style pppm 1e-6 + +neighbor 1.0 bin +neigh_modify delay 0 every 1 check yes + +group type1 type 1 +400 atoms in group type1 +compute charge1 type1 property/atom q +compute q1 type1 reduce ave c_charge1 +group type2 type 2 +800 atoms in group type2 +compute charge2 type2 property/atom q +compute q2 type2 reduce ave c_charge2 +variable qtot equal count(type1)*c_q1+count(type2)*c_q2 +variable nqeq equal f_2 + +thermo_style custom step pe c_q1 c_q2 v_qtot v_nqeq +thermo 10 +thermo_modify format line "%4d %12.9g %12.8f %12.8f %16.12f %6.0f" + +timestep 0.0001 + +fix 1 all nve + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.27644401 + grid = 27 27 30 + stencil order = 5 + estimated absolute RMS force accuracy = 1.4502702e-05 + estimated relative force accuracy = 1.0071569e-06 + using double precision FFTW3 + 3d grid and FFT values/proc = 14960 5832 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 13 + ghost atom cutoff = 13 + binsize = 6.5, bins = 4 4 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair buck/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard + (2) fix qeq/fire, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.195 | 9.246 | 9.278 Mbytes +Step PotEng c_q1 c_q2 v_qtot v_nqeq + 0 -3432.05316 0.85226679 -0.42613339 0.000000000001 37 + 10 -3452.04937 0.85475813 -0.42737906 0.000000000001 10 + 20 -3497.83659 0.85998739 -0.42999370 0.000000000002 13 + 30 -3568.47793 0.86771599 -0.43385799 0.000000000002 13 + 40 -3633.35326 0.87337029 -0.43668514 0.000000000002 13 + 50 -3700.16079 0.87805847 -0.43902924 0.000000000000 13 + 60 -3784.31906 0.88401635 -0.44200818 -0.000000000001 11 + 70 -3877.60163 0.89010162 -0.44505081 -0.000000000000 13 + 80 -3965.28179 0.89431356 -0.44715678 0.000000000001 11 + 90 -4048.33861 0.89698069 -0.44849034 0.000000000001 13 + 100 -4118.63861 0.89718818 -0.44859409 0.000000000002 12 +Loop time of 3.88026 on 4 procs for 100 steps with 1200 atoms + +Performance: 0.223 ns/day, 107.785 hours/ns, 25.771 timesteps/s +98.0% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.68424 | 0.69912 | 0.73572 | 2.5 | 18.02 +Kspace | 0.38093 | 0.41715 | 0.43168 | 3.2 | 10.75 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.012711 | 0.013318 | 0.014003 | 0.4 | 0.34 +Output | 0.00066566 | 0.00098735 | 0.0019317 | 0.0 | 0.03 +Modify | 2.7477 | 2.7477 | 2.7477 | 0.0 | 70.81 +Other | | 0.002004 | | | 0.05 + +Nlocal: 300.000 ave 300 max 300 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 4875.00 ave 4880 max 4870 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 91900.0 ave 93081 max 90719 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 367600 +Ave neighs/atom = 306.33333 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:17 diff --git a/examples/qeq/log.27Nov18.qeq.buck.g++.1 b/examples/qeq/log.27Nov18.qeq.buck.g++.1 deleted file mode 100644 index 4d5225ccc3..0000000000 --- a/examples/qeq/log.27Nov18.qeq.buck.g++.1 +++ /dev/null @@ -1,118 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# This example demonstrates the use of various fix qeq variants with -# that defines and uses charges, in this case pair_style buck/coul/long - -units metal -atom_style charge - -read_data data.aC - orthogonal box = (0 0 0) to (25.1583 25.1583 28.0203) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 1200 atoms -replicate 2 2 2 - orthogonal box = (0 0 0) to (50.3166 50.3166 56.0405) - 1 by 1 by 1 MPI processor grid - 9600 atoms - Time spent = 0.00114894 secs - -pair_style buck/coul/long 12.0 -pair_coeff 2 2 1388.77 .3623188 175.0 -pair_coeff 1 2 18003 .2052124 133.5381 -pair_coeff 1 1 0 .1 0 -kspace_style ewald 1e-6 - -neighbor 1.0 bin -neigh_modify delay 0 every 1 check yes - -group type1 type 1 -3200 atoms in group type1 -compute charge1 type1 property/atom q -compute q1 type1 reduce ave c_charge1 -group type2 type 2 -6400 atoms in group type2 -compute charge2 type2 property/atom q -compute q2 type2 reduce ave c_charge2 -variable qtot equal count(type1)*c_q1+count(type2)*c_q2 - -thermo_style custom step pe c_q1 c_q2 v_qtot spcpu -thermo 10 - -timestep 0.0001 - -velocity all create 300.0 1281937 -fix 1 all nve - -#fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/slater 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/dynamic 1 10 1.0e-4 100 param.qeq2 -fix 2 all qeq/fire 1 10 1.0e-4 100 param.qeq2 - -run 100 -Ewald initialization ... - using 12-bit tables for long-range coulomb (src/kspace.cpp:321) - G vector (1/distance) = 0.305064 - estimated absolute RMS force accuracy = 2.07629e-05 - estimated relative force accuracy = 1.44191e-06 - KSpace vectors: actual max1d max3d = 13556 20 34460 - kxmax kymax kzmax = 18 18 20 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 13 - ghost atom cutoff = 13 - binsize = 6.5, bins = 8 8 9 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair buck/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard - (2) fix qeq/fire, perpetual, copy from (1) - attributes: half, newton on - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 134 | 134 | 134 Mbytes -Step PotEng c_q1 c_q2 v_qtot S/CPU - 0 -27457.219 0.85227886 -0.42613943 -2.1827873e-10 0 - 10 -27626.057 0.85486228 -0.42743114 -2.0372681e-10 0.64313877 - 20 -27975.085 0.85968531 -0.42984266 -1.036824e-10 0.55119179 - 30 -28552.628 0.86755661 -0.4337783 1.3051249e-10 0.53160643 - 40 -29133.643 0.87426387 -0.43713193 1.1368684e-10 0.53075341 - 50 -29697.011 0.8794039 -0.43970195 1.200533e-10 0.52358127 - 60 -30342.001 0.88478594 -0.44239297 6.002665e-11 0.5366762 - 70 -31081.138 0.8906973 -0.44534865 -4.7293724e-11 0.55904546 - 80 -31792.732 0.89506635 -0.44753317 -4.3200998e-11 0.59606079 - 90 -32424.749 0.89714841 -0.44857421 -1.1596057e-10 0.58047419 - 100 -32998.353 0.89755721 -0.44877861 -1.0231815e-10 0.59444001 -Loop time of 177.79 on 1 procs for 100 steps with 9600 atoms - -Performance: 0.005 ns/day, 4938.612 hours/ns, 0.562 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 11.518 | 11.518 | 11.518 | 0.0 | 6.48 -Kspace | 107.37 | 107.37 | 107.37 | 0.0 | 60.39 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.019721 | 0.019721 | 0.019721 | 0.0 | 0.01 -Output | 0.002218 | 0.002218 | 0.002218 | 0.0 | 0.00 -Modify | 58.869 | 58.869 | 58.869 | 0.0 | 33.11 -Other | | 0.007197 | | | 0.00 - -Nlocal: 9600 ave 9600 max 9600 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 22125 ave 22125 max 22125 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 2.9408e+06 ave 2.9408e+06 max 2.9408e+06 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 2940800 -Ave neighs/atom = 306.333 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:03:01 diff --git a/examples/qeq/log.27Nov18.qeq.buck.g++.4 b/examples/qeq/log.27Nov18.qeq.buck.g++.4 deleted file mode 100644 index 947c3caeaf..0000000000 --- a/examples/qeq/log.27Nov18.qeq.buck.g++.4 +++ /dev/null @@ -1,118 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# This example demonstrates the use of various fix qeq variants with -# that defines and uses charges, in this case pair_style buck/coul/long - -units metal -atom_style charge - -read_data data.aC - orthogonal box = (0 0 0) to (25.1583 25.1583 28.0203) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 1200 atoms -replicate 2 2 2 - orthogonal box = (0 0 0) to (50.3166 50.3166 56.0405) - 1 by 2 by 2 MPI processor grid - 9600 atoms - Time spent = 0.000675201 secs - -pair_style buck/coul/long 12.0 -pair_coeff 2 2 1388.77 .3623188 175.0 -pair_coeff 1 2 18003 .2052124 133.5381 -pair_coeff 1 1 0 .1 0 -kspace_style ewald 1e-6 - -neighbor 1.0 bin -neigh_modify delay 0 every 1 check yes - -group type1 type 1 -3200 atoms in group type1 -compute charge1 type1 property/atom q -compute q1 type1 reduce ave c_charge1 -group type2 type 2 -6400 atoms in group type2 -compute charge2 type2 property/atom q -compute q2 type2 reduce ave c_charge2 -variable qtot equal count(type1)*c_q1+count(type2)*c_q2 - -thermo_style custom step pe c_q1 c_q2 v_qtot spcpu -thermo 10 - -timestep 0.0001 - -velocity all create 300.0 1281937 -fix 1 all nve - -#fix 2 all qeq/point 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/shielded 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/slater 1 10 1.0e-6 100 param.qeq2 -#fix 2 all qeq/dynamic 1 10 1.0e-4 100 param.qeq2 -fix 2 all qeq/fire 1 10 1.0e-4 100 param.qeq2 - -run 100 -Ewald initialization ... - using 12-bit tables for long-range coulomb (src/kspace.cpp:321) - G vector (1/distance) = 0.305064 - estimated absolute RMS force accuracy = 2.07629e-05 - estimated relative force accuracy = 1.44191e-06 - KSpace vectors: actual max1d max3d = 13556 20 34460 - kxmax kymax kzmax = 18 18 20 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 13 - ghost atom cutoff = 13 - binsize = 6.5, bins = 8 8 9 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair buck/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard - (2) fix qeq/fire, perpetual, copy from (1) - attributes: half, newton on - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 53.06 | 53.13 | 53.21 Mbytes -Step PotEng c_q1 c_q2 v_qtot S/CPU - 0 -27457.215 0.85227886 -0.42613943 2.1373125e-11 0 - 10 -27626.057 0.85486228 -0.42743114 3.0468073e-11 2.4245312 - 20 -27975.085 0.85968531 -0.42984266 1.0095391e-10 2.0185316 - 30 -28552.627 0.86755661 -0.4337783 1.3096724e-10 1.9605335 - 40 -29133.643 0.87426387 -0.43713193 1.5279511e-10 1.9624139 - 50 -29697.01 0.8794039 -0.43970195 1.6461854e-10 1.8113263 - 60 -30342 0.88478594 -0.44239297 1.7826096e-10 1.9537722 - 70 -31081.139 0.89069733 -0.44534866 1.4733814e-10 2.058406 - 80 -31792.732 0.89506635 -0.44753317 1.3824319e-10 2.2160813 - 90 -32424.752 0.89714841 -0.44857421 1.2914825e-10 2.0952145 - 100 -32998.353 0.89755721 -0.44877861 1.4824764e-10 2.1292486 -Loop time of 48.7541 on 4 procs for 100 steps with 9600 atoms - -Performance: 0.018 ns/day, 1354.281 hours/ns, 2.051 timesteps/s -97.4% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.9747 | 3.0315 | 3.0758 | 2.1 | 6.22 -Kspace | 27.873 | 28.264 | 28.63 | 5.3 | 57.97 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.53835 | 0.8523 | 1.2286 | 28.2 | 1.75 -Output | 0.0012984 | 0.001591 | 0.0024178 | 1.2 | 0.00 -Modify | 16.58 | 16.59 | 16.601 | 0.3 | 34.03 -Other | | 0.01409 | | | 0.03 - -Nlocal: 2400 ave 2400 max 2400 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 11550 ave 11550 max 11550 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 735200 ave 740758 max 729642 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 2940800 -Ave neighs/atom = 306.333 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:00:49 diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 4504865303..56491228fd 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -54,10 +54,15 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); + scalar_flag = 1; + extscalar = 0; + nevery = utils::inumeric(FLERR,arg[3],false,lmp); cutoff = utils::numeric(FLERR,arg[4],false,lmp); tolerance = utils::numeric(FLERR,arg[5],false,lmp); maxiter = utils::inumeric(FLERR,arg[6],false,lmp); + maxwarn = 1; + matvecs = 0; // check for sane arguments if ((nevery <= 0) || (cutoff <= 0.0) || (tolerance <= 0.0) || (maxiter <= 0)) @@ -123,7 +128,6 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : } else { read_file(arg[7]); } - } /* ---------------------------------------------------------------------- */ @@ -277,6 +281,13 @@ void FixQEq::reallocate_matrix() /* ---------------------------------------------------------------------- */ +double FixQEq::compute_scalar() +{ + return matvecs; +} + +/* ---------------------------------------------------------------------- */ + void FixQEq::init_list(int /*id*/, NeighList *ptr) { list = ptr; @@ -395,7 +406,7 @@ int FixQEq::CG( double *b, double *x ) vector_sum( d, 1., p, beta, d, inum ); } - if ((comm->me == 0) && (loop >= maxiter)) + if ((comm->me == 0) && maxwarn && (loop >= maxiter)) error->warning(FLERR,fmt::format("Fix qeq CG convergence failed ({}) " "after {} iterations at step {}", sqrt(sig_new)/b_norm,loop, diff --git a/src/QEQ/fix_qeq.h b/src/QEQ/fix_qeq.h index 9a3087840b..a11a41841e 100644 --- a/src/QEQ/fix_qeq.h +++ b/src/QEQ/fix_qeq.h @@ -35,6 +35,8 @@ class FixQEq : public Fix { void pre_force_respa(int, int, int); void min_pre_force(int); + virtual double compute_scalar(); + // derived child classes must provide these functions virtual void init() = 0; @@ -64,7 +66,8 @@ class FixQEq : public Fix { double swa, swb; // lower/upper Taper cutoff radius double Tap[8]; // Taper function double tolerance; // tolerance for the norm of the rel residual in CG - int maxiter; // maximum number of QEq iterations + int maxiter; // maximum number of QEq iterations + int maxwarn; // print warning when max iterations was reached double cutoff, cutoff_sq; // neighbor cutoff double *chi,*eta,*gamma,*zeta,*zcore; // qeq parameters diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 397393b786..5af7a4c9a0 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -53,6 +53,12 @@ FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/dynamic command"); qstep = atof(arg[iarg+1]); iarg += 2; + } else if (strcmp(arg[iarg],"warn") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/dynamic command"); + if (strcmp(arg[iarg+1],"no") == 0) maxwarn = 0; + else if (strcmp(arg[iarg+1],"yes") == 0) maxwarn = 1; + else error->all(FLERR,"Illegal fix qeq/dynamic command"); + iarg += 2; } else error->all(FLERR,"Illegal fix qeq/dynamic command"); } } @@ -145,7 +151,7 @@ void FixQEqDynamic::pre_force(int /*vflag*/) MPI_Allreduce(&enegmax,&enegmaxall,1,MPI_DOUBLE,MPI_MAX,world); enegmax = enegmaxall; - if (enegchk <= tolerance && enegmax <= 100.0*tolerance) break; + if ((enegchk <= tolerance) && (enegmax <= 100.0*tolerance)) break; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -153,8 +159,9 @@ void FixQEqDynamic::pre_force(int /*vflag*/) q1[i] += qf[i]*dtq2 - qdamp*q1[i]; } } + matvecs = iloop; - if ((comm->me == 0) && (iloop >= maxiter)) + if ((comm->me == 0) && maxwarn && (iloop >= maxiter)) error->warning(FLERR,fmt::format("Charges did not converge at step " "{}: {}",update->ntimestep,enegchk)); diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 0bdf65dc18..0e89ee3d17 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -63,6 +63,12 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/fire command"); qstep = atof(arg[iarg+1]); iarg += 2; + } else if (strcmp(arg[iarg],"warn") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/fire command"); + if (strcmp(arg[iarg+1],"no") == 0) maxwarn = 0; + else if (strcmp(arg[iarg+1],"yes") == 0) maxwarn = 1; + else error->all(FLERR,"Illegal fix qeq/fire command"); + iarg += 2; } else error->all(FLERR,"Illegal fix qeq/fire command"); } } @@ -213,8 +219,9 @@ void FixQEqFire::pre_force(int /*vflag*/) if (enegchk < tolerance) break; } + matvecs = iloop; - if ((comm->me == 0) && (iloop >= maxiter)) + if ((comm->me == 0) && maxwarn && (iloop >= maxiter)) error->warning(FLERR,fmt::format("Charges did not converge at step " "{}: {}",update->ntimestep,enegchk)); diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index ac31f906e0..8d60585773 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -38,7 +38,15 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ FixQEqPoint::FixQEqPoint(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) {} + FixQEq(lmp, narg, arg) { + if (narg == 10) { + if (strcmp(arg[8],"warn") == 0) { + if (strcmp(arg[9],"no") == 0) maxwarn = 0; + else if (strcmp(arg[9],"yes") == 0) maxwarn = 1; + else error->all(FLERR,"Illegal fix qeq/point command"); + } else error->all(FLERR,"Illegal fix qeq/point command"); + } else if (narg > 8) error->all(FLERR,"Illegal fix qeq/point command"); +} /* ---------------------------------------------------------------------- */ @@ -80,6 +88,7 @@ void FixQEqPoint::pre_force(int /*vflag*/) init_matvec(); matvecs = CG(b_s, s); // CG on s - parallel matvecs += CG(b_t, t); // CG on t - parallel + matvecs /= 2; calculate_Q(); if (force->kspace) force->kspace->qsum_qsq(); diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index ad6202abd8..351700057b 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -40,6 +40,13 @@ using namespace LAMMPS_NS; FixQEqShielded::FixQEqShielded(LAMMPS *lmp, int narg, char **arg) : FixQEq(lmp, narg, arg) { + if (narg == 10) { + if (strcmp(arg[8],"warn") == 0) { + if (strcmp(arg[9],"no") == 0) maxwarn = 0; + else if (strcmp(arg[9],"yes") == 0) maxwarn = 1; + else error->all(FLERR,"Illegal fix qeq/shielded command"); + } else error->all(FLERR,"Illegal fix qeq/shielded command"); + } else if (narg > 8) error->all(FLERR,"Illegal fix qeq/shielded command"); if (reax_flag) extract_reax(); } @@ -143,6 +150,7 @@ void FixQEqShielded::pre_force(int /*vflag*/) init_matvec(); matvecs = CG(b_s, s); // CG on s - parallel matvecs += CG(b_t, t); // CG on t - parallel + matvecs /= 2; calculate_Q(); if (force->kspace) force->kspace->qsum_qsq(); diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 326d71c93b..da0d2090cf 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -52,6 +52,12 @@ FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/slater command"); alpha = atof(arg[iarg+1]); iarg += 2; + } else if (strcmp(arg[iarg],"warn") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/slater command"); + if (strcmp(arg[iarg+1],"no") == 0) maxwarn = 0; + else if (strcmp(arg[iarg+1],"yes") == 0) maxwarn = 1; + else error->all(FLERR,"Illegal fix qeq/slater command"); + iarg += 2; } else error->all(FLERR,"Illegal fix qeq/slater command"); } @@ -120,6 +126,7 @@ void FixQEqSlater::pre_force(int /*vflag*/) init_matvec(); matvecs = CG(b_s, s); // CG on s - parallel matvecs += CG(b_t, t); // CG on t - parallel + matvecs /= 2; calculate_Q(); if (force->kspace) force->kspace->qsum_qsq(); From fe2efa4cb3159e7f634e87c64f15ea685fb4eff8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:51:05 -0400 Subject: [PATCH 055/119] disallow usage of qeq fixes with incompatible GPU and USER-INTEL packages --- src/QEQ/fix_qeq.cpp | 8 ++++++++ src/pair.h | 2 ++ src/pair_hybrid.cpp | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 56491228fd..542670f1f3 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -24,6 +24,8 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" +#include "pair.h" +#include "suffix.h" #include "text_file_reader.h" #include "update.h" @@ -300,6 +302,12 @@ void FixQEq::setup_pre_force(int vflag) if (force->newton_pair == 0) error->all(FLERR,"QEQ with 'newton pair off' not supported"); + if (force->pair) { + if (force->pair->suffix_flag & (Suffix::INTEL|Suffix::GPU)) + error->all(FLERR,"QEQ is not compatiple with suffix version " + "of pair style"); + } + deallocate_storage(); allocate_storage(); diff --git a/src/pair.h b/src/pair.h index b25ad448eb..5b35d029ab 100644 --- a/src/pair.h +++ b/src/pair.h @@ -28,6 +28,8 @@ class Pair : protected Pointers { friend class FixGPU; friend class FixIntel; friend class FixOMP; + friend class FixQEq; + friend class PairHybrid; friend class ThrOMP; friend class Info; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 48ba1ccff7..485257858d 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -948,9 +948,7 @@ void PairHybrid::modify_special(int m, int /*narg*/, char **arg) special[2] = utils::numeric(FLERR,arg[2],false,lmp); special[3] = utils::numeric(FLERR,arg[3],false,lmp); - // have to cast to PairHybrid to work around C++ access restriction - - if (((PairHybrid *)styles[m])->suffix_flag & (Suffix::INTEL|Suffix::GPU)) + if (styles[m]->suffix_flag & (Suffix::INTEL|Suffix::GPU)) error->all(FLERR,"Pair_modify special is not compatible with " "suffix version of hybrid substyle"); From fec12020ac8fb2e5b1facfed4e17fe3c61c82749 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:52:29 -0400 Subject: [PATCH 056/119] add unit tests for fix qeq/point and fix qeq/shielded --- .../atomic-pair-buck_coul_cut_qeq_point.yaml | 175 ++++++++++++++++++ ...tomic-pair-buck_coul_cut_qeq_shielded.yaml | 175 ++++++++++++++++++ 2 files changed, 350 insertions(+) create mode 100644 unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_point.yaml create mode 100644 unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_shielded.yaml diff --git a/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_point.yaml b/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_point.yaml new file mode 100644 index 0000000000..d3e6b38980 --- /dev/null +++ b/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_point.yaml @@ -0,0 +1,175 @@ +--- +lammps_version: 8 Apr 2021 +date_generated: Tue Apr 20 14:47:51 2021 +epsilon: 7.5e-13 +skip_tests: intel single +prerequisites: ! | + pair buck/coul/cut + fix qeq/point +pre_commands: ! | + echo screen + variable newton_pair delete + variable newton_pair index on + atom_modify map array + units metal + atom_style charge + lattice diamond 3.77 + region box block 0 2 0 2 0 2 + create_box 2 box + create_atoms 1 box + displace_atoms all random 0.1 0.1 0.1 623426 + mass 1 28.0 + mass 2 16.0 + set type 1 type/fraction 2 0.666667 998877 + set type 1 charge 0.8 + set type 2 charge 0.4 + velocity all create 100 4534624 loop geom +post_commands: ! | + fix qeq all qeq/point 1 6.0 1.0e-20 20 ${input_dir}/param.qeq2 warn no +input_file: in.empty +pair_style: buck/coul/cut 6.0 +pair_coeff: ! | + 1 1 0.0 0.1 00 + 1 2 18003.0 0.2052124 133.5381 + 2 2 1388.77 0.3623188 175.0 +extract: ! "" +natoms: 64 +init_vdwl: 106.41860675757 +init_coul: -129.9140700924124 +init_stress: ! |- + -2.8069812877025680e+02 -4.4806768911794171e+02 -5.0378472147221044e+02 3.9357896002405380e+02 -4.6782123097483543e+02 1.9690042286173212e+02 +init_forces: ! |2 + 1 7.9125122896296922e+00 -2.1014839690852849e+00 1.0994080971957654e+01 + 2 -8.6188789139298905e+00 -1.8333074427098923e+00 6.9043233196778493e+00 + 3 7.8498612200411868e+00 -2.1754399089581845e+01 -2.8862198492435933e+00 + 4 6.0059474900265855e+00 2.0200604615492711e+01 -3.6502720655785064e+00 + 5 -1.0414088486908696e+01 -1.2032673161543727e+01 -8.1683250459138641e+00 + 6 2.4526971509997360e+00 1.6151940503875748e+00 3.9699353225387135e+00 + 7 1.1484521325651471e+01 2.6251346011917382e+00 -5.0509149729671243e-01 + 8 -8.6634039445313658e+00 -8.3084485039834881e+00 3.9070922142448175e+00 + 9 7.9495750681929742e+00 -9.0507972374486361e+00 -4.4437699190231843e+00 + 10 -1.1184211738488107e+01 -2.0985043628368132e+00 8.0230797778549956e+00 + 11 2.8166289803609963e+01 -2.6396601038400636e+01 -7.0398077372607645e+01 + 12 1.8384817166363799e+01 4.9304421068745743e+00 -1.8773815008331542e+01 + 13 -8.5901832560112172e+00 -1.1830174021232128e+01 1.0687567118271307e+01 + 14 -2.7556923264654802e+00 1.7745847764979608e+00 -9.2066420206368988e+00 + 15 4.6735302548764643e+00 -3.2709618690940427e+00 -2.0693142194244816e+00 + 16 -6.0547965516444906e+00 -2.2600378957272116e+00 3.2677368381468008e-01 + 17 -9.1378380656225406e+00 1.1908878845184031e+01 -1.7535407559841292e+00 + 18 -1.2710024935571287e+00 -1.8390249623807247e+00 -5.0661022351703764e+00 + 19 4.7508234682845059e+00 -4.7660218202653398e-01 1.9578845982916517e+00 + 20 -2.4044494501312546e+00 1.3188349248766018e+01 -4.2723195450669484e+00 + 21 2.5545939677742822e+00 -7.6599926401155196e+00 -1.9913355105865760e+00 + 22 -1.2721065348405212e+01 2.2605336717084196e+01 -4.7468563523008402e+00 + 23 2.4611421112071081e+00 -1.4649327715865049e-01 3.5863258472083799e+00 + 24 -4.3893602786163104e+00 2.1969519282498890e+01 4.4720052177174487e+00 + 25 2.0238917888202160e+01 -1.5707849435118018e+01 5.7119813878581205e+00 + 26 -1.2244546012542273e+01 8.7637388770168165e+00 1.1554289778536326e+01 + 27 2.6315583772500917e+00 5.2366381109035203e+00 5.6567854473912291e+00 + 28 1.6069342319200945e+01 2.2379145739762505e+00 1.2146106338402367e+01 + 29 1.6156898389873891e+01 -1.3554238523505591e+01 -9.1896135574796052e+00 + 30 -8.4056006337974853e+00 7.0469844075145707e+00 6.3110771274676658e+00 + 31 -1.3273848195602289e-01 -6.8307139969335129e+00 7.6340671688916251e-01 + 32 -3.5499992242635152e+01 1.6857356356036899e+01 5.1954595281751772e+01 + 33 -1.5976858206617210e+01 -2.1986638912202295e+01 1.5916728791281200e+01 + 34 9.9892552480335084e+00 2.4910832782965171e+00 -3.5317186985424054e+00 + 35 7.0710369156676450e+01 -3.5579041343629925e+01 -5.3907803084513858e+01 + 36 -5.7367330604749455e+01 -7.0169041999492791e+01 7.3977418913261829e+01 + 37 5.5359814356241074e+01 7.2104773934571938e+01 -6.4062698737301162e+01 + 38 7.3137814516005992e+00 -6.9993845661823428e+00 -4.9786686785484031e+00 + 39 2.1766057858052013e+00 2.6649010324053237e+00 -5.5648981412947700e+00 + 40 -8.6278470191715790e+00 -6.1938287573923239e+00 -5.3007116622920181e-01 + 41 -2.1876614204878253e+00 -4.9711482834141876e+00 2.1023653625053651e+00 + 42 6.7356638591944380e+00 2.3811284335916083e+00 -2.6936658473425106e+00 + 43 -4.8166095077507318e+00 9.0096363628437235e+00 -3.5021097239659325e+00 + 44 4.5856314854049890e-01 -6.4502158514658676e+00 -2.2547412879230078e+00 + 45 -1.4050653828419732e+00 -2.7741840518241623e-01 5.9455907460299153e+00 + 46 1.7068092414266975e+00 3.0134108012937979e+00 -7.3633262984858643e+00 + 47 -8.5993680232001868e+00 3.9482405710461826e-02 -7.4020141073315715e-01 + 48 -1.4797111864775530e+02 9.0978008317055270e+01 8.8422607641864516e+01 + 49 1.2110838856400735e+01 1.0210083421020201e+01 -1.7064250014241885e+01 + 50 1.5673894480674800e+01 4.2472425008217618e+00 2.3874134866435037e-01 + 51 -1.0755978881146193e+03 9.4584826950708475e+02 -1.2161507490133176e+03 + 52 1.5238648316158450e+01 -1.4713914840395454e+01 1.0700180235730782e+01 + 53 1.0832818442423763e+03 -9.4512225095469830e+02 1.2182464933546009e+03 + 54 -1.2715521453452059e+00 1.0003156043833941e+00 -4.7435368103541586e+00 + 55 -1.2828505786775382e+01 2.4021051786462557e+01 -1.1214232355595612e+01 + 56 -7.6186543306062049e+01 2.6038364737554620e+01 4.6298155917897482e+01 + 57 1.0443716577117205e+02 3.6009056789261075e+02 2.1380802968687473e+02 + 58 -9.1275826241798370e+00 -1.3245000554098924e+01 -8.7148296348715926e-01 + 59 1.2840492718836813e+02 -1.0559491971264805e+02 -6.6237876488606588e+01 + 60 -2.1677737255323635e+00 -1.1892793887650410e+00 -8.1033360541735249e+00 + 61 -1.2148578617098147e+02 -3.5657463872647236e+02 -2.0401151842776562e+02 + 62 -2.7445863145191973e+00 1.2181869352734287e+01 6.0139221094528885e+00 + 63 -7.8700771372090834e+00 -3.1538926482273300e+00 1.0493868436023858e+01 + 64 2.5378792969187284e+01 3.2092052615283109e+01 -1.6443232536994536e+01 +run_vdwl: -1745.867185907274 +run_coul: -134.07506093090166 +run_stress: ! |- + -4.5872997550021264e+03 -3.9988755027842894e+03 -6.1188498400678936e+03 4.1760773642646591e+03 -5.3312812896810128e+03 4.4665905499115461e+03 +run_forces: ! |2 + 1 7.9285352946497758e+00 -2.1027294435031489e+00 1.1086825816163195e+01 + 2 -8.5419611035054892e+00 -1.8545741670495524e+00 7.0079173935199286e+00 + 3 8.4201002043041484e+00 -2.3236585201563706e+01 -3.5619050765611897e+00 + 4 5.8244272716577141e+00 2.0336700262604413e+01 -3.7991301665341801e+00 + 5 -1.0597147068623588e+01 -1.2052626644608324e+01 -8.3616620515931093e+00 + 6 2.3454925059969298e+00 1.9423650844033959e+00 4.1282352821875090e+00 + 7 1.1498130683730052e+01 2.7037305516932548e+00 -4.3590618591979624e-01 + 8 -8.7055079862119680e+00 -8.2080543611619063e+00 3.8502610802694401e+00 + 9 7.8905280043672006e+00 -9.1748249725951716e+00 -4.3595650830599473e+00 + 10 -1.1214544607539489e+01 -2.0450291190922241e+00 8.0819592940862215e+00 + 11 3.1110360595812111e+01 -3.0379448305557091e+01 -8.0086245459647699e+01 + 12 1.8159177163415904e+01 4.8329111811515117e+00 -1.8760362770452407e+01 + 13 -8.3967367015110703e+00 -1.1826424656028374e+01 1.0490586963619998e+01 + 14 -2.7403143901237863e+00 1.5146525228727186e+00 -9.5102191320553011e+00 + 15 4.6084095676492058e+00 -3.2455057110391716e+00 -2.0076394841639451e+00 + 16 -5.9971213141367166e+00 -2.1400797487747161e+00 3.8635660450105780e-01 + 17 -9.2777494354866672e+00 1.1929670372837402e+01 -1.5781112010078653e+00 + 18 -1.2640996234737609e+00 -1.8706861715670353e+00 -5.0907920358459542e+00 + 19 4.7710267464485367e+00 -4.0988795718884213e-01 1.9972858346581028e+00 + 20 -2.2378279249288067e+00 1.3107343895216937e+01 -4.2428037955197233e+00 + 21 2.5289893324335391e+00 -7.6558240340245325e+00 -1.9069419539704020e+00 + 22 -1.2728255711560161e+01 2.2449803210470662e+01 -4.4375794812338860e+00 + 23 2.2126988647283259e+00 -1.9107846463909647e-01 3.6978572940177510e+00 + 24 -4.9407746531577494e+00 2.3427146491434673e+01 5.0673415871481255e+00 + 25 2.0382651093146954e+01 -1.5777195827352591e+01 5.8844240401473211e+00 + 26 -1.2179841258863439e+01 8.7610073871936400e+00 1.1530406923973768e+01 + 27 2.6588676610969855e+00 5.1896378052166741e+00 5.6387483053555902e+00 + 28 1.5666189299730341e+01 1.6249815489114361e+00 1.1769883127324578e+01 + 29 1.6154781213323030e+01 -1.3566033536379088e+01 -9.1472138878710076e+00 + 30 -8.3472695417921603e+00 7.0562388858473168e+00 6.3337664999339882e+00 + 31 4.5583726078147091e-02 -6.8079173592470026e+00 8.8191267004599450e-01 + 32 -3.7970235777293169e+01 2.1379327045743118e+01 6.2117682066075531e+01 + 33 -1.6353741251628691e+01 -2.2709420959741056e+01 1.6304846015441370e+01 + 34 9.9972886088735162e+00 2.2643391331974536e+00 -3.4550103310401896e+00 + 35 7.6455556546064358e+01 -3.7809722812169873e+01 -5.8409719550108399e+01 + 36 -6.9348410375051216e+01 -8.5084762326803883e+01 8.7066878049116482e+01 + 37 6.7398486015543440e+01 8.6977799607188729e+01 -7.7261561475806531e+01 + 38 7.3284526937033183e+00 -7.6017536517090827e+00 -4.4692146119773133e+00 + 39 2.2039881666125036e+00 2.6712481163988575e+00 -5.4998118879989439e+00 + 40 -8.1920739102716507e+00 -5.6013665505583772e+00 -6.3906324471289055e-01 + 41 -9.6914424345020511e-01 -3.6895968531383003e+00 1.1100392846951848e+00 + 42 6.4344379128480211e+00 2.8919317863081786e+00 -2.0533867506787638e+00 + 43 -4.8969216688076900e+00 8.9173540382237473e+00 -3.4262725785712571e+00 + 44 3.9812820211199523e-01 -6.4925904498103826e+00 -2.2914632965466297e+00 + 45 -1.1701379586492111e+00 -6.8534375447769547e-01 5.2141786324779167e+00 + 46 1.7082488047076678e+00 2.9689192858013040e+00 -7.3986980836820644e+00 + 47 -8.4162004926885050e+00 -1.1549845996840341e-01 -6.9949420861709011e-01 + 48 -1.7140102399704551e+02 1.0954749031941631e+02 1.0215589866028962e+02 + 49 1.2958089986488774e+01 1.0763913519899868e+01 -1.6248816454541608e+01 + 50 1.4518431826929746e+01 5.0424709064095214e+00 5.3597634284364259e-02 + 51 -1.4015254817893208e+04 1.2504756770641432e+04 -1.5967183598544239e+04 + 52 1.5420056645525479e+01 -1.4998517432233239e+01 1.0961481290482833e+01 + 53 1.4023035080488416e+04 -1.2504964789519170e+04 1.5967622019398565e+04 + 54 -1.2443556258779074e+00 1.1935781697358863e+00 -4.7574145417182354e+00 + 55 -1.3066707495598941e+01 2.3943248755492228e+01 -1.1562546476831322e+01 + 56 -8.3304235816705628e+01 2.6818208086831827e+01 5.1686194842892000e+01 + 57 1.5120792842525938e+02 5.1705018806557780e+02 3.0849363663112024e+02 + 58 -9.2125676676377548e+00 -1.1733522325859413e+01 1.8639253510409390e-02 + 59 1.5201721677305994e+02 -1.2328671257917705e+02 -8.0267873143196880e+01 + 60 -2.1359354701455682e+00 -1.0122954230610202e+00 -7.9908260633230173e+00 + 61 -1.6847550389189405e+02 -5.1524925258885060e+02 -2.9923087564684147e+02 + 62 -2.7864227120115106e+00 1.2259886975143148e+01 5.9379812236948695e+00 + 63 -7.9097586153187249e+00 -3.2603634511507762e+00 1.0417329010466950e+01 + 64 2.5990005859488274e+01 3.2517151166598666e+01 -1.6862446054183820e+01 +... diff --git a/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_shielded.yaml b/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_shielded.yaml new file mode 100644 index 0000000000..2a80c30144 --- /dev/null +++ b/unittest/force-styles/tests/atomic-pair-buck_coul_cut_qeq_shielded.yaml @@ -0,0 +1,175 @@ +--- +lammps_version: 8 Apr 2021 +date_generated: Tue Apr 20 14:48:00 2021 +epsilon: 7.5e-13 +skip_tests: intel single +prerequisites: ! | + pair buck/coul/cut + fix qeq/shielded +pre_commands: ! | + echo screen + variable newton_pair delete + variable newton_pair index on + atom_modify map array + units metal + atom_style charge + lattice diamond 3.77 + region box block 0 2 0 2 0 2 + create_box 2 box + create_atoms 1 box + displace_atoms all random 0.1 0.1 0.1 623426 + mass 1 28.0 + mass 2 16.0 + set type 1 type/fraction 2 0.666667 998877 + set type 1 charge 0.8 + set type 2 charge 0.4 + velocity all create 100 4534624 loop geom +post_commands: ! | + fix qeq all qeq/shielded 1 6.0 1.0e-20 20 ${input_dir}/param.qeq2 warn no +input_file: in.empty +pair_style: buck/coul/cut 6.0 +pair_coeff: ! | + 1 1 0.0 0.1 00 + 1 2 18003.0 0.2052124 133.5381 + 2 2 1388.77 0.3623188 175.0 +extract: ! "" +natoms: 64 +init_vdwl: 106.41860675757 +init_coul: -92.45424973362312 +init_stress: ! |- + -2.6904173108770976e+02 -4.3428982773044442e+02 -4.9175916018347112e+02 3.9566088371930806e+02 -4.7262515517192719e+02 1.9591432292647838e+02 +init_forces: ! |2 + 1 7.9141417235740947e+00 -1.6575050231777215e+00 1.1247124417953305e+01 + 2 -8.1950643733925208e+00 -1.6928876509873696e+00 6.6818350912540652e+00 + 3 7.5215990692204731e+00 -2.1745595057982086e+01 -3.1301184475253381e+00 + 4 5.3917119324179188e+00 1.9732178742296160e+01 -3.7725042521095493e+00 + 5 -1.0136647320370246e+01 -1.2048794925281427e+01 -8.4425399256150335e+00 + 6 2.4664525420347161e+00 1.5156953299620182e+00 3.7546365998324012e+00 + 7 1.1539561031557810e+01 2.5652090902711979e+00 -4.3086648609162537e-01 + 8 -8.0662635175834705e+00 -8.3166158318636221e+00 4.2929691537457746e+00 + 9 7.8771720152697613e+00 -9.0024422542616396e+00 -4.5409532537229280e+00 + 10 -1.0964825127320315e+01 -1.7834328756310320e+00 7.8305203967741654e+00 + 11 2.8042061526336870e+01 -2.4878965644063260e+01 -6.9143265780487837e+01 + 12 1.8495615121211895e+01 4.3133827818564443e+00 -1.7691034897981336e+01 + 13 -8.4399728839306629e+00 -1.1518157999367906e+01 1.0295637396842004e+01 + 14 -2.7480646564437472e+00 1.8734968257465416e+00 -9.0973470213750058e+00 + 15 4.0225295371995529e+00 -4.0872787545152063e+00 -2.9384778611873470e+00 + 16 -5.9650138797306003e+00 -2.3087379423335772e+00 6.8308131661998561e-02 + 17 -9.1908442946528215e+00 1.1751276661643065e+01 -1.8408085151683529e+00 + 18 -1.3137718308179736e+00 -1.9012430640012012e+00 -5.1139666908059747e+00 + 19 4.4549255890758639e+00 -4.3939817417280941e-01 2.1886643387097751e+00 + 20 -2.0319203048741077e+00 1.2653408558732941e+01 -4.9917805891989406e+00 + 21 2.4950515142199343e+00 -7.8536749191430131e+00 -1.8304140855930795e+00 + 22 -1.2859663801965809e+01 2.2730915732234180e+01 -4.9479217011461092e+00 + 23 2.5459383618018023e+00 -2.9828026430000509e-01 3.4194490946030140e+00 + 24 -4.3638180485752436e+00 2.2376710173772068e+01 4.7532741402407801e+00 + 25 2.0836667788518888e+01 -1.6344888313048909e+01 5.6211876341385709e+00 + 26 -1.2607606955151248e+01 9.1008974375965153e+00 1.2019343399635865e+01 + 27 2.1952885206072059e+00 5.0665486907574895e+00 5.5237917166507362e+00 + 28 1.6488561582105199e+01 2.4906410951101425e+00 1.2426653974121137e+01 + 29 1.6251639920278514e+01 -1.4165524718233035e+01 -9.5519013725891924e+00 + 30 -8.5665322777305750e+00 6.5330097528312958e+00 6.7385937277364834e+00 + 31 -1.6266027468958288e-01 -6.6886609738962113e+00 8.8566519040115255e-01 + 32 -3.5245474890368847e+01 1.6495014756334484e+01 5.1078937232184522e+01 + 33 -1.5987226674008781e+01 -2.1890093847568011e+01 1.6032979914514094e+01 + 34 9.8711439787861472e+00 2.5536945969673872e+00 -3.3348635269507474e+00 + 35 7.0807263895311777e+01 -3.5539168497154421e+01 -5.3725574081330656e+01 + 36 -5.6877142152340149e+01 -6.9366823927578849e+01 7.2994971999025935e+01 + 37 5.4660108324736413e+01 7.1291615544338143e+01 -6.3759392720711894e+01 + 38 7.0743366174130307e+00 -7.6487647563486689e+00 -4.6878237559766189e+00 + 39 2.0381847012670646e+00 2.6755672967675741e+00 -5.2811442194348039e+00 + 40 -9.0185944759842691e+00 -5.7604357452722770e+00 -3.4337610522422546e-01 + 41 -2.7088447313443842e+00 -5.2782133055992473e+00 1.7885966807060194e+00 + 42 6.7732857687967325e+00 2.3205919970957725e+00 -2.4010131075334322e+00 + 43 -4.5927233661860249e+00 9.0529486933975445e+00 -3.6577320776925335e+00 + 44 2.8749921571080672e-01 -6.1319691267726260e+00 -1.7739459946345322e+00 + 45 -1.1845421822047435e+00 -1.2989558081946262e-01 5.4900076955978339e+00 + 46 1.3601159060680870e+00 3.5799207177313330e+00 -7.6189436341957544e+00 + 47 -8.1337841515165614e+00 -1.2629496960863673e-01 -8.8562060415993760e-01 + 48 -1.4860155650493951e+02 9.0963206813737870e+01 8.8856904799540899e+01 + 49 1.2639152627450446e+01 1.0359532596352693e+01 -1.7242867911828036e+01 + 50 1.5521880865901194e+01 4.2868543946915896e+00 3.1711848237800400e-01 + 51 -1.0735634351608480e+03 9.4537025515826099e+02 -1.2147493979398862e+03 + 52 1.5466658019682828e+01 -1.4895417892202326e+01 1.1112480680825493e+01 + 53 1.0819480450682750e+03 -9.4418452213503031e+02 1.2169212362594612e+03 + 54 -1.0894773002862821e+00 6.6706752208107978e-01 -4.8790516443905974e+00 + 55 -1.3844732593145427e+01 2.4648863250620490e+01 -1.1348546815898326e+01 + 56 -7.5962830973889339e+01 2.6101351295707214e+01 4.6341687389775707e+01 + 57 1.0485701291302608e+02 3.6058930749586290e+02 2.1396553624858470e+02 + 58 -8.9779882186764475e+00 -1.3244731779675908e+01 -1.3278080384995206e+00 + 59 1.2850554211073154e+02 -1.0591990510462425e+02 -6.6793350663870882e+01 + 60 -2.1508838217754374e+00 -9.5900020614540604e-01 -7.7855526817679328e+00 + 61 -1.2102976382849171e+02 -3.5660400748210526e+02 -2.0445983478947505e+02 + 62 -3.2250906445468925e+00 1.1774314121365196e+01 6.3355915377420322e+00 + 63 -7.6074695879604359e+00 -2.9040201639454253e+00 1.0880944642028627e+01 + 64 2.5065083017154684e+01 3.1881871782588231e+01 -1.6344906772607633e+01 +run_vdwl: -1738.504828461019 +run_coul: -94.95581768227976 +run_stress: ! |- + -4.5595453405449562e+03 -3.9713162676196043e+03 -6.0848825790480287e+03 4.1634964821175072e+03 -5.3172121985750009e+03 4.4482840126121810e+03 +run_forces: ! |2 + 1 7.9430648174104608e+00 -1.6505623585983651e+00 1.1353040695469964e+01 + 2 -8.0909470592272665e+00 -1.6949319849892177e+00 6.7767677870716474e+00 + 3 8.1078778180838125e+00 -2.3235717929919247e+01 -3.8090540398880952e+00 + 4 5.2184189853247993e+00 1.9883083402118530e+01 -3.9293647164607202e+00 + 5 -1.0315532797751688e+01 -1.2066521654437734e+01 -8.6235072008116074e+00 + 6 2.3527033402736865e+00 1.8434233133221647e+00 3.9200698665620468e+00 + 7 1.1558853330915097e+01 2.6482270737969671e+00 -3.5653539616982843e-01 + 8 -8.0944578895520376e+00 -8.2317015861577598e+00 4.2492167566992798e+00 + 9 7.7973204991242282e+00 -9.1232078942352679e+00 -4.4476458756957902e+00 + 10 -1.0992761089447495e+01 -1.7271203633765912e+00 7.8732627610722128e+00 + 11 3.0931722247747444e+01 -2.8786477048677739e+01 -7.8665114289916033e+01 + 12 1.8274394539545813e+01 4.2080021850140445e+00 -1.7702358881800027e+01 + 13 -8.2599586789888200e+00 -1.1515741006968879e+01 1.0107104927112278e+01 + 14 -2.7279898223061001e+00 1.6130541061743697e+00 -9.3952153337124464e+00 + 15 3.9515263062313335e+00 -4.0844589202051376e+00 -2.8866117721996689e+00 + 16 -5.8981678832905171e+00 -2.1804152314776850e+00 1.4275910534889458e-01 + 17 -9.3307269581232593e+00 1.1774312330333576e+01 -1.6692683576013803e+00 + 18 -1.3134558888695769e+00 -1.9382763777674961e+00 -5.1386794705347452e+00 + 19 4.4778449905197109e+00 -3.7332160506766110e-01 2.2265534122637054e+00 + 20 -1.9216161276856039e+00 1.2623039169837961e+01 -4.9985363809975647e+00 + 21 2.4738768947622880e+00 -7.8544243197235870e+00 -1.7482503763962445e+00 + 22 -1.2883029726566168e+01 2.2588117645764534e+01 -4.6467323617000371e+00 + 23 2.3091594744980535e+00 -3.5151849114507772e-01 3.5274744438543237e+00 + 24 -4.9018564244447180e+00 2.3838352476498073e+01 5.3460036982254815e+00 + 25 2.0948048851721442e+01 -1.6373698326971489e+01 5.7720446049694036e+00 + 26 -1.2578008211337877e+01 9.1211609042314503e+00 1.2008844944222867e+01 + 27 2.2045394963986160e+00 5.0247152904089880e+00 5.4827119887611868e+00 + 28 1.6104286139406646e+01 1.9002405388339891e+00 1.2069099381708440e+01 + 29 1.6263381250006539e+01 -1.4213704415061143e+01 -9.5280965445643737e+00 + 30 -8.5106296596336417e+00 6.5389339966331104e+00 6.7625294275517316e+00 + 31 1.4273319546851848e-02 -6.6747306136807882e+00 1.0093006407241376e+00 + 32 -3.7680672886741476e+01 2.0930462633195887e+01 6.1078153188510051e+01 + 33 -1.6365245005849875e+01 -2.2602871724758668e+01 1.6416398262575715e+01 + 34 9.8850471358845962e+00 2.3562304461945787e+00 -3.2796925462623761e+00 + 35 7.6552797346940821e+01 -3.7762973127437611e+01 -5.8230414917441593e+01 + 36 -6.8717983540165619e+01 -8.4097670136565384e+01 8.5940075687947427e+01 + 37 6.6554563114837478e+01 8.5966291567755746e+01 -7.6794896761790099e+01 + 38 7.1088003592849205e+00 -8.2230746263721581e+00 -4.2021171895312630e+00 + 39 2.0757879393792544e+00 2.6895810149309449e+00 -5.2209951864941644e+00 + 40 -8.5670330622826629e+00 -5.1877611476592262e+00 -4.7690438257845008e-01 + 41 -1.5274749236361123e+00 -4.0411587071835031e+00 7.8872850139034600e-01 + 42 6.4844518585745128e+00 2.8177957843382857e+00 -1.7924873100831999e+00 + 43 -4.6905478422001954e+00 8.9556578890169813e+00 -3.5942238071494108e+00 + 44 2.2519703741980698e-01 -6.1753412426980390e+00 -1.8022354020798390e+00 + 45 -9.1501325926584676e-01 -5.2347101045402322e-01 4.8068911677143360e+00 + 46 1.3779977952935716e+00 3.4995478428931444e+00 -7.6316648685752480e+00 + 47 -8.0609749909669581e+00 -2.1741420953096791e-01 -8.4151730986634521e-01 + 48 -1.7213184634714088e+02 1.0957659916624621e+02 1.0267576521252535e+02 + 49 1.3502214899750406e+01 1.0917576182238818e+01 -1.6482937758762418e+01 + 50 1.4379813283875713e+01 5.0553400873044820e+00 1.0683342950103625e-01 + 51 -1.3957521762635950e+04 1.2452654544174226e+04 -1.5900991752693422e+04 + 52 1.5633296407076536e+01 -1.5168118286747163e+01 1.1375722352219624e+01 + 53 1.3966019441343162e+04 -1.2452432702569762e+04 1.5901485612155189e+04 + 54 -1.0302010742237790e+00 8.0882593586606122e-01 -4.8342043026033270e+00 + 55 -1.4050317568063919e+01 2.4571746720771483e+01 -1.1619744995231775e+01 + 56 -8.3051825195541284e+01 2.6893430568070734e+01 5.1720488371951646e+01 + 57 1.5167680987925942e+02 5.1771459761745700e+02 3.0876046319206444e+02 + 58 -9.0684224428918387e+00 -1.1737173531443593e+01 -4.2815053798067343e-01 + 59 1.5222786378196815e+02 -1.2370024170265403e+02 -8.0875432712487481e+01 + 60 -2.1233147761897007e+00 -7.9017832727701498e-01 -7.6738212145982452e+00 + 61 -1.6808948242299991e+02 -5.1546658556632860e+02 -2.9975983407554941e+02 + 62 -3.2501332686207283e+00 1.1879860248088384e+01 6.2378391727747093e+00 + 63 -7.6393918044176985e+00 -2.9843682141469259e+00 1.0819122718511684e+01 + 64 2.5665406780155877e+01 3.2294883947912929e+01 -1.6760878883557520e+01 +... From a959d655601d9d78d668baea9988df6dbeb901ab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:52:42 -0400 Subject: [PATCH 057/119] whitespace fixes --- src/QEQ/fix_qeq.cpp | 72 ++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 542670f1f3..d6fe12abf8 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -120,7 +120,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : atom->add_callback(Atom::GROW); for (int i = 0; i < atom->nmax; i++) - for (int j = 0; j < nprev; ++j ) + for (int j = 0; j < nprev; ++j) s_hist[i][j] = t_hist[i][j] = atom->q[i]; if (strcmp(arg[7],"coul/streitz") == 0) { @@ -253,7 +253,7 @@ void FixQEq::allocate_matrix() i = ilist[ii]; m += numneigh[i]; } - m_cap = MAX( (int)(m * safezone), mincap * MIN_NBRS ); + m_cap = MAX((int)(m * safezone), mincap * MIN_NBRS); H.n = n_cap; H.m = m_cap; @@ -267,10 +267,10 @@ void FixQEq::allocate_matrix() void FixQEq::deallocate_matrix() { - memory->destroy( H.firstnbr ); - memory->destroy( H.numnbrs ); - memory->destroy( H.jlist ); - memory->destroy( H.val ); + memory->destroy(H.firstnbr); + memory->destroy(H.numnbrs); + memory->destroy(H.jlist); + memory->destroy(H.val); } /* ---------------------------------------------------------------------- */ @@ -365,7 +365,7 @@ void FixQEq::min_pre_force(int vflag) /* ---------------------------------------------------------------------- */ -int FixQEq::CG( double *b, double *x ) +int FixQEq::CG(double *b, double *x) { int loop, i, ii, inum, *ilist; double tmp, alfa, beta, b_norm; @@ -375,10 +375,10 @@ int FixQEq::CG( double *b, double *x ) ilist = list->ilist; pack_flag = 1; - sparse_matvec( &H, x, q ); - comm->reverse_comm_fix( this ); + sparse_matvec(&H, x, q); + comm->reverse_comm_fix(this); - vector_sum( r , 1., b, -1., q, inum ); + vector_sum(r , 1., b, -1., q, inum); for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; @@ -387,19 +387,19 @@ int FixQEq::CG( double *b, double *x ) else d[i] = 0.0; } - b_norm = parallel_norm( b, inum ); - sig_new = parallel_dot( r, d, inum); + b_norm = parallel_norm(b, inum); + sig_new = parallel_dot(r, d, inum); for (loop = 1; loop < maxiter && sqrt(sig_new)/b_norm > tolerance; ++loop) { comm->forward_comm_fix(this); - sparse_matvec( &H, d, q ); + sparse_matvec(&H, d, q); comm->reverse_comm_fix(this); - tmp = parallel_dot( d, q, inum); + tmp = parallel_dot(d, q, inum); alfa = sig_new / tmp; - vector_add( x, alfa, d, inum ); - vector_add( r, -alfa, q, inum ); + vector_add(x, alfa, d, inum); + vector_add(r, -alfa, q, inum); for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; @@ -408,10 +408,10 @@ int FixQEq::CG( double *b, double *x ) } sig_old = sig_new; - sig_new = parallel_dot( r, p, inum); + sig_new = parallel_dot(r, p, inum); beta = sig_new / sig_old; - vector_sum( d, 1., p, beta, d, inum ); + vector_sum(d, 1., p, beta, d, inum); } if ((comm->me == 0) && maxwarn && (loop >= maxiter)) @@ -425,7 +425,7 @@ int FixQEq::CG( double *b, double *x ) /* ---------------------------------------------------------------------- */ -void FixQEq::sparse_matvec( sparse_matrix *A, double *x, double *b ) +void FixQEq::sparse_matvec(sparse_matrix *A, double *x, double *b) { int i, j, itr_j; @@ -444,7 +444,7 @@ void FixQEq::sparse_matvec( sparse_matrix *A, double *x, double *b ) for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) { - for ( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { + for (itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; b[i] += A->val[itr_j] * x[j]; b[j] += A->val[itr_j] * x[i]; @@ -466,8 +466,8 @@ void FixQEq::calculate_Q() inum = list->inum; ilist = list->ilist; - s_sum = parallel_vector_acc( s, inum ); - t_sum = parallel_vector_acc( t, inum); + s_sum = parallel_vector_acc(s, inum); + t_sum = parallel_vector_acc(t, inum); u = s_sum / t_sum; for (ii = 0; ii < inum; ++ii) { @@ -485,7 +485,7 @@ void FixQEq::calculate_Q() } pack_flag = 4; - comm->forward_comm_fix( this ); //Dist_vector( atom->q ); + comm->forward_comm_fix(this); //Dist_vector(atom->q); } /* ---------------------------------------------------------------------- */ @@ -516,11 +516,11 @@ void FixQEq::unpack_forward_comm(int n, int first, double *buf) if (pack_flag == 1) for (m = 0, i = first; m < n; m++, i++) d[i] = buf[m]; - else if ( pack_flag == 2) + else if (pack_flag == 2) for (m = 0, i = first; m < n; m++, i++) s[i] = buf[m]; - else if ( pack_flag == 3) + else if (pack_flag == 3) for (m = 0, i = first; m < n; m++, i++) t[i] = buf[m]; - else if ( pack_flag == 4) + else if (pack_flag == 4) for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; } @@ -605,7 +605,7 @@ int FixQEq::unpack_exchange(int n, double *buf) /* ---------------------------------------------------------------------- */ -double FixQEq::parallel_norm( double *v, int n ) +double FixQEq::parallel_norm(double *v, int n) { int i; double my_sum, norm_sqr; @@ -623,14 +623,14 @@ double FixQEq::parallel_norm( double *v, int n ) my_sum += v[i]*v[i]; } - MPI_Allreduce( &my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); - return sqrt( norm_sqr ); + return sqrt(norm_sqr); } /* ---------------------------------------------------------------------- */ -double FixQEq::parallel_dot( double *v1, double *v2, int n) +double FixQEq::parallel_dot(double *v1, double *v2, int n) { int i; double my_dot, res; @@ -648,14 +648,14 @@ double FixQEq::parallel_dot( double *v1, double *v2, int n) my_dot += v1[i] * v2[i]; } - MPI_Allreduce( &my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world); return res; } /* ---------------------------------------------------------------------- */ -double FixQEq::parallel_vector_acc( double *v, int n ) +double FixQEq::parallel_vector_acc(double *v, int n) { int i; double my_acc, res; @@ -673,15 +673,15 @@ double FixQEq::parallel_vector_acc( double *v, int n ) my_acc += v[i]; } - MPI_Allreduce( &my_acc, &res, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_acc, &res, 1, MPI_DOUBLE, MPI_SUM, world); return res; } /* ---------------------------------------------------------------------- */ -void FixQEq::vector_sum( double* dest, double c, double* v, - double d, double* y, int k ) +void FixQEq::vector_sum(double* dest, double c, double* v, + double d, double* y, int k) { int kk; int *ilist; @@ -697,7 +697,7 @@ void FixQEq::vector_sum( double* dest, double c, double* v, /* ---------------------------------------------------------------------- */ -void FixQEq::vector_add( double* dest, double c, double* v, int k ) +void FixQEq::vector_add(double* dest, double c, double* v, int k) { int kk; int *ilist; From ae570c05d836f683d80215e7068e786d7c914340 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:53:44 -0400 Subject: [PATCH 058/119] we don't need to hardcode pair styles to skip specific tests, but use YAML file for it --- unittest/force-styles/test_pair_style.cpp | 15 --------------- .../force-styles/tests/atomic-pair-colloid.yaml | 1 + .../tests/atomic-pair-colloid_multi.yaml | 1 + .../tests/atomic-pair-colloid_multi_tri.yaml | 1 + .../tests/atomic-pair-colloid_tiled.yaml | 1 + .../tests/atomic-pair-colloid_tiled_tri.yaml | 1 + unittest/force-styles/tests/atomic-pair-eam.yaml | 1 + .../force-styles/tests/atomic-pair-eam_alloy.yaml | 1 + .../tests/atomic-pair-eam_alloy_real.yaml | 1 + .../force-styles/tests/atomic-pair-eam_cd.yaml | 1 + .../tests/atomic-pair-eam_cd_old.yaml | 1 + .../tests/atomic-pair-eam_cd_real.yaml | 1 + .../force-styles/tests/atomic-pair-eam_fs.yaml | 1 + .../tests/atomic-pair-eam_fs_real.yaml | 1 + .../force-styles/tests/atomic-pair-eam_he.yaml | 1 + .../tests/atomic-pair-eam_he_real.yaml | 1 + .../force-styles/tests/atomic-pair-eam_real.yaml | 1 + .../tests/atomic-pair-hybrid-eam.yaml | 1 + .../tests/atomic-pair-hybrid-eam_fs.yaml | 1 + .../tests/atomic-pair-yukawa_colloid.yaml | 1 + unittest/force-styles/tests/mol-pair-dpd.yaml | 2 +- .../force-styles/tests/mol-pair-dpd_tstat.yaml | 2 +- 22 files changed, 21 insertions(+), 17 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 057f2b5352..999ac54e7b 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -1188,21 +1188,6 @@ TEST(PairStyle, single) GTEST_SKIP(); } - // The single function in EAM is different from what we assume - // here, therefore we have to skip testing those pair styles. - // Pair styles colloid and yukawa/colloid are also not compatible with this single tester - if ((test_config.pair_style.substr(0, 7) == "colloid") || - (test_config.pair_style.substr(0, 14) == "yukawa/colloid") || - (test_config.pair_style.substr(0, 3) == "dpd") || - (test_config.pair_style.substr(0, 3) == "eam") || - ((test_config.pair_style.substr(0, 6) == "hybrid") && - (test_config.pair_style.find("eam") != std::string::npos))) { - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - GTEST_SKIP(); - } - // now start over if (!verbose) ::testing::internal::CaptureStdout(); diff --git a/unittest/force-styles/tests/atomic-pair-colloid.yaml b/unittest/force-styles/tests/atomic-pair-colloid.yaml index 537ac447b5..b666021c91 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 +skip_tests: single prerequisites: ! | pair colloid pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml b/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml index 025a7faa05..d224977a3e 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 +skip_tests: single prerequisites: ! | pair colloid pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml b/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml index 9ead662a06..fa52a37ce7 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 +skip_tests: single prerequisites: ! | pair colloid pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml b/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml index be3ba744d0..62e85584e7 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 +skip_tests: single prerequisites: ! | pair colloid pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml b/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml index cd6c7595e8..b3f0b7a06d 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 +skip_tests: single prerequisites: ! | pair colloid pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam.yaml b/unittest/force-styles/tests/atomic-pair-eam.yaml index c606813d56..9c8c3ba8cd 100644 --- a/unittest/force-styles/tests/atomic-pair-eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 6e-12 +skip_tests: single prerequisites: ! | pair eam pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml b/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml index 072a0a97c0..5ec5bef372 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/alloy pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml index 033c341f08..bff08e048b 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 7.5e-12 +skip_tests: single prerequisites: ! | pair eam/alloy pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd.yaml index bda14a9e5a..915253dce7 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/cd pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml index 4f6891bae6..a7fa727b7f 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/cd/old pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml index e2ac5f0cae..abe25cff95 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/cd pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam_fs.yaml b/unittest/force-styles/tests/atomic-pair-eam_fs.yaml index 89ad740424..58c533d7ec 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_fs.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_fs.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:01 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/fs pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml index bf7f4f338b..f7739ee824 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:01 2021 epsilon: 7.5e-12 +skip_tests: single prerequisites: ! | pair eam/fs pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam_he.yaml b/unittest/force-styles/tests/atomic-pair-eam_he.yaml index 001301fe1a..f2bf098b2f 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_he.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_he.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:01 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/he pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml index 236b9538a7..b2b198486e 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:02 2021 epsilon: 7.5e-12 +skip_tests: single prerequisites: ! | pair eam/he pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-eam_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_real.yaml index 89e7c1ce0b..4d95f04edc 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_real.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:02 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml b/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml index a681657b65..11f226d493 100644 --- a/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:02 2021 epsilon: 1e-11 +skip_tests: single prerequisites: ! | pair eam/fs pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml b/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml index d2f511b3ea..ee63f01e63 100644 --- a/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml +++ b/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:03 2021 epsilon: 5e-12 +skip_tests: single prerequisites: ! | pair eam/fs pre_commands: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml index 1529cf51b9..008c4be01c 100644 --- a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml +++ b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-14 +skip_tests: single prerequisites: ! | atom sphere pair yukawa/colloid diff --git a/unittest/force-styles/tests/mol-pair-dpd.yaml b/unittest/force-styles/tests/mol-pair-dpd.yaml index 4964a74e2a..c3900a3bc6 100644 --- a/unittest/force-styles/tests/mol-pair-dpd.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 -skip_tests: gpu intel +skip_tests: gpu intel single prerequisites: ! | atom full pair dpd diff --git a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml index 0348c0d601..09d52366ba 100644 --- a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 -skip_tests: gpu intel +skip_tests: gpu intel single prerequisites: ! | atom full pair dpd/tstat From 678e243430a61d964757661b3dd0f34423daa3a9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:54:14 -0400 Subject: [PATCH 059/119] small update of unit test inputs --- .../tests/atomic-pair-reax_c.yaml | 277 +++++++++--------- .../tests/atomic-pair-reax_c_lgvdw.yaml | 275 ++++++++--------- .../tests/atomic-pair-reax_c_noqeq.yaml | 51 ++-- 3 files changed, 303 insertions(+), 300 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index a0dabff323..261812d56c 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,7 +1,8 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:24 202 -epsilon: 5e-11 +lammps_version: 8 Apr 2021 +date_generated: Mon Apr 19 09:21:15 2021 +epsilon: 1e-10 +skip_tests: prerequisites: ! | pair reax/c fix qeq/reax @@ -24,149 +25,149 @@ pre_commands: ! | set type 2 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-12 reax/c + fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c maxiter 20 nowarn input_file: in.empty pair_style: reax/c NULL checkqeq yes pair_coeff: ! | * * ffield.reax.mattsson C O extract: ! "" natoms: 64 -init_vdwl: -4208.20379453327 -init_coul: -268.025868109969 +init_vdwl: -4208.203794533267 +init_coul: -268.02765877429266 init_stress: ! |2- - 2.3677048490920824e+03 3.0802122558803894e+03 1.2727815110256352e+03 -1.5387991688244833e+03 -1.0906364142624241e+03 1.1229877249520346e+03 + 2.3677138597920134e+03 3.0801994317052795e+03 1.2727836669117719e+03 -1.5387982333122163e+03 -1.0906434577120353e+03 1.1229697394381967e+03 init_forces: ! |2 - 1 2.9634051452159092e+01 -5.6267761875030658e+02 -1.6668253255975264e+02 - 2 -1.5938437728854763e+02 -2.2076601831952277e+02 -1.7161994484506349e+02 - 3 -3.1194106231120934e+01 -3.0591930644164984e+02 4.4652570958886855e+01 - 4 4.4646653320086006e+02 1.7080811286682768e+02 1.7439026170464757e+02 - 5 -1.1512606621586120e+02 7.9716954463543715e+01 1.7959700550169842e+01 - 6 -7.1695199301551634e+02 4.0749156821010061e+01 2.1512037025864390e+02 - 7 2.3022543693157868e+02 -9.0170756873660693e+01 8.2190170006827103e+01 - 8 -2.1141251466323027e+01 -1.5635879347049067e+02 1.6101907187949953e+02 - 9 -1.2130842270575529e+02 -2.7960689135673749e+02 -1.9629114850260629e+02 - 10 -3.7631710890081683e+02 3.4103240548842098e+02 -1.8166279141141010e+02 - 11 -1.6154553323830120e+02 1.5743068117734555e+02 3.5832389058238908e+02 - 12 6.1602989065533677e+02 -1.4821564423137232e+02 1.0871005319359449e+02 - 13 -2.1366561068611992e+02 -3.0163595494862591e+02 5.2420406156009221e+02 - 14 2.5933950255870195e+02 -1.7967300062480934e+01 -2.7733367021033393e+02 - 15 1.7570537661851756e+02 1.7550639099552842e+02 -9.5789475936401502e+01 - 16 3.0588529285446674e+02 -4.7675556549182751e+01 -3.4330544488853229e+02 - 17 -1.5018545342641502e+02 1.3259542010622835e+02 2.3200545258695152e+02 - 18 1.6469564396901859e+02 -1.0816413254504512e+02 2.1207485840072781e+02 - 19 2.4759285902953567e+02 -4.8758383780475292e+01 -2.2494100786652814e+02 - 20 1.2418785577595527e+02 2.5137242577522335e+02 -1.5341186115707405e+01 - 21 -1.9556210564940739e+02 2.3152590535605817e+01 -1.2529729601983919e+02 - 22 2.4829386068621537e+02 -2.9828789153725000e+02 -4.0455445433034242e+01 - 23 8.2076007650246268e+01 1.3042103437660427e+02 1.5221389911908562e+02 - 24 -7.6912973583004117e+01 2.3539925428997182e+02 -1.7129603802759658e+02 - 25 -2.9782413878288601e+01 -1.8931910469290884e+02 6.7989202537834629e+01 - 26 -3.9488494691858733e+01 2.1025614474841166e+00 -2.0748963060927093e+02 - 27 -2.7704110443954568e+02 5.3736974078111837e+02 4.2318884882982655e+02 - 28 -2.9303219943086964e+02 -5.1154115419315801e+01 -2.3633993403319352e+02 - 29 1.2970484011863229e+02 -4.2266229540891523e+01 1.6350076615001245e+02 - 30 5.6925606430450244e+01 3.7880191852738363e+01 6.8636397133393515e+01 - 31 -1.9325596697344542e+02 -1.1645368911552394e+02 -2.0671692761029085e+01 - 32 1.2360965200003356e+02 -3.3253411369799544e+01 -1.0516118459008628e+02 - 33 6.5241847803264264e+01 3.7105112939426823e+02 6.0972558235487462e+01 - 34 -2.3124259597670152e+02 -1.1681740329837199e+02 -2.5838262648349195e+02 - 35 -4.1912226107435538e+02 7.9942920270919515e+01 3.1021023518178822e+02 - 36 -1.8561789047275289e+02 -1.1563628711158724e+02 -4.2360172436739234e+01 - 37 8.8271496723997984e+00 -3.5266450940740185e+02 -6.0505384072464253e+01 - 38 -1.9249505149150679e+01 1.1716319600328805e+02 -2.3477222840192979e+02 - 39 -1.0433878247256505e+01 -7.0902801856124668e+01 1.4264113912371403e+02 - 40 3.3265570779159901e+02 -8.8675933035708010e+02 1.6250845779831312e+01 - 41 -6.4537349815542413e+01 1.5189506353207591e+02 -1.8225353662815957e+02 - 42 2.3368723487133941e+01 1.1821526859991214e+02 4.1207323013177859e+02 - 43 -3.5145546474481449e+01 -3.6511647370571314e+00 2.4936793079195368e+02 - 44 -1.2881828259629406e+00 -2.4877240180809443e+02 7.9235766494652268e+01 - 45 2.0871504532583336e+02 -1.0817588901332421e+02 -4.1291808327418767e+02 - 46 -1.3837716960724282e+02 4.6114279241771982e+02 -2.4013801845132105e+02 - 47 1.3255320792807126e+02 2.8747276038957534e+02 -3.2896384987639095e+01 - 48 7.8145138718960652e+02 6.5215432481087248e+01 -6.2304789958695994e+02 - 49 2.4486314507349098e+02 1.9101300126648027e+01 3.7417037047533785e+02 - 50 2.9821275118609668e+02 3.0684252095011033e+02 5.6994896759607411e+02 - 51 -8.0052405736428466e+02 5.1024940640343124e+02 7.5829315450302556e+02 - 52 -9.2130898885920971e+01 1.1909837120722435e+02 -2.4118832391136704e+02 - 53 -3.6386926333492499e+02 -2.0729203700042348e+02 -3.4910517647674493e+02 - 54 -8.3399710534859324e+01 1.8942260327527066e+02 -1.2868598438441273e+02 - 55 -2.5305956575882524e+02 -1.1005916187119085e+02 -3.0893514828401271e+02 - 56 1.7364614503186098e+02 -2.5754370913466397e+02 -4.3744509948530059e+01 - 57 4.2667925201490533e+02 1.5529221173801471e+02 -3.9988499000695890e+02 - 58 -3.9656744140931579e+01 7.8953243693622596e+01 2.6135299122214326e+02 - 59 -2.7594240444747766e+02 1.9891763338576968e+02 2.4122500794444767e+02 - 60 -2.5675904361267118e+02 -1.1527171320999500e+02 9.9923550442604068e+01 - 61 3.0884427580032076e+02 4.9986415802554944e+02 -1.3369122169845875e+02 - 62 2.8530106503430972e+01 5.9540697567549117e-01 -2.7403025931165831e+02 - 63 2.5297054006405324e+02 -2.7640485799390927e+02 -1.9200503841891754e+02 - 64 -8.4680445259235810e+01 -1.5737027404334836e+02 1.5637808719891763e+02 -run_vdwl: -4208.20960310156 -run_coul: -268.025834774416 + 1 2.9633286152714895e+01 -5.6268158870662865e+02 -1.6667929778658686e+02 + 2 -1.5938461587386283e+02 -2.2076632409584278e+02 -1.7162405040710766e+02 + 3 -3.1194767737908826e+01 -3.0592472349600524e+02 4.4651629891466243e+01 + 4 4.4646596256626185e+02 1.7080830170172359e+02 1.7439025633170678e+02 + 5 -1.1512522479897345e+02 7.9717596119857888e+01 1.7958911311542607e+01 + 6 -7.1695066631618761e+02 4.0748756065642638e+01 2.1511809762804484e+02 + 7 2.3022206076223796e+02 -9.0168647609670387e+01 8.2189129278766103e+01 + 8 -2.1137097290905352e+01 -1.5635843951502784e+02 1.6101855425514745e+02 + 9 -1.2130643966073812e+02 -2.7960290186509405e+02 -1.9629224425201704e+02 + 10 -3.7631894872912522e+02 3.4103357651251537e+02 -1.8166645213907478e+02 + 11 -1.6153902964754667e+02 1.5743241425267431e+02 3.5832306945377178e+02 + 12 6.1603732792700282e+02 -1.4821040465468917e+02 1.0870676706201488e+02 + 13 -2.1366851202213653e+02 -3.0163954126350092e+02 5.2420915627618558e+02 + 14 2.5933780612532126e+02 -1.7968461610614241e+01 -2.7733218830598901e+02 + 15 1.7570487907901011e+02 1.7550789799326304e+02 -9.5786451085155491e+01 + 16 3.0589204520776934e+02 -4.7676020729815768e+01 -3.4330483431656791e+02 + 17 -1.5018690887845338e+02 1.3259473313627657e+02 2.3200552664411475e+02 + 18 1.6469519167779183e+02 -1.0816250655621064e+02 2.1207543727392661e+02 + 19 2.4759344887399081e+02 -4.8758511247092088e+01 -2.2494130722447932e+02 + 20 1.2418791307460424e+02 2.5137179718270556e+02 -1.5340308025983461e+01 + 21 -1.9556242958992678e+02 2.3151160715888874e+01 -1.2529867634994399e+02 + 22 2.4829292770827422e+02 -2.9828612004289113e+02 -4.0454677881884024e+01 + 23 8.2077976837017900e+01 1.3041866298293627e+02 1.5221209316034532e+02 + 24 -7.6913783243387826e+01 2.3540203354364189e+02 -1.7129245933770727e+02 + 25 -2.9781744550605662e+01 -1.8931888070263267e+02 6.7990019857554202e+01 + 26 -3.9488424247767014e+01 2.0999360632613091e+00 -2.0748830164832864e+02 + 27 -2.7704383990910344e+02 5.3737323080507701e+02 4.2318830552299499e+02 + 28 -2.9302153625490882e+02 -5.1150243581343020e+01 -2.3633573764669612e+02 + 29 1.2970603958450926e+02 -4.2262332230398229e+01 1.6349790455526482e+02 + 30 5.6924470622841902e+01 3.7878571490062619e+01 6.8637961971110911e+01 + 31 -1.9325586894804644e+02 -1.1645468493273863e+02 -2.0673145110109189e+01 + 32 1.2359537270071175e+02 -3.3261682729471509e+01 -1.0517081413370242e+02 + 33 6.5244494839342053e+01 3.7105575675452133e+02 6.0972008518320628e+01 + 34 -2.3124412393972406e+02 -1.1681894708374426e+02 -2.5838515661900914e+02 + 35 -4.1912097866037749e+02 7.9940298322579153e+01 3.1020906752098472e+02 + 36 -1.8561756690805518e+02 -1.1563749469376307e+02 -4.2356131544286932e+01 + 37 8.8268459557867800e+00 -3.5266202517998272e+02 -6.0508589419221380e+01 + 38 -1.9251065954670622e+01 1.1716443799821707e+02 -2.3476787650314483e+02 + 39 -1.0434207876793304e+01 -7.0902825597879200e+01 1.4264102290267166e+02 + 40 3.3265415672808695e+02 -8.8676314506220365e+02 1.6250323289221797e+01 + 41 -6.4525340969477625e+01 1.5190482993381195e+02 -1.8226363836162227e+02 + 42 2.3374265976474046e+01 1.1820849928255014e+02 4.1205919897871769e+02 + 43 -3.5145427442179937e+01 -3.6494054739761985e+00 2.4936139875273903e+02 + 44 -1.2909580317707088e+00 -2.4878033872407525e+02 7.9235212511230884e+01 + 45 2.0871432412721612e+02 -1.0816380085646371e+02 -4.1290534066227440e+02 + 46 -1.3837993836409981e+02 4.6113983127416537e+02 -2.4014147975943226e+02 + 47 1.3255343208840517e+02 2.8747648851097466e+02 -3.2895641248751062e+01 + 48 7.8145151343613895e+02 6.5212246673697649e+01 -6.2304415905848475e+02 + 49 2.4486207561858652e+02 1.9098760054137188e+01 3.7416718126982084e+02 + 50 2.9821250019803648e+02 3.0684285856103526e+02 5.6995325423529778e+02 + 51 -8.0052512629134719e+02 5.1024666433916468e+02 7.5828839863942687e+02 + 52 -9.2132795322260193e+01 1.1909938868988401e+02 -2.4119177446813089e+02 + 53 -3.6386508146804226e+02 -2.0728774423637225e+02 -3.4909372895932455e+02 + 54 -8.3400478462696412e+01 1.8942847373883873e+02 -1.2868846530013360e+02 + 55 -2.5306030895087017e+02 -1.1005903030773361e+02 -3.0893490115268742e+02 + 56 1.7363066404655606e+02 -2.5755159082633384e+02 -4.3732393367297526e+01 + 57 4.2667868235664599e+02 1.5529168633998034e+02 -3.9988358463751354e+02 + 58 -3.9654228870269598e+01 7.8950867015507271e+01 2.6135841350205141e+02 + 59 -2.7594567334153987e+02 1.9892282891821415e+02 2.4123100379637927e+02 + 60 -2.5675971154579702e+02 -1.1527142348407712e+02 9.9923841074681320e+01 + 61 3.0884909844566982e+02 4.9986511818576071e+02 -1.3369330200973721e+02 + 62 2.8529506416321446e+01 5.9000054110319344e-01 -2.7402724976042202e+02 + 63 2.5296716267913251e+02 -2.7640609445310349e+02 -1.9200849927940413e+02 + 64 -8.4682581712903087e+01 -1.5737182215029318e+02 1.5637971229670848e+02 +run_vdwl: -4208.209603101568 +run_coul: -268.02581602182215 run_stress: ! |2- - 2.3675903993358406e+03 3.0802227297812642e+03 1.2727311522665882e+03 -1.5388669378280856e+03 -1.0907269208274088e+03 1.1229243202747448e+03 + 2.3675915915115038e+03 3.0802240114846613e+03 1.2727324747502155e+03 -1.5388667254325053e+03 -1.0907269430167464e+03 1.1229240366702902e+03 run_forces: ! |2 - 1 2.9635294281436092e+01 -5.6267712552700186e+02 -1.6667999923843206e+02 - 2 -1.5938673400140527e+02 -2.2076536449677653e+02 -1.7162354129440891e+02 - 3 -3.1189858281210785e+01 -3.0593580065887033e+02 4.4645958607345577e+01 - 4 4.4646581891377559e+02 1.7080959763779822e+02 1.7439093938229493e+02 - 5 -1.1512839796352765e+02 7.9717058687958001e+01 1.7957487669481100e+01 - 6 -7.1695602565953550e+02 4.0752829698478386e+01 2.1512533839223761e+02 - 7 2.3022644486507866e+02 -9.0168915600464501e+01 8.2194655874286369e+01 - 8 -2.1149264848910175e+01 -1.5637111051646082e+02 1.6102981315503155e+02 - 9 -1.2130987756625950e+02 -2.7961363383960696e+02 -1.9628960069621482e+02 - 10 -3.7631817089739258e+02 3.4103259385919483e+02 -1.8166532788364435e+02 - 11 -1.6154687915100456e+02 1.5742797820605873e+02 3.5832199951133140e+02 - 12 6.1603841944552107e+02 -1.4820397700260011e+02 1.0871524086045234e+02 - 13 -2.1367529106982624e+02 -3.0167446795645282e+02 5.2424091634214585e+02 - 14 2.5933827511245227e+02 -1.7968203382107991e+01 -2.7733114072560983e+02 - 15 1.7570793004227912e+02 1.7551005525189765e+02 -9.5784231788957229e+01 - 16 3.0586985592964720e+02 -4.7679566106090903e+01 -3.4332192731516005e+02 - 17 -1.5018636472319054e+02 1.3259146324636768e+02 2.3200578297682745e+02 - 18 1.6469881174797919e+02 -1.0816836176970681e+02 2.1207670716671672e+02 - 19 2.4759420520521982e+02 -4.8758383157848726e+01 -2.2494116682891169e+02 - 20 1.2419960666459312e+02 2.5137933265677643e+02 -1.5328241144786812e+01 - 21 -1.9556094492813440e+02 2.3151723981859487e+01 -1.2529581330695682e+02 - 22 2.4829941584472434e+02 -2.9829345245026002e+02 -4.0446702084680311e+01 - 23 8.2074458696897636e+01 1.3042100306278206e+02 1.5221371881645402e+02 - 24 -7.6917668833393961e+01 2.3540360228741474e+02 -1.7130192995348895e+02 - 25 -2.9742104523748988e+01 -1.8935699467866542e+02 6.7995874219778344e+01 - 26 -3.9494943772414118e+01 2.1074054700131106e+00 -2.0748981609909322e+02 - 27 -2.7704003655188802e+02 5.3736954143358219e+02 4.2318574013795291e+02 - 28 -2.9302855291141344e+02 -5.1149666119061756e+01 -2.3633679976969094e+02 - 29 1.2970505460316522e+02 -4.2266433901186595e+01 1.6349685185829642e+02 - 30 5.6925896868100061e+01 3.7880918758124416e+01 6.8637128510118643e+01 - 31 -1.9325534294267334e+02 -1.1645328076630720e+02 -2.0671892621504433e+01 - 32 1.2360198063047470e+02 -3.3253019999994883e+01 -1.0516936549572080e+02 - 33 6.5239383936127538e+01 3.7104662858441014e+02 6.0974455303813109e+01 - 34 -2.3124084085048867e+02 -1.1681523003062699e+02 -2.5837805461659735e+02 - 35 -4.1912113383003572e+02 7.9943750613190943e+01 3.1020725803699969e+02 - 36 -1.8561422052416717e+02 -1.1563434085907485e+02 -4.2360108129760114e+01 - 37 8.8275421439853545e+00 -3.5266971563414063e+02 -6.0507541452884695e+01 - 38 -1.9245036832008864e+01 1.1717726898956253e+02 -2.3478417248390394e+02 - 39 -1.0434224692455489e+01 -7.0902644440221152e+01 1.4263978421851866e+02 - 40 3.3271177801104579e+02 -8.8679293552758975e+02 1.6219742097522396e+01 - 41 -6.4538764985979284e+01 1.5189397693612446e+02 -1.8225441696827028e+02 - 42 2.3368235855950271e+01 1.1822246665265955e+02 4.1207745038608465e+02 - 43 -3.5145643416957128e+01 -3.6517162539675607e+00 2.4936784353003958e+02 - 44 -1.2879745401173426e+00 -2.4877345145177651e+02 7.9236449970532846e+01 - 45 2.0871643412343590e+02 -1.0817571271652029e+02 -4.1291831345583290e+02 - 46 -1.3836372705500636e+02 4.6117938292216792e+02 -2.4016736526257426e+02 - 47 1.3255125611053478e+02 2.8747591615862939e+02 -3.2895660248580036e+01 - 48 7.8145417759941688e+02 6.5214930060474302e+01 -6.2304930828901490e+02 - 49 2.4488281403350587e+02 1.9105496615734893e+01 3.7418605144315814e+02 - 50 2.9822129513623162e+02 3.0683153982649424e+02 5.6994490418787450e+02 - 51 -8.0058572063723739e+02 5.1028617285810617e+02 7.5832431569053767e+02 - 52 -9.2137024513584748e+01 1.1910687193191870e+02 -2.4119120858089093e+02 - 53 -3.6387082584370717e+02 -2.0729771077034724e+02 -3.4910499737703145e+02 - 54 -8.3401322475858819e+01 1.8942466656608883e+02 -1.2869045777950635e+02 - 55 -2.5309678413623661e+02 -1.1001947899860551e+02 -3.0896372370111590e+02 - 56 1.7364604573970860e+02 -2.5754429115057047e+02 -4.3743962049926409e+01 - 57 4.2666362581830975e+02 1.5528157995548534e+02 -3.9988032807883297e+02 - 58 -3.9656744873436978e+01 7.8953170998895359e+01 2.6135222052438655e+02 - 59 -2.7594581611220792e+02 1.9891770704106938e+02 2.4122933700028292e+02 - 60 -2.5675992319674720e+02 -1.1527235824442458e+02 9.9923831048598458e+01 - 61 3.0884428120727830e+02 4.9986711220603212e+02 -1.3369013376809971e+02 - 62 2.8530678742782751e+01 5.9283151666778267e-01 -2.7403002505086550e+02 - 63 2.5296775626792288e+02 -2.7640525289650611e+02 -1.9200401038421046e+02 - 64 -8.4674586435418931e+01 -1.5736397776818120e+02 1.5637348700606000e+02 + 1 2.9635340083051346e+01 -5.6267710249795869e+02 -1.6667998370665143e+02 + 2 -1.5938666826920343e+02 -2.2076534189863366e+02 -1.7162354109212984e+02 + 3 -3.1189870810301095e+01 -3.0593571985047180e+02 4.4645956923836664e+01 + 4 4.4646581130069950e+02 1.7080959759402148e+02 1.7439093558473147e+02 + 5 -1.1512840430317976e+02 7.9717053594844629e+01 1.7957493384932661e+01 + 6 -7.1695600898242708e+02 4.0752809200821034e+01 2.1512530796739239e+02 + 7 2.3022648522685608e+02 -9.0168938352327743e+01 8.2194670669568964e+01 + 8 -2.1149215429861702e+01 -1.5637110513857075e+02 1.6102981761092099e+02 + 9 -1.2130987184908217e+02 -2.7961359052794438e+02 -1.9628960657192528e+02 + 10 -3.7631820453396847e+02 3.4103263667614613e+02 -1.8166531833456517e+02 + 11 -1.6154688755051467e+02 1.5742797323066301e+02 3.5832199781281412e+02 + 12 6.1603846554302856e+02 -1.4820394873283382e+02 1.0871523277525925e+02 + 13 -2.1367534498311514e+02 -3.0167456097439617e+02 5.2424088341628442e+02 + 14 2.5933832701218608e+02 -1.7968192701718916e+01 -2.7733108167843062e+02 + 15 1.7570795092251277e+02 1.7551000310384359e+02 -9.5784222372814824e+01 + 16 3.0586981469801617e+02 -4.7679565967035259e+01 -3.4332195262424483e+02 + 17 -1.5018632687377072e+02 1.3259144780414934e+02 2.3200578527117301e+02 + 18 1.6469880313326215e+02 -1.0816831870102239e+02 2.1207667736516382e+02 + 19 2.4759420024003853e+02 -4.8758379338079727e+01 -2.2494116275048481e+02 + 20 1.2419960129665635e+02 2.5137932270320678e+02 -1.5328240053348356e+01 + 21 -1.9556094383241299e+02 2.3151696381601958e+01 -1.2529580363737537e+02 + 22 2.4829940463520313e+02 -2.9829343297891006e+02 -4.0446694405761576e+01 + 23 8.2074486469597687e+01 1.3042095796913281e+02 1.5221366791874641e+02 + 24 -7.6917692833702446e+01 2.3540351711765027e+02 -1.7130196247252570e+02 + 25 -2.9742100996765380e+01 -1.8935699491160051e+02 6.7995875362048835e+01 + 26 -3.9494945036515908e+01 2.1074087479630634e+00 -2.0748976668424677e+02 + 27 -2.7704005979662662e+02 5.3736953816242783e+02 4.2318569074160462e+02 + 28 -2.9302860300138957e+02 -5.1149672303866737e+01 -2.3633681317128332e+02 + 29 1.2970506005124116e+02 -4.2266505241952196e+01 1.6349682642247129e+02 + 30 5.6925895652797955e+01 3.7880903611520054e+01 6.8637138210808786e+01 + 31 -1.9325535402701956e+02 -1.1645328207806656e+02 -2.0671892295502396e+01 + 32 1.2360206049549920e+02 -3.3252985301196659e+01 -1.0516931870918121e+02 + 33 6.5239430456833531e+01 3.7104671672305966e+02 6.0974424435615809e+01 + 34 -2.3124086955801889e+02 -1.1681533354856286e+02 -2.5837807428177962e+02 + 35 -4.1912107298361212e+02 7.9943751193797880e+01 3.1020726776656619e+02 + 36 -1.8561413355995509e+02 -1.1563427104741439e+02 -4.2360264054660597e+01 + 37 8.8273599678770864e+00 -3.5266981598144150e+02 -6.0507477320620680e+01 + 38 -1.9245038012709841e+01 1.1717725521030376e+02 -2.3478404802363110e+02 + 39 -1.0434215698836438e+01 -7.0902647384814358e+01 1.4263978849003041e+02 + 40 3.3271178359289979e+02 -8.8679283858336646e+02 1.6219768658650871e+01 + 41 -6.4538810609188275e+01 1.5189398379892381e+02 -1.8225442798722727e+02 + 42 2.3368203862303545e+01 1.1822249156204117e+02 4.1207761014771074e+02 + 43 -3.5145614670828280e+01 -3.6517750326814120e+00 2.4936780076604907e+02 + 44 -1.2879422574017376e+00 -2.4877334082189225e+02 7.9236450933542571e+01 + 45 2.0871640299070592e+02 -1.0817582150128533e+02 -4.1291845938329635e+02 + 46 -1.3836372708562709e+02 4.6117937798867194e+02 -2.4016736146584793e+02 + 47 1.3255127160214204e+02 2.8747595545221196e+02 -3.2895652028052091e+01 + 48 7.8145389054767179e+02 6.5214945379088277e+01 -6.2304920777042912e+02 + 49 2.4488291106236500e+02 1.9105409364926288e+01 3.7418589758696908e+02 + 50 2.9822130989912665e+02 3.0683153011979800e+02 5.6994487035095165e+02 + 51 -8.0058521183025380e+02 5.1028581602653651e+02 7.5832461768047244e+02 + 52 -9.2137019037691147e+01 1.1910697318842861e+02 -2.4119128768698766e+02 + 53 -3.6387123110982282e+02 -2.0729720964342076e+02 -3.4910519380830556e+02 + 54 -8.3401332800193543e+01 1.8942464275359734e+02 -1.2869043354758486e+02 + 55 -2.5309678157873975e+02 -1.1001947468656527e+02 -3.0896372177857239e+02 + 56 1.7364608133921760e+02 -2.5754423801373565e+02 -4.3743927978158730e+01 + 57 4.2666357128098645e+02 1.5528157162856127e+02 -3.9988029715399989e+02 + 58 -3.9656756118817448e+01 7.8953165237690285e+01 2.6135222125861111e+02 + 59 -2.7594578242635424e+02 1.9891765773401318e+02 2.4122928728349606e+02 + 60 -2.5675991915252069e+02 -1.1527235180653685e+02 9.9923833769027368e+01 + 61 3.0884427542809721e+02 4.9986710924069786e+02 -1.3369013404232507e+02 + 62 2.8530654477154116e+01 5.9282210053495610e-01 -2.7403003802560033e+02 + 63 2.5296776535482985e+02 -2.7640523185325759e+02 -1.9200396674401188e+02 + 64 -8.4674657022429557e+01 -1.5736405319931387e+02 1.5637353707611086e+02 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index 567bddf5ce..b24f60dc62 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -1,7 +1,8 @@ --- -lammps_version: 10 Feb 2021 -date_generated: Fri Feb 26 23:09:06 2021 +lammps_version: 8 Apr 2021 +date_generated: Mon Apr 19 09:21:17 2021 epsilon: 2e-10 +skip_tests: prerequisites: ! | pair reax/c fix qeq/reax @@ -24,149 +25,149 @@ pre_commands: ! | set type 2 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-12 reax/c + fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c maxiter 20 nowarn input_file: in.empty pair_style: reax/c NULL checkqeq yes lgvdw yes safezone 1.6 pair_coeff: ! | * * ffield.reax.lg C O extract: ! "" natoms: 64 -init_vdwl: -3780.05455778888 -init_coul: -279.915673357255 +init_vdwl: -3780.0545577888824 +init_coul: -279.9157988760615 init_stress: ! |2- - 3.6448951295886809e+03 3.7339747706707872e+03 3.9381618834038791e+03 -8.8619786783545931e+02 2.5350870087071300e+02 -5.2815321737906061e+02 + 3.6448931383720665e+03 3.7339659142876435e+03 3.9381659849081570e+03 -8.8620105504582875e+02 2.5350490498306664e+02 -5.2816569317142807e+02 init_forces: ! |2 - 1 -1.4572029645683264e+02 -2.2140279106291507e+02 -1.4808209307797372e+02 - 2 -1.7648559093934148e+02 -1.0146253457806542e+02 -1.7990394625657274e+01 - 3 -2.0615681734642330e+01 -4.0343795757803508e+02 -3.8603528931018054e+01 - 4 2.6614805335034998e+02 4.0003808276416684e+01 1.4690013778960667e+02 - 5 9.7835379063416177e+00 4.3883349405662791e+01 4.9796878717762787e+01 - 6 -2.6938292077229727e+02 3.3510334278335421e+00 2.2965715764113384e+02 - 7 3.2574907048037380e+02 -1.7976941537341810e+02 2.2179461677416583e+02 - 8 9.9964451146865471e+01 -2.8685082304987185e+02 1.4158552983794476e+02 - 9 1.6434754325282601e+01 -1.9355787416131696e+02 -9.4334270045756043e+01 - 10 -2.0854046881408067e+02 1.0026332198593936e+02 -1.5021108992594620e+02 - 11 -2.0573869228583661e+02 2.7604115414799344e+02 5.5777178022191936e+02 - 12 5.0287983468578147e+02 -6.0967301596834591e+02 3.9376960681073700e+02 - 13 -9.1248851272055674e+01 3.5482322889104140e+01 7.9771590707710800e+01 - 14 1.1722782444599024e+02 7.0786340536242163e+00 -1.1012937857655862e+02 - 15 2.0459798791677210e+02 1.1350278391711655e+01 -6.9643830810411416e+01 - 16 6.4801734481789666e+01 2.7717249468796996e+02 9.6968479199374073e+01 - 17 -1.1757359629210440e+02 7.5596700050451688e+01 8.2370289516995197e+00 - 18 1.4980090631536169e+02 4.6438235985629220e+01 1.9074239639237979e+02 - 19 9.9231823331994249e+01 -3.4161546701845765e+01 -9.3483634123621087e+01 - 20 3.4394881232874110e+02 1.8755825664166662e+02 1.8392127409682581e+02 - 21 -1.7639610172391272e+02 5.9887963695524753e+01 2.3192666899298981e+01 - 22 3.5943370198457734e+02 -4.9707358210204012e+02 2.0606470760846634e+02 - 23 1.7581454592506283e+01 2.1298589011272401e+02 1.9485076353331874e+02 - 24 -1.8644255768132263e+02 2.0152190140053236e+02 -1.5033309490489984e+02 - 25 6.6423577752363499e+01 -2.6628307450649118e+02 6.5041785228006987e+01 - 26 -2.9537785779457244e+02 1.8889631581804576e+02 8.6386764001190215e+01 - 27 1.0405918844455742e+02 -2.5941844595001200e+00 -6.3479328226780297e+01 - 28 -1.7940076477784703e+02 -1.9073773001560042e+02 -1.6921173789426470e+02 - 29 2.8517719341938289e+02 -9.8606325860704928e+01 -1.5865623093424992e+02 - 30 3.3012242903480393e-01 9.9396498728799443e+01 3.2850839694515677e+00 - 31 -1.8086381055199379e+00 -5.1096382098849077e+01 6.0017778789149006e+00 - 32 3.1529080422017097e+02 -1.2793618573898891e+02 -2.4176655958597905e+02 - 33 -5.4059845316529982e+00 1.7567793716993873e+02 -1.1807703472018468e+02 - 34 -1.9400422792080016e+02 -1.0951834015498645e+02 -1.5439493063315896e+02 - 35 -1.9195028872533084e+02 -1.2771069506738369e+01 1.3164511899864968e+02 - 36 2.1450496684040476e+02 4.8524211958783019e+02 -2.2938069671779124e+02 - 37 -3.3553470604466861e+02 -4.9645835564195778e+02 2.1990191695195585e+02 - 38 -3.2544634716452649e+01 2.4953051954442103e+01 -1.5693055302887637e+02 - 39 -1.5399380031833186e+01 2.3903552655945369e+01 9.6153869485537527e+01 - 40 -6.4358524883048119e+01 1.7841114478565163e+02 1.6199309566416363e+02 - 41 -2.4659875162869224e+02 2.3085714222291421e+02 -2.9640003056844074e+02 - 42 -2.9451816756430145e+02 4.3373137951523881e+02 4.3706447002809585e+02 - 43 1.3265813359025546e+02 -2.9267792386382844e+01 2.3063687596593061e+02 - 44 1.0054916914535585e+02 -2.0011423542533092e+02 1.1673423852526635e+02 - 45 1.5191419311763582e+02 -3.3909681846522182e+02 -6.8137727102148324e+02 - 46 -3.6974683734054048e+02 6.5878375129662163e+02 -1.2846618277461354e+02 - 47 7.0999436005486899e+01 2.6787204282530024e+02 -2.6037631699380153e+01 - 48 4.8459114652542161e+02 -1.6692984322713417e+02 -3.2654222496284581e+02 - 49 1.0015069521843192e+02 1.7138648274496632e+01 1.2769578723947120e+02 - 50 -2.5642349862470508e+02 4.8550182268850142e+02 1.7833824453195746e+02 - 51 1.5929454215699664e+03 -1.5099874513231559e+03 1.3757379604584460e+03 - 52 -3.9361841716365302e+02 2.9260629050190221e+02 -2.7081695001177656e+02 - 53 -1.2156822810124922e+03 1.0481194207223216e+03 -1.7260439380729260e+03 - 54 5.4550048561223889e+01 1.0309107570306772e+02 -6.1755737140629734e+01 - 55 -2.0237966584139775e+02 1.8109638545320627e+02 -4.9049185930881845e+02 - 56 2.0035852288703015e+02 -1.8905601495144680e+02 -1.3674988378339864e+02 - 57 -1.7850181832398803e+02 -3.3738128559238868e+02 -1.4864548151794997e+02 - 58 -2.5672973403862750e+02 -1.3337752501158548e+02 8.4361840521538781e+01 - 59 -1.7898419258529674e+02 1.8142061294130923e+02 2.7914590931082478e+02 - 60 -7.4397281468755821e+01 -6.8191313100547362e+01 5.7945873657168903e+01 - 61 9.6097455977519928e+01 4.4560160451051973e+02 5.3539867605744419e+01 - 62 3.3100209418397625e+01 1.3292271559420541e+02 -3.6118667405609742e+01 - 63 -2.5659895412732226e+01 -3.1619326785330378e+02 5.0013180663156710e+01 - 64 2.5886074093968855e+01 -6.0852122206871925e+01 7.5059691631914314e+00 -run_vdwl: -3780.05347390992 -run_coul: -279.915602843914 + 1 -1.4572091886023205e+02 -2.2140554853210335e+02 -1.4808089621820409e+02 + 2 -1.7648676367493852e+02 -1.0146318760917033e+02 -1.7992199180511228e+01 + 3 -2.0615863857279255e+01 -4.0344141093113177e+02 -3.8603948937580682e+01 + 4 2.6614837240037974e+02 4.0003929778899199e+01 1.4690018353209234e+02 + 5 9.7844364238111634e+00 4.3884264292874640e+01 4.9796276452188778e+01 + 6 -2.6938167754794108e+02 3.3502567046531411e+00 2.2965489848185831e+02 + 7 3.2574749906033628e+02 -1.7976901688562575e+02 2.2179384812686754e+02 + 8 9.9963664597069211e+01 -2.8685055064461562e+02 1.4158554323500957e+02 + 9 1.6434737377652411e+01 -1.9355784885649135e+02 -9.4333988453824674e+01 + 10 -2.0854160335689650e+02 1.0026489817881713e+02 -1.5021072248976765e+02 + 11 -2.0573434026899415e+02 2.7604212909913434e+02 5.5777133973549599e+02 + 12 5.0288346447168902e+02 -6.0966999599334633e+02 3.9376794144396729e+02 + 13 -9.1250837980014055e+01 3.5479126438212312e+01 7.9772485712987830e+01 + 14 1.1722657768580721e+02 7.0781215767454047e+00 -1.1012920740892103e+02 + 15 2.0459752525877119e+02 1.1351310328466946e+01 -6.9642718405081723e+01 + 16 6.4806165788586554e+01 2.7717257212730721e+02 9.6969385115315887e+01 + 17 -1.1757474559792530e+02 7.5596314208592773e+01 8.2371686135118694e+00 + 18 1.4980035999104621e+02 4.6438099206051213e+01 1.9074297138984858e+02 + 19 9.9234004591160854e+01 -3.4162209353811022e+01 -9.3484579137358054e+01 + 20 3.4394959503379101e+02 1.8755989482421211e+02 1.8392094734100132e+02 + 21 -1.7639663517067046e+02 5.9886792943355104e+01 2.3192630518286926e+01 + 22 3.5943350303372904e+02 -4.9707299042671059e+02 2.0606498955302629e+02 + 23 1.7582092751419758e+01 2.1298501938255976e+02 1.9485029772476997e+02 + 24 -1.8644089886656593e+02 2.0152439860030270e+02 -1.5033144599992980e+02 + 25 6.6423833906552588e+01 -2.6628287125895685e+02 6.5042482646519929e+01 + 26 -2.9537910718596163e+02 1.8889491141232935e+02 8.6384752113539022e+01 + 27 1.0405788965828641e+02 -2.5925449178566540e+00 -6.3480098517547759e+01 + 28 -1.7939608695369640e+02 -1.9073765779235862e+02 -1.6920914616960835e+02 + 29 2.8517744376210021e+02 -9.8603006038058396e+01 -1.5865567773918144e+02 + 30 3.2949780945743384e-01 9.9395901723688951e+01 3.2867025811830066e+00 + 31 -1.8081982094889877e+00 -5.1095979886608603e+01 6.0017226789971536e+00 + 32 3.1528485795048732e+02 -1.2793879136489154e+02 -2.4176923563635890e+02 + 33 -5.4047496313993761e+00 1.7567978501697323e+02 -1.1807749995154678e+02 + 34 -1.9400365443632006e+02 -1.0951910631961994e+02 -1.5439514659643123e+02 + 35 -1.9195164058841638e+02 -1.2771663795724534e+01 1.3164519528710119e+02 + 36 2.1450335760238607e+02 4.8524149100278362e+02 -2.2937661241075210e+02 + 37 -3.3553202602756068e+02 -4.9645660169968471e+02 2.1989946614447041e+02 + 38 -3.2545637693167187e+01 2.4953724757619213e+01 -1.5692994894863165e+02 + 39 -1.5399133308638410e+01 2.3903543199312750e+01 9.6153912587959454e+01 + 40 -6.4359455436231784e+01 1.7840898418733599e+02 1.6199268811537300e+02 + 41 -2.4659695132042634e+02 2.3085908053073328e+02 -2.9640112753929327e+02 + 42 -2.9451821900140999e+02 4.3373059300879572e+02 4.3706356205288336e+02 + 43 1.3266010178695632e+02 -2.9267135032181088e+01 2.3063316835486089e+02 + 44 1.0054895163178887e+02 -2.0011754287270674e+02 1.1673372624795425e+02 + 45 1.5191525332856557e+02 -3.3909441520578207e+02 -6.8137683597574699e+02 + 46 -3.6974751746664356e+02 6.5878294118257850e+02 -1.2846738301725193e+02 + 47 7.0999626065694201e+01 2.6787348460906964e+02 -2.6037187103136354e+01 + 48 4.8458888753820582e+02 -1.6692979718938696e+02 -3.2654041125642522e+02 + 49 1.0015039714682548e+02 1.7137645197720190e+01 1.2769396347000726e+02 + 50 -2.5642342676546355e+02 4.8550218436953134e+02 1.7834042598268297e+02 + 51 1.5929472695008881e+03 -1.5099908240612401e+03 1.3757388145073317e+03 + 52 -3.9361969825076892e+02 2.9260735969130604e+02 -2.7081798065168311e+02 + 53 -1.2156829912640842e+03 1.0481229021396230e+03 -1.7260431178358995e+03 + 54 5.4550088623147516e+01 1.0309452579709432e+02 -6.1757701222598442e+01 + 55 -2.0238006702340041e+02 1.8109613688188938e+02 -4.9049119362596980e+02 + 56 2.0035548328443991e+02 -1.8905716639832801e+02 -1.3674890405161500e+02 + 57 -1.7850234090472205e+02 -3.3738119605793531e+02 -1.4864438401289951e+02 + 58 -2.5672838772121492e+02 -1.3337878903216912e+02 8.4365052514154812e+01 + 59 -1.7898423879701210e+02 1.8142157612585032e+02 2.7914729458451137e+02 + 60 -7.4397164149646969e+01 -6.8190924044876084e+01 5.7945904025898891e+01 + 61 9.6099033708008989e+01 4.4560187645463765e+02 5.3539291937468079e+01 + 62 3.3097868057397406e+01 1.3291944752881338e+02 -3.6118812725322506e+01 + 63 -2.5661745572767739e+01 -3.1619354530304156e+02 5.0012317415788416e+01 + 64 2.5884883063459124e+01 -6.0852905003457536e+01 7.5067609941699116e+00 +run_vdwl: -3780.0534739099153 +run_coul: -279.9156023968299 run_stress: ! |2- - 3.6449190860682643e+03 3.7339547135739058e+03 3.9381731084171565e+03 -8.8617648240339543e+02 2.5350122212091981e+02 -5.2818520710537973e+02 + 3.6449193028377299e+03 3.7339549167173282e+03 3.9381733557741995e+03 -8.8617642091921402e+02 2.5350119722836649e+02 -5.2818522888411621e+02 run_forces: ! |2 - 1 -1.4571798162167252e+02 -2.2140580848061688e+02 -1.4808148933254313e+02 - 2 -1.7648308397779235e+02 -1.0146477741996672e+02 -1.7988558948131221e+01 - 3 -2.0614227228633823e+01 -4.0344097417855238e+02 -3.8604729133131215e+01 - 4 2.6614888483484418e+02 4.0003234613562718e+01 1.4690057491500562e+02 - 5 9.7845353993210757e+00 4.3882567909729040e+01 4.9797207642045677e+01 - 6 -2.6938082734775594e+02 3.3524823444182630e+00 2.2965816523899235e+02 - 7 3.2575187542507791e+02 -1.7977227944937169e+02 2.2179960580675152e+02 - 8 9.9964011515726739e+01 -2.8685358089601482e+02 1.4158731106157231e+02 - 9 1.6438524923736644e+01 -1.9355302991489253e+02 -9.4334960672514242e+01 - 10 -2.0853805940018381e+02 1.0026019274304203e+02 -1.5021521543813694e+02 - 11 -2.0574133907407125e+02 2.7604371539616938e+02 5.5777225388303532e+02 - 12 5.0285711778760270e+02 -6.0968357929450372e+02 3.9377681166481295e+02 - 13 -9.1246236584998883e+01 3.5490065792296186e+01 7.9756754045764964e+01 - 14 1.1722762015217488e+02 7.0777587800518864e+00 -1.1012808747152181e+02 - 15 2.0459886374792103e+02 1.1352434902632419e+01 -6.9641008537041586e+01 - 16 6.4819488894277626e+01 2.7717767285477504e+02 9.6971206512117831e+01 - 17 -1.1757145373858191e+02 7.5598283763031333e+01 8.2344537953401620e+00 - 18 1.4979763484000514e+02 4.6437981230754680e+01 1.9074030927267040e+02 - 19 9.9232177039551743e+01 -3.4161491191063057e+01 -9.3482743694123911e+01 - 20 3.4394272911489560e+02 1.8755951153575882e+02 1.8391751542140381e+02 - 21 -1.7639675023083032e+02 5.9884188602876513e+01 2.3197830826168012e+01 - 22 3.5944608335498276e+02 -4.9708524898876021e+02 2.0607149093293810e+02 - 23 1.7579271068638736e+01 2.1298728097754687e+02 1.9485168054795750e+02 - 24 -1.8644003680983860e+02 2.0152727772546126e+02 -1.5032646302314092e+02 - 25 6.6427890225862839e+01 -2.6628950112809588e+02 6.5040867172812568e+01 - 26 -2.9538210986747896e+02 1.8889963664467763e+02 8.6392520853920516e+01 - 27 1.0405463527343457e+02 -2.5883797810836899e+00 -6.3473815684801785e+01 - 28 -1.7939102939145226e+02 -1.9072998240489997e+02 -1.6920314161246782e+02 - 29 2.8518125846098656e+02 -9.8610707014135585e+01 -1.5865904861816750e+02 - 30 3.2948855593638848e-01 9.9396107066086955e+01 3.2866521919189089e+00 - 31 -1.8093342589558659e+00 -5.1090324665848712e+01 5.9965783206663161e+00 - 32 3.1528757881180007e+02 -1.2794634397194349e+02 -2.4177668881260021e+02 - 33 -5.4083133243805372e+00 1.7567908978406618e+02 -1.1807415000724265e+02 - 34 -1.9400316636479977e+02 -1.0951814437454595e+02 -1.5439329543504013e+02 - 35 -1.9195026719711194e+02 -1.2774392196243292e+01 1.3164394415174289e+02 - 36 2.1450819558036866e+02 4.8524393939315888e+02 -2.2938259760791684e+02 - 37 -3.3553755452540895e+02 -4.9646067746196536e+02 2.1990265059231979e+02 - 38 -3.2545680671007766e+01 2.4954714465771517e+01 -1.5693304654702996e+02 - 39 -1.5400979972013733e+01 2.3902925031181187e+01 9.6154974338013474e+01 - 40 -6.4361324286781183e+01 1.7841294566727018e+02 1.6199313424706546e+02 - 41 -2.4660579832547052e+02 2.3084997378288404e+02 -2.9640187773211630e+02 - 42 -2.9452038269198692e+02 4.3373690323403952e+02 4.3706797334309402e+02 - 43 1.3265462163819998e+02 -2.9274830054471895e+01 2.3064015623266641e+02 - 44 1.0054965815688162e+02 -2.0011417092775127e+02 1.1673395109270328e+02 - 45 1.5191488778751707e+02 -3.3909986813212635e+02 -6.8138447286529720e+02 - 46 -3.6974585651662977e+02 6.5877949821504194e+02 -1.2846140462208882e+02 - 47 7.0999522650120099e+01 2.6787232844301741e+02 -2.6037434470741427e+01 - 48 4.8457875917949451e+02 -1.6693867974736796e+02 -3.2653088508349691e+02 - 49 1.0016330847216284e+02 1.7144939472474533e+01 1.2769410377207676e+02 - 50 -2.5643045293874383e+02 4.8550578070475757e+02 1.7833571905770887e+02 - 51 1.5929685733709441e+03 -1.5100179731534890e+03 1.3757557210338409e+03 - 52 -3.9363155553927618e+02 2.9261413115276798e+02 -2.7081680938457316e+02 - 53 -1.2156938822751686e+03 1.0481428026908065e+03 -1.7260661331518384e+03 - 54 5.4545508362448210e+01 1.0309421723440155e+02 -6.1761185913629610e+01 - 55 -2.0239005919386466e+02 1.8108787078448725e+02 -4.9048334046900078e+02 - 56 2.0036614412052225e+02 -1.8905881350356012e+02 -1.3675071587645911e+02 - 57 -1.7850227402751372e+02 -3.3738314148552627e+02 -1.4864701622354673e+02 - 58 -2.5670676029812597e+02 -1.3336092440092364e+02 8.4345104538588089e+01 - 59 -1.7898804840101980e+02 1.8142384187504891e+02 2.7914484812152023e+02 - 60 -7.4398955008919714e+01 -6.8191485113974892e+01 5.7946912127557717e+01 - 61 9.6097667682189197e+01 4.4562130970058109e+02 5.3555842003747642e+01 - 62 3.3087710298162186e+01 1.3291451685900134e+02 -3.6140086918051345e+01 - 63 -2.5660817878335301e+01 -3.1619388904758910e+02 5.0012563149825205e+01 - 64 2.5890372243019073e+01 -6.0849122994338025e+01 7.5030153780264586e+00 + 1 -1.4571796976977475e+02 -2.2140579635792884e+02 -1.4808149010447769e+02 + 2 -1.7648305954284041e+02 -1.0146476417236073e+02 -1.7988566053603591e+01 + 3 -2.0614225365740097e+01 -4.0344097227230094e+02 -3.8604731470054062e+01 + 4 2.6614888269720814e+02 4.0003233795014168e+01 1.4690057516187863e+02 + 5 9.7845378052670569e+00 4.3882570307523316e+01 4.9797206010047589e+01 + 6 -2.6938082908045919e+02 3.3524802199605972e+00 2.2965815951985147e+02 + 7 3.2575186725741395e+02 -1.7977227930984148e+02 2.2179960228952396e+02 + 8 9.9964020081557138e+01 -2.8685357554222099e+02 1.4158731522817112e+02 + 9 1.6438523377332476e+01 -1.9355303092496897e+02 -9.4334957020327948e+01 + 10 -2.0853806475972263e+02 1.0026021875703947e+02 -1.5021521105990161e+02 + 11 -2.0574136330802202e+02 2.7604370854540770e+02 5.5777225668964445e+02 + 12 5.0285717304860879e+02 -6.0968353881851192e+02 3.9377680529647569e+02 + 13 -9.1246272612282368e+01 3.5490016998948100e+01 7.9756749986805872e+01 + 14 1.1722763390616720e+02 7.0777572837063545e+00 -1.1012806750165767e+02 + 15 2.0459887112033201e+02 1.1352405359138412e+01 -6.9641010980711187e+01 + 16 6.4819489591627985e+01 2.7717767094468888e+02 9.6971198880055780e+01 + 17 -1.1757145471738642e+02 7.5598280349563737e+01 8.2344590524461072e+00 + 18 1.4979763975305985e+02 4.6437996441246753e+01 1.9074030452047762e+02 + 19 9.9232182958160649e+01 -3.4161493200256849e+01 -9.3482747032954819e+01 + 20 3.4394273190544487e+02 1.8755952354050976e+02 1.8391751060923613e+02 + 21 -1.7639675308717227e+02 5.9884172559678539e+01 2.3197838699496501e+01 + 22 3.5944608490729252e+02 -4.9708525361009697e+02 2.0607148872705903e+02 + 23 1.7579274952856146e+01 2.1298728055372681e+02 1.9485167236722779e+02 + 24 -1.8644004784533396e+02 2.0152728030974987e+02 -1.5032647044559059e+02 + 25 6.6427893699487285e+01 -2.6628950089076670e+02 6.5040872719333763e+01 + 26 -2.9538211829350598e+02 1.8889965241529200e+02 8.6392539131687670e+01 + 27 1.0405461403221605e+02 -2.5883825588235845e+00 -6.3473842387095296e+01 + 28 -1.7939104123925333e+02 -1.9072999063995681e+02 -1.6920313224146631e+02 + 29 2.8518126138643589e+02 -9.8610753428175371e+01 -1.5865905973294608e+02 + 30 3.2949044114559667e-01 9.9396106279740152e+01 3.2866487023715845e+00 + 31 -1.8093337117467343e+00 -5.1090328691324387e+01 5.9965849772505502e+00 + 32 3.1528763104400332e+02 -1.2794632256692650e+02 -2.4177666052802613e+02 + 33 -5.4083129170642179e+00 1.7567908715551988e+02 -1.1807415450387619e+02 + 34 -1.9400317396625167e+02 -1.0951816546456534e+02 -1.5439330137890337e+02 + 35 -1.9195026193065127e+02 -1.2774392319491161e+01 1.3164394629475399e+02 + 36 2.1450819729293397e+02 4.8524393495667874e+02 -2.2938261082652426e+02 + 37 -3.3553756825286939e+02 -4.9646067369623501e+02 2.1990265295677537e+02 + 38 -3.2545669240461962e+01 2.4954715957821520e+01 -1.5693302625922774e+02 + 39 -1.5400978707519485e+01 2.3902924956982389e+01 9.6154975229739549e+01 + 40 -6.4361322091921963e+01 1.7841296679824200e+02 1.6199313367381012e+02 + 41 -2.4660579311181596e+02 2.3084998025482201e+02 -2.9640187317945146e+02 + 42 -2.9452037865586266e+02 4.3373691264280740e+02 4.3706800713302425e+02 + 43 1.3265463914285502e+02 -2.9274831727547486e+01 2.3064014394569924e+02 + 44 1.0054966120054988e+02 -2.0011413451728055e+02 1.1673396063607694e+02 + 45 1.5191487332744026e+02 -3.3909989475298806e+02 -6.8138450042787269e+02 + 46 -3.6974586930852371e+02 6.5877947911188835e+02 -1.2846142437073112e+02 + 47 7.0999519258744826e+01 2.6787233536251233e+02 -2.6037425588932479e+01 + 48 4.8457871743082603e+02 -1.6693866918660342e+02 -3.2653088595197522e+02 + 49 1.0016334450403171e+02 1.7144926659081193e+01 1.2769410739667713e+02 + 50 -2.5643044716127639e+02 4.8550578281218662e+02 1.7833569703185714e+02 + 51 1.5929685800547243e+03 -1.5100179816024361e+03 1.3757557055371278e+03 + 52 -3.9363157215408233e+02 2.9261415024331393e+02 -2.7081681598776061e+02 + 53 -1.2156938934830002e+03 1.0481428177286084e+03 -1.7260661177369154e+03 + 54 5.4545512167986800e+01 1.0309421079214434e+02 -6.1761171483942455e+01 + 55 -2.0239006109115883e+02 1.8108786983188449e+02 -4.9048333730029168e+02 + 56 2.0036614371542044e+02 -1.8905881182672297e+02 -1.3675071296668057e+02 + 57 -1.7850229397871476e+02 -3.3738313920990021e+02 -1.4864700460708005e+02 + 58 -2.5670676044045717e+02 -1.3336092216373774e+02 8.4345105241459464e+01 + 59 -1.7898804526082839e+02 1.8142383013226376e+02 2.7914483449637197e+02 + 60 -7.4398952097636979e+01 -6.8191483730035287e+01 5.7946910740208871e+01 + 61 9.6097660916192893e+01 4.4562130692576051e+02 5.3555843428685527e+01 + 62 3.3087683040848127e+01 1.3291451189592027e+02 -3.6140107370205008e+01 + 63 -2.5660819680707732e+01 -3.1619389079817131e+02 5.0012586602224751e+01 + 64 2.5890370845876866e+01 -6.0849124899192077e+01 7.5030175856502677e+00 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index efdf3ff5de..54b66c5b71 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -1,7 +1,8 @@ --- -lammps_version: 10 Feb 2021 -date_generated: Fri Feb 26 23:09:08 2021 +lammps_version: 8 Apr 2021 +date_generated: Mon Apr 19 09:21:19 2021 epsilon: 5e-13 +skip_tests: prerequisites: ! | pair reax/c pre_commands: ! | @@ -29,18 +30,18 @@ pair_coeff: ! | * * ffield.reax.mattsson C C extract: ! "" natoms: 64 -init_vdwl: -8975.38106346063 -init_coul: 0.592852986871656 +init_vdwl: -8975.381063460629 +init_coul: 0.5928529868716559 init_stress: ! |- - -1.1526162173764681e+03 -4.6218014500723507e+02 3.1954383274884901e+02 -2.2197591028227616e+03 3.4480244373669785e+02 -1.2644452447488200e+03 + -1.1526162173764683e+03 -4.6218014500723461e+02 3.1954383274884901e+02 -2.2197591028227621e+03 3.4480244373669785e+02 -1.2644452447488200e+03 init_forces: ! |2 1 -2.0916057489019278e+02 -1.8819573882656792e+02 -2.2843342560290171e+02 2 -5.9711660034805291e+01 -1.3795294129596448e+02 -6.1450415050409106e+01 3 1.0924699545317881e+02 5.4683388561496884e+01 8.7122903226954129e+00 4 2.2394129214932286e+02 -1.2607110719575815e+02 5.6116628706921283e+01 5 2.1339173392425103e+01 2.3982132147793212e+02 -1.1311227256425612e+02 - 6 -2.3465218593173694e+02 8.7997863600775148e+01 7.1405034243397978e+01 - 7 1.7783507933620086e+02 3.8498185748852222e+01 -2.7669272643606155e+02 + 6 -2.3465218593173694e+02 8.7997863600775204e+01 7.1405034243397978e+01 + 7 1.7783507933620086e+02 3.8498185748852194e+01 -2.7669272643606155e+02 8 -2.1014288646597468e+01 -4.0711968506334620e+02 1.5140757706928005e+02 9 -5.9307137188585735e+01 2.6264734812019469e+02 1.7442573676385443e+01 10 -8.4525778086876372e+01 1.5450140994331881e+02 6.0015146335720981e+00 @@ -59,7 +60,7 @@ init_forces: ! |2 23 -1.0142123148353758e+02 2.3316671624708323e+02 2.3905950409694179e+02 24 4.1563056415358169e+01 -1.2911164666848796e+01 -3.1668646816892700e+01 25 2.1166667371090460e+02 -2.0418293867725825e+02 -3.1232107629433731e+01 - 26 -2.6320989589682608e+02 1.2065128452552987e+02 2.6277305997802796e+02 + 26 -2.6320989589682614e+02 1.2065128452552987e+02 2.6277305997802796e+02 27 -7.4498892273813865e+01 1.0778676260209129e+02 1.6095170163345196e+02 28 -2.4911277843488330e+02 -9.8499434443852323e+01 2.2239731087969662e+02 29 4.5655943120047868e+02 -5.6181584973687457e+01 -2.7582701917178326e+02 @@ -71,10 +72,10 @@ init_forces: ! |2 35 -4.3920895665271935e+01 1.3832065189158040e+00 3.2302673529697479e+01 36 6.0407395927653840e+02 6.3222430241983602e+02 -1.5530384927410198e+01 37 -1.7704334275340958e+02 -3.4711199127962510e+02 2.0757920588578631e+02 - 38 -1.5990280705026578e+02 3.4383476554695548e+01 -1.1348860416567172e+02 + 38 -1.5990280705026578e+02 3.4383476554695534e+01 -1.1348860416567172e+02 39 1.2481780186485386e+02 3.1854282379699551e+01 2.4141006149778542e+02 40 -3.3952439214884555e+02 -5.2081203805390805e+02 -3.2749145453037904e+01 - 41 1.5953768898032129e+01 -2.5259433402085026e+01 -6.0977489335468213e+01 + 41 1.5953768898032132e+01 -2.5259433402085026e+01 -6.0977489335468242e+01 42 -3.5152692860571921e+02 1.0103192674618649e+02 1.0057493004151380e+02 43 1.8325251692529525e+02 -1.7843397924740284e+01 3.5813821983655600e+01 44 -1.7148730839833942e+02 6.5823249480752622e+01 -3.9043544554425509e+01 @@ -88,20 +89,20 @@ init_forces: ! |2 52 2.6770006025654067e+02 -1.3486195976744685e+02 -1.0999251813934440e+02 53 -3.0038447974652507e+02 1.7427208891886863e+02 -2.8369940533043155e+02 54 -1.8044322949045332e+02 3.2006167622599366e+02 -2.1986764638272368e+02 - 55 -6.7026995338193800e+01 2.8420556560193825e+02 -1.8256943632991815e+02 + 55 -6.7026995338193785e+01 2.8420556560193825e+02 -1.8256943632991815e+02 56 -9.3944897793228427e+02 7.6593871052490795e+02 -4.5872941120666036e+02 57 -2.7671724574062154e+01 -1.7257977562305285e+02 -1.6210118849324644e+02 58 7.1032070297632515e+02 -8.0881938208311499e+02 4.6676948457734852e+02 59 1.5682857500225748e+02 5.9891527233627251e+01 1.2646558890105979e+02 - 60 9.4076874705709940e+01 -1.1749874299724539e+02 -2.9919368333582653e+01 + 60 9.4076874705709940e+01 -1.1749874299724536e+02 -2.9919368333582653e+01 61 -4.8945763699767674e+01 1.6634783727405593e+02 6.7645978441449785e+01 - 62 1.6618577867039602e+02 7.3503605317082460e+01 2.2193892218236812e+02 + 62 1.6618577867039602e+02 7.3503605317082432e+01 2.2193892218236812e+02 63 4.6491757293229652e+00 -3.5581179274724047e+02 -3.8944419279304846e+01 - 64 -2.0021113303887086e+02 -1.1223202348830976e+02 3.0276216112541510e+02 -run_vdwl: -8975.38042076783 -run_coul: 0.592853076313598 + 64 -2.0021113303887086e+02 -1.1223202348830974e+02 3.0276216112541510e+02 +run_vdwl: -8975.380420767826 +run_coul: 0.5928530763135977 run_stress: ! |- - -1.1524045146329236e+03 -4.6202672628887268e+02 3.1947257175242049e+02 -2.2198788293036200e+03 3.4537925625758328e+02 -1.2645006400276918e+03 + -1.1524045146329231e+03 -4.6202672628887268e+02 3.1947257175242231e+02 -2.2198788293036200e+03 3.4537925625758328e+02 -1.2645006400276918e+03 run_forces: ! |2 1 -2.0916271375742122e+02 -1.8819704628010820e+02 -2.2843189669574852e+02 2 -5.9713089401385787e+01 -1.3795344000202866e+02 -6.1452818077516426e+01 @@ -113,9 +114,9 @@ run_forces: ! |2 8 -2.1021838063645568e+01 -4.0712804090199722e+02 1.5141447171445833e+02 9 -5.9306114388327742e+01 2.6264890826456997e+02 1.7441651570743588e+01 10 -8.4526898873820201e+01 1.5450366474645668e+02 6.0033453272929940e+00 - 11 -1.1159943563282732e+02 1.8656190683525134e+02 3.4449923076959345e+02 + 11 -1.1159943563282735e+02 1.8656190683525134e+02 3.4449923076959345e+02 12 3.3352091011374790e+02 -3.8250187755922349e+02 5.1084711927225143e+01 - 13 -3.9348220819701362e+02 -9.9340584671855098e+01 2.4784344215807911e+02 + 13 -3.9348220819701362e+02 -9.9340584671855126e+01 2.4784344215807911e+02 14 1.7611207455981244e+02 -2.8017472349270184e+02 -2.7998178961052838e+02 15 2.5245571069035290e+02 -5.4734821409382626e+01 -1.3455249096986566e+02 16 1.6596243938777351e+02 1.6278821061030078e+02 4.2193739172058962e+01 @@ -124,28 +125,28 @@ run_forces: ! |2 19 -5.9065305354749185e+01 1.7641117222083235e+01 -1.0450807266106713e+02 20 1.3106409577706648e+02 2.5186488486411651e+01 1.3539864929844231e+02 21 -3.2006405209533727e+02 -1.1510774059461794e+02 -2.5815972761838644e+01 - 22 -1.2758648770740034e+01 -1.3030598897381913e+02 -1.4401125298080763e+02 + 22 -1.2758648770740034e+01 -1.3030598897381913e+02 -1.4401125298080760e+02 23 -1.0142069915754510e+02 2.3316707339244664e+02 2.3905997646640651e+02 24 4.1563103349612355e+01 -1.2912528416939978e+01 -3.1670350622584593e+01 25 2.1168614583214108e+02 -2.0420927517565983e+02 -3.1221859837734250e+01 - 26 -2.6321230702712649e+02 1.2065335797472036e+02 2.6277789068532360e+02 + 26 -2.6321230702712649e+02 1.2065335797472038e+02 2.6277789068532360e+02 27 -7.4500805679154823e+01 1.0778230652943388e+02 1.6094824153641918e+02 28 -2.4910955893577807e+02 -9.8496280842320616e+01 2.2240251270644734e+02 29 4.5656377692784969e+02 -5.6186906107102686e+01 -2.7582984196898542e+02 30 -1.1442511837997856e+02 5.2288586072111144e+01 -1.7194888884507304e+02 - 31 -1.8372666861898105e+02 -1.0040300216200654e+02 -9.6974937189118549e+01 + 31 -1.8372666861898108e+02 -1.0040300216200654e+02 -9.6974937189118549e+01 32 1.5285848611243131e+02 -1.2910298326427261e+02 -1.8526958855531907e+02 33 2.0676324457133298e+01 3.7958042970093453e+02 -3.0330268376879861e+01 34 -1.8482802426276322e+02 -8.4860106696650362e+01 -1.0335087798868081e+02 - 35 -4.3757312673305961e+01 1.3332543035332109e+00 3.2176626618113424e+01 + 35 -4.3757312673305961e+01 1.3332543035332394e+00 3.2176626618113424e+01 36 6.0396434382165080e+02 6.3211513244050911e+02 -1.5608509994293938e+01 37 -1.7702865323607540e+02 -3.4710307878941217e+02 2.0756937792988572e+02 38 -1.5990155316495603e+02 3.4380405811165133e+01 -1.1348496857139023e+02 39 1.2481655186335834e+02 3.1838210934905270e+01 2.4138399128801109e+02 40 -3.3940174784427825e+02 -5.2071078889465889e+02 -3.2710078405858489e+01 - 41 1.5894692394219231e+01 -2.5287374067694170e+01 -6.0953115361932838e+01 + 41 1.5894692394219231e+01 -2.5287374067694170e+01 -6.0953115361932809e+01 42 -3.5153052244718293e+02 1.0102830549812477e+02 1.0056790310062641e+02 - 43 1.8327499597791055e+02 -1.7817142708111650e+01 3.5817319257754178e+01 + 43 1.8327499597791055e+02 -1.7817142708111650e+01 3.5817319257754193e+01 44 -1.7148210647983669e+02 6.5813679084638309e+01 -3.9042611994879181e+01 45 6.8003425377666687e+01 -5.2977048819501960e+01 -1.1277968937633442e+02 46 -1.9814362259114762e+02 3.1898369061349177e+02 -1.7124898143652061e+02 From 204566790239f4882314dc1447ebcdc0bbd00537 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:55:09 -0400 Subject: [PATCH 060/119] document QEQ package incompatibilities --- doc/src/fix_qeq.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index 7ea79a89ce..ffc85dcf3b 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -230,6 +230,8 @@ These fixes are part of the QEQ package. They are only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. +The qeq fixes are not compatible with the GPU and USER-INTEL packages. + Related commands """""""""""""""" From daaebd55a6e8b952b49618939db9f58b0a4e2695 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 14:56:27 -0400 Subject: [PATCH 061/119] add QEQ parameter file --- unittest/force-styles/tests/param.qeq2 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 unittest/force-styles/tests/param.qeq2 diff --git a/unittest/force-styles/tests/param.qeq2 b/unittest/force-styles/tests/param.qeq2 new file mode 100644 index 0000000000..1d77b7d3a6 --- /dev/null +++ b/unittest/force-styles/tests/param.qeq2 @@ -0,0 +1,3 @@ +# UNITS: metal +1 0.00000 7.25028 0.01 0.772871 0.000000 +2 11.26882 15.37920 0.01 0.243072 0.000000 From c5438156925121713e613bbbc5d57c512507a343 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 15:28:42 -0400 Subject: [PATCH 062/119] small tweaks --- unittest/commands/test_groups.cpp | 2 +- unittest/force-styles/tests/fix-timestep-adapt_pair.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 181f000a7c..1b65d6dfa4 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -245,7 +245,7 @@ TEST_F(GroupTest, Molecular) ASSERT_EQ(group->count(group->find("three")), 15); ASSERT_DOUBLE_EQ(group->mass(group->find("half")), 40); ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 10); - ASSERT_DOUBLE_EQ(group->charge(group->find("top")), 0); + ASSERT_NEAR(group->charge(group->find("top")), 0,1.0e-14); ASSERT_DOUBLE_EQ(group->charge(group->find("right"), domain->find_region("top")), 0); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three include xxx");); diff --git a/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml b/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml index 167f531b8e..58b25f6012 100644 --- a/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml +++ b/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Thu Mar 25 14:01:17 202 -epsilon: 1e-14 +epsilon: 2e-14 prerequisites: ! | atom full fix adapt From 83c1187e47da2dc61e9b99635f3d9a0f991c097c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 16:53:39 -0400 Subject: [PATCH 063/119] clear allocated data structure so that all included pointers are initialized to null --- src/USER-REAXC/pair_reaxc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 565dc89eb0..5cd1556943 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -78,7 +78,9 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) api->control = new control_params; memset(api->control,0,sizeof(control_params)); api->data = new simulation_data; + memset(api->data,0,sizeof(simulation_data)); api->workspace = new storage; + memset(api->workspace,0,sizeof(storage)); memory->create(api->lists, LIST_N,"reaxff:lists"); memset(api->lists,0,LIST_N * sizeof(reax_list)); From 66eea0b63a66fca9c5d10f22d6baf47f5f5c8f98 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 16:54:17 -0400 Subject: [PATCH 064/119] call destroy() before create() for multi-dimensional arrays to avoid leakage --- src/USER-REAXC/reaxc_ffield.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 7e60682102..530a5913a6 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -91,6 +91,7 @@ namespace ReaxFF { if (n < 1) THROW_ERROR("Invalid number of global parameters"); + memory->destroy(gp.l); memory->create(gp.l,n,"reaxff:gp.l"); // see reaxff_types.h for mapping between l[i] and the lambdas used in ff @@ -118,6 +119,11 @@ namespace ReaxFF { auto &hbp = reax->hbp; auto &fbp = reax->fbp; + memory->destroy(sbp); + memory->destroy(tbp); + memory->destroy(thbp); + memory->destroy(hbp); + memory->destroy(fbp); memory->create(sbp,n,"reaxff:sbp"); memory->create(tbp,n,n,"reaxff:tbp"); memory->create(thbp,n,n,n,"reaxff:thbp"); From b014e8b94fb9e13155e002c69f3ca01ffae0391f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 17:15:52 -0400 Subject: [PATCH 065/119] revert standard reax/c test --- .../tests/atomic-pair-reax_c.yaml | 270 +++++++++--------- 1 file changed, 135 insertions(+), 135 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index 261812d56c..857326b10d 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,6 +1,6 @@ --- lammps_version: 8 Apr 2021 -date_generated: Mon Apr 19 09:21:15 2021 +date_generated: Tue Apr 20 16:11:55 2021 epsilon: 1e-10 skip_tests: prerequisites: ! | @@ -25,7 +25,7 @@ pre_commands: ! | set type 2 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c maxiter 20 nowarn + fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c input_file: in.empty pair_style: reax/c NULL checkqeq yes pair_coeff: ! | @@ -33,141 +33,141 @@ pair_coeff: ! | extract: ! "" natoms: 64 init_vdwl: -4208.203794533267 -init_coul: -268.02765877429266 +init_coul: -268.0258681099893 init_stress: ! |2- - 2.3677138597920134e+03 3.0801994317052795e+03 1.2727836669117719e+03 -1.5387982333122163e+03 -1.0906434577120353e+03 1.1229697394381967e+03 + 2.3677048490925813e+03 3.0802122558807969e+03 1.2727815110263937e+03 -1.5387991688242109e+03 -1.0906364142628713e+03 1.1229877249527449e+03 init_forces: ! |2 - 1 2.9633286152714895e+01 -5.6268158870662865e+02 -1.6667929778658686e+02 - 2 -1.5938461587386283e+02 -2.2076632409584278e+02 -1.7162405040710766e+02 - 3 -3.1194767737908826e+01 -3.0592472349600524e+02 4.4651629891466243e+01 - 4 4.4646596256626185e+02 1.7080830170172359e+02 1.7439025633170678e+02 - 5 -1.1512522479897345e+02 7.9717596119857888e+01 1.7958911311542607e+01 - 6 -7.1695066631618761e+02 4.0748756065642638e+01 2.1511809762804484e+02 - 7 2.3022206076223796e+02 -9.0168647609670387e+01 8.2189129278766103e+01 - 8 -2.1137097290905352e+01 -1.5635843951502784e+02 1.6101855425514745e+02 - 9 -1.2130643966073812e+02 -2.7960290186509405e+02 -1.9629224425201704e+02 - 10 -3.7631894872912522e+02 3.4103357651251537e+02 -1.8166645213907478e+02 - 11 -1.6153902964754667e+02 1.5743241425267431e+02 3.5832306945377178e+02 - 12 6.1603732792700282e+02 -1.4821040465468917e+02 1.0870676706201488e+02 - 13 -2.1366851202213653e+02 -3.0163954126350092e+02 5.2420915627618558e+02 - 14 2.5933780612532126e+02 -1.7968461610614241e+01 -2.7733218830598901e+02 - 15 1.7570487907901011e+02 1.7550789799326304e+02 -9.5786451085155491e+01 - 16 3.0589204520776934e+02 -4.7676020729815768e+01 -3.4330483431656791e+02 - 17 -1.5018690887845338e+02 1.3259473313627657e+02 2.3200552664411475e+02 - 18 1.6469519167779183e+02 -1.0816250655621064e+02 2.1207543727392661e+02 - 19 2.4759344887399081e+02 -4.8758511247092088e+01 -2.2494130722447932e+02 - 20 1.2418791307460424e+02 2.5137179718270556e+02 -1.5340308025983461e+01 - 21 -1.9556242958992678e+02 2.3151160715888874e+01 -1.2529867634994399e+02 - 22 2.4829292770827422e+02 -2.9828612004289113e+02 -4.0454677881884024e+01 - 23 8.2077976837017900e+01 1.3041866298293627e+02 1.5221209316034532e+02 - 24 -7.6913783243387826e+01 2.3540203354364189e+02 -1.7129245933770727e+02 - 25 -2.9781744550605662e+01 -1.8931888070263267e+02 6.7990019857554202e+01 - 26 -3.9488424247767014e+01 2.0999360632613091e+00 -2.0748830164832864e+02 - 27 -2.7704383990910344e+02 5.3737323080507701e+02 4.2318830552299499e+02 - 28 -2.9302153625490882e+02 -5.1150243581343020e+01 -2.3633573764669612e+02 - 29 1.2970603958450926e+02 -4.2262332230398229e+01 1.6349790455526482e+02 - 30 5.6924470622841902e+01 3.7878571490062619e+01 6.8637961971110911e+01 - 31 -1.9325586894804644e+02 -1.1645468493273863e+02 -2.0673145110109189e+01 - 32 1.2359537270071175e+02 -3.3261682729471509e+01 -1.0517081413370242e+02 - 33 6.5244494839342053e+01 3.7105575675452133e+02 6.0972008518320628e+01 - 34 -2.3124412393972406e+02 -1.1681894708374426e+02 -2.5838515661900914e+02 - 35 -4.1912097866037749e+02 7.9940298322579153e+01 3.1020906752098472e+02 - 36 -1.8561756690805518e+02 -1.1563749469376307e+02 -4.2356131544286932e+01 - 37 8.8268459557867800e+00 -3.5266202517998272e+02 -6.0508589419221380e+01 - 38 -1.9251065954670622e+01 1.1716443799821707e+02 -2.3476787650314483e+02 - 39 -1.0434207876793304e+01 -7.0902825597879200e+01 1.4264102290267166e+02 - 40 3.3265415672808695e+02 -8.8676314506220365e+02 1.6250323289221797e+01 - 41 -6.4525340969477625e+01 1.5190482993381195e+02 -1.8226363836162227e+02 - 42 2.3374265976474046e+01 1.1820849928255014e+02 4.1205919897871769e+02 - 43 -3.5145427442179937e+01 -3.6494054739761985e+00 2.4936139875273903e+02 - 44 -1.2909580317707088e+00 -2.4878033872407525e+02 7.9235212511230884e+01 - 45 2.0871432412721612e+02 -1.0816380085646371e+02 -4.1290534066227440e+02 - 46 -1.3837993836409981e+02 4.6113983127416537e+02 -2.4014147975943226e+02 - 47 1.3255343208840517e+02 2.8747648851097466e+02 -3.2895641248751062e+01 - 48 7.8145151343613895e+02 6.5212246673697649e+01 -6.2304415905848475e+02 - 49 2.4486207561858652e+02 1.9098760054137188e+01 3.7416718126982084e+02 - 50 2.9821250019803648e+02 3.0684285856103526e+02 5.6995325423529778e+02 - 51 -8.0052512629134719e+02 5.1024666433916468e+02 7.5828839863942687e+02 - 52 -9.2132795322260193e+01 1.1909938868988401e+02 -2.4119177446813089e+02 - 53 -3.6386508146804226e+02 -2.0728774423637225e+02 -3.4909372895932455e+02 - 54 -8.3400478462696412e+01 1.8942847373883873e+02 -1.2868846530013360e+02 - 55 -2.5306030895087017e+02 -1.1005903030773361e+02 -3.0893490115268742e+02 - 56 1.7363066404655606e+02 -2.5755159082633384e+02 -4.3732393367297526e+01 - 57 4.2667868235664599e+02 1.5529168633998034e+02 -3.9988358463751354e+02 - 58 -3.9654228870269598e+01 7.8950867015507271e+01 2.6135841350205141e+02 - 59 -2.7594567334153987e+02 1.9892282891821415e+02 2.4123100379637927e+02 - 60 -2.5675971154579702e+02 -1.1527142348407712e+02 9.9923841074681320e+01 - 61 3.0884909844566982e+02 4.9986511818576071e+02 -1.3369330200973721e+02 - 62 2.8529506416321446e+01 5.9000054110319344e-01 -2.7402724976042202e+02 - 63 2.5296716267913251e+02 -2.7640609445310349e+02 -1.9200849927940413e+02 - 64 -8.4682581712903087e+01 -1.5737182215029318e+02 1.5637971229670848e+02 -run_vdwl: -4208.209603101568 -run_coul: -268.02581602182215 + 1 2.9634051452064185e+01 -5.6267761875030578e+02 -1.6668253255995427e+02 + 2 -1.5938437728855834e+02 -2.2076601831947630e+02 -1.7161994484503376e+02 + 3 -3.1194106231028943e+01 -3.0591930644159874e+02 4.4652570958842091e+01 + 4 4.4646653320084567e+02 1.7080811286684130e+02 1.7439026170464035e+02 + 5 -1.1512606621591536e+02 7.9716954463499022e+01 1.7959700550221577e+01 + 6 -7.1695199301548041e+02 4.0749156820926302e+01 2.1512037025856239e+02 + 7 2.3022543693175217e+02 -9.0170756873726333e+01 8.2190170006889645e+01 + 8 -2.1141251466334634e+01 -1.5635879347045886e+02 1.6101907187957218e+02 + 9 -1.2130842270563915e+02 -2.7960689135651120e+02 -1.9629114850256667e+02 + 10 -3.7631710890095133e+02 3.4103240548851863e+02 -1.8166279141134066e+02 + 11 -1.6154553323853384e+02 1.5743068117724297e+02 3.5832389058241489e+02 + 12 6.1602989065569886e+02 -1.4821564423105795e+02 1.0871005319350247e+02 + 13 -2.1366561068643219e+02 -3.0163595494900011e+02 5.2420406156019726e+02 + 14 2.5933950255875533e+02 -1.7967300062459064e+01 -2.7733367021016983e+02 + 15 1.7570537661854226e+02 1.7550639099554951e+02 -9.5789475936342853e+01 + 16 3.0588529285450090e+02 -4.7675556549230315e+01 -3.4330544488854196e+02 + 17 -1.5018545342619470e+02 1.3259542010621982e+02 2.3200545258699555e+02 + 18 1.6469564396901654e+02 -1.0816413254489510e+02 2.1207485840068148e+02 + 19 2.4759285902963026e+02 -4.8758383780523836e+01 -2.2494100786658765e+02 + 20 1.2418785577587857e+02 2.5137242577506828e+02 -1.5341186115637054e+01 + 21 -1.9556210564941867e+02 2.3152590535678623e+01 -1.2529729601999072e+02 + 22 2.4829386068622458e+02 -2.9828789153726473e+02 -4.0455445433038705e+01 + 23 8.2076007650237955e+01 1.3042103437664485e+02 1.5221389911915190e+02 + 24 -7.6912973583045328e+01 2.3539925428983466e+02 -1.7129603802744774e+02 + 25 -2.9782413878295884e+01 -1.8931910469291046e+02 6.7989202537813426e+01 + 26 -3.9488494691930782e+01 2.1025614476190424e+00 -2.0748963060916628e+02 + 27 -2.7704110443958297e+02 5.3736974078118158e+02 4.2318884882973293e+02 + 28 -2.9303219943093302e+02 -5.1154115419355229e+01 -2.3633993403335379e+02 + 29 1.2970484011865997e+02 -4.2266229541184131e+01 1.6350076614993492e+02 + 30 5.6925606430580402e+01 3.7880191852747046e+01 6.8636397133447261e+01 + 31 -1.9325596697353834e+02 -1.1645368911553673e+02 -2.0671692760916812e+01 + 32 1.2360965200043042e+02 -3.3253411369754360e+01 -1.0516118458992996e+02 + 33 6.5241847803263653e+01 3.7105112939425635e+02 6.0972558235451928e+01 + 34 -2.3124259597682851e+02 -1.1681740329855472e+02 -2.5838262648358858e+02 + 35 -4.1912226107430826e+02 7.9942920270906228e+01 3.1021023518174763e+02 + 36 -1.8561789047309296e+02 -1.1563628711183125e+02 -4.2360172436503717e+01 + 37 8.8271496727767698e+00 -3.5266450940716857e+02 -6.0505384072663695e+01 + 38 -1.9249505149115080e+01 1.1716319600342219e+02 -2.3477222840170350e+02 + 39 -1.0433878247334579e+01 -7.0902801856116241e+01 1.4264113912369183e+02 + 40 3.3265570779157940e+02 -8.8675933035692253e+02 1.6250845779884724e+01 + 41 -6.4537349815891190e+01 1.5189506353185567e+02 -1.8225353662797988e+02 + 42 2.3368723487140532e+01 1.1821526860010481e+02 4.1207323013207559e+02 + 43 -3.5145546474533603e+01 -3.6511647370358964e+00 2.4936793079206421e+02 + 44 -1.2881828259467285e+00 -2.4877240180803770e+02 7.9235766494558362e+01 + 45 2.0871504532588767e+02 -1.0817588901356530e+02 -4.1291808327438582e+02 + 46 -1.3837716960728255e+02 4.6114279241763722e+02 -2.4013801845141728e+02 + 47 1.3255320792802377e+02 2.8747276038939981e+02 -3.2896384987644886e+01 + 48 7.8145138718954991e+02 6.5215432481105154e+01 -6.2304789958706840e+02 + 49 2.4486314507345327e+02 1.9101300126651807e+01 3.7417037047544727e+02 + 50 2.9821275118603683e+02 3.0684252095008105e+02 5.6994896759617143e+02 + 51 -8.0052405736417188e+02 5.1024940640330806e+02 7.5829315450290915e+02 + 52 -9.2130898885915201e+01 1.1909837120722082e+02 -2.4118832391136655e+02 + 53 -3.6386926333489237e+02 -2.0729203700030763e+02 -3.4910517647679171e+02 + 54 -8.3399710534966360e+01 1.8942260327526213e+02 -1.2868598438440796e+02 + 55 -2.5305956575883852e+02 -1.1005916187118478e+02 -3.0893514828399947e+02 + 56 1.7364614503216589e+02 -2.5754370913449043e+02 -4.3744509948719575e+01 + 57 4.2667925201499298e+02 1.5529221173799095e+02 -3.9988499000700682e+02 + 58 -3.9656744140978226e+01 7.8953243693724033e+01 2.6135299122199172e+02 + 59 -2.7594240444753677e+02 1.9891763338587063e+02 2.4122500794453137e+02 + 60 -2.5675904361258932e+02 -1.1527171320987564e+02 9.9923550442534349e+01 + 61 3.0884427580009310e+02 4.9986415802549146e+02 -1.3369122169832409e+02 + 62 2.8530106503456519e+01 5.9540697570827006e-01 -2.7403025931181190e+02 + 63 2.5297054006404551e+02 -2.7640485799385101e+02 -1.9200503841907977e+02 + 64 -8.4680445259248458e+01 -1.5737027404337621e+02 1.5637808719882156e+02 +run_vdwl: -4208.209603101557 +run_coul: -268.02583477440254 run_stress: ! |2- - 2.3675915915115038e+03 3.0802240114846613e+03 1.2727324747502155e+03 -1.5388667254325053e+03 -1.0907269430167464e+03 1.1229240366702902e+03 + 2.3675903993352799e+03 3.0802227297815411e+03 1.2727311522674922e+03 -1.5388669378285692e+03 -1.0907269208284702e+03 1.1229243202763012e+03 run_forces: ! |2 - 1 2.9635340083051346e+01 -5.6267710249795869e+02 -1.6667998370665143e+02 - 2 -1.5938666826920343e+02 -2.2076534189863366e+02 -1.7162354109212984e+02 - 3 -3.1189870810301095e+01 -3.0593571985047180e+02 4.4645956923836664e+01 - 4 4.4646581130069950e+02 1.7080959759402148e+02 1.7439093558473147e+02 - 5 -1.1512840430317976e+02 7.9717053594844629e+01 1.7957493384932661e+01 - 6 -7.1695600898242708e+02 4.0752809200821034e+01 2.1512530796739239e+02 - 7 2.3022648522685608e+02 -9.0168938352327743e+01 8.2194670669568964e+01 - 8 -2.1149215429861702e+01 -1.5637110513857075e+02 1.6102981761092099e+02 - 9 -1.2130987184908217e+02 -2.7961359052794438e+02 -1.9628960657192528e+02 - 10 -3.7631820453396847e+02 3.4103263667614613e+02 -1.8166531833456517e+02 - 11 -1.6154688755051467e+02 1.5742797323066301e+02 3.5832199781281412e+02 - 12 6.1603846554302856e+02 -1.4820394873283382e+02 1.0871523277525925e+02 - 13 -2.1367534498311514e+02 -3.0167456097439617e+02 5.2424088341628442e+02 - 14 2.5933832701218608e+02 -1.7968192701718916e+01 -2.7733108167843062e+02 - 15 1.7570795092251277e+02 1.7551000310384359e+02 -9.5784222372814824e+01 - 16 3.0586981469801617e+02 -4.7679565967035259e+01 -3.4332195262424483e+02 - 17 -1.5018632687377072e+02 1.3259144780414934e+02 2.3200578527117301e+02 - 18 1.6469880313326215e+02 -1.0816831870102239e+02 2.1207667736516382e+02 - 19 2.4759420024003853e+02 -4.8758379338079727e+01 -2.2494116275048481e+02 - 20 1.2419960129665635e+02 2.5137932270320678e+02 -1.5328240053348356e+01 - 21 -1.9556094383241299e+02 2.3151696381601958e+01 -1.2529580363737537e+02 - 22 2.4829940463520313e+02 -2.9829343297891006e+02 -4.0446694405761576e+01 - 23 8.2074486469597687e+01 1.3042095796913281e+02 1.5221366791874641e+02 - 24 -7.6917692833702446e+01 2.3540351711765027e+02 -1.7130196247252570e+02 - 25 -2.9742100996765380e+01 -1.8935699491160051e+02 6.7995875362048835e+01 - 26 -3.9494945036515908e+01 2.1074087479630634e+00 -2.0748976668424677e+02 - 27 -2.7704005979662662e+02 5.3736953816242783e+02 4.2318569074160462e+02 - 28 -2.9302860300138957e+02 -5.1149672303866737e+01 -2.3633681317128332e+02 - 29 1.2970506005124116e+02 -4.2266505241952196e+01 1.6349682642247129e+02 - 30 5.6925895652797955e+01 3.7880903611520054e+01 6.8637138210808786e+01 - 31 -1.9325535402701956e+02 -1.1645328207806656e+02 -2.0671892295502396e+01 - 32 1.2360206049549920e+02 -3.3252985301196659e+01 -1.0516931870918121e+02 - 33 6.5239430456833531e+01 3.7104671672305966e+02 6.0974424435615809e+01 - 34 -2.3124086955801889e+02 -1.1681533354856286e+02 -2.5837807428177962e+02 - 35 -4.1912107298361212e+02 7.9943751193797880e+01 3.1020726776656619e+02 - 36 -1.8561413355995509e+02 -1.1563427104741439e+02 -4.2360264054660597e+01 - 37 8.8273599678770864e+00 -3.5266981598144150e+02 -6.0507477320620680e+01 - 38 -1.9245038012709841e+01 1.1717725521030376e+02 -2.3478404802363110e+02 - 39 -1.0434215698836438e+01 -7.0902647384814358e+01 1.4263978849003041e+02 - 40 3.3271178359289979e+02 -8.8679283858336646e+02 1.6219768658650871e+01 - 41 -6.4538810609188275e+01 1.5189398379892381e+02 -1.8225442798722727e+02 - 42 2.3368203862303545e+01 1.1822249156204117e+02 4.1207761014771074e+02 - 43 -3.5145614670828280e+01 -3.6517750326814120e+00 2.4936780076604907e+02 - 44 -1.2879422574017376e+00 -2.4877334082189225e+02 7.9236450933542571e+01 - 45 2.0871640299070592e+02 -1.0817582150128533e+02 -4.1291845938329635e+02 - 46 -1.3836372708562709e+02 4.6117937798867194e+02 -2.4016736146584793e+02 - 47 1.3255127160214204e+02 2.8747595545221196e+02 -3.2895652028052091e+01 - 48 7.8145389054767179e+02 6.5214945379088277e+01 -6.2304920777042912e+02 - 49 2.4488291106236500e+02 1.9105409364926288e+01 3.7418589758696908e+02 - 50 2.9822130989912665e+02 3.0683153011979800e+02 5.6994487035095165e+02 - 51 -8.0058521183025380e+02 5.1028581602653651e+02 7.5832461768047244e+02 - 52 -9.2137019037691147e+01 1.1910697318842861e+02 -2.4119128768698766e+02 - 53 -3.6387123110982282e+02 -2.0729720964342076e+02 -3.4910519380830556e+02 - 54 -8.3401332800193543e+01 1.8942464275359734e+02 -1.2869043354758486e+02 - 55 -2.5309678157873975e+02 -1.1001947468656527e+02 -3.0896372177857239e+02 - 56 1.7364608133921760e+02 -2.5754423801373565e+02 -4.3743927978158730e+01 - 57 4.2666357128098645e+02 1.5528157162856127e+02 -3.9988029715399989e+02 - 58 -3.9656756118817448e+01 7.8953165237690285e+01 2.6135222125861111e+02 - 59 -2.7594578242635424e+02 1.9891765773401318e+02 2.4122928728349606e+02 - 60 -2.5675991915252069e+02 -1.1527235180653685e+02 9.9923833769027368e+01 - 61 3.0884427542809721e+02 4.9986710924069786e+02 -1.3369013404232507e+02 - 62 2.8530654477154116e+01 5.9282210053495610e-01 -2.7403003802560033e+02 - 63 2.5296776535482985e+02 -2.7640523185325759e+02 -1.9200396674401188e+02 - 64 -8.4674657022429557e+01 -1.5736405319931387e+02 1.5637353707611086e+02 + 1 2.9635294281594891e+01 -5.6267712552696150e+02 -1.6667999923844903e+02 + 2 -1.5938673400152015e+02 -2.2076536449681436e+02 -1.7162354129442059e+02 + 3 -3.1189858281105185e+01 -3.0593580065880258e+02 4.4645958607293259e+01 + 4 4.4646581891374524e+02 1.7080959763777909e+02 1.7439093938228865e+02 + 5 -1.1512839796355780e+02 7.9717058687934127e+01 1.7957487669510552e+01 + 6 -7.1695602565953936e+02 4.0752829698557036e+01 2.1512533839228914e+02 + 7 2.3022644486519332e+02 -9.0168915600534049e+01 8.2194655874280542e+01 + 8 -2.1149264848803984e+01 -1.5637111051643518e+02 1.6102981315498010e+02 + 9 -1.2130987756626322e+02 -2.7961363383950686e+02 -1.9628960069615047e+02 + 10 -3.7631817089745317e+02 3.4103259385937486e+02 -1.8166532788357921e+02 + 11 -1.6154687915131711e+02 1.5742797820595132e+02 3.5832199951140109e+02 + 12 6.1603841944463943e+02 -1.4820397700321357e+02 1.0871524086056972e+02 + 13 -2.1367529106934364e+02 -3.0167446795627899e+02 5.2424091634188028e+02 + 14 2.5933827511240753e+02 -1.7968203382119590e+01 -2.7733114072539661e+02 + 15 1.7570793004244069e+02 1.7551005525188296e+02 -9.5784231788977749e+01 + 16 3.0586985592967915e+02 -4.7679566105948382e+01 -3.4332192731505285e+02 + 17 -1.5018636472333995e+02 1.3259146324636694e+02 2.3200578297675395e+02 + 18 1.6469881174805161e+02 -1.0816836176978013e+02 2.1207670716678888e+02 + 19 2.4759420520504079e+02 -4.8758383157767163e+01 -2.2494116682880116e+02 + 20 1.2419960666452823e+02 2.5137933265660718e+02 -1.5328241144729745e+01 + 21 -1.9556094492800702e+02 2.3151723982064777e+01 -1.2529581330697818e+02 + 22 2.4829941584476597e+02 -2.9829345245033829e+02 -4.0446702084715653e+01 + 23 8.2074458696916352e+01 1.3042100306284391e+02 1.5221371881648275e+02 + 24 -7.6917668833500898e+01 2.3540360228733630e+02 -1.7130192995354321e+02 + 25 -2.9742104523786168e+01 -1.8935699467868037e+02 6.7995874219729117e+01 + 26 -3.9494943772628240e+01 2.1074054704555034e+00 -2.0748981609854840e+02 + 27 -2.7704003655185977e+02 5.3736954143365233e+02 4.2318574013793761e+02 + 28 -2.9302855291123007e+02 -5.1149666118960234e+01 -2.3633679976948793e+02 + 29 1.2970505460342494e+02 -4.2266433901986183e+01 1.6349685185792413e+02 + 30 5.6925896868052199e+01 3.7880918758244668e+01 6.8637128510003294e+01 + 31 -1.9325534294265759e+02 -1.1645328076628637e+02 -2.0671892621502057e+01 + 32 1.2360198063082690e+02 -3.3253019999942374e+01 -1.0516936549567490e+02 + 33 6.5239383936196262e+01 3.7104662858439900e+02 6.0974455303733073e+01 + 34 -2.3124084085037498e+02 -1.1681523003031349e+02 -2.5837805461650902e+02 + 35 -4.1912113383005675e+02 7.9943750613186452e+01 3.1020725803706983e+02 + 36 -1.8561422052418746e+02 -1.1563434085911459e+02 -4.2360108129603255e+01 + 37 8.8275421440856547e+00 -3.5266971563412392e+02 -6.0507541453071482e+01 + 38 -1.9245036832038224e+01 1.1717726898939364e+02 -2.3478417248419430e+02 + 39 -1.0434224692470824e+01 -7.0902644440221394e+01 1.4263978421852897e+02 + 40 3.3271177801097122e+02 -8.8679293552761555e+02 1.6219742097556569e+01 + 41 -6.4538764986359638e+01 1.5189397693612858e+02 -1.8225441696797373e+02 + 42 2.3368235855713472e+01 1.1822246665296132e+02 4.1207745038653673e+02 + 43 -3.5145643416904370e+01 -3.6517162542190285e+00 2.4936784352978586e+02 + 44 -1.2879745400758535e+00 -2.4877345145140910e+02 7.9236449970514400e+01 + 45 2.0871643412339361e+02 -1.0817571271704279e+02 -4.1291831345629367e+02 + 46 -1.3836372705477595e+02 4.6117938292253513e+02 -2.4016736526221720e+02 + 47 1.3255125611057784e+02 2.8747591615865849e+02 -3.2895660248675412e+01 + 48 7.8145417759956388e+02 6.5214930060371188e+01 -6.2304930828897488e+02 + 49 2.4488281403352434e+02 1.9105496615711587e+01 3.7418605144303842e+02 + 50 2.9822129513622804e+02 3.0683153982657637e+02 5.6994490418774092e+02 + 51 -8.0058572063770589e+02 5.1028617285827835e+02 7.5832431569040102e+02 + 52 -9.2137024513793961e+01 1.1910687193195571e+02 -2.4119120858088723e+02 + 53 -3.6387082584333763e+02 -2.0729771077051413e+02 -3.4910499737675855e+02 + 54 -8.3401322475888492e+01 1.8942466656602346e+02 -1.2869045777950828e+02 + 55 -2.5309678413622956e+02 -1.1001947899857218e+02 -3.0896372370121657e+02 + 56 1.7364604574033362e+02 -2.5754429115061833e+02 -4.3743962050161187e+01 + 57 4.2666362581864087e+02 1.5528157995541829e+02 -3.9988032807910298e+02 + 58 -3.9656744873557194e+01 7.8953170999147844e+01 2.6135222052406243e+02 + 59 -2.7594581611215335e+02 1.9891770704103524e+02 2.4122933700019283e+02 + 60 -2.5675992319678829e+02 -1.1527235824444743e+02 9.9923831048647713e+01 + 61 3.0884428120706025e+02 4.9986711220596823e+02 -1.3369013376796840e+02 + 62 2.8530678742627682e+01 5.9283151669757950e-01 -2.7403002505093650e+02 + 63 2.5296775626791694e+02 -2.7640525289662742e+02 -1.9200401038407171e+02 + 64 -8.4674586435530216e+01 -1.5736397776830248e+02 1.5637348700621067e+02 ... From daf984835ca3fe8a19348d945b265f7174081fb9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 17:31:43 -0400 Subject: [PATCH 066/119] whitespace --- doc/src/fix_qeq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index ffc85dcf3b..6992db6bca 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -134,7 +134,7 @@ may be useful for testing and benchmarking purposes, as it allows to use a fixed number of QEq iterations when *tolerance* is set to a small enough value to alway reach the *maxiter* limit. Turning off warnings will avoid the excessive output in that case. - + The *qeq/point* style describes partial charges on atoms as point charges. Interaction between a pair of charged particles is 1/r, which is the simplest description of the interaction between charges. From 2a7e662d7185d9a41be122e8c7011177fc25c49c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Apr 2021 20:14:30 -0400 Subject: [PATCH 067/119] more whitespace --- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 90 ++++----- src/KOKKOS/pair_reaxc_kokkos.cpp | 2 +- src/KOKKOS/pair_reaxc_kokkos.h | 2 +- src/QEQ/fix_qeq.cpp | 2 +- src/QEQ/fix_qeq_dynamic.cpp | 2 +- src/QEQ/fix_qeq_fire.cpp | 2 +- src/QEQ/fix_qeq_point.cpp | 10 +- src/QEQ/fix_qeq_shielded.cpp | 24 +-- src/QEQ/fix_qeq_slater.cpp | 14 +- src/USER-OMP/fix_qeq_reax_omp.cpp | 98 +++++----- src/USER-OMP/reaxc_bond_orders_omp.cpp | 184 ++++++++--------- src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 72 +++---- src/USER-OMP/reaxc_multi_body_omp.cpp | 8 +- src/USER-OMP/reaxc_nonbonded_omp.cpp | 4 +- src/USER-OMP/reaxc_valence_angles_omp.cpp | 8 +- src/USER-REAXC/fix_qeq_reax.cpp | 14 +- src/USER-REAXC/fix_qeq_reax.h | 6 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 6 +- src/USER-REAXC/reaxc_bond_orders.cpp | 228 +++++++++++----------- src/USER-REAXC/reaxc_bonds.cpp | 20 +- src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 70 +++---- src/USER-REAXC/reaxc_init_md.cpp | 2 +- src/USER-REAXC/reaxc_multi_body.cpp | 26 +-- src/USER-REAXC/reaxc_nonbonded.cpp | 4 +- src/USER-REAXC/reaxc_reset_tools.cpp | 2 +- src/USER-REAXC/reaxc_valence_angles.cpp | 158 +++++++-------- src/USER-REAXC/reaxff_api.h | 4 +- src/USER-REAXC/reaxff_defs.h | 2 +- 28 files changed, 532 insertions(+), 532 deletions(-) diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index 1094d953b7..94ebd155e3 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -140,7 +140,7 @@ void FixQEqReaxKokkos::init_shielding_k() for (i = 1; i <= ntypes; ++i) for (j = 1; j <= ntypes; ++j) - k_shield.h_view(i,j) = pow( gamma[i] * gamma[j], -1.5 ); + k_shield.h_view(i,j) = pow(gamma[i] * gamma[j], -1.5); k_shield.template modify(); k_shield.template sync(); @@ -260,13 +260,13 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) FixQEqReaxKokkosMatVecFunctor matvec_functor(this); Kokkos::parallel_for(inum,matvec_functor); - // comm->forward_comm_fix(this); //Dist_vector( s ); + // comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 2; k_s.template modify(); comm->forward_comm_fix(this); k_s.template sync(); - // comm->forward_comm_fix(this); //Dist_vector( t ); + // comm->forward_comm_fix(this); //Dist_vector(t); pack_flag = 3; k_t.template modify(); comm->forward_comm_fix(this); @@ -731,7 +731,7 @@ int FixQEqReaxKokkos::cg_solve1() if (execution_space == Host) teamsize = 1; else teamsize = 128; - // sparse_matvec( &H, x, q ); + // sparse_matvec(&H, x, q); FixQEqReaxKokkosSparse12Functor sparse12_functor(this); Kokkos::parallel_for(inum,sparse12_functor); if (neighflag != FULL) { @@ -751,38 +751,38 @@ int FixQEqReaxKokkos::cg_solve1() if (neighflag != FULL) { k_o.template modify(); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->reverse_comm_fix(this); //Coll_vector(q); k_o.template sync(); } - // vector_sum( r , 1., b, -1., q, nn ); + // vector_sum(r , 1., b, -1., q, nn); // preconditioning: d[j] = r[j] * Hdia_inv[j]; - // b_norm = parallel_norm( b, nn ); + // b_norm = parallel_norm(b, nn); F_FLOAT my_norm = 0.0; FixQEqReaxKokkosNorm1Functor norm1_functor(this); Kokkos::parallel_reduce(inum,norm1_functor,my_norm); F_FLOAT norm_sqr = 0.0; - MPI_Allreduce( &my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); b_norm = sqrt(norm_sqr); - // sig_new = parallel_dot( r, d, nn); + // sig_new = parallel_dot(r, d, nn); F_FLOAT my_dot = 0.0; FixQEqReaxKokkosDot1Functor dot1_functor(this); Kokkos::parallel_reduce(inum,dot1_functor,my_dot); F_FLOAT dot_sqr = 0.0; - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); F_FLOAT sig_new = dot_sqr; int loop; for (loop = 1; (loop < imax) && (sqrt(sig_new)/b_norm > tolerance); loop++) { - // comm->forward_comm_fix(this); //Dist_vector( d ); + // comm->forward_comm_fix(this); //Dist_vector(d); pack_flag = 1; k_d.template modify(); comm->forward_comm_fix(this); k_d.template sync(); - // sparse_matvec( &H, d, q ); + // sparse_matvec(&H, d, q); FixQEqReaxKokkosSparse22Functor sparse22_functor(this); Kokkos::parallel_for(inum,sparse22_functor); if (neighflag != FULL) { @@ -804,36 +804,36 @@ int FixQEqReaxKokkos::cg_solve1() if (neighflag != FULL) { k_o.template modify(); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->reverse_comm_fix(this); //Coll_vector(q); k_o.template sync(); } - // tmp = parallel_dot( d, q, nn); + // tmp = parallel_dot(d, q, nn); my_dot = dot_sqr = 0.0; FixQEqReaxKokkosDot2Functor dot2_functor(this); Kokkos::parallel_reduce(inum,dot2_functor,my_dot); - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); tmp = dot_sqr; alpha = sig_new / tmp; sig_old = sig_new; - // vector_add( s, alpha, d, nn ); - // vector_add( r, -alpha, q, nn ); + // vector_add(s, alpha, d, nn); + // vector_add(r, -alpha, q, nn); my_dot = dot_sqr = 0.0; FixQEqReaxKokkosPrecon1Functor precon1_functor(this); Kokkos::parallel_for(inum,precon1_functor); // preconditioning: p[j] = r[j] * Hdia_inv[j]; - // sig_new = parallel_dot( r, p, nn); + // sig_new = parallel_dot(r, p, nn); FixQEqReaxKokkosPreconFunctor precon_functor(this); Kokkos::parallel_reduce(inum,precon_functor,my_dot); - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); sig_new = dot_sqr; beta = sig_new / sig_old; - // vector_sum( d, 1., p, beta, d, nn ); + // vector_sum(d, 1., p, beta, d, nn); FixQEqReaxKokkosVecSum2Functor vecsum2_functor(this); Kokkos::parallel_for(inum,vecsum2_functor); } @@ -859,7 +859,7 @@ int FixQEqReaxKokkos::cg_solve2() if (execution_space == Host) teamsize = 1; else teamsize = 128; - // sparse_matvec( &H, x, q ); + // sparse_matvec(&H, x, q); FixQEqReaxKokkosSparse32Functor sparse32_functor(this); Kokkos::parallel_for(inum,sparse32_functor); if (neighflag != FULL) { @@ -881,38 +881,38 @@ int FixQEqReaxKokkos::cg_solve2() if (neighflag != FULL) { k_o.template modify(); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->reverse_comm_fix(this); //Coll_vector(q); k_o.template sync(); } - // vector_sum( r , 1., b, -1., q, nn ); + // vector_sum(r , 1., b, -1., q, nn); // preconditioning: d[j] = r[j] * Hdia_inv[j]; - // b_norm = parallel_norm( b, nn ); + // b_norm = parallel_norm(b, nn); F_FLOAT my_norm = 0.0; FixQEqReaxKokkosNorm2Functor norm2_functor(this); Kokkos::parallel_reduce(inum,norm2_functor,my_norm); F_FLOAT norm_sqr = 0.0; - MPI_Allreduce( &my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); b_norm = sqrt(norm_sqr); - // sig_new = parallel_dot( r, d, nn); + // sig_new = parallel_dot(r, d, nn); F_FLOAT my_dot = 0.0; FixQEqReaxKokkosDot1Functor dot1_functor(this); Kokkos::parallel_reduce(inum,dot1_functor,my_dot); F_FLOAT dot_sqr = 0.0; - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); F_FLOAT sig_new = dot_sqr; int loop; for (loop = 1; (loop < imax) && (sqrt(sig_new)/b_norm > tolerance); loop++) { - // comm->forward_comm_fix(this); //Dist_vector( d ); + // comm->forward_comm_fix(this); //Dist_vector(d); pack_flag = 1; k_d.template modify(); comm->forward_comm_fix(this); k_d.template sync(); - // sparse_matvec( &H, d, q ); + // sparse_matvec(&H, d, q); FixQEqReaxKokkosSparse22Functor sparse22_functor(this); Kokkos::parallel_for(inum,sparse22_functor); if (neighflag != FULL) { @@ -934,36 +934,36 @@ int FixQEqReaxKokkos::cg_solve2() if (neighflag != FULL) { k_o.template modify(); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->reverse_comm_fix(this); //Coll_vector(q); k_o.template sync(); } - // tmp = parallel_dot( d, q, nn); + // tmp = parallel_dot(d, q, nn); my_dot = dot_sqr = 0.0; FixQEqReaxKokkosDot2Functor dot2_functor(this); Kokkos::parallel_reduce(inum,dot2_functor,my_dot); - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); tmp = dot_sqr; alpha = sig_new / tmp; sig_old = sig_new; - // vector_add( t, alpha, d, nn ); - // vector_add( r, -alpha, q, nn ); + // vector_add(t, alpha, d, nn); + // vector_add(r, -alpha, q, nn); my_dot = dot_sqr = 0.0; FixQEqReaxKokkosPrecon2Functor precon2_functor(this); Kokkos::parallel_for(inum,precon2_functor); // preconditioning: p[j] = r[j] * Hdia_inv[j]; - // sig_new = parallel_dot( r, p, nn); + // sig_new = parallel_dot(r, p, nn); FixQEqReaxKokkosPreconFunctor precon_functor(this); Kokkos::parallel_reduce(inum,precon_functor,my_dot); - MPI_Allreduce( &my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); sig_new = dot_sqr; beta = sig_new / sig_old; - // vector_sum( d, 1., p, beta, d, nn ); + // vector_sum(d, 1., p, beta, d, nn); FixQEqReaxKokkosVecSum2Functor vecsum2_functor(this); Kokkos::parallel_for(inum,vecsum2_functor); } @@ -984,18 +984,18 @@ void FixQEqReaxKokkos::calculate_q() F_FLOAT sum, sum_all; const int inum = list->inum; - // s_sum = parallel_vector_acc( s, nn ); + // s_sum = parallel_vector_acc(s, nn); sum = sum_all = 0.0; FixQEqReaxKokkosVecAcc1Functor vecacc1_functor(this); Kokkos::parallel_reduce(inum,vecacc1_functor,sum); - MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world); const F_FLOAT s_sum = sum_all; - // t_sum = parallel_vector_acc( t, nn); + // t_sum = parallel_vector_acc(t, nn); sum = sum_all = 0.0; FixQEqReaxKokkosVecAcc2Functor vecacc2_functor(this); Kokkos::parallel_reduce(inum,vecacc2_functor,sum); - MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world ); + MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world); const F_FLOAT t_sum = sum_all; // u = s_sum / t_sum; @@ -1007,7 +1007,7 @@ void FixQEqReaxKokkos::calculate_q() atomKK->modified(execution_space,Q_MASK); pack_flag = 4; - //comm->forward_comm_fix( this ); //Dist_vector( atom->q ); + //comm->forward_comm_fix(this); //Dist_vector(atom->q); comm->forward_comm_fix(this); } @@ -1382,11 +1382,11 @@ KOKKOS_INLINE_FUNCTION void FixQEqReaxKokkos::operator()(TagFixQEqReaxUnpackForwardComm, const int &i) const { if (pack_flag == 1) d_d[i + first] = d_buf[i]; - else if ( pack_flag == 2) + else if (pack_flag == 2) d_s[i + first] = d_buf[i]; - else if ( pack_flag == 3) + else if (pack_flag == 3) d_t[i + first] = d_buf[i]; - else if ( pack_flag == 4) + else if (pack_flag == 4) q[i + first] = d_buf[i]; } diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 04c70342ed..a5caad9fd2 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -2389,7 +2389,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular tdual_int_1d; Kokkos::DualView k_params_sing; diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index d6fe12abf8..d7e449492e 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -434,7 +434,7 @@ void FixQEq::sparse_matvec(sparse_matrix *A, double *x, double *b) for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) - b[i] = eta[ atom->type[i] ] * x[i]; + b[i] = eta[atom->type[i]] * x[i]; } for (i = nlocal; i < nall; ++i) { diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 5af7a4c9a0..4580b506b8 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -266,7 +266,7 @@ void FixQEqDynamic::unpack_forward_comm(int n, int first, double *buf) if (pack_flag == 1) for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; - else if ( pack_flag == 2) + else if (pack_flag == 2) for (m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; } diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 0e89ee3d17..7cd3c6ce71 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -326,7 +326,7 @@ void FixQEqFire::unpack_forward_comm(int n, int first, double *buf) if (pack_flag == 1) for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; - else if ( pack_flag == 2) + else if (pack_flag == 2) for (m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; } diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 8d60585773..faca995a69 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -109,18 +109,18 @@ void FixQEqPoint::init_matvec() for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -( chi[atom->type[i]] + chizj[i] ); + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -(chi[atom->type[i]] + chizj[i]); b_t[i] = -1.0; - t[i] = t_hist[i][2] + 3 * ( t_hist[i][0] - t_hist[i][1] ); + t[i] = t_hist[i][2] + 3 * (t_hist[i][0] - t_hist[i][1]); s[i] = 4*(s_hist[i][0]+s_hist[i][2])-(6*s_hist[i][1]+s_hist[i][3]); } } pack_flag = 2; - comm->forward_comm_fix(this); //Dist_vector( s ); + comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 3; - comm->forward_comm_fix(this); //Dist_vector( t ); + comm->forward_comm_fix(this); //Dist_vector(t); } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 351700057b..8b218f4028 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -108,7 +108,7 @@ void FixQEqShielded::init_shielding() int ntypes = atom->ntypes; for (i = 1; i <= ntypes; ++i) for (j = 1; j <= ntypes; ++j) - shld[i][j] = pow( gamma[i] * gamma[j], -1.5 ); + shld[i][j] = pow(gamma[i] * gamma[j], -1.5); if (fabs(swa) > 0.01 && comm->me == 0) error->warning(FLERR,"Fix qeq has non-zero lower Taper radius cutoff"); @@ -117,7 +117,7 @@ void FixQEqShielded::init_shielding() else if (swb < 5 && comm->me == 0) error->warning(FLERR,"Fix qeq has very low Taper radius cutoff"); - d7 = pow( swb - swa, 7 ); + d7 = pow(swb - swa, 7); swa2 = swa*swa; swa3 = swa2*swa; swb2 = swb*swb; @@ -126,12 +126,12 @@ void FixQEqShielded::init_shielding() Tap[7] = 20.0 / d7; Tap[6] = -70.0 * (swa + swb) / d7; Tap[5] = 84.0 * (swa2 + 3.0*swa*swb + swb2) / d7; - Tap[4] = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3 ) / d7; - Tap[3] = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3 ) / d7; + Tap[4] = -35.0 * (swa3 + 9.0*swa2*swb + 9.0*swa*swb2 + swb3) / d7; + Tap[3] = 140.0 * (swa3*swb + 3.0*swa2*swb2 + swa*swb3) / d7; Tap[2] =-210.0 * (swa3*swb2 + swa2*swb3) / d7; Tap[1] = 140.0 * swa3 * swb3 / d7; Tap[0] = (-35.0*swa3*swb2*swb2 + 21.0*swa2*swb3*swb2 - - 7.0*swa*swb3*swb3 + swb3*swb3*swb ) / d7; + 7.0*swa*swb3*swb3 + swb3*swb3*swb) / d7; } /* ---------------------------------------------------------------------- */ @@ -171,18 +171,18 @@ void FixQEqShielded::init_matvec() for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -( chi[atom->type[i]] + chizj[i] ); + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -(chi[atom->type[i]] + chizj[i]); b_t[i] = -1.0; - t[i] = t_hist[i][2] + 3 * ( t_hist[i][0] - t_hist[i][1] ); + t[i] = t_hist[i][2] + 3 * (t_hist[i][0] - t_hist[i][1]); s[i] = 4*(s_hist[i][0]+s_hist[i][2])-(6*s_hist[i][1]+s_hist[i][3]); } } pack_flag = 2; - comm->forward_comm_fix(this); //Dist_vector( s ); + comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 3; - comm->forward_comm_fix(this); //Dist_vector( t ); + comm->forward_comm_fix(this); //Dist_vector(t); } /* ---------------------------------------------------------------------- */ @@ -225,7 +225,7 @@ void FixQEqShielded::compute_H() if (r_sqr <= cutoff_sq) { H.jlist[m_fill] = j; r = sqrt(r_sqr); - H.val[m_fill] = 0.5 * calculate_H( r, shld[type[i]][type[j]] ); + H.val[m_fill] = 0.5 * calculate_H(r, shld[type[i]][type[j]]); m_fill++; } } @@ -240,7 +240,7 @@ void FixQEqShielded::compute_H() /* ---------------------------------------------------------------------- */ -double FixQEqShielded::calculate_H( double r, double gamma ) +double FixQEqShielded::calculate_H(double r, double gamma) { double Taper, denom; diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index da0d2090cf..975caf5c81 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -147,18 +147,18 @@ void FixQEqSlater::init_matvec() for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -( chi[atom->type[i]] + chizj[i] ); + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -(chi[atom->type[i]] + chizj[i]); b_t[i] = -1.0; - t[i] = t_hist[i][2] + 3 * ( t_hist[i][0] - t_hist[i][1] ); + t[i] = t_hist[i][2] + 3 * (t_hist[i][0] - t_hist[i][1]); s[i] = 4*(s_hist[i][0]+s_hist[i][2])-(6*s_hist[i][1]+s_hist[i][3]); } } pack_flag = 2; - comm->forward_comm_fix(this); //Dist_vector( s ); + comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 3; - comm->forward_comm_fix(this); //Dist_vector( t ); + comm->forward_comm_fix(this); //Dist_vector(t); } /* ---------------------------------------------------------------------- */ @@ -346,7 +346,7 @@ double FixQEqSlater::calculate_H_wolf(double zei, double zej, double zj, /* ---------------------------------------------------------------------- */ -void FixQEqSlater::sparse_matvec( sparse_matrix *A, double *x, double *b ) +void FixQEqSlater::sparse_matvec(sparse_matrix *A, double *x, double *b) { int i, j, itr_j; @@ -368,7 +368,7 @@ void FixQEqSlater::sparse_matvec( sparse_matrix *A, double *x, double *b ) for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) { - for( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { + for(itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; b[i] += A->val[itr_j] * x[j]; b[j] += A->val[itr_j] * x[i]; diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 52e9565a46..b4a878f126 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -212,7 +212,7 @@ void FixQEqReaxOMP::compute_H() if (flag) { H.jlist[mfill] = j; - H.val[mfill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]] ); + H.val[mfill] = calculate_H(sqrt(r_sqr), shld[type[i]][type[j]]); mfill++; } } @@ -307,8 +307,8 @@ void FixQEqReaxOMP::init_matvec() if (atom->mask[i] & groupbit) { /* init pre-conditioner for H and init solution vectors */ - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -chi[ atom->type[i] ]; + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -chi[atom->type[i]]; b_t[i] = -1.0; // Predictor Step @@ -335,8 +335,8 @@ void FixQEqReaxOMP::init_matvec() if (atom->mask[i] & groupbit) { /* init pre-conditioner for H and init solution vectors */ - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -chi[ atom->type[i] ]; + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -chi[atom->type[i]]; b_t[i] = -1.0; /* linear extrapolation for s & t from previous solutions */ @@ -344,8 +344,8 @@ void FixQEqReaxOMP::init_matvec() //t[i] = 2 * t_hist[i][0] - t_hist[i][1]; /* quadratic extrapolation for s & t from previous solutions */ - //s[i] = s_hist[i][2] + 3 * ( s_hist[i][0] - s_hist[i][1] ); - t[i] = t_hist[i][2] + 3 * ( t_hist[i][0] - t_hist[i][1] ); + //s[i] = s_hist[i][2] + 3 * (s_hist[i][0] - s_hist[i][1]); + t[i] = t_hist[i][2] + 3 * (t_hist[i][0] - t_hist[i][1]); /* cubic extrapolation for s & t from previous solutions */ s[i] = 4*(s_hist[i][0]+s_hist[i][2])-(6*s_hist[i][1]+s_hist[i][3]); @@ -355,14 +355,14 @@ void FixQEqReaxOMP::init_matvec() } pack_flag = 2; - comm->forward_comm_fix(this); //Dist_vector( s ); + comm->forward_comm_fix(this); //Dist_vector(s); pack_flag = 3; - comm->forward_comm_fix(this); //Dist_vector( t ); + comm->forward_comm_fix(this); //Dist_vector(t); } /* ---------------------------------------------------------------------- */ -int FixQEqReaxOMP::CG( double *b, double *x) +int FixQEqReaxOMP::CG(double *b, double *x) { int i; double alpha, beta, b_norm; @@ -371,8 +371,8 @@ int FixQEqReaxOMP::CG( double *b, double *x) double my_buf[2], buf[2]; pack_flag = 1; - sparse_matvec( &H, x, q ); - comm->reverse_comm_fix( this); //Coll_Vector( q ); + sparse_matvec(&H, x, q); + comm->reverse_comm_fix(this); //Coll_Vector(q); double tmp1, tmp2; tmp1 = tmp2 = 0.0; @@ -400,9 +400,9 @@ int FixQEqReaxOMP::CG( double *b, double *x) sig_new = buf[1]; for (i = 1; i < imax && sqrt(sig_new) / b_norm > tolerance; ++i) { - comm->forward_comm_fix(this); //Dist_vector( d ); - sparse_matvec( &H, d, q ); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->forward_comm_fix(this); //Dist_vector(d); + sparse_matvec(&H, d, q); + comm->reverse_comm_fix(this); //Coll_vector(q); tmp1 = 0.0; #if defined(_OPENMP) @@ -471,7 +471,7 @@ int FixQEqReaxOMP::CG( double *b, double *x) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::sparse_matvec( sparse_matrix *A, double *x, double *b) +void FixQEqReaxOMP::sparse_matvec(sparse_matrix *A, double *x, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) @@ -491,7 +491,7 @@ void FixQEqReaxOMP::sparse_matvec( sparse_matrix *A, double *x, double *b) #endif for (ii = 0; ii < nn; ++ii) { i = ilist[ii]; - if (atom->mask[i] & groupbit) b[i] = eta[ atom->type[i] ] * x[i]; + if (atom->mask[i] & groupbit) b[i] = eta[atom->type[i]] * x[i]; } #if defined(_OPENMP) @@ -586,12 +586,12 @@ void FixQEqReaxOMP::calculate_Q() } pack_flag = 4; - comm->forward_comm_fix( this); //Dist_vector( atom->q ); + comm->forward_comm_fix(this); //Dist_vector(atom->q); } /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::vector_sum( double* dest, double c, double* v, +void FixQEqReaxOMP::vector_sum(double* dest, double c, double* v, double d, double* y, int k) { int i; @@ -607,7 +607,7 @@ void FixQEqReaxOMP::vector_sum( double* dest, double c, double* v, /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::vector_add( double* dest, double c, double* v, int k) +void FixQEqReaxOMP::vector_add(double* dest, double c, double* v, int k) { int i; @@ -626,7 +626,7 @@ void FixQEqReaxOMP::vector_add( double* dest, double c, double* v, int k) /* dual CG support */ /* ---------------------------------------------------------------------- */ -int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) +int FixQEqReaxOMP::dual_CG(double *b1, double *b2, double *x1, double *x2) { int i; double alpha_s, alpha_t, beta_s, beta_t, b_norm_s, b_norm_t; @@ -635,8 +635,8 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) double my_buf[4], buf[4]; pack_flag = 5; // forward 2x d and reverse 2x q - dual_sparse_matvec( &H, x1, x2, q ); - comm->reverse_comm_fix(this); //Coll_Vector( q ); + dual_sparse_matvec(&H, x1, x2, q); + comm->reverse_comm_fix(this); //Coll_Vector(q); double tmp1, tmp2, tmp3, tmp4; tmp1 = tmp2 = tmp3 = tmp4 = 0.0; @@ -648,16 +648,16 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) int ii = ilist[jj]; if (atom->mask[ii] & groupbit) { int indxI = 2 * ii; - r[indxI ] = b1[ii] - q[indxI ]; + r[indxI] = b1[ii] - q[indxI]; r[indxI+1] = b2[ii] - q[indxI+1]; - d[indxI ] = r[indxI ] * Hdia_inv[ii]; //pre-condition + d[indxI] = r[indxI] * Hdia_inv[ii]; //pre-condition d[indxI+1] = r[indxI+1] * Hdia_inv[ii]; tmp1 += b1[ii] * b1[ii]; tmp2 += b2[ii] * b2[ii]; - tmp3 += r[indxI ] * d[indxI ]; + tmp3 += r[indxI] * d[indxI]; tmp4 += r[indxI+1] * d[indxI+1]; } } @@ -676,9 +676,9 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) sig_new_t = buf[3]; for (i = 1; i < imax; ++i) { - comm->forward_comm_fix(this); //Dist_vector( d ); - dual_sparse_matvec( &H, d, q ); - comm->reverse_comm_fix(this); //Coll_vector( q ); + comm->forward_comm_fix(this); //Dist_vector(d); + dual_sparse_matvec(&H, d, q); + comm->reverse_comm_fix(this); //Coll_vector(q); tmp1 = tmp2 = 0.0; #if defined(_OPENMP) @@ -693,7 +693,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) int ii = ilist[jj]; if (atom->mask[ii] & groupbit) { int indxI = 2 * ii; - tmp1 += d[indxI ] * q[indxI ]; + tmp1 += d[indxI] * q[indxI]; tmp2 += d[indxI+1] * q[indxI+1]; } } @@ -722,17 +722,17 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) int ii = ilist[jj]; if (atom->mask[ii] & groupbit) { int indxI = 2 * ii; - x1[ii] += alpha_s * d[indxI ]; + x1[ii] += alpha_s * d[indxI]; x2[ii] += alpha_t * d[indxI+1]; - r[indxI ] -= alpha_s * q[indxI ]; + r[indxI] -= alpha_s * q[indxI]; r[indxI+1] -= alpha_t * q[indxI+1]; // pre-conditioning - p[indxI ] = r[indxI ] * Hdia_inv[ii]; + p[indxI] = r[indxI] * Hdia_inv[ii]; p[indxI+1] = r[indxI+1] * Hdia_inv[ii]; - tmp1 += r[indxI ] * p[indxI ]; + tmp1 += r[indxI] * p[indxI]; tmp2 += r[indxI+1] * p[indxI+1]; } } @@ -763,7 +763,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) if (atom->mask[ii] & groupbit) { int indxI = 2 * ii; - d[indxI ] = p[indxI ] + beta_s * d[indxI ]; + d[indxI] = p[indxI] + beta_s * d[indxI]; d[indxI+1] = p[indxI+1] + beta_t * d[indxI+1]; } } @@ -798,7 +798,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2, double *b) +void FixQEqReaxOMP::dual_sparse_matvec(sparse_matrix *A, double *x1, double *x2, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) @@ -822,8 +822,8 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2 i = ilist[ii]; if (atom->mask[i] & groupbit) { indxI = 2 * i; - b[indxI ] = eta[ atom->type[i] ] * x1[i]; - b[indxI+1] = eta[ atom->type[i] ] * x2[i]; + b[indxI] = eta[atom->type[i]] * x1[i]; + b[indxI+1] = eta[atom->type[i]] * x2[i]; } } @@ -845,7 +845,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2 for (i = 0; i < NN; ++i) { indxI = 2 * i; for (int t=0; tfirstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; indxJ = 2 * j; - b[indxI ] += A->val[itr_j] * x1[j]; + b[indxI] += A->val[itr_j] * x1[j]; b[indxI+1] += A->val[itr_j] * x2[j]; - b_temp[tid][indxJ ] += A->val[itr_j] * x1[i]; + b_temp[tid][indxJ] += A->val[itr_j] * x1[i]; b_temp[tid][indxJ+1] += A->val[itr_j] * x2[i]; } } @@ -879,7 +879,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2 for (i = 0; i < NN; ++i) { indxI = 2 * i; for (int t = 0; t < nthreads; ++t) { - b[indxI ] += b_temp[t][indxI ]; + b[indxI] += b_temp[t][indxI]; b[indxI+1] += b_temp[t][indxI+1]; } } @@ -889,7 +889,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2 /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b ) +void FixQEqReaxOMP::dual_sparse_matvec(sparse_matrix *A, double *x, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) @@ -913,8 +913,8 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b ) i = ilist[ii]; if (atom->mask[i] & groupbit) { indxI = 2 * i; - b[indxI ] = eta[ atom->type[i] ] * x[indxI ]; - b[indxI+1] = eta[ atom->type[i] ] * x[indxI+1]; + b[indxI] = eta[atom->type[i]] * x[indxI]; + b[indxI+1] = eta[atom->type[i]] * x[indxI+1]; } } @@ -936,7 +936,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b ) for (i = 0; i < NN; ++i) { indxI = 2 * i; for (int t=0; tfirstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; indxJ = 2 * j; - b[indxI ] += A->val[itr_j] * x[indxJ ]; + b[indxI] += A->val[itr_j] * x[indxJ]; b[indxI+1] += A->val[itr_j] * x[indxJ+1]; - b_temp[tid][indxJ ] += A->val[itr_j] * x[indxI ]; + b_temp[tid][indxJ] += A->val[itr_j] * x[indxI]; b_temp[tid][indxJ+1] += A->val[itr_j] * x[indxI+1]; } } @@ -970,7 +970,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b ) for (i = 0; i < NN; ++i) { indxI = 2 * i; for (int t = 0; t < nthreads; ++t) { - b[indxI ] += b_temp[t][indxI ]; + b[indxI] += b_temp[t][indxI]; b[indxI+1] += b_temp[t][indxI+1]; } } diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index c3c1fb37df..6434c3d03a 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -58,7 +58,7 @@ namespace ReaxFF { nbr_j = &(bonds->select.bond_list[pj]); j = nbr_j->nbr; bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); double c = bo_ij->Cdbo + bo_ji->Cdbo; coef.C1dbo = bo_ij->C1dbo * c; @@ -83,19 +83,19 @@ namespace ReaxFF { coef.C3dDelta = bo_ij->C3dbo * c; c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp ); + rvec_Scale( temp, c, bo_ij->dBOp); c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); - rvec_ScaledAdd( temp, c, workspace->dDeltap_self[i] ); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[i]); - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); + rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); - rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+i],temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fi_tmp, -1.0, temp); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, fi_tmp[0],fi_tmp[1],fi_tmp[2], @@ -103,20 +103,20 @@ namespace ReaxFF { } c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp ); + rvec_Scale( temp, c, bo_ij->dBOp); c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); - rvec_ScaledAdd( temp, c, workspace->dDeltap_self[j] ); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[j]); - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); - rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+j],temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fj_tmp, -1.0, temp); - rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); + rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, fj_tmp[0],fj_tmp[1],fj_tmp[2], @@ -128,15 +128,15 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); + // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); rvec_Scale(temp, c, nbr_k->bo_data.dBOp); - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fk_tmp, -1.0, temp); @@ -158,15 +158,15 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); - // rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); + // rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); rvec_Scale(temp, c, nbr_k->bo_data.dBOp); - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fk_tmp, -1.0, temp); @@ -203,7 +203,7 @@ namespace ReaxFF { nbr_j = &(bonds->select.bond_list[pj]); j = nbr_j->nbr; bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); @@ -238,59 +238,59 @@ namespace ReaxFF { rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); } /* then atom i itself */ - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ + rvec_Scale(temp, coef.C1dbo, bo_ij->dBOp); /*1st,dBO*/ + rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); /*2nd,dBO*/ + rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); /*1st,dBO*/ + rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]);/*2nd,dBO*/ + rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ + rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ + rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ + rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBO_pi2*/ + rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBO_pi2*/ + rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]);/*3rd*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+i],temp); for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ + rvec_Scale(temp, -coef.C3dbo, nbr_k->bo_data.dBOp); /*3rd,dBO*/ + rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); } /* then atom j itself */ - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ + rvec_Scale(temp, -coef.C1dbo, bo_ij->dBOp); /*1st, dBO*/ + rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); /*2nd, dBO*/ + rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); /*1st, dBO*/ + rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ + rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ - rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ + rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBOpi2*/ + rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBOpi2*/ + rvec_ScaledAdd(temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+j],temp ); + rvec_Add(workspace->forceReduction[reductionOffset+j],temp); } /* ---------------------------------------------------------------------- */ - int BOp_OMP( storage * /* workspace */, reax_list *bonds, double bo_cut, + int BOp_OMP(storage * /* workspace */, reax_list *bonds, double bo_cut, int i, int btop_i, far_neighbor_data *nbr_pj, single_body_parameters * /* sbp_i */, single_body_parameters * /* sbp_j */, two_body_parameters *twbp, @@ -309,24 +309,24 @@ namespace ReaxFF { /* Initially BO values are the uncorrected ones, page 1 */ /****** bonds i-j and j-i ******/ - ibond = &( bonds->select.bond_list[btop_i] ); - jbond = &( bonds->select.bond_list[btop_j] ); + ibond = &(bonds->select.bond_list[btop_i]); + jbond = &(bonds->select.bond_list[btop_j]); ibond->nbr = j; jbond->nbr = i; ibond->d = nbr_pj->d; jbond->d = nbr_pj->d; - rvec_Copy( ibond->dvec, nbr_pj->dvec ); - rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); - ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); - ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); + rvec_Copy(ibond->dvec, nbr_pj->dvec); + rvec_Scale(jbond->dvec, -1, nbr_pj->dvec); + ivec_Copy(ibond->rel_box, nbr_pj->rel_box); + ivec_Scale(jbond->rel_box, -1, nbr_pj->rel_box); ibond->dbond_index = btop_i; jbond->dbond_index = btop_i; ibond->sym_index = btop_j; jbond->sym_index = btop_i; - bo_ij = &( ibond->bo_data ); - bo_ji = &( jbond->bo_data ); + bo_ij = &(ibond->bo_data); + bo_ji = &(jbond->bo_data); bo_ji->BO = bo_ij->BO = BO; bo_ji->BO_s = bo_ij->BO_s = BO_s; bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; @@ -344,14 +344,14 @@ namespace ReaxFF { rvec_Scale(bo_ij->dln_BOp_pi2, -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); - rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); - rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); + rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi); + rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2); - rvec_Scale( bo_ij->dBOp, + rvec_Scale(bo_ij->dBOp, -(bo_ij->BO_s * Cln_BOp_s + bo_ij->BO_pi * Cln_BOp_pi + - bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); - rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); + bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec); + rvec_Scale(bo_ji->dBOp, -1., bo_ij->dBOp); bo_ij->BO_s -= bo_cut; bo_ij->BO -= bo_cut; @@ -366,7 +366,7 @@ namespace ReaxFF { /* ---------------------------------------------------------------------- */ - void BOOMP( reax_system *system, storage *workspace, reax_list **lists) + void BOOMP(reax_system *system, storage *workspace, reax_list **lists) { double p_lp1 = system->reax_param.gp.l[15]; double p_boc1 = system->reax_param.gp.l[0]; @@ -428,10 +428,10 @@ namespace ReaxFF { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; if (type_j < 0) continue; - bo_ij = &( bonds->select.bond_list[pj].bo_data ); + bo_ij = &(bonds->select.bond_list[pj].bo_data); if (i < j || workspace->bond_mark[j] > 3) { - twbp = &( system->reax_param.tbp[type_i][type_j] ); + twbp = &(system->reax_param.tbp[type_i][type_j]); if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { bo_ij->C1dbo = 1.000000; @@ -456,38 +456,38 @@ namespace ReaxFF { /* on page 1 */ if (twbp->ovc >= 0.001) { /* Correction for overcoordination */ - exp_p1i = exp( -p_boc1 * Deltap_i ); - exp_p2i = exp( -p_boc2 * Deltap_i ); - exp_p1j = exp( -p_boc1 * Deltap_j ); - exp_p2j = exp( -p_boc2 * Deltap_j ); + exp_p1i = exp(-p_boc1 * Deltap_i); + exp_p2i = exp(-p_boc2 * Deltap_i); + exp_p1j = exp(-p_boc1 * Deltap_j); + exp_p2j = exp(-p_boc2 * Deltap_j); f2 = exp_p1i + exp_p1j; - f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); - f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + - ( val_j + f2 )/( val_j + f2 + f3 ) ); + f3 = -1.0 / p_boc2 * log(0.5 * (exp_p2i + exp_p2j)); + f1 = 0.5 * ((val_i + f2)/(val_i + f2 + f3) + + (val_j + f2)/(val_j + f2 + f3)); /* Now come the derivates */ /* Bond Order pages 5-7, derivative of f1 */ temp = f2 + f3; u1_ij = val_i + temp; u1_ji = val_j + temp; - Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + - 1.0 / SQR( u1_ji )); - Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + - ( u1_ji - f3 ) / SQR( u1_ji )); + Cf1A_ij = 0.5 * f3 * (1.0 / SQR(u1_ij) + + 1.0 / SQR(u1_ji)); + Cf1B_ij = -0.5 * ((u1_ij - f3) / SQR(u1_ij) + + (u1_ji - f3) / SQR(u1_ji)); - Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - + Cf1_ij = 0.50 * (-p_boc1 * exp_p1i / u1_ij - ((val_i+f2) / SQR(u1_ij)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) ) + + (-p_boc1 * exp_p1i + + exp_p2i / (exp_p2i + exp_p2j)) + -p_boc1 * exp_p1i / u1_ji - ((val_j+f2) / SQR(u1_ji)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) )); + (-p_boc1 * exp_p1i + + exp_p2i / (exp_p2i + exp_p2j))); Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + - Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); + Cf1B_ij * exp_p2j / (exp_p2i + exp_p2j); } else { /* No overcoordination correction! */ f1 = 1.0; @@ -496,9 +496,9 @@ namespace ReaxFF { if (twbp->v13cor >= 0.001) { /* Correction for 1-3 bond orders */ - exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + exp_f4 =exp(-(twbp->p_boc4 * SQR(bo_ij->BO) - Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); - exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + exp_f5 =exp(-(twbp->p_boc4 * SQR(bo_ij->BO) - Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); f4 = 1. / (1. + exp_f4); @@ -526,7 +526,7 @@ namespace ReaxFF { bo_ij->BO = bo_ij->BO * A0_ij; bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; - bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); + bo_ij->BO_s = bo_ij->BO - (bo_ij->BO_pi + bo_ij->BO_pi2); bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; bo_ij->C2dbo = bo_ij->BO * A2_ij; @@ -585,8 +585,8 @@ namespace ReaxFF { everything else is set in uncorrected_bo calculations */ sym_index = bonds->select.bond_list[pj].sym_index; - bo_ij = &( bonds->select.bond_list[pj].bo_data ); - bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); + bo_ij = &(bonds->select.bond_list[pj].bo_data); + bo_ji = &(bonds->select.bond_list[sym_index].bo_data); bo_ij->BO = bo_ji->BO; bo_ij->BO_s = bo_ji->BO_s; bo_ij->BO_pi = bo_ji->BO_pi; @@ -612,7 +612,7 @@ namespace ReaxFF { for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[ type_j ]); + sbp_j = &(system->reax_param.sbp[type_j]); workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index 8c9ffe577e..5ce70b74fb 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -41,7 +41,7 @@ namespace ReaxFF { /* ---------------------------------------------------------------------- */ - void Hydrogen_BondsOMP( reax_system *system, control_params *control, + void Hydrogen_BondsOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists) { @@ -105,20 +105,20 @@ namespace ReaxFF { type_j = system->my_atoms[j].type; start_j = Start_Index(j, bonds); end_j = End_Index(j, bonds); - hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); - hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); + hb_start_j = Start_Index(system->my_atoms[j].Hindex, hbonds); + hb_end_j = End_Index(system->my_atoms[j].Hindex, hbonds); if (type_j < 0) continue; top = 0; for (pi = start_j; pi < end_j; ++pi) { - pbond_ij = &( bond_list[pi] ); + pbond_ij = &(bond_list[pi]); i = pbond_ij->nbr; type_i = system->my_atoms[i].type; if (type_i < 0) continue; bo_ij = &(pbond_ij->bo_data); - if ( system->reax_param.sbp[type_i].p_hbond == 2 && - bo_ij->BO >= HB_THRESHOLD ) + if (system->reax_param.sbp[type_i].p_hbond == 2 && + bo_ij->BO >= HB_THRESHOLD) hblist[top++] = pi; } @@ -129,35 +129,35 @@ namespace ReaxFF { if (type_k < 0) continue; nbr_jk = hbond_list[pk].ptr; r_jk = nbr_jk->d; - rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); + rvec_Scale(dvec_jk, hbond_list[pk].scl, nbr_jk->dvec); for (itr = 0; itr < top; ++itr) { pi = hblist[itr]; - pbond_ij = &( bonds->select.bond_list[pi] ); + pbond_ij = &(bonds->select.bond_list[pi]); i = pbond_ij->nbr; if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { bo_ij = &(pbond_ij->bo_data); type_i = system->my_atoms[i].type; if (type_i < 0) continue; - hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); + hbp = &(system->reax_param.hbp[type_i][type_j][type_k]); ++num_hb_intrs; - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &theta, &cos_theta ); + Calculate_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &theta, &cos_theta); /* the derivative of cos(theta) */ - Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + Calculate_dCos_ThetaOMP(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, &dcos_theta_di, &dcos_theta_dj, - &dcos_theta_dk ); + &dcos_theta_dk); /* hydrogen bond energy*/ - sin_theta2 = sin( theta/2.0 ); + sin_theta2 = sin(theta/2.0); sin_xhz4 = SQR(sin_theta2); sin_xhz4 *= sin_xhz4; - cos_xhz1 = ( 1.0 - cos_theta ); - exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); - exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + - r_jk / hbp->r0_hb - 2.0 ) ); + cos_xhz1 = (1.0 - cos_theta); + exp_hb2 = exp(-hbp->p_hb2 * bo_ij->BO); + exp_hb3 = exp(-hbp->p_hb3 * (hbp->r0_hb / r_jk + + r_jk / hbp->r0_hb - 2.0)); e_hb_thr += e_hb = hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; @@ -171,38 +171,38 @@ namespace ReaxFF { if (control->virial == 0) { // dcos terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk); // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk ); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk); } else { /* for pressure coupling, terms that are not related to bond order derivatives are added directly into pressure vector/tensor */ - rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms - rvec_Add(workspace->forceReduction[reductionOffset+i], force ); + rvec_Scale(force, +CEhb2, dcos_theta_di); // dcos terms + rvec_Add(workspace->forceReduction[reductionOffset+i], force); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj); - ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); - rvec_Scale( force, +CEhb2, dcos_theta_dk ); - rvec_Add(workspace->forceReduction[reductionOffset+k], force ); + ivec_Scale(rel_jk, hbond_list[pk].scl, nbr_jk->rel_box); + rvec_Scale(force, +CEhb2, dcos_theta_dk); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk); - rvec_Scale( force, CEhb3/r_jk, dvec_jk ); - rvec_Add(workspace->forceReduction[reductionOffset+k], force ); + rvec_Scale(force, CEhb3/r_jk, dvec_jk); + rvec_Add(workspace->forceReduction[reductionOffset+k], force); } /* tally into per-atom virials */ if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - rvec_ScaledSum( delij, 1., system->my_atoms[j].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, - -1., system->my_atoms[k].x ); + rvec_ScaledSum(delij, 1., system->my_atoms[j].x, + -1., system->my_atoms[i].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[j].x, + -1., system->my_atoms[k].x); rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp index 2ec73e738b..7a24ac5fce 100644 --- a/src/USER-OMP/reaxc_multi_body_omp.cpp +++ b/src/USER-OMP/reaxc_multi_body_omp.cpp @@ -93,7 +93,7 @@ namespace ReaxFF { for (i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + sbp_i = &(system->reax_param.sbp[type_i]); /* lone-pair Energy */ p_lp2 = sbp_i->p_lp2; @@ -158,7 +158,7 @@ namespace ReaxFF { for (i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; - sbp_i = &(system->reax_param.sbp[ type_i ]); + sbp_i = &(system->reax_param.sbp[type_i]); /* over-coordination energy */ if (sbp_i->mass > 21.0) @@ -172,7 +172,7 @@ namespace ReaxFF { type_j = system->my_atoms[j].type; if (type_j < 0) continue; bo_ij = &(bonds->select.bond_list[pj].bo_data); - twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); + twbp = &(system->reax_param.tbp[type_i][type_j]); sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* @@ -243,7 +243,7 @@ namespace ReaxFF { pbond = &(bonds->select.bond_list[pj]); j = pbond->nbr; bo_ij = &(pbond->bo_data); - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] + twbp = &(system->reax_param.tbp[system->my_atoms[i].type] [system->my_atoms[pbond->nbr].type]); bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s; // OvCoor-1st diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index 496e5476b0..9ca7ba41a9 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -112,8 +112,8 @@ namespace ReaxFF { if (flag) { r_ij = nbr_pj->d; - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] - [ system->my_atoms[j].type ]); + twbp = &(system->reax_param.tbp[system->my_atoms[i].type] + [system->my_atoms[j].type]); /* Calculate Taper and its derivative */ // Tap = nbr_pj->Tap; -- precomputed during compte_H diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 4719fcfbab..690fea14af 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -276,8 +276,8 @@ namespace ReaxFF { my_offset = _my_offset[j]; - p_val3 = system->reax_param.sbp[ type_j ].p_val3; - p_val5 = system->reax_param.sbp[ type_j ].p_val5; + p_val3 = system->reax_param.sbp[type_j].p_val3; + p_val5 = system->reax_param.sbp[type_j].p_val5; SBOp = 0, prod_SBO = 1; for (t = start_j; t < end_j; ++t) { @@ -390,7 +390,7 @@ namespace ReaxFF { (bo_ij->BO > control->thb_cut) && (bo_jk->BO > control->thb_cut) && (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { - thbh = &(system->reax_param.thbp[ type_i ][ type_j ][ type_k ]); + thbh = &(system->reax_param.thbp[type_i][type_j][type_k]); for (cnt = 0; cnt < thbh->cnt; ++cnt) { @@ -457,7 +457,7 @@ namespace ReaxFF { exp_pen2ij = exp(-p_pen2 * SQR(BOA_ij - 2.0)); exp_pen2jk = exp(-p_pen2 * SQR(BOA_jk - 2.0)); exp_pen3 = exp(-p_pen3 * workspace->Delta[j]); - exp_pen4 = exp( p_pen4 * workspace->Delta[j]); + exp_pen4 = exp(p_pen4 * workspace->Delta[j]); trm_pen34 = 1.0 + exp_pen3 + exp_pen4; f9_Dj = (2.0 + exp_pen3) / trm_pen34; Cf9j = (-p_pen3 * exp_pen3 * trm_pen34 - diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 493d9cd508..eef7df53fd 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -593,8 +593,8 @@ void FixQEqReax::init_matvec() if (atom->mask[i] & groupbit) { /* init pre-conditioner for H and init solution vectors */ - Hdia_inv[i] = 1. / eta[ atom->type[i] ]; - b_s[i] = -chi[ atom->type[i] ]; + Hdia_inv[i] = 1. / eta[atom->type[i]]; + b_s[i] = -chi[atom->type[i]]; b_t[i] = -1.0; /* quadratic extrapolation for s & t from previous solutions */ @@ -761,7 +761,7 @@ void FixQEqReax::sparse_matvec(sparse_matrix *A, double *x, double *b) for (ii = 0; ii < nn; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) - b[i] = eta[ atom->type[i] ] * x[i]; + b[i] = eta[atom->type[i]] * x[i]; } for (ii = nn; ii < NN; ++ii) { @@ -835,7 +835,7 @@ int FixQEqReax::pack_forward_comm(int n, int *list, double *buf, m = 0; for (int i = 0; i < n; i++) { int j = 2 * list[i]; - buf[m++] = d[j ]; + buf[m++] = d[j]; buf[m++] = d[j+1]; } return m; @@ -862,7 +862,7 @@ void FixQEqReax::unpack_forward_comm(int n, int first, double *buf) m = 0; for (i = first; i < last; i++) { int j = 2 * i; - d[j ] = buf[m++]; + d[j] = buf[m++]; d[j+1] = buf[m++]; } } @@ -878,7 +878,7 @@ int FixQEqReax::pack_reverse_comm(int n, int first, double *buf) int last = first + n; for (i = first; i < last; i++) { int indxI = 2 * i; - buf[m++] = q[indxI ]; + buf[m++] = q[indxI]; buf[m++] = q[indxI+1]; } return m; @@ -896,7 +896,7 @@ void FixQEqReax::unpack_reverse_comm(int n, int *list, double *buf) int m = 0; for (int i = 0; i < n; i++) { int indxI = 2 * list[i]; - q[indxI ] += buf[m++]; + q[indxI] += buf[m++]; q[indxI+1] += buf[m++]; } } else { diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index 9237e3e7ff..9fc20f35d0 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -127,9 +127,9 @@ class FixQEqReax : public Fix { virtual int pack_exchange(int, double *); virtual int unpack_exchange(int, double *); - virtual double parallel_norm( double*, int ); - virtual double parallel_dot( double*, double*, int ); - virtual double parallel_vector_acc( double*, int ); + virtual double parallel_norm(double*, int); + virtual double parallel_dot(double*, double*, int); + virtual double parallel_vector_acc(double*, int); virtual void vector_sum(double*,double,double*,double,double*,int); virtual void vector_add(double*, double, double*,int); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index c741259810..58065e3276 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -47,7 +47,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0 ) + if (nevery <= 0) error->all(FLERR,"Illegal fix reax/c/bonds command"); if (me == 0) { @@ -194,7 +194,7 @@ void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) nj = 0; for (pj = Start_Index(i, reaxc->api->lists); pj < End_Index(i, reaxc->api->lists); ++pj) { - bo_ij = &( reaxc->api->lists->select.bond_list[pj] ); + bo_ij = &(reaxc->api->lists->select.bond_list[pj]); j = bo_ij->nbr; jtag = tag[j]; bo_tmp = bo_ij->bo_data.BO; @@ -233,7 +233,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) } j += (5+numbonds); - if (atom->molecule == nullptr ) buf[j] = 0.0; + if (atom->molecule == nullptr) buf[j] = 0.0; else buf[j] = atom->molecule[i]; j ++; diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index f6e923406d..c3fda58173 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -31,7 +31,7 @@ #include namespace ReaxFF { - void Add_dBond_to_Forces_NPT( int i, int pj, storage *workspace, reax_list **lists ) + void Add_dBond_to_Forces_NPT(int i, int pj, storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; @@ -44,7 +44,7 @@ namespace ReaxFF { nbr_j = &(bonds->select.bond_list[pj]); j = nbr_j->nbr; bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); @@ -74,58 +74,58 @@ namespace ReaxFF { rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ /* force */ - rvec_Add( workspace->f[k], temp ); + rvec_Add(workspace->f[k], temp); } /* then atom i itself */ - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); /*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); /*1st,dBO*/ - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] );/*2nd,dBO*/ - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ + rvec_Scale(temp, coef.C1dbo, bo_ij->dBOp); /*1st,dBO*/ + rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); /*2nd,dBO*/ + rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); /*1st,dBO*/ + rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]);/*2nd,dBO*/ + rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ + rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ + rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBO_pi2*/ - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] );/*3rd*/ + rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBO_pi2*/ + rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBO_pi2*/ + rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]);/*3rd*/ /* force */ - rvec_Add( workspace->f[i], temp ); + rvec_Add(workspace->f[i], temp); for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); /*3rd,dBO*/ - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ + rvec_Scale(temp, -coef.C3dbo, nbr_k->bo_data.dBOp); /*3rd,dBO*/ + rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ + rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ /* force */ - rvec_Add( workspace->f[k], temp ); + rvec_Add(workspace->f[k], temp); } /* then atom j itself */ - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); /*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); /*1st, dBO*/ - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ + rvec_Scale(temp, -coef.C1dbo, bo_ij->dBOp); /*1st, dBO*/ + rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); /*2nd, dBO*/ + rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); /*1st, dBO*/ + rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); /*1st,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); /*2nd,dBOpi*/ - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ + rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ + rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); /*1st,dBOpi2*/ - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); /*2nd,dBOpi2*/ - rvec_ScaledAdd( temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ + rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBOpi2*/ + rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBOpi2*/ + rvec_ScaledAdd(temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ /* force */ - rvec_Add( workspace->f[j], temp ); + rvec_Add(workspace->f[j], temp); } - void Add_dBond_to_Forces( reax_system *system, int i, int pj, - storage *workspace, reax_list **lists ) + void Add_dBond_to_Forces(reax_system *system, int i, int pj, + storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; @@ -140,7 +140,7 @@ namespace ReaxFF { nbr_j = &(bonds->select.bond_list[pj]); j = nbr_j->nbr; bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[ nbr_j->sym_index ].bo_data); + bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); @@ -161,40 +161,40 @@ namespace ReaxFF { coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); // forces on i - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C2dbo, workspace->dDeltap_self[i] ); - rvec_ScaledAdd( temp, coef.C1dDelta, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C2dDelta, workspace->dDeltap_self[i] ); - rvec_ScaledAdd( temp, coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, coef.C2dbopi, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbopi, workspace->dDeltap_self[i]); - rvec_ScaledAdd( temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - rvec_ScaledAdd( temp, coef.C2dbopi2, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbopi2, workspace->dDeltap_self[i] ); - rvec_Add( workspace->f[i], temp ); + rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); + rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]); + rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]); + rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); + rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]); + rvec_Add(workspace->f[i], temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fi_tmp, -1.0, temp); - rvec_ScaledSum( delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x ); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); system->pair_ptr->v_tally(i,fi_tmp,delij); } // forces on j - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dbo, workspace->dDeltap_self[j] ); - rvec_ScaledAdd( temp, -coef.C1dDelta, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C3dDelta, workspace->dDeltap_self[j]); - rvec_ScaledAdd( temp, -coef.C1dbopi, bo_ij->dln_BOp_pi ); - rvec_ScaledAdd( temp, -coef.C2dbopi, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C4dbopi, workspace->dDeltap_self[j]); - rvec_ScaledAdd( temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2 ); - rvec_ScaledAdd( temp, -coef.C2dbopi2, bo_ij->dBOp ); - rvec_ScaledAdd( temp, coef.C4dbopi2, workspace->dDeltap_self[j]); - rvec_Add( workspace->f[j], temp ); + rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); + rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]); + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]); + rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); + rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); + rvec_ScaledAdd(temp, coef.C4dbopi2, workspace->dDeltap_self[j]); + rvec_Add(workspace->f[j], temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fj_tmp, -1.0, temp); - rvec_ScaledSum( delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x ); + rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); system->pair_ptr->v_tally(j,fj_tmp,delji); } @@ -203,11 +203,11 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); - rvec_Add( workspace->f[k], temp ); + rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); + rvec_Add(workspace->f[k], temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fk_tmp, -1.0, temp); @@ -223,11 +223,11 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); - rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd( temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); - rvec_Add( workspace->f[k], temp ); + rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); + rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + rvec_Add(workspace->f[k], temp); if (system->pair_ptr->vflag_atom) { rvec_Scale(fk_tmp, -1.0, temp); @@ -254,18 +254,18 @@ namespace ReaxFF { r2 = SQR(nbr_pj->d); if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { - C12 = twbp->p_bo1 * pow( nbr_pj->d / twbp->r_s, twbp->p_bo2 ); - BO_s = (1.0 + bo_cut) * exp( C12 ); + C12 = twbp->p_bo1 * pow(nbr_pj->d / twbp->r_s, twbp->p_bo2); + BO_s = (1.0 + bo_cut) * exp(C12); } else BO_s = C12 = 0.0; if (sbp_i->r_pi > 0.0 && sbp_j->r_pi > 0.0) { - C34 = twbp->p_bo3 * pow( nbr_pj->d / twbp->r_p, twbp->p_bo4 ); - BO_pi = exp( C34 ); + C34 = twbp->p_bo3 * pow(nbr_pj->d / twbp->r_p, twbp->p_bo4); + BO_pi = exp(C34); } else BO_pi = C34 = 0.0; if (sbp_i->r_pi_pi > 0.0 && sbp_j->r_pi_pi > 0.0) { - C56 = twbp->p_bo5 * pow( nbr_pj->d / twbp->r_pp, twbp->p_bo6 ); - BO_pi2= exp( C56 ); + C56 = twbp->p_bo5 * pow(nbr_pj->d / twbp->r_pp, twbp->p_bo6); + BO_pi2= exp(C56); } else BO_pi2 = C56 = 0.0; /* Initially BO values are the uncorrected ones, page 1 */ @@ -273,26 +273,26 @@ namespace ReaxFF { if (BO >= bo_cut) { /****** bonds i-j and j-i ******/ - ibond = &( bonds->select.bond_list[btop_i] ); - btop_j = End_Index( j, bonds ); + ibond = &(bonds->select.bond_list[btop_i]); + btop_j = End_Index(j, bonds); jbond = &(bonds->select.bond_list[btop_j]); ibond->nbr = j; jbond->nbr = i; ibond->d = nbr_pj->d; jbond->d = nbr_pj->d; - rvec_Copy( ibond->dvec, nbr_pj->dvec ); - rvec_Scale( jbond->dvec, -1, nbr_pj->dvec ); - ivec_Copy( ibond->rel_box, nbr_pj->rel_box ); - ivec_Scale( jbond->rel_box, -1, nbr_pj->rel_box ); + rvec_Copy(ibond->dvec, nbr_pj->dvec); + rvec_Scale(jbond->dvec, -1, nbr_pj->dvec); + ivec_Copy(ibond->rel_box, nbr_pj->rel_box); + ivec_Scale(jbond->rel_box, -1, nbr_pj->rel_box); ibond->dbond_index = btop_i; jbond->dbond_index = btop_i; ibond->sym_index = btop_j; jbond->sym_index = btop_i; - Set_End_Index( j, btop_j+1, bonds ); + Set_End_Index(j, btop_j+1, bonds); - bo_ij = &( ibond->bo_data ); - bo_ji = &( jbond->bo_data ); + bo_ij = &(ibond->bo_data); + bo_ji = &(jbond->bo_data); bo_ji->BO = bo_ij->BO = BO; bo_ji->BO_s = bo_ij->BO_s = BO_s; bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; @@ -310,17 +310,17 @@ namespace ReaxFF { rvec_Scale(bo_ij->dln_BOp_pi2, -bo_ij->BO_pi2*Cln_BOp_pi2,ibond->dvec); rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); - rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); - rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); + rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi); + rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2); - rvec_Scale( bo_ij->dBOp, + rvec_Scale(bo_ij->dBOp, -(bo_ij->BO_s * Cln_BOp_s + bo_ij->BO_pi * Cln_BOp_pi + - bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); - rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); + bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec); + rvec_Scale(bo_ji->dBOp, -1., bo_ij->dBOp); - rvec_Add( workspace->dDeltap_self[i], bo_ij->dBOp ); - rvec_Add( workspace->dDeltap_self[j], bo_ji->dBOp ); + rvec_Add(workspace->dDeltap_self[i], bo_ij->dBOp); + rvec_Add(workspace->dDeltap_self[j], bo_ji->dBOp); bo_ij->BO_s -= bo_cut; bo_ij->BO -= bo_cut; @@ -383,11 +383,11 @@ namespace ReaxFF { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; if (type_j < 0) continue; - bo_ij = &( bonds->select.bond_list[pj].bo_data ); - // fprintf( stderr, "\tj:%d - ubo: %8.3f\n", j+1, bo_ij->BO ); + bo_ij = &(bonds->select.bond_list[pj].bo_data); + // fprintf(stderr, "\tj:%d - ubo: %8.3f\n", j+1, bo_ij->BO); if (i < j || workspace->bond_mark[j] > 3) { - twbp = &( system->reax_param.tbp[type_i][type_j] ); + twbp = &(system->reax_param.tbp[type_i][type_j]); if (twbp->ovc < 0.001 && twbp->v13cor < 0.001) { bo_ij->C1dbo = 1.000000; @@ -412,36 +412,36 @@ namespace ReaxFF { /* on page 1 */ if (twbp->ovc >= 0.001) { /* Correction for overcoordination */ - exp_p1i = exp( -p_boc1 * Deltap_i ); - exp_p2i = exp( -p_boc2 * Deltap_i ); - exp_p1j = exp( -p_boc1 * Deltap_j ); - exp_p2j = exp( -p_boc2 * Deltap_j ); + exp_p1i = exp(-p_boc1 * Deltap_i); + exp_p2i = exp(-p_boc2 * Deltap_i); + exp_p1j = exp(-p_boc1 * Deltap_j); + exp_p2j = exp(-p_boc2 * Deltap_j); f2 = exp_p1i + exp_p1j; - f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); - f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + - ( val_j + f2 )/( val_j + f2 + f3 ) ); + f3 = -1.0 / p_boc2 * log(0.5 * (exp_p2i + exp_p2j)); + f1 = 0.5 * ((val_i + f2)/(val_i + f2 + f3) + + (val_j + f2)/(val_j + f2 + f3)); temp = f2 + f3; u1_ij = val_i + temp; u1_ji = val_j + temp; - Cf1A_ij = 0.5 * f3 * (1.0 / SQR( u1_ij ) + - 1.0 / SQR( u1_ji )); - Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + - ( u1_ji - f3 ) / SQR( u1_ji )); + Cf1A_ij = 0.5 * f3 * (1.0 / SQR(u1_ij) + + 1.0 / SQR(u1_ji)); + Cf1B_ij = -0.5 * ((u1_ij - f3) / SQR(u1_ij) + + (u1_ji - f3) / SQR(u1_ji)); - Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - + Cf1_ij = 0.50 * (-p_boc1 * exp_p1i / u1_ij - ((val_i+f2) / SQR(u1_ij)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) ) + + (-p_boc1 * exp_p1i + + exp_p2i / (exp_p2i + exp_p2j)) + -p_boc1 * exp_p1i / u1_ji - ((val_j+f2) / SQR(u1_ji)) * - ( -p_boc1 * exp_p1i + - exp_p2i / ( exp_p2i + exp_p2j ) )); + (-p_boc1 * exp_p1i + + exp_p2i / (exp_p2i + exp_p2j))); Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + - Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); + Cf1B_ij * exp_p2j / (exp_p2i + exp_p2j); } else { /* No overcoordination correction! */ @@ -451,9 +451,9 @@ namespace ReaxFF { if (twbp->v13cor >= 0.001) { /* Correction for 1-3 bond orders */ - exp_f4 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + exp_f4 =exp(-(twbp->p_boc4 * SQR(bo_ij->BO) - Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); - exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - + exp_f5 =exp(-(twbp->p_boc4 * SQR(bo_ij->BO) - Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); f4 = 1. / (1. + exp_f4); @@ -481,7 +481,7 @@ namespace ReaxFF { bo_ij->BO = bo_ij->BO * A0_ij; bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; - bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); + bo_ij->BO_s = bo_ij->BO - (bo_ij->BO_pi + bo_ij->BO_pi2); bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; bo_ij->C2dbo = bo_ij->BO * A2_ij; @@ -515,7 +515,7 @@ namespace ReaxFF { /* We only need to update bond orders from bo_ji everything else is set in uncorrected_bo calculations */ sym_index = bonds->select.bond_list[pj].sym_index; - bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); + bo_ji = &(bonds->select.bond_list[sym_index].bo_data); bo_ij->BO = bo_ji->BO; bo_ij->BO_s = bo_ji->BO_s; bo_ij->BO_pi = bo_ji->BO_pi; @@ -531,7 +531,7 @@ namespace ReaxFF { for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; - sbp_j = &(system->reax_param.sbp[ type_j ]); + sbp_j = &(system->reax_param.sbp[type_j]); workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index a06700bb3b..a21059f19d 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -75,17 +75,17 @@ namespace ReaxFF { /* set the pointers */ type_i = system->my_atoms[i].type; type_j = system->my_atoms[j].type; - sbp_i = &( system->reax_param.sbp[type_i] ); - sbp_j = &( system->reax_param.sbp[type_j] ); - twbp = &( system->reax_param.tbp[type_i][type_j] ); - bo_ij = &( bonds->select.bond_list[pj].bo_data ); + sbp_i = &(system->reax_param.sbp[type_i]); + sbp_j = &(system->reax_param.sbp[type_j]); + twbp = &(system->reax_param.tbp[type_i][type_j]); + bo_ij = &(bonds->select.bond_list[pj].bo_data); /* calculate the constants */ if (bo_ij->BO_s == 0.0) pow_BOs_be2 = 0.0; - else pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); - exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); + else pow_BOs_be2 = pow(bo_ij->BO_s, twbp->p_be2); + exp_be12 = exp(twbp->p_be1 * (1.0 - pow_BOs_be2)); CEbo = -twbp->De_s * exp_be12 * - ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); + (1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2); /* calculate the Bond Energy */ data->my_en.e_bond += ebond = @@ -104,10 +104,10 @@ namespace ReaxFF { /* Stabilisation terminal triple bond */ if (bo_ij->BO >= 1.00) { - if ( gp37 == 2 || + if (gp37 == 2 || (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { - exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); + exphu = exp(-gp7 * SQR(bo_ij->BO - 2.50)); exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); @@ -117,7 +117,7 @@ namespace ReaxFF { data->my_en.e_bond += estriph; decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * - ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); + (gp3 - 2.0 * gp7 * (bo_ij->BO-2.50)); decobdboua = -gp10 * exphu * hulpov * (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); decobdboub = -gp10 * exphu * hulpov * diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index 43362ac878..463208425e 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -67,20 +67,20 @@ namespace ReaxFF { type_j = system->my_atoms[j].type; start_j = Start_Index(j, bonds); end_j = End_Index(j, bonds); - hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); - hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); + hb_start_j = Start_Index(system->my_atoms[j].Hindex, hbonds); + hb_end_j = End_Index(system->my_atoms[j].Hindex, hbonds); if (type_j < 0) continue; top = 0; for (pi = start_j; pi < end_j; ++pi) { - pbond_ij = &( bond_list[pi] ); + pbond_ij = &(bond_list[pi]); i = pbond_ij->nbr; type_i = system->my_atoms[i].type; if (type_i < 0) continue; bo_ij = &(pbond_ij->bo_data); - if ( system->reax_param.sbp[type_i].p_hbond == 2 && - bo_ij->BO >= HB_THRESHOLD ) + if (system->reax_param.sbp[type_i].p_hbond == 2 && + bo_ij->BO >= HB_THRESHOLD) hblist[top++] = pi; } @@ -91,36 +91,36 @@ namespace ReaxFF { if (type_k < 0) continue; nbr_jk = hbond_list[pk].ptr; r_jk = nbr_jk->d; - rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); + rvec_Scale(dvec_jk, hbond_list[pk].scl, nbr_jk->dvec); for (itr = 0; itr < top; ++itr) { pi = hblist[itr]; - pbond_ij = &( bonds->select.bond_list[pi] ); + pbond_ij = &(bonds->select.bond_list[pi]); i = pbond_ij->nbr; if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { bo_ij = &(pbond_ij->bo_data); type_i = system->my_atoms[i].type; if (type_i < 0) continue; - hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); + hbp = &(system->reax_param.hbp[type_i][type_j][type_k]); if (hbp->r0_hb <= 0.0) continue; ++num_hb_intrs; - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &theta, &cos_theta ); + Calculate_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + &theta, &cos_theta); /* the derivative of cos(theta) */ - Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, + Calculate_dCos_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, &dcos_theta_di, &dcos_theta_dj, - &dcos_theta_dk ); + &dcos_theta_dk); /* hyrogen bond energy*/ - sin_theta2 = sin( theta/2.0 ); + sin_theta2 = sin(theta/2.0); sin_xhz4 = SQR(sin_theta2); sin_xhz4 *= sin_xhz4; - cos_xhz1 = ( 1.0 - cos_theta ); - exp_hb2 = exp( -hbp->p_hb2 * bo_ij->BO ); - exp_hb3 = exp( -hbp->p_hb3 * ( hbp->r0_hb / r_jk + - r_jk / hbp->r0_hb - 2.0 ) ); + cos_xhz1 = (1.0 - cos_theta); + exp_hb2 = exp(-hbp->p_hb2 * bo_ij->BO); + exp_hb3 = exp(-hbp->p_hb3 * (hbp->r0_hb / r_jk + + r_jk / hbp->r0_hb - 2.0)); data->my_en.e_hb += e_hb = hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; @@ -135,36 +135,36 @@ namespace ReaxFF { if (control->virial == 0) { // dcos terms - rvec_ScaledAdd( workspace->f[i], +CEhb2, dcos_theta_di ); - rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); - rvec_ScaledAdd( workspace->f[k], +CEhb2, dcos_theta_dk ); + rvec_ScaledAdd(workspace->f[i], +CEhb2, dcos_theta_di); + rvec_ScaledAdd(workspace->f[j], +CEhb2, dcos_theta_dj); + rvec_ScaledAdd(workspace->f[k], +CEhb2, dcos_theta_dk); // dr terms - rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); - rvec_ScaledAdd( workspace->f[k], +CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd(workspace->f[j], -CEhb3/r_jk, dvec_jk); + rvec_ScaledAdd(workspace->f[k], +CEhb3/r_jk, dvec_jk); } else { - rvec_Scale( force, +CEhb2, dcos_theta_di ); // dcos terms - rvec_Add( workspace->f[i], force ); + rvec_Scale(force, +CEhb2, dcos_theta_di); // dcos terms + rvec_Add(workspace->f[i], force); - rvec_ScaledAdd( workspace->f[j], +CEhb2, dcos_theta_dj ); + rvec_ScaledAdd(workspace->f[j], +CEhb2, dcos_theta_dj); - ivec_Scale( rel_jk, hbond_list[pk].scl, nbr_jk->rel_box ); - rvec_Scale( force, +CEhb2, dcos_theta_dk ); - rvec_Add( workspace->f[k], force ); + ivec_Scale(rel_jk, hbond_list[pk].scl, nbr_jk->rel_box); + rvec_Scale(force, +CEhb2, dcos_theta_dk); + rvec_Add(workspace->f[k], force); // dr terms - rvec_ScaledAdd( workspace->f[j], -CEhb3/r_jk, dvec_jk ); + rvec_ScaledAdd(workspace->f[j], -CEhb3/r_jk, dvec_jk); - rvec_Scale( force, CEhb3/r_jk, dvec_jk ); - rvec_Add( workspace->f[k], force ); + rvec_Scale(force, CEhb3/r_jk, dvec_jk); + rvec_Add(workspace->f[k], force); } /* tally into per-atom virials */ if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - rvec_ScaledSum( delij, 1., system->my_atoms[j].x, - -1., system->my_atoms[i].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[j].x, - -1., system->my_atoms[k].x ); + rvec_ScaledSum(delij, 1., system->my_atoms[j].x, + -1., system->my_atoms[i].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[j].x, + -1., system->my_atoms[k].x); rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 86a8677a02..d2b014947e 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -54,7 +54,7 @@ namespace ReaxFF { if (control->hbond_cut > 0) for (i = 0; i < system->n; ++i) { atom = &(system->my_atoms[i]); - if (system->reax_param.sbp[ atom->type ].p_hbond == 1 && atom->type >= 0) + if (system->reax_param.sbp[atom->type].p_hbond == 1 && atom->type >= 0) atom->Hindex = system->numH++; else atom->Hindex = -1; } diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index 09fb848a08..4f3ab95395 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -72,8 +72,8 @@ namespace ReaxFF { /* lone-pair Energy */ p_lp2 = sbp_i->p_lp2; - expvd2 = exp( -75 * workspace->Delta_lp[i] ); - inv_expvd2 = 1. / (1. + expvd2 ); + expvd2 = exp(-75 * workspace->Delta_lp[i]); + inv_expvd2 = 1. / (1. + expvd2); numbonds = 0; e_lp = 0.0; @@ -103,9 +103,9 @@ namespace ReaxFF { type_j = system->my_atoms[j].type; if (type_j < 0) continue; - if (!strcmp( system->reax_param.sbp[type_j].name, "C" )) { - twbp = &( system->reax_param.tbp[type_i][type_j]); - bo_ij = &( bonds->select.bond_list[pj].bo_data ); + if (!strcmp(system->reax_param.sbp[type_j].name, "C")) { + twbp = &(system->reax_param.tbp[type_i][type_j]); + bo_ij = &(bonds->select.bond_list[pj].bo_data); Di = workspace->Delta[i]; vov3 = bo_ij->BO - Di - 0.040*pow(Di, 4.); @@ -148,16 +148,16 @@ namespace ReaxFF { sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); + (bo_ij->BO_pi + bo_ij->BO_pi2); } - exp_ovun1 = p_ovun3 * exp( p_ovun4 * sum_ovun2 ); + exp_ovun1 = p_ovun3 * exp(p_ovun4 * sum_ovun2); inv_exp_ovun1 = 1.0 / (1 + exp_ovun1); Delta_lpcorr = workspace->Delta[i] - (dfvl * workspace->Delta_lp_temp[i]) * inv_exp_ovun1; - exp_ovun2 = exp( p_ovun2 * Delta_lpcorr ); + exp_ovun2 = exp(p_ovun2 * Delta_lpcorr); inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2); DlpVi = 1.0 / (Delta_lpcorr + sbp_i->valency + 1e-8); @@ -166,9 +166,9 @@ namespace ReaxFF { data->my_en.e_ov += e_ov = sum_ovun1 * CEover1; CEover2 = sum_ovun1 * DlpVi * inv_exp_ovun2 * - (1.0 - Delta_lpcorr * ( DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2 )); + (1.0 - Delta_lpcorr * (DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2)); - CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1 ); + CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1); CEover4 = CEover2 * (dfvl * workspace->Delta_lp_temp[i]) * p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1); @@ -179,7 +179,7 @@ namespace ReaxFF { p_ovun5 = sbp_i->p_ovun5; exp_ovun2n = 1.0 / exp_ovun2; - exp_ovun6 = exp( p_ovun6 * Delta_lpcorr ); + exp_ovun6 = exp(p_ovun6 * Delta_lpcorr); exp_ovun8 = p_ovun7 * exp(p_ovun8 * sum_ovun2); inv_exp_ovun2n = 1.0 / (1.0 + exp_ovun2n); inv_exp_ovun8 = 1.0 / (1.0 + exp_ovun8); @@ -194,8 +194,8 @@ namespace ReaxFF { -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; CEunder1 = inv_exp_ovun2n * - ( p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + - p_ovun2 * e_un * exp_ovun2n ); + (p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + + p_ovun2 * e_un * exp_ovun2n); CEunder2 = -e_un * p_ovun8 * exp_ovun8 * inv_exp_ovun8; CEunder3 = CEunder1 * (1.0 - dfvl*workspace->dDelta_lp[i]*inv_exp_ovun1); CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) * diff --git a/src/USER-REAXC/reaxc_nonbonded.cpp b/src/USER-REAXC/reaxc_nonbonded.cpp index e4adf6c7b1..a7f9aee807 100644 --- a/src/USER-REAXC/reaxc_nonbonded.cpp +++ b/src/USER-REAXC/reaxc_nonbonded.cpp @@ -111,8 +111,8 @@ namespace ReaxFF { if (flag) { r_ij = nbr_pj->d; - twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] - [ system->my_atoms[j].type ]); + twbp = &(system->reax_param.tbp[system->my_atoms[i].type] + [system->my_atoms[j].type]); Tap = workspace->Tap[7] * r_ij + workspace->Tap[6]; Tap = Tap * r_ij + workspace->Tap[5]; diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index e7d8d4d024..3208d935cc 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -43,7 +43,7 @@ namespace ReaxFF { for (i = 0; i < system->n; ++i) { atom = &(system->my_atoms[i]); if (atom->type < 0) continue; - if (system->reax_param.sbp[ atom->type ].p_hbond == 1) + if (system->reax_param.sbp[atom->type].p_hbond == 1) atom->Hindex = system->numH++; else atom->Hindex = -1; } diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index e1a535e193..839b92c614 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -32,20 +32,20 @@ #include "error.h" namespace ReaxFF { - void Calculate_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, - double *theta, double *cos_theta ) + void Calculate_Theta(rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, + double *theta, double *cos_theta) { - (*cos_theta) = rvec_Dot(dvec_ji,dvec_jk) / ( d_ji * d_jk ); + (*cos_theta) = rvec_Dot(dvec_ji,dvec_jk) / (d_ji * d_jk); if (*cos_theta > 1.) *cos_theta = 1.0; if (*cos_theta < -1.) *cos_theta = -1.0; - (*theta) = acos( *cos_theta ); + (*theta) = acos(*cos_theta); } - void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, + void Calculate_dCos_Theta(rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, rvec* dcos_theta_di, rvec* dcos_theta_dj, - rvec* dcos_theta_dk ) + rvec* dcos_theta_dk) { int t; double sqr_d_ji = SQR(d_ji); @@ -59,14 +59,14 @@ namespace ReaxFF { (*dcos_theta_di)[t] = dvec_jk[t] * inv_dists - Cdot_inv3 * sqr_d_jk * dvec_ji[t]; (*dcos_theta_dj)[t] = -(dvec_jk[t] + dvec_ji[t]) * inv_dists + - Cdot_inv3 * ( sqr_d_jk * dvec_ji[t] + sqr_d_ji * dvec_jk[t] ); + Cdot_inv3 * (sqr_d_jk * dvec_ji[t] + sqr_d_ji * dvec_jk[t]); (*dcos_theta_dk)[t] = dvec_ji[t] * inv_dists - Cdot_inv3 * sqr_d_ji * dvec_jk[t]; } } - void Valence_Angles( reax_system *system, control_params *control, + void Valence_Angles(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists) { @@ -119,17 +119,17 @@ namespace ReaxFF { start_j = Start_Index(j, bonds); end_j = End_Index(j, bonds); - p_val3 = system->reax_param.sbp[ type_j ].p_val3; - p_val5 = system->reax_param.sbp[ type_j ].p_val5; + p_val3 = system->reax_param.sbp[type_j].p_val3; + p_val5 = system->reax_param.sbp[type_j].p_val5; SBOp = 0, prod_SBO = 1; for (t = start_j; t < end_j; ++t) { bo_jt = &(bonds->select.bond_list[t].bo_data); SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); - temp = SQR( bo_jt->BO ); + temp = SQR(bo_jt->BO); temp *= temp; temp *= temp; - prod_SBO *= exp( -temp ); + prod_SBO *= exp(-temp); } if (workspace->vlpex[j] >= 0) { @@ -141,50 +141,50 @@ namespace ReaxFF { } SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); - dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj ); + dSBO1 = -8 * prod_SBO * (workspace->Delta_boc[j] + p_val8 * vlpadj); if (SBO <= 0) SBO2 = 0, CSBO2 = 0; else if (SBO > 0 && SBO <= 1) { - SBO2 = pow( SBO, p_val9 ); - CSBO2 = p_val9 * pow( SBO, p_val9 - 1 ); + SBO2 = pow(SBO, p_val9); + CSBO2 = p_val9 * pow(SBO, p_val9 - 1); } else if (SBO > 1 && SBO < 2) { - SBO2 = 2 - pow( 2-SBO, p_val9 ); - CSBO2 = p_val9 * pow( 2 - SBO, p_val9 - 1 ); + SBO2 = 2 - pow(2-SBO, p_val9); + CSBO2 = p_val9 * pow(2 - SBO, p_val9 - 1); } else SBO2 = 2, CSBO2 = 0; - expval6 = exp( p_val6 * workspace->Delta_boc[j] ); + expval6 = exp(p_val6 * workspace->Delta_boc[j]); for (pi = start_j; pi < end_j; ++pi) { - Set_Start_Index( pi, num_thb_intrs, thb_intrs ); + Set_Start_Index(pi, num_thb_intrs, thb_intrs); pbond_ij = &(bonds->select.bond_list[pi]); bo_ij = &(pbond_ij->bo_data); BOA_ij = bo_ij->BO - control->thb_cut; - if ( BOA_ij/*bo_ij->BO*/ > 0.0 && - ( j < system->n || pbond_ij->nbr < system->n )) { + if (BOA_ij/*bo_ij->BO*/ > 0.0 && + (j < system->n || pbond_ij->nbr < system->n)) { i = pbond_ij->nbr; type_i = system->my_atoms[i].type; for (pk = start_j; pk < pi; ++pk) { - start_pk = Start_Index( pk, thb_intrs ); - end_pk = End_Index( pk, thb_intrs ); + start_pk = Start_Index(pk, thb_intrs); + end_pk = End_Index(pk, thb_intrs); for (t = start_pk; t < end_pk; ++t) if (thb_intrs->select.three_body_list[t].thb == i) { - p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs] ); + p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs]); p_kji = &(thb_intrs->select.three_body_list[t]); p_ijk->thb = bonds->select.bond_list[pk].nbr; p_ijk->pthb = pk; p_ijk->theta = p_kji->theta; - rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk ); - rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj ); - rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di ); + rvec_Copy(p_ijk->dcos_di, p_kji->dcos_dk); + rvec_Copy(p_ijk->dcos_dj, p_kji->dcos_dj); + rvec_Copy(p_ijk->dcos_dk, p_kji->dcos_di); ++num_thb_intrs; break; @@ -197,21 +197,21 @@ namespace ReaxFF { BOA_jk = bo_jk->BO - control->thb_cut; k = pbond_jk->nbr; type_k = system->my_atoms[k].type; - p_ijk = &( thb_intrs->select.three_body_list[num_thb_intrs] ); + p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs]); - Calculate_Theta( pbond_ij->dvec, pbond_ij->d, + Calculate_Theta(pbond_ij->dvec, pbond_ij->d, pbond_jk->dvec, pbond_jk->d, - &theta, &cos_theta ); + &theta, &cos_theta); - Calculate_dCos_Theta( pbond_ij->dvec, pbond_ij->d, + Calculate_dCos_Theta(pbond_ij->dvec, pbond_ij->d, pbond_jk->dvec, pbond_jk->d, &(p_ijk->dcos_di), &(p_ijk->dcos_dj), - &(p_ijk->dcos_dk) ); + &(p_ijk->dcos_dk)); p_ijk->thb = k; p_ijk->pthb = pk; p_ijk->theta = theta; - sin_theta = sin( theta ); + sin_theta = sin(theta); if (sin_theta < 1.0e-5) sin_theta = 1.0e-5; @@ -222,11 +222,11 @@ namespace ReaxFF { (bo_ij->BO > control->thb_cut) && (bo_jk->BO > control->thb_cut) && (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { - thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] ); + thbh = &(system->reax_param.thbp[type_i][type_j][type_k]); for (cnt = 0; cnt < thbh->cnt; ++cnt) { if (fabs(thbh->prm[cnt].p_val1) > 0.001) { - thbp = &( thbh->prm[cnt] ); + thbp = &(thbh->prm[cnt]); /* ANGLE ENERGY */ p_val1 = thbp->p_val1; @@ -235,26 +235,26 @@ namespace ReaxFF { p_val7 = thbp->p_val7; theta_00 = thbp->theta_00; - exp3ij = exp( -p_val3 * pow( BOA_ij, p_val4 ) ); + exp3ij = exp(-p_val3 * pow(BOA_ij, p_val4)); f7_ij = 1.0 - exp3ij; - Cf7ij = p_val3 * p_val4 * pow( BOA_ij, p_val4 - 1.0 ) * exp3ij; + Cf7ij = p_val3 * p_val4 * pow(BOA_ij, p_val4 - 1.0) * exp3ij; - exp3jk = exp( -p_val3 * pow( BOA_jk, p_val4 ) ); + exp3jk = exp(-p_val3 * pow(BOA_jk, p_val4)); f7_jk = 1.0 - exp3jk; - Cf7jk = p_val3 * p_val4 * pow( BOA_jk, p_val4 - 1.0 ) * exp3jk; + Cf7jk = p_val3 * p_val4 * pow(BOA_jk, p_val4 - 1.0) * exp3jk; - expval7 = exp( -p_val7 * workspace->Delta_boc[j] ); + expval7 = exp(-p_val7 * workspace->Delta_boc[j]); trm8 = 1.0 + expval6 + expval7; - f8_Dj = p_val5 - ( (p_val5 - 1.0) * (2.0 + expval6) / trm8 ); - Cf8j = ( (1.0 - p_val5) / SQR(trm8) ) * - ( p_val6 * expval6 * trm8 - - (2.0 + expval6) * ( p_val6*expval6 - p_val7*expval7 ) ); + f8_Dj = p_val5 - ((p_val5 - 1.0) * (2.0 + expval6) / trm8); + Cf8j = ((1.0 - p_val5) / SQR(trm8)) * + (p_val6 * expval6 * trm8 - + (2.0 + expval6) * (p_val6*expval6 - p_val7*expval7)); theta_0 = 180.0 - theta_00 * (1.0 - exp(-p_val10 * (2.0 - SBO2))); - theta_0 = DEG2RAD( theta_0 ); + theta_0 = DEG2RAD(theta_0); - expval2theta = exp( -p_val2 * SQR(theta_0 - theta) ); + expval2theta = exp(-p_val2 * SQR(theta_0 - theta)); if (p_val1 >= 0) expval12theta = p_val1 * (1.0 - expval2theta); else // To avoid linear Me-H-Me angles (6/6/06) @@ -267,7 +267,7 @@ namespace ReaxFF { expval2theta * (theta_0 - theta); Ctheta_0 = p_val10 * DEG2RAD(theta_00) * - exp( -p_val10 * (2.0 - SBO2) ); + exp(-p_val10 * (2.0 - SBO2)); CEval5 = -CEval4 * Ctheta_0 * CSBO2; CEval6 = CEval5 * dSBO1; @@ -284,16 +284,16 @@ namespace ReaxFF { p_pen3 = system->reax_param.gp.l[20]; p_pen4 = system->reax_param.gp.l[21]; - exp_pen2ij = exp( -p_pen2 * SQR( BOA_ij - 2.0 ) ); - exp_pen2jk = exp( -p_pen2 * SQR( BOA_jk - 2.0 ) ); - exp_pen3 = exp( -p_pen3 * workspace->Delta[j] ); - exp_pen4 = exp( p_pen4 * workspace->Delta[j] ); + exp_pen2ij = exp(-p_pen2 * SQR(BOA_ij - 2.0)); + exp_pen2jk = exp(-p_pen2 * SQR(BOA_jk - 2.0)); + exp_pen3 = exp(-p_pen3 * workspace->Delta[j]); + exp_pen4 = exp( p_pen4 * workspace->Delta[j]); trm_pen34 = 1.0 + exp_pen3 + exp_pen4; - f9_Dj = ( 2.0 + exp_pen3 ) / trm_pen34; - Cf9j = ( -p_pen3 * exp_pen3 * trm_pen34 - - (2.0 + exp_pen3) * ( -p_pen3 * exp_pen3 + - p_pen4 * exp_pen4 ) ) / - SQR( trm_pen34 ); + f9_Dj = (2.0 + exp_pen3) / trm_pen34; + Cf9j = (-p_pen3 * exp_pen3 * trm_pen34 - + (2.0 + exp_pen3) * (-p_pen3 * exp_pen3 + + p_pen4 * exp_pen4)) / + SQR(trm_pen34); data->my_en.e_pen += e_pen = p_pen1 * f9_Dj * exp_pen2ij * exp_pen2jk; @@ -310,13 +310,13 @@ namespace ReaxFF { p_coa3 = system->reax_param.gp.l[38]; p_coa4 = system->reax_param.gp.l[30]; - exp_coa2 = exp( p_coa2 * workspace->Delta_val[j] ); + exp_coa2 = exp(p_coa2 * workspace->Delta_val[j]); data->my_en.e_coa += e_coa = p_coa1 / (1. + exp_coa2) * - exp( -p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij) ) * - exp( -p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk) ) * - exp( -p_coa4 * SQR(BOA_ij - 1.5) ) * - exp( -p_coa4 * SQR(BOA_jk - 1.5) ); + exp(-p_coa3 * SQR(workspace->total_bond_order[i]-BOA_ij)) * + exp(-p_coa3 * SQR(workspace->total_bond_order[k]-BOA_jk)) * + exp(-p_coa4 * SQR(BOA_ij - 1.5)) * + exp(-p_coa4 * SQR(BOA_jk - 1.5)); CEcoa1 = -2 * p_coa4 * (BOA_ij - 1.5) * e_coa; CEcoa2 = -2 * p_coa4 * (BOA_jk - 1.5) * e_coa; @@ -335,10 +335,10 @@ namespace ReaxFF { workspace->CdDelta[k] += CEcoa5; for (t = start_j; t < end_j; ++t) { - pbond_jt = &( bonds->select.bond_list[t] ); + pbond_jt = &(bonds->select.bond_list[t]); bo_jt = &(pbond_jt->bo_data); temp_bo_jt = bo_jt->BO; - temp = CUBE( temp_bo_jt ); + temp = CUBE(temp_bo_jt); pBOjt7 = temp * temp * temp_bo_jt; bo_jt->Cdbo += (CEval6 * pBOjt7); @@ -347,31 +347,31 @@ namespace ReaxFF { } if (control->virial == 0) { - rvec_ScaledAdd( workspace->f[i], CEval8, p_ijk->dcos_di ); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); - rvec_ScaledAdd( workspace->f[k], CEval8, p_ijk->dcos_dk ); + rvec_ScaledAdd(workspace->f[i], CEval8, p_ijk->dcos_di); + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->f[k], CEval8, p_ijk->dcos_dk); } else { - rvec_Scale( force, CEval8, p_ijk->dcos_di ); - rvec_Add( workspace->f[i], force ); + rvec_Scale(force, CEval8, p_ijk->dcos_di); + rvec_Add(workspace->f[i], force); - rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - rvec_Scale( force, CEval8, p_ijk->dcos_dk ); - rvec_Add( workspace->f[k], force ); + rvec_Scale(force, CEval8, p_ijk->dcos_dk); + rvec_Add(workspace->f[k], force); } /* tally into per-atom virials */ if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { /* Acquire vectors */ - rvec_ScaledSum( delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x ); - rvec_ScaledSum( delkj, 1., system->my_atoms[k].x, - -1., system->my_atoms[j].x ); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, + -1., system->my_atoms[j].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[k].x, + -1., system->my_atoms[j].x); - rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di ); - rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj ); - rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk ); + rvec_Scale(fi_tmp, -CEval8, p_ijk->dcos_di); + rvec_Scale(fj_tmp, -CEval8, p_ijk->dcos_dj); + rvec_Scale(fk_tmp, -CEval8, p_ijk->dcos_dk); eng_tmp = e_ang + e_pen + e_coa; @@ -386,7 +386,7 @@ namespace ReaxFF { } } - Set_End_Index(pi, num_thb_intrs, thb_intrs ); + Set_End_Index(pi, num_thb_intrs, thb_intrs); } } diff --git a/src/USER-REAXC/reaxff_api.h b/src/USER-REAXC/reaxff_api.h index 819d7c0d3b..96febe70f9 100644 --- a/src/USER-REAXC/reaxff_api.h +++ b/src/USER-REAXC/reaxff_api.h @@ -184,8 +184,8 @@ namespace ReaxFF return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; } - inline double rvec_Norm( rvec v ) { - return sqrt( SQR(v[0]) + SQR(v[1]) + SQR(v[2]) ); + inline double rvec_Norm(rvec v) { + return sqrt(SQR(v[0]) + SQR(v[1]) + SQR(v[2])); } inline void rvec_Scale(rvec ret, double c, rvec v) { diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index 854871e5a7..2727fb897e 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -29,7 +29,7 @@ #define CUBE(x) ((x)*(x)*(x)) #define DEG2RAD(a) ((a)*constPI/180.0) #define RAD2DEG(a) ((a)*180.0/constPI) -#define MAX3(x,y,z) MAX( MAX(x,y), z) +#define MAX3(x,y,z) MAX(MAX(x,y), z) #define constPI 3.14159265 #define C_ele 332.06371 From dbced62a65e895052bf0e4245298d39ba5df08f5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 00:44:09 -0400 Subject: [PATCH 068/119] reorder code for better plain vs. omp code comparison. remove unused stuff --- src/USER-OMP/pair_reaxc_omp.cpp | 266 ++++++++++++++--------------- src/USER-OMP/reaxc_init_md_omp.cpp | 14 +- src/USER-REAXC/fix_qeq_reax.cpp | 4 +- src/USER-REAXC/fix_qeq_reax.h | 2 - src/USER-REAXC/pair_reaxc.cpp | 31 ++-- src/USER-REAXC/pair_reaxc.h | 2 - src/USER-REAXC/reaxc_allocate.cpp | 14 ++ src/USER-REAXC/reaxc_init_md.cpp | 19 ++- 8 files changed, 172 insertions(+), 180 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 178c65a1b1..af4a61360f 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -35,19 +35,20 @@ #include "pair_reaxc_omp.h" -#include #include "atom.h" -#include "update.h" -#include "force.h" +#include "citeme.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" +#include "fix_reaxc.h" +#include "force.h" +#include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" -#include "modify.h" -#include "fix_reaxc.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include "update.h" + +#include #include "reaxff_api.h" #include "reaxff_omp.h" @@ -96,6 +97,127 @@ PairReaxCOMP::~PairReaxCOMP() /* ---------------------------------------------------------------------- */ +void PairReaxCOMP::init_style() +{ + if (!atom->q_flag) + error->all(FLERR,"Pair style reax/c/omp requires atom attribute q"); + + bool have_qeq = ((modify->find_fix_by_style("^qeq/reax") != -1) + || (modify->find_fix_by_style("^qeq/shielded") != -1)); + if (!have_qeq && qeqflag == 1) + error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); + + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + api->system->bigN = static_cast (atom->natoms); // all atoms in the system + api->system->wsize = comm->nprocs; + + if (atom->tag_enable == 0) + error->all(FLERR,"Pair style reax/c/omp requires atom IDs"); + if (force->newton_pair == 0) + error->all(FLERR,"Pair style reax/c/omp requires newton pair on"); + + // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT + + if (atom->natoms > MAXSMALLINT) + error->all(FLERR,"Too many atoms for pair style reax/c/omp"); + + // need a half neighbor list w/ Newton off and ghost neighbors + // built whenever re-neighboring occurs + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->newton = 2; + neighbor->requests[irequest]->ghost = 1; + + cutmax = MAX3(api->control->nonb_cut, api->control->hbond_cut, api->control->bond_cut); + if ((cutmax < 2.0*api->control->bond_cut) && (comm->me == 0)) + error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " + "increased neighbor list skin."); + + if (fix_reax == nullptr) { + modify->add_fix(fmt::format("{} all REAXC",fix_id)); + fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; + } + + api->control->nthreads = comm->nthreads; +} + +/* ---------------------------------------------------------------------- */ + +void PairReaxCOMP::setup() +{ + int oldN; + int mincap = api->system->mincap; + double safezone = api->system->safezone; + + api->system->n = atom->nlocal; // my atoms + api->system->N = atom->nlocal + atom->nghost; // mine + ghosts + oldN = api->system->N; + api->system->bigN = static_cast (atom->natoms); // all atoms in the system + + if (api->system->N > nmax) { + memory->destroy(num_nbrs_offset); + // Don't update nmax here. It is updated at end of compute(). + memory->create(num_nbrs_offset, api->system->N, "pair:num_nbrs_offset"); + } + + if (setup_flag == 0) { + + setup_flag = 1; + + int *num_bonds = fix_reax->num_bonds; + int *num_hbonds = fix_reax->num_hbonds; + + // determine the local and total capacity + + api->system->local_cap = MAX((int)(api->system->n * safezone), mincap); + api->system->total_cap = MAX((int)(api->system->N * safezone), mincap); + + // initialize my data structures + + PreAllocate_Space(api->system, api->workspace); + write_reax_atoms(); + + api->system->wsize = comm->nprocs; + + int num_nbrs = estimate_reax_lists(); + if (num_nbrs < 0) + error->all(FLERR,"Too many neighbors for pair style reax/c"); + + Make_List(api->system->total_cap,num_nbrs,TYP_FAR_NEIGHBOR,api->lists+FAR_NBRS); + (api->lists+FAR_NBRS)->error_ptr=error; + + write_reax_lists(); + + InitializeOMP(api->system,api->control,api->data,api->workspace,&api->lists,world); + for (int k = 0; k < api->system->N; ++k) { + num_bonds[k] = api->system->my_atoms[k].num_bonds; + num_hbonds[k] = api->system->my_atoms[k].num_hbonds; + } + + } else { + + // fill in reax datastructures + + write_reax_atoms(); + + // reset the bond list info for new atoms + + for (int k = oldN; k < api->system->N; ++k) + Set_End_Index(k, Start_Index(k, api->lists+BONDS), api->lists+BONDS); + + // estimate far neighbor list size + // Not present in MPI-only version + api->workspace->realloc.num_far = estimate_reax_lists(); + + // check if I need to shrink/extend my data-structs + + ReAllocate(api->system, api->control, api->data, api->workspace, &api->lists); + } +} + +/* ---------------------------------------------------------------------- */ + void PairReaxCOMP::compute(int eflag, int vflag) { double evdwl,ecoul; @@ -214,132 +336,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::init_style() -{ - if (!atom->q_flag) - error->all(FLERR,"Pair reax/c/omp requires atom attribute q"); - - // firstwarn = 1; - - bool have_qeq = ((modify->find_fix_by_style("^qeq/reax") != -1) - || (modify->find_fix_by_style("^qeq/shielded") != -1)); - if (!have_qeq && qeqflag == 1) - error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); - - api->system->n = atom->nlocal; // my atoms - api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - api->system->bigN = static_cast (atom->natoms); // all atoms in the system - api->system->wsize = comm->nprocs; - - if (atom->tag_enable == 0) - error->all(FLERR,"Pair style reax/c/omp requires atom IDs"); - if (force->newton_pair == 0) - error->all(FLERR,"Pair style reax/c/omp requires newton pair on"); - - if ((atom->map_tag_max > 99999999) && (comm->me == 0)) - error->warning(FLERR,"Some Atom-IDs are too large. Pair style reax/c/omp " - "native output files may get misformatted or corrupted"); - - // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT - - if (atom->natoms > MAXSMALLINT) - error->all(FLERR,"Too many atoms for pair style reax/c/omp"); - - // need a half neighbor list w/ Newton off and ghost neighbors - // built whenever re-neighboring occurs - - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->newton = 2; - neighbor->requests[irequest]->ghost = 1; - - cutmax = MAX3(api->control->nonb_cut, api->control->hbond_cut, api->control->bond_cut); - if ((cutmax < 2.0*api->control->bond_cut) && (comm->me == 0)) - error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " - "increased neighbor list skin."); - - for (int i = 0; i < LIST_N; ++i) - api->lists[i].allocated = 0; - - if (fix_reax == nullptr) { - modify->add_fix(fmt::format("{} all REAXC",fix_id)); - fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; - } - - api->control->nthreads = comm->nthreads; -} - -/* ---------------------------------------------------------------------- */ - -void PairReaxCOMP::setup() -{ - int oldN; - int mincap = api->system->mincap; - double safezone = api->system->safezone; - - api->system->n = atom->nlocal; // my atoms - api->system->N = atom->nlocal + atom->nghost; // mine + ghosts - oldN = api->system->N; - api->system->bigN = static_cast (atom->natoms); // all atoms in the system - - if (api->system->N > nmax) { - memory->destroy(num_nbrs_offset); - // Don't update nmax here. It is updated at end of compute(). - memory->create(num_nbrs_offset, api->system->N, "pair:num_nbrs_offset"); - } - - if (setup_flag == 0) { - - setup_flag = 1; - - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; - - // determine the local and total capacity - - api->system->local_cap = MAX((int)(api->system->n * safezone), mincap); - api->system->total_cap = MAX((int)(api->system->N * safezone), mincap); - - // initialize my data structures - - PreAllocate_Space(api->system, api->workspace); - write_reax_atoms(); - - int num_nbrs = estimate_reax_lists(); - Make_List(api->system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, api->lists+FAR_NBRS); - - write_reax_lists(); - - InitializeOMP(api->system, api->control, api->data, - api->workspace, &api->lists, world); - - for (int k = 0; k < api->system->N; ++k) { - num_bonds[k] = api->system->my_atoms[k].num_bonds; - num_hbonds[k] = api->system->my_atoms[k].num_hbonds; - } - - } else { - - // fill in reax datastructures - - write_reax_atoms(); - - // reset the bond list info for new atoms - - for (int k = oldN; k < api->system->N; ++k) - Set_End_Index(k, Start_Index(k, api->lists+BONDS), api->lists+BONDS); - - // estimate far neighbor list size - // Not present in MPI-only version - api->workspace->realloc.num_far = estimate_reax_lists(); - - // check if I need to shrink/extend my data-structs - - ReAllocate(api->system, api->control, api->data, api->workspace, &api->lists); - } -} - -/* ---------------------------------------------------------------------- */ - void PairReaxCOMP::write_reax_atoms() { int *num_bonds = fix_reax->num_bonds; diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index cccee3afe8..bfaa871b61 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -1,6 +1,5 @@ /*---------------------------------------------------------------------- PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd Copyright (2010) Purdue University @@ -27,15 +26,13 @@ ----------------------------------------------------------------------*/ #include "reaxff_omp.h" +#include "reaxff_api.h" #include "error.h" -#include "reaxff_api.h" - +#include #include -/* ---------------------------------------------------------------------- */ - namespace ReaxFF { static void Init_ListsOMP(reax_system *system, control_params *control, reax_list **lists) @@ -63,6 +60,7 @@ namespace ReaxFF { total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); Make_List(system->Hcap, total_hbonds, TYP_HBOND,*lists+HBONDS); + (*lists+HBONDS)->error_ptr = system->error_ptr; } total_bonds = 0; @@ -73,6 +71,7 @@ namespace ReaxFF { bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); Make_List(system->total_cap, bond_cap, TYP_BOND,*lists+BONDS); + (*lists+BONDS)->error_ptr = system->error_ptr; int nthreads = control->nthreads; reax_list *bonds = (*lists)+BONDS; @@ -84,14 +83,12 @@ namespace ReaxFF { /* 3bodies list */ cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); Make_List(bond_cap, cap_3body, TYP_THREE_BODY,*lists+THREE_BODIES); + (*lists+THREE_BODIES)->error_ptr = system->error_ptr; free(hb_top); free(bond_top); } -/* ---------------------------------------------------------------------- */ - -// The only difference with the MPI-only function is calls to Init_ListsOMP and Init_Force_FunctionsOMP(). void InitializeOMP(reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, MPI_Comm world) @@ -100,7 +97,6 @@ namespace ReaxFF { Init_Simulation_Data(data); Init_Workspace(system,control,workspace); Init_ListsOMP(system,control,lists); - if (control->tabulate) Init_Lookup_Tables(system,control,workspace,world); } diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index eef7df53fd..4a1e92552d 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -376,8 +376,8 @@ void FixQEqReax::init() if (!atom->q_flag) error->all(FLERR,"Fix qeq/reax requires atom attribute q"); - ngroup = group->count(igroup); - if (ngroup == 0) error->all(FLERR,"Fix qeq/reax group has no atoms"); + if (group->count(igroup) == 0) + error->all(FLERR,"Fix qeq/reax group has no atoms"); // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index 9fc20f35d0..acd60f67b6 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -72,8 +72,6 @@ class FixQEqReax : public Fix { double *chi,*eta,*gamma; // qeq parameters double **shld; - bigint ngroup; - // fictitious charges double *s, *t; diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 5cd1556943..3c7980382e 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -12,8 +12,9 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Hasan Metin Aktulga, Purdue University - (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) + Contributing author: + Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu + Per-atom energy/virial added by Ray Shan (Sandia) Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added by Ray Shan (Sandia) @@ -26,7 +27,6 @@ #include "citeme.h" #include "comm.h" #include "error.h" -#include "fix.h" #include "fix_reaxc.h" #include "force.h" #include "memory.h" @@ -129,7 +129,7 @@ PairReaxC::~PairReaxC() if (api->control->tabulate) Deallocate_Lookup_Tables(api->system); - if (api->control->hbond_cut > 0) Delete_List(api->lists+HBONDS); + if (api->control->hbond_cut > 0) Delete_List(api->lists+HBONDS); Delete_List(api->lists+BONDS); Delete_List(api->lists+THREE_BODIES); Delete_List(api->lists+FAR_NBRS); @@ -335,8 +335,6 @@ void PairReaxC::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style reax/c requires atom attribute q"); - // firstwarn = 1; - bool have_qeq = ((modify->find_fix_by_style("^qeq/reax") != -1) || (modify->find_fix_by_style("^qeq/shielded") != -1)); if (!have_qeq && qeqflag == 1) @@ -351,9 +349,6 @@ void PairReaxC::init_style() error->all(FLERR,"Pair style reax/c requires atom IDs"); if (force->newton_pair == 0) error->all(FLERR,"Pair style reax/c requires newton pair on"); - if ((atom->map_tag_max > 99999999) && (comm->me == 0)) - error->warning(FLERR,"Some Atom-IDs are too large. Pair style reax/c " - "native output files may get misformatted or corrupted"); // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT @@ -372,10 +367,6 @@ void PairReaxC::init_style() error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - for (int i = 0; i < LIST_N; ++i) - if (api->lists[i].allocated != 1) - api->lists[i].allocated = 0; - if (fix_reax == nullptr) { modify->add_fix(fmt::format("{} all REAXC",fix_id)); fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; @@ -412,17 +403,18 @@ void PairReaxC::setup() PreAllocate_Space(api->system, api->workspace); write_reax_atoms(); + api->system->wsize = comm->nprocs; + int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) error->all(FLERR,"Too many neighbors for pair style reax/c"); - Make_List(api->system->total_cap, num_nbrs, - TYP_FAR_NEIGHBOR, api->lists+FAR_NBRS); + + Make_List(api->system->total_cap,num_nbrs,TYP_FAR_NEIGHBOR,api->lists+FAR_NBRS); (api->lists+FAR_NBRS)->error_ptr=error; write_reax_lists(); - api->system->wsize = comm->nprocs; - Initialize(api->system, api->control, api->data, - api->workspace, &api->lists, world); + + Initialize(api->system,api->control,api->data,api->workspace,&api->lists,world); for (int k = 0; k < api->system->N; ++k) { num_bonds[k] = api->system->my_atoms[k].num_bonds; num_hbonds[k] = api->system->my_atoms[k].num_hbonds; @@ -443,9 +435,6 @@ void PairReaxC::setup() ReAllocate(api->system, api->control, api->data, api->workspace, &api->lists); } - - bigint local_ngroup = list->inum; - MPI_Allreduce(&local_ngroup, &ngroup, 1, MPI_LMP_BIGINT, MPI_SUM, world); } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/pair_reaxc.h b/src/USER-REAXC/pair_reaxc.h index 9372f23ff4..ea5fe54481 100644 --- a/src/USER-REAXC/pair_reaxc.h +++ b/src/USER-REAXC/pair_reaxc.h @@ -54,8 +54,6 @@ class PairReaxC : public Pair { double **tmpbo,**tmpr; ReaxFF::API *api; - - bigint ngroup; typedef double rvec[3]; protected: diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index b79c5fe57c..fb5df616b3 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -288,6 +288,20 @@ namespace ReaxFF { Reallocate_Bonds_List(control, system, (*lists)+BONDS, &num_bonds, &est_3body); wsr->bonds = 0; wsr->num_3body = MAX(wsr->num_3body, est_3body) * 2; + + + if (system->omp_active) { + int nthreads = control->nthreads; + reax_list *bonds = (*lists)+BONDS; + + for (int i = 0; i < bonds->num_intrs; ++i) { + sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction, + "CdboReduction"); + + bonds->select.bond_list[i].bo_data.CdboReduction = + (double*) smalloc(error, sizeof(double)*nthreads, "CdboReduction"); + } + } } /* 3-body list */ diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index d2b014947e..7e165d51e1 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -2,15 +2,16 @@ PuReMD - Purdue ReaxFF Molecular Dynamics Program Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu + + Contributing authors: + H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama + Corresponding author: + Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu Please cite the related publication: H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. + Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -165,11 +166,11 @@ namespace ReaxFF { simulation_data *data, storage *workspace, reax_list **lists, MPI_Comm world) { - Init_System(system, control); + Init_System(system,control); Init_Simulation_Data(data); - Init_Workspace(system, control, workspace); - Init_Lists(system, control, lists); + Init_Workspace(system,control,workspace); + Init_Lists(system,control,lists); if (control->tabulate) - Init_Lookup_Tables(system, control, workspace, world); + Init_Lookup_Tables(system,control,workspace,world); } } From d2008aa3623653c1897f63968393efc4730ed753 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 01:19:45 -0400 Subject: [PATCH 069/119] add test for reaxff using coulomb tabulation --- src/USER-REAXC/reaxc_init_md.cpp | 4 +- .../tests/atomic-pair-reax_c_tabulate.yaml | 174 ++++++++++++++++++ unittest/force-styles/tests/reaxff.control | 7 + 3 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml create mode 100644 unittest/force-styles/tests/reaxff.control diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 7e165d51e1..3c98e1f15d 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -27,13 +27,13 @@ #include "reaxff_api.h" +#include "error.h" + #include #include #include #include -#include "error.h" - namespace ReaxFF { void Init_System(reax_system *system, control_params *control) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml new file mode 100644 index 0000000000..ed599c837f --- /dev/null +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -0,0 +1,174 @@ +--- +lammps_version: 8 Apr 2021 +date_generated: Wed Apr 21 00:57:10 2021 +epsilon: 1e-12 +skip_tests: +prerequisites: ! | + pair reax/c + fix qeq/reax +pre_commands: ! | + echo screen + shell cp ${input_dir}/reaxff.control reaxff-1.control + variable newton_pair delete + variable newton_pair index on + atom_modify map array + units real + atom_style charge + lattice diamond 3.77 + region box block 0 2 0 2 0 2 + create_box 2 box + create_atoms 1 box + displace_atoms all random 0.1 0.1 0.1 623426 + mass 1 12.0 + mass 2 13.0 + set type 1 type/fraction 2 0.5 998877 + set type 1 charge 0.01 + set type 2 charge -0.01 + velocity all create 100 4534624 loop geom +post_commands: ! | + fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c +input_file: in.empty +pair_style: reax/c reaxff-1.control checkqeq yes +pair_coeff: ! | + * * ffield.reax.mattsson C O +extract: ! "" +natoms: 64 +init_vdwl: -4208.203794533516 +init_coul: -268.0258681099902 +init_stress: ! |2- + 2.3677048490913976e+03 3.0802122558796082e+03 1.2727815110251254e+03 -1.5387991688241113e+03 -1.0906364142627658e+03 1.1229877249527667e+03 +init_forces: ! |2 + 1 2.9634051452065776e+01 -5.6267761875029782e+02 -1.6668253255994802e+02 + 2 -1.5938437728856897e+02 -2.2076601831947826e+02 -1.7161994484504669e+02 + 3 -3.1194106231031462e+01 -3.0591930644160692e+02 4.4652570958825507e+01 + 4 4.4646653320082436e+02 1.7080811286685625e+02 1.7439026170462094e+02 + 5 -1.1512606621588829e+02 7.9716954463493224e+01 1.7959700550214329e+01 + 6 -7.1695199301547871e+02 4.0749156820934594e+01 2.1512037025856768e+02 + 7 2.3022543693175331e+02 -9.0170756873740558e+01 8.2190170006875675e+01 + 8 -2.1141251466328132e+01 -1.5635879347045079e+02 1.6101907187955612e+02 + 9 -1.2130842270564283e+02 -2.7960689135651160e+02 -1.9629114850255749e+02 + 10 -3.7631710890094666e+02 3.4103240548851926e+02 -1.8166279141134461e+02 + 11 -1.6154553323850425e+02 1.5743068117721410e+02 3.5832389058234611e+02 + 12 6.1602989065568624e+02 -1.4821564423107765e+02 1.0871005319351426e+02 + 13 -2.1366561068642801e+02 -3.0163595494898948e+02 5.2420406156017953e+02 + 14 2.5933950255876238e+02 -1.7967300062473768e+01 -2.7733367021016375e+02 + 15 1.7570537661853186e+02 1.7550639099555497e+02 -9.5789475936343749e+01 + 16 3.0588529285449920e+02 -4.7675556549224140e+01 -3.4330544488852303e+02 + 17 -1.5018545342618870e+02 1.3259542010622351e+02 2.3200545258700299e+02 + 18 1.6469564396901546e+02 -1.0816413254489154e+02 2.1207485840068557e+02 + 19 2.4759285902963390e+02 -4.8758383780485623e+01 -2.2494100786656901e+02 + 20 1.2418785577586725e+02 2.5137242577508303e+02 -1.5341186115659308e+01 + 21 -1.9556210564941841e+02 2.3152590535658355e+01 -1.2529729601998551e+02 + 22 2.4829386068623685e+02 -2.9828789153728195e+02 -4.0455445433014944e+01 + 23 8.2076007650220902e+01 1.3042103437662357e+02 1.5221389911913158e+02 + 24 -7.6912973583042813e+01 2.3539925428986885e+02 -1.7129603802743895e+02 + 25 -2.9782413878301764e+01 -1.8931910469292632e+02 6.7989202537824610e+01 + 26 -3.9488494691904407e+01 2.1025614475916794e+00 -2.0748963060920084e+02 + 27 -2.7704110443956750e+02 5.3736974078117703e+02 4.2318884882972577e+02 + 28 -2.9303219943094604e+02 -5.1154115419361588e+01 -2.3633993403334915e+02 + 29 1.2970484011863061e+02 -4.2266229541142110e+01 1.6350076614995828e+02 + 30 5.6925606430591166e+01 3.7880191852724600e+01 6.8636397133459397e+01 + 31 -1.9325596697353996e+02 -1.1645368911554472e+02 -2.0671692760919722e+01 + 32 1.2360965200040813e+02 -3.3253411369721618e+01 -1.0516118458985304e+02 + 33 6.5241847803273885e+01 3.7105112939424635e+02 6.0972558235447849e+01 + 34 -2.3124259597682195e+02 -1.1681740329854802e+02 -2.5838262648358682e+02 + 35 -4.1912226107425607e+02 7.9942920270887299e+01 3.1021023518170796e+02 + 36 -1.8561789047315065e+02 -1.1563628711189787e+02 -4.2360172436435668e+01 + 37 8.8271496728328600e+00 -3.5266450940709689e+02 -6.0505384072732632e+01 + 38 -1.9249505149101950e+01 1.1716319600338795e+02 -2.3477222840168844e+02 + 39 -1.0433878247327728e+01 -7.0902801856110116e+01 1.4264113912369351e+02 + 40 3.3265570779158168e+02 -8.8675933035692435e+02 1.6250845779881573e+01 + 41 -6.4537349815946172e+01 1.5189506353180369e+02 -1.8225353662793415e+02 + 42 2.3368723487157848e+01 1.1821526860005753e+02 4.1207323013202608e+02 + 43 -3.5145546474526668e+01 -3.6511647370512939e+00 2.4936793079205805e+02 + 44 -1.2881828259541797e+00 -2.4877240180804270e+02 7.9235766494551896e+01 + 45 2.0871504532586613e+02 -1.0817588901351927e+02 -4.1291808327433904e+02 + 46 -1.3837716960728835e+02 4.6114279241763722e+02 -2.4013801845141236e+02 + 47 1.3255320792802306e+02 2.8747276038940731e+02 -3.2896384987636942e+01 + 48 7.8145138718949806e+02 6.5215432481146109e+01 -6.2304789958703225e+02 + 49 2.4486314507346734e+02 1.9101300126656582e+01 3.7417037047544437e+02 + 50 2.9821275118602205e+02 3.0684252095007048e+02 5.6994896759618052e+02 + 51 -8.0052405736429807e+02 5.1024940640341299e+02 7.5829315450277397e+02 + 52 -9.2130898885938862e+01 1.1909837120724032e+02 -2.4118832391138585e+02 + 53 -3.6386926333478533e+02 -2.0729203700042135e+02 -3.4910517647665347e+02 + 54 -8.3399710534951524e+01 1.8942260327525179e+02 -1.2868598438438329e+02 + 55 -2.5305956575884065e+02 -1.1005916187118694e+02 -3.0893514828399697e+02 + 56 1.7364614503217334e+02 -2.5754370913441153e+02 -4.3744509948721834e+01 + 57 4.2667925201499622e+02 1.5529221173799826e+02 -3.9988499000699767e+02 + 58 -3.9656744140970858e+01 7.8953243693724005e+01 2.6135299122198956e+02 + 59 -2.7594240444747430e+02 1.9891763338583493e+02 2.4122500794450380e+02 + 60 -2.5675904361260217e+02 -1.1527171320985197e+02 9.9923550442518007e+01 + 61 3.0884427580008497e+02 4.9986415802549533e+02 -1.3369122169831985e+02 + 62 2.8530106503455144e+01 5.9540697570421841e-01 -2.7403025931182458e+02 + 63 2.5297054006405503e+02 -2.7640485799384788e+02 -1.9200503841910373e+02 + 64 -8.4680445259253446e+01 -1.5737027404336791e+02 1.5637808719883620e+02 +run_vdwl: -4208.209603101806 +run_coul: -268.02583477440504 +run_stress: ! |2- + 2.3675903993340926e+03 3.0802227297803529e+03 1.2727311522662451e+03 -1.5388669378284644e+03 -1.0907269208283653e+03 1.1229243202763250e+03 +run_forces: ! |2 + 1 2.9635294281596629e+01 -5.6267712552695355e+02 -1.6667999923844260e+02 + 2 -1.5938673400153084e+02 -2.2076536449681615e+02 -1.7162354129443358e+02 + 3 -3.1189858281107686e+01 -3.0593580065881065e+02 4.4645958607276903e+01 + 4 4.4646581891372387e+02 1.7080959763779416e+02 1.7439093938226924e+02 + 5 -1.1512839796353090e+02 7.9717058687928301e+01 1.7957487669503269e+01 + 6 -7.1695602565953754e+02 4.0752829698565129e+01 2.1512533839229457e+02 + 7 2.3022644486519411e+02 -9.0168915600548360e+01 8.2194655874266601e+01 + 8 -2.1149264848797216e+01 -1.5637111051642705e+02 1.6102981315496413e+02 + 9 -1.2130987756626666e+02 -2.7961363383950726e+02 -1.9628960069614115e+02 + 10 -3.7631817089744851e+02 3.4103259385937554e+02 -1.8166532788358310e+02 + 11 -1.6154687915128738e+02 1.5742797820592227e+02 3.5832199951133208e+02 + 12 6.1603841944462704e+02 -1.4820397700323306e+02 1.0871524086058155e+02 + 13 -2.1367529106933924e+02 -3.0167446795626824e+02 5.2424091634186300e+02 + 14 2.5933827511241435e+02 -1.7968203382134384e+01 -2.7733114072539058e+02 + 15 1.7570793004243023e+02 1.7551005525188847e+02 -9.5784231788978602e+01 + 16 3.0586985592967716e+02 -4.7679566105942172e+01 -3.4332192731503403e+02 + 17 -1.5018636472333401e+02 1.3259146324637055e+02 2.3200578297676140e+02 + 18 1.6469881174805093e+02 -1.0816836176977682e+02 2.1207670716679300e+02 + 19 2.4759420520504440e+02 -4.8758383157728915e+01 -2.2494116682878234e+02 + 20 1.2419960666451705e+02 2.5137933265662170e+02 -1.5328241144751686e+01 + 21 -1.9556094492800662e+02 2.3151723982044651e+01 -1.2529581330697289e+02 + 22 2.4829941584477842e+02 -2.9829345245035574e+02 -4.0446702084691779e+01 + 23 8.2074458696899129e+01 1.3042100306282259e+02 1.5221371881646226e+02 + 24 -7.6917668833498695e+01 2.3540360228737018e+02 -1.7130192995353460e+02 + 25 -2.9742104523791699e+01 -1.8935699467869648e+02 6.7995874219740458e+01 + 26 -3.9494943772601978e+01 2.1074054704282794e+00 -2.0748981609858308e+02 + 27 -2.7704003655184448e+02 5.3736954143364790e+02 4.2318574013793062e+02 + 28 -2.9302855291124280e+02 -5.1149666118966557e+01 -2.3633679976948292e+02 + 29 1.2970505460339569e+02 -4.2266433901944204e+01 1.6349685185794760e+02 + 30 5.6925896868063084e+01 3.7880918758222101e+01 6.8637128510015330e+01 + 31 -1.9325534294265930e+02 -1.1645328076629426e+02 -2.0671892621504877e+01 + 32 1.2360198063080443e+02 -3.3253019999909611e+01 -1.0516936549559779e+02 + 33 6.5239383936206508e+01 3.7104662858438877e+02 6.0974455303728860e+01 + 34 -2.3124084085036844e+02 -1.1681523003030674e+02 -2.5837805461650709e+02 + 35 -4.1912113383000468e+02 7.9943750613167680e+01 3.1020725803703027e+02 + 36 -1.8561422052424510e+02 -1.1563434085918074e+02 -4.2360108129535796e+01 + 37 8.8275421441412476e+00 -3.5266971563405309e+02 -6.0507541453139780e+01 + 38 -1.9245036832024766e+01 1.1717726898935943e+02 -2.3478417248417912e+02 + 39 -1.0434224692463781e+01 -7.0902644440215226e+01 1.4263978421853071e+02 + 40 3.3271177801097338e+02 -8.8679293552761737e+02 1.6219742097553457e+01 + 41 -6.4538764986414577e+01 1.5189397693607691e+02 -1.8225441696792819e+02 + 42 2.3368235855730731e+01 1.1822246665291377e+02 4.1207745038648687e+02 + 43 -3.5145643416897457e+01 -3.6517162542343855e+00 2.4936784352977961e+02 + 44 -1.2879745400833591e+00 -2.4877345145141396e+02 7.9236449970507763e+01 + 45 2.0871643412337198e+02 -1.0817571271699651e+02 -4.1291831345624706e+02 + 46 -1.3836372705478144e+02 4.6117938292253501e+02 -2.4016736526221220e+02 + 47 1.3255125611057710e+02 2.8747591615866617e+02 -3.2895660248667433e+01 + 48 7.8145417759951215e+02 6.5214930060411348e+01 -6.2304930828893896e+02 + 49 2.4488281403353915e+02 1.9105496615716447e+01 3.7418605144303535e+02 + 50 2.9822129513621309e+02 3.0683153982656597e+02 5.6994490418774978e+02 + 51 -8.0058572063783151e+02 5.1028617285838249e+02 7.5832431569026710e+02 + 52 -9.2137024513817948e+01 1.1910687193197515e+02 -2.4119120858090670e+02 + 53 -3.6387082584323133e+02 -2.0729771077062716e+02 -3.4910499737662099e+02 + 54 -8.3401322475873869e+01 1.8942466656601317e+02 -1.2869045777948361e+02 + 55 -2.5309678413623200e+02 -1.1001947899857403e+02 -3.0896372370121441e+02 + 56 1.7364604574034126e+02 -2.5754429115053944e+02 -4.3743962050163233e+01 + 57 4.2666362581864416e+02 1.5528157995542574e+02 -3.9988032807909389e+02 + 58 -3.9656744873549869e+01 7.8953170999147900e+01 2.6135222052406010e+02 + 59 -2.7594581611209134e+02 1.9891770704099989e+02 2.4122933700016557e+02 + 60 -2.5675992319680108e+02 -1.1527235824442386e+02 9.9923831048631499e+01 + 61 3.0884428120705229e+02 4.9986711220597209e+02 -1.3369013376796403e+02 + 62 2.8530678742626058e+01 5.9283151669356982e-01 -2.7403002505094940e+02 + 63 2.5296775626792657e+02 -2.7640525289662452e+02 -1.9200401038409547e+02 + 64 -8.4674586435535105e+01 -1.5736397776829435e+02 1.5637348700622513e+02 +... diff --git a/unittest/force-styles/tests/reaxff.control b/unittest/force-styles/tests/reaxff.control new file mode 100644 index 0000000000..ecf22940b7 --- /dev/null +++ b/unittest/force-styles/tests/reaxff.control @@ -0,0 +1,7 @@ +tabulate_long_range 10000 ! denotes the granularity of long range tabulation, 0 means no tabulation + +nbrhood_cutoff 4.5 ! near neighbors cutoff for bond calculations in A +hbond_cutoff 6.0 ! cutoff distance for hydrogen bond interactions +bond_graph_cutoff 0.3 ! bond strength cutoff for bond graphs +thb_cutoff 0.001 ! cutoff value for three body interactions + From 82ecfabe2267c8d5f4b60a95e4cfecf8a781d89f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 01:29:48 -0400 Subject: [PATCH 070/119] remove more unused code and structs --- src/USER-REAXC/pair_reaxc.cpp | 2 -- src/USER-REAXC/reaxc_list.cpp | 29 ----------------------------- src/USER-REAXC/reaxff_defs.h | 5 ++--- src/USER-REAXC/reaxff_types.h | 13 ------------- 4 files changed, 2 insertions(+), 47 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 3c7980382e..ea4e2509ce 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -758,8 +758,6 @@ double PairReaxC::memory_usage() bytes += (double)2.0 * api->lists->n * sizeof(int); bytes += (double)api->lists->num_intrs * sizeof(three_body_interaction_data); bytes += (double)api->lists->num_intrs * sizeof(bond_data); - bytes += (double)api->lists->num_intrs * sizeof(dbond_data); - bytes += (double)api->lists->num_intrs * sizeof(dDelta_data); bytes += (double)api->lists->num_intrs * sizeof(far_neighbor_data); bytes += (double)api->lists->num_intrs * sizeof(hbond_data); diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 1063328f8e..a31d300103 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -46,11 +46,6 @@ namespace ReaxFF { l->type = type; switch(l->type) { - case TYP_VOID: - if (l->select.v) sfree(l->error_ptr, l->select.v, "list:v"); - l->select.v = (void*) smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(void*), "list:v"); - break; - case TYP_THREE_BODY: if (l->select.three_body_list) sfree(l->error_ptr, l->select.three_body_list,"list:three_bodies"); l->select.three_body_list = (three_body_interaction_data*) @@ -64,18 +59,6 @@ namespace ReaxFF { smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(bond_data), "list:bonds"); break; - case TYP_DBO: - if (l->select.dbo_list) sfree(l->error_ptr, l->select.dbo_list,"list:dbonds"); - l->select.dbo_list = (dbond_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dbond_data), "list:dbonds"); - break; - - case TYP_DDELTA: - if (l->select.dDelta_list) sfree(l->error_ptr, l->select.dDelta_list,"list:dDeltas"); - l->select.dDelta_list = (dDelta_data*) - smalloc(l->error_ptr, (rc_bigint) num_intrs * sizeof(dDelta_data), "list:dDeltas"); - break; - case TYP_FAR_NEIGHBOR: if (l->select.far_nbr_list) sfree(l->error_ptr, l->select.far_nbr_list,"list:far_nbrs"); l->select.far_nbr_list = (far_neighbor_data*) @@ -105,10 +88,6 @@ namespace ReaxFF { l->end_index = nullptr; switch(l->type) { - case TYP_VOID: - sfree(l->error_ptr, l->select.v, "list:v"); - l->select.v = nullptr; - break; case TYP_HBOND: sfree(l->error_ptr, l->select.hbond_list, "list:hbonds"); l->select.hbond_list = nullptr; @@ -121,14 +100,6 @@ namespace ReaxFF { sfree(l->error_ptr, l->select.bond_list, "list:bonds"); l->select.bond_list = nullptr; break; - case TYP_DBO: - sfree(l->error_ptr, l->select.dbo_list, "list:dbos"); - l->select.dbo_list = nullptr; - break; - case TYP_DDELTA: - sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas"); - l->select.dDelta_list = nullptr; - break; case TYP_THREE_BODY: sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies"); l->select.three_body_list = nullptr; diff --git a/src/USER-REAXC/reaxff_defs.h b/src/USER-REAXC/reaxff_defs.h index 2727fb897e..df31d41d4c 100644 --- a/src/USER-REAXC/reaxff_defs.h +++ b/src/USER-REAXC/reaxff_defs.h @@ -59,9 +59,8 @@ namespace ReaxFF { /******************* ENUMERATORS *************************/ - enum lists { BONDS, THREE_BODIES, HBONDS, FAR_NBRS, LIST_N }; - enum interactions {TYP_VOID, TYP_BOND, TYP_THREE_BODY, - TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_DBO, TYP_DDELTA, TYP_N}; + enum {BONDS, THREE_BODIES, HBONDS, FAR_NBRS, LIST_N}; + enum {TYP_BOND, TYP_THREE_BODY, TYP_HBOND, TYP_FAR_NEIGHBOR, TYP_N}; } #endif diff --git a/src/USER-REAXC/reaxff_types.h b/src/USER-REAXC/reaxff_types.h index 1a68116391..c88e0f5a6a 100644 --- a/src/USER-REAXC/reaxff_types.h +++ b/src/USER-REAXC/reaxff_types.h @@ -293,16 +293,6 @@ namespace ReaxFF far_neighbor_data *ptr; }; - struct dDelta_data { - int wrt; - rvec dVal; - }; - - struct dbond_data { - int wrt; - rvec dBO, dBOpi, dBOpi2; - }; - struct bond_order_data { double BO, BO_s, BO_pi, BO_pi2; double Cdbo, Cdbopi, Cdbopi2; @@ -372,11 +362,8 @@ namespace ReaxFF union list_type { - void *v; three_body_interaction_data *three_body_list; bond_data *bond_list; - dbond_data *dbo_list; - dDelta_data *dDelta_list; far_neighbor_data *far_nbr_list; hbond_data *hbond_list; }; From 9b59e901bc454e6981d44dbd62122d98ad9f28dc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 09:54:59 -0400 Subject: [PATCH 071/119] update reax/c tests. disable OpenMP tests as that code is broken. --- .../tests/atomic-pair-reax_c.yaml | 290 ++++++++--------- .../tests/atomic-pair-reax_c_lgvdw.yaml | 291 +++++++++--------- .../tests/atomic-pair-reax_c_noqeq.yaml | 4 +- .../tests/atomic-pair-reax_c_tabulate.yaml | 291 +++++++++--------- 4 files changed, 443 insertions(+), 433 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index 857326b10d..570233f4bd 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,8 +1,8 @@ --- lammps_version: 8 Apr 2021 -date_generated: Tue Apr 20 16:11:55 2021 -epsilon: 1e-10 -skip_tests: +date_generated: Wed Apr 21 09:14:10 2021 +epsilon: 1e-11 +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -15,159 +15,163 @@ pre_commands: ! | atom_style charge lattice diamond 3.77 region box block 0 2 0 2 0 2 - create_box 2 box + create_box 3 box create_atoms 1 box displace_atoms all random 0.1 0.1 0.1 623426 - mass 1 12.0 - mass 2 13.0 + mass 1 1.0 + mass 2 12.0 + mass 3 16.0 set type 1 type/fraction 2 0.5 998877 - set type 1 charge 0.01 - set type 2 charge -0.01 + set type 2 type/fraction 3 0.5 887766 + set type 1 charge 0.00 + set type 2 charge 0.01 + set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c + pair_modify nofdotr input_file: in.empty pair_style: reax/c NULL checkqeq yes pair_coeff: ! | - * * ffield.reax.mattsson C O + * * ffield.reax.mattsson H C O extract: ! "" natoms: 64 -init_vdwl: -4208.203794533267 -init_coul: -268.0258681099893 +init_vdwl: -3296.3503506624793 +init_coul: -327.06551252279587 init_stress: ! |2- - 2.3677048490925813e+03 3.0802122558807969e+03 1.2727815110263937e+03 -1.5387991688242109e+03 -1.0906364142628713e+03 1.1229877249527449e+03 + 3.0523786192092821e+03 3.0876898599834703e+03 3.2008340933315003e+03 -9.2310133390813661e+01 -2.9719470139173262e+02 -8.6006991065711546e+01 init_forces: ! |2 - 1 2.9634051452064185e+01 -5.6267761875030578e+02 -1.6668253255995427e+02 - 2 -1.5938437728855834e+02 -2.2076601831947630e+02 -1.7161994484503376e+02 - 3 -3.1194106231028943e+01 -3.0591930644159874e+02 4.4652570958842091e+01 - 4 4.4646653320084567e+02 1.7080811286684130e+02 1.7439026170464035e+02 - 5 -1.1512606621591536e+02 7.9716954463499022e+01 1.7959700550221577e+01 - 6 -7.1695199301548041e+02 4.0749156820926302e+01 2.1512037025856239e+02 - 7 2.3022543693175217e+02 -9.0170756873726333e+01 8.2190170006889645e+01 - 8 -2.1141251466334634e+01 -1.5635879347045886e+02 1.6101907187957218e+02 - 9 -1.2130842270563915e+02 -2.7960689135651120e+02 -1.9629114850256667e+02 - 10 -3.7631710890095133e+02 3.4103240548851863e+02 -1.8166279141134066e+02 - 11 -1.6154553323853384e+02 1.5743068117724297e+02 3.5832389058241489e+02 - 12 6.1602989065569886e+02 -1.4821564423105795e+02 1.0871005319350247e+02 - 13 -2.1366561068643219e+02 -3.0163595494900011e+02 5.2420406156019726e+02 - 14 2.5933950255875533e+02 -1.7967300062459064e+01 -2.7733367021016983e+02 - 15 1.7570537661854226e+02 1.7550639099554951e+02 -9.5789475936342853e+01 - 16 3.0588529285450090e+02 -4.7675556549230315e+01 -3.4330544488854196e+02 - 17 -1.5018545342619470e+02 1.3259542010621982e+02 2.3200545258699555e+02 - 18 1.6469564396901654e+02 -1.0816413254489510e+02 2.1207485840068148e+02 - 19 2.4759285902963026e+02 -4.8758383780523836e+01 -2.2494100786658765e+02 - 20 1.2418785577587857e+02 2.5137242577506828e+02 -1.5341186115637054e+01 - 21 -1.9556210564941867e+02 2.3152590535678623e+01 -1.2529729601999072e+02 - 22 2.4829386068622458e+02 -2.9828789153726473e+02 -4.0455445433038705e+01 - 23 8.2076007650237955e+01 1.3042103437664485e+02 1.5221389911915190e+02 - 24 -7.6912973583045328e+01 2.3539925428983466e+02 -1.7129603802744774e+02 - 25 -2.9782413878295884e+01 -1.8931910469291046e+02 6.7989202537813426e+01 - 26 -3.9488494691930782e+01 2.1025614476190424e+00 -2.0748963060916628e+02 - 27 -2.7704110443958297e+02 5.3736974078118158e+02 4.2318884882973293e+02 - 28 -2.9303219943093302e+02 -5.1154115419355229e+01 -2.3633993403335379e+02 - 29 1.2970484011865997e+02 -4.2266229541184131e+01 1.6350076614993492e+02 - 30 5.6925606430580402e+01 3.7880191852747046e+01 6.8636397133447261e+01 - 31 -1.9325596697353834e+02 -1.1645368911553673e+02 -2.0671692760916812e+01 - 32 1.2360965200043042e+02 -3.3253411369754360e+01 -1.0516118458992996e+02 - 33 6.5241847803263653e+01 3.7105112939425635e+02 6.0972558235451928e+01 - 34 -2.3124259597682851e+02 -1.1681740329855472e+02 -2.5838262648358858e+02 - 35 -4.1912226107430826e+02 7.9942920270906228e+01 3.1021023518174763e+02 - 36 -1.8561789047309296e+02 -1.1563628711183125e+02 -4.2360172436503717e+01 - 37 8.8271496727767698e+00 -3.5266450940716857e+02 -6.0505384072663695e+01 - 38 -1.9249505149115080e+01 1.1716319600342219e+02 -2.3477222840170350e+02 - 39 -1.0433878247334579e+01 -7.0902801856116241e+01 1.4264113912369183e+02 - 40 3.3265570779157940e+02 -8.8675933035692253e+02 1.6250845779884724e+01 - 41 -6.4537349815891190e+01 1.5189506353185567e+02 -1.8225353662797988e+02 - 42 2.3368723487140532e+01 1.1821526860010481e+02 4.1207323013207559e+02 - 43 -3.5145546474533603e+01 -3.6511647370358964e+00 2.4936793079206421e+02 - 44 -1.2881828259467285e+00 -2.4877240180803770e+02 7.9235766494558362e+01 - 45 2.0871504532588767e+02 -1.0817588901356530e+02 -4.1291808327438582e+02 - 46 -1.3837716960728255e+02 4.6114279241763722e+02 -2.4013801845141728e+02 - 47 1.3255320792802377e+02 2.8747276038939981e+02 -3.2896384987644886e+01 - 48 7.8145138718954991e+02 6.5215432481105154e+01 -6.2304789958706840e+02 - 49 2.4486314507345327e+02 1.9101300126651807e+01 3.7417037047544727e+02 - 50 2.9821275118603683e+02 3.0684252095008105e+02 5.6994896759617143e+02 - 51 -8.0052405736417188e+02 5.1024940640330806e+02 7.5829315450290915e+02 - 52 -9.2130898885915201e+01 1.1909837120722082e+02 -2.4118832391136655e+02 - 53 -3.6386926333489237e+02 -2.0729203700030763e+02 -3.4910517647679171e+02 - 54 -8.3399710534966360e+01 1.8942260327526213e+02 -1.2868598438440796e+02 - 55 -2.5305956575883852e+02 -1.1005916187118478e+02 -3.0893514828399947e+02 - 56 1.7364614503216589e+02 -2.5754370913449043e+02 -4.3744509948719575e+01 - 57 4.2667925201499298e+02 1.5529221173799095e+02 -3.9988499000700682e+02 - 58 -3.9656744140978226e+01 7.8953243693724033e+01 2.6135299122199172e+02 - 59 -2.7594240444753677e+02 1.9891763338587063e+02 2.4122500794453137e+02 - 60 -2.5675904361258932e+02 -1.1527171320987564e+02 9.9923550442534349e+01 - 61 3.0884427580009310e+02 4.9986415802549146e+02 -1.3369122169832409e+02 - 62 2.8530106503456519e+01 5.9540697570827006e-01 -2.7403025931181190e+02 - 63 2.5297054006404551e+02 -2.7640485799385101e+02 -1.9200503841907977e+02 - 64 -8.4680445259248458e+01 -1.5737027404337621e+02 1.5637808719882156e+02 -run_vdwl: -4208.209603101557 -run_coul: -268.02583477440254 + 1 -8.8484559491557889e+01 -2.5824737864578637e+01 1.0916228789487674e+02 + 2 -1.1227736122976223e+02 -1.8092349731667611e+02 -2.2420586526896261e+02 + 3 -1.7210817575849026e+02 1.8292439782308702e+02 1.3552618819720569e+01 + 4 3.2997500231085198e+01 -5.1076027616185407e+01 9.0475628837095513e+01 + 5 1.8144778146274791e+02 1.6797701000587452e+01 -8.1725507301127038e+01 + 6 1.3634094180728110e+02 -3.0056789474000180e+02 2.9661495129805971e+01 + 7 -5.3287158661291762e+01 -1.2872927610192625e+02 -1.6347871108897493e+02 + 8 -1.5334883257588757e+02 4.0171483324130726e+01 1.5317461163040997e+02 + 9 1.8364155867634079e+01 8.1986572088186804e+01 2.8272397798081524e+01 + 10 8.4246730110712534e+01 1.4177487113456962e+02 1.2330079878579957e+02 + 11 -4.3218423112520902e+01 6.5551082199289709e+01 1.3464882148706636e+02 + 12 -9.7317470492933836e+01 -2.6234999414154014e+01 7.2277941881646539e+00 + 13 -6.3183329836753863e+01 -4.7368101002971272e+01 -3.7592654029315028e+01 + 14 7.8642975316486172e+01 -6.7997612991897427e+01 -9.9044775614596048e+01 + 15 -6.6373732796038979e+01 2.1787558547532143e+02 8.0103149369093387e+01 + 16 1.9216166082224373e+02 5.3228015320734826e+01 6.6260214054210593e+01 + 17 1.4496007689503062e+02 -3.9700923044583718e+01 -9.7503851828130053e+01 + 18 -4.4989550233790240e+01 -1.9360605894359739e+02 1.1274792197022482e+02 + 19 2.6657528138945770e+02 3.7189510796650950e+02 -3.3847307488287697e+02 + 20 -7.6341040242469418e+01 -8.8478925962203348e+01 1.3557778212060649e+00 + 21 -7.1188591900926752e+01 -5.1591439985136624e+01 -1.2279442803769274e+02 + 22 1.5504836733039957e+02 -1.3094504458746073e+02 8.1474408030760628e+01 + 23 7.8015302036861655e+01 -1.3272310040521637e+01 -2.2771427736544169e+01 + 24 -2.0546718065741098e+02 2.1611071031053456e+02 -1.2423208053538966e+02 + 25 -1.1402686646199034e+02 1.9100238121128132e+02 -8.3504908417580012e+01 + 26 2.8663576552098777e+02 -2.1773884754170604e+02 2.3144300100087472e+02 + 27 -6.3247409025611177e+01 6.9122196748087063e+01 1.8606936744368775e+02 + 28 -3.5426011055935223e+00 3.8764809029451868e+01 3.2874001946768942e+01 + 29 -7.1069178571876577e+01 3.5485903180427719e+01 2.7311648896320207e+01 + 30 -1.7036987830119904e+02 -1.9851827590031277e+02 -1.1511401829123538e+02 + 31 -1.3970409889743334e+02 1.6660943915628047e+02 -1.2913930522474701e+02 + 32 2.7179130444112268e+01 -6.0169059447629913e+01 -1.7669495182022038e+02 + 33 -6.2659679124099597e+01 -6.4422131921795355e+01 6.4150928205326579e+01 + 34 -2.2119065265693539e+01 1.0450386886830508e+02 -7.3998379587547845e+01 + 35 2.6982987783286296e+02 -2.1519317040003412e+02 1.3051628460669610e+02 + 36 1.0368628874516664e+02 1.8817377639779619e+02 -1.9748944223870336e+02 + 37 -1.8009522406836993e+02 1.2993653092243849e+02 -6.3523043394051776e+01 + 38 -2.9571205878459978e+02 1.0441609933482223e+02 1.5582204859042619e+02 + 39 8.7398805727029284e+01 -6.0025559644669258e+01 2.2209742009837157e+01 + 40 2.0540672579010824e+01 -1.0735874009092363e+02 5.8655918369892206e+01 + 41 -5.8895846271372314e+01 1.1852345624639781e+01 -6.6147257724570267e+01 + 42 -9.6895512314642531e+01 3.8928741136688728e+01 -7.5791929957116224e+01 + 43 2.2476051812062417e+02 9.5505204283237461e+01 1.2309042240718740e+02 + 44 8.9817373579488645e+01 -1.0616333580628948e+02 -8.6321519086255435e+01 + 45 1.7202629662584396e+01 1.2890307246697839e+02 5.2916171301068474e+01 + 46 1.3547783972601877e+01 -2.9276223331260056e+01 2.2187412696867373e+01 + 47 3.3389762514712238e+01 -1.9217585014965047e+02 -6.9956213241088250e+01 + 48 7.3631720332112678e+01 -2.0953007324688525e+02 -2.3183566221404714e+01 + 49 -3.7589944473227274e+02 -2.4083165714763936e+01 1.0770339502610540e+02 + 50 3.8603083564823841e+01 -7.3616481568799330e+01 9.0414065019644596e+01 + 51 1.3736420686706188e+02 -1.0204157331506994e+02 1.5813725581150808e+02 + 52 -1.0797257051087823e+02 1.1876975735151167e+02 -1.3295758126486243e+02 + 53 -5.3807540206295343e+01 3.3259462625854701e+02 -3.8426833263045523e-03 + 54 -1.0690184616186750e+01 6.2820270853646399e+01 1.8343158343321130e+02 + 55 1.1231900459987581e+02 -1.7906654831317169e+02 7.6533681064340868e+01 + 56 -4.1027190034916586e+01 -1.4085413191133767e+02 3.7483064289953241e+01 + 57 9.9904315214040494e+01 7.0938939080461637e+01 -6.8654961257661526e+01 + 58 -2.7563642882026745e+01 -6.7445498717142405e+00 -1.8442640542823220e+01 + 59 -6.6628933617875404e+01 1.0613066354110040e+02 8.7736153919831665e+01 + 60 -1.7748415247439002e+01 6.3757605316872542e+01 -1.5086907478326543e+02 + 61 -3.3560907195791366e+01 -1.0076987083174089e+02 -7.4536106106935804e+01 + 62 1.5883428926665005e+01 -5.8433760297908881e+00 2.8392494016034949e+01 + 63 1.3294494001298790e+02 -1.2724568063770238e+02 -6.4886848316806251e+01 + 64 1.0738157273930990e+02 1.2062173788161539e+02 7.4541400611710785e+01 +run_vdwl: -3296.346882377749 +run_coul: -327.0653995073912 run_stress: ! |2- - 2.3675903993352799e+03 3.0802227297815411e+03 1.2727311522674922e+03 -1.5388669378285692e+03 -1.0907269208284702e+03 1.1229243202763012e+03 + 3.0523824138350801e+03 3.0876910136734191e+03 3.2008348843495064e+03 -9.2310681174629309e+01 -2.9719286551009412e+02 -8.6004906282204530e+01 run_forces: ! |2 - 1 2.9635294281594891e+01 -5.6267712552696150e+02 -1.6667999923844903e+02 - 2 -1.5938673400152015e+02 -2.2076536449681436e+02 -1.7162354129442059e+02 - 3 -3.1189858281105185e+01 -3.0593580065880258e+02 4.4645958607293259e+01 - 4 4.4646581891374524e+02 1.7080959763777909e+02 1.7439093938228865e+02 - 5 -1.1512839796355780e+02 7.9717058687934127e+01 1.7957487669510552e+01 - 6 -7.1695602565953936e+02 4.0752829698557036e+01 2.1512533839228914e+02 - 7 2.3022644486519332e+02 -9.0168915600534049e+01 8.2194655874280542e+01 - 8 -2.1149264848803984e+01 -1.5637111051643518e+02 1.6102981315498010e+02 - 9 -1.2130987756626322e+02 -2.7961363383950686e+02 -1.9628960069615047e+02 - 10 -3.7631817089745317e+02 3.4103259385937486e+02 -1.8166532788357921e+02 - 11 -1.6154687915131711e+02 1.5742797820595132e+02 3.5832199951140109e+02 - 12 6.1603841944463943e+02 -1.4820397700321357e+02 1.0871524086056972e+02 - 13 -2.1367529106934364e+02 -3.0167446795627899e+02 5.2424091634188028e+02 - 14 2.5933827511240753e+02 -1.7968203382119590e+01 -2.7733114072539661e+02 - 15 1.7570793004244069e+02 1.7551005525188296e+02 -9.5784231788977749e+01 - 16 3.0586985592967915e+02 -4.7679566105948382e+01 -3.4332192731505285e+02 - 17 -1.5018636472333995e+02 1.3259146324636694e+02 2.3200578297675395e+02 - 18 1.6469881174805161e+02 -1.0816836176978013e+02 2.1207670716678888e+02 - 19 2.4759420520504079e+02 -4.8758383157767163e+01 -2.2494116682880116e+02 - 20 1.2419960666452823e+02 2.5137933265660718e+02 -1.5328241144729745e+01 - 21 -1.9556094492800702e+02 2.3151723982064777e+01 -1.2529581330697818e+02 - 22 2.4829941584476597e+02 -2.9829345245033829e+02 -4.0446702084715653e+01 - 23 8.2074458696916352e+01 1.3042100306284391e+02 1.5221371881648275e+02 - 24 -7.6917668833500898e+01 2.3540360228733630e+02 -1.7130192995354321e+02 - 25 -2.9742104523786168e+01 -1.8935699467868037e+02 6.7995874219729117e+01 - 26 -3.9494943772628240e+01 2.1074054704555034e+00 -2.0748981609854840e+02 - 27 -2.7704003655185977e+02 5.3736954143365233e+02 4.2318574013793761e+02 - 28 -2.9302855291123007e+02 -5.1149666118960234e+01 -2.3633679976948793e+02 - 29 1.2970505460342494e+02 -4.2266433901986183e+01 1.6349685185792413e+02 - 30 5.6925896868052199e+01 3.7880918758244668e+01 6.8637128510003294e+01 - 31 -1.9325534294265759e+02 -1.1645328076628637e+02 -2.0671892621502057e+01 - 32 1.2360198063082690e+02 -3.3253019999942374e+01 -1.0516936549567490e+02 - 33 6.5239383936196262e+01 3.7104662858439900e+02 6.0974455303733073e+01 - 34 -2.3124084085037498e+02 -1.1681523003031349e+02 -2.5837805461650902e+02 - 35 -4.1912113383005675e+02 7.9943750613186452e+01 3.1020725803706983e+02 - 36 -1.8561422052418746e+02 -1.1563434085911459e+02 -4.2360108129603255e+01 - 37 8.8275421440856547e+00 -3.5266971563412392e+02 -6.0507541453071482e+01 - 38 -1.9245036832038224e+01 1.1717726898939364e+02 -2.3478417248419430e+02 - 39 -1.0434224692470824e+01 -7.0902644440221394e+01 1.4263978421852897e+02 - 40 3.3271177801097122e+02 -8.8679293552761555e+02 1.6219742097556569e+01 - 41 -6.4538764986359638e+01 1.5189397693612858e+02 -1.8225441696797373e+02 - 42 2.3368235855713472e+01 1.1822246665296132e+02 4.1207745038653673e+02 - 43 -3.5145643416904370e+01 -3.6517162542190285e+00 2.4936784352978586e+02 - 44 -1.2879745400758535e+00 -2.4877345145140910e+02 7.9236449970514400e+01 - 45 2.0871643412339361e+02 -1.0817571271704279e+02 -4.1291831345629367e+02 - 46 -1.3836372705477595e+02 4.6117938292253513e+02 -2.4016736526221720e+02 - 47 1.3255125611057784e+02 2.8747591615865849e+02 -3.2895660248675412e+01 - 48 7.8145417759956388e+02 6.5214930060371188e+01 -6.2304930828897488e+02 - 49 2.4488281403352434e+02 1.9105496615711587e+01 3.7418605144303842e+02 - 50 2.9822129513622804e+02 3.0683153982657637e+02 5.6994490418774092e+02 - 51 -8.0058572063770589e+02 5.1028617285827835e+02 7.5832431569040102e+02 - 52 -9.2137024513793961e+01 1.1910687193195571e+02 -2.4119120858088723e+02 - 53 -3.6387082584333763e+02 -2.0729771077051413e+02 -3.4910499737675855e+02 - 54 -8.3401322475888492e+01 1.8942466656602346e+02 -1.2869045777950828e+02 - 55 -2.5309678413622956e+02 -1.1001947899857218e+02 -3.0896372370121657e+02 - 56 1.7364604574033362e+02 -2.5754429115061833e+02 -4.3743962050161187e+01 - 57 4.2666362581864087e+02 1.5528157995541829e+02 -3.9988032807910298e+02 - 58 -3.9656744873557194e+01 7.8953170999147844e+01 2.6135222052406243e+02 - 59 -2.7594581611215335e+02 1.9891770704103524e+02 2.4122933700019283e+02 - 60 -2.5675992319678829e+02 -1.1527235824444743e+02 9.9923831048647713e+01 - 61 3.0884428120706025e+02 4.9986711220596823e+02 -1.3369013376796840e+02 - 62 2.8530678742627682e+01 5.9283151669757950e-01 -2.7403002505093650e+02 - 63 2.5296775626791694e+02 -2.7640525289662742e+02 -1.9200401038407171e+02 - 64 -8.4674586435530216e+01 -1.5736397776830248e+02 1.5637348700621067e+02 + 1 -8.8486129396001530e+01 -2.5824483374473200e+01 1.0916517213634106e+02 + 2 -1.1227648453173390e+02 -1.8093214754186130e+02 -2.2420118533940351e+02 + 3 -1.7210894875994978e+02 1.8292263268451674e+02 1.3551979435686128e+01 + 4 3.2999405001009400e+01 -5.1077312719545837e+01 9.0478579144069556e+01 + 5 1.8144963583123214e+02 1.6798391906831810e+01 -8.1723378082075570e+01 + 6 1.3640835897739447e+02 -3.0059507544862095e+02 2.9594750460783345e+01 + 7 -5.3287619129789434e+01 -1.2872953167026759e+02 -1.6348317368624129e+02 + 8 -1.5334990952322434e+02 4.0171746946780843e+01 1.5317542403106131e+02 + 9 1.8362961213927143e+01 8.1984428717784240e+01 2.8273598253027259e+01 + 10 8.4245458094789043e+01 1.4177227430519346e+02 1.2329899933660965e+02 + 11 -4.3217035356344425e+01 6.5547850976510759e+01 1.3463983671946417e+02 + 12 -9.7319343004573113e+01 -2.6236499899232278e+01 7.2232061905742402e+00 + 13 -6.3184735475530402e+01 -4.7368090836538087e+01 -3.7590268076036111e+01 + 14 7.8642680121803949e+01 -6.7994653297646451e+01 -9.9042134233434069e+01 + 15 -6.6371195967082812e+01 2.1787700653339664e+02 8.0102624694807375e+01 + 16 1.9215832443892597e+02 5.3231888618093969e+01 6.6253846562695060e+01 + 17 1.4496126989603110e+02 -3.9700366098757236e+01 -9.7506725874209394e+01 + 18 -4.4989211400008614e+01 -1.9360716191976445e+02 1.1274798810455862e+02 + 19 2.6657546213782740e+02 3.7189369483257695e+02 -3.3847202166068041e+02 + 20 -7.6352829159880940e+01 -8.8469178952301604e+01 1.3384778817072185e+00 + 21 -7.1188597560667418e+01 -5.1592404200740091e+01 -1.2279357314243519e+02 + 22 1.5504965184741241e+02 -1.3094582932680530e+02 8.1473922626938005e+01 + 23 7.8017376001392932e+01 -1.3263023728607561e+01 -2.2771654676273968e+01 + 24 -2.0547634460482246e+02 2.1612342044348730e+02 -1.2423651650061706e+02 + 25 -1.1402944116091903e+02 1.9100648219391277e+02 -8.3505645569845370e+01 + 26 2.8664542299410533e+02 -2.1774609219880716e+02 2.3144720166994406e+02 + 27 -6.3243843868043058e+01 6.9123801262965287e+01 1.8607035157681673e+02 + 28 -3.5444604841998397e+00 3.8760531647714473e+01 3.2869123667281691e+01 + 29 -7.1069494158179211e+01 3.5486459158760582e+01 2.7311657876181052e+01 + 30 -1.7037059987992399e+02 -1.9851840131669357e+02 -1.1511410156295636e+02 + 31 -1.3970663440086005e+02 1.6660841802305004e+02 -1.2914070628112796e+02 + 32 2.7179939937138421e+01 -6.0162678551485520e+01 -1.7668459764117443e+02 + 33 -6.2659124615698168e+01 -6.4421915847941506e+01 6.4151176691093482e+01 + 34 -2.2118740875419455e+01 1.0450303589341144e+02 -7.3997370482692972e+01 + 35 2.6987081482968875e+02 -2.1523754104000355e+02 1.3052736086179604e+02 + 36 1.0368798521815546e+02 1.8816694370725344e+02 -1.9748485159172904e+02 + 37 -1.8012152564003850e+02 1.2997662140302853e+02 -6.3547259053587844e+01 + 38 -2.9571525697590829e+02 1.0441941743734590e+02 1.5582112543442358e+02 + 39 8.7399620724575271e+01 -6.0025787992411296e+01 2.2209357601282150e+01 + 40 2.0541458171950978e+01 -1.0735817059033016e+02 5.8656280350524312e+01 + 41 -5.8893965304899972e+01 1.1850504754314887e+01 -6.6138932259022468e+01 + 42 -9.6894702780992375e+01 3.8926449644174816e+01 -7.5794133002764795e+01 + 43 2.2475651760389383e+02 9.5503072846836503e+01 1.2308683766845400e+02 + 44 8.9821846939843113e+01 -1.0615882525757857e+02 -8.6326896770189890e+01 + 45 1.7193681344342288e+01 1.2889564928820627e+02 5.2922372841252404e+01 + 46 1.3549091739280335e+01 -2.9276447091757490e+01 2.2187152043656496e+01 + 47 3.3389460345593179e+01 -1.9217121673024420e+02 -6.9954603582952544e+01 + 48 7.3644268618852777e+01 -2.0953201921822830e+02 -2.3192562071413263e+01 + 49 -3.7593958318941031e+02 -2.4028439106859878e+01 1.0779151134441000e+02 + 50 3.8603926624328551e+01 -7.3615255297989435e+01 9.0412505212292402e+01 + 51 1.3736689552214156e+02 -1.0204490780187869e+02 1.5814099219652564e+02 + 52 -1.0797151154267746e+02 1.1876989597626186e+02 -1.3296150756377074e+02 + 53 -5.3843453069456601e+01 3.3257024143956789e+02 -2.3416395383762278e-02 + 54 -1.0678049522667429e+01 6.2807424617056625e+01 1.8344969045860523e+02 + 55 1.1232135576105661e+02 -1.7906994470561881e+02 7.6534265234548187e+01 + 56 -4.1035945990527679e+01 -1.4084577238065071e+02 3.7489705598247994e+01 + 57 9.9903872061946174e+01 7.0936213558024505e+01 -6.8656338416452527e+01 + 58 -2.7563844572724122e+01 -6.7426705471926862e+00 -1.8442803060445037e+01 + 59 -6.6637290503389451e+01 1.0613630918459926e+02 8.7741455199772943e+01 + 60 -1.7749706497437369e+01 6.3756413885635943e+01 -1.5086911682892705e+02 + 61 -3.3559889608749941e+01 -1.0076809277084803e+02 -7.4536003122046253e+01 + 62 1.5883833834736409e+01 -5.8439916924703503e+00 2.8393403991146936e+01 + 63 1.3294237052896716e+02 -1.2724619636183070e+02 -6.4882384014219085e+01 + 64 1.0738250214938944e+02 1.2062290362868877e+02 7.4541927445529211e+01 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index b24f60dc62..3e12ad726d 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -1,8 +1,8 @@ --- lammps_version: 8 Apr 2021 -date_generated: Mon Apr 19 09:21:17 2021 -epsilon: 2e-10 -skip_tests: +date_generated: Wed Apr 21 08:52:02 2021 +epsilon: 1e-12 +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -15,159 +15,162 @@ pre_commands: ! | atom_style charge lattice diamond 3.77 region box block 0 2 0 2 0 2 - create_box 2 box + create_box 3 box create_atoms 1 box displace_atoms all random 0.1 0.1 0.1 623426 - mass 1 12.0 - mass 2 13.0 + mass 1 1.0 + mass 2 12.0 + mass 3 16.0 set type 1 type/fraction 2 0.5 998877 - set type 1 charge 0.01 - set type 2 charge -0.01 + set type 2 type/fraction 3 0.5 887766 + set type 1 charge 0.00 + set type 2 charge 0.01 + set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c maxiter 20 nowarn + fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c input_file: in.empty pair_style: reax/c NULL checkqeq yes lgvdw yes safezone 1.6 pair_coeff: ! | - * * ffield.reax.lg C O + * * ffield.reax.lg H C O extract: ! "" natoms: 64 -init_vdwl: -3780.0545577888824 -init_coul: -279.9157988760615 +init_vdwl: -2454.3149508399256 +init_coul: -344.1380904917976 init_stress: ! |2- - 3.6448931383720665e+03 3.7339659142876435e+03 3.9381659849081570e+03 -8.8620105504582875e+02 2.5350490498306664e+02 -5.2816569317142807e+02 + 4.8195587070292022e+03 4.4865954368949351e+03 3.2679588293062784e+03 -1.8469678134590688e+03 7.6556385424846496e+02 -4.9517278307742413e+02 init_forces: ! |2 - 1 -1.4572091886023205e+02 -2.2140554853210335e+02 -1.4808089621820409e+02 - 2 -1.7648676367493852e+02 -1.0146318760917033e+02 -1.7992199180511228e+01 - 3 -2.0615863857279255e+01 -4.0344141093113177e+02 -3.8603948937580682e+01 - 4 2.6614837240037974e+02 4.0003929778899199e+01 1.4690018353209234e+02 - 5 9.7844364238111634e+00 4.3884264292874640e+01 4.9796276452188778e+01 - 6 -2.6938167754794108e+02 3.3502567046531411e+00 2.2965489848185831e+02 - 7 3.2574749906033628e+02 -1.7976901688562575e+02 2.2179384812686754e+02 - 8 9.9963664597069211e+01 -2.8685055064461562e+02 1.4158554323500957e+02 - 9 1.6434737377652411e+01 -1.9355784885649135e+02 -9.4333988453824674e+01 - 10 -2.0854160335689650e+02 1.0026489817881713e+02 -1.5021072248976765e+02 - 11 -2.0573434026899415e+02 2.7604212909913434e+02 5.5777133973549599e+02 - 12 5.0288346447168902e+02 -6.0966999599334633e+02 3.9376794144396729e+02 - 13 -9.1250837980014055e+01 3.5479126438212312e+01 7.9772485712987830e+01 - 14 1.1722657768580721e+02 7.0781215767454047e+00 -1.1012920740892103e+02 - 15 2.0459752525877119e+02 1.1351310328466946e+01 -6.9642718405081723e+01 - 16 6.4806165788586554e+01 2.7717257212730721e+02 9.6969385115315887e+01 - 17 -1.1757474559792530e+02 7.5596314208592773e+01 8.2371686135118694e+00 - 18 1.4980035999104621e+02 4.6438099206051213e+01 1.9074297138984858e+02 - 19 9.9234004591160854e+01 -3.4162209353811022e+01 -9.3484579137358054e+01 - 20 3.4394959503379101e+02 1.8755989482421211e+02 1.8392094734100132e+02 - 21 -1.7639663517067046e+02 5.9886792943355104e+01 2.3192630518286926e+01 - 22 3.5943350303372904e+02 -4.9707299042671059e+02 2.0606498955302629e+02 - 23 1.7582092751419758e+01 2.1298501938255976e+02 1.9485029772476997e+02 - 24 -1.8644089886656593e+02 2.0152439860030270e+02 -1.5033144599992980e+02 - 25 6.6423833906552588e+01 -2.6628287125895685e+02 6.5042482646519929e+01 - 26 -2.9537910718596163e+02 1.8889491141232935e+02 8.6384752113539022e+01 - 27 1.0405788965828641e+02 -2.5925449178566540e+00 -6.3480098517547759e+01 - 28 -1.7939608695369640e+02 -1.9073765779235862e+02 -1.6920914616960835e+02 - 29 2.8517744376210021e+02 -9.8603006038058396e+01 -1.5865567773918144e+02 - 30 3.2949780945743384e-01 9.9395901723688951e+01 3.2867025811830066e+00 - 31 -1.8081982094889877e+00 -5.1095979886608603e+01 6.0017226789971536e+00 - 32 3.1528485795048732e+02 -1.2793879136489154e+02 -2.4176923563635890e+02 - 33 -5.4047496313993761e+00 1.7567978501697323e+02 -1.1807749995154678e+02 - 34 -1.9400365443632006e+02 -1.0951910631961994e+02 -1.5439514659643123e+02 - 35 -1.9195164058841638e+02 -1.2771663795724534e+01 1.3164519528710119e+02 - 36 2.1450335760238607e+02 4.8524149100278362e+02 -2.2937661241075210e+02 - 37 -3.3553202602756068e+02 -4.9645660169968471e+02 2.1989946614447041e+02 - 38 -3.2545637693167187e+01 2.4953724757619213e+01 -1.5692994894863165e+02 - 39 -1.5399133308638410e+01 2.3903543199312750e+01 9.6153912587959454e+01 - 40 -6.4359455436231784e+01 1.7840898418733599e+02 1.6199268811537300e+02 - 41 -2.4659695132042634e+02 2.3085908053073328e+02 -2.9640112753929327e+02 - 42 -2.9451821900140999e+02 4.3373059300879572e+02 4.3706356205288336e+02 - 43 1.3266010178695632e+02 -2.9267135032181088e+01 2.3063316835486089e+02 - 44 1.0054895163178887e+02 -2.0011754287270674e+02 1.1673372624795425e+02 - 45 1.5191525332856557e+02 -3.3909441520578207e+02 -6.8137683597574699e+02 - 46 -3.6974751746664356e+02 6.5878294118257850e+02 -1.2846738301725193e+02 - 47 7.0999626065694201e+01 2.6787348460906964e+02 -2.6037187103136354e+01 - 48 4.8458888753820582e+02 -1.6692979718938696e+02 -3.2654041125642522e+02 - 49 1.0015039714682548e+02 1.7137645197720190e+01 1.2769396347000726e+02 - 50 -2.5642342676546355e+02 4.8550218436953134e+02 1.7834042598268297e+02 - 51 1.5929472695008881e+03 -1.5099908240612401e+03 1.3757388145073317e+03 - 52 -3.9361969825076892e+02 2.9260735969130604e+02 -2.7081798065168311e+02 - 53 -1.2156829912640842e+03 1.0481229021396230e+03 -1.7260431178358995e+03 - 54 5.4550088623147516e+01 1.0309452579709432e+02 -6.1757701222598442e+01 - 55 -2.0238006702340041e+02 1.8109613688188938e+02 -4.9049119362596980e+02 - 56 2.0035548328443991e+02 -1.8905716639832801e+02 -1.3674890405161500e+02 - 57 -1.7850234090472205e+02 -3.3738119605793531e+02 -1.4864438401289951e+02 - 58 -2.5672838772121492e+02 -1.3337878903216912e+02 8.4365052514154812e+01 - 59 -1.7898423879701210e+02 1.8142157612585032e+02 2.7914729458451137e+02 - 60 -7.4397164149646969e+01 -6.8190924044876084e+01 5.7945904025898891e+01 - 61 9.6099033708008989e+01 4.4560187645463765e+02 5.3539291937468079e+01 - 62 3.3097868057397406e+01 1.3291944752881338e+02 -3.6118812725322506e+01 - 63 -2.5661745572767739e+01 -3.1619354530304156e+02 5.0012317415788416e+01 - 64 2.5884883063459124e+01 -6.0852905003457536e+01 7.5067609941699116e+00 -run_vdwl: -3780.0534739099153 -run_coul: -279.9156023968299 + 1 -1.9811664067580182e+02 -1.5618748554879582e+02 -1.0716617094919907e+02 + 2 -4.1075966889759563e+01 -6.7708246449675840e+01 -4.2506724189242647e+01 + 3 3.1596544789529471e+01 8.8571277602644201e+01 1.4850846557451504e+02 + 4 1.7447178183928099e+02 3.2866954415453613e+01 -3.1178861314762706e+01 + 5 1.1873199005659009e+02 5.9095115842131946e+01 2.3739439807686179e+02 + 6 1.3052453610124778e+03 -4.4208109447713031e+02 -1.4245452171137988e+03 + 7 -8.7153363585941023e+01 -1.0895261162467337e+02 -3.5604687372058106e+02 + 8 -9.1047579854191540e+01 4.4450937169776367e+01 1.1879559986803962e+02 + 9 4.7456602925193245e+01 1.7227642506022178e+02 -1.4638226748446916e+01 + 10 6.3508986324759796e+01 4.8590610415561784e+01 1.1075535682642920e+01 + 11 -5.1919052217198669e+01 7.3820742396411859e+01 5.1375340691983297e+01 + 12 -1.0171933720752882e+02 -1.9845958414353028e+01 -1.7437665462751706e+01 + 13 -7.3048376131504796e+01 -4.5586627360377669e+01 2.8533062846208733e+01 + 14 8.6287140258369817e+01 -4.1664353236768321e+01 1.7094340432182378e+01 + 15 -3.5690271737605428e+01 1.2671711108383720e+02 4.5865072089126144e+01 + 16 1.0608232372370766e+02 3.5980003156299802e+01 1.8676593635940499e+01 + 17 2.3577630118103411e+02 -9.8579505236746968e+01 4.1005658232556200e+01 + 18 -2.0815299273687735e+01 -1.1578579968450298e+02 6.5566787154472507e+01 + 19 4.3265264076046996e+01 1.0913234729250232e+02 3.0900987497773690e+02 + 20 -1.0086773950039240e+02 7.4841212143883325e+01 -1.6547856280073117e+02 + 21 -8.5974538718179744e+01 -4.5982868874732929e+00 -7.3066508052444064e+01 + 22 1.3343492132570225e+02 -1.2211943449611955e+02 9.0328124087551757e+01 + 23 5.2985077374887140e+01 2.0040750326966958e+01 -9.0416982004666480e+00 + 24 -1.8957025969382849e+02 8.1671696884795921e+01 -1.2920621849543499e+01 + 25 -1.0067836293726950e+02 1.3220054680372047e+02 -4.8975895235994550e+01 + 26 2.1849478729429609e+02 -1.9386903120078875e+02 1.7116657218419908e+02 + 27 -3.7478069218092728e+01 3.0044804022729718e+01 9.3872627169948615e+01 + 28 9.9359193467603504e+01 -5.5156189036814503e+01 -3.1541196450035848e+01 + 29 -3.9530012231991570e+01 5.6689953230829921e+01 2.5358584427671751e+01 + 30 -9.7652246814367359e+01 -2.2271920242502716e+02 -1.4460601547049507e+02 + 31 -4.6192346966779532e+01 7.2790084189834928e+01 3.1159158603346764e+01 + 32 1.2013060628467292e+01 -3.4474347848945314e+01 -1.0622600014669138e+02 + 33 5.2551051115345523e+01 4.2704675585248630e+01 -3.0154896799401914e+01 + 34 1.6822864099952500e+02 -1.6889974455036809e-02 1.1832622696299902e+02 + 35 5.1185090023661428e+02 -1.3214021604987859e+03 1.1319907541000694e+03 + 36 -1.4331382529302426e+01 9.9702896436312997e+01 -1.3159358421899245e+02 + 37 -8.9317756897655033e+02 1.3544128453102780e+03 -7.5922493710251501e+02 + 38 -3.8384748878233427e+02 1.2143676601363953e+02 1.7580047976723324e+02 + 39 1.6381134310552264e+02 -1.2998574463953725e+01 -7.8542909545441546e+01 + 40 6.1412235617277197e+01 -2.0153615037331058e+01 4.3186957794586576e+01 + 41 1.3114484088383918e+01 1.7854214885793702e+00 3.3683765652624928e+01 + 42 -6.4838533708029459e+01 5.2662237041257001e+01 -6.8645855319469462e+01 + 43 2.0925885626252014e+02 8.2942516657430232e+01 1.1786724503954686e+02 + 44 -3.8463410277622422e+01 -7.5319916775508801e+01 -1.3445887472637639e+02 + 45 -3.4797907366084118e+01 7.6266761873332939e+01 4.3023416525122556e+01 + 46 2.3463432665038621e+01 -1.5313857576705704e+01 -3.8707451594223810e+00 + 47 -3.7271493199629646e+01 -5.4876511333920163e+01 -1.9275411927395847e+01 + 48 2.8275275023555395e+02 -1.7973942289882834e+02 -6.0167953907639014e+02 + 49 -2.0529905689923421e+03 -6.7838314309842531e+01 7.6230272883402529e+02 + 50 1.3292222637274614e+02 -9.8795036249084134e+01 9.9132259532945980e+01 + 51 2.6168921895029303e+02 -1.9761595427509062e+02 2.4062513751852873e+02 + 52 -1.2257063176561176e+02 1.3353869954874421e+02 -1.1598337420807962e+02 + 53 3.8021621191835891e+02 8.1199705966172507e+02 2.7057346247419940e+02 + 54 6.9440336670547097e+01 -1.1592524541887400e+02 2.2072297942372262e+02 + 55 8.7300666059627744e+01 -1.3907353173150560e+02 5.9541107879138558e+01 + 56 3.4771676857170326e+02 -2.4546959502036665e+02 -3.5077189358394349e+02 + 57 6.1706174952483430e+01 7.9893925286373715e+01 3.4373445887630085e+00 + 58 3.7240798760941452e+01 -1.2919400623491822e+02 3.9695110774075808e+01 + 59 -5.2076445103995331e+02 2.1046582886974142e+02 1.7083299176148790e+02 + 60 -7.8657547105875338e+01 -2.3005356890255392e+01 -1.2454833328198771e+02 + 61 -3.9633103573229910e+01 -5.5165443660352402e+01 -4.0780192434587690e+01 + 62 -1.8742346202622763e+01 -1.3844690899539831e+01 2.2586546200036643e+00 + 63 6.5150947885422269e+01 7.1009493033300544e+01 -8.4093092375006023e+01 + 64 4.0079516427458081e+01 9.6476598333945958e+01 9.1213458480138442e+01 +run_vdwl: -2454.3233099608155 +run_coul: -344.1379608070739 run_stress: ! |2- - 3.6449193028377299e+03 3.7339549167173282e+03 3.9381733557741995e+03 -8.8617642091921402e+02 2.5350119722836649e+02 -5.2818522888411621e+02 + 4.8194587329953674e+03 4.4865895224706956e+03 3.2679446938086498e+03 -1.8471163065259325e+03 7.6545324620049087e+02 -4.9527853267788902e+02 run_forces: ! |2 - 1 -1.4571796976977475e+02 -2.2140579635792884e+02 -1.4808149010447769e+02 - 2 -1.7648305954284041e+02 -1.0146476417236073e+02 -1.7988566053603591e+01 - 3 -2.0614225365740097e+01 -4.0344097227230094e+02 -3.8604731470054062e+01 - 4 2.6614888269720814e+02 4.0003233795014168e+01 1.4690057516187863e+02 - 5 9.7845378052670569e+00 4.3882570307523316e+01 4.9797206010047589e+01 - 6 -2.6938082908045919e+02 3.3524802199605972e+00 2.2965815951985147e+02 - 7 3.2575186725741395e+02 -1.7977227930984148e+02 2.2179960228952396e+02 - 8 9.9964020081557138e+01 -2.8685357554222099e+02 1.4158731522817112e+02 - 9 1.6438523377332476e+01 -1.9355303092496897e+02 -9.4334957020327948e+01 - 10 -2.0853806475972263e+02 1.0026021875703947e+02 -1.5021521105990161e+02 - 11 -2.0574136330802202e+02 2.7604370854540770e+02 5.5777225668964445e+02 - 12 5.0285717304860879e+02 -6.0968353881851192e+02 3.9377680529647569e+02 - 13 -9.1246272612282368e+01 3.5490016998948100e+01 7.9756749986805872e+01 - 14 1.1722763390616720e+02 7.0777572837063545e+00 -1.1012806750165767e+02 - 15 2.0459887112033201e+02 1.1352405359138412e+01 -6.9641010980711187e+01 - 16 6.4819489591627985e+01 2.7717767094468888e+02 9.6971198880055780e+01 - 17 -1.1757145471738642e+02 7.5598280349563737e+01 8.2344590524461072e+00 - 18 1.4979763975305985e+02 4.6437996441246753e+01 1.9074030452047762e+02 - 19 9.9232182958160649e+01 -3.4161493200256849e+01 -9.3482747032954819e+01 - 20 3.4394273190544487e+02 1.8755952354050976e+02 1.8391751060923613e+02 - 21 -1.7639675308717227e+02 5.9884172559678539e+01 2.3197838699496501e+01 - 22 3.5944608490729252e+02 -4.9708525361009697e+02 2.0607148872705903e+02 - 23 1.7579274952856146e+01 2.1298728055372681e+02 1.9485167236722779e+02 - 24 -1.8644004784533396e+02 2.0152728030974987e+02 -1.5032647044559059e+02 - 25 6.6427893699487285e+01 -2.6628950089076670e+02 6.5040872719333763e+01 - 26 -2.9538211829350598e+02 1.8889965241529200e+02 8.6392539131687670e+01 - 27 1.0405461403221605e+02 -2.5883825588235845e+00 -6.3473842387095296e+01 - 28 -1.7939104123925333e+02 -1.9072999063995681e+02 -1.6920313224146631e+02 - 29 2.8518126138643589e+02 -9.8610753428175371e+01 -1.5865905973294608e+02 - 30 3.2949044114559667e-01 9.9396106279740152e+01 3.2866487023715845e+00 - 31 -1.8093337117467343e+00 -5.1090328691324387e+01 5.9965849772505502e+00 - 32 3.1528763104400332e+02 -1.2794632256692650e+02 -2.4177666052802613e+02 - 33 -5.4083129170642179e+00 1.7567908715551988e+02 -1.1807415450387619e+02 - 34 -1.9400317396625167e+02 -1.0951816546456534e+02 -1.5439330137890337e+02 - 35 -1.9195026193065127e+02 -1.2774392319491161e+01 1.3164394629475399e+02 - 36 2.1450819729293397e+02 4.8524393495667874e+02 -2.2938261082652426e+02 - 37 -3.3553756825286939e+02 -4.9646067369623501e+02 2.1990265295677537e+02 - 38 -3.2545669240461962e+01 2.4954715957821520e+01 -1.5693302625922774e+02 - 39 -1.5400978707519485e+01 2.3902924956982389e+01 9.6154975229739549e+01 - 40 -6.4361322091921963e+01 1.7841296679824200e+02 1.6199313367381012e+02 - 41 -2.4660579311181596e+02 2.3084998025482201e+02 -2.9640187317945146e+02 - 42 -2.9452037865586266e+02 4.3373691264280740e+02 4.3706800713302425e+02 - 43 1.3265463914285502e+02 -2.9274831727547486e+01 2.3064014394569924e+02 - 44 1.0054966120054988e+02 -2.0011413451728055e+02 1.1673396063607694e+02 - 45 1.5191487332744026e+02 -3.3909989475298806e+02 -6.8138450042787269e+02 - 46 -3.6974586930852371e+02 6.5877947911188835e+02 -1.2846142437073112e+02 - 47 7.0999519258744826e+01 2.6787233536251233e+02 -2.6037425588932479e+01 - 48 4.8457871743082603e+02 -1.6693866918660342e+02 -3.2653088595197522e+02 - 49 1.0016334450403171e+02 1.7144926659081193e+01 1.2769410739667713e+02 - 50 -2.5643044716127639e+02 4.8550578281218662e+02 1.7833569703185714e+02 - 51 1.5929685800547243e+03 -1.5100179816024361e+03 1.3757557055371278e+03 - 52 -3.9363157215408233e+02 2.9261415024331393e+02 -2.7081681598776061e+02 - 53 -1.2156938934830002e+03 1.0481428177286084e+03 -1.7260661177369154e+03 - 54 5.4545512167986800e+01 1.0309421079214434e+02 -6.1761171483942455e+01 - 55 -2.0239006109115883e+02 1.8108786983188449e+02 -4.9048333730029168e+02 - 56 2.0036614371542044e+02 -1.8905881182672297e+02 -1.3675071296668057e+02 - 57 -1.7850229397871476e+02 -3.3738313920990021e+02 -1.4864700460708005e+02 - 58 -2.5670676044045717e+02 -1.3336092216373774e+02 8.4345105241459464e+01 - 59 -1.7898804526082839e+02 1.8142383013226376e+02 2.7914483449637197e+02 - 60 -7.4398952097636979e+01 -6.8191483730035287e+01 5.7946910740208871e+01 - 61 9.6097660916192893e+01 4.4562130692576051e+02 5.3555843428685527e+01 - 62 3.3087683040848127e+01 1.3291451189592027e+02 -3.6140107370205008e+01 - 63 -2.5660819680707732e+01 -3.1619389079817131e+02 5.0012586602224751e+01 - 64 2.5890370845876866e+01 -6.0849124899192077e+01 7.5030175856502677e+00 + 1 -1.9811556407056105e+02 -1.5618143620847076e+02 -1.0716119874908736e+02 + 2 -4.1073968384374822e+01 -6.7710647015369261e+01 -4.2502864658157357e+01 + 3 3.1592798331689554e+01 8.8575236369726497e+01 1.4850890801985440e+02 + 4 1.7447282006187956e+02 3.2862369867970486e+01 -3.1175721266394820e+01 + 5 1.1873112974792335e+02 5.9090963929048286e+01 2.3738916225937453e+02 + 6 1.3053008444613590e+03 -4.4210323642713990e+02 -1.4246081409032693e+03 + 7 -8.7152343512651925e+01 -1.0895314566818783e+02 -3.5604721285130660e+02 + 8 -9.1046846091347717e+01 4.4451665481009478e+01 1.1879618751723048e+02 + 9 4.7463133585713976e+01 1.7228438483982211e+02 -1.4645071927693378e+01 + 10 6.3506921990797963e+01 4.8587688349158157e+01 1.1073324095443047e+01 + 11 -5.1917951887543467e+01 7.3818630188510326e+01 5.1369234828489169e+01 + 12 -1.0172154753205886e+02 -1.9847809999838844e+01 -1.7441731987232995e+01 + 13 -7.3048126072731904e+01 -4.5586545373889699e+01 2.8534758158919548e+01 + 14 8.6288077929554390e+01 -4.1660634795038867e+01 1.7096747148188005e+01 + 15 -3.5688114877422009e+01 1.2671728980619932e+02 4.5864235397118819e+01 + 16 1.0608395201173668e+02 3.5983845233526992e+01 1.8672925070386189e+01 + 17 2.3576828121395241e+02 -9.8577850318505511e+01 4.1004495565128586e+01 + 18 -2.0815095995902741e+01 -1.1578710179047430e+02 6.5566934287391263e+01 + 19 4.3264252619509847e+01 1.0912982970441868e+02 3.0901253523346554e+02 + 20 -1.0088948935029296e+02 7.4849484282711913e+01 -1.6550538409007385e+02 + 21 -8.5974038585183081e+01 -4.5987854992617834e+00 -7.3065890363335626e+01 + 22 1.3343130763213867e+02 -1.2211553430043760e+02 9.0325064574872243e+01 + 23 5.2984912690315269e+01 2.0042805349785095e+01 -9.0417924141684995e+00 + 24 -1.8954830238390488e+02 8.1645824240164018e+01 -1.2893974448861035e+01 + 25 -1.0068116183998592e+02 1.3220505876703567e+02 -4.8977129584747800e+01 + 26 2.1847179335289820e+02 -1.9385136258527231e+02 1.7114800244815061e+02 + 27 -3.7476307441658193e+01 3.0046433191315710e+01 9.3873685757283738e+01 + 28 9.9355970623229197e+01 -5.5158350569168128e+01 -3.1544144508393853e+01 + 29 -3.9530224377035040e+01 5.6690552166969916e+01 2.5358784555346130e+01 + 30 -9.7652510697052605e+01 -2.2271892169387453e+02 -1.4460597467192864e+02 + 31 -4.6194950503295722e+01 7.2792554749932378e+01 3.1151667586195479e+01 + 32 1.2014466624027639e+01 -3.4469133688337756e+01 -1.0621837802800977e+02 + 33 5.2553699854339712e+01 4.2706400148046903e+01 -3.0154323622364608e+01 + 34 1.6822906612351349e+02 -1.7651825961895091e-02 1.1832699040444524e+02 + 35 5.1193507571856594e+02 -1.3215008853106001e+03 1.1320319719742358e+03 + 36 -1.4340338085502863e+01 9.9690347849156822e+01 -1.3158127406978679e+02 + 37 -8.9323390159980181e+02 1.3545163222654817e+03 -7.5929442355796721e+02 + 38 -3.8384755818822509e+02 1.2143789174035305e+02 1.7579570815453911e+02 + 39 1.6381197094628513e+02 -1.2998258674043836e+01 -7.8543109639931160e+01 + 40 6.1411228642100049e+01 -2.0154566391139259e+01 4.3186834298875652e+01 + 41 1.3119781105415569e+01 1.7920555043075754e+00 3.3686007139293849e+01 + 42 -6.4838490750749202e+01 5.2660553302313652e+01 -6.8647362072367542e+01 + 43 2.0926308211689772e+02 8.2945847275902722e+01 1.1786850503407649e+02 + 44 -3.8461829626420936e+01 -7.5317323697263234e+01 -1.3445959877777378e+02 + 45 -3.4805239678702840e+01 7.6262295586966061e+01 4.3024220690600892e+01 + 46 2.3465031078234954e+01 -1.5312554894709733e+01 -3.8725170500358517e+00 + 47 -3.7271036720207945e+01 -5.4879638482209749e+01 -1.9275876359755905e+01 + 48 2.8270391245290489e+02 -1.7971102191169697e+02 -6.0165064633346822e+02 + 49 -2.0529526126133592e+03 -6.7744467074995413e+01 7.6241869031244312e+02 + 50 1.3291615685330385e+02 -9.8801239572742261e+01 9.9131933784099587e+01 + 51 2.6169570171244874e+02 -1.9762541199560968e+02 2.4063463246277209e+02 + 52 -1.2256816067286560e+02 1.3353356136884040e+02 -1.1597765595389474e+02 + 53 3.8012282364003778e+02 8.1194045374755683e+02 2.7050484440708368e+02 + 54 6.9456553969440762e+01 -1.1593864337324271e+02 2.2074869335520950e+02 + 55 8.7303368709848343e+01 -1.3907755259033479e+02 5.9542185087028599e+01 + 56 3.4769731101937157e+02 -2.4546533348164235e+02 -3.5075782168770780e+02 + 57 6.1706155820465277e+01 7.9892471516403987e+01 3.4375912204692596e+00 + 58 3.7237511516193948e+01 -1.2919240641738722e+02 3.9695822512620317e+01 + 59 -5.2071132643271164e+02 2.1045883047165901e+02 1.7082619476821390e+02 + 60 -7.8658294909200478e+01 -2.3007149625533529e+01 -1.2454738729229325e+02 + 61 -3.9624794908666530e+01 -5.5169201638846069e+01 -4.0777145486525050e+01 + 62 -1.8741606623350261e+01 -1.3845552517299271e+01 2.2601936169388708e+00 + 63 6.5142845574860658e+01 7.0992677773634583e+01 -8.4109461087571162e+01 + 64 4.0079794681812899e+01 9.6475030340595495e+01 9.1215541718322243e+01 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index 54b66c5b71..d0f59749fd 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -1,8 +1,8 @@ --- lammps_version: 8 Apr 2021 -date_generated: Mon Apr 19 09:21:19 2021 +date_generated: Wed Apr 21 08:52:00 2021 epsilon: 5e-13 -skip_tests: +skip_tests: omp prerequisites: ! | pair reax/c pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml index ed599c837f..12136d7a27 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -1,8 +1,8 @@ --- lammps_version: 8 Apr 2021 -date_generated: Wed Apr 21 00:57:10 2021 +date_generated: Wed Apr 21 08:52:02 2021 epsilon: 1e-12 -skip_tests: +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -16,159 +16,162 @@ pre_commands: ! | atom_style charge lattice diamond 3.77 region box block 0 2 0 2 0 2 - create_box 2 box + create_box 3 box create_atoms 1 box displace_atoms all random 0.1 0.1 0.1 623426 - mass 1 12.0 - mass 2 13.0 + mass 1 1.0 + mass 2 12.0 + mass 3 16.0 set type 1 type/fraction 2 0.5 998877 - set type 1 charge 0.01 - set type 2 charge -0.01 + set type 2 type/fraction 3 0.5 887766 + set type 1 charge 0.00 + set type 2 charge 0.01 + set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c input_file: in.empty pair_style: reax/c reaxff-1.control checkqeq yes pair_coeff: ! | - * * ffield.reax.mattsson C O + * * ffield.reax.mattsson H C O extract: ! "" natoms: 64 -init_vdwl: -4208.203794533516 -init_coul: -268.0258681099902 -init_stress: ! |2- - 2.3677048490913976e+03 3.0802122558796082e+03 1.2727815110251254e+03 -1.5387991688241113e+03 -1.0906364142627658e+03 1.1229877249527667e+03 +init_vdwl: -3248.7357862540734 +init_coul: -327.0655125227952 +init_stress: ! |- + -9.1835020319343903e+02 -1.1070721188680500e+03 -7.1558466813462928e+02 -2.3040889388184371e+02 1.9640581541966435e+02 -6.6002885423290161e+02 init_forces: ! |2 - 1 2.9634051452065776e+01 -5.6267761875029782e+02 -1.6668253255994802e+02 - 2 -1.5938437728856897e+02 -2.2076601831947826e+02 -1.7161994484504669e+02 - 3 -3.1194106231031462e+01 -3.0591930644160692e+02 4.4652570958825507e+01 - 4 4.4646653320082436e+02 1.7080811286685625e+02 1.7439026170462094e+02 - 5 -1.1512606621588829e+02 7.9716954463493224e+01 1.7959700550214329e+01 - 6 -7.1695199301547871e+02 4.0749156820934594e+01 2.1512037025856768e+02 - 7 2.3022543693175331e+02 -9.0170756873740558e+01 8.2190170006875675e+01 - 8 -2.1141251466328132e+01 -1.5635879347045079e+02 1.6101907187955612e+02 - 9 -1.2130842270564283e+02 -2.7960689135651160e+02 -1.9629114850255749e+02 - 10 -3.7631710890094666e+02 3.4103240548851926e+02 -1.8166279141134461e+02 - 11 -1.6154553323850425e+02 1.5743068117721410e+02 3.5832389058234611e+02 - 12 6.1602989065568624e+02 -1.4821564423107765e+02 1.0871005319351426e+02 - 13 -2.1366561068642801e+02 -3.0163595494898948e+02 5.2420406156017953e+02 - 14 2.5933950255876238e+02 -1.7967300062473768e+01 -2.7733367021016375e+02 - 15 1.7570537661853186e+02 1.7550639099555497e+02 -9.5789475936343749e+01 - 16 3.0588529285449920e+02 -4.7675556549224140e+01 -3.4330544488852303e+02 - 17 -1.5018545342618870e+02 1.3259542010622351e+02 2.3200545258700299e+02 - 18 1.6469564396901546e+02 -1.0816413254489154e+02 2.1207485840068557e+02 - 19 2.4759285902963390e+02 -4.8758383780485623e+01 -2.2494100786656901e+02 - 20 1.2418785577586725e+02 2.5137242577508303e+02 -1.5341186115659308e+01 - 21 -1.9556210564941841e+02 2.3152590535658355e+01 -1.2529729601998551e+02 - 22 2.4829386068623685e+02 -2.9828789153728195e+02 -4.0455445433014944e+01 - 23 8.2076007650220902e+01 1.3042103437662357e+02 1.5221389911913158e+02 - 24 -7.6912973583042813e+01 2.3539925428986885e+02 -1.7129603802743895e+02 - 25 -2.9782413878301764e+01 -1.8931910469292632e+02 6.7989202537824610e+01 - 26 -3.9488494691904407e+01 2.1025614475916794e+00 -2.0748963060920084e+02 - 27 -2.7704110443956750e+02 5.3736974078117703e+02 4.2318884882972577e+02 - 28 -2.9303219943094604e+02 -5.1154115419361588e+01 -2.3633993403334915e+02 - 29 1.2970484011863061e+02 -4.2266229541142110e+01 1.6350076614995828e+02 - 30 5.6925606430591166e+01 3.7880191852724600e+01 6.8636397133459397e+01 - 31 -1.9325596697353996e+02 -1.1645368911554472e+02 -2.0671692760919722e+01 - 32 1.2360965200040813e+02 -3.3253411369721618e+01 -1.0516118458985304e+02 - 33 6.5241847803273885e+01 3.7105112939424635e+02 6.0972558235447849e+01 - 34 -2.3124259597682195e+02 -1.1681740329854802e+02 -2.5838262648358682e+02 - 35 -4.1912226107425607e+02 7.9942920270887299e+01 3.1021023518170796e+02 - 36 -1.8561789047315065e+02 -1.1563628711189787e+02 -4.2360172436435668e+01 - 37 8.8271496728328600e+00 -3.5266450940709689e+02 -6.0505384072732632e+01 - 38 -1.9249505149101950e+01 1.1716319600338795e+02 -2.3477222840168844e+02 - 39 -1.0433878247327728e+01 -7.0902801856110116e+01 1.4264113912369351e+02 - 40 3.3265570779158168e+02 -8.8675933035692435e+02 1.6250845779881573e+01 - 41 -6.4537349815946172e+01 1.5189506353180369e+02 -1.8225353662793415e+02 - 42 2.3368723487157848e+01 1.1821526860005753e+02 4.1207323013202608e+02 - 43 -3.5145546474526668e+01 -3.6511647370512939e+00 2.4936793079205805e+02 - 44 -1.2881828259541797e+00 -2.4877240180804270e+02 7.9235766494551896e+01 - 45 2.0871504532586613e+02 -1.0817588901351927e+02 -4.1291808327433904e+02 - 46 -1.3837716960728835e+02 4.6114279241763722e+02 -2.4013801845141236e+02 - 47 1.3255320792802306e+02 2.8747276038940731e+02 -3.2896384987636942e+01 - 48 7.8145138718949806e+02 6.5215432481146109e+01 -6.2304789958703225e+02 - 49 2.4486314507346734e+02 1.9101300126656582e+01 3.7417037047544437e+02 - 50 2.9821275118602205e+02 3.0684252095007048e+02 5.6994896759618052e+02 - 51 -8.0052405736429807e+02 5.1024940640341299e+02 7.5829315450277397e+02 - 52 -9.2130898885938862e+01 1.1909837120724032e+02 -2.4118832391138585e+02 - 53 -3.6386926333478533e+02 -2.0729203700042135e+02 -3.4910517647665347e+02 - 54 -8.3399710534951524e+01 1.8942260327525179e+02 -1.2868598438438329e+02 - 55 -2.5305956575884065e+02 -1.1005916187118694e+02 -3.0893514828399697e+02 - 56 1.7364614503217334e+02 -2.5754370913441153e+02 -4.3744509948721834e+01 - 57 4.2667925201499622e+02 1.5529221173799826e+02 -3.9988499000699767e+02 - 58 -3.9656744140970858e+01 7.8953243693724005e+01 2.6135299122198956e+02 - 59 -2.7594240444747430e+02 1.9891763338583493e+02 2.4122500794450380e+02 - 60 -2.5675904361260217e+02 -1.1527171320985197e+02 9.9923550442518007e+01 - 61 3.0884427580008497e+02 4.9986415802549533e+02 -1.3369122169831985e+02 - 62 2.8530106503455144e+01 5.9540697570421841e-01 -2.7403025931182458e+02 - 63 2.5297054006405503e+02 -2.7640485799384788e+02 -1.9200503841910373e+02 - 64 -8.4680445259253446e+01 -1.5737027404336791e+02 1.5637808719883620e+02 -run_vdwl: -4208.209603101806 -run_coul: -268.02583477440504 -run_stress: ! |2- - 2.3675903993340926e+03 3.0802227297803529e+03 1.2727311522662451e+03 -1.5388669378284644e+03 -1.0907269208283653e+03 1.1229243202763250e+03 + 1 -8.8484243142053771e+01 -2.5824351291806131e+01 1.0916231386685253e+02 + 2 -1.0451347832614758e+02 -1.8136974287862063e+02 -2.1792749625845642e+02 + 3 -1.7141330932870608e+02 1.8106971255162955e+02 1.2675253960497301e+01 + 4 3.2218812838204848e+01 -5.1411756251266169e+01 9.0007306757969332e+01 + 5 1.8144819687099243e+02 1.6798395592380494e+01 -8.1726053808337795e+01 + 6 1.3634126802325468e+02 -3.0056831863560092e+02 2.9662272655036674e+01 + 7 -5.2968391883957075e+01 -1.2850613949952665e+02 -1.6373506942005375e+02 + 8 -1.5240314403220790e+02 4.1133257093807195e+01 1.5386487473711944e+02 + 9 3.2812532468307630e+01 1.0176367686189140e+02 1.4294427965088833e+01 + 10 7.9509811085534508e+01 1.3053732532659748e+02 1.1246398073074913e+02 + 11 -4.3144361329385013e+01 6.5763458097239607e+01 1.3482625633510347e+02 + 12 -9.6706456479566398e+01 -2.5878068074726730e+01 7.8323180467847466e+00 + 13 -6.3851121453490357e+01 -4.6607020158192647e+01 -3.6458352736129619e+01 + 14 7.8283848679559682e+01 -6.3646790831912000e+01 -8.9030561188058030e+01 + 15 -6.4212540181982106e+01 2.1093128152294153e+02 7.9060299592798899e+01 + 16 1.8608410345576598e+02 5.8084942932974315e+01 5.8538920003760346e+01 + 17 1.4285494615811757e+02 -3.9754521764346137e+01 -9.7686742464543357e+01 + 18 -4.1881548239260340e+01 -1.8476992042512617e+02 1.0708048360801492e+02 + 19 2.6677589878662855e+02 3.7179534199157007e+02 -3.3866575926816608e+02 + 20 -7.3520359401756991e+01 -8.3905077072099573e+01 -2.3854316876052961e-01 + 21 -7.2528668519170566e+01 -5.5898051886914395e+01 -1.1976059789267009e+02 + 22 1.5613953224968657e+02 -1.3200393155013322e+02 8.2112641076919701e+01 + 23 8.1833165091702909e+01 -1.7531644917125782e+01 -2.5648343293479577e+01 + 24 -2.1833127742352656e+02 1.9453922798678227e+02 -1.0817823414171312e+02 + 25 -1.1414613109864892e+02 1.9088917707975912e+02 -8.3362585828151552e+01 + 26 2.8281696751420088e+02 -2.1478267582733659e+02 2.2873793580282316e+02 + 27 -5.9769124622217909e+01 6.5221508924768330e+01 1.7553584075622149e+02 + 28 -2.9606162623424783e+00 3.8183918395203605e+01 3.2190129571074365e+01 + 29 -7.1069178571897922e+01 3.5485903180456219e+01 2.7311648896337669e+01 + 30 -1.7036975157904502e+02 -1.9851849204561248e+02 -1.1511387046436195e+02 + 31 -1.3744101014029059e+02 1.6223817575815931e+02 -1.1915340963940670e+02 + 32 2.7247730686207166e+01 -6.0237587331413039e+01 -1.7664910575209962e+02 + 33 -6.1822971861324099e+01 -6.2648749988189138e+01 6.4194672454603221e+01 + 34 -1.7144145154614481e+01 9.9612835226783460e+01 -6.7437146990430080e+01 + 35 2.7024145652918196e+02 -2.1533864682645708e+02 1.3021380112890139e+02 + 36 1.0192185945862100e+02 1.8671686332443795e+02 -1.9864174410201804e+02 + 37 -1.7944122400067195e+02 1.2994089095714943e+02 -6.4321354857450871e+01 + 38 -2.9675055634802862e+02 1.0371104129720518e+02 1.5526989537725160e+02 + 39 8.6949523213895674e+01 -5.9975159120196956e+01 2.1780252234486241e+01 + 40 2.1612729980868430e+01 -1.0242580356371293e+02 5.7270724021457731e+01 + 41 -5.7836015722979205e+01 1.2268076597657853e+01 -6.6177893589402757e+01 + 42 -9.4774792026636987e+01 3.6872244003647978e+01 -7.5003138682741707e+01 + 43 2.2327470123469593e+02 9.5798787537490540e+01 1.2250410628715080e+02 + 44 8.7959342085865870e+01 -9.8740455124804626e+01 -8.4938709742755535e+01 + 45 1.4089093363544144e+01 1.2499300233485909e+02 5.5864237375372056e+01 + 46 1.3547776948110229e+01 -2.9276229642219512e+01 2.2187402435965939e+01 + 47 3.3448457824361199e+01 -1.9209977417392150e+02 -6.9989895706263340e+01 + 48 6.7827627502625162e+01 -2.0361789453088664e+02 -2.8571736118815554e+01 + 49 -3.7476005148434922e+02 -2.4452451195186526e+01 1.0764661193358344e+02 + 50 4.0090993029105412e+01 -7.3201402054245932e+01 8.9025922810974976e+01 + 51 1.3736420686697005e+02 -1.0204157331499377e+02 1.5813725581140889e+02 + 52 -1.1253479916199427e+02 1.2293268076535985e+02 -1.2940078007359961e+02 + 53 -5.3560738472921095e+01 3.3353082884518017e+02 -1.1314448604069298e+00 + 54 -1.0678339177259694e+01 6.2810937621378145e+01 1.8344988318246158e+02 + 55 1.1231900459987534e+02 -1.7906654831317346e+02 7.6533681064342304e+01 + 56 -4.7772143767870944e+01 -1.3536779754026816e+02 3.4054518546944344e+01 + 57 9.6541690594806298e+01 7.5093838528685538e+01 -6.0858704719314126e+01 + 58 -2.0459002696752538e+01 -1.1535051272093606e+01 -1.4282722385693347e+01 + 59 -6.9459404830701018e+01 1.0185761321965332e+02 8.3383492919159224e+01 + 60 -1.6658947285275730e+01 6.4062738321772898e+01 -1.5162708730048112e+02 + 61 -3.5221540644535267e+01 -1.0209415023871217e+02 -7.4154806308030501e+01 + 62 1.5375061601631639e+01 -6.3257038363614946e+00 2.7511178147389188e+01 + 63 1.3464841040549373e+02 -1.2416888785900632e+02 -5.8961420295344652e+01 + 64 1.0701063550375264e+02 1.1895268715876718e+02 7.4448770962530915e+01 +run_vdwl: -3248.732462206598 +run_coul: -327.0653994771387 +run_stress: ! |- + -9.1826184153105692e+02 -1.1070021528099094e+03 -7.1550580149015514e+02 -2.3049698812230801e+02 1.9635464153062043e+02 -6.6005793264639442e+02 run_forces: ! |2 - 1 2.9635294281596629e+01 -5.6267712552695355e+02 -1.6667999923844260e+02 - 2 -1.5938673400153084e+02 -2.2076536449681615e+02 -1.7162354129443358e+02 - 3 -3.1189858281107686e+01 -3.0593580065881065e+02 4.4645958607276903e+01 - 4 4.4646581891372387e+02 1.7080959763779416e+02 1.7439093938226924e+02 - 5 -1.1512839796353090e+02 7.9717058687928301e+01 1.7957487669503269e+01 - 6 -7.1695602565953754e+02 4.0752829698565129e+01 2.1512533839229457e+02 - 7 2.3022644486519411e+02 -9.0168915600548360e+01 8.2194655874266601e+01 - 8 -2.1149264848797216e+01 -1.5637111051642705e+02 1.6102981315496413e+02 - 9 -1.2130987756626666e+02 -2.7961363383950726e+02 -1.9628960069614115e+02 - 10 -3.7631817089744851e+02 3.4103259385937554e+02 -1.8166532788358310e+02 - 11 -1.6154687915128738e+02 1.5742797820592227e+02 3.5832199951133208e+02 - 12 6.1603841944462704e+02 -1.4820397700323306e+02 1.0871524086058155e+02 - 13 -2.1367529106933924e+02 -3.0167446795626824e+02 5.2424091634186300e+02 - 14 2.5933827511241435e+02 -1.7968203382134384e+01 -2.7733114072539058e+02 - 15 1.7570793004243023e+02 1.7551005525188847e+02 -9.5784231788978602e+01 - 16 3.0586985592967716e+02 -4.7679566105942172e+01 -3.4332192731503403e+02 - 17 -1.5018636472333401e+02 1.3259146324637055e+02 2.3200578297676140e+02 - 18 1.6469881174805093e+02 -1.0816836176977682e+02 2.1207670716679300e+02 - 19 2.4759420520504440e+02 -4.8758383157728915e+01 -2.2494116682878234e+02 - 20 1.2419960666451705e+02 2.5137933265662170e+02 -1.5328241144751686e+01 - 21 -1.9556094492800662e+02 2.3151723982044651e+01 -1.2529581330697289e+02 - 22 2.4829941584477842e+02 -2.9829345245035574e+02 -4.0446702084691779e+01 - 23 8.2074458696899129e+01 1.3042100306282259e+02 1.5221371881646226e+02 - 24 -7.6917668833498695e+01 2.3540360228737018e+02 -1.7130192995353460e+02 - 25 -2.9742104523791699e+01 -1.8935699467869648e+02 6.7995874219740458e+01 - 26 -3.9494943772601978e+01 2.1074054704282794e+00 -2.0748981609858308e+02 - 27 -2.7704003655184448e+02 5.3736954143364790e+02 4.2318574013793062e+02 - 28 -2.9302855291124280e+02 -5.1149666118966557e+01 -2.3633679976948292e+02 - 29 1.2970505460339569e+02 -4.2266433901944204e+01 1.6349685185794760e+02 - 30 5.6925896868063084e+01 3.7880918758222101e+01 6.8637128510015330e+01 - 31 -1.9325534294265930e+02 -1.1645328076629426e+02 -2.0671892621504877e+01 - 32 1.2360198063080443e+02 -3.3253019999909611e+01 -1.0516936549559779e+02 - 33 6.5239383936206508e+01 3.7104662858438877e+02 6.0974455303728860e+01 - 34 -2.3124084085036844e+02 -1.1681523003030674e+02 -2.5837805461650709e+02 - 35 -4.1912113383000468e+02 7.9943750613167680e+01 3.1020725803703027e+02 - 36 -1.8561422052424510e+02 -1.1563434085918074e+02 -4.2360108129535796e+01 - 37 8.8275421441412476e+00 -3.5266971563405309e+02 -6.0507541453139780e+01 - 38 -1.9245036832024766e+01 1.1717726898935943e+02 -2.3478417248417912e+02 - 39 -1.0434224692463781e+01 -7.0902644440215226e+01 1.4263978421853071e+02 - 40 3.3271177801097338e+02 -8.8679293552761737e+02 1.6219742097553457e+01 - 41 -6.4538764986414577e+01 1.5189397693607691e+02 -1.8225441696792819e+02 - 42 2.3368235855730731e+01 1.1822246665291377e+02 4.1207745038648687e+02 - 43 -3.5145643416897457e+01 -3.6517162542343855e+00 2.4936784352977961e+02 - 44 -1.2879745400833591e+00 -2.4877345145141396e+02 7.9236449970507763e+01 - 45 2.0871643412337198e+02 -1.0817571271699651e+02 -4.1291831345624706e+02 - 46 -1.3836372705478144e+02 4.6117938292253501e+02 -2.4016736526221220e+02 - 47 1.3255125611057710e+02 2.8747591615866617e+02 -3.2895660248667433e+01 - 48 7.8145417759951215e+02 6.5214930060411348e+01 -6.2304930828893896e+02 - 49 2.4488281403353915e+02 1.9105496615716447e+01 3.7418605144303535e+02 - 50 2.9822129513621309e+02 3.0683153982656597e+02 5.6994490418774978e+02 - 51 -8.0058572063783151e+02 5.1028617285838249e+02 7.5832431569026710e+02 - 52 -9.2137024513817948e+01 1.1910687193197515e+02 -2.4119120858090670e+02 - 53 -3.6387082584323133e+02 -2.0729771077062716e+02 -3.4910499737662099e+02 - 54 -8.3401322475873869e+01 1.8942466656601317e+02 -1.2869045777948361e+02 - 55 -2.5309678413623200e+02 -1.1001947899857403e+02 -3.0896372370121441e+02 - 56 1.7364604574034126e+02 -2.5754429115053944e+02 -4.3743962050163233e+01 - 57 4.2666362581864416e+02 1.5528157995542574e+02 -3.9988032807909389e+02 - 58 -3.9656744873549869e+01 7.8953170999147900e+01 2.6135222052406010e+02 - 59 -2.7594581611209134e+02 1.9891770704099989e+02 2.4122933700016557e+02 - 60 -2.5675992319680108e+02 -1.1527235824442386e+02 9.9923831048631499e+01 - 61 3.0884428120705229e+02 4.9986711220597209e+02 -1.3369013376796403e+02 - 62 2.8530678742626058e+01 5.9283151669356982e-01 -2.7403002505094940e+02 - 63 2.5296775626792657e+02 -2.7640525289662452e+02 -1.9200401038409547e+02 - 64 -8.4674586435535105e+01 -1.5736397776829435e+02 1.5637348700622513e+02 + 1 -8.8485813027206106e+01 -2.5824096764125731e+01 1.0916519811125200e+02 + 2 -1.0451269244764349e+02 -1.8137828885716391e+02 -2.1792302517211854e+02 + 3 -1.7141411648636478e+02 1.8106803267132440e+02 1.2674658958989376e+01 + 4 3.2220655253010904e+01 -5.1413086231065009e+01 9.0010227071396386e+01 + 5 1.8145005123751935e+02 1.6799086578426795e+01 -8.1723924656170567e+01 + 6 1.3640868425589994e+02 -3.0059549892327152e+02 2.9595528779455449e+01 + 7 -5.2968868171259700e+01 -1.2850640761855158e+02 -1.6373951876943795e+02 + 8 -1.5240417232930932e+02 4.1133578832982629e+01 1.5386572595284764e+02 + 9 3.2811395144161118e+01 1.0176141517530588e+02 1.4295529169373282e+01 + 10 7.9508569375402288e+01 1.3053469081285704e+02 1.1246210158699024e+02 + 11 -4.3142968406859097e+01 6.5760241919953828e+01 1.3481728343070949e+02 + 12 -9.6708250458847047e+01 -2.5879521605003774e+01 7.8278088000700450e+00 + 13 -6.3852523341823215e+01 -4.6607003335506526e+01 -3.6455965991574899e+01 + 14 7.8283534745824213e+01 -6.3643851884097081e+01 -8.9027881489336053e+01 + 15 -6.4209962316685647e+01 2.1093255387179667e+02 7.9059692211125324e+01 + 16 1.8608085162130908e+02 5.8088780803195149e+01 5.8532604899053126e+01 + 17 1.4285609630789870e+02 -3.9754014601715802e+01 -9.7689588113924358e+01 + 18 -4.1881237955183380e+01 -1.8477109777149900e+02 1.0708061287038568e+02 + 19 2.6677609377410010e+02 3.7179392086487712e+02 -3.3866472006706340e+02 + 20 -7.3532190353883053e+01 -8.3895301502997995e+01 -2.5591151698950659e-01 + 21 -7.2528695460850031e+01 -5.5899068566579935e+01 -1.1975970158720031e+02 + 22 1.5614083463623408e+02 -1.3200472837628521e+02 8.2112156159808862e+01 + 23 8.1835290134891864e+01 -1.7522433028942366e+01 -2.5648597332802922e+01 + 24 -2.1834038832017538e+02 1.9455197293610073e+02 -1.0818261235148485e+02 + 25 -1.1414871301032665e+02 1.9089327234338916e+02 -8.3363315092572321e+01 + 26 2.8282661127556162e+02 -2.1478990451658228e+02 2.2874215408671131e+02 + 27 -5.9765619577841512e+01 6.5223096224356411e+01 1.7553677772771837e+02 + 28 -2.9624987519851000e+00 3.8179667154298826e+01 3.2185280629057068e+01 + 29 -7.1069494187081830e+01 3.5486459200488397e+01 2.7311657807311487e+01 + 30 -1.7037047317028464e+02 -1.9851861739498079e+02 -1.1511395377375429e+02 + 31 -1.3744346258178371e+02 1.6223725554250467e+02 -1.1915482471876425e+02 + 32 2.7248541074999881e+01 -6.0231207974705434e+01 -1.7663875080811843e+02 + 33 -6.1822398570959187e+01 -6.2648503570177034e+01 6.4194898940197760e+01 + 34 -1.7143769208529751e+01 9.9611942509072080e+01 -6.7436075885014986e+01 + 35 2.7028238194296250e+02 -2.1538301386687789e+02 1.3022488558865325e+02 + 36 1.0192362247594352e+02 1.8671008619975407e+02 -1.9863711527085923e+02 + 37 -1.7946751638141498e+02 1.2998098195714172e+02 -6.4345576150932828e+01 + 38 -2.9675376021752191e+02 1.0371435865032235e+02 1.5526896750689889e+02 + 39 8.6950332148131110e+01 -5.9975388525042028e+01 2.1779869753193040e+01 + 40 2.1613442490343317e+01 -1.0242529062335393e+02 5.7271060256879871e+01 + 41 -5.7834219239599371e+01 1.2266148111030006e+01 -6.6169611760840567e+01 + 42 -9.4774021509187520e+01 3.6869981851995341e+01 -7.5005285702022732e+01 + 43 2.2327078175416057e+02 9.5796580610065675e+01 1.2250057895428364e+02 + 44 8.7963372590925971e+01 -9.8736166841311601e+01 -8.4943701327958067e+01 + 45 1.4080569929277514e+01 1.2498603359504317e+02 5.5870075675508225e+01 + 46 1.3549084713162141e+01 -2.9276453411015115e+01 2.2187141786216614e+01 + 47 3.3448153520154243e+01 -1.9209514330879989e+02 -6.9988284949882583e+01 + 48 6.7840148074199064e+01 -2.0361975956922109e+02 -2.8580806381848241e+01 + 49 -3.7480020999441342e+02 -2.4397739069897693e+01 1.0773474200196225e+02 + 50 4.0091767398974710e+01 -7.3200211843412532e+01 8.9024460533547710e+01 + 51 1.3736689552057061e+02 -1.0204490779999098e+02 1.5814099219631356e+02 + 52 -1.1253380764229995e+02 1.2293290174735385e+02 -1.2940467151627448e+02 + 53 -5.3596650492501155e+01 3.3350644289105048e+02 -1.1510223807932292e+00 + 54 -1.0666202581574648e+01 6.2798090272532036e+01 1.8346799239172421e+02 + 55 1.1232135575968965e+02 -1.7906994470748415e+02 7.6534265236354301e+01 + 56 -4.7780797026174795e+01 -1.3535955159718560e+02 3.4061208199866762e+01 + 57 9.6541265005138669e+01 7.5091144884198542e+01 -6.0860069746425758e+01 + 58 -2.0459328007572658e+01 -1.1533053731831272e+01 -1.4282938438265621e+01 + 59 -6.9467796604507953e+01 1.0186323697055805e+02 8.3388794196804326e+01 + 60 -1.6660217426514649e+01 6.4061566362647156e+01 -1.5162714312949214e+02 + 61 -3.5220536021452773e+01 -1.0209241739133056e+02 -7.4154706185261873e+01 + 62 1.5375483178245863e+01 -6.3263099051314251e+00 2.7512110875657907e+01 + 63 1.3464595988109866e+02 -1.2416936634154251e+02 -5.8957063242418137e+01 + 64 1.0701154605982802e+02 1.1895382951205713e+02 7.4449321163285816e+01 ... From 4eaa45337c24d786bc7cd1546bc59e82d1346a91 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 15:14:12 -0400 Subject: [PATCH 072/119] reorder functions for simpler side-by-side comparison --- src/USER-OMP/reaxc_bond_orders_omp.cpp | 291 ++++++++++++------------- 1 file changed, 140 insertions(+), 151 deletions(-) diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index 6434c3d03a..4e7e42fac7 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -1,6 +1,5 @@ /*---------------------------------------------------------------------- PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd Copyright (2010) Purdue University @@ -37,156 +36,6 @@ using namespace LAMMPS_NS; namespace ReaxFF { - void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) { - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - int pk, k, j; - - PairReaxCOMP *pair_reax_ptr = static_cast(system->pair_ptr); - - int tid = get_tid(); - ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - long reductionOffset = (system->N * tid); - - /* Virial Tallying variables */ - rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; - - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); - - double c = bo_ij->Cdbo + bo_ji->Cdbo; - coef.C1dbo = bo_ij->C1dbo * c; - coef.C2dbo = bo_ij->C2dbo * c; - coef.C3dbo = bo_ij->C3dbo * c; - - c = bo_ij->Cdbopi + bo_ji->Cdbopi; - coef.C1dbopi = bo_ij->C1dbopi * c; - coef.C2dbopi = bo_ij->C2dbopi * c; - coef.C3dbopi = bo_ij->C3dbopi * c; - coef.C4dbopi = bo_ij->C4dbopi * c; - - c = bo_ij->Cdbopi2 + bo_ji->Cdbopi2; - coef.C1dbopi2 = bo_ij->C1dbopi2 * c; - coef.C2dbopi2 = bo_ij->C2dbopi2 * c; - coef.C3dbopi2 = bo_ij->C3dbopi2 * c; - coef.C4dbopi2 = bo_ij->C4dbopi2 * c; - - c = workspace->CdDelta[i] + workspace->CdDelta[j]; - coef.C1dDelta = bo_ij->C1dbo * c; - coef.C2dDelta = bo_ij->C2dbo * c; - coef.C3dDelta = bo_ij->C3dbo * c; - - c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp); - - c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); - rvec_ScaledAdd(temp, c, workspace->dDeltap_self[i]); - - rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); - rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); - - rvec_Add(workspace->forceReduction[reductionOffset+i],temp); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fi_tmp, -1.0, temp); - rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, - fi_tmp[0],fi_tmp[1],fi_tmp[2], - delij[0],delij[1],delij[2],thr); - } - - c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); - rvec_Scale( temp, c, bo_ij->dBOp); - - c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); - rvec_ScaledAdd(temp, c, workspace->dDeltap_self[j]); - - rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); - rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); - - - rvec_Add(workspace->forceReduction[reductionOffset+j],temp); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fj_tmp, -1.0, temp); - rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, - fj_tmp[0],fj_tmp[1],fj_tmp[2], - delji[0],delji[1],delji[2],thr); - } - - // forces on k: i neighbor - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); - - const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); - rvec_Scale(temp, c, nbr_k->bo_data.dBOp); - - rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); - } - } - - // forces on k: j neighbor - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - // rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); - - const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); - rvec_Scale(temp, c, nbr_k->bo_data.dBOp); - - rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); - rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); - - rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); - } - } - } - -/* ---------------------------------------------------------------------- */ - void Add_dBond_to_Forces_NPTOMP(reax_system *system, int i, int pj, storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; @@ -288,6 +137,146 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+j],temp); } +/* ---------------------------------------------------------------------- */ + + void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, + storage *workspace, reax_list **lists) { + reax_list *bonds = (*lists) + BONDS; + bond_data *nbr_j, *nbr_k; + bond_order_data *bo_ij, *bo_ji; + dbond_coefficients coef; + int pk, k, j; + + PairReaxCOMP *pair_reax_ptr = static_cast(system->pair_ptr); + + int tid = get_tid(); + ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); + long reductionOffset = (system->N * tid); + + /* Virial Tallying variables */ + rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; + + /* Initializations */ + nbr_j = &(bonds->select.bond_list[pj]); + j = nbr_j->nbr; + bo_ij = &(nbr_j->bo_data); + bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); + + double c = bo_ij->Cdbo + bo_ji->Cdbo; + coef.C1dbo = bo_ij->C1dbo * c; + coef.C2dbo = bo_ij->C2dbo * c; + coef.C3dbo = bo_ij->C3dbo * c; + + c = bo_ij->Cdbopi + bo_ji->Cdbopi; + coef.C1dbopi = bo_ij->C1dbopi * c; + coef.C2dbopi = bo_ij->C2dbopi * c; + coef.C3dbopi = bo_ij->C3dbopi * c; + coef.C4dbopi = bo_ij->C4dbopi * c; + + c = bo_ij->Cdbopi2 + bo_ji->Cdbopi2; + coef.C1dbopi2 = bo_ij->C1dbopi2 * c; + coef.C2dbopi2 = bo_ij->C2dbopi2 * c; + coef.C3dbopi2 = bo_ij->C3dbopi2 * c; + coef.C4dbopi2 = bo_ij->C4dbopi2 * c; + + c = workspace->CdDelta[i] + workspace->CdDelta[j]; + coef.C1dDelta = bo_ij->C1dbo * c; + coef.C2dDelta = bo_ij->C2dbo * c; + coef.C3dDelta = bo_ij->C3dbo * c; + + c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp); + + c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[i]); + + rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); + + rvec_Add(workspace->forceReduction[reductionOffset+i],temp); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fi_tmp, -1.0, temp); + rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, + fi_tmp[0],fi_tmp[1],fi_tmp[2], + delij[0],delij[1],delij[2],thr); + } + + c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp); + + c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[j]); + + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); + rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); + + + rvec_Add(workspace->forceReduction[reductionOffset+j],temp); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fj_tmp, -1.0, temp); + rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, + fj_tmp[0],fj_tmp[1],fj_tmp[2], + delji[0],delji[1],delji[2],thr); + } + + // forces on k: i neighbor + for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delki[0],delki[1],delki[2],thr); + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delkj[0],delkj[1],delkj[2],thr); + } + } + + // forces on k: j neighbor + for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { + nbr_k = &(bonds->select.bond_list[pk]); + k = nbr_k->nbr; + + const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + + rvec_Add(workspace->forceReduction[reductionOffset+k],temp); + + if (system->pair_ptr->vflag_atom) { + rvec_Scale(fk_tmp, -1.0, temp); + rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delki[0],delki[1],delki[2],thr); + + rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); + + pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + fk_tmp[0],fk_tmp[1],fk_tmp[2], + delkj[0],delkj[1],delkj[2],thr); + } + } + } + /* ---------------------------------------------------------------------- */ int BOp_OMP(storage * /* workspace */, reax_list *bonds, double bo_cut, From 865759116e1bd9f31a054e895b90f9224f25cad0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 15:14:18 -0400 Subject: [PATCH 073/119] update some comments --- src/USER-REAXC/reaxc_bond_orders.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index c3fda58173..65189562ae 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -2,15 +2,16 @@ PuReMD - Purdue ReaxFF Molecular Dynamics Program Copyright (2010) Purdue University - Hasan Metin Aktulga, hmaktulga@lbl.gov - Joseph Fogarty, jcfogart@mail.usf.edu - Sagar Pandit, pandit@usf.edu - Ananth Y Grama, ayg@cs.purdue.edu + + Contributing authors: + H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama + Corresponding author: + Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu Please cite the related publication: H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. + Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -64,6 +65,11 @@ namespace ReaxFF { coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + + /************************************ + * forces related to atom i * + * first neighbors of atom i * + ************************************/ for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; From f856030203a1d99fff38f48c39d4fea6462e12ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Apr 2021 15:22:00 -0400 Subject: [PATCH 074/119] update example inputs and log files for current state of affairs --- examples/reax/in.reaxc.rdx | 68 ++++---- examples/reax/in.reaxc.rdx-shielded | 67 ++++---- examples/reax/in.reaxc.tatb | 71 ++++---- examples/reax/in.reaxc.tatb-shielded | 71 ++++---- .../reax/log.21Apr21.reaxc.rdx-shielded.g++.1 | 154 ++++++++++++++++++ .../reax/log.21Apr21.reaxc.rdx-shielded.g++.4 | 154 ++++++++++++++++++ examples/reax/log.21Apr21.reaxc.rdx.g++.1 | 154 ++++++++++++++++++ examples/reax/log.21Apr21.reaxc.rdx.g++.4 | 154 ++++++++++++++++++ .../log.21Apr21.reaxc.tatb-shielded.g++.1 | 154 ++++++++++++++++++ .../log.21Apr21.reaxc.tatb-shielded.g++.4 | 154 ++++++++++++++++++ examples/reax/log.21Apr21.reaxc.tatb.g++.1 | 154 ++++++++++++++++++ examples/reax/log.21Apr21.reaxc.tatb.g++.4 | 154 ++++++++++++++++++ .../reax/log.4Jan19.reaxc.rdx-shielded.g++.1 | 116 ------------- .../reax/log.4Jan19.reaxc.rdx-shielded.g++.4 | 116 ------------- .../reax/log.4Jan19.reaxc.tatb-shielded.g++.1 | 114 ------------- .../reax/log.4Jan19.reaxc.tatb-shielded.g++.4 | 114 ------------- examples/reax/log.8March18.reaxc.rdx.g++.1 | 115 ------------- examples/reax/log.8March18.reaxc.rdx.g++.4 | 115 ------------- examples/reax/log.8March18.reaxc.tatb.g++.1 | 113 ------------- examples/reax/log.8March18.reaxc.tatb.g++.4 | 113 ------------- 20 files changed, 1373 insertions(+), 1052 deletions(-) create mode 100644 examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 create mode 100644 examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 create mode 100644 examples/reax/log.21Apr21.reaxc.rdx.g++.1 create mode 100644 examples/reax/log.21Apr21.reaxc.rdx.g++.4 create mode 100644 examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 create mode 100644 examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 create mode 100644 examples/reax/log.21Apr21.reaxc.tatb.g++.1 create mode 100644 examples/reax/log.21Apr21.reaxc.tatb.g++.4 delete mode 100644 examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.1 delete mode 100644 examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.4 delete mode 100644 examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.1 delete mode 100644 examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.4 delete mode 100644 examples/reax/log.8March18.reaxc.rdx.g++.1 delete mode 100644 examples/reax/log.8March18.reaxc.rdx.g++.4 delete mode 100644 examples/reax/log.8March18.reaxc.tatb.g++.1 delete mode 100644 examples/reax/log.8March18.reaxc.tatb.g++.4 diff --git a/examples/reax/in.reaxc.rdx b/examples/reax/in.reaxc.rdx index 4874ea2dbb..36bf2a6e8c 100644 --- a/examples/reax/in.reaxc.rdx +++ b/examples/reax/in.reaxc.rdx @@ -1,52 +1,54 @@ # ReaxFF potential for RDX system # this run is equivalent to reax/in.reax.rdx -units real +units real -atom_style charge -read_data data.rdx +atom_style charge +read_data data.rdx pair_style reax/c control.reax_c.rdx pair_coeff * * ffield.reax C H O N compute reax all pair reax/c -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no -fix 1 all nve +fix 1 all nve fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c -thermo 10 -thermo_style custom step temp epair etotal press & - v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & - v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq +variable nqeq equal f_2 -timestep 1.0 +thermo 10 +thermo_style custom step temp epair etotal press & + v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & + v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq -#dump 1 all atom 10 dump.reaxc.rdx +timestep 1.0 -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 1 all atom 10 dump.reaxc.rdx -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -run 100 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 diff --git a/examples/reax/in.reaxc.rdx-shielded b/examples/reax/in.reaxc.rdx-shielded index 3354b92eab..2151f63a5f 100644 --- a/examples/reax/in.reaxc.rdx-shielded +++ b/examples/reax/in.reaxc.rdx-shielded @@ -1,52 +1,53 @@ # ReaxFF potential for RDX system # this run is equivalent to reax/in.reax.rdx -units real +units real -atom_style charge -read_data data.rdx +atom_style charge +read_data data.rdx pair_style reax/c control.reax_c.rdx pair_coeff * * ffield.reax C H O N compute reax all pair reax/c -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no -fix 1 all nve +fix 1 all nve fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c +variable nqeq equal f_2 -thermo 10 -thermo_style custom step temp epair etotal press & - v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & - v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq +thermo 10 +thermo_style custom step temp epair etotal press & + v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & + v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq -timestep 1.0 +timestep 1.0 -#dump 1 all atom 10 dump.reaxc.rdx +#dump 1 all atom 10 dump.reaxc.rdx -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -run 100 +run 100 diff --git a/examples/reax/in.reaxc.tatb b/examples/reax/in.reaxc.tatb index a166613b85..474290340f 100644 --- a/examples/reax/in.reaxc.tatb +++ b/examples/reax/in.reaxc.tatb @@ -1,55 +1,56 @@ # ReaxFF potential for TATB system # this run is equivalent to reax/in.reax.tatb, -units real +units real -atom_style charge -read_data data.tatb +atom_style charge +read_data data.tatb pair_style reax/c control.reax_c.tatb pair_coeff * * ffield.reax C H O N compute reax all pair reax/c -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no -fix 1 all nve +fix 1 all nve fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc +fix 4 all reax/c/bonds 5 bonds.reaxc +variable nqeq equal f_2 -thermo 5 -thermo_style custom step temp epair etotal press & - v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & - v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq +thermo 5 +thermo_style custom step temp epair etotal press & + v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & + v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq -timestep 0.0625 +timestep 0.0625 -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z +#dump 1 all custom 100 dump.reaxc.tatb id type q x y z -#dump 2 all image 5 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 5 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 5 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 5 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -fix 3 all reax/c/species 1 5 5 species.tatb +fix 3 all reax/c/species 1 5 5 species.tatb -run 25 +run 25 diff --git a/examples/reax/in.reaxc.tatb-shielded b/examples/reax/in.reaxc.tatb-shielded index 2ff4d34f7a..aeac3308a8 100644 --- a/examples/reax/in.reaxc.tatb-shielded +++ b/examples/reax/in.reaxc.tatb-shielded @@ -1,55 +1,56 @@ # ReaxFF potential for TATB system # this run is equivalent to reax/in.reax.tatb, -units real +units real -atom_style charge -read_data data.tatb +atom_style charge +read_data data.tatb pair_style reax/c control.reax_c.tatb pair_coeff * * ffield.reax C H O N compute reax all pair reax/c -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no -fix 1 all nve +fix 1 all nve fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc +fix 4 all reax/c/bonds 5 bonds.reaxc +variable nqeq equal f_2 -thermo 5 -thermo_style custom step temp epair etotal press & - v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & - v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq +thermo 5 +thermo_style custom step temp epair etotal press & + v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa & + v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq -timestep 0.0625 +timestep 0.0625 -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z +#dump 1 all custom 100 dump.reaxc.tatb id type q x y z -#dump 2 all image 5 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 5 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 5 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 5 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -fix 3 all reax/c/species 1 5 5 species.tatb +fix 3 all reax/c/species 1 5 5 species.tatb -run 25 +run 25 diff --git a/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 b/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 new file mode 100644 index 0000000000..5ff8307135 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.617026 on 1 procs for 100 steps with 21 atoms + +Performance: 14.003 ns/day, 1.714 hours/ns, 162.068 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52176 | 0.52176 | 0.52176 | 0.0 | 84.56 +Neigh | 0.033948 | 0.033948 | 0.033948 | 0.0 | 5.50 +Comm | 0.0017188 | 0.0017188 | 0.0017188 | 0.0 | 0.28 +Output | 0.00059319 | 0.00059319 | 0.00059319 | 0.0 | 0.10 +Modify | 0.05887 | 0.05887 | 0.05887 | 0.0 | 9.54 +Other | | 0.0001347 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 b/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 new file mode 100644 index 0000000000..79fa5f77b2 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.617778 on 1 procs for 100 steps with 21 atoms + +Performance: 13.986 ns/day, 1.716 hours/ns, 161.871 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52159 | 0.52159 | 0.52159 | 0.0 | 84.43 +Neigh | 0.03479 | 0.03479 | 0.03479 | 0.0 | 5.63 +Comm | 0.0017166 | 0.0017166 | 0.0017166 | 0.0 | 0.28 +Output | 0.00061226 | 0.00061226 | 0.00061226 | 0.0 | 0.10 +Modify | 0.058924 | 0.058924 | 0.058924 | 0.0 | 9.54 +Other | | 0.0001466 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.rdx.g++.1 b/examples/reax/log.21Apr21.reaxc.rdx.g++.1 new file mode 100644 index 0000000000..38347ffce7 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.rdx.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.618477 on 1 procs for 100 steps with 21 atoms + +Performance: 13.970 ns/day, 1.718 hours/ns, 161.687 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52329 | 0.52329 | 0.52329 | 0.0 | 84.61 +Neigh | 0.03397 | 0.03397 | 0.03397 | 0.0 | 5.49 +Comm | 0.0017006 | 0.0017006 | 0.0017006 | 0.0 | 0.27 +Output | 0.00060892 | 0.00060892 | 0.00060892 | 0.0 | 0.10 +Modify | 0.058764 | 0.058764 | 0.058764 | 0.0 | 9.50 +Other | | 0.0001407 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.rdx.g++.4 b/examples/reax/log.21Apr21.reaxc.rdx.g++.4 new file mode 100644 index 0000000000..a409cbe358 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.rdx.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.618479 on 1 procs for 100 steps with 21 atoms + +Performance: 13.970 ns/day, 1.718 hours/ns, 161.687 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52299 | 0.52299 | 0.52299 | 0.0 | 84.56 +Neigh | 0.034338 | 0.034338 | 0.034338 | 0.0 | 5.55 +Comm | 0.0017166 | 0.0017166 | 0.0017166 | 0.0 | 0.28 +Output | 0.00060272 | 0.00060272 | 0.00060272 | 0.0 | 0.10 +Modify | 0.058692 | 0.058692 | 0.058692 | 0.0 | 9.49 +Other | | 0.0001385 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 b/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 new file mode 100644 index 0000000000..dac271442b --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.618214 on 1 procs for 100 steps with 21 atoms + +Performance: 13.976 ns/day, 1.717 hours/ns, 161.756 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52298 | 0.52298 | 0.52298 | 0.0 | 84.60 +Neigh | 0.033964 | 0.033964 | 0.033964 | 0.0 | 5.49 +Comm | 0.001708 | 0.001708 | 0.001708 | 0.0 | 0.28 +Output | 0.00060844 | 0.00060844 | 0.00060844 | 0.0 | 0.10 +Modify | 0.058812 | 0.058812 | 0.058812 | 0.0 | 9.51 +Other | | 0.0001411 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 b/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 new file mode 100644 index 0000000000..74c2a13875 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.617311 on 1 procs for 100 steps with 21 atoms + +Performance: 13.996 ns/day, 1.715 hours/ns, 161.993 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52226 | 0.52226 | 0.52226 | 0.0 | 84.60 +Neigh | 0.033952 | 0.033952 | 0.033952 | 0.0 | 5.50 +Comm | 0.0017183 | 0.0017183 | 0.0017183 | 0.0 | 0.28 +Output | 0.00060129 | 0.00060129 | 0.00060129 | 0.0 | 0.10 +Modify | 0.058648 | 0.058648 | 0.058648 | 0.0 | 9.50 +Other | | 0.0001364 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.tatb.g++.1 b/examples/reax/log.21Apr21.reaxc.tatb.g++.1 new file mode 100644 index 0000000000..d79287b694 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.tatb.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.617401 on 1 procs for 100 steps with 21 atoms + +Performance: 13.994 ns/day, 1.715 hours/ns, 161.969 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52185 | 0.52185 | 0.52185 | 0.0 | 84.52 +Neigh | 0.034507 | 0.034507 | 0.034507 | 0.0 | 5.59 +Comm | 0.0017211 | 0.0017211 | 0.0017211 | 0.0 | 0.28 +Output | 0.00060844 | 0.00060844 | 0.00060844 | 0.0 | 0.10 +Modify | 0.058573 | 0.058573 | 0.058573 | 0.0 | 9.49 +Other | | 0.0001466 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.21Apr21.reaxc.tatb.g++.4 b/examples/reax/log.21Apr21.reaxc.tatb.g++.4 new file mode 100644 index 0000000000..e0cb6b6760 --- /dev/null +++ b/examples/reax/log.21Apr21.reaxc.tatb.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system +# this run is equivalent to reax/in.reax.rdx + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reax/c control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reax/c + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxc.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reax/c command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reax command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reax/c, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: half/ghost/bin/3d/newtoff + bin: standard + (2) fix qeq/reax, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 + 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 + 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 + 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 + 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 + 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 + 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 + 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 + 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 +Loop time of 0.617397 on 1 procs for 100 steps with 21 atoms + +Performance: 13.994 ns/day, 1.715 hours/ns, 161.970 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.52183 | 0.52183 | 0.52183 | 0.0 | 84.52 +Neigh | 0.034217 | 0.034217 | 0.034217 | 0.0 | 5.54 +Comm | 0.0017104 | 0.0017104 | 0.0017104 | 0.0 | 0.28 +Output | 0.00059891 | 0.00059891 | 0.00059891 | 0.0 | 0.10 +Modify | 0.0589 | 0.0589 | 0.0589 | 0.0 | 9.54 +Other | | 0.0001419 | | | 0.02 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1096 +Ave neighs/atom = 52.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.1 b/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.1 deleted file mode 100644 index 9e991a5d6e..0000000000 --- a/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.1 +++ /dev/null @@ -1,116 +0,0 @@ -LAMMPS (4 Jan 2019) -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx - orthogonal box = (35 35 35) to (48 48 48) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - -pair_style reax/c control.reax_c.rdx -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/shielded, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 15.54 | 15.54 | 15.54 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79939 0 168.88404 - 10 1288.6115 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.60722 0.2017796 0 54.629557 3.1252289 -77.7067 0 14.933901 -5.8108542 843.92073 -180.43321 0 107.75934 - 20 538.95832 -1942.7037 -1910.5731 -10725.665 -2803.7395 7.9078296 0.077926657 0 81.61005 0.22951928 -57.5571 0 30.331204 -10.178049 878.99014 -159.69088 0 89.31512 - 30 463.09535 -1933.5765 -1905.9685 -33255.521 -2749.8591 -8.0154561 0.027628873 0 81.62739 0.11972409 -50.262289 0 20.820315 -9.6327029 851.88723 -149.49502 0 79.205749 - 40 885.49232 -1958.9126 -1906.1229 -4814.704 -2795.644 9.1506683 0.13747502 0 70.947988 0.2436053 -57.862679 0 19.076499 -11.141216 873.73896 -159.99392 0 92.434085 - 50 861.16622 -1954.4599 -1903.1204 -1896.7878 -2784.8448 3.8269901 0.15793272 0 79.851828 3.3492155 -78.066128 0 32.628996 -7.9565333 872.81832 -190.98567 0 114.75995 - 60 1167.7852 -1971.843 -1902.2241 -3482.6875 -2705.8632 -17.121673 0.22749075 0 44.507672 7.856086 -74.788945 0 16.256491 -4.6046463 835.83056 -188.33693 0 114.19414 - 70 1439.997 -1989.3024 -1903.4553 23845.434 -2890.7895 31.958869 0.26671726 0 85.758681 3.1803462 -71.002898 0 24.35711 -10.311314 905.86781 -175.38471 0 106.79648 - 80 502.39629 -1930.7545 -1900.8035 -20356.384 -2703.8111 -18.66263 0.11286065 0 99.804114 2.0329076 -76.171338 0 19.23692 -6.2786691 826.47429 -166.03132 0 92.539464 - 90 749.08722 -1946.9837 -1902.3259 17798.557 -2863.7579 42.068808 0.24338058 0 96.181716 0.96183793 -69.955449 0 24.615308 -11.58277 903.68837 -190.13841 0 120.6914 - 100 1109.6997 -1968.5874 -1902.4313 -4490.2776 -2755.896 -7.1232734 0.21757686 0 61.806176 7.0827207 -75.645383 0 20.114879 -6.2371839 863.56324 -198.56967 0 122.09951 -Loop time of 0.657427 on 1 procs for 100 steps with 21 atoms - -Performance: 13.142 ns/day, 1.826 hours/ns, 152.108 timesteps/s -99.3% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.59308 | 0.59308 | 0.59308 | 0.0 | 90.21 -Neigh | 0.020665 | 0.020665 | 0.020665 | 0.0 | 3.14 -Comm | 0.0015757 | 0.0015757 | 0.0015757 | 0.0 | 0.24 -Output | 0.00039387 | 0.00039387 | 0.00039387 | 0.0 | 0.06 -Modify | 0.04156 | 0.04156 | 0.04156 | 0.0 | 6.32 -Other | | 0.000154 | | | 0.02 - -Nlocal: 21 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 1306 ave 1306 max 1306 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1306 -Ave neighs/atom = 62.1905 -Neighbor list builds = 10 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:00 diff --git a/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.4 b/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.4 deleted file mode 100644 index 1492865c17..0000000000 --- a/examples/reax/log.4Jan19.reaxc.rdx-shielded.g++.4 +++ /dev/null @@ -1,116 +0,0 @@ -LAMMPS (4 Jan 2019) -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx - orthogonal box = (35 35 35) to (48 48 48) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 21 atoms - -pair_style reax/c control.reax_c.rdx -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/shielded, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 10.62 | 12.08 | 13.84 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -1884.3081 -1884.3081 27186.178 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79987 0 168.88452 - 10 1288.6116 -1989.6644 -1912.8422 -19456.355 -2734.6769 -15.60722 0.2017796 0 54.629559 3.1252284 -77.7067 0 14.933902 -5.8108544 843.92073 -180.43321 0 107.75934 - 20 538.95818 -1942.7037 -1910.5731 -10725.629 -2803.7394 7.9078295 0.077926694 0 81.61005 0.22951941 -57.557106 0 30.331206 -10.178049 878.9901 -159.68969 0 89.313929 - 30 463.09529 -1933.5765 -1905.9685 -33255.529 -2749.859 -8.0154758 0.027628845 0 81.627406 0.1197241 -50.26229 0 20.82031 -9.6327013 851.88715 -149.49497 0 79.205706 - 40 885.49462 -1958.9125 -1906.1227 -4814.6528 -2795.6439 9.1506212 0.13747486 0 70.94804 0.24360501 -57.862675 0 19.076509 -11.141214 873.7389 -159.99391 0 92.434076 - 50 861.16112 -1954.4601 -1903.121 -1896.6704 -2784.8452 3.8270543 0.15793292 0 79.851662 3.3492078 -78.066133 0 32.628979 -7.9565431 872.81857 -190.9857 0 114.75999 - 60 1167.7837 -1971.8434 -1902.2245 -3482.8961 -2705.8635 -17.121601 0.22749083 0 44.507696 7.8559922 -74.789025 0 16.256492 -4.6046625 835.83053 -188.33688 0 114.19412 - 70 1439.9917 -1989.3024 -1903.4555 23845.887 -2890.7894 31.958677 0.26671714 0 85.758424 3.1804092 -71.002955 0 24.357221 -10.311284 905.86805 -175.38496 0 106.7967 - 80 502.39695 -1930.7548 -1900.8039 -20356.331 -2703.8113 -18.662598 0.11286102 0 99.803743 2.0329429 -76.171299 0 19.236922 -6.2786652 826.4744 -166.03139 0 92.539525 - 90 749.08478 -1946.984 -1902.3264 17798.605 -2863.7581 42.068587 0.24338052 0 96.181622 0.96184063 -69.955519 0 24.615456 -11.582749 903.68853 -190.13827 0 120.69126 - 100 1109.6952 -1968.5879 -1902.4321 -4490.2728 -2755.8985 -7.1225966 0.21757682 0 61.805902 7.0826502 -75.64544 0 20.115369 -6.2372513 863.56451 -198.56956 0 122.09944 -Loop time of 0.634333 on 4 procs for 100 steps with 21 atoms - -Performance: 13.621 ns/day, 1.762 hours/ns, 157.646 timesteps/s -93.8% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.53395 | 0.5352 | 0.53805 | 0.2 | 84.37 -Neigh | 0.0088253 | 0.012023 | 0.016203 | 2.4 | 1.90 -Comm | 0.0051677 | 0.0081 | 0.0093861 | 1.9 | 1.28 -Output | 0.00049353 | 0.00054371 | 0.00058222 | 0.0 | 0.09 -Modify | 0.074155 | 0.078299 | 0.081472 | 0.9 | 12.34 -Other | | 0.0001715 | | | 0.03 - -Nlocal: 5.25 ave 15 max 0 min -Histogram: 1 0 2 0 0 0 0 0 0 1 -Nghost: 355.5 ave 432 max 282 min -Histogram: 1 0 0 0 1 1 0 0 0 1 -Neighs: 298.75 ave 822 max 0 min -Histogram: 1 0 2 0 0 0 0 0 0 1 -FullNghs: 326.5 ave 927 max 0 min -Histogram: 1 0 2 0 0 0 0 0 0 1 - -Total # of neighbors = 1306 -Ave neighs/atom = 62.1905 -Neighbor list builds = 10 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:00 diff --git a/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.1 b/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.1 deleted file mode 100644 index 86dc1c323a..0000000000 --- a/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.1 +++ /dev/null @@ -1,114 +0,0 @@ -LAMMPS (4 Jan 2019) -# ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, - -units real - -atom_style charge -read_data data.tatb - triclinic box = (0 0 0) to (13.624 17.1149 15.1826) with tilt (-5.75316 -6.32547 7.42573) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 384 atoms - -pair_style reax/c control.reax_c.tatb -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no - -fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc - -thermo 5 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 0.0625 - -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z - -#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -fix 3 all reax/c/species 1 5 5 species.tatb - -run 25 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 5 4 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/shielded, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 169.6 | 169.6 | 169.6 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -44760.998 -44760.998 7827.7879 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6394 0 6391.0274 - 5 0.61603942 -44761.698 -44760.994 8934.628 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.193 0 6388.6691 - 10 2.3525549 -44763.227 -44760.541 12288.614 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50358 -1560.7569 252.85309 -655.44063 18850.391 -8730.9684 0 6381.7061 - 15 4.9013311 -44766.36 -44760.764 17716.982 -61103.434 489.14721 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2449 0 6370.4111 - 20 7.8294673 -44769.686 -44760.747 25205.558 -61089.006 490.21313 4.719302 0 1571.7022 20.420943 -260.85565 -1573.7378 253.3539 -654.31623 18816.07 -8703.5142 0 6355.2654 - 25 10.697904 -44772.904 -44760.691 34232.821 -61069.308 490.25886 4.7163736 0 1570.7397 20.181346 -251.91378 -1582.3261 253.82253 -653.53184 18791.975 -8684.3541 0 6336.8349 -Loop time of 7.80985 on 1 procs for 25 steps with 384 atoms - -Performance: 0.017 ns/day, 1388.418 hours/ns, 3.201 timesteps/s -100.0% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 5.003 | 5.003 | 5.003 | 0.0 | 64.06 -Neigh | 1.1164 | 1.1164 | 1.1164 | 0.0 | 14.29 -Comm | 0.0065806 | 0.0065806 | 0.0065806 | 0.0 | 0.08 -Output | 0.00029969 | 0.00029969 | 0.00029969 | 0.0 | 0.00 -Modify | 1.6831 | 1.6831 | 1.6831 | 0.0 | 21.55 -Other | | 0.0004976 | | | 0.01 - -Nlocal: 384 ave 384 max 384 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 7559 ave 7559 max 7559 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 286828 ave 286828 max 286828 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 336304 ave 336304 max 336304 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 336304 -Ave neighs/atom = 875.792 -Neighbor list builds = 5 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:08 diff --git a/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.4 b/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.4 deleted file mode 100644 index 7dc9867f5a..0000000000 --- a/examples/reax/log.4Jan19.reaxc.tatb-shielded.g++.4 +++ /dev/null @@ -1,114 +0,0 @@ -LAMMPS (4 Jan 2019) -# ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, - -units real - -atom_style charge -read_data data.tatb - triclinic box = (0 0 0) to (13.624 17.1149 15.1826) with tilt (-5.75316 -6.32547 7.42573) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 384 atoms - -pair_style reax/c control.reax_c.tatb -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no - -fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc - -thermo 5 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 0.0625 - -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z - -#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -fix 3 all reax/c/species 1 5 5 species.tatb - -run 25 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 5 4 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/shielded, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 113 | 113 | 113 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -44760.998 -44760.998 7827.7866 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6398 0 6391.0277 - 5 0.61603968 -44761.698 -44760.994 8934.6336 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1906 0 6388.6666 - 10 2.3525543 -44763.227 -44760.541 12288.588 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9756 0 6381.7133 - 15 4.9013233 -44766.36 -44760.764 17716.934 -61103.434 489.14722 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2627 0 6370.4289 - 20 7.8294615 -44769.686 -44760.747 25205.586 -61089.006 490.21314 4.7193021 0 1571.7022 20.420943 -260.85565 -1573.7378 253.3539 -654.31623 18816.07 -8703.4958 0 6355.2471 - 25 10.697919 -44772.904 -44760.691 34232.898 -61069.308 490.25887 4.7163736 0 1570.7397 20.181347 -251.91377 -1582.3261 253.82253 -653.53184 18791.975 -8684.3285 0 6336.8093 -Loop time of 4.34178 on 4 procs for 25 steps with 384 atoms - -Performance: 0.031 ns/day, 771.872 hours/ns, 5.758 timesteps/s -96.8% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 3.1756 | 3.1763 | 3.1771 | 0.0 | 73.16 -Neigh | 0.58917 | 0.59661 | 0.6035 | 0.9 | 13.74 -Comm | 0.0088837 | 0.010178 | 0.011116 | 0.8 | 0.23 -Output | 0.00036407 | 0.0019013 | 0.003552 | 2.7 | 0.04 -Modify | 0.54882 | 0.55637 | 0.56413 | 0.8 | 12.81 -Other | | 0.0004123 | | | 0.01 - -Nlocal: 96 ave 96 max 96 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 5118 ave 5118 max 5118 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 79754 ave 79754 max 79754 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 84076 ave 84076 max 84076 min -Histogram: 4 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 336304 -Ave neighs/atom = 875.792 -Neighbor list builds = 5 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:04 diff --git a/examples/reax/log.8March18.reaxc.rdx.g++.1 b/examples/reax/log.8March18.reaxc.rdx.g++.1 deleted file mode 100644 index 4ae10e3f52..0000000000 --- a/examples/reax/log.8March18.reaxc.rdx.g++.1 +++ /dev/null @@ -1,115 +0,0 @@ -LAMMPS (8 Mar 2018) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx - orthogonal box = (35 35 35) to (48 48 48) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - -pair_style reax/c control.reax_c.rdx -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 15.28 | 15.28 | 15.28 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79937 0 168.88402 - 10 1288.6114 -1989.6644 -1912.8422 -19456.35 -2734.6769 -15.607219 0.20177961 0 54.629556 3.1252294 -77.7067 0 14.933901 -5.8108541 843.92074 -180.43322 0 107.75935 - 20 538.95849 -1942.7037 -1910.5731 -10725.658 -2803.7395 7.9078331 0.077926702 0 81.610043 0.22951937 -57.557104 0 30.331203 -10.178049 878.99015 -159.69092 0 89.315159 - 30 463.09542 -1933.5765 -1905.9685 -33255.507 -2749.8591 -8.0154628 0.027628767 0 81.627403 0.11972403 -50.262284 0 20.82032 -9.6327022 851.88722 -149.495 0 79.205731 - 40 885.49449 -1958.9126 -1906.1228 -4814.7123 -2795.644 9.1506221 0.1374749 0 70.948046 0.24360579 -57.8627 0 19.076515 -11.141211 873.73892 -159.9939 0 92.434059 - 50 861.1646 -1954.4599 -1903.1206 -1896.7387 -2784.8446 3.8269113 0.1579328 0 79.851775 3.3492107 -78.066127 0 32.628975 -7.9565255 872.81826 -190.98565 0 114.75994 - 60 1167.785 -1971.8432 -1902.2243 -3482.6975 -2705.8638 -17.121582 0.22749067 0 44.507705 7.856069 -74.788959 0 16.256519 -4.6046602 835.8308 -188.33691 0 114.19414 - 70 1439.9947 -1989.3024 -1903.4554 23845.067 -2890.7896 31.958874 0.26671735 0 85.758608 3.1803486 -71.002907 0 24.357106 -10.311315 905.86799 -175.38482 0 106.79659 - 80 502.40024 -1930.7547 -1900.8035 -20356.557 -2703.8096 -18.663105 0.11286226 0 99.803799 2.0329394 -76.171387 0 19.236609 -6.2786041 826.47358 -166.03157 0 92.539694 - 90 749.09267 -1946.9834 -1902.3254 17798.812 -2863.7586 42.068927 0.24338042 0 96.18195 0.96181754 -69.955528 0 24.61541 -11.58277 903.68895 -190.13838 0 120.69139 - 100 1109.7046 -1968.5875 -1902.4311 -4490.6736 -2755.8953 -7.1235173 0.21757663 0 61.806405 7.0825933 -75.645487 0 20.114745 -6.2371664 863.56285 -198.56939 0 122.09923 -Loop time of 0.395195 on 1 procs for 100 steps with 21 atoms - -Performance: 21.863 ns/day, 1.098 hours/ns, 253.039 timesteps/s -99.3% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.3722 | 0.3722 | 0.3722 | 0.0 | 94.18 -Neigh | 0.0098455 | 0.0098455 | 0.0098455 | 0.0 | 2.49 -Comm | 0.00047445 | 0.00047445 | 0.00047445 | 0.0 | 0.12 -Output | 0.00034022 | 0.00034022 | 0.00034022 | 0.0 | 0.09 -Modify | 0.012187 | 0.012187 | 0.012187 | 0.0 | 3.08 -Other | | 0.0001521 | | | 0.04 - -Nlocal: 21 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.1905 -Neighbor list builds = 10 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:00 diff --git a/examples/reax/log.8March18.reaxc.rdx.g++.4 b/examples/reax/log.8March18.reaxc.rdx.g++.4 deleted file mode 100644 index 6ea4835402..0000000000 --- a/examples/reax/log.8March18.reaxc.rdx.g++.4 +++ /dev/null @@ -1,115 +0,0 @@ -LAMMPS (8 Mar 2018) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx - orthogonal box = (35 35 35) to (48 48 48) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 21 atoms - -pair_style reax/c control.reax_c.rdx -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 10.37 | 11.76 | 13.34 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -1884.3081 -1884.3081 27186.178 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79988 0 168.88453 - 10 1288.6115 -1989.6644 -1912.8422 -19456.354 -2734.6769 -15.60722 0.2017796 0 54.629558 3.1252286 -77.7067 0 14.933902 -5.8108544 843.92073 -180.43321 0 107.75934 - 20 538.95818 -1942.7037 -1910.5731 -10725.623 -2803.7394 7.9078307 0.077926702 0 81.61005 0.22951942 -57.557107 0 30.331206 -10.178049 878.9901 -159.68951 0 89.313749 - 30 463.09514 -1933.5765 -1905.9685 -33255.525 -2749.859 -8.0154737 0.027628797 0 81.627408 0.11972402 -50.262283 0 20.82031 -9.6327021 851.88715 -149.49499 0 79.205724 - 40 885.49412 -1958.9125 -1906.1227 -4814.6606 -2795.6439 9.150622 0.13747487 0 70.948029 0.24360517 -57.862679 0 19.076509 -11.141214 873.7389 -159.99392 0 92.434078 - 50 861.16393 -1954.46 -1903.1207 -1896.7323 -2784.8449 3.8270197 0.1579328 0 79.851743 3.3492115 -78.066132 0 32.628992 -7.9565379 872.81841 -190.98568 0 114.75996 - 60 1167.7846 -1971.8432 -1902.2243 -3482.8111 -2705.8633 -17.121657 0.2274907 0 44.507681 7.8560366 -74.788989 0 16.256493 -4.6046537 835.8305 -188.33687 0 114.1941 - 70 1439.9942 -1989.3023 -1903.4554 23845.444 -2890.7894 31.958784 0.26671721 0 85.758586 3.1803655 -71.002918 0 24.357158 -10.311304 905.86792 -175.38481 0 106.79657 - 80 502.3975 -1930.7546 -1900.8036 -20356.439 -2703.8105 -18.662812 0.11286123 0 99.80391 2.0329293 -76.171334 0 19.236803 -6.2786439 826.47397 -166.03141 0 92.539551 - 90 749.09048 -1946.9837 -1902.3258 17798.718 -2863.7582 42.068719 0.24338057 0 96.181773 0.96183581 -69.955529 0 24.615414 -11.582758 903.68862 -190.1384 0 120.69139 - 100 1109.6999 -1968.5875 -1902.4314 -4490.3728 -2755.8964 -7.1231468 0.21757685 0 61.806149 7.0826648 -75.645428 0 20.115002 -6.2371958 863.56343 -198.56957 0 122.09942 -Loop time of 0.329552 on 4 procs for 100 steps with 21 atoms - -Performance: 26.217 ns/day, 0.915 hours/ns, 303.443 timesteps/s -96.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.26372 | 0.26499 | 0.26754 | 0.3 | 80.41 -Neigh | 0.0045478 | 0.0062494 | 0.0076699 | 1.5 | 1.90 -Comm | 0.0041637 | 0.0064691 | 0.0080271 | 1.8 | 1.96 -Output | 0.00054169 | 0.00056636 | 0.00060368 | 0.0 | 0.17 -Modify | 0.049433 | 0.051134 | 0.05311 | 0.6 | 15.52 -Other | | 0.000141 | | | 0.04 - -Nlocal: 5.25 ave 15 max 0 min -Histogram: 1 0 2 0 0 0 0 0 0 1 -Nghost: 355.5 ave 432 max 282 min -Histogram: 1 0 0 0 1 1 0 0 0 1 -Neighs: 298.75 ave 822 max 0 min -Histogram: 1 0 2 0 0 0 0 0 0 1 - -Total # of neighbors = 1195 -Ave neighs/atom = 56.9048 -Neighbor list builds = 10 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:00 diff --git a/examples/reax/log.8March18.reaxc.tatb.g++.1 b/examples/reax/log.8March18.reaxc.tatb.g++.1 deleted file mode 100644 index ac5537bba4..0000000000 --- a/examples/reax/log.8March18.reaxc.tatb.g++.1 +++ /dev/null @@ -1,113 +0,0 @@ -LAMMPS (8 Mar 2018) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, - -units real - -atom_style charge -read_data data.tatb - triclinic box = (0 0 0) to (13.624 17.1149 15.1826) with tilt (-5.75316 -6.32547 7.42573) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 384 atoms - -pair_style reax/c control.reax_c.tatb -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc - -thermo 5 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 0.0625 - -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z - -#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -fix 3 all reax/c/species 1 5 5 species.tatb - -run 25 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 5 4 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 176.7 | 176.7 | 176.7 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -44760.998 -44760.998 7827.7874 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6395 0 6391.0275 - 5 0.61603968 -44761.698 -44760.994 8934.6347 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1911 0 6388.6671 - 10 2.3525551 -44763.227 -44760.541 12288.583 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9768 0 6381.7146 - 15 4.9013279 -44766.36 -44760.764 17717.01 -61103.434 489.14722 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2375 0 6370.4038 - 20 7.8294645 -44769.686 -44760.747 25205.624 -61089.006 490.21314 4.719302 0 1571.7022 20.420943 -260.85564 -1573.7378 253.3539 -654.31623 18816.07 -8703.4889 0 6355.2402 - 25 10.697904 -44772.904 -44760.691 34232.965 -61069.308 490.25888 4.7163736 0 1570.7397 20.181346 -251.91377 -1582.3261 253.82253 -653.53184 18791.975 -8684.3125 0 6336.7934 -Loop time of 4.72562 on 1 procs for 25 steps with 384 atoms - -Performance: 0.029 ns/day, 840.110 hours/ns, 5.290 timesteps/s -99.4% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 3.775 | 3.775 | 3.775 | 0.0 | 79.88 -Neigh | 0.47047 | 0.47047 | 0.47047 | 0.0 | 9.96 -Comm | 0.0025151 | 0.0025151 | 0.0025151 | 0.0 | 0.05 -Output | 0.0003159 | 0.0003159 | 0.0003159 | 0.0 | 0.01 -Modify | 0.47676 | 0.47676 | 0.47676 | 0.0 | 10.09 -Other | | 0.0005293 | | | 0.01 - -Nlocal: 384 ave 384 max 384 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 7559 ave 7559 max 7559 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 286828 ave 286828 max 286828 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 286828 -Ave neighs/atom = 746.948 -Neighbor list builds = 5 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:05 diff --git a/examples/reax/log.8March18.reaxc.tatb.g++.4 b/examples/reax/log.8March18.reaxc.tatb.g++.4 deleted file mode 100644 index 12558be68a..0000000000 --- a/examples/reax/log.8March18.reaxc.tatb.g++.4 +++ /dev/null @@ -1,113 +0,0 @@ -LAMMPS (8 Mar 2018) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, - -units real - -atom_style charge -read_data data.tatb - triclinic box = (0 0 0) to (13.624 17.1149 15.1826) with tilt (-5.75316 -6.32547 7.42573) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 384 atoms - -pair_style reax/c control.reax_c.tatb -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify delay 0 every 5 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc - -thermo 5 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - -timestep 0.0625 - -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z - -#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -fix 3 all reax/c/species 1 5 5 species.tatb - -run 25 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 5 4 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 118 | 118 | 118 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq - 0 0 -44760.998 -44760.998 7827.7866 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6398 0 6391.0277 - 5 0.61603968 -44761.698 -44760.994 8934.6335 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1906 0 6388.6666 - 10 2.3525544 -44763.227 -44760.541 12288.587 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9764 0 6381.7141 - 15 4.9013311 -44766.36 -44760.764 17716.955 -61103.434 489.14721 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2558 0 6370.4221 - 20 7.8294715 -44769.686 -44760.747 25205.613 -61089.006 490.21314 4.7193021 0 1571.7022 20.420943 -260.85564 -1573.7378 253.3539 -654.31623 18816.07 -8703.4906 0 6355.2419 - 25 10.697924 -44772.904 -44760.691 34232.794 -61069.308 490.25886 4.7163736 0 1570.7397 20.181347 -251.91376 -1582.3261 253.82253 -653.53183 18791.975 -8684.3641 0 6336.8449 -Loop time of 2.84068 on 4 procs for 25 steps with 384 atoms - -Performance: 0.048 ns/day, 505.009 hours/ns, 8.801 timesteps/s -98.4% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.3253 | 2.328 | 2.3305 | 0.2 | 81.95 -Neigh | 0.2589 | 0.26458 | 0.26897 | 0.7 | 9.31 -Comm | 0.0094428 | 0.012062 | 0.014872 | 2.3 | 0.42 -Output | 0.00043392 | 0.0042209 | 0.0054941 | 3.4 | 0.15 -Modify | 0.22563 | 0.23134 | 0.23579 | 0.8 | 8.14 -Other | | 0.0005122 | | | 0.02 - -Nlocal: 96 ave 96 max 96 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 5118 ave 5118 max 5118 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 79754 ave 79754 max 79754 min -Histogram: 4 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 319016 -Ave neighs/atom = 830.771 -Neighbor list builds = 5 -Dangerous builds not checked - -Please see the log.cite file for references relevant to this simulation - -Total wall time: 0:00:03 From f4239530bd886c636d8e6b960318f55a398f2317 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jul 2021 15:58:27 -0400 Subject: [PATCH 075/119] recover virial and nofdotr related changes by @athomps and @akohlmey --- src/ML-IAP/pair_mliap.cpp | 3 +- src/OPENMP/pair_reaxc_omp.cpp | 3 - src/OPENMP/pair_reaxc_omp.h | 28 +++-- src/OPENMP/reaxc_bond_orders_omp.cpp | 123 ++-------------------- src/OPENMP/reaxc_bonds_omp.cpp | 8 +- src/OPENMP/reaxc_forces_omp.cpp | 31 ++---- src/OPENMP/reaxc_hydrogen_bonds_omp.cpp | 60 ++++------- src/OPENMP/reaxc_multi_body_omp.cpp | 12 +-- src/OPENMP/reaxc_nonbonded_omp.cpp | 38 ++----- src/OPENMP/reaxc_torsion_angles_omp.cpp | 99 ++++++------------ src/OPENMP/reaxc_valence_angles_omp.cpp | 32 ++---- src/REAXFF/pair_reaxc.cpp | 3 - src/REAXFF/reaxc_bond_orders.cpp | 129 +++--------------------- src/REAXFF/reaxc_bonds.cpp | 11 +- src/REAXFF/reaxc_control.cpp | 1 - src/REAXFF/reaxc_forces.cpp | 14 +-- src/REAXFF/reaxc_hydrogen_bonds.cpp | 41 ++------ src/REAXFF/reaxc_multi_body.cpp | 12 +-- src/REAXFF/reaxc_nonbonded.cpp | 32 ++---- src/REAXFF/reaxc_torsion_angles.cpp | 92 ++++------------- src/REAXFF/reaxc_valence_angles.cpp | 48 +++------ src/REAXFF/reaxff_api.h | 5 +- src/REAXFF/reaxff_types.h | 1 - src/USER-MISC/pair_drip.cpp | 33 ++---- src/pair.cpp | 58 ++++++----- src/pair.h | 2 +- 26 files changed, 244 insertions(+), 675 deletions(-) diff --git a/src/ML-IAP/pair_mliap.cpp b/src/ML-IAP/pair_mliap.cpp index 0d2a80635a..64c5a547be 100644 --- a/src/ML-IAP/pair_mliap.cpp +++ b/src/ML-IAP/pair_mliap.cpp @@ -264,8 +264,7 @@ void PairMLIAP::e_tally(MLIAPData* data) add virial contribution into global and per-atom accumulators ------------------------------------------------------------------------- */ -void PairMLIAP::v_tally(int i, int j, - double *fij, double *rij) +void PairMLIAP::v_tally(int i, int j, double *fij, double *rij) { double v[6]; diff --git a/src/OPENMP/pair_reaxc_omp.cpp b/src/OPENMP/pair_reaxc_omp.cpp index 87190f5285..2596f8390b 100644 --- a/src/OPENMP/pair_reaxc_omp.cpp +++ b/src/OPENMP/pair_reaxc_omp.cpp @@ -233,9 +233,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) evdwl = ecoul = 0.0; ev_init(eflag,vflag); - if (vflag_global) api->control->virial = 1; - else api->control->virial = 0; - if (vflag_atom) error->all(FLERR,"Pair style reax/c/omp does not support " "computing per-atom stress"); diff --git a/src/OPENMP/pair_reaxc_omp.h b/src/OPENMP/pair_reaxc_omp.h index 895dc646af..d8152656ff 100644 --- a/src/OPENMP/pair_reaxc_omp.h +++ b/src/OPENMP/pair_reaxc_omp.h @@ -47,33 +47,49 @@ class PairReaxCOMP : public PairReaxC, public ThrOMP { reduce_thr(styleparm, eflagparm, vflagparm, thrparm); } - inline void ev_tally_thr_proxy(Pair *const pairparm, const int iparm, const int jparm, + inline void ev_tally_thr_proxy(const int iparm, const int jparm, const int nlocalparm, const int newton_pairparm, const double evdwlparm, const double ecoulparm, const double fpairparm, const double delxparm, const double delyparm, const double delzparm, ThrData *const thrparm) { - ev_tally_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, + ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fpairparm, delxparm, delyparm, delzparm, thrparm); } - inline void ev_tally_xyz_thr_proxy(Pair *const pairparm, const int iparm, const int jparm, + inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm, const int nlocalparm, const int newton_pairparm, const double evdwlparm, const double ecoulparm, const double fxparm, const double fyparm, const double fzparm, const double delxparm, const double delyparm, const double delzparm, ThrData *const thrparm) { - ev_tally_xyz_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, + ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fxparm, fyparm, fzparm, delxparm, delyparm, delzparm, thrparm); } - inline void ev_tally3_thr_proxy(Pair *const pairparm, int i, int j, int k, double evdwl, + inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl, double ecoul, double *fj, double *fk, double *drji, double *drki, ThrData *const thrparm) { - ev_tally3_thr(pairparm, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm); + ev_tally3_thr(this, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm); + } + + inline void v_tally3_thr_proxy(const int i, const int j, const int k, const double *const fi, + const double *const fk, const double *const drij, + const double *const drkj, ThrData *const thrparm) + { + v_tally3_thr(this, i, j, k, fi, fk, drij, drkj, thrparm); + } + + inline void v_tally4_thr_proxy(const int i, const int j, const int k, const int l, + const double *const fi, const double *const fj, + const double *const fk, const double *const dril, + const double *const drjl, const double *const drkl, + ThrData *const thrparm) + { + v_tally4_thr(this, i, j, k, l, fi, fj, fk, dril, drjl, drkl, thrparm); } protected: diff --git a/src/OPENMP/reaxc_bond_orders_omp.cpp b/src/OPENMP/reaxc_bond_orders_omp.cpp index 22d7fe1e6e..9c026ee95c 100644 --- a/src/OPENMP/reaxc_bond_orders_omp.cpp +++ b/src/OPENMP/reaxc_bond_orders_omp.cpp @@ -37,109 +37,6 @@ using namespace LAMMPS_NS; namespace ReaxFF { - void Add_dBond_to_Forces_NPTOMP(reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) { - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - rvec temp; - int pk, k, j; - - int tid = get_tid(); - long reductionOffset = (system->N * tid); - - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); - - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - - - /************************************ - * forces related to atom i * - * first neighbors of atom i * - ************************************/ - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ - rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ - - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - } - - /* then atom i itself */ - rvec_Scale(temp, coef.C1dbo, bo_ij->dBOp); /*1st,dBO*/ - rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); /*2nd,dBO*/ - rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); /*1st,dBO*/ - rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]);/*2nd,dBO*/ - rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ - rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ - rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ - - rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBO_pi2*/ - rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBO_pi2*/ - rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]);/*3rd*/ - - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+i],temp); - - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale(temp, -coef.C3dbo, nbr_k->bo_data.dBOp); /*3rd,dBO*/ - rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ - - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - } - - /* then atom j itself */ - rvec_Scale(temp, -coef.C1dbo, bo_ij->dBOp); /*1st, dBO*/ - rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); /*1st, dBO*/ - rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - - rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ - rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ - rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ - - rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBOpi2*/ - rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBOpi2*/ - rvec_ScaledAdd(temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ - - /* force */ - rvec_Add(workspace->forceReduction[reductionOffset+j],temp); - } - -/* ---------------------------------------------------------------------- */ - void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; @@ -196,11 +93,11 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+i],temp); - if (system->pair_ptr->vflag_atom) { + if (system->pair_ptr->vflag_either) { rvec_Scale(fi_tmp, -1.0, temp); rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,i,j,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(i,j,system->N,0,0,0, fi_tmp[0],fi_tmp[1],fi_tmp[2], delij[0],delij[1],delij[2],thr); } @@ -217,11 +114,11 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+j],temp); - if (system->pair_ptr->vflag_atom) { + if (system->pair_ptr->vflag_either) { rvec_Scale(fj_tmp, -1.0, temp); rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,j,i,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(j,i,system->N,0,0,0, fj_tmp[0],fj_tmp[1],fj_tmp[2], delji[0],delji[1],delji[2],thr); } @@ -236,16 +133,16 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - if (system->pair_ptr->vflag_atom) { + if (system->pair_ptr->vflag_either) { rvec_Scale(fk_tmp, -1.0, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(k,i,system->N,0,0,0, fk_tmp[0],fk_tmp[1],fk_tmp[2], delki[0],delki[1],delki[2],thr); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(k,j,system->N,0,0,0, fk_tmp[0],fk_tmp[1],fk_tmp[2], delkj[0],delkj[1],delkj[2],thr); } @@ -261,17 +158,17 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+k],temp); - if (system->pair_ptr->vflag_atom) { + if (system->pair_ptr->vflag_either) { rvec_Scale(fk_tmp, -1.0, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(k,i,system->N,0,0,0, fk_tmp[0],fk_tmp[1],fk_tmp[2], delki[0],delki[1],delki[2],thr); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, + pair_reax_ptr->ev_tally_xyz_thr_proxy(k,j,system->N,0,0,0, fk_tmp[0],fk_tmp[1],fk_tmp[2], delkj[0],delkj[1],delkj[2],thr); } diff --git a/src/OPENMP/reaxc_bonds_omp.cpp b/src/OPENMP/reaxc_bonds_omp.cpp index 9380aad5af..2357d20690 100644 --- a/src/OPENMP/reaxc_bonds_omp.cpp +++ b/src/OPENMP/reaxc_bonds_omp.cpp @@ -121,8 +121,8 @@ namespace ReaxFF { -twbp->De_pp * bo_ij->BO_pi2; /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr); /* calculate derivatives of Bond Orders */ @@ -152,8 +152,8 @@ namespace ReaxFF { (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); bo_ij->Cdbo += decobdbo; diff --git a/src/OPENMP/reaxc_forces_omp.cpp b/src/OPENMP/reaxc_forces_omp.cpp index 18c9419723..26f36f1357 100644 --- a/src/OPENMP/reaxc_forces_omp.cpp +++ b/src/OPENMP/reaxc_forces_omp.cpp @@ -119,33 +119,16 @@ namespace ReaxFF { } } - if (control->virial == 0) { - #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for (i = 0; i < system->N; ++i) { - const int startj = Start_Index(i, bonds); - const int endj = End_Index(i, bonds); - for (pj = startj; pj < endj; ++pj) - if (i < bonds->select.bond_list[pj].nbr) - Add_dBond_to_ForcesOMP(system, i, pj, workspace, lists); - } - - } else { - -#if defined(_OPENMP) -#pragma omp for schedule(dynamic,50) -#endif - for (i = 0; i < system->N; ++i) { - const int startj = Start_Index(i, bonds); - const int endj = End_Index(i, bonds); - for (pj = startj; pj < endj; ++pj) - if (i < bonds->select.bond_list[pj].nbr) - Add_dBond_to_Forces_NPTOMP(system, i, pj, workspace, lists); - } - - } // if (virial == 0) + for (i = 0; i < system->N; ++i) { + const int startj = Start_Index(i, bonds); + const int endj = End_Index(i, bonds); + for (pj = startj; pj < endj; ++pj) + if (i < bonds->select.bond_list[pj].nbr) + Add_dBond_to_ForcesOMP(system, i, pj, workspace, lists); + } pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, 0, 1, thr); diff --git a/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp b/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp index d3adedd5b1..1b174aef81 100644 --- a/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp @@ -43,7 +43,7 @@ namespace ReaxFF { /* ---------------------------------------------------------------------- */ void Hydrogen_BondsOMP(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, reax_list **lists) + simulation_data *data, storage *workspace, reax_list **lists) { const int nthreads = control->nthreads; @@ -58,11 +58,10 @@ namespace ReaxFF { int hblist[MAX_BONDS]; int itr, top; int num_hb_intrs = 0; - ivec rel_jk; double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, e_hb_thr = 0.0, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force; + rvec dvec_jk; hbond_parameters *hbp; bond_order_data *bo_ij; bond_data *pbond_ij; @@ -119,7 +118,7 @@ namespace ReaxFF { bo_ij = &(pbond_ij->bo_data); if (system->reax_param.sbp[type_i].p_hbond == 2 && - bo_ij->BO >= HB_THRESHOLD) + bo_ij->BO >= HB_THRESHOLD) hblist[top++] = pi; } @@ -145,11 +144,11 @@ namespace ReaxFF { ++num_hb_intrs; Calculate_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &theta, &cos_theta); + &theta, &cos_theta); /* the derivative of cos(theta) */ Calculate_dCos_ThetaOMP(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, - &dcos_theta_di, &dcos_theta_dj, - &dcos_theta_dk); + &dcos_theta_di, &dcos_theta_dj, + &dcos_theta_dk); /* hydrogen bond energy*/ sin_theta2 = sin(theta/2.0); @@ -158,7 +157,7 @@ namespace ReaxFF { cos_xhz1 = (1.0 - cos_theta); exp_hb2 = exp(-hbp->p_hb2 * bo_ij->BO); exp_hb3 = exp(-hbp->p_hb3 * (hbp->r0_hb / r_jk + - r_jk / hbp->r0_hb - 2.0)); + r_jk / hbp->r0_hb - 2.0)); e_hb_thr += e_hb = hbp->p_hb1 * (1.0 - exp_hb2) * exp_hb3 * sin_xhz4; @@ -170,51 +169,28 @@ namespace ReaxFF { /* hydrogen bond forces */ bo_ij->Cdbo += CEhb1; // dbo term - if (control->virial == 0) { - // dcos terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk); - // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk); - } - else { - /* for pressure coupling, terms that are not related to bond order - derivatives are added directly into pressure vector/tensor */ - rvec_Scale(force, +CEhb2, dcos_theta_di); // dcos terms - rvec_Add(workspace->forceReduction[reductionOffset+i], force); - - - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj); - - ivec_Scale(rel_jk, hbond_list[pk].scl, nbr_jk->rel_box); - rvec_Scale(force, +CEhb2, dcos_theta_dk); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - // dr terms - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j],-CEhb3/r_jk, dvec_jk); - - rvec_Scale(force, CEhb3/r_jk, dvec_jk); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - } + // dcos terms + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], +CEhb2, dcos_theta_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], +CEhb2, dcos_theta_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb2, dcos_theta_dk); + // dr terms + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], -CEhb3/r_jk, dvec_jk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], +CEhb3/r_jk, dvec_jk); /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - rvec_ScaledSum(delij, 1., system->my_atoms[j].x, - -1., system->my_atoms[i].x); - rvec_ScaledSum(delkj, 1., system->my_atoms[j].x, - -1., system->my_atoms[k].x); + if (system->pair_ptr->vflag_either || system->pair_ptr->eflag_either) { + rvec_ScaledSum(delij, 1., system->my_atoms[j].x, -1., system->my_atoms[i].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[j].x, -1., system->my_atoms[k].x); rvec_Scale(fi_tmp, CEhb2, dcos_theta_di); rvec_Scale(fk_tmp, CEhb2, dcos_theta_dk); rvec_ScaledAdd(fk_tmp, CEhb3/r_jk, dvec_jk); - pair_reax_ptr->ev_tally3_thr_proxy(system->pair_ptr,i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj,thr); + pair_reax_ptr->ev_tally3_thr_proxy(i,j,k,e_hb,0.0,fi_tmp,fk_tmp,delij,delkj,thr); } } } } - } } #if defined(_OPENMP) diff --git a/src/OPENMP/reaxc_multi_body_omp.cpp b/src/OPENMP/reaxc_multi_body_omp.cpp index 7d338511d6..6b7a7c76f4 100644 --- a/src/OPENMP/reaxc_multi_body_omp.cpp +++ b/src/OPENMP/reaxc_multi_body_omp.cpp @@ -118,8 +118,8 @@ namespace ReaxFF { if (numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( i, i, system->n, 1, e_lp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); /* correction for C2 */ @@ -145,8 +145,8 @@ namespace ReaxFF { workspace->CdDelta[i] += deahu2dsbo; /* tally into per-atom energy */ - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, system->n, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( i, j, system->n, 1, e_lph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); } } @@ -229,10 +229,10 @@ namespace ReaxFF { p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2; /* tally into per-atom energy */ - if (system->pair_ptr->evflag) { + if (system->pair_ptr->eflag_either) { eng_tmp = e_ov; if (numbonds > 0) eng_tmp+= e_un; - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, + pair_reax_ptr->ev_tally_thr_proxy( i, i, system->n, 1, eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); } diff --git a/src/OPENMP/reaxc_nonbonded_omp.cpp b/src/OPENMP/reaxc_nonbonded_omp.cpp index e6feb0b497..595731b005 100644 --- a/src/OPENMP/reaxc_nonbonded_omp.cpp +++ b/src/OPENMP/reaxc_nonbonded_omp.cpp @@ -64,7 +64,6 @@ namespace ReaxFF { double e_ele, e_vdW, e_core; const double SMALL = 0.0001; double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp; two_body_parameters *twbp; far_neighbor_data *nbr_pj; @@ -203,23 +202,14 @@ namespace ReaxFF { rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); f_tmp = -(CEvd + CEclmb); - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, + pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, pe_vdw, e_ele, f_tmp, delij[0], delij[1], delij[2], thr); } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], - +(CEvd + CEclmb), nbr_pj->dvec); - } else { /* NPT, iNPT or sNPT */ - /* for pressure coupling, terms not related to bond order - derivatives are added directly into pressure vector/tensor */ - - rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); - rvec_ScaledAdd(workspace->f[reductionOffset+i], -1., temp); - rvec_Add(workspace->forceReduction[reductionOffset+j], temp); - } + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+j], + +(CEvd + CEclmb), nbr_pj->dvec); } } } @@ -257,7 +247,6 @@ namespace ReaxFF { double e_vdW, e_ele; double CEvd, CEclmb; double f_tmp, delij[3]; - rvec temp; far_neighbor_data *nbr_pj; LR_lookup_table *t; @@ -332,26 +321,17 @@ namespace ReaxFF { CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + if (system->pair_ptr->evflag) { rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); f_tmp = -(CEvd + CEclmb); - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, e_vdW, e_ele, + pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, e_vdW, e_ele, f_tmp, delij[0], delij[1], delij[2], thr); } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); - rvec_ScaledAdd(workspace->forceReduction[froffset+j], - +(CEvd + CEclmb), nbr_pj->dvec); - } else { // NPT, iNPT or sNPT - /* for pressure coupling, terms not related to bond order derivatives - are added directly into pressure vector/tensor */ - rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); - - rvec_ScaledAdd(workspace->f[i], -1., temp); - rvec_Add(workspace->forceReduction[froffset+j], temp); - } + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->forceReduction[froffset+j], + +(CEvd + CEclmb), nbr_pj->dvec); } } } diff --git a/src/OPENMP/reaxc_torsion_angles_omp.cpp b/src/OPENMP/reaxc_torsion_angles_omp.cpp index f3283ef93c..83f49e96de 100644 --- a/src/OPENMP/reaxc_torsion_angles_omp.cpp +++ b/src/OPENMP/reaxc_torsion_angles_omp.cpp @@ -87,8 +87,6 @@ namespace ReaxFF { double CEconj4, CEconj5, CEconj6; double e_tor, e_con; rvec dvec_li; - rvec force; - ivec rel_box_jl; four_body_header *fbh; four_body_parameters *fbp; bond_data *pbond_ij, *pbond_jk, *pbond_kl; @@ -319,72 +317,34 @@ namespace ReaxFF { //bo_kl->Cdbo += (CEtors6 + CEconj3); bo_kl->CdboReduction[tid] += (CEtors6 + CEconj3); - if (control->virial == 0) { - /* dcos_theta_ijk */ - rvec_ScaledAdd(workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], - CEtors7 + CEconj4, p_ijk->dcos_dk); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], - CEtors7 + CEconj4, p_ijk->dcos_di); + /* dcos_theta_ijk */ + rvec_ScaledAdd(workspace->f[j], + CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], + CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors7 + CEconj4, p_ijk->dcos_di); - /* dcos_theta_jkl */ - rvec_ScaledAdd(workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], - CEtors8 + CEconj5, p_jkl->dcos_dj); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], - CEtors8 + CEconj5, p_jkl->dcos_dk); + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], + CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], + CEtors8 + CEconj5, p_jkl->dcos_dk); - /* dcos_omega */ - rvec_ScaledAdd(workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], - CEtors9 + CEconj6, dcos_omega_di); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], - CEtors9 + CEconj6, dcos_omega_dk); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], - CEtors9 + CEconj6, dcos_omega_dl); - } - else { - ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); - - /* dcos_theta_ijk */ - rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_dk); - rvec_Add(workspace->forceReduction[reductionOffset+i], force); - - rvec_ScaledAdd(workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj); - - rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_di); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - - /* dcos_theta_jkl */ - rvec_ScaledAdd(workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di); - - rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dj); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - - rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dk); - rvec_Add(workspace->forceReduction[reductionOffset+l], force); - - /* dcos_omega */ - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_di); - rvec_Add(workspace->forceReduction[reductionOffset+i], force); - - rvec_ScaledAdd(workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj); - - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dk); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dl); - rvec_Add(workspace->forceReduction[reductionOffset+i], force); - } + /* dcos_omega */ + rvec_ScaledAdd(workspace->f[j], + CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], + CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], + CEtors9 + CEconj6, dcos_omega_dk); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+l], + CEtors9 + CEconj6, dcos_omega_dl); /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + if (system->pair_ptr->evflag) { // acquire vectors rvec_ScaledSum(delil, 1., system->my_atoms[l].x, @@ -410,14 +370,13 @@ namespace ReaxFF { // tally eng_tmp = e_tor + e_con; - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, k, system->n, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( j, k, system->n, 1, eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - // NEED TO MAKE AN OMP VERSION OF THIS CALL! - if (system->pair_ptr->vflag_atom) - system->pair_ptr->v_tally4(i, j, k, l, fi_tmp, fj_tmp, fk_tmp, - delil, deljl, delkl); + if (system->pair_ptr->vflag_either) + pair_reax_ptr->v_tally4_thr_proxy(i, j, k, l, fi_tmp, fj_tmp, fk_tmp, + delil, deljl, delkl, thr); } } // pl check ends diff --git a/src/OPENMP/reaxc_valence_angles_omp.cpp b/src/OPENMP/reaxc_valence_angles_omp.cpp index 5785e3c966..ed457c96fe 100644 --- a/src/OPENMP/reaxc_valence_angles_omp.cpp +++ b/src/OPENMP/reaxc_valence_angles_omp.cpp @@ -140,7 +140,6 @@ namespace ReaxFF { double f7_ij, f7_jk, f8_Dj, f9_Dj; double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; double BOA_ij, BOA_jk; - rvec force; // Tallying variables double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; @@ -519,26 +518,12 @@ namespace ReaxFF { bo_jt->Cdbopi2 += CEval5; } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], - CEval8, p_ijk->dcos_di); - rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], - CEval8, p_ijk->dcos_dk); - } else { - /* terms not related to bond order derivatives are - added directly into forces and pressure vector/tensor */ - rvec_Scale(force, CEval8, p_ijk->dcos_di); - rvec_Add(workspace->forceReduction[reductionOffset+i], force); - - rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - - rvec_Scale(force, CEval8, p_ijk->dcos_dk); - rvec_Add(workspace->forceReduction[reductionOffset+k], force); - } + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+i], CEval8, p_ijk->dcos_di); + rvec_ScaledAdd(workspace->forceReduction[reductionOffset+k], CEval8, p_ijk->dcos_dk); /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + if (system->pair_ptr->evflag) { /* Acquire vectors */ rvec_ScaledSum(delij, 1., system->my_atoms[i].x, @@ -552,12 +537,11 @@ namespace ReaxFF { eng_tmp = e_ang + e_pen + e_coa; - if (system->pair_ptr->evflag) - pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, j, system->N, 1, + if (system->pair_ptr->eflag_either) + pair_reax_ptr->ev_tally_thr_proxy( j, j, system->N, 1, eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); - if (system->pair_ptr->vflag_atom) - // NEED TO MAKE AN OMP VERSION OF THIS CALL! - system->pair_ptr->v_tally3(i, j, k, fi_tmp, fk_tmp, delij, delkj); + if (system->pair_ptr->vflag_either) + pair_reax_ptr->v_tally3_thr_proxy(i, j, k, fi_tmp, fk_tmp, delij, delkj, thr); } } // if (p_val1>0.001) diff --git a/src/REAXFF/pair_reaxc.cpp b/src/REAXFF/pair_reaxc.cpp index 3b1d09a002..389b7d9e13 100644 --- a/src/REAXFF/pair_reaxc.cpp +++ b/src/REAXFF/pair_reaxc.cpp @@ -464,9 +464,6 @@ void PairReaxC::compute(int eflag, int vflag) evdwl = ecoul = 0.0; ev_init(eflag,vflag); - if (vflag_global) api->control->virial = 1; - else api->control->virial = 0; - api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts api->system->bigN = static_cast (atom->natoms); // all atoms in the system diff --git a/src/REAXFF/reaxc_bond_orders.cpp b/src/REAXFF/reaxc_bond_orders.cpp index 3866c61110..0e4227922b 100644 --- a/src/REAXFF/reaxc_bond_orders.cpp +++ b/src/REAXFF/reaxc_bond_orders.cpp @@ -33,106 +33,7 @@ #include namespace ReaxFF { - void Add_dBond_to_Forces_NPT(int i, int pj, storage *workspace, reax_list **lists) - { - reax_list *bonds = (*lists) + BONDS; - bond_data *nbr_j, *nbr_k; - bond_order_data *bo_ij, *bo_ji; - dbond_coefficients coef; - rvec temp; - int pk, k, j; - - /* Initializations */ - nbr_j = &(bonds->select.bond_list[pj]); - j = nbr_j->nbr; - bo_ij = &(nbr_j->bo_data); - bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); - - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - - - /************************************ - * forces related to atom i * - * first neighbors of atom i * - ************************************/ - for (pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale(temp, -coef.C2dbo, nbr_k->bo_data.dBOp); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); /*3rd, dBOpi*/ - rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp);/*3rd, dBOpi2*/ - - /* force */ - rvec_Add(workspace->f[k], temp); - } - - /* then atom i itself */ - rvec_Scale(temp, coef.C1dbo, bo_ij->dBOp); /*1st,dBO*/ - rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); /*2nd,dBO*/ - rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); /*1st,dBO*/ - rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]);/*2nd,dBO*/ - rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ - rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ - rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]);/*3rd,dBOpi*/ - - rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBO_pi2*/ - rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBO_pi2*/ - rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]);/*3rd*/ - - /* force */ - rvec_Add(workspace->f[i], temp); - - for (pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk) { - nbr_k = &(bonds->select.bond_list[pk]); - k = nbr_k->nbr; - - rvec_Scale(temp, -coef.C3dbo, nbr_k->bo_data.dBOp); /*3rd,dBO*/ - rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);/*dDelta*/ - rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); /*4th,dBOpi*/ - rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp);/*4th,dBOpi2*/ - - /* force */ - rvec_Add(workspace->f[k], temp); - } - - /* then atom j itself */ - rvec_Scale(temp, -coef.C1dbo, bo_ij->dBOp); /*1st, dBO*/ - rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); /*2nd, dBO*/ - rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); /*1st, dBO*/ - rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]);/*2nd, dBO*/ - - rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); /*1st,dBOpi*/ - rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); /*2nd,dBOpi*/ - rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]);/*3rd,dBOpi*/ - - rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); /*1st,dBOpi2*/ - rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); /*2nd,dBOpi2*/ - rvec_ScaledAdd(temp,coef.C4dbopi2,workspace->dDeltap_self[j]);/*3rd,dBOpi2*/ - - /* force */ - rvec_Add(workspace->f[j], temp); - } - - void Add_dBond_to_Forces(reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) + void Add_dBond_to_Forces(reax_system *system, int i, int pj, storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; @@ -180,10 +81,10 @@ namespace ReaxFF { rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]); rvec_Add(workspace->f[i], temp); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fi_tmp, -1.0, temp); + if (system->pair_ptr->vflag_either) { + rvec_Scale(fi_tmp, -0.5, temp); rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); - system->pair_ptr->v_tally(i,fi_tmp,delij); + system->pair_ptr->v_tally2_newton(i,fi_tmp,delij); } // forces on j @@ -199,10 +100,10 @@ namespace ReaxFF { rvec_ScaledAdd(temp, coef.C4dbopi2, workspace->dDeltap_self[j]); rvec_Add(workspace->f[j], temp); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fj_tmp, -1.0, temp); + if (system->pair_ptr->vflag_either) { + rvec_Scale(fj_tmp, -0.5, temp); rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); - system->pair_ptr->v_tally(j,fj_tmp,delji); + system->pair_ptr->v_tally2_newton(j,fj_tmp,delji); } // forces on k: i neighbor @@ -216,12 +117,12 @@ namespace ReaxFF { rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); rvec_Add(workspace->f[k], temp); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); + if (system->pair_ptr->vflag_either) { + rvec_Scale(fk_tmp, -0.5, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - system->pair_ptr->v_tally(k,fk_tmp,delki); + system->pair_ptr->v_tally2_newton(k,fk_tmp,delki); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - system->pair_ptr->v_tally(k,fk_tmp,delkj); + system->pair_ptr->v_tally2_newton(k,fk_tmp,delkj); } } @@ -236,12 +137,12 @@ namespace ReaxFF { rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); rvec_Add(workspace->f[k], temp); - if (system->pair_ptr->vflag_atom) { - rvec_Scale(fk_tmp, -1.0, temp); + if (system->pair_ptr->vflag_either) { + rvec_Scale(fk_tmp, -0.5, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - system->pair_ptr->v_tally(k,fk_tmp,delki); + system->pair_ptr->v_tally2_newton(k,fk_tmp,delki); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - system->pair_ptr->v_tally(k,fk_tmp,delkj); + system->pair_ptr->v_tally2_newton(k,fk_tmp,delkj); } } } diff --git a/src/REAXFF/reaxc_bonds.cpp b/src/REAXFF/reaxc_bonds.cpp index 2c83ce8144..7feea043fa 100644 --- a/src/REAXFF/reaxc_bonds.cpp +++ b/src/REAXFF/reaxc_bonds.cpp @@ -32,8 +32,7 @@ #include namespace ReaxFF { - void Bonds(reax_system *system, simulation_data *data, - storage *workspace, reax_list **lists) + void Bonds(reax_system *system, simulation_data *data, storage *workspace, reax_list **lists) { int i, j, pj, natoms; int start_i, end_i; @@ -94,8 +93,8 @@ namespace ReaxFF { -twbp->De_p * bo_ij->BO_pi -twbp->De_pp * bo_ij->BO_pi2; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(i,j,natoms,1,ebond,0.0,0.0,0.0,0.0,0.0); /* calculate derivatives of Bond Orders */ @@ -124,8 +123,8 @@ namespace ReaxFF { decobdboub = -gp10 * exphu * hulpov * (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(i,j,natoms,1,estriph,0.0,0.0,0.0,0.0,0.0); bo_ij->Cdbo += decobdbo; diff --git a/src/REAXFF/reaxc_control.cpp b/src/REAXFF/reaxc_control.cpp index 97fd65df9d..c84c3afe9d 100644 --- a/src/REAXFF/reaxc_control.cpp +++ b/src/REAXFF/reaxc_control.cpp @@ -71,7 +71,6 @@ namespace ReaxFF { /* assign default values */ control->nthreads = 1; control->tabulate = 0; - control->virial = 0; control->bond_cut = 5.0; control->bg_cut = 0.3; control->thb_cut = 0.001; diff --git a/src/REAXFF/reaxc_forces.cpp b/src/REAXFF/reaxc_forces.cpp index 5bb0dcca88..ec783102b4 100644 --- a/src/REAXFF/reaxc_forces.cpp +++ b/src/REAXFF/reaxc_forces.cpp @@ -47,7 +47,7 @@ namespace ReaxFF { Valence_Angles(system, control, data, workspace, lists); Torsion_Angles(system, control, data, workspace, lists); if (control->hbond_cut > 0) - Hydrogen_Bonds(system, control, data, workspace, lists); + Hydrogen_Bonds(system, data, workspace, lists); } static void Compute_NonBonded_Forces(reax_system *system, @@ -64,21 +64,15 @@ namespace ReaxFF { Tabulated_vdW_Coulomb_Energy(system, control, data, workspace, lists); } - static void Compute_Total_Force(reax_system *system, control_params *control, - storage *workspace, reax_list **lists) + static void Compute_Total_Force(reax_system *system, storage *workspace, reax_list **lists) { int i, pj; reax_list *bonds = (*lists) + BONDS; for (i = 0; i < system->N; ++i) for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) - if (i < bonds->select.bond_list[pj].nbr) { - if (control->virial == 0) + if (i < bonds->select.bond_list[pj].nbr) Add_dBond_to_Forces(system, i, pj, workspace, lists); - else - Add_dBond_to_Forces_NPT(i, pj, workspace, lists); - } - } static void Validate_Lists(reax_system *system, reax_list **lists, @@ -387,6 +381,6 @@ namespace ReaxFF { Compute_NonBonded_Forces(system, control, data, workspace, lists); /*********** total force ***************/ - Compute_Total_Force(system, control, workspace, lists); + Compute_Total_Force(system, workspace, lists); } } diff --git a/src/REAXFF/reaxc_hydrogen_bonds.cpp b/src/REAXFF/reaxc_hydrogen_bonds.cpp index 3072968d58..5c7629ffb7 100644 --- a/src/REAXFF/reaxc_hydrogen_bonds.cpp +++ b/src/REAXFF/reaxc_hydrogen_bonds.cpp @@ -32,9 +32,7 @@ #include "pair.h" namespace ReaxFF { - void Hydrogen_Bonds(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists) + void Hydrogen_Bonds(reax_system *system, simulation_data *data, storage *workspace, reax_list **lists) { int i, j, k, pi, pk; int type_i, type_j, type_k; @@ -42,11 +40,10 @@ namespace ReaxFF { int hblist[MAX_BONDS]; int itr, top; int num_hb_intrs = 0; - ivec rel_jk; double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; - rvec dvec_jk, force; + rvec dvec_jk; hbond_parameters *hbp; bond_order_data *bo_ij; bond_data *pbond_ij; @@ -134,34 +131,16 @@ namespace ReaxFF { /* hydrogen bond forces */ bo_ij->Cdbo += CEhb1; // dbo term - if (control->virial == 0) { - // dcos terms - rvec_ScaledAdd(workspace->f[i], +CEhb2, dcos_theta_di); - rvec_ScaledAdd(workspace->f[j], +CEhb2, dcos_theta_dj); - rvec_ScaledAdd(workspace->f[k], +CEhb2, dcos_theta_dk); - // dr terms - rvec_ScaledAdd(workspace->f[j], -CEhb3/r_jk, dvec_jk); - rvec_ScaledAdd(workspace->f[k], +CEhb3/r_jk, dvec_jk); - } - else { - rvec_Scale(force, +CEhb2, dcos_theta_di); // dcos terms - rvec_Add(workspace->f[i], force); - - rvec_ScaledAdd(workspace->f[j], +CEhb2, dcos_theta_dj); - - ivec_Scale(rel_jk, hbond_list[pk].scl, nbr_jk->rel_box); - rvec_Scale(force, +CEhb2, dcos_theta_dk); - rvec_Add(workspace->f[k], force); - - // dr terms - rvec_ScaledAdd(workspace->f[j], -CEhb3/r_jk, dvec_jk); - - rvec_Scale(force, CEhb3/r_jk, dvec_jk); - rvec_Add(workspace->f[k], force); - } + // dcos terms + rvec_ScaledAdd(workspace->f[i], +CEhb2, dcos_theta_di); + rvec_ScaledAdd(workspace->f[j], +CEhb2, dcos_theta_dj); + rvec_ScaledAdd(workspace->f[k], +CEhb2, dcos_theta_dk); + // dr terms + rvec_ScaledAdd(workspace->f[j], -CEhb3/r_jk, dvec_jk); + rvec_ScaledAdd(workspace->f[k], +CEhb3/r_jk, dvec_jk); /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + if (system->pair_ptr->evflag) { rvec_ScaledSum(delij, 1., system->my_atoms[j].x, -1., system->my_atoms[i].x); rvec_ScaledSum(delkj, 1., system->my_atoms[j].x, diff --git a/src/REAXFF/reaxc_multi_body.cpp b/src/REAXFF/reaxc_multi_body.cpp index bd1a5ccaa6..2390b54474 100644 --- a/src/REAXFF/reaxc_multi_body.cpp +++ b/src/REAXFF/reaxc_multi_body.cpp @@ -93,8 +93,8 @@ namespace ReaxFF { if (numbonds > 0 || control->enobondsflag) workspace->CdDelta[i] += CElp; // lp - 1st term - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(i,i,system->n,1,e_lp,0.0,0.0,0.0,0.0,0.0); /* correction for C2 */ @@ -119,8 +119,8 @@ namespace ReaxFF { bo_ij->Cdbo += deahu2dbo; workspace->CdDelta[i] += deahu2dsbo; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(i,j,system->n,1,e_lph,0.0,0.0,0.0,0.0,0.0); } @@ -202,8 +202,8 @@ namespace ReaxFF { CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) * p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) { + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) { eng_tmp = e_ov; if (numbonds > 0 || control->enobondsflag) eng_tmp += e_un; diff --git a/src/REAXFF/reaxc_nonbonded.cpp b/src/REAXFF/reaxc_nonbonded.cpp index e86ffe3a8b..8a1e41da29 100644 --- a/src/REAXFF/reaxc_nonbonded.cpp +++ b/src/REAXFF/reaxc_nonbonded.cpp @@ -47,8 +47,8 @@ namespace ReaxFF { (system->reax_param.sbp[type_i].eta / 2.) * SQR(q)); data->my_en.e_pol += en_tmp; - /* tally into per-atom energy */ - if (system->pair_ptr->evflag) + /* tally energy into global or per-atom energy accumulators */ + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(i,i,system->n,1,0.0,en_tmp,0.0,0.0,0.0,0.0); } } @@ -67,7 +67,6 @@ namespace ReaxFF { double dr3gamij_1, dr3gamij_3; double e_ele, e_vdW, e_core, SMALL = 0.0001; double e_lg, de_lg, r_ij5, r_ij6, re6; - rvec temp; two_body_parameters *twbp; far_neighbor_data *nbr_pj; reax_list *far_nbrs; @@ -193,7 +192,7 @@ namespace ReaxFF { (dTap - Tap * r_ij / dr3gamij_1) / dr3gamij_3; /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + if (system->pair_ptr->evflag) { pe_vdw = Tap * (e_vdW + e_core + e_lg); rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); @@ -202,15 +201,8 @@ namespace ReaxFF { f_tmp,delij[0],delij[1],delij[2]); } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); - rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); - } else { /* NPT, iNPT or sNPT */ - rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); - - rvec_ScaledAdd(workspace->f[i], -1., temp); - rvec_Add(workspace->f[j], temp); - } + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); } } } @@ -231,7 +223,6 @@ namespace ReaxFF { double CEvd, CEclmb, SMALL = 0.0001; double f_tmp, delij[3]; - rvec temp; far_neighbor_data *nbr_pj; reax_list *far_nbrs; LR_lookup_table *t; @@ -301,7 +292,7 @@ namespace ReaxFF { CEclmb *= system->my_atoms[i].q * system->my_atoms[j].q; /* tally into per-atom energy */ - if (system->pair_ptr->evflag || system->pair_ptr->vflag_atom) { + if (system->pair_ptr->evflag) { rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); f_tmp = -(CEvd + CEclmb); @@ -309,15 +300,8 @@ namespace ReaxFF { f_tmp,delij[0],delij[1],delij[2]); } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); - rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); - } else { // NPT, iNPT or sNPT - rvec_Scale(temp, CEvd + CEclmb, nbr_pj->dvec); - - rvec_ScaledAdd(workspace->f[i], -1., temp); - rvec_Add(workspace->f[j], temp); - } + rvec_ScaledAdd(workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec); + rvec_ScaledAdd(workspace->f[j], +(CEvd + CEclmb), nbr_pj->dvec); } } } diff --git a/src/REAXFF/reaxc_torsion_angles.cpp b/src/REAXFF/reaxc_torsion_angles.cpp index adbb6ffc06..329f7b8a7a 100644 --- a/src/REAXFF/reaxc_torsion_angles.cpp +++ b/src/REAXFF/reaxc_torsion_angles.cpp @@ -144,8 +144,6 @@ namespace ReaxFF { double CEconj4, CEconj5, CEconj6; double e_tor, e_con; rvec dvec_li; - rvec force; - ivec rel_box_jl; four_body_header *fbh; four_body_parameters *fbp; bond_data *pbond_ij, *pbond_jk, *pbond_kl; @@ -351,81 +349,29 @@ namespace ReaxFF { bo_jk->Cdbo += (CEtors5 + CEconj2); bo_kl->Cdbo += (CEtors6 + CEconj3); - if (control->virial == 0) { - /* dcos_theta_ijk */ - rvec_ScaledAdd(workspace->f[i], - CEtors7 + CEconj4, p_ijk->dcos_dk); - rvec_ScaledAdd(workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj); - rvec_ScaledAdd(workspace->f[k], - CEtors7 + CEconj4, p_ijk->dcos_di); + /* dcos_theta_ijk */ + rvec_ScaledAdd(workspace->f[i], CEtors7 + CEconj4, p_ijk->dcos_dk); + rvec_ScaledAdd(workspace->f[j], CEtors7 + CEconj4, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->f[k], CEtors7 + CEconj4, p_ijk->dcos_di); - /* dcos_theta_jkl */ - rvec_ScaledAdd(workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di); - rvec_ScaledAdd(workspace->f[k], - CEtors8 + CEconj5, p_jkl->dcos_dj); - rvec_ScaledAdd(workspace->f[l], - CEtors8 + CEconj5, p_jkl->dcos_dk); + /* dcos_theta_jkl */ + rvec_ScaledAdd(workspace->f[j], CEtors8 + CEconj5, p_jkl->dcos_di); + rvec_ScaledAdd(workspace->f[k], CEtors8 + CEconj5, p_jkl->dcos_dj); + rvec_ScaledAdd(workspace->f[l], CEtors8 + CEconj5, p_jkl->dcos_dk); - /* dcos_omega */ - rvec_ScaledAdd(workspace->f[i], - CEtors9 + CEconj6, dcos_omega_di); - rvec_ScaledAdd(workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj); - rvec_ScaledAdd(workspace->f[k], - CEtors9 + CEconj6, dcos_omega_dk); - rvec_ScaledAdd(workspace->f[l], - CEtors9 + CEconj6, dcos_omega_dl); - } - else { - ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); - - /* dcos_theta_ijk */ - rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_dk); - rvec_Add(workspace->f[i], force); - - rvec_ScaledAdd(workspace->f[j], - CEtors7 + CEconj4, p_ijk->dcos_dj); - - rvec_Scale(force, CEtors7 + CEconj4, p_ijk->dcos_di); - rvec_Add(workspace->f[k], force); - - /* dcos_theta_jkl */ - rvec_ScaledAdd(workspace->f[j], - CEtors8 + CEconj5, p_jkl->dcos_di); - - rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dj); - rvec_Add(workspace->f[k], force); - - rvec_Scale(force, CEtors8 + CEconj5, p_jkl->dcos_dk); - rvec_Add(workspace->f[l], force); - - - /* dcos_omega */ - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_di); - rvec_Add(workspace->f[i], force); - - rvec_ScaledAdd(workspace->f[j], - CEtors9 + CEconj6, dcos_omega_dj); - - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dk); - rvec_Add(workspace->f[k], force); - - rvec_Scale(force, CEtors9 + CEconj6, dcos_omega_dl); - rvec_Add(workspace->f[l], force); - } + /* dcos_omega */ + rvec_ScaledAdd(workspace->f[i], CEtors9 + CEconj6, dcos_omega_di); + rvec_ScaledAdd(workspace->f[j], CEtors9 + CEconj6, dcos_omega_dj); + rvec_ScaledAdd(workspace->f[k], CEtors9 + CEconj6, dcos_omega_dk); + rvec_ScaledAdd(workspace->f[l], CEtors9 + CEconj6, dcos_omega_dl); /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { + if (system->pair_ptr->evflag) { // acquire vectors - rvec_ScaledSum(delil, 1., system->my_atoms[l].x, - -1., system->my_atoms[i].x); - rvec_ScaledSum(deljl, 1., system->my_atoms[l].x, - -1., system->my_atoms[j].x); - rvec_ScaledSum(delkl, 1., system->my_atoms[l].x, - -1., system->my_atoms[k].x); + rvec_ScaledSum(delil, 1., system->my_atoms[l].x, -1., system->my_atoms[i].x); + rvec_ScaledSum(deljl, 1., system->my_atoms[l].x, -1., system->my_atoms[j].x); + rvec_ScaledSum(delkl, 1., system->my_atoms[l].x, -1., system->my_atoms[k].x); // dcos_theta_ijk rvec_Scale(fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk); rvec_Scale(fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj); @@ -442,9 +388,9 @@ namespace ReaxFF { // tally eng_tmp = e_tor + e_con; - if (system->pair_ptr->evflag) + if (system->pair_ptr->eflag_either) system->pair_ptr->ev_tally(j,k,natoms,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); - if (system->pair_ptr->vflag_atom) + if (system->pair_ptr->vflag_either) system->pair_ptr->v_tally4(i,j,k,l,fi_tmp,fj_tmp,fk_tmp,delil,deljl,delkl); } } // pl check ends diff --git a/src/REAXFF/reaxc_valence_angles.cpp b/src/REAXFF/reaxc_valence_angles.cpp index 6f609646e3..5f75b6637d 100644 --- a/src/REAXFF/reaxc_valence_angles.cpp +++ b/src/REAXFF/reaxc_valence_angles.cpp @@ -67,9 +67,8 @@ namespace ReaxFF { } - void Valence_Angles(reax_system *system, control_params *control, - simulation_data *data, storage *workspace, - reax_list **lists) + void Valence_Angles(reax_system *system, control_params *control, simulation_data *data, + storage *workspace, reax_list **lists) { int i, j, pi, k, pk, t; int type_i, type_j, type_k; @@ -92,7 +91,6 @@ namespace ReaxFF { double f7_ij, f7_jk, f8_Dj, f9_Dj; double Ctheta_0, theta_0, theta_00, theta, cos_theta, sin_theta; double BOA_ij, BOA_jk; - rvec force; // Tallying variables double eng_tmp, fi_tmp[3], fj_tmp[3], fk_tmp[3]; @@ -114,7 +112,7 @@ namespace ReaxFF { num_thb_intrs = 0; - for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N + for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; start_j = Start_Index(j, bonds); @@ -218,7 +216,6 @@ namespace ReaxFF { ++num_thb_intrs; - if ((j < system->n) && (BOA_jk > 0.0) && (bo_ij->BO > control->thb_cut) && (bo_jk->BO > control->thb_cut) && @@ -347,39 +344,26 @@ namespace ReaxFF { bo_jt->Cdbopi2 += CEval5; } - if (control->virial == 0) { - rvec_ScaledAdd(workspace->f[i], CEval8, p_ijk->dcos_di); - rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - rvec_ScaledAdd(workspace->f[k], CEval8, p_ijk->dcos_dk); - } else { - rvec_Scale(force, CEval8, p_ijk->dcos_di); - rvec_Add(workspace->f[i], force); + rvec_ScaledAdd(workspace->f[i], CEval8, p_ijk->dcos_di); + rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); + rvec_ScaledAdd(workspace->f[k], CEval8, p_ijk->dcos_dk); - rvec_ScaledAdd(workspace->f[j], CEval8, p_ijk->dcos_dj); - - rvec_Scale(force, CEval8, p_ijk->dcos_dk); - rvec_Add(workspace->f[k], force); + /* tally energy */ + if (system->pair_ptr->eflag_either) { + eng_tmp = e_ang + e_pen + e_coa; + system->pair_ptr->ev_tally(j,j,system->N,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); } - /* tally into per-atom virials */ - if (system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { - + /* tally virial */ + if (system->pair_ptr->vflag_either) { + /* Acquire vectors */ - rvec_ScaledSum(delij, 1., system->my_atoms[i].x, - -1., system->my_atoms[j].x); - rvec_ScaledSum(delkj, 1., system->my_atoms[k].x, - -1., system->my_atoms[j].x); - + rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); + rvec_ScaledSum(delkj, 1., system->my_atoms[k].x, -1., system->my_atoms[j].x); rvec_Scale(fi_tmp, -CEval8, p_ijk->dcos_di); rvec_Scale(fj_tmp, -CEval8, p_ijk->dcos_dj); rvec_Scale(fk_tmp, -CEval8, p_ijk->dcos_dk); - - eng_tmp = e_ang + e_pen + e_coa; - - if (system->pair_ptr->evflag) - system->pair_ptr->ev_tally(j,j,system->N,1,eng_tmp,0.0,0.0,0.0,0.0,0.0); - if (system->pair_ptr->vflag_atom) - system->pair_ptr->v_tally3(i,j,k,fi_tmp,fk_tmp,delij,delkj); + system->pair_ptr->v_tally3(i,j,k,fi_tmp,fk_tmp,delij,delkj); } } } diff --git a/src/REAXFF/reaxff_api.h b/src/REAXFF/reaxff_api.h index 96febe70f9..6179da9c72 100644 --- a/src/REAXFF/reaxff_api.h +++ b/src/REAXFF/reaxff_api.h @@ -54,7 +54,6 @@ namespace ReaxFF single_body_parameters *, single_body_parameters *, two_body_parameters *); extern void Add_dBond_to_Forces(reax_system*, int, int, storage*, reax_list**); - extern void Add_dBond_to_Forces_NPT(int, int, storage*, reax_list**); // bonds @@ -78,8 +77,8 @@ namespace ReaxFF // hydrogen bonds - extern void Hydrogen_Bonds(reax_system *, control_params *, - simulation_data *, storage *, reax_list **); + extern void Hydrogen_Bonds(reax_system *, simulation_data *, storage *, reax_list **); + // init md extern void Init_System(reax_system *, control_params *); diff --git a/src/REAXFF/reaxff_types.h b/src/REAXFF/reaxff_types.h index c88e0f5a6a..aec48072df 100644 --- a/src/REAXFF/reaxff_types.h +++ b/src/REAXFF/reaxff_types.h @@ -240,7 +240,6 @@ namespace ReaxFF double thb_cutsq; int tabulate; - int virial; int lgflag; int enobondsflag; diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 97f5ca439e..a59d74bab9 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -366,10 +366,7 @@ void PairDRIP::compute(int eflag, int vflag) f[j][0] += fj[0]; f[j][1] += fj[1]; f[j][2] += fj[2]; - - // multiply 2 since v_tally has a 0.5 coeff - fj[0] *= 2; fj[1] *= 2; fj[2] *= 2; - if (vflag_atom) v_tally(j, fj, x[j]); + if (vflag_either) v_tally2_newton(j, fj, x[j]); } } //loop over jj @@ -377,10 +374,7 @@ void PairDRIP::compute(int eflag, int vflag) f[i][0] += fi[0]; f[i][1] += fi[1]; f[i][2] += fi[2]; - - // multiply 2 since v_tally has a 0.5 coeff - fi[0] *= 2; fi[1] *= 2; fi[2] *= 2; - if (vflag_atom) v_tally(i, fi, x[i]); + if (vflag_either) v_tally2_newton(i, fi, x[i]); } // loop over ii @@ -529,22 +523,13 @@ double PairDRIP::calc_repulsive(int const i, int const j, Param& p, f[nbj3][k] += fnbj3[k]; } - if (vflag_atom) { - // multiply since v_tally has a 0.5 coeff - for (int k = 0; k < DIM; k++) { - fnbi1[k] *= 2; - fnbi2[k] *= 2; - fnbi3[k] *= 2; - fnbj1[k] *= 2; - fnbj2[k] *= 2; - fnbj3[k] *= 2; - } - v_tally(nbi1, fnbi1, x[nbi1]); - v_tally(nbi2, fnbi2, x[nbi2]); - v_tally(nbi3, fnbi3, x[nbi3]); - v_tally(nbj1, fnbj1, x[nbj1]); - v_tally(nbj2, fnbj2, x[nbj2]); - v_tally(nbj3, fnbj3, x[nbj3]); + if (vflag_either) { + v_tally2_newton(nbi1, fnbi1, x[nbi1]); + v_tally2_newton(nbi2, fnbi2, x[nbi2]); + v_tally2_newton(nbi3, fnbi3, x[nbi3]); + v_tally2_newton(nbj1, fnbj1, x[nbj1]); + v_tally2_newton(nbj2, fnbj2, x[nbj2]); + v_tally2_newton(nbj3, fnbj3, x[nbj3]); } return phi; diff --git a/src/pair.cpp b/src/pair.cpp index 5e8c666743..bc8cb2ecd1 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -991,7 +991,7 @@ void Pair::ev_unset() } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators need i < nlocal test since called by bond_quartic and dihedral_charmm ------------------------------------------------------------------------- */ @@ -1092,7 +1092,7 @@ void Pair::ev_tally(int i, int j, int nlocal, int newton_pair, } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators can use this version with full neighbor lists ------------------------------------------------------------------------- */ @@ -1138,7 +1138,7 @@ void Pair::ev_tally_full(int i, double evdwl, double ecoul, double fpair, } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators for virial, have delx,dely,delz and fx,fy,fz ------------------------------------------------------------------------- */ @@ -1232,7 +1232,7 @@ void Pair::ev_tally_xyz(int i, int j, int nlocal, int newton_pair, } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators for virial, have delx,dely,delz and fx,fy,fz called when using full neighbor lists ------------------------------------------------------------------------- */ @@ -1285,7 +1285,7 @@ void Pair::ev_tally_xyz_full(int i, double evdwl, double ecoul, } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators called by SW and hbond potentials, newton_pair is always on virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk ------------------------------------------------------------------------- */ @@ -1342,7 +1342,7 @@ void Pair::ev_tally3(int i, int j, int k, double evdwl, double ecoul, } /* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global and per-atom accumulators + tally eng_vdwl and virial into global or per-atom accumulators called by AIREBO potential, newton_pair is always on ------------------------------------------------------------------------- */ @@ -1487,28 +1487,40 @@ void Pair::ev_tally_tip4p(int key, int *list, double *v, } /* ---------------------------------------------------------------------- - tally virial into per-atom accumulators - called by REAX/C potential, newton_pair is always on - fi is magnitude of force on atom i + tally virial into global or per-atom accumulators + called by ReaxFF potential, newton_pair is always on + fi is magnitude of force on atom i, deli is the direction + note that the other atom (j) is not updated, due to newton on ------------------------------------------------------------------------- */ -void Pair::v_tally(int i, double *fi, double *deli) +void Pair::v_tally2_newton(int i, double *fi, double *deli) { double v[6]; - v[0] = 0.5*deli[0]*fi[0]; - v[1] = 0.5*deli[1]*fi[1]; - v[2] = 0.5*deli[2]*fi[2]; - v[3] = 0.5*deli[0]*fi[1]; - v[4] = 0.5*deli[0]*fi[2]; - v[5] = 0.5*deli[1]*fi[2]; + v[0] = deli[0]*fi[0]; + v[1] = deli[1]*fi[1]; + v[2] = deli[2]*fi[2]; + v[3] = deli[0]*fi[1]; + v[4] = deli[0]*fi[2]; + v[5] = deli[1]*fi[2]; - vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2]; - vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5]; + if (vflag_global) { + virial[0] += v[0]; + virial[1] += v[1]; + virial[2] += v[2]; + virial[3] += v[3]; + virial[4] += v[4]; + virial[5] += v[5]; + } + + if (vflag_atom) { + vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2]; + vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5]; + } } /* ---------------------------------------------------------------------- - tally virial into per-atom accumulators + tally virial into global or per-atom accumulators called by AIREBO potential, newton_pair is always on fpair is magnitude of force on atom I ------------------------------------------------------------------------- */ @@ -1549,7 +1561,7 @@ void Pair::v_tally2(int i, int j, double fpair, double *drij) /* ---------------------------------------------------------------------- tally virial into per-atom accumulators - called by AIREBO and Tersoff potential, newton_pair is always on + called by AIREBO and Tersoff potentials, newton_pair is always on ------------------------------------------------------------------------- */ void Pair::v_tally3(int i, int j, int k, double *fi, double *fj, double *drik, double *drjk) @@ -1589,8 +1601,8 @@ void Pair::v_tally3(int i, int j, int k, double *fi, double *fj, double *drik, d } /* ---------------------------------------------------------------------- - tally virial into per-atom accumulators - called by AIREBO potential, newton_pair is always on + tally virial into global or per-atom accumulators + called by AIREBO potential, Tersoff, ReaxFF potentials, newton_pair is always on ------------------------------------------------------------------------- */ void Pair::v_tally4(int i, int j, int k, int m, @@ -1634,7 +1646,7 @@ void Pair::v_tally4(int i, int j, int k, int m, } /* ---------------------------------------------------------------------- - tally virial into global and per-atom accumulators + tally virial into global or per-atom accumulators called by pair lubricate potential with 6 tensor components ------------------------------------------------------------------------- */ diff --git a/src/pair.h b/src/pair.h index ad158bba9e..c4a5d3678c 100644 --- a/src/pair.h +++ b/src/pair.h @@ -137,9 +137,9 @@ class Pair : protected Pointers { // need to be public, so can be called by pair_style reaxc - void v_tally(int, double *, double *); void ev_tally(int, int, int, int, double, double, double, double, double, double); void ev_tally3(int, int, int, double, double, double *, double *, double *, double *); + void v_tally2_newton(int, double *, double *); void v_tally3(int, int, int, double *, double *, double *, double *); void v_tally4(int, int, int, int, double *, double *, double *, double *, double *, double *); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, From e0ba11fbf0e75e2a437c2d973cc1c016e9d5d66c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jul 2021 16:19:31 -0400 Subject: [PATCH 076/119] update LAMMPS homepage URL --- src/OPENMP/reaxff_omp.h | 2 +- src/REAXFF/reaxff_api.h | 2 +- src/REAXFF/reaxff_defs.h | 2 +- src/REAXFF/reaxff_inline.h | 2 +- src/REAXFF/reaxff_types.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OPENMP/reaxff_omp.h b/src/OPENMP/reaxff_omp.h index 4188ac9bf7..252e5f0e9d 100644 --- a/src/OPENMP/reaxff_omp.h +++ b/src/OPENMP/reaxff_omp.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract diff --git a/src/REAXFF/reaxff_api.h b/src/REAXFF/reaxff_api.h index 6179da9c72..ae3b013541 100644 --- a/src/REAXFF/reaxff_api.h +++ b/src/REAXFF/reaxff_api.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract diff --git a/src/REAXFF/reaxff_defs.h b/src/REAXFF/reaxff_defs.h index df31d41d4c..868f6e22c2 100644 --- a/src/REAXFF/reaxff_defs.h +++ b/src/REAXFF/reaxff_defs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract diff --git a/src/REAXFF/reaxff_inline.h b/src/REAXFF/reaxff_inline.h index ba9927e5d3..a53ab4bb05 100644 --- a/src/REAXFF/reaxff_inline.h +++ b/src/REAXFF/reaxff_inline.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract diff --git a/src/REAXFF/reaxff_types.h b/src/REAXFF/reaxff_types.h index aec48072df..e57244c66b 100644 --- a/src/REAXFF/reaxff_types.h +++ b/src/REAXFF/reaxff_types.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract From e29577634dc7888adfe4c499d4c800c51600640c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jul 2021 16:23:45 -0400 Subject: [PATCH 077/119] fix whitespace --- src/REAXFF/reaxc_valence_angles.cpp | 2 +- src/pair.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/REAXFF/reaxc_valence_angles.cpp b/src/REAXFF/reaxc_valence_angles.cpp index 5f75b6637d..ac3e2dbd1e 100644 --- a/src/REAXFF/reaxc_valence_angles.cpp +++ b/src/REAXFF/reaxc_valence_angles.cpp @@ -356,7 +356,7 @@ namespace ReaxFF { /* tally virial */ if (system->pair_ptr->vflag_either) { - + /* Acquire vectors */ rvec_ScaledSum(delij, 1., system->my_atoms[i].x, -1., system->my_atoms[j].x); rvec_ScaledSum(delkj, 1., system->my_atoms[k].x, -1., system->my_atoms[j].x); diff --git a/src/pair.cpp b/src/pair.cpp index bc8cb2ecd1..38c7922c17 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -1490,7 +1490,7 @@ void Pair::ev_tally_tip4p(int key, int *list, double *v, tally virial into global or per-atom accumulators called by ReaxFF potential, newton_pair is always on fi is magnitude of force on atom i, deli is the direction - note that the other atom (j) is not updated, due to newton on + note that the other atom (j) is not updated, due to newton on ------------------------------------------------------------------------- */ void Pair::v_tally2_newton(int i, double *fi, double *deli) From d412a4c9335dbdc06f12e5948f793300ef77247d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jul 2021 21:03:10 -0400 Subject: [PATCH 078/119] re-enable OpenMP testing for ReaxFF --- unittest/force-styles/test_pair_style.cpp | 3 +- .../tests/atomic-pair-reax_c.yaml | 171 +++++++++--------- .../tests/atomic-pair-reax_c_lgvdw.yaml | 5 +- .../tests/atomic-pair-reax_c_noqeq.yaml | 5 +- .../tests/atomic-pair-reax_c_tabulate.yaml | 5 +- .../tests/atomic-pair-yukawa_colloid.yaml | 1 + 6 files changed, 93 insertions(+), 97 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index a3f16eee17..23858f93b9 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -524,8 +524,7 @@ TEST(PairStyle, plain) if (print_stats) std::cerr << "restart_energy stats:" << stats << std::endl; // pair style rann does not support pair_modify nofdotr - // temporarily disable testing pair style reax/c until we merge the other fixes - if ((test_config.pair_style != "rann") && !(test_config.pair_style.find("reax") != std::string::npos)) { + if (test_config.pair_style != "rann") { if (!verbose) ::testing::internal::CaptureStdout(); restart_lammps(lmp, test_config, true); if (!verbose) ::testing::internal::GetCapturedStdout(); diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index c65b49e83c..630f3b1d17 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,8 +1,7 @@ --- -lammps_version: 8 Apr 2021 -date_generated: Wed Apr 21 09:14:10 2021 +lammps_version: 2 Jul 2021 +date_generated: Mon Jul 12 20:56:37 2021 epsilon: 1e-11 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -37,140 +36,140 @@ extract: ! "" natoms: 64 init_vdwl: -3296.3503506624793 init_coul: -327.06551252279587 -init_stress: ! |2- - 3.0523786192092821e+03 3.0876898599834703e+03 3.2008340933315003e+03 -9.2310133390813661e+01 -2.9719470139173262e+02 -8.6006991065711546e+01 +init_stress: ! |- + -1.0522112314759645e+03 -1.2629480788292406e+03 -8.6765541430728683e+02 -2.5149818635822589e+02 2.0624598409299679e+02 -6.4309968343216531e+02 init_forces: ! |2 1 -8.8484559491557889e+01 -2.5824737864578637e+01 1.0916228789487674e+02 - 2 -1.1227736122976223e+02 -1.8092349731667611e+02 -2.2420586526896261e+02 + 2 -1.1227736122976223e+02 -1.8092349731667616e+02 -2.2420586526896261e+02 3 -1.7210817575849026e+02 1.8292439782308702e+02 1.3552618819720569e+01 - 4 3.2997500231085198e+01 -5.1076027616185407e+01 9.0475628837095513e+01 - 5 1.8144778146274791e+02 1.6797701000587452e+01 -8.1725507301127038e+01 - 6 1.3634094180728110e+02 -3.0056789474000180e+02 2.9661495129805971e+01 + 4 3.2997500231085269e+01 -5.1076027616185407e+01 9.0475628837095513e+01 + 5 1.8144778146274791e+02 1.6797701000587466e+01 -8.1725507301127038e+01 + 6 1.3634094180728110e+02 -3.0056789474000180e+02 2.9661495129805957e+01 7 -5.3287158661291762e+01 -1.2872927610192625e+02 -1.6347871108897493e+02 8 -1.5334883257588757e+02 4.0171483324130726e+01 1.5317461163040997e+02 9 1.8364155867634079e+01 8.1986572088186804e+01 2.8272397798081524e+01 10 8.4246730110712534e+01 1.4177487113456962e+02 1.2330079878579957e+02 11 -4.3218423112520902e+01 6.5551082199289709e+01 1.3464882148706636e+02 12 -9.7317470492933836e+01 -2.6234999414154014e+01 7.2277941881646539e+00 - 13 -6.3183329836753863e+01 -4.7368101002971272e+01 -3.7592654029315028e+01 - 14 7.8642975316486172e+01 -6.7997612991897427e+01 -9.9044775614596048e+01 + 13 -6.3183329836753863e+01 -4.7368101002971272e+01 -3.7592654029315021e+01 + 14 7.8642975316486172e+01 -6.7997612991897455e+01 -9.9044775614596048e+01 15 -6.6373732796038979e+01 2.1787558547532143e+02 8.0103149369093387e+01 - 16 1.9216166082224373e+02 5.3228015320734826e+01 6.6260214054210593e+01 + 16 1.9216166082224373e+02 5.3228015320734819e+01 6.6260214054210593e+01 17 1.4496007689503062e+02 -3.9700923044583718e+01 -9.7503851828130053e+01 18 -4.4989550233790240e+01 -1.9360605894359739e+02 1.1274792197022482e+02 - 19 2.6657528138945770e+02 3.7189510796650950e+02 -3.3847307488287697e+02 + 19 2.6657528138945770e+02 3.7189510796650950e+02 -3.3847307488287703e+02 20 -7.6341040242469418e+01 -8.8478925962203348e+01 1.3557778212060649e+00 21 -7.1188591900926752e+01 -5.1591439985136624e+01 -1.2279442803769274e+02 22 1.5504836733039957e+02 -1.3094504458746073e+02 8.1474408030760628e+01 - 23 7.8015302036861655e+01 -1.3272310040521637e+01 -2.2771427736544169e+01 + 23 7.8015302036861655e+01 -1.3272310040521637e+01 -2.2771427736544183e+01 24 -2.0546718065741098e+02 2.1611071031053456e+02 -1.2423208053538966e+02 25 -1.1402686646199034e+02 1.9100238121128132e+02 -8.3504908417580012e+01 - 26 2.8663576552098777e+02 -2.1773884754170604e+02 2.3144300100087472e+02 - 27 -6.3247409025611177e+01 6.9122196748087063e+01 1.8606936744368775e+02 - 28 -3.5426011055935223e+00 3.8764809029451868e+01 3.2874001946768942e+01 - 29 -7.1069178571876577e+01 3.5485903180427719e+01 2.7311648896320207e+01 - 30 -1.7036987830119904e+02 -1.9851827590031277e+02 -1.1511401829123538e+02 - 31 -1.3970409889743334e+02 1.6660943915628047e+02 -1.2913930522474701e+02 - 32 2.7179130444112268e+01 -6.0169059447629913e+01 -1.7669495182022038e+02 + 26 2.8663576552098772e+02 -2.1773884754170604e+02 2.3144300100087472e+02 + 27 -6.3247409025611177e+01 6.9122196748087077e+01 1.8606936744368778e+02 + 28 -3.5426011055935240e+00 3.8764809029451875e+01 3.2874001946768900e+01 + 29 -7.1069178571876577e+01 3.5485903180427719e+01 2.7311648896320204e+01 + 30 -1.7036987830119904e+02 -1.9851827590031277e+02 -1.1511401829123537e+02 + 31 -1.3970409889743331e+02 1.6660943915628047e+02 -1.2913930522474698e+02 + 32 2.7179130444112271e+01 -6.0169059447629905e+01 -1.7669495182022038e+02 33 -6.2659679124099597e+01 -6.4422131921795355e+01 6.4150928205326579e+01 34 -2.2119065265693539e+01 1.0450386886830508e+02 -7.3998379587547845e+01 - 35 2.6982987783286296e+02 -2.1519317040003412e+02 1.3051628460669610e+02 - 36 1.0368628874516664e+02 1.8817377639779619e+02 -1.9748944223870336e+02 - 37 -1.8009522406836993e+02 1.2993653092243849e+02 -6.3523043394051776e+01 - 38 -2.9571205878459978e+02 1.0441609933482223e+02 1.5582204859042619e+02 - 39 8.7398805727029284e+01 -6.0025559644669258e+01 2.2209742009837157e+01 + 35 2.6982987783286291e+02 -2.1519317040003412e+02 1.3051628460669610e+02 + 36 1.0368628874516659e+02 1.8817377639779619e+02 -1.9748944223870336e+02 + 37 -1.8009522406836990e+02 1.2993653092243849e+02 -6.3523043394051804e+01 + 38 -2.9571205878459978e+02 1.0441609933482222e+02 1.5582204859042619e+02 + 39 8.7398805727029270e+01 -6.0025559644669258e+01 2.2209742009837157e+01 40 2.0540672579010824e+01 -1.0735874009092363e+02 5.8655918369892206e+01 41 -5.8895846271372314e+01 1.1852345624639781e+01 -6.6147257724570267e+01 - 42 -9.6895512314642531e+01 3.8928741136688728e+01 -7.5791929957116224e+01 + 42 -9.6895512314642531e+01 3.8928741136688721e+01 -7.5791929957116210e+01 43 2.2476051812062417e+02 9.5505204283237461e+01 1.2309042240718740e+02 - 44 8.9817373579488645e+01 -1.0616333580628948e+02 -8.6321519086255435e+01 - 45 1.7202629662584396e+01 1.2890307246697839e+02 5.2916171301068474e+01 - 46 1.3547783972601877e+01 -2.9276223331260056e+01 2.2187412696867373e+01 - 47 3.3389762514712238e+01 -1.9217585014965047e+02 -6.9956213241088250e+01 - 48 7.3631720332112678e+01 -2.0953007324688525e+02 -2.3183566221404714e+01 - 49 -3.7589944473227274e+02 -2.4083165714763936e+01 1.0770339502610540e+02 + 44 8.9817373579488660e+01 -1.0616333580628948e+02 -8.6321519086255435e+01 + 45 1.7202629662584396e+01 1.2890307246697841e+02 5.2916171301068466e+01 + 46 1.3547783972601877e+01 -2.9276223331260049e+01 2.2187412696867376e+01 + 47 3.3389762514712210e+01 -1.9217585014965047e+02 -6.9956213241088250e+01 + 48 7.3631720332112650e+01 -2.0953007324688525e+02 -2.3183566221404728e+01 + 49 -3.7589944473227274e+02 -2.4083165714763936e+01 1.0770339502610545e+02 50 3.8603083564823841e+01 -7.3616481568799330e+01 9.0414065019644596e+01 51 1.3736420686706188e+02 -1.0204157331506994e+02 1.5813725581150808e+02 - 52 -1.0797257051087823e+02 1.1876975735151167e+02 -1.3295758126486243e+02 - 53 -5.3807540206295343e+01 3.3259462625854701e+02 -3.8426833263045523e-03 - 54 -1.0690184616186750e+01 6.2820270853646399e+01 1.8343158343321130e+02 - 55 1.1231900459987581e+02 -1.7906654831317169e+02 7.6533681064340868e+01 - 56 -4.1027190034916586e+01 -1.4085413191133767e+02 3.7483064289953241e+01 + 52 -1.0797257051087824e+02 1.1876975735151170e+02 -1.3295758126486243e+02 + 53 -5.3807540206295350e+01 3.3259462625854701e+02 -3.8426833263187632e-03 + 54 -1.0690184616186752e+01 6.2820270853646427e+01 1.8343158343321130e+02 + 55 1.1231900459987581e+02 -1.7906654831317167e+02 7.6533681064340854e+01 + 56 -4.1027190034916586e+01 -1.4085413191133770e+02 3.7483064289953241e+01 57 9.9904315214040494e+01 7.0938939080461637e+01 -6.8654961257661526e+01 - 58 -2.7563642882026745e+01 -6.7445498717142405e+00 -1.8442640542823220e+01 - 59 -6.6628933617875404e+01 1.0613066354110040e+02 8.7736153919831665e+01 - 60 -1.7748415247439002e+01 6.3757605316872542e+01 -1.5086907478326543e+02 - 61 -3.3560907195791366e+01 -1.0076987083174089e+02 -7.4536106106935804e+01 - 62 1.5883428926665005e+01 -5.8433760297908881e+00 2.8392494016034949e+01 - 63 1.3294494001298790e+02 -1.2724568063770238e+02 -6.4886848316806251e+01 - 64 1.0738157273930990e+02 1.2062173788161539e+02 7.4541400611710785e+01 + 58 -2.7563642882026748e+01 -6.7445498717142405e+00 -1.8442640542823220e+01 + 59 -6.6628933617875418e+01 1.0613066354110040e+02 8.7736153919831665e+01 + 60 -1.7748415247438995e+01 6.3757605316872542e+01 -1.5086907478326543e+02 + 61 -3.3560907195791366e+01 -1.0076987083174090e+02 -7.4536106106935819e+01 + 62 1.5883428926665005e+01 -5.8433760297908881e+00 2.8392494016034941e+01 + 63 1.3294494001298787e+02 -1.2724568063770238e+02 -6.4886848316806251e+01 + 64 1.0738157273930993e+02 1.2062173788161539e+02 7.4541400611710785e+01 run_vdwl: -3296.346882377749 run_coul: -327.0653995073912 -run_stress: ! |2- - 3.0523824138350801e+03 3.0876910136734191e+03 3.2008348843495064e+03 -9.2310681174629309e+01 -2.9719286551009412e+02 -8.6004906282204530e+01 +run_stress: ! |- + -1.0521225462925122e+03 -1.2628780139889509e+03 -8.6757617693085899e+02 -2.5158592653603847e+02 2.0619472152426923e+02 -6.4312943979323541e+02 run_forces: ! |2 1 -8.8486129396001530e+01 -2.5824483374473200e+01 1.0916517213634106e+02 - 2 -1.1227648453173390e+02 -1.8093214754186130e+02 -2.2420118533940351e+02 - 3 -1.7210894875994978e+02 1.8292263268451674e+02 1.3551979435686128e+01 - 4 3.2999405001009400e+01 -5.1077312719545837e+01 9.0478579144069556e+01 + 2 -1.1227648453173390e+02 -1.8093214754186130e+02 -2.2420118533940354e+02 + 3 -1.7210894875994978e+02 1.8292263268451674e+02 1.3551979435686139e+01 + 4 3.2999405001009407e+01 -5.1077312719545837e+01 9.0478579144069556e+01 5 1.8144963583123214e+02 1.6798391906831810e+01 -8.1723378082075570e+01 6 1.3640835897739447e+02 -3.0059507544862095e+02 2.9594750460783345e+01 - 7 -5.3287619129789434e+01 -1.2872953167026759e+02 -1.6348317368624129e+02 + 7 -5.3287619129789434e+01 -1.2872953167026756e+02 -1.6348317368624129e+02 8 -1.5334990952322434e+02 4.0171746946780843e+01 1.5317542403106131e+02 - 9 1.8362961213927143e+01 8.1984428717784240e+01 2.8273598253027259e+01 + 9 1.8362961213927139e+01 8.1984428717784255e+01 2.8273598253027259e+01 10 8.4245458094789043e+01 1.4177227430519346e+02 1.2329899933660965e+02 11 -4.3217035356344425e+01 6.5547850976510759e+01 1.3463983671946417e+02 12 -9.7319343004573113e+01 -2.6236499899232278e+01 7.2232061905742402e+00 13 -6.3184735475530402e+01 -4.7368090836538087e+01 -3.7590268076036111e+01 - 14 7.8642680121803949e+01 -6.7994653297646451e+01 -9.9042134233434069e+01 - 15 -6.6371195967082812e+01 2.1787700653339664e+02 8.0102624694807375e+01 - 16 1.9215832443892597e+02 5.3231888618093969e+01 6.6253846562695060e+01 - 17 1.4496126989603110e+02 -3.9700366098757236e+01 -9.7506725874209394e+01 + 14 7.8642680121803977e+01 -6.7994653297646451e+01 -9.9042134233434012e+01 + 15 -6.6371195967082826e+01 2.1787700653339664e+02 8.0102624694807375e+01 + 16 1.9215832443892597e+02 5.3231888618093983e+01 6.6253846562695074e+01 + 17 1.4496126989603110e+02 -3.9700366098757222e+01 -9.7506725874209380e+01 18 -4.4989211400008614e+01 -1.9360716191976445e+02 1.1274798810455862e+02 - 19 2.6657546213782740e+02 3.7189369483257695e+02 -3.3847202166068041e+02 + 19 2.6657546213782740e+02 3.7189369483257695e+02 -3.3847202166068035e+02 20 -7.6352829159880940e+01 -8.8469178952301604e+01 1.3384778817072185e+00 - 21 -7.1188597560667418e+01 -5.1592404200740091e+01 -1.2279357314243519e+02 + 21 -7.1188597560667432e+01 -5.1592404200740106e+01 -1.2279357314243519e+02 22 1.5504965184741241e+02 -1.3094582932680530e+02 8.1473922626938005e+01 23 7.8017376001392932e+01 -1.3263023728607561e+01 -2.2771654676273968e+01 - 24 -2.0547634460482246e+02 2.1612342044348730e+02 -1.2423651650061706e+02 + 24 -2.0547634460482251e+02 2.1612342044348730e+02 -1.2423651650061706e+02 25 -1.1402944116091903e+02 1.9100648219391277e+02 -8.3505645569845370e+01 26 2.8664542299410533e+02 -2.1774609219880716e+02 2.3144720166994406e+02 - 27 -6.3243843868043058e+01 6.9123801262965287e+01 1.8607035157681673e+02 - 28 -3.5444604841998397e+00 3.8760531647714473e+01 3.2869123667281691e+01 + 27 -6.3243843868043029e+01 6.9123801262965273e+01 1.8607035157681673e+02 + 28 -3.5444604841998415e+00 3.8760531647714480e+01 3.2869123667281706e+01 29 -7.1069494158179211e+01 3.5486459158760582e+01 2.7311657876181052e+01 30 -1.7037059987992399e+02 -1.9851840131669357e+02 -1.1511410156295636e+02 - 31 -1.3970663440086005e+02 1.6660841802305004e+02 -1.2914070628112796e+02 - 32 2.7179939937138421e+01 -6.0162678551485520e+01 -1.7668459764117443e+02 - 33 -6.2659124615698168e+01 -6.4421915847941506e+01 6.4151176691093482e+01 + 31 -1.3970663440086005e+02 1.6660841802305001e+02 -1.2914070628112796e+02 + 32 2.7179939937138432e+01 -6.0162678551485513e+01 -1.7668459764117441e+02 + 33 -6.2659124615698168e+01 -6.4421915847941520e+01 6.4151176691093482e+01 34 -2.2118740875419455e+01 1.0450303589341144e+02 -7.3997370482692972e+01 35 2.6987081482968875e+02 -2.1523754104000355e+02 1.3052736086179604e+02 - 36 1.0368798521815546e+02 1.8816694370725344e+02 -1.9748485159172904e+02 - 37 -1.8012152564003850e+02 1.2997662140302853e+02 -6.3547259053587844e+01 - 38 -2.9571525697590829e+02 1.0441941743734590e+02 1.5582112543442358e+02 - 39 8.7399620724575271e+01 -6.0025787992411296e+01 2.2209357601282150e+01 - 40 2.0541458171950978e+01 -1.0735817059033016e+02 5.8656280350524312e+01 - 41 -5.8893965304899972e+01 1.1850504754314887e+01 -6.6138932259022468e+01 - 42 -9.6894702780992375e+01 3.8926449644174816e+01 -7.5794133002764795e+01 + 36 1.0368798521815543e+02 1.8816694370725344e+02 -1.9748485159172907e+02 + 37 -1.8012152564003850e+02 1.2997662140302859e+02 -6.3547259053587872e+01 + 38 -2.9571525697590829e+02 1.0441941743734588e+02 1.5582112543442358e+02 + 39 8.7399620724575271e+01 -6.0025787992411310e+01 2.2209357601282150e+01 + 40 2.0541458171950978e+01 -1.0735817059033018e+02 5.8656280350524320e+01 + 41 -5.8893965304899986e+01 1.1850504754314887e+01 -6.6138932259022468e+01 + 42 -9.6894702780992361e+01 3.8926449644174809e+01 -7.5794133002764795e+01 43 2.2475651760389383e+02 9.5503072846836503e+01 1.2308683766845400e+02 44 8.9821846939843113e+01 -1.0615882525757857e+02 -8.6326896770189890e+01 - 45 1.7193681344342288e+01 1.2889564928820627e+02 5.2922372841252404e+01 - 46 1.3549091739280335e+01 -2.9276447091757490e+01 2.2187152043656496e+01 - 47 3.3389460345593179e+01 -1.9217121673024420e+02 -6.9954603582952544e+01 - 48 7.3644268618852777e+01 -2.0953201921822830e+02 -2.3192562071413263e+01 + 45 1.7193681344342288e+01 1.2889564928820624e+02 5.2922372841252404e+01 + 46 1.3549091739280335e+01 -2.9276447091757493e+01 2.2187152043656500e+01 + 47 3.3389460345593150e+01 -1.9217121673024420e+02 -6.9954603582952544e+01 + 48 7.3644268618852763e+01 -2.0953201921822830e+02 -2.3192562071413278e+01 49 -3.7593958318941031e+02 -2.4028439106859878e+01 1.0779151134441000e+02 50 3.8603926624328551e+01 -7.3615255297989435e+01 9.0412505212292402e+01 51 1.3736689552214156e+02 -1.0204490780187869e+02 1.5814099219652564e+02 - 52 -1.0797151154267746e+02 1.1876989597626186e+02 -1.3296150756377074e+02 - 53 -5.3843453069456601e+01 3.3257024143956789e+02 -2.3416395383762278e-02 - 54 -1.0678049522667429e+01 6.2807424617056625e+01 1.8344969045860523e+02 + 52 -1.0797151154267745e+02 1.1876989597626186e+02 -1.3296150756377074e+02 + 53 -5.3843453069456601e+01 3.3257024143956778e+02 -2.3416395383797806e-02 + 54 -1.0678049522667429e+01 6.2807424617056597e+01 1.8344969045860523e+02 55 1.1232135576105661e+02 -1.7906994470561881e+02 7.6534265234548187e+01 - 56 -4.1035945990527679e+01 -1.4084577238065071e+02 3.7489705598247994e+01 - 57 9.9903872061946174e+01 7.0936213558024505e+01 -6.8656338416452527e+01 + 56 -4.1035945990527679e+01 -1.4084577238065074e+02 3.7489705598247994e+01 + 57 9.9903872061946146e+01 7.0936213558024505e+01 -6.8656338416452527e+01 58 -2.7563844572724122e+01 -6.7426705471926862e+00 -1.8442803060445037e+01 - 59 -6.6637290503389451e+01 1.0613630918459926e+02 8.7741455199772943e+01 - 60 -1.7749706497437369e+01 6.3756413885635943e+01 -1.5086911682892705e+02 - 61 -3.3559889608749941e+01 -1.0076809277084803e+02 -7.4536003122046253e+01 - 62 1.5883833834736409e+01 -5.8439916924703503e+00 2.8393403991146936e+01 - 63 1.3294237052896716e+02 -1.2724619636183070e+02 -6.4882384014219085e+01 - 64 1.0738250214938944e+02 1.2062290362868877e+02 7.4541927445529211e+01 + 59 -6.6637290503389465e+01 1.0613630918459926e+02 8.7741455199772943e+01 + 60 -1.7749706497437362e+01 6.3756413885635943e+01 -1.5086911682892702e+02 + 61 -3.3559889608749941e+01 -1.0076809277084801e+02 -7.4536003122046239e+01 + 62 1.5883833834736409e+01 -5.8439916924703503e+00 2.8393403991146943e+01 + 63 1.3294237052896716e+02 -1.2724619636183067e+02 -6.4882384014219042e+01 + 64 1.0738250214938945e+02 1.2062290362868877e+02 7.4541927445529197e+01 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index 3e12ad726d..c67cffdbba 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -1,8 +1,7 @@ --- -lammps_version: 8 Apr 2021 -date_generated: Wed Apr 21 08:52:02 2021 +lammps_version: 2 Jul 2021 +date_generated: Mon Jul 12 20:56:38 2021 epsilon: 1e-12 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index d0f59749fd..5927f854d6 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -1,8 +1,7 @@ --- -lammps_version: 8 Apr 2021 -date_generated: Wed Apr 21 08:52:00 2021 +lammps_version: 2 Jul 2021 +date_generated: Mon Jul 12 20:56:38 2021 epsilon: 5e-13 -skip_tests: omp prerequisites: ! | pair reax/c pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml index 12136d7a27..2434dfdcbc 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -1,8 +1,7 @@ --- -lammps_version: 8 Apr 2021 -date_generated: Wed Apr 21 08:52:02 2021 +lammps_version: 2 Jul 2021 +date_generated: Mon Jul 12 20:56:39 2021 epsilon: 1e-12 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax diff --git a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml index 1c5c24832d..d807696e63 100644 --- a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml +++ b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:10 2021 epsilon: 2e-13 +skip_tests: single prerequisites: ! | atom sphere pair yukawa/colloid From 5f302b9035247028e2ed2105ffd016c81d26b58d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jul 2021 17:42:46 -0400 Subject: [PATCH 079/119] temporarily skip testing REAXFF with OpenMP --- unittest/force-styles/tests/atomic-pair-reax_c.yaml | 1 + unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml | 1 + unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml | 1 + unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index 630f3b1d17..22cc182b30 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -2,6 +2,7 @@ lammps_version: 2 Jul 2021 date_generated: Mon Jul 12 20:56:37 2021 epsilon: 1e-11 +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index c67cffdbba..d91caa277c 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -2,6 +2,7 @@ lammps_version: 2 Jul 2021 date_generated: Mon Jul 12 20:56:38 2021 epsilon: 1e-12 +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index 5927f854d6..9cfaaf4625 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -2,6 +2,7 @@ lammps_version: 2 Jul 2021 date_generated: Mon Jul 12 20:56:38 2021 epsilon: 5e-13 +skip_tests: omp prerequisites: ! | pair reax/c pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml index 2434dfdcbc..8afebb059b 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -2,6 +2,7 @@ lammps_version: 2 Jul 2021 date_generated: Mon Jul 12 20:56:39 2021 epsilon: 1e-12 +skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax From 88e363c0bbf4bc46c1465034dd3d900f6142b149 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 14:51:04 -0400 Subject: [PATCH 080/119] document and add unit tests for lammps_set_fix_external_callback() --- src/library.cpp | 47 +++++++++---- src/library.h | 2 +- unittest/c-library/CMakeLists.txt | 4 ++ unittest/c-library/test_library_external.cpp | 73 ++++++++++++++++++++ unittest/python/CMakeLists.txt | 5 ++ unittest/python/python-fix-external.py | 42 +++++++++++ 6 files changed, 159 insertions(+), 14 deletions(-) create mode 100644 unittest/c-library/test_library_external.cpp create mode 100644 unittest/python/python-fix-external.py diff --git a/src/library.cpp b/src/library.cpp index c0dcb4f328..f0d747f258 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4804,15 +4804,38 @@ void lammps_decode_image_flags(imageint image, int *flags) flags[2] = (image >> IMG2BITS) - IMGMAX; } -/* ---------------------------------------------------------------------- - find fix external with given ID and set the callback function - and caller pointer -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr callback_ptr, void * caller) +/** Set the callback function for a fix external instance with given ID. + Optionally also set the pointer to the calling object. +\verbatim embed:rst + +Fix :doc:`external ` allows programs that are running LAMMPS through +its library interface to modify certain LAMMPS properties on specific +timesteps, similar to the way other fixes do. + +This function sets the callback function which has to have C language +bindings with the prototype: + +.. code-block:: c + + void func(void *ptr, bigint timestep, int nlocal, tagint *ids, double **x, double **fexternal); + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param funcptr pointer to callback function + * \param ptr pointer to object in calling code, passed to callback function as first argument */ + +void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr funcptr, void *ptr) { LAMMPS *lmp = (LAMMPS *) handle; - FixExternal::FnPtr callback = (FixExternal::FnPtr) callback_ptr; + FixExternal::FnPtr callback = (FixExternal::FnPtr) funcptr; BEGIN_CAPTURE { @@ -4823,18 +4846,16 @@ void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr c Fix *fix = lmp->modify->fix[ifix]; if (strcmp("external",fix->style) != 0) - lmp->error->all(FLERR,"Fix '{}' is not of style " - "external!", id); + lmp->error->all(FLERR,"Fix '{}' is not of style 'external'", id); - FixExternal * fext = (FixExternal*) fix; - fext->set_callback(callback, caller); + FixExternal *fext = (FixExternal *) fix; + fext->set_callback(callback, ptr); } END_CAPTURE } /* set global energy contribution from fix external */ -void lammps_fix_external_set_energy_global(void *handle, char *id, - double energy) +void lammps_fix_external_set_energy_global(void *handle, char *id, double energy) { LAMMPS *lmp = (LAMMPS *) handle; @@ -4849,7 +4870,7 @@ void lammps_fix_external_set_energy_global(void *handle, char *id, if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + FixExternal *fext = (FixExternal*) fix; fext->set_energy_global(energy); } END_CAPTURE diff --git a/src/library.h b/src/library.h index a337d7b510..2732314771 100644 --- a/src/library.h +++ b/src/library.h @@ -226,7 +226,7 @@ void lammps_decode_image_flags(int64_t image, int *flags); #if defined(LAMMPS_BIGBIG) typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); -void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void *); +void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr funcptr, void *ptr); #elif defined(LAMMPS_SMALLBIG) typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **); void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void *); diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 3c24cdcff4..b01cd64677 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -7,6 +7,10 @@ add_executable(test_library_commands test_library_commands.cpp test_main.cpp) target_link_libraries(test_library_commands PRIVATE lammps GTest::GTest GTest::GMock) add_test(LibraryCommands test_library_commands) +add_executable(test_library_external test_library_external.cpp test_main.cpp) +target_link_libraries(test_library_external PRIVATE lammps GTest::GTest GTest::GMock) +add_test(LibraryExternal test_library_external) + add_executable(test_library_properties test_library_properties.cpp test_main.cpp) target_link_libraries(test_library_properties PRIVATE lammps GTest::GTest GTest::GMock) target_compile_definitions(test_library_properties PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp new file mode 100644 index 0000000000..78ed91195c --- /dev/null +++ b/unittest/c-library/test_library_external.cpp @@ -0,0 +1,73 @@ +// unit tests creating LAMMPS instances via the library interface + +#include "library.h" + +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "test_main.h" + +using ::testing::HasSubstr; +using ::testing::StartsWith; + +extern "C" { +#ifdef LAMMPS_SMALLSMALL +typedef int32_t step_t; +typedef int32_t tag_t; +#elif LAMMPS_SMALLBIG +typedef int64_t step_t; +typedef int32_t tag_t; +#else +typedef int64_t step_t; +typedef int64_t tag_t; +#endif +static void callback_one(void *lmp, step_t timestep, int nlocal, tag_t *ids, double **x, double **f) +{ + for (int i = 0; i < nlocal; ++i) + f[i][0] = f[i][1] = f[i][2] = (double)timestep; +} +} + +TEST(lammps_external_pf, null_args) +{ + const char *args[] = {"liblammps", "-log", "none", "-nocite"}; + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); + + ::testing::internal::CaptureStdout(); + void *handle = lammps_open_no_mpi(argc, argv, NULL); + std::string output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + ::testing::internal::CaptureStdout(); + lammps_commands_string(handle, "lattice sc 1.0\n" + "region box block -1 1 -1 1 -1 1\n" + "create_box 1 box\n" + "create_atoms 1 box\n" + "mass 1 1.0\n" + "pair_style zero 0.1\n" + "pair_coeff 1 1\n" + "velocity all set 0.1 0.0 -0.1\n" + "thermo 5\n" + "fix 1 all nve\n" + "fix ext all external pf/callback 5 1\n"); + + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + ::testing::internal::CaptureStdout(); + lammps_set_fix_external_callback(handle, (char *)"ext", &callback_one, handle); + lammps_command(handle, "run 10 post no"); + double temp = lammps_get_thermo(handle,"temp"); + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + EXPECT_DOUBLE_EQ(temp,1.0/30.0); + + ::testing::internal::CaptureStdout(); + lammps_close(handle); + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; +} diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index b51d6e340a..9c9b7832ad 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -85,6 +85,11 @@ if(Python_EXECUTABLE) COMMAND ${PYTHON_TEST_RUNNER} ${CMAKE_CURRENT_SOURCE_DIR}/python-formats.py -v WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(PythonFormats PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") + + add_test(NAME PythonFixExternal + COMMAND ${PYTHON_TEST_RUNNER} ${CMAKE_CURRENT_SOURCE_DIR}/python-fix-external.py -v + WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) + set_tests_properties(PythonFixExternal PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") else() message(STATUS "Skipping Tests for the LAMMPS Python Module: no suitable Python interpreter") endif() diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py new file mode 100644 index 0000000000..badc9e5731 --- /dev/null +++ b/unittest/python/python-fix-external.py @@ -0,0 +1,42 @@ +import sys,os,unittest +from ctypes import * +from lammps import lammps + +# add timestep dependent force +def callback_one(lmp, ntimestep, nlocal, tag, x, f): + for i in range(nlocal): + f[i][0] = float(ntimestep) + f[i][1] = float(ntimestep) + f[i][2] = float(ntimestep) + +class PythonExternal(unittest.TestCase): + def testExternalCallback(self): + """Test fix external from Python with pf/callback""" + + machine=None + if 'LAMMPS_MACHINE_NAME' in os.environ: + machine=os.environ['LAMMPS_MACHINE_NAME'] + lmp=lammps(name=machine, cmdargs=['-nocite', '-log','none', '-echo', 'screen']) + + # a few commands to set up simple system + basic_system="""lattice sc 1.0 + region box block -1 1 -1 1 -1 1 + create_box 1 box + create_atoms 1 box + mass 1 1.0 + pair_style zero 0.1 + pair_coeff 1 1 + velocity all set 0.1 0.0 -0.1 + thermo 5 + fix 1 all nve + fix ext all external pf/callback 5 1 +""" + lmp.commands_string(basic_system) + lmp.set_fix_external_callback("ext",callback_one,lmp) + lmp.command("run 10 post no") + self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) + +############################## +if __name__ == "__main__": + unittest.main() + From 8b1dedf04a3c16a6d21673734c64fb1ce9e90c79 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 17:21:57 -0400 Subject: [PATCH 081/119] add extract method to fix external --- src/fix_external.cpp | 15 ++++++++++++++- src/fix_external.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 8bede4ee19..4bc1e7eebc 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -238,7 +238,7 @@ void FixExternal::set_virial_peratom(double **caller_virial) void FixExternal::set_vector_length(int n) { - delete [] caller_vector; + delete[] caller_vector; vector_flag = 1; size_vector = n; @@ -342,3 +342,16 @@ void FixExternal::set_callback(FnPtr caller_callback, void *caller_ptr) callback = caller_callback; ptr_caller = caller_ptr; } + +/* ---------------------------------------------------------------------- + get access to internal data structures +------------------------------------------------------------------------- */ + +void *FixExternal::extract(const char *str, int &dim) +{ + if (strcmp(str, "fexternal") == 0) { + dim = 2; + return (void *) fexternal; + } + return nullptr; +} diff --git a/src/fix_external.h b/src/fix_external.h index 0ace978f99..f0f46cd4c5 100644 --- a/src/fix_external.h +++ b/src/fix_external.h @@ -57,6 +57,8 @@ class FixExternal : public Fix { typedef void (*FnPtr)(void *, bigint, int, tagint *, double **, double **); void set_callback(FnPtr, void *); + void *extract(const char *, int &); + private: int mode, ncall, napply, eflag_caller; FnPtr callback; From f3dc13c9dd72960daa80b4738697de71c4fa0ef0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 17:25:47 -0400 Subject: [PATCH 082/119] expand library interface for fix external functionality --- doc/src/Library_utility.rst | 2 +- python/lammps/core.py | 59 +++++- src/library.cpp | 185 ++++++++++++++++++- src/library.h | 15 +- unittest/c-library/test_library_external.cpp | 77 +++++++- unittest/python/python-fix-external.py | 41 ++++ 6 files changed, 350 insertions(+), 29 deletions(-) diff --git a/doc/src/Library_utility.rst b/doc/src/Library_utility.rst index b2f3666f88..2748d418b6 100644 --- a/doc/src/Library_utility.rst +++ b/doc/src/Library_utility.rst @@ -33,7 +33,7 @@ where such memory buffers were allocated that require the use of ----------------------- -.. doxygenfunction:: lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*) +.. doxygenfunction:: lammps_set_fix_external_callback(void *, const char *, FixExternalFnPtr, void*) :project: progguide ----------------------- diff --git a/python/lammps/core.py b/python/lammps/core.py index 2f101f4eab..5079828ba8 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -295,9 +295,13 @@ class lammps(object): self.lib.lammps_extract_variable.argtypes = [c_void_p, c_char_p, c_char_p] - # TODO: NOT IMPLEMENTED IN PYTHON WRAPPER - self.lib.lammps_fix_external_set_energy_global = [c_void_p, c_char_p, c_double] - self.lib.lammps_fix_external_set_virial_global = [c_void_p, c_char_p, POINTER(c_double)] + self.lib.lammps_fix_external_get_force.argtypes = [c_void_p, c_char_p] + self.lib.lammps_fix_external_get_force.restype = POINTER(POINTER(c_double)) + + self.lib.lammps_fix_external_set_energy_global.argtypes = [c_void_p, c_char_p, c_double] + self.lib.lammps_fix_external_set_virial_global.argtypes = [c_void_p, c_char_p, POINTER(c_double)] + self.lib.lammps_fix_external_set_energy_peratom.argtypes = [c_void_p, c_char_p, POINTER(c_double)] + self.lib.lammps_fix_external_set_virial_peratom.argtypes = [c_void_p, c_char_p, POINTER(POINTER(c_double))] # detect if Python is using a version of mpi4py that can pass communicators # only needed if LAMMPS has been compiled with MPI support. @@ -1725,7 +1729,33 @@ class lammps(object): # ------------------------------------------------------------------------- - def set_fix_external_callback(self, fix_name, callback, caller=None): + def set_fix_external_callback(self, fix_id, callback, caller=None): + """Set the callback function for a fix external instance with a given fix ID. + + Optionally also set a reference to the calling object. + + This is a wrapper around the :cpp:func:`lammps_set_fix_external_callback` function + of the C-library interface. However this is set up to call a Python function with + the following arguments. + + .. code-block: python + + def func(object, ntimestep, nlocal, tag, x, f): + + - object is the value of the "caller" argument + - ntimestep is the current timestep + - nlocal is the number of local atoms on the current MPI process + - tag is a 1d NumPy array of integers representing the atom IDs of the local atoms + - x is a 2d NumPy array of floating point numbers of the coordinates of the local atoms + - f is a 2d NumPy array of floating point numbers of the forces on the local atoms that will be added + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param callback: Python function that will be called from fix external + :type: function + :param caller: reference to some object passed to the callback function + :type: object, optional + """ import numpy as np def callback_wrapper(caller, ntimestep, nlocal, tag_ptr, x_ptr, fext_ptr): @@ -1737,10 +1767,27 @@ class lammps(object): cFunc = self.FIX_EXTERNAL_CALLBACK_FUNC(callback_wrapper) cCaller = caller - self.callback[fix_name] = { 'function': cFunc, 'caller': caller } + self.callback[fix_id] = { 'function': cFunc, 'caller': caller } with ExceptionCheck(self): - self.lib.lammps_set_fix_external_callback(self.lmp, fix_name.encode(), cFunc, cCaller) + self.lib.lammps_set_fix_external_callback(self.lmp, fix_id.encode(), cFunc, cCaller) + # ------------------------------------------------------------------------- + + def fix_external_get_force(self, fix_id): + """Get access to that array with per-atom forces of a fix external instance with a given fix ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :return: requested data + :rtype: ctypes.POINTER(ctypes.POINTER(ctypes.double)) + """ + + with ExceptionCheck(self): + return self.lib.lammps_fix_external_get_force(self.lmp, fix_id.encode()) + return None # ------------------------------------------------------------------------- diff --git a/src/library.cpp b/src/library.cpp index f0d747f258..4488114579 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4806,7 +4806,7 @@ void lammps_decode_image_flags(imageint image, int *flags) /* ---------------------------------------------------------------------- */ -/** Set the callback function for a fix external instance with given ID. +/** Set the callback function for a fix external instance with the given ID. Optionally also set the pointer to the calling object. \verbatim embed:rst @@ -4814,13 +4814,15 @@ Fix :doc:`external ` allows programs that are running LAMMPS throu its library interface to modify certain LAMMPS properties on specific timesteps, similar to the way other fixes do. -This function sets the callback function which has to have C language -bindings with the prototype: +This function sets the callback function for use with the "pf/callback" +mode. The function has to have C language bindings with the prototype: .. code-block:: c void func(void *ptr, bigint timestep, int nlocal, tagint *ids, double **x, double **fexternal); +This is an alternative to the array mechanism set up by :cpp:func:`lammps_fix_external_set_force`. + Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. @@ -4832,7 +4834,7 @@ external code. * \param funcptr pointer to callback function * \param ptr pointer to object in calling code, passed to callback function as first argument */ -void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr funcptr, void *ptr) +void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr) { LAMMPS *lmp = (LAMMPS *) handle; FixExternal::FnPtr callback = (FixExternal::FnPtr) funcptr; @@ -4854,8 +4856,77 @@ void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr f END_CAPTURE } -/* set global energy contribution from fix external */ -void lammps_fix_external_set_energy_global(void *handle, char *id, double energy) +/** Get pointer to the force array storage in a fix external instance with the given ID. + +\verbatim embed:rst + +Fix :doc:`external ` allows programs that are running LAMMPS through +its library interface to add or modify certain LAMMPS properties on specific +timesteps, similar to the way other fixes do. + +This function provides access to the per-atom force storage in the fix +to be added to the individual atoms when using the "pf/array" mode. The +*fexternal* array can be accessed similar to the "native" per-atom +*arrays accessible via the :cpp:func:`lammps_extract_atom` function. +Because the underlying data structures can change as atoms migrate +between MPI processes, this function should be always called immediately +before the forces are going to be set. + +This is an alternative to the callback mechanism set up by +:cpp:func:`lammps_set_fix_external_callback` with out using the callback +mechanism to call out to the external program. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \return a pointer to the per-atom force array allocated by the fix */ + +double **lammps_fix_external_get_force(void *handle, const char *id) +{ + LAMMPS *lmp = (LAMMPS *) handle; + double **fexternal = nullptr; + + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,"Can not find fix with ID '{}'!", id); + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); + + fexternal = (double **)fix->extract("fexternal",ifix); + } + END_CAPTURE + return fexternal; +} + +/** Set the global energy contribution for a fix external instance with the given ID. + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_set_force` to also set the contribution +to the global energy from the external code. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param eng energy to be added to the global energy */ + +void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng) { LAMMPS *lmp = (LAMMPS *) handle; @@ -4871,14 +4942,30 @@ void lammps_fix_external_set_energy_global(void *handle, char *id, double energy lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); FixExternal *fext = (FixExternal*) fix; - fext->set_energy_global(energy); + fext->set_energy_global(eng); } END_CAPTURE } -/* set global virial contribution from fix external */ -void lammps_fix_external_set_virial_global(void *handle, char *id, - double *virial) +/** Set the global virial contribution for a fix external instance with the given ID. + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_set_force` to also set the contribution +to the global virial from the external code. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param virial the 6 global stress tensor components to be added to the global virial */ + +void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial) { LAMMPS *lmp = (LAMMPS *) handle; @@ -4899,6 +4986,84 @@ void lammps_fix_external_set_virial_global(void *handle, char *id, END_CAPTURE } +/** Set the per-atom energy contribution for a fix external instance with the given ID. + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_set_force` to also set the contribution +to the per-atom energy from the external code. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param eng energy to be added to the per-atom energy */ + +void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng) +{ + LAMMPS *lmp = (LAMMPS *) handle; + + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,"Can not find fix with ID '{}'!", id); + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); + + FixExternal *fext = (FixExternal*) fix; + fext->set_energy_peratom(eng); + } + END_CAPTURE +} + +/** Set the per-atom virial contribution for a fix external instance with the given ID. + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_set_force` to also set the contribution +to the per-atom virial from the external code. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param virial the 6 per-atom stress tensor components to be added to the per-atom virial */ + +void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial) +{ + LAMMPS *lmp = (LAMMPS *) handle; + + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,"Can not find fix with ID '{}'!", id); + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); + + FixExternal * fext = (FixExternal*) fix; + fext->set_virial_peratom(virial); + } + END_CAPTURE +} + /* ---------------------------------------------------------------------- */ /** Free memory buffer allocated by LAMMPS. diff --git a/src/library.h b/src/library.h index 2732314771..25b5199dc7 100644 --- a/src/library.h +++ b/src/library.h @@ -226,16 +226,21 @@ void lammps_decode_image_flags(int64_t image, int *flags); #if defined(LAMMPS_BIGBIG) typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); -void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr funcptr, void *ptr); +void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr); #elif defined(LAMMPS_SMALLBIG) typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **); -void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void *); +void lammps_set_fix_external_callback(void *, const char *, FixExternalFnPtr, void *); #else typedef void (*FixExternalFnPtr)(void *, int, int, int *, double **, double **); -void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void *); +void lammps_set_fix_external_callback(void *, const char *, FixExternalFnPtr, void *); #endif -void lammps_fix_external_set_energy_global(void *, char *, double); -void lammps_fix_external_set_virial_global(void *, char *, double *); +double **lammps_fix_external_get_force(void *handle, const char *id); +void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng); +void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng); +void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial); +void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial); +void lammps_fix_external_set_vector_length(void *handle, const char *id, int len); +void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **val); void lammps_free(void *ptr); diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index 78ed91195c..f6f126c2b8 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -24,14 +24,17 @@ typedef int32_t tag_t; typedef int64_t step_t; typedef int64_t tag_t; #endif -static void callback_one(void *lmp, step_t timestep, int nlocal, tag_t *ids, double **x, double **f) +static void callback_one(void *handle, step_t timestep, int nlocal, tag_t *, double **, double **f) { for (int i = 0; i < nlocal; ++i) f[i][0] = f[i][1] = f[i][2] = (double)timestep; + lammps_fix_external_set_energy_global(handle, "ext", 1.0); + double v[6] = {1.0,1.0,1.0,0.0,0.0,0.0 }; + lammps_fix_external_set_virial_global(handle, "ext", v); } } -TEST(lammps_external_pf, null_args) +TEST(lammps_external, callback) { const char *args[] = {"liblammps", "-log", "none", "-nocite"}; char **argv = (char **)args; @@ -53,18 +56,78 @@ TEST(lammps_external_pf, null_args) "velocity all set 0.1 0.0 -0.1\n" "thermo 5\n" "fix 1 all nve\n" - "fix ext all external pf/callback 5 1\n"); + "fix ext all external pf/callback 5 1\n" + "fix_modify ext energy yes virial yes\n"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ::testing::internal::CaptureStdout(); - lammps_set_fix_external_callback(handle, (char *)"ext", &callback_one, handle); + lammps_set_fix_external_callback(handle, "ext", &callback_one, handle); lammps_command(handle, "run 10 post no"); - double temp = lammps_get_thermo(handle,"temp"); - output = ::testing::internal::GetCapturedStdout(); + double temp = lammps_get_thermo(handle, "temp"); + double pe = lammps_get_thermo(handle, "pe"); + double press = lammps_get_thermo(handle, "press"); + output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; - EXPECT_DOUBLE_EQ(temp,1.0/30.0); + EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); + EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); + EXPECT_DOUBLE_EQ(press, 0.15416666666666667); + + ::testing::internal::CaptureStdout(); + lammps_close(handle); + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; +} + +TEST(lammps_external, array) +{ + const char *args[] = {"liblammps", "-log", "none", "-nocite"}; + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); + + ::testing::internal::CaptureStdout(); + void *handle = lammps_open_no_mpi(argc, argv, NULL); + std::string output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + ::testing::internal::CaptureStdout(); + lammps_commands_string(handle, "lattice sc 1.0\n" + "region box block -1 1 -1 1 -1 1\n" + "create_box 1 box\n" + "create_atoms 1 box\n" + "mass 1 1.0\n" + "pair_style zero 0.1\n" + "pair_coeff 1 1\n" + "velocity all set 0.1 0.0 -0.1\n" + "thermo 5\n" + "fix 1 all nve\n" + "fix ext all external pf/array 1\n"); + + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + ::testing::internal::CaptureStdout(); + double **force = lammps_fix_external_get_force(handle, "ext"); + int nlocal = lammps_extract_setting(handle, "nlocal"); + for (int i = 0; i < nlocal; ++i) + force[i][0] = force[i][1] = force[i][2] = 0.0; + lammps_command(handle, "run 5 post no"); + double temp = lammps_get_thermo(handle, "temp"); + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + EXPECT_DOUBLE_EQ(temp, 4.0 / 525.0); + + ::testing::internal::CaptureStdout(); + nlocal = lammps_extract_setting(handle, "nlocal"); + force = lammps_fix_external_get_force(handle, "ext"); + for (int i = 0; i < nlocal; ++i) + force[i][0] = force[i][1] = force[i][2] = 6.0; + lammps_command(handle, "run 5 post no"); + temp = lammps_get_thermo(handle, "temp"); + output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); ::testing::internal::CaptureStdout(); lammps_close(handle); diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index badc9e5731..4f589bb5f6 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -36,6 +36,47 @@ class PythonExternal(unittest.TestCase): lmp.command("run 10 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) + def testExternalArray(self): + """Test fix external from Python with pf/array""" + + machine=None + if 'LAMMPS_MACHINE_NAME' in os.environ: + machine=os.environ['LAMMPS_MACHINE_NAME'] + lmp=lammps(name=machine, cmdargs=['-nocite', '-log','none', '-echo', 'screen']) + + # a few commands to set up simple system + basic_system="""lattice sc 1.0 + region box block -1 1 -1 1 -1 1 + create_box 1 box + create_atoms 1 box + mass 1 1.0 + pair_style zero 0.1 + pair_coeff 1 1 + velocity all set 0.1 0.0 -0.1 + thermo 5 + fix 1 all nve + fix ext all external pf/array 1 +""" + lmp.commands_string(basic_system) + force = lmp.fix_external_get_force("ext"); + nlocal = lmp.extract_setting("nlocal"); + for i in range(nlocal): + force[i][0] = 0.0 + force[i][1] = 0.0 + force[i][2] = 0.0 + + lmp.command("run 5 post no") + self.assertAlmostEqual(lmp.get_thermo("temp"),4.0/525.0,14) + + force = lmp.fix_external_get_force("ext"); + nlocal = lmp.extract_setting("nlocal"); + for i in range(nlocal): + force[i][0] = 6.0 + force[i][1] = 6.0 + force[i][2] = 6.0 + lmp.command("run 5 post no") + self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) + ############################## if __name__ == "__main__": unittest.main() From 5912d0a1c2d86333478aea3399488a3cb11051ab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 17:43:44 -0400 Subject: [PATCH 083/119] add support for setting global energy for fix external to python module --- python/lammps/core.py | 17 +++++++++++++++++ unittest/c-library/test_library_external.cpp | 13 ++++++++----- unittest/python/python-fix-external.py | 5 +++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 5079828ba8..44cd51bb33 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1791,6 +1791,23 @@ class lammps(object): # ------------------------------------------------------------------------- + def fix_external_set_energy_global(self, fix_id, eng): + """Get access to that array with per-atom forces of a fix external instance with a given fix ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eng: potential energy to be added by fix external + :type: float + """ + + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_energy_global(self.lmp, fix_id.encode(), eng) + + # ------------------------------------------------------------------------- + def get_neighlist(self, idx): """Returns an instance of :class:`NeighList` which wraps access to the neighbor list with the given index diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index f6f126c2b8..7c53daaef7 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -28,8 +28,11 @@ static void callback_one(void *handle, step_t timestep, int nlocal, tag_t *, dou { for (int i = 0; i < nlocal; ++i) f[i][0] = f[i][1] = f[i][2] = (double)timestep; - lammps_fix_external_set_energy_global(handle, "ext", 1.0); - double v[6] = {1.0,1.0,1.0,0.0,0.0,0.0 }; + if (timestep < 10) + lammps_fix_external_set_energy_global(handle, "ext", 0.0); + else + lammps_fix_external_set_energy_global(handle, "ext", 1.0); + double v[6] = {1.0, 1.0, 1.0, 0.0, 0.0, 0.0}; lammps_fix_external_set_virial_global(handle, "ext", v); } } @@ -65,10 +68,10 @@ TEST(lammps_external, callback) ::testing::internal::CaptureStdout(); lammps_set_fix_external_callback(handle, "ext", &callback_one, handle); lammps_command(handle, "run 10 post no"); - double temp = lammps_get_thermo(handle, "temp"); - double pe = lammps_get_thermo(handle, "pe"); + double temp = lammps_get_thermo(handle, "temp"); + double pe = lammps_get_thermo(handle, "pe"); double press = lammps_get_thermo(handle, "press"); - output = ::testing::internal::GetCapturedStdout(); + output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index 4f589bb5f6..02fe805626 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -8,6 +8,10 @@ def callback_one(lmp, ntimestep, nlocal, tag, x, f): f[i][0] = float(ntimestep) f[i][1] = float(ntimestep) f[i][2] = float(ntimestep) + if ntimestep < 10: + lmp.fix_external_set_energy_global("ext",0.5) + else: + lmp.fix_external_set_energy_global("ext",1.0) class PythonExternal(unittest.TestCase): def testExternalCallback(self): @@ -35,6 +39,7 @@ class PythonExternal(unittest.TestCase): lmp.set_fix_external_callback("ext",callback_one,lmp) lmp.command("run 10 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) + self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) def testExternalArray(self): """Test fix external from Python with pf/array""" From ba5bf0fb775c5acaa5f29f2738f95c88daff699e Mon Sep 17 00:00:00 2001 From: kipbarrett Date: Fri, 16 Jul 2021 17:37:06 -0500 Subject: [PATCH 084/119] plugged memory leaks. Resolves [2811] --- src/ML-RANN/pair_rann.cpp | 23 ++++++++++++++----- src/ML-RANN/rann_fingerprint_bond.cpp | 1 + src/ML-RANN/rann_fingerprint_bondscreened.cpp | 1 + .../rann_fingerprint_bondscreenedspin.cpp | 1 + src/ML-RANN/rann_fingerprint_bondspin.cpp | 1 + 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index f0d1dec876..7b1a5a4317 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -110,22 +110,30 @@ PairRANN::~PairRANN() for (int j=0;j0) { + for (int j=0;jdestroy(dssumy); memory->destroy(dssumz); } + memory->destroy(setflag); + memory->destroy(cutsq); } void PairRANN::allocate(const std::vector &elementwords) @@ -305,6 +315,7 @@ void PairRANN::read_file(char *filename) ptr=fgets(linetemp,longline,fp); linenum++; if (ptr == nullptr) { + fclose(fp); if (check_potential()) { error->one(FLERR,"Invalid syntax in potential file, values are inconsistent or missing"); } @@ -478,10 +489,8 @@ void PairRANN::read_network_layers(std::vector line,std::vector line,std::vector line,std::vector line1,FILE* fp,char *filename,int *linenum) { int i,j,l; - char linetemp[MAXLINE]; + char linetemp[MAXLINE],*ptr; for (l=0;lone(filename,*linenum-1,"networklayers must be defined before biases."); @@ -558,7 +567,8 @@ void PairRANN::read_bias(std::vector line,std::vector net[l].Biases[i] = new double [net[l].dimensions[i+1]]; net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); for (j=1;jone(filename,*linenum,"unexpected end of potential file!"); (*linenum)++; Tokenizer values1 = Tokenizer(linetemp,": ,\t_\n"); line1 = values1.as_vector(); @@ -832,6 +842,7 @@ void PairRANN::compute(int eflag, int vflag) } } if (vflag_fdotr) virial_fdotr_compute(); + delete [] sims; } void PairRANN::cull_neighbor_list(int* jnum,int i,int sn) { diff --git a/src/ML-RANN/rann_fingerprint_bond.cpp b/src/ML-RANN/rann_fingerprint_bond.cpp index bf14828a7b..88291921a0 100644 --- a/src/ML-RANN/rann_fingerprint_bond.cpp +++ b/src/ML-RANN/rann_fingerprint_bond.cpp @@ -282,6 +282,7 @@ void Fingerprint_bond::generate_coefficients() { //calculates multinomial c coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } + delete [] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.cpp b/src/ML-RANN/rann_fingerprint_bondscreened.cpp index 59fed322a3..c26e9cd18e 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreened.cpp @@ -283,6 +283,7 @@ void Fingerprint_bondscreened::generate_coefficients() { //calculates multi coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } + delete [] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp index 0728b6a295..b30865a96d 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp @@ -285,6 +285,7 @@ void Fingerprint_bondscreenedspin::generate_coefficients() { //calculates m coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } + delete [] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondspin.cpp b/src/ML-RANN/rann_fingerprint_bondspin.cpp index 1005818217..990bf12d78 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondspin.cpp @@ -283,6 +283,7 @@ void Fingerprint_bondspin::generate_coefficients() { //calculates multinomi coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } + delete [] M; } From 626b93cfbb5d3fd4d7c91a2670971128717defd5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 21:44:53 -0400 Subject: [PATCH 085/119] plug memory leak for alpha/alpha_k parameter --- src/ML-RANN/rann_fingerprint_bond.cpp | 1 + src/ML-RANN/rann_fingerprint_bondscreened.cpp | 1 + src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp | 1 + src/ML-RANN/rann_fingerprint_bondspin.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/src/ML-RANN/rann_fingerprint_bond.cpp b/src/ML-RANN/rann_fingerprint_bond.cpp index 88291921a0..1adcb5da19 100644 --- a/src/ML-RANN/rann_fingerprint_bond.cpp +++ b/src/ML-RANN/rann_fingerprint_bond.cpp @@ -156,6 +156,7 @@ void Fingerprint_bond::init(int *i,int _id) { rc = 0; mlength = 0; kmax = 0; + delete[] alpha_k; alpha_k = new double [1]; alpha_k[0]=-1; empty = false; diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.cpp b/src/ML-RANN/rann_fingerprint_bondscreened.cpp index c26e9cd18e..e4c50cd1d0 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreened.cpp @@ -156,6 +156,7 @@ void Fingerprint_bondscreened::init(int *i,int _id) { rc = 0; mlength = 0; kmax = 0; + delete[] alpha_k; alpha_k = new double [1]; alpha_k[0]=-1; empty = false; diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp index b30865a96d..123e91439e 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp @@ -158,6 +158,7 @@ void Fingerprint_bondscreenedspin::init(int *i,int _id) { rc = 0; mlength = 0; kmax = 0; + delete[] alpha_k; alpha_k = new double [1]; alpha_k[0]=-1; empty = false; diff --git a/src/ML-RANN/rann_fingerprint_bondspin.cpp b/src/ML-RANN/rann_fingerprint_bondspin.cpp index 990bf12d78..7dfeb2d44c 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondspin.cpp @@ -157,6 +157,7 @@ void Fingerprint_bondspin::init(int *i,int _id) { rc = 0; mlength = 0; kmax = 0; + delete[] alpha_k; alpha_k = new double [1]; alpha_k[0]=-1; empty = false; From 0ddd90fe0ff341c7763b11f515c67f91cfaa67ad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 21:50:56 -0400 Subject: [PATCH 086/119] reformat allocations and deallocations --- src/ML-RANN/pair_rann.cpp | 64 +++++++++---------- src/ML-RANN/rann_fingerprint_bond.cpp | 46 ++++++------- src/ML-RANN/rann_fingerprint_bondscreened.cpp | 46 ++++++------- .../rann_fingerprint_bondscreenedspin.cpp | 46 ++++++------- src/ML-RANN/rann_fingerprint_bondspin.cpp | 46 ++++++------- src/ML-RANN/rann_fingerprint_radial.cpp | 22 +++---- .../rann_fingerprint_radialscreened.cpp | 22 +++---- .../rann_fingerprint_radialscreenedspin.cpp | 22 +++---- src/ML-RANN/rann_fingerprint_radialspin.cpp | 22 +++---- 9 files changed, 168 insertions(+), 168 deletions(-) diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index 7b1a5a4317..95e4d1af58 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -100,45 +100,45 @@ PairRANN::PairRANN(LAMMPS *lmp) : Pair(lmp) PairRANN::~PairRANN() { //clear memory - delete [] mass; + delete[] mass; for (int i=0;i0) { for (int j=0;j0) { for (int j=0;jdestroy(xn); memory->destroy(yn); memory->destroy(zn); @@ -207,10 +207,10 @@ void PairRANN::allocate(const std::vector &elementwords) activation = new RANN::Activation**[nelementsp]; fingerprints = new RANN::Fingerprint**[nelementsp]; fingerprintlength = new int[nelementsp]; - fingerprintperelement = new int [nelementsp]; + fingerprintperelement = new int[nelementsp]; fingerprintcount = new int[nelementsp]; - screening_min = new double [nelements*nelements*nelements]; - screening_max = new double [nelements*nelements*nelements]; + screening_min = new double[nelements*nelements*nelements]; + screening_max = new double[nelements*nelements*nelements]; for (i=0;intypes+1]; + map = new int[atom->ntypes+1]; if (narg != 3 + atom->ntypes) error->one(FLERR,"Incorrect args for pair coefficients"); if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->one(FLERR,"Incorrect args for pair coefficients"); nelements = -1; @@ -483,10 +483,10 @@ void PairRANN::read_network_layers(std::vector line,std::vectorone(filename,linenum,"invalid number of network layers"); - delete [] net[i].dimensions; + delete[] net[i].dimensions; weightdefined[i] = new bool [net[i].layers]; biasdefined[i] = new bool [net[i].layers]; - net[i].dimensions = new int [net[i].layers]; + net[i].dimensions = new int[net[i].layers]; net[i].Weights = new double * [net[i].layers-1]; net[i].Biases = new double * [net[i].layers-1]; for (j=0;j line,std::vector=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid weight layer"); if (net[l].dimensions[i]==0 || net[l].dimensions[i+1]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding weight"); - net[l].Weights[i] = new double [net[l].dimensions[i]*net[l].dimensions[i+1]]; + net[l].Weights[i] = new double[net[l].dimensions[i]*net[l].dimensions[i+1]]; weightdefined[l][i] = true; nwords = line1.size(); if (nwords != net[l].dimensions[i])error->one(filename,*linenum,"invalid weights per line"); @@ -564,7 +564,7 @@ void PairRANN::read_bias(std::vector line,std::vector if (i>=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid bias layer"); if (net[l].dimensions[i]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding bias"); biasdefined[l][i] = true; - net[l].Biases[i] = new double [net[l].dimensions[i+1]]; + net[l].Biases[i] = new double[net[l].dimensions[i+1]]; net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); for (j=1;jallscreen = false; } Fingerprint_bond::~Fingerprint_bond() { - delete [] alpha_k; - delete [] atomtypes; - delete [] expcuttable; - delete [] dfctable; + delete[] alpha_k; + delete[] atomtypes; + delete[] expcuttable; + delete[] dfctable; for (int i=0;i<(mlength*(mlength+1))>>1;i++) { - delete [] coeff[i]; - delete [] coeffx[i]; - delete [] coeffy[i]; - delete [] coeffz[i]; - delete [] Mf[i]; + delete[] coeff[i]; + delete[] coeffx[i]; + delete[] coeffy[i]; + delete[] coeffz[i]; + delete[] Mf[i]; } - delete [] coeff; - delete [] coeffx; - delete [] coeffy; - delete [] coeffz; - delete [] Mf; - delete [] rinvsqrttable; + delete[] coeff; + delete[] coeffx; + delete[] coeffy; + delete[] coeffz; + delete[] Mf; + delete[] rinvsqrttable; } bool Fingerprint_bond::parse_values(std::string constant,std::vector line1) { @@ -81,8 +81,8 @@ bool Fingerprint_bond::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - expcuttable = new double [(res+buf)*(kmax)]; - dfctable = new double [res+buf]; + expcuttable = new double[(res+buf)*(kmax)]; + dfctable = new double[res+buf]; for (m=0;m<(res+buf);m++) { r1 = cutmax*cutmax*(double)(m)/(double)(res); for (n=0;n<(kmax);n++) { @@ -283,7 +283,7 @@ void Fingerprint_bond::generate_coefficients() { //calculates multinomial c coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } - delete [] M; + delete[] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.cpp b/src/ML-RANN/rann_fingerprint_bondscreened.cpp index e4c50cd1d0..2ed63a3655 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreened.cpp @@ -39,36 +39,36 @@ Fingerprint_bondscreened::Fingerprint_bondscreened(PairRANN *_pair) : Fingerprin dr = 0; re = 0; rc = 0; - alpha_k = new double [1]; + alpha_k = new double[1]; alpha_k[0] = -1; kmax = 0; mlength = 0; id = -1; style = "bondscreened"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; _pair->doscreen = true; screen = true; } Fingerprint_bondscreened::~Fingerprint_bondscreened() { - delete [] alpha_k; - delete [] atomtypes; - delete [] expcuttable; - delete [] dfctable; + delete[] alpha_k; + delete[] atomtypes; + delete[] expcuttable; + delete[] dfctable; for (int i=0;i<(mlength*(mlength+1))>>1;i++) { - delete [] coeff[i]; - delete [] coeffx[i]; - delete [] coeffy[i]; - delete [] coeffz[i]; - delete [] Mf[i]; + delete[] coeff[i]; + delete[] coeffx[i]; + delete[] coeffy[i]; + delete[] coeffz[i]; + delete[] Mf[i]; } - delete [] coeff; - delete [] coeffx; - delete [] coeffy; - delete [] coeffz; - delete [] Mf; - delete [] rinvsqrttable; + delete[] coeff; + delete[] coeffx; + delete[] coeffy; + delete[] coeffz; + delete[] Mf; + delete[] rinvsqrttable; } bool Fingerprint_bondscreened::parse_values(std::string constant,std::vector line1) { @@ -81,8 +81,8 @@ bool Fingerprint_bondscreened::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - expcuttable = new double [(res+buf)*(kmax)]; - dfctable = new double [res+buf]; + expcuttable = new double[(res+buf)*(kmax)]; + dfctable = new double[res+buf]; for (m=0;m<(res+buf);m++) { r1 = cutmax*cutmax*(double)(m)/(double)(res); for (n=0;n<(kmax);n++) { @@ -284,7 +284,7 @@ void Fingerprint_bondscreened::generate_coefficients() { //calculates multi coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } - delete [] M; + delete[] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp index 123e91439e..49829b41a1 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp @@ -39,13 +39,13 @@ Fingerprint_bondscreenedspin::Fingerprint_bondscreenedspin(PairRANN *_pair) : Fi dr = 0; re = 0; rc = 0; - alpha_k = new double [1]; + alpha_k = new double[1]; alpha_k[0] = -1; kmax = 0; mlength = 0; id = -1; style = "bondscreenedspin"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; _pair->doscreen = true; screen = true; @@ -54,23 +54,23 @@ Fingerprint_bondscreenedspin::Fingerprint_bondscreenedspin(PairRANN *_pair) : Fi } Fingerprint_bondscreenedspin::~Fingerprint_bondscreenedspin() { - delete [] alpha_k; - delete [] atomtypes; - delete [] expcuttable; - delete [] dfctable; + delete[] alpha_k; + delete[] atomtypes; + delete[] expcuttable; + delete[] dfctable; for (int i=0;i<(mlength*(mlength+1))>>1;i++) { - delete [] coeff[i]; - delete [] coeffx[i]; - delete [] coeffy[i]; - delete [] coeffz[i]; - delete [] Mf[i]; + delete[] coeff[i]; + delete[] coeffx[i]; + delete[] coeffy[i]; + delete[] coeffz[i]; + delete[] Mf[i]; } - delete [] coeff; - delete [] coeffx; - delete [] coeffy; - delete [] coeffz; - delete [] Mf; - delete [] rinvsqrttable; + delete[] coeff; + delete[] coeffx; + delete[] coeffy; + delete[] coeffz; + delete[] Mf; + delete[] rinvsqrttable; } bool Fingerprint_bondscreenedspin::parse_values(std::string constant,std::vector line1) { @@ -83,8 +83,8 @@ bool Fingerprint_bondscreenedspin::parse_values(std::string constant,std::vector rc = strtod(line1[0].c_str(),NULL); } else if (constant.compare("alphak")==0) { - delete [] alpha_k; - alpha_k = new double [nwords]; + delete[] alpha_k; + alpha_k = new double[nwords]; for (l=0;lres; double cutmax = pair->cutmax; - expcuttable = new double [(res+buf)*(kmax)]; - dfctable = new double [res+buf]; + expcuttable = new double[(res+buf)*(kmax)]; + dfctable = new double[res+buf]; for (m=0;m<(res+buf);m++) { r1 = cutmax*cutmax*(double)(m)/(double)(res); for (n=0;n<(kmax);n++) { @@ -286,7 +286,7 @@ void Fingerprint_bondscreenedspin::generate_coefficients() { //calculates m coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } - delete [] M; + delete[] M; } diff --git a/src/ML-RANN/rann_fingerprint_bondspin.cpp b/src/ML-RANN/rann_fingerprint_bondspin.cpp index 7dfeb2d44c..452846cfb1 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondspin.cpp @@ -39,13 +39,13 @@ Fingerprint_bondspin::Fingerprint_bondspin(PairRANN *_pair) : Fingerprint(_pair) dr = 0; re = 0; rc = 0; - alpha_k = new double [1]; + alpha_k = new double[1]; alpha_k[0] = -1; kmax = 0; mlength = 0; id = -1; style = "bondspin"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; _pair->allscreen = false; _pair->dospin = true; @@ -53,23 +53,23 @@ Fingerprint_bondspin::Fingerprint_bondspin(PairRANN *_pair) : Fingerprint(_pair) } Fingerprint_bondspin::~Fingerprint_bondspin() { - delete [] alpha_k; - delete [] atomtypes; - delete [] expcuttable; - delete [] dfctable; + delete[] alpha_k; + delete[] atomtypes; + delete[] expcuttable; + delete[] dfctable; for (int i=0;i<(mlength*(mlength+1))>>1;i++) { - delete [] coeff[i]; - delete [] coeffx[i]; - delete [] coeffy[i]; - delete [] coeffz[i]; - delete [] Mf[i]; + delete[] coeff[i]; + delete[] coeffx[i]; + delete[] coeffy[i]; + delete[] coeffz[i]; + delete[] Mf[i]; } - delete [] coeff; - delete [] coeffx; - delete [] coeffy; - delete [] coeffz; - delete [] Mf; - delete [] rinvsqrttable; + delete[] coeff; + delete[] coeffx; + delete[] coeffy; + delete[] coeffz; + delete[] Mf; + delete[] rinvsqrttable; } bool Fingerprint_bondspin::parse_values(std::string constant,std::vector line1) { @@ -82,8 +82,8 @@ bool Fingerprint_bondspin::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - expcuttable = new double [(res+buf)*(kmax)]; - dfctable = new double [res+buf]; + expcuttable = new double[(res+buf)*(kmax)]; + dfctable = new double[res+buf]; for (m=0;m<(res+buf);m++) { r1 = cutmax*cutmax*(double)(m)/(double)(res); for (n=0;n<(kmax);n++) { @@ -284,7 +284,7 @@ void Fingerprint_bondspin::generate_coefficients() { //calculates multinomi coeff[p1][p] = pair->factorial(p)/pair->factorial(coeffx[p1][p])/pair->factorial(coeffy[p1][p])/pair->factorial(coeffz[p1][p]); } } - delete [] M; + delete[] M; } diff --git a/src/ML-RANN/rann_fingerprint_radial.cpp b/src/ML-RANN/rann_fingerprint_radial.cpp index f468ee2f6c..93cab2f363 100644 --- a/src/ML-RANN/rann_fingerprint_radial.cpp +++ b/src/ML-RANN/rann_fingerprint_radial.cpp @@ -41,13 +41,13 @@ Fingerprint_radial::Fingerprint_radial(PairRANN *_pair) : Fingerprint(_pair) dr = 0; re = 0; rc = 0; - alpha = new double [1]; + alpha = new double[1]; alpha[0] = -1; nmax = 0; omin = 0; id = -1; style = "radial"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; fullydefined = false; _pair->allscreen = false; @@ -55,11 +55,11 @@ Fingerprint_radial::Fingerprint_radial(PairRANN *_pair) : Fingerprint(_pair) Fingerprint_radial::~Fingerprint_radial() { - delete [] atomtypes; - delete [] radialtable; - delete [] alpha; - delete [] dfctable; - delete [] rinvsqrttable; + delete[] atomtypes; + delete[] radialtable; + delete[] alpha; + delete[] dfctable; + delete[] rinvsqrttable; } bool Fingerprint_radial::parse_values(std::string constant,std::vector line1) { @@ -72,8 +72,8 @@ bool Fingerprint_radial::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - radialtable = new double [(res+buf)*get_length()]; - dfctable = new double [res+buf]; + radialtable = new double[(res+buf)*get_length()]; + dfctable = new double[res+buf]; for (k=0;k<(res+buf);k++) { r1 = cutmax*cutmax*(double)(k)/(double)(res); for (m=0;m<=(nmax-omin);m++) { diff --git a/src/ML-RANN/rann_fingerprint_radialscreened.cpp b/src/ML-RANN/rann_fingerprint_radialscreened.cpp index 126b83fc51..a933703db8 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_radialscreened.cpp @@ -41,13 +41,13 @@ Fingerprint_radialscreened::Fingerprint_radialscreened(PairRANN *_pair) : Finger dr = 0; re = 0; rc = 0; - alpha = new double [1]; + alpha = new double[1]; alpha[0] = -1; nmax = 0; omin = 0; id = -1; style = "radialscreened"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; fullydefined = false; _pair->doscreen = true; @@ -56,11 +56,11 @@ Fingerprint_radialscreened::Fingerprint_radialscreened(PairRANN *_pair) : Finger Fingerprint_radialscreened::~Fingerprint_radialscreened() { - delete [] atomtypes; - delete [] radialtable; - delete [] alpha; - delete [] dfctable; - delete [] rinvsqrttable; + delete[] atomtypes; + delete[] radialtable; + delete[] alpha; + delete[] dfctable; + delete[] rinvsqrttable; } bool Fingerprint_radialscreened::parse_values(std::string constant,std::vector line1) { @@ -73,8 +73,8 @@ bool Fingerprint_radialscreened::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - radialtable = new double [(res+buf)*get_length()]; - dfctable = new double [res+buf]; + radialtable = new double[(res+buf)*get_length()]; + dfctable = new double[res+buf]; for (k=0;k<(res+buf);k++) { r1 = cutmax*cutmax*(double)(k)/(double)(res); for (m=0;m<=(nmax-omin);m++) { diff --git a/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp index 11674190fb..ecd0e4a2f0 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp @@ -40,13 +40,13 @@ Fingerprint_radialscreenedspin::Fingerprint_radialscreenedspin(PairRANN *_pair) dr = 0; re = 0; rc = 0; - alpha = new double [1]; + alpha = new double[1]; alpha[0] = -1; nmax = 0; omin = 0; id = -1; style = "radialscreenedspin"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; fullydefined = false; _pair->doscreen = true; @@ -57,11 +57,11 @@ Fingerprint_radialscreenedspin::Fingerprint_radialscreenedspin(PairRANN *_pair) Fingerprint_radialscreenedspin::~Fingerprint_radialscreenedspin() { - delete [] atomtypes; - delete [] radialtable; - delete [] alpha; - delete [] dfctable; - delete [] rinvsqrttable; + delete[] atomtypes; + delete[] radialtable; + delete[] alpha; + delete[] dfctable; + delete[] rinvsqrttable; } bool Fingerprint_radialscreenedspin::parse_values(std::string constant,std::vector line1) { @@ -74,8 +74,8 @@ bool Fingerprint_radialscreenedspin::parse_values(std::string constant,std::vect rc = strtod(line1[0].c_str(),NULL); } else if (constant.compare("alpha")==0) { - delete [] alpha; - alpha = new double [nwords]; + delete[] alpha; + alpha = new double[nwords]; for (l=0;lres; double cutmax = pair->cutmax; - radialtable = new double [(res+buf)*get_length()]; - dfctable = new double [res+buf]; + radialtable = new double[(res+buf)*get_length()]; + dfctable = new double[res+buf]; for (k=0;k<(res+buf);k++) { r1 = cutmax*cutmax*(double)(k)/(double)(res); for (m=0;m<=(nmax-omin);m++) { diff --git a/src/ML-RANN/rann_fingerprint_radialspin.cpp b/src/ML-RANN/rann_fingerprint_radialspin.cpp index 2d0a2f68f1..137f7ac162 100644 --- a/src/ML-RANN/rann_fingerprint_radialspin.cpp +++ b/src/ML-RANN/rann_fingerprint_radialspin.cpp @@ -40,13 +40,13 @@ Fingerprint_radialspin::Fingerprint_radialspin(PairRANN *_pair) : Fingerprint(_p dr = 0; re = 0; rc = 0; - alpha = new double [1]; + alpha = new double[1]; alpha[0] = -1; nmax = 0; omin = 0; id = -1; style = "radialspin"; - atomtypes = new int [n_body_type]; + atomtypes = new int[n_body_type]; empty = true; fullydefined = false; _pair->allscreen = false; @@ -56,11 +56,11 @@ Fingerprint_radialspin::Fingerprint_radialspin(PairRANN *_pair) : Fingerprint(_p Fingerprint_radialspin::~Fingerprint_radialspin() { - delete [] atomtypes; - delete [] radialtable; - delete [] alpha; - delete [] dfctable; - delete [] rinvsqrttable; + delete[] atomtypes; + delete[] radialtable; + delete[] alpha; + delete[] dfctable; + delete[] rinvsqrttable; } bool Fingerprint_radialspin::parse_values(std::string constant,std::vector line1) { @@ -73,8 +73,8 @@ bool Fingerprint_radialspin::parse_values(std::string constant,std::vectorres; double cutmax = pair->cutmax; - radialtable = new double [(res+buf)*get_length()]; - dfctable = new double [res+buf]; + radialtable = new double[(res+buf)*get_length()]; + dfctable = new double[res+buf]; for (k=0;k<(res+buf);k++) { r1 = cutmax*cutmax*(double)(k)/(double)(res); for (m=0;m<=(nmax-omin);m++) { From d462bb3131c70172ef61f3d07a86a6f4ae9dc46d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 22:44:04 -0400 Subject: [PATCH 087/119] fix off-by-one bug --- src/fix_external.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 4bc1e7eebc..26c852fbd0 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -254,7 +254,7 @@ void FixExternal::set_vector_length(int n) void FixExternal::set_vector(int index, double value) { - if (index >= size_vector) + if (index > size_vector) error->all(FLERR,"Invalid set_vector index in fix external"); caller_vector[index-1] = value; } From fa654f2270233fac4b586afa5c95d8363ce14917 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jul 2021 23:41:25 -0400 Subject: [PATCH 088/119] add support for set_vector for fix external in c-library, python and unittest --- .gitignore | 1 + doc/src/Library_utility.rst | 24 ++++++ python/lammps/core.py | 37 ++++++++ src/library.cpp | 90 ++++++++++++++++++-- src/library.h | 2 +- unittest/c-library/test_library_external.cpp | 31 +++++-- unittest/python/python-fix-external.py | 19 ++++- 7 files changed, 188 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 14d9dbebc9..b71a750c7d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ Thumbs.db /build* /CMakeCache.txt /CMakeFiles/ +/Testing /Makefile /cmake_install.cmake /lmp diff --git a/doc/src/Library_utility.rst b/doc/src/Library_utility.rst index 2748d418b6..32fac6bcc8 100644 --- a/doc/src/Library_utility.rst +++ b/doc/src/Library_utility.rst @@ -8,7 +8,11 @@ functions. They do not directly call the LAMMPS library. - :cpp:func:`lammps_decode_image_flags` - :cpp:func:`lammps_set_fix_external_callback` - :cpp:func:`lammps_fix_external_set_energy_global` +- :cpp:func:`lammps_fix_external_set_energy_peratom` - :cpp:func:`lammps_fix_external_set_virial_global` +- :cpp:func:`lammps_fix_external_set_virial_peratom` +- :cpp:func:`lammps_fix_external_set_vector_length` +- :cpp:func:`lammps_fix_external_set_vector` - :cpp:func:`lammps_free` - :cpp:func:`lammps_is_running` - :cpp:func:`lammps_force_timeout` @@ -43,11 +47,31 @@ where such memory buffers were allocated that require the use of ----------------------- +.. doxygenfunction:: lammps_fix_external_set_energy_peratom + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_fix_external_set_virial_global :project: progguide ----------------------- +.. doxygenfunction:: lammps_fix_external_set_virial_peratom + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_fix_external_set_vector_length + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_fix_external_set_vector + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_free :project: progguide diff --git a/python/lammps/core.py b/python/lammps/core.py index 44cd51bb33..05192b5f6e 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -303,6 +303,9 @@ class lammps(object): self.lib.lammps_fix_external_set_energy_peratom.argtypes = [c_void_p, c_char_p, POINTER(c_double)] self.lib.lammps_fix_external_set_virial_peratom.argtypes = [c_void_p, c_char_p, POINTER(POINTER(c_double))] + self.lib.lammps_fix_external_set_vector_length.argtypes = [c_void_p, c_char_p, c_int] + self.lib.lammps_fix_external_set_vector.argtypes = [c_void_p, c_char_p, c_int, c_double] + # detect if Python is using a version of mpi4py that can pass communicators # only needed if LAMMPS has been compiled with MPI support. self.has_mpi4py = False @@ -1806,6 +1809,40 @@ class lammps(object): with ExceptionCheck(self): return self.lib.lammps_fix_external_set_energy_global(self.lmp, fix_id.encode(), eng) + # ------------------------------------------------------------------------- + def fix_external_set_vector_length(self, fix_id, length): + """Set the vector length for a global vector stored with fix external for analysis + + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector_length` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param length: length of the global vector + :type: int + """ + + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_vector_length(self.lmp, fix_id.encode(), length) + + # ------------------------------------------------------------------------- + def fix_external_set_vector(self, fix_id, idx, val): + """Store a global vector value for a fix external instance with the given ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param idx: 1-based index of the value in the global vector + :type: int + :param val: value to be stored in the global vector + :type: float + """ + + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_vector(self.lmp, fix_id.encode(), idx, val) + # ------------------------------------------------------------------------- def get_neighlist(self, idx): diff --git a/src/library.cpp b/src/library.cpp index 4488114579..2c75657447 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4821,7 +4821,7 @@ mode. The function has to have C language bindings with the prototype: void func(void *ptr, bigint timestep, int nlocal, tagint *ids, double **x, double **fexternal); -This is an alternative to the array mechanism set up by :cpp:func:`lammps_fix_external_set_force`. +This is an alternative to the array mechanism set up by :cpp:func:`lammps_fix_external_get_force`. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4913,7 +4913,7 @@ double **lammps_fix_external_get_force(void *handle, const char *id) \verbatim embed:rst This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_set_force` to also set the contribution +:cpp:func:`lammps_fix_external_get_force` to also set the contribution to the global energy from the external code. Please see the documentation for :doc:`fix external ` for @@ -4952,7 +4952,7 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_set_force` to also set the contribution +:cpp:func:`lammps_fix_external_get_force` to also set the contribution to the global virial from the external code. Please see the documentation for :doc:`fix external ` for @@ -4991,7 +4991,7 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double \verbatim embed:rst This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_set_force` to also set the contribution +:cpp:func:`lammps_fix_external_get_force` to also set the contribution to the per-atom energy from the external code. Please see the documentation for :doc:`fix external ` for @@ -5030,7 +5030,7 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double \verbatim embed:rst This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_set_force` to also set the contribution +:cpp:func:`lammps_fix_external_get_force` to also set the contribution to the per-atom virial from the external code. Please see the documentation for :doc:`fix external ` for @@ -5064,6 +5064,86 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double END_CAPTURE } +/** Set the vector length for a global vector stored with fix external for analysis + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of +properties that will be stored with the fix via :cpp:func:`lammps_fix_external_set_vector`. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param len length of the global vector to be stored with the fix */ + +void lammps_fix_external_set_vector_length(void *handle, const char *id, int len) +{ + LAMMPS *lmp = (LAMMPS *) handle; + + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,"Can not find fix with ID '{}'!", id); + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); + + FixExternal *fext = (FixExternal*) fix; + fext->set_vector_length(len); + } + END_CAPTURE +} + +/** Store global vector for a fix external instance with the given ID. + +\verbatim embed:rst + +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and +:cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of +properties that will be stored with the fix. The length of the vector +must be set beforehand with :cpp:func:`lammps_fix_external_set_vector_length`. + +Please see the documentation for :doc:`fix external ` for +more information about how to use the fix and how to couple it with an +external code. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id fix ID of fix external instance + * \param idx 1 based index of in global vector + * \param val value to be stored in global vector */ + +void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val) +{ + LAMMPS *lmp = (LAMMPS *) handle; + + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,"Can not find fix with ID '{}'!", id); + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); + + FixExternal * fext = (FixExternal*) fix; + fext->set_vector(idx, val); + } + END_CAPTURE +} + /* ---------------------------------------------------------------------- */ /** Free memory buffer allocated by LAMMPS. diff --git a/src/library.h b/src/library.h index 25b5199dc7..654eda38fa 100644 --- a/src/library.h +++ b/src/library.h @@ -240,7 +240,7 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial); void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial); void lammps_fix_external_set_vector_length(void *handle, const char *id, int len); -void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **val); +void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val); void lammps_free(void *ptr); diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index 7c53daaef7..d44f3ff2ee 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -28,12 +28,20 @@ static void callback_one(void *handle, step_t timestep, int nlocal, tag_t *, dou { for (int i = 0; i < nlocal; ++i) f[i][0] = f[i][1] = f[i][2] = (double)timestep; - if (timestep < 10) - lammps_fix_external_set_energy_global(handle, "ext", 0.0); - else - lammps_fix_external_set_energy_global(handle, "ext", 1.0); + double v[6] = {1.0, 1.0, 1.0, 0.0, 0.0, 0.0}; lammps_fix_external_set_virial_global(handle, "ext", v); + if (timestep < 10) { + lammps_fix_external_set_energy_global(handle, "ext", 0.5); + lammps_fix_external_set_vector(handle, "ext", 1, timestep); + lammps_fix_external_set_vector(handle, "ext", 3, 1.0); + lammps_fix_external_set_vector(handle, "ext", 4, -0.25); + } else { + lammps_fix_external_set_energy_global(handle, "ext", 1.0); + lammps_fix_external_set_vector(handle, "ext", 2, timestep); + lammps_fix_external_set_vector(handle, "ext", 5, -1.0); + lammps_fix_external_set_vector(handle, "ext", 6, 0.25); + } } } @@ -57,11 +65,12 @@ TEST(lammps_external, callback) "pair_style zero 0.1\n" "pair_coeff 1 1\n" "velocity all set 0.1 0.0 -0.1\n" - "thermo 5\n" "fix 1 all nve\n" "fix ext all external pf/callback 5 1\n" + "thermo_style custom step temp pe ke etotal press\n" + "thermo 5\n" "fix_modify ext energy yes virial yes\n"); - + lammps_fix_external_set_vector_length(handle, "ext", 6); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; @@ -71,11 +80,19 @@ TEST(lammps_external, callback) double temp = lammps_get_thermo(handle, "temp"); double pe = lammps_get_thermo(handle, "pe"); double press = lammps_get_thermo(handle, "press"); - output = ::testing::internal::GetCapturedStdout(); + double val = 0.0; + double *valp; + for (int i = 0; i < 6; ++i) { + valp = (double *)lammps_extract_fix(handle, "ext", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, i, 0); + val += *valp; + lammps_free(valp); + } + output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); EXPECT_DOUBLE_EQ(press, 0.15416666666666667); + EXPECT_DOUBLE_EQ(val, 15); ::testing::internal::CaptureStdout(); lammps_close(handle); diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index 02fe805626..eab4687e2b 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -1,6 +1,6 @@ import sys,os,unittest from ctypes import * -from lammps import lammps +from lammps import lammps, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR # add timestep dependent force def callback_one(lmp, ntimestep, nlocal, tag, x, f): @@ -9,9 +9,15 @@ def callback_one(lmp, ntimestep, nlocal, tag, x, f): f[i][1] = float(ntimestep) f[i][2] = float(ntimestep) if ntimestep < 10: - lmp.fix_external_set_energy_global("ext",0.5) + lmp.fix_external_set_energy_global("ext", 0.5) + lmp.fix_external_set_vector("ext", 1, ntimestep) + lmp.fix_external_set_vector("ext", 3, 1.0) + lmp.fix_external_set_vector("ext", 4, -0.25) else: - lmp.fix_external_set_energy_global("ext",1.0) + lmp.fix_external_set_energy_global("ext", 1.0) + lmp.fix_external_set_vector("ext", 2, ntimestep) + lmp.fix_external_set_vector("ext", 5, -1.0) + lmp.fix_external_set_vector("ext", 6, 0.25) class PythonExternal(unittest.TestCase): def testExternalCallback(self): @@ -31,15 +37,22 @@ class PythonExternal(unittest.TestCase): pair_style zero 0.1 pair_coeff 1 1 velocity all set 0.1 0.0 -0.1 + thermo_style custom step temp pe ke etotal press thermo 5 fix 1 all nve fix ext all external pf/callback 5 1 + fix_modify ext energy yes virial yes """ lmp.commands_string(basic_system) + lmp.fix_external_set_vector_length("ext",6); lmp.set_fix_external_callback("ext",callback_one,lmp) lmp.command("run 10 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) + val = 0.0 + for i in range(0,6): + val += lmp.extract_fix("ext",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=i) + self.assertAlmostEqual(val,15.0,14) def testExternalArray(self): """Test fix external from Python with pf/array""" From f251bc544f90758a85819b9ecb6e4f4c31e58024 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jul 2021 07:38:53 -0400 Subject: [PATCH 089/119] support setting global virial for fix external from python --- python/lammps/core.py | 24 +++++++++++++++++++++--- src/library.cpp | 2 +- unittest/python/python-fix-external.py | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 05192b5f6e..9ea2530cdc 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1795,20 +1795,38 @@ class lammps(object): # ------------------------------------------------------------------------- def fix_external_set_energy_global(self, fix_id, eng): - """Get access to that array with per-atom forces of a fix external instance with a given fix ID. + """Set the global energy contribution for a fix external instance with the given ID. - This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_global` function of the C-library interface. :param fix_id: Fix-ID of a fix external instance :type: string - :param eng: potential energy to be added by fix external + :param eng: potential energy value to be added by fix external :type: float """ with ExceptionCheck(self): return self.lib.lammps_fix_external_set_energy_global(self.lmp, fix_id.encode(), eng) + # ------------------------------------------------------------------------- + + def fix_external_set_virial_global(self, fix_id, virial): + """Set the global virial contribution for a fix external instance with the given ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_global` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eng: list of 6 floating point numbers with the virial to be added by fix external + :type: float + """ + + cvirial = (6*c_double)(*virial) + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_virial_global(self.lmp, fix_id.encode(), cvirial) + # ------------------------------------------------------------------------- def fix_external_set_vector_length(self, fix_id, length): """Set the vector length for a global vector stored with fix external for analysis diff --git a/src/library.cpp b/src/library.cpp index 2c75657447..167c0c39b5 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -5103,7 +5103,7 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len END_CAPTURE } -/** Store global vector for a fix external instance with the given ID. +/** Store a global vector value for a fix external instance with the given ID. \verbatim embed:rst diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index eab4687e2b..1b46943b5a 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -4,6 +4,8 @@ from lammps import lammps, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR # add timestep dependent force def callback_one(lmp, ntimestep, nlocal, tag, x, f): + virial = [1.0, 1.0, 1.0, 0.0, 0.0, 0.0] + lmp.fix_external_set_virial_global("ext",virial) for i in range(nlocal): f[i][0] = float(ntimestep) f[i][1] = float(ntimestep) @@ -49,6 +51,7 @@ class PythonExternal(unittest.TestCase): lmp.command("run 10 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) + self.assertAlmostEqual(lmp.get_thermo("press"),0.15416666666666667,14) val = 0.0 for i in range(0,6): val += lmp.extract_fix("ext",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=i) From 8460d67eb200cb26ab335a85c84e557952cf3c6c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 19 Jul 2021 00:25:00 -0400 Subject: [PATCH 090/119] update embedded documentation to correctly describe the functionality --- src/library.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index 167c0c39b5..a6e4509c56 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4914,7 +4914,9 @@ double **lammps_fix_external_get_force(void *handle, const char *id) This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to also set the contribution -to the global energy from the external code. +to the global energy from the external code. The value of the *eng* +argument will be stored in the fix and applied on the current and all +following timesteps until changed. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4951,9 +4953,11 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst -This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_get_force` to also set the contribution -to the global virial from the external code. +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` +to set the contribution to the global virial from the external code +as part of the callback function. For this to work, the handle to the +LAMMPS object must be passed as the *ptr* argument when registering the +callback function. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4990,9 +4994,12 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double \verbatim embed:rst -This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_get_force` to also set the contribution -to the per-atom energy from the external code. +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` +to set the per-atom energy contribution due to the fix from the external code +as part of the callback function. For this to work, the handle to the +LAMMPS object must be passed as the *ptr* argument when registering the +callback function. No check is made whether the sum of the +contributions are consistent with any global added energy. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5029,9 +5036,12 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double \verbatim embed:rst -This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and -:cpp:func:`lammps_fix_external_get_force` to also set the contribution -to the per-atom virial from the external code. +This is a companion function to :cpp:func:`lammps_set_fix_external_callback` +to set the per-atom virial contribution due to the fix from the external code +as part of the callback function. For this to work, the handle to the +LAMMPS object must be passed as the *ptr* argument when registering the +callback function. No check is made whether the sum of the +contributions are consistent with any globally added virial components. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an From 1c4e8aba122e5d792788464bf5f88988aa91f348 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 19 Jul 2021 00:29:27 -0400 Subject: [PATCH 091/119] add tests for per-atom values, global energy with pf/array mode --- unittest/c-library/test_library_external.cpp | 45 +++++++++++++++++--- unittest/python/python-fix-external.py | 10 +++-- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index d44f3ff2ee..8acb7a43f4 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -24,7 +24,7 @@ typedef int32_t tag_t; typedef int64_t step_t; typedef int64_t tag_t; #endif -static void callback_one(void *handle, step_t timestep, int nlocal, tag_t *, double **, double **f) +static void callback(void *handle, step_t timestep, int nlocal, tag_t *, double **, double **f) { for (int i = 0; i < nlocal; ++i) f[i][0] = f[i][1] = f[i][2] = (double)timestep; @@ -42,6 +42,23 @@ static void callback_one(void *handle, step_t timestep, int nlocal, tag_t *, dou lammps_fix_external_set_vector(handle, "ext", 5, -1.0); lammps_fix_external_set_vector(handle, "ext", 6, 0.25); } + double *eatom = new double[nlocal]; + double **vatom = new double *[nlocal]; + vatom[0] = new double[nlocal * 6]; + eatom[0] = 0.0; + vatom[0][0] = vatom[0][1] = vatom[0][2] = vatom[0][3] = vatom[0][4] = vatom[0][5] = 0.0; + + for (int i = 1; i < nlocal; ++i) { + eatom[i] = 0.1 * i; + vatom[i] = vatom[0] + 6 * i; + vatom[i][0] = vatom[i][1] = vatom[i][2] = 0.1; + vatom[i][3] = vatom[i][4] = vatom[i][5] = -0.2; + } + lammps_fix_external_set_energy_peratom(handle, "ext", eatom); + lammps_fix_external_set_virial_peratom(handle, "ext", vatom); + delete[] eatom; + delete[] vatom[0]; + delete[] vatom; } } @@ -67,7 +84,10 @@ TEST(lammps_external, callback) "velocity all set 0.1 0.0 -0.1\n" "fix 1 all nve\n" "fix ext all external pf/callback 5 1\n" - "thermo_style custom step temp pe ke etotal press\n" + "compute eatm all pe/atom fix\n" + "compute vatm all stress/atom NULL fix\n" + "compute sum all reduce sum c_eatm c_vatm[*]\n" + "thermo_style custom step temp pe ke etotal press c_sum[*]\n" "thermo 5\n" "fix_modify ext energy yes virial yes\n"); lammps_fix_external_set_vector_length(handle, "ext", 6); @@ -75,7 +95,7 @@ TEST(lammps_external, callback) if (verbose) std::cout << output; ::testing::internal::CaptureStdout(); - lammps_set_fix_external_callback(handle, "ext", &callback_one, handle); + lammps_set_fix_external_callback(handle, "ext", &callback, handle); lammps_command(handle, "run 10 post no"); double temp = lammps_get_thermo(handle, "temp"); double pe = lammps_get_thermo(handle, "pe"); @@ -87,12 +107,21 @@ TEST(lammps_external, callback) val += *valp; lammps_free(valp); } + double *reduce = + (double *)lammps_extract_compute(handle, "sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); EXPECT_DOUBLE_EQ(press, 0.15416666666666667); EXPECT_DOUBLE_EQ(val, 15); + EXPECT_DOUBLE_EQ(reduce[0], 2.8); + EXPECT_DOUBLE_EQ(reduce[1], -0.7); + EXPECT_DOUBLE_EQ(reduce[2], -0.7); + EXPECT_DOUBLE_EQ(reduce[3], -0.7); + EXPECT_DOUBLE_EQ(reduce[4], 1.4); + EXPECT_DOUBLE_EQ(reduce[5], 1.4); + EXPECT_DOUBLE_EQ(reduce[6], 1.4); ::testing::internal::CaptureStdout(); lammps_close(handle); @@ -120,9 +149,9 @@ TEST(lammps_external, array) "pair_style zero 0.1\n" "pair_coeff 1 1\n" "velocity all set 0.1 0.0 -0.1\n" - "thermo 5\n" "fix 1 all nve\n" - "fix ext all external pf/array 1\n"); + "fix ext all external pf/array 1\n" + "thermo 5\n"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; @@ -132,22 +161,28 @@ TEST(lammps_external, array) int nlocal = lammps_extract_setting(handle, "nlocal"); for (int i = 0; i < nlocal; ++i) force[i][0] = force[i][1] = force[i][2] = 0.0; + lammps_fix_external_set_energy_global(handle, "ext", 0.5); lammps_command(handle, "run 5 post no"); double temp = lammps_get_thermo(handle, "temp"); + double pe = lammps_get_thermo(handle, "pe"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 4.0 / 525.0); + EXPECT_DOUBLE_EQ(pe, 1.0 / 16.0); ::testing::internal::CaptureStdout(); nlocal = lammps_extract_setting(handle, "nlocal"); force = lammps_fix_external_get_force(handle, "ext"); for (int i = 0; i < nlocal; ++i) force[i][0] = force[i][1] = force[i][2] = 6.0; + lammps_fix_external_set_energy_global(handle, "ext", 1.0); lammps_command(handle, "run 5 post no"); temp = lammps_get_thermo(handle, "temp"); + pe = lammps_get_thermo(handle, "pe"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); + EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); ::testing::internal::CaptureStdout(); lammps_close(handle); diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index 1b46943b5a..e1c511d480 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -4,8 +4,7 @@ from lammps import lammps, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR # add timestep dependent force def callback_one(lmp, ntimestep, nlocal, tag, x, f): - virial = [1.0, 1.0, 1.0, 0.0, 0.0, 0.0] - lmp.fix_external_set_virial_global("ext",virial) + lmp.fix_external_set_virial_global("ext",[1.0, 1.0, 1.0, 0.0, 0.0, 0.0]) for i in range(nlocal): f[i][0] = float(ntimestep) f[i][1] = float(ntimestep) @@ -74,9 +73,10 @@ class PythonExternal(unittest.TestCase): pair_style zero 0.1 pair_coeff 1 1 velocity all set 0.1 0.0 -0.1 - thermo 5 fix 1 all nve fix ext all external pf/array 1 + thermo_style custom step temp pe ke + thermo 5 """ lmp.commands_string(basic_system) force = lmp.fix_external_get_force("ext"); @@ -85,9 +85,11 @@ class PythonExternal(unittest.TestCase): force[i][0] = 0.0 force[i][1] = 0.0 force[i][2] = 0.0 + lmp.fix_external_set_energy_global("ext", 0.5) lmp.command("run 5 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),4.0/525.0,14) + self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/16.0,14) force = lmp.fix_external_get_force("ext"); nlocal = lmp.extract_setting("nlocal"); @@ -95,8 +97,10 @@ class PythonExternal(unittest.TestCase): force[i][0] = 6.0 force[i][1] = 6.0 force[i][2] = 6.0 + lmp.fix_external_set_energy_global("ext", 1.0) lmp.command("run 5 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) + self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) ############################## if __name__ == "__main__": From a1082f4de96d793e23b820f11aa2cd625ee8f7e0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 19 Jul 2021 12:15:43 -0400 Subject: [PATCH 092/119] fix typo --- doc/src/fix_qeq.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index 6992db6bca..ccacea08db 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -129,10 +129,10 @@ entries per line are required. The fix qeq styles will print a warning if the charges are not equilibrated within *tolerance* by *maxiter* steps, unless the -*warn* keyword is used with "no" as argument. This latter option +*warn* keyword is used with "no" as argument. This latter option may be useful for testing and benchmarking purposes, as it allows to use a fixed number of QEq iterations when *tolerance* is set -to a small enough value to alway reach the *maxiter* limit. Turning +to a small enough value to always reach the *maxiter* limit. Turning off warnings will avoid the excessive output in that case. The *qeq/point* style describes partial charges on atoms as point From 4e0071c8cf63c599478db9a133705404b3fa224b Mon Sep 17 00:00:00 2001 From: kipbarrett Date: Mon, 19 Jul 2021 12:52:09 -0500 Subject: [PATCH 093/119] rearranged deallocation --- src/ML-RANN/pair_rann.cpp | 145 +++++++++++++++++++++++++++----------- src/ML-RANN/pair_rann.h | 1 + 2 files changed, 104 insertions(+), 42 deletions(-) diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index 95e4d1af58..73ff747c81 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -75,29 +75,90 @@ static const char cite_user_rann_package[] = PairRANN::PairRANN(LAMMPS *lmp) : Pair(lmp) { + //initialize ints and bools single_enable = 0; restartinfo = 0; one_coeff = 1; manybody_flag = 1; allocated = 0; nelements = -1; - elements = nullptr; - mass = nullptr; - - // set comm size needed by this Pair - // comm unused for now. - - comm_forward = 38; - comm_reverse = 30; + nelementsp = -1; + comm_forward = 0; + comm_reverse = 0; res = 10000; cutmax = 0; - //at least one of the following will change during fingerprint definition: + dospin = false; + memguess = 0; + nmax1 = 0; + nmax2 = 0; + fmax = 0; + fnmax = 0; + //at least one of the following two flags will change during fingerprint definition: doscreen = false; allscreen = true; - dospin = false; + + //null init for arrays with sizes not yet determined. + elements = nullptr; + mass = nullptr; + elementsp = nullptr; + map = nullptr; + fingerprintcount = nullptr; + fingerprintlength = nullptr; + fingerprintperelement = nullptr; + screening_min = nullptr; + screening_max = nullptr; + weightdefined = nullptr; + biasdefined = nullptr; + xn = nullptr; + yn = nullptr; + zn = nullptr; + Sik = nullptr; + dSikx = nullptr; + dSiky = nullptr; + dSikz = nullptr; + dSijkx = nullptr; + dSijky = nullptr; + dSijkz = nullptr; + sx = nullptr; + sy = nullptr; + sz = nullptr; + dSijkxc = nullptr; + dSijkyc = nullptr; + dSijkzc = nullptr; + dfeaturesx = nullptr; + dfeaturesy = nullptr; + dfeaturesz = nullptr; + features = nullptr; + layer = nullptr; + sum = nullptr; + sum1 = nullptr; + dlayerx = nullptr; + dlayery = nullptr; + dlayerz = nullptr; + dlayersumx = nullptr; + dlayersumy = nullptr; + dlayersumz = nullptr; + dsx = nullptr; + dsy = nullptr; + dsz = nullptr; + dssumx = nullptr; + dssumy = nullptr; + dssumz = nullptr; + tn = nullptr; + jl = nullptr; + Bij = nullptr; + sims = nullptr; + net = nullptr; + activation = nullptr; + fingerprints = nullptr; } PairRANN::~PairRANN() +{ + deallocate(); +} + +void PairRANN::deallocate() { //clear memory delete[] mass; @@ -157,30 +218,26 @@ PairRANN::~PairRANN() memory->destroy(dlayersumx); memory->destroy(dlayersumy); memory->destroy(dlayersumz); - if (doscreen) { - memory->destroy(Sik); - memory->destroy(Bij); - memory->destroy(dSikx); - memory->destroy(dSiky); - memory->destroy(dSikz); - memory->destroy(dSijkx); - memory->destroy(dSijky); - memory->destroy(dSijkz); - memory->destroy(dSijkxc); - memory->destroy(dSijkyc); - memory->destroy(dSijkzc); - } - if (dospin) { - memory->destroy(sx); - memory->destroy(sy); - memory->destroy(sz); - memory->destroy(dsx); - memory->destroy(dsy); - memory->destroy(dsz); - memory->destroy(dssumx); - memory->destroy(dssumy); - memory->destroy(dssumz); - } + memory->destroy(Sik); + memory->destroy(Bij); + memory->destroy(dSikx); + memory->destroy(dSiky); + memory->destroy(dSikz); + memory->destroy(dSijkx); + memory->destroy(dSijky); + memory->destroy(dSijkz); + memory->destroy(dSijkxc); + memory->destroy(dSijkyc); + memory->destroy(dSijkzc); + memory->destroy(sx); + memory->destroy(sy); + memory->destroy(sz); + memory->destroy(dsx); + memory->destroy(dsy); + memory->destroy(dsz); + memory->destroy(dssumx); + memory->destroy(dssumy); + memory->destroy(dssumz); memory->destroy(setflag); memory->destroy(cutsq); } @@ -243,6 +300,7 @@ void PairRANN::settings(int narg, char ** /*arg*/) void PairRANN::coeff(int narg, char **arg) { int i,j; + deallocate();//clear allocation from any previous coeff map = new int[atom->ntypes+1]; if (narg != 3 + atom->ntypes) error->one(FLERR,"Incorrect args for pair coefficients"); if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->one(FLERR,"Incorrect args for pair coefficients"); @@ -294,7 +352,7 @@ void PairRANN::read_file(char *filename) FILE *fp; int eof = 0; std::string line,line1; - int longline = 4096; + const int longline = 4096; int linenum; char linetemp[longline]; std::string strtemp; @@ -405,12 +463,12 @@ void PairRANN::read_fpe(std::vector line,std::vector l } void PairRANN::read_fingerprints(std::vector line,std::vector line1,char *filename,int linenum) { - int nwords1,nwords,i,j,k,i1; + int nwords1,nwords,i,j,k,i1,*atomtypes; bool found; nwords1 = line1.size(); nwords = line.size(); if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before fingerprints in potential file."); - int atomtypes[nwords-1]; + atomtypes = new int[nwords-1]; for (i=1;i line,std::vectorinit(atomtypes,utils::inumeric(filename,linenum,line1[k++].c_str(),1,lmp)); fingerprintcount[i]++; } + delete[] atomtypes; } void PairRANN::read_fingerprint_constants(std::vector line,std::vector line1,char *filename,int linenum) { - int i,j,k,i1; + int i,j,k,i1,*atomtypes; bool found; int nwords = line.size(); if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before fingerprints in potential file."); int n_body_type = nwords-4; - int atomtypes[n_body_type]; + atomtypes = new int[n_body_type]; for (i=1;i<=n_body_type;i++) { found = false; for (j=0;j line,std::vec } if (!found) {error->one(filename,linenum-1,"cannot define constants for unknown fingerprint");} fingerprints[i][i1]->fullydefined=fingerprints[i][i1]->parse_values(line[nwords-1],line1); + delete[] atomtypes; } void PairRANN::read_network_layers(std::vector line,std::vector line1,char *filename,int linenum) { @@ -521,7 +581,7 @@ void PairRANN::read_layer_size(std::vector line,std::vector line,std::vector line1,FILE* fp,char *filename,int *linenum) { int i,j,k,l,nwords; char *ptr; - int longline = 4096; + const int longline = 4096; char linetemp [longline]; for (l=0;l line,std::vect } void PairRANN::read_screening(std::vector line,std::vector line1,char *filename,int linenum) { - int i,j,k; + int i,j,k,*atomtypes; bool found; int nwords = line.size(); if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before fingerprints in potential file."); if (nwords!=5)error->one(filename,linenum-1,"invalid screening command"); int n_body_type = 3; - int atomtypes[n_body_type]; + atomtypes = new int[n_body_type]; for (i=1;i<=n_body_type;i++) { found = false; for (j=0;j line,std::vectorone(filename,linenum-1,"unrecognized screening keyword"); + delete[] atomtypes; } //Called after finishing reading the potential file to make sure it is complete. True is bad. diff --git a/src/ML-RANN/pair_rann.h b/src/ML-RANN/pair_rann.h index ceaa5f445c..6c047775d4 100644 --- a/src/ML-RANN/pair_rann.h +++ b/src/ML-RANN/pair_rann.h @@ -136,6 +136,7 @@ namespace LAMMPS_NS { private: //new functions void allocate(const std::vector &);//called after reading element list, but before reading the rest of the potential + void deallocate(); void read_file(char *);//read potential file void read_atom_types(std::vector,char*,int); void read_fpe(std::vector,std::vector,char*,int);//fingerprints per element. Count total fingerprints defined for each 1st element in element combinations From 9615867600189214066c7969e5eab3e2bf0aad13 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 00:25:32 -0400 Subject: [PATCH 094/119] make contribution to global virial compatible with pf/array mode --- src/fix_external.cpp | 12 ++++++++---- src/fix_external.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 26c852fbd0..99539e86cf 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -80,7 +80,7 @@ FixExternal::~FixExternal() atom->delete_callback(id,Atom::GROW); memory->destroy(fexternal); - delete [] caller_vector; + delete[] caller_vector; } /* ---------------------------------------------------------------------- */ @@ -163,6 +163,12 @@ void FixExternal::post_force(int vflag) f[i][1] += fexternal[i][1]; f[i][2] += fexternal[i][2]; } + + // add contribution to global virial from previously stored value + + if (vflag_global) + for (int i = 0; i < 6; ++i) + virial[i] = user_virial[i]; } } @@ -196,10 +202,8 @@ void FixExternal::set_energy_global(double caller_energy) void FixExternal::set_virial_global(double *caller_virial) { - if (!vflag_global) return; - for (int i = 0; i < 6; i++) - virial[i] = caller_virial[i]; + user_virial[i] = caller_virial[i]; } /* ---------------------------------------------------------------------- diff --git a/src/fix_external.h b/src/fix_external.h index f0f46cd4c5..16db5d5015 100644 --- a/src/fix_external.h +++ b/src/fix_external.h @@ -64,6 +64,7 @@ class FixExternal : public Fix { FnPtr callback; void *ptr_caller; double user_energy; + double user_virial[6]; double *caller_vector; }; From f6e9c308181c577ec26fc4d827fb052960ad5e7d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 00:47:10 -0400 Subject: [PATCH 095/119] update unit tests --- unittest/c-library/test_library_external.cpp | 15 ++++++++++++--- unittest/python/python-fix-external.py | 9 +++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index 8acb7a43f4..005b31fcab 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -162,13 +162,17 @@ TEST(lammps_external, array) for (int i = 0; i < nlocal; ++i) force[i][0] = force[i][1] = force[i][2] = 0.0; lammps_fix_external_set_energy_global(handle, "ext", 0.5); + double v[6] = {0.5, 0.5, 0.5, 0.0, 0.0, 0.0}; + lammps_fix_external_set_virial_global(handle, "ext", v); lammps_command(handle, "run 5 post no"); - double temp = lammps_get_thermo(handle, "temp"); - double pe = lammps_get_thermo(handle, "pe"); - output = ::testing::internal::GetCapturedStdout(); + double temp = lammps_get_thermo(handle, "temp"); + double pe = lammps_get_thermo(handle, "pe"); + double press = lammps_get_thermo(handle, "press"); + output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 4.0 / 525.0); EXPECT_DOUBLE_EQ(pe, 1.0 / 16.0); + EXPECT_DOUBLE_EQ(press, 0.069166666666666668); ::testing::internal::CaptureStdout(); nlocal = lammps_extract_setting(handle, "nlocal"); @@ -176,13 +180,18 @@ TEST(lammps_external, array) for (int i = 0; i < nlocal; ++i) force[i][0] = force[i][1] = force[i][2] = 6.0; lammps_fix_external_set_energy_global(handle, "ext", 1.0); + v[0] = v[1] = v[2] = 1.0; + v[3] = v[4] = v[5] = 0.0; + lammps_fix_external_set_virial_global(handle, "ext", v); lammps_command(handle, "run 5 post no"); temp = lammps_get_thermo(handle, "temp"); pe = lammps_get_thermo(handle, "pe"); + press = lammps_get_thermo(handle, "press"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; EXPECT_DOUBLE_EQ(temp, 1.0 / 30.0); EXPECT_DOUBLE_EQ(pe, 1.0 / 8.0); + EXPECT_DOUBLE_EQ(press, 0.15416666666666667); ::testing::internal::CaptureStdout(); lammps_close(handle); diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index e1c511d480..2d4c50e454 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -75,7 +75,8 @@ class PythonExternal(unittest.TestCase): velocity all set 0.1 0.0 -0.1 fix 1 all nve fix ext all external pf/array 1 - thermo_style custom step temp pe ke + fix_modify ext energy yes virial yes + thermo_style custom step temp pe ke press thermo 5 """ lmp.commands_string(basic_system) @@ -86,10 +87,12 @@ class PythonExternal(unittest.TestCase): force[i][1] = 0.0 force[i][2] = 0.0 lmp.fix_external_set_energy_global("ext", 0.5) - + lmp.fix_external_set_virial_global("ext",[0.5, 0.5, 0.5, 0.0, 0.0, 0.0]) + lmp.command("run 5 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),4.0/525.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/16.0,14) + self.assertAlmostEqual(lmp.get_thermo("press"),0.06916666666666667,14) force = lmp.fix_external_get_force("ext"); nlocal = lmp.extract_setting("nlocal"); @@ -98,9 +101,11 @@ class PythonExternal(unittest.TestCase): force[i][1] = 6.0 force[i][2] = 6.0 lmp.fix_external_set_energy_global("ext", 1.0) + lmp.fix_external_set_virial_global("ext",[1.0, 1.0, 1.0, 0.0, 0.0, 0.0]) lmp.command("run 5 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) + self.assertAlmostEqual(lmp.get_thermo("press"),0.15416666666666667,14) ############################## if __name__ == "__main__": From 13147707aa6bce793a9a9a48e51c5c5939313bfd Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 21 Jul 2021 11:33:11 -0400 Subject: [PATCH 096/119] Add utility script to help update URLs for offline tool --- tools/offline/scripts/update_downloads.sh | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tools/offline/scripts/update_downloads.sh diff --git a/tools/offline/scripts/update_downloads.sh b/tools/offline/scripts/update_downloads.sh new file mode 100755 index 0000000000..247b92e562 --- /dev/null +++ b/tools/offline/scripts/update_downloads.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#helper script to update URLs from CMake folder + +CMAKE_FOLDER=../../../cmake + +function extract_setting() +{ + export $1=$(grep -Rh "set($1" ../../../cmake/ | cut -d\" -f2) +} + +function update_setting() +{ + echo Setting $1 to $2 + sed -i "/^$1=/c$1=\"$2\"" init_http_cache.sh +} + + +URLS=$(grep -Rh "_URL=" init_http_cache.sh | grep -v ^LAMMPS | grep -v SCAFACOS_FIX | cut -d= -f1) + +# update URLs by grabbing the latest ones from cmake files +for URL in $URLS +do + extract_setting "$URL" + update_setting "$URL" ${!URL} +done From d7edc95193a9ea3a7d85061b21fa4087bdbf7a89 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 21 Jul 2021 11:34:43 -0400 Subject: [PATCH 097/119] Update init_http_cache.sh --- tools/offline/scripts/init_http_cache.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index 9bda6cdaa5..55856bbf21 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -40,26 +40,26 @@ echo "Dowloading thirdparty tarballs..." MPICH2_WIN64_DEVEL_URL="${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" MPICH2_WIN32_DEVEL_URL="${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" VORO_URL="${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" -OPENCL_LOADER_URL="${LAMMPS_THIRDPARTY_URL}/opencl-loader-2020.12.18.tar.gz" +OPENCL_LOADER_URL="${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.06.30.tar.gz" SCAFACOS_FIX_URL="${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff" GTEST_URL="https://github.com/google/googletest/archive/release-1.10.0.tar.gz" YAML_URL="https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" -MATHJAX_URL="https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz" +MATHJAX_URL="https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" EIGEN3_URL="https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz" CUB_URL="https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" -KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz" +KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" KIM_URL="https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" MSCG_URL="https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" -PLUMED_URL="https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz" +PLUMED_URL="https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-src-2.7.1.tgz" PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" LATTE_URL="https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" SCAFACOS_URL="https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" MDI_URL="https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" GTEST_FILENAME="gtest-1.10.0.tar.gz" -MATHJAX_FILENAME="mathjax-3.1.2.tar.gz" +MATHJAX_FILENAME="mathjax-3.1.3.tar.gz" CUB_FILENAME="cub-1.12.0.tar.gz" -KOKKOS_FILENAME="kokkos-3.3.01.tar.gz" +KOKKOS_FILENAME="kokkos-3.4.01.tar.gz" MSCG_FILENAME="mscg-1.7.3.1.tar.gz" LATTE_FILENAME="latte-1.2.2.tar.gz" PACELIB_FILENAME="pacelib-2021.4.9.tar.gz" From 72744ea441fb2e0b04e4a8df058c2a1063ddb456 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 12:08:19 -0400 Subject: [PATCH 098/119] update swig interface file to the latest changes in the c library header --- tools/swig/lammps.i | 46 ++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index 56547dda53..5bf47f2463 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -128,16 +128,27 @@ extern int lammps_id_name(void *, const char *, int, char *buffer, int buf_si extern int lammps_plugin_count(); extern int lammps_plugin_name(int, char *, char *, int); /* -extern int lammps_encode_image_flags(int ix, int iy, int iz); -extern void lammps_decode_image_flags(int image, int *flags); -extern int64_t lammps_encode_image_flags(int ix, int iy, int iz); -extern void lammps_decode_image_flags(int64_t image, int *flags); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_fix_external_set_energy_global(void *, char *, double); -extern void lammps_fix_external_set_virial_global(void *, char *, double *); + * Have not found a good way to map these functions in a general way. + * So some individual customization for the specific use case and compilation is needed. + * + extern int lammps_encode_image_flags(int ix, int iy, int iz); + extern void lammps_decode_image_flags(int image, int *flags); + extern int64_t lammps_encode_image_flags(int ix, int iy, int iz); + extern void lammps_decode_image_flags(int64_t image, int *flags); + + * Supporting the fix external callback mechanism will require extra code specific to the application. + typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); + extern void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr); + * these two functions can only be used from the callback, so we don't support them either + extern void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng); + extern void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial); */ +extern double **lammps_fix_external_get_force(void *handle, const char *id); +extern void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng); +extern void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial); +extern void lammps_fix_external_set_vector_length(void *handle, const char *id, int len); +extern void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val); + extern void lammps_free(void *ptr); extern int lammps_is_running(void *handle); extern void lammps_force_timeout(void *handle); @@ -255,16 +266,21 @@ extern int lammps_encode_image_flags(int ix, int iy, int iz); extern void lammps_decode_image_flags(int image, int *flags); extern int64_t lammps_encode_image_flags(int ix, int iy, int iz); extern void lammps_decode_image_flags(int64_t image, int *flags); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); -extern void lammps_fix_external_set_energy_global(void *, char *, double); -extern void lammps_fix_external_set_virial_global(void *, char *, double *); +typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); +extern void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr); +extern void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng); +extern void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial); */ +extern double **lammps_fix_external_get_force(void *handle, const char *id); +extern void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng); +extern void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial); +extern void lammps_fix_external_set_vector_length(void *handle, const char *id, int len); +extern void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val); + extern void lammps_free(void *ptr); extern int lammps_is_running(void *handle); extern void lammps_force_timeout(void *handle); extern int lammps_has_error(void *handle); extern int lammps_get_last_error_message(void *handle, char *buffer, int buf_size); -/* last revised for LAMMPS 8 April 2021 */ +/* last revised on 21 July 2021 */ From b20fcbd686046687582d2d79dcf471062cd5bcf5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 16:00:28 -0400 Subject: [PATCH 099/119] implement per-atom stress and nofdotr support for reax/c/omp --- src/OPENMP/pair_reaxc_omp.cpp | 4 -- src/OPENMP/pair_reaxc_omp.h | 6 ++ src/OPENMP/reaxc_bond_orders_omp.cpp | 42 ++++--------- src/OPENMP/reaxc_bonds_omp.cpp | 16 ++--- src/OPENMP/thr_omp.cpp | 22 +++++++ src/OPENMP/thr_omp.h | 4 +- src/REAXFF/reaxc_bond_orders.cpp | 88 ++++++++++++++-------------- src/REAXFF/reaxc_bonds.cpp | 2 +- 8 files changed, 92 insertions(+), 92 deletions(-) diff --git a/src/OPENMP/pair_reaxc_omp.cpp b/src/OPENMP/pair_reaxc_omp.cpp index 2596f8390b..b65c9a391f 100644 --- a/src/OPENMP/pair_reaxc_omp.cpp +++ b/src/OPENMP/pair_reaxc_omp.cpp @@ -233,10 +233,6 @@ void PairReaxCOMP::compute(int eflag, int vflag) evdwl = ecoul = 0.0; ev_init(eflag,vflag); - if (vflag_atom) - error->all(FLERR,"Pair style reax/c/omp does not support " - "computing per-atom stress"); - api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts api->system->bigN = static_cast (atom->natoms); // all atoms in the system diff --git a/src/OPENMP/pair_reaxc_omp.h b/src/OPENMP/pair_reaxc_omp.h index d8152656ff..81d1c35b0e 100644 --- a/src/OPENMP/pair_reaxc_omp.h +++ b/src/OPENMP/pair_reaxc_omp.h @@ -76,6 +76,12 @@ class PairReaxCOMP : public PairReaxC, public ThrOMP { ev_tally3_thr(this, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm); } + inline void v_tally2_newton_thr_proxy(const int i, const double *const fi, + const double *const deli, ThrData *const thrparm) + { + v_tally2_newton_thr(this, i, fi, deli, thrparm); + } + inline void v_tally3_thr_proxy(const int i, const int j, const int k, const double *const fi, const double *const fk, const double *const drij, const double *const drkj, ThrData *const thrparm) diff --git a/src/OPENMP/reaxc_bond_orders_omp.cpp b/src/OPENMP/reaxc_bond_orders_omp.cpp index 9c026ee95c..3e419792d9 100644 --- a/src/OPENMP/reaxc_bond_orders_omp.cpp +++ b/src/OPENMP/reaxc_bond_orders_omp.cpp @@ -37,8 +37,8 @@ using namespace LAMMPS_NS; namespace ReaxFF { - void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, - storage *workspace, reax_list **lists) { + void Add_dBond_to_ForcesOMP(reax_system *system, int i, int pj, storage *workspace, reax_list **lists) + { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; @@ -94,12 +94,10 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+i],temp); if (system->pair_ptr->vflag_either) { - rvec_Scale(fi_tmp, -1.0, temp); + rvec_Scale(fi_tmp, -0.5, temp); rvec_ScaledSum(delij, 1., system->my_atoms[i].x,-1., system->my_atoms[j].x); - pair_reax_ptr->ev_tally_xyz_thr_proxy(i,j,system->N,0,0,0, - fi_tmp[0],fi_tmp[1],fi_tmp[2], - delij[0],delij[1],delij[2],thr); + pair_reax_ptr->v_tally2_newton_thr_proxy(i,fi_tmp,delij,thr); } c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); @@ -115,12 +113,9 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+j],temp); if (system->pair_ptr->vflag_either) { - rvec_Scale(fj_tmp, -1.0, temp); + rvec_Scale(fj_tmp, -0.5, temp); rvec_ScaledSum(delji, 1., system->my_atoms[j].x,-1., system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(j,i,system->N,0,0,0, - fj_tmp[0],fj_tmp[1],fj_tmp[2], - delji[0],delji[1],delji[2],thr); + pair_reax_ptr->v_tally2_newton_thr_proxy(j,fj_tmp,delji,thr); } // forces on k: i neighbor @@ -134,17 +129,11 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+k],temp); if (system->pair_ptr->vflag_either) { - rvec_Scale(fk_tmp, -1.0, temp); + rvec_Scale(fk_tmp, -0.5, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); + pair_reax_ptr->v_tally2_newton_thr_proxy(k,fk_tmp,delki,thr); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); + pair_reax_ptr->v_tally2_newton_thr_proxy(k,fk_tmp,delkj,thr); } } @@ -159,18 +148,11 @@ namespace ReaxFF { rvec_Add(workspace->forceReduction[reductionOffset+k],temp); if (system->pair_ptr->vflag_either) { - rvec_Scale(fk_tmp, -1.0, temp); + rvec_Scale(fk_tmp, -0.5, temp); rvec_ScaledSum(delki,1.,system->my_atoms[k].x,-1.,system->my_atoms[i].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(k,i,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delki[0],delki[1],delki[2],thr); - + pair_reax_ptr->v_tally2_newton_thr_proxy(k,fk_tmp,delki,thr); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); - - pair_reax_ptr->ev_tally_xyz_thr_proxy(k,j,system->N,0,0,0, - fk_tmp[0],fk_tmp[1],fk_tmp[2], - delkj[0],delkj[1],delkj[2],thr); + pair_reax_ptr->v_tally2_newton_thr_proxy(k,fk_tmp,delkj,thr); } } } diff --git a/src/OPENMP/reaxc_bonds_omp.cpp b/src/OPENMP/reaxc_bonds_omp.cpp index 2357d20690..784af432cc 100644 --- a/src/OPENMP/reaxc_bonds_omp.cpp +++ b/src/OPENMP/reaxc_bonds_omp.cpp @@ -1,14 +1,12 @@ // clang-format off /*---------------------------------------------------------------------- PuReMD - Purdue ReaxFF Molecular Dynamics Program - Website: https://www.cs.purdue.edu/puremd Copyright (2010) Purdue University - - Contributing authors: - H. M. Aktulga, J. Fogarty, S. Pandit, A. Grama - Corresponding author: - Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu + Hasan Metin Aktulga, hmaktulga@lbl.gov + Joseph Fogarty, jcfogart@mail.usf.edu + Sagar Pandit, pandit@usf.edu + Ananth Y Grama, ayg@cs.purdue.edu Please cite the related publication: H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, @@ -122,8 +120,7 @@ namespace ReaxFF { /* tally into per-atom energy */ if (system->pair_ptr->eflag_either) - pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, - ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + pair_reax_ptr->ev_tally_thr_proxy(i,j,natoms,1,ebond,0.0,0.0,0.0,0.0,0.0,thr); /* calculate derivatives of Bond Orders */ bo_ij->Cdbo += CEbo; @@ -153,8 +150,7 @@ namespace ReaxFF { /* tally into per-atom energy */ if (system->pair_ptr->eflag_either) - pair_reax_ptr->ev_tally_thr_proxy( i, j, natoms, 1, - estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); + pair_reax_ptr->ev_tally_thr_proxy(i,j,natoms,1,estriph,0.0,0.0,0.0,0.0,0.0,thr); bo_ij->Cdbo += decobdbo; workspace->CdDelta[i] += decobdboua; diff --git a/src/OPENMP/thr_omp.cpp b/src/OPENMP/thr_omp.cpp index 545e3bbe88..7f4bc95e8c 100644 --- a/src/OPENMP/thr_omp.cpp +++ b/src/OPENMP/thr_omp.cpp @@ -1499,6 +1499,28 @@ void ThrOMP::v_tally2_thr(Pair *const pair, const int i, const int j, const doub } } +/* ---------------------------------------------------------------------- + tally virial into per-atom accumulators + called by RexaFF potential, newton_pair is always on + fi is magnitude of force on atom i, deli is the direction + note that the other atom (j) is not updated, due to newton on +------------------------------------------------------------------------- */ + +void ThrOMP::v_tally2_newton_thr(Pair *const pair, const int i, const double * const fi, + const double * const deli, ThrData * const thr) +{ + double v[6]; + + v[0] = deli[0]*fi[0]; + v[1] = deli[1]*fi[1]; + v[2] = deli[2]*fi[2]; + v[3] = deli[0]*fi[1]; + v[4] = deli[0]*fi[2]; + v[5] = deli[1]*fi[2]; + if (pair->vflag_global) v_tally(thr->virial_pair,v); + if (pair->vflag_atom) v_tally(thr->vatom_pair[i],v); +} + /* ---------------------------------------------------------------------- tally virial into per-atom accumulators called by AIREBO and Tersoff potential, newton_pair is always on diff --git a/src/OPENMP/thr_omp.h b/src/OPENMP/thr_omp.h index 35cd43be5d..02fdbdf25b 100644 --- a/src/OPENMP/thr_omp.h +++ b/src/OPENMP/thr_omp.h @@ -135,8 +135,8 @@ class ThrOMP { void ev_tally_xyz_full_thr(Pair *const, const int, const double, const double, const double, const double, const double, const double, const double, const double, ThrData *const); - void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, - ThrData *const); + void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, ThrData *const); + void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const, ThrData *const); void ev_tally3_thr(Pair *const, const int, const int, const int, const double, const double, const double *const, const double *const, const double *const, const double *const, ThrData *const); diff --git a/src/REAXFF/reaxc_bond_orders.cpp b/src/REAXFF/reaxc_bond_orders.cpp index 0e4227922b..d827e3753d 100644 --- a/src/REAXFF/reaxc_bond_orders.cpp +++ b/src/REAXFF/reaxc_bond_orders.cpp @@ -50,35 +50,37 @@ namespace ReaxFF { bo_ij = &(nbr_j->bo_data); bo_ji = &(bonds->select.bond_list[nbr_j->sym_index].bo_data); - coef.C1dbo = bo_ij->C1dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C2dbo = bo_ij->C2dbo * (bo_ij->Cdbo + bo_ji->Cdbo); - coef.C3dbo = bo_ij->C3dbo * (bo_ij->Cdbo + bo_ji->Cdbo); + double c = bo_ij->Cdbo + bo_ji->Cdbo; + coef.C1dbo = bo_ij->C1dbo * c; + coef.C2dbo = bo_ij->C2dbo * c; + coef.C3dbo = bo_ij->C3dbo * c; - coef.C1dbopi = bo_ij->C1dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C2dbopi = bo_ij->C2dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C3dbopi = bo_ij->C3dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); - coef.C4dbopi = bo_ij->C4dbopi * (bo_ij->Cdbopi + bo_ji->Cdbopi); + c = bo_ij->Cdbopi + bo_ji->Cdbopi; + coef.C1dbopi = bo_ij->C1dbopi * c; + coef.C2dbopi = bo_ij->C2dbopi * c; + coef.C3dbopi = bo_ij->C3dbopi * c; + coef.C4dbopi = bo_ij->C4dbopi * c; - coef.C1dbopi2 = bo_ij->C1dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C2dbopi2 = bo_ij->C2dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C3dbopi2 = bo_ij->C3dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); - coef.C4dbopi2 = bo_ij->C4dbopi2 * (bo_ij->Cdbopi2 + bo_ji->Cdbopi2); + c = bo_ij->Cdbopi2 + bo_ji->Cdbopi2; + coef.C1dbopi2 = bo_ij->C1dbopi2 * c; + coef.C2dbopi2 = bo_ij->C2dbopi2 * c; + coef.C3dbopi2 = bo_ij->C3dbopi2 * c; + coef.C4dbopi2 = bo_ij->C4dbopi2 * c; - coef.C1dDelta = bo_ij->C1dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); + c = workspace->CdDelta[i] + workspace->CdDelta[j]; + coef.C1dDelta = bo_ij->C1dbo * c; + coef.C2dDelta = bo_ij->C2dbo * c; + coef.C3dDelta = bo_ij->C3dbo * c; + + c = (coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp); + + c = (coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[i]); - // forces on i - rvec_Scale( temp, coef.C1dbo, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C2dbo, workspace->dDeltap_self[i]); - rvec_ScaledAdd(temp, coef.C1dDelta, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C2dDelta, workspace->dDeltap_self[i]); rvec_ScaledAdd(temp, coef.C1dbopi, bo_ij->dln_BOp_pi); - rvec_ScaledAdd(temp, coef.C2dbopi, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C3dbopi, workspace->dDeltap_self[i]); rvec_ScaledAdd(temp, coef.C1dbopi2, bo_ij->dln_BOp_pi2); - rvec_ScaledAdd(temp, coef.C2dbopi2, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C3dbopi2, workspace->dDeltap_self[i]); + rvec_Add(workspace->f[i], temp); if (system->pair_ptr->vflag_either) { @@ -87,17 +89,15 @@ namespace ReaxFF { system->pair_ptr->v_tally2_newton(i,fi_tmp,delij); } - // forces on j - rvec_Scale( temp, -coef.C1dbo, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C3dbo, workspace->dDeltap_self[j]); - rvec_ScaledAdd(temp, -coef.C1dDelta, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C3dDelta, workspace->dDeltap_self[j]); + c = -(coef.C1dbo + coef.C1dDelta + coef.C2dbopi + coef.C2dbopi2); + rvec_Scale( temp, c, bo_ij->dBOp); + + c = (coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_ScaledAdd(temp, c, workspace->dDeltap_self[j]); + rvec_ScaledAdd(temp, -coef.C1dbopi, bo_ij->dln_BOp_pi); - rvec_ScaledAdd(temp, -coef.C2dbopi, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C4dbopi, workspace->dDeltap_self[j]); rvec_ScaledAdd(temp, -coef.C1dbopi2, bo_ij->dln_BOp_pi2); - rvec_ScaledAdd(temp, -coef.C2dbopi2, bo_ij->dBOp); - rvec_ScaledAdd(temp, coef.C4dbopi2, workspace->dDeltap_self[j]); + rvec_Add(workspace->f[j], temp); if (system->pair_ptr->vflag_either) { @@ -111,10 +111,9 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C3dbopi2, nbr_k->bo_data.dBOp); + const double c = -(coef.C2dbo + coef.C2dDelta + coef.C3dbopi + coef.C3dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + rvec_Add(workspace->f[k], temp); if (system->pair_ptr->vflag_either) { @@ -131,10 +130,9 @@ namespace ReaxFF { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; - rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); - rvec_ScaledAdd(temp, -coef.C4dbopi2, nbr_k->bo_data.dBOp); + const double c = -(coef.C3dbo + coef.C3dDelta + coef.C4dbopi + coef.C4dbopi2); + rvec_Scale(temp, c, nbr_k->bo_data.dBOp); + rvec_Add(workspace->f[k], temp); if (system->pair_ptr->vflag_either) { @@ -152,14 +150,14 @@ namespace ReaxFF { single_body_parameters *sbp_i, single_body_parameters *sbp_j, two_body_parameters *twbp) { int j, btop_j; - double r2, C12, C34, C56; + double rr2, C12, C34, C56; double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; double BO, BO_s, BO_pi, BO_pi2; bond_data *ibond, *jbond; bond_order_data *bo_ij, *bo_ji; j = nbr_pj->nbr; - r2 = SQR(nbr_pj->d); + rr2 = 1.0 / SQR(nbr_pj->d); if (sbp_i->r_s > 0.0 && sbp_j->r_s > 0.0) { C12 = twbp->p_bo1 * pow(nbr_pj->d / twbp->r_s, twbp->p_bo2); @@ -207,9 +205,9 @@ namespace ReaxFF { bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; /* Bond Order page2-3, derivative of total bond order prime */ - Cln_BOp_s = twbp->p_bo2 * C12 / r2; - Cln_BOp_pi = twbp->p_bo4 * C34 / r2; - Cln_BOp_pi2 = twbp->p_bo6 * C56 / r2; + Cln_BOp_s = twbp->p_bo2 * C12 * rr2; + Cln_BOp_pi = twbp->p_bo4 * C34 * rr2; + Cln_BOp_pi2 = twbp->p_bo6 * C56 * rr2; /* Only dln_BOp_xx wrt. dr_i is stored here, note that dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ diff --git a/src/REAXFF/reaxc_bonds.cpp b/src/REAXFF/reaxc_bonds.cpp index 7feea043fa..cb28aaa1ca 100644 --- a/src/REAXFF/reaxc_bonds.cpp +++ b/src/REAXFF/reaxc_bonds.cpp @@ -11,7 +11,7 @@ Please cite the related publication: H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, "Parallel Reactive Molecular Dynamics: Numerical Methods and - Algorithmic Techniques", Parallel Computing, in press. + Algorithmic Techniques", Parallel Computing, 38 (4-5), 245-259 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as From 5436975fa2f5379a465ee1fe0eba4e2514e1986d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 16:01:28 -0400 Subject: [PATCH 100/119] update unit test reference data for REAXFF also with OpenMP enabled --- .../tests/atomic-pair-reax_c.yaml | 253 +++++++++-------- .../tests/atomic-pair-reax_c_lgvdw.yaml | 249 +++++++++-------- .../tests/atomic-pair-reax_c_noqeq.yaml | 261 +++++++++--------- .../tests/atomic-pair-reax_c_tabulate.yaml | 247 +++++++++-------- 4 files changed, 503 insertions(+), 507 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index 22cc182b30..9eaad2a949 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,8 +1,7 @@ --- lammps_version: 2 Jul 2021 -date_generated: Mon Jul 12 20:56:37 2021 +date_generated: Wed Jul 21 15:49:45 2021 epsilon: 1e-11 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -38,139 +37,139 @@ natoms: 64 init_vdwl: -3296.3503506624793 init_coul: -327.06551252279587 init_stress: ! |- - -1.0522112314759645e+03 -1.2629480788292406e+03 -8.6765541430728683e+02 -2.5149818635822589e+02 2.0624598409299679e+02 -6.4309968343216531e+02 + -1.0522112314759656e+03 -1.2629480788292419e+03 -8.6765541430728797e+02 -2.5149818635822544e+02 2.0624598409299588e+02 -6.4309968343216440e+02 init_forces: ! |2 - 1 -8.8484559491557889e+01 -2.5824737864578637e+01 1.0916228789487674e+02 - 2 -1.1227736122976223e+02 -1.8092349731667616e+02 -2.2420586526896261e+02 - 3 -1.7210817575849026e+02 1.8292439782308702e+02 1.3552618819720569e+01 - 4 3.2997500231085269e+01 -5.1076027616185407e+01 9.0475628837095513e+01 - 5 1.8144778146274791e+02 1.6797701000587466e+01 -8.1725507301127038e+01 - 6 1.3634094180728110e+02 -3.0056789474000180e+02 2.9661495129805957e+01 - 7 -5.3287158661291762e+01 -1.2872927610192625e+02 -1.6347871108897493e+02 - 8 -1.5334883257588757e+02 4.0171483324130726e+01 1.5317461163040997e+02 - 9 1.8364155867634079e+01 8.1986572088186804e+01 2.8272397798081524e+01 - 10 8.4246730110712534e+01 1.4177487113456962e+02 1.2330079878579957e+02 - 11 -4.3218423112520902e+01 6.5551082199289709e+01 1.3464882148706636e+02 - 12 -9.7317470492933836e+01 -2.6234999414154014e+01 7.2277941881646539e+00 - 13 -6.3183329836753863e+01 -4.7368101002971272e+01 -3.7592654029315021e+01 - 14 7.8642975316486172e+01 -6.7997612991897455e+01 -9.9044775614596048e+01 - 15 -6.6373732796038979e+01 2.1787558547532143e+02 8.0103149369093387e+01 - 16 1.9216166082224373e+02 5.3228015320734819e+01 6.6260214054210593e+01 - 17 1.4496007689503062e+02 -3.9700923044583718e+01 -9.7503851828130053e+01 - 18 -4.4989550233790240e+01 -1.9360605894359739e+02 1.1274792197022482e+02 - 19 2.6657528138945770e+02 3.7189510796650950e+02 -3.3847307488287703e+02 - 20 -7.6341040242469418e+01 -8.8478925962203348e+01 1.3557778212060649e+00 - 21 -7.1188591900926752e+01 -5.1591439985136624e+01 -1.2279442803769274e+02 - 22 1.5504836733039957e+02 -1.3094504458746073e+02 8.1474408030760628e+01 - 23 7.8015302036861655e+01 -1.3272310040521637e+01 -2.2771427736544183e+01 - 24 -2.0546718065741098e+02 2.1611071031053456e+02 -1.2423208053538966e+02 - 25 -1.1402686646199034e+02 1.9100238121128132e+02 -8.3504908417580012e+01 - 26 2.8663576552098772e+02 -2.1773884754170604e+02 2.3144300100087472e+02 - 27 -6.3247409025611177e+01 6.9122196748087077e+01 1.8606936744368778e+02 - 28 -3.5426011055935240e+00 3.8764809029451875e+01 3.2874001946768900e+01 - 29 -7.1069178571876577e+01 3.5485903180427719e+01 2.7311648896320204e+01 - 30 -1.7036987830119904e+02 -1.9851827590031277e+02 -1.1511401829123537e+02 + 1 -8.8484559491557889e+01 -2.5824737864578672e+01 1.0916228789487677e+02 + 2 -1.1227736122976222e+02 -1.8092349731667619e+02 -2.2420586526896258e+02 + 3 -1.7210817575849026e+02 1.8292439782308693e+02 1.3552618819720610e+01 + 4 3.2997500231085269e+01 -5.1076027616185407e+01 9.0475628837095528e+01 + 5 1.8144778146274791e+02 1.6797701000587494e+01 -8.1725507301127109e+01 + 6 1.3634094180728098e+02 -3.0056789474000180e+02 2.9661495129805985e+01 + 7 -5.3287158661291791e+01 -1.2872927610192625e+02 -1.6347871108897493e+02 + 8 -1.5334883257588757e+02 4.0171483324130705e+01 1.5317461163041000e+02 + 9 1.8364155867634015e+01 8.1986572088186833e+01 2.8272397798081524e+01 + 10 8.4246730110712562e+01 1.4177487113456959e+02 1.2330079878579957e+02 + 11 -4.3218423112520917e+01 6.5551082199289681e+01 1.3464882148706636e+02 + 12 -9.7317470492933836e+01 -2.6234999414154061e+01 7.2277941881646433e+00 + 13 -6.3183329836753892e+01 -4.7368101002971272e+01 -3.7592654029315028e+01 + 14 7.8642975316486144e+01 -6.7997612991897398e+01 -9.9044775614596077e+01 + 15 -6.6373732796038979e+01 2.1787558547532149e+02 8.0103149369093416e+01 + 16 1.9216166082224373e+02 5.3228015320734841e+01 6.6260214054210607e+01 + 17 1.4496007689503060e+02 -3.9700923044583725e+01 -9.7503851828130109e+01 + 18 -4.4989550233790240e+01 -1.9360605894359739e+02 1.1274792197022477e+02 + 19 2.6657528138945764e+02 3.7189510796650950e+02 -3.3847307488287709e+02 + 20 -7.6341040242469404e+01 -8.8478925962203348e+01 1.3557778212060665e+00 + 21 -7.1188591900926752e+01 -5.1591439985136596e+01 -1.2279442803769271e+02 + 22 1.5504836733039957e+02 -1.3094504458746079e+02 8.1474408030760628e+01 + 23 7.8015302036861712e+01 -1.3272310040521580e+01 -2.2771427736544119e+01 + 24 -2.0546718065741095e+02 2.1611071031053456e+02 -1.2423208053538964e+02 + 25 -1.1402686646199034e+02 1.9100238121128135e+02 -8.3504908417580054e+01 + 26 2.8663576552098777e+02 -2.1773884754170615e+02 2.3144300100087472e+02 + 27 -6.3247409025611177e+01 6.9122196748087077e+01 1.8606936744368775e+02 + 28 -3.5426011055935045e+00 3.8764809029451875e+01 3.2874001946768900e+01 + 29 -7.1069178571876577e+01 3.5485903180427727e+01 2.7311648896320222e+01 + 30 -1.7036987830119904e+02 -1.9851827590031277e+02 -1.1511401829123534e+02 31 -1.3970409889743331e+02 1.6660943915628047e+02 -1.2913930522474698e+02 - 32 2.7179130444112271e+01 -6.0169059447629905e+01 -1.7669495182022038e+02 - 33 -6.2659679124099597e+01 -6.4422131921795355e+01 6.4150928205326579e+01 - 34 -2.2119065265693539e+01 1.0450386886830508e+02 -7.3998379587547845e+01 - 35 2.6982987783286291e+02 -2.1519317040003412e+02 1.3051628460669610e+02 + 32 2.7179130444112264e+01 -6.0169059447629905e+01 -1.7669495182022038e+02 + 33 -6.2659679124099576e+01 -6.4422131921795383e+01 6.4150928205326579e+01 + 34 -2.2119065265693525e+01 1.0450386886830510e+02 -7.3998379587547845e+01 + 35 2.6982987783286291e+02 -2.1519317040003423e+02 1.3051628460669625e+02 36 1.0368628874516659e+02 1.8817377639779619e+02 -1.9748944223870336e+02 - 37 -1.8009522406836990e+02 1.2993653092243849e+02 -6.3523043394051804e+01 - 38 -2.9571205878459978e+02 1.0441609933482222e+02 1.5582204859042619e+02 - 39 8.7398805727029270e+01 -6.0025559644669258e+01 2.2209742009837157e+01 - 40 2.0540672579010824e+01 -1.0735874009092363e+02 5.8655918369892206e+01 - 41 -5.8895846271372314e+01 1.1852345624639781e+01 -6.6147257724570267e+01 - 42 -9.6895512314642531e+01 3.8928741136688721e+01 -7.5791929957116210e+01 - 43 2.2476051812062417e+02 9.5505204283237461e+01 1.2309042240718740e+02 - 44 8.9817373579488660e+01 -1.0616333580628948e+02 -8.6321519086255435e+01 - 45 1.7202629662584396e+01 1.2890307246697841e+02 5.2916171301068466e+01 - 46 1.3547783972601877e+01 -2.9276223331260049e+01 2.2187412696867376e+01 - 47 3.3389762514712210e+01 -1.9217585014965047e+02 -6.9956213241088250e+01 - 48 7.3631720332112650e+01 -2.0953007324688525e+02 -2.3183566221404728e+01 - 49 -3.7589944473227274e+02 -2.4083165714763936e+01 1.0770339502610545e+02 - 50 3.8603083564823841e+01 -7.3616481568799330e+01 9.0414065019644596e+01 + 37 -1.8009522406836996e+02 1.2993653092243866e+02 -6.3523043394051889e+01 + 38 -2.9571205878459978e+02 1.0441609933482223e+02 1.5582204859042622e+02 + 39 8.7398805727029284e+01 -6.0025559644669265e+01 2.2209742009837157e+01 + 40 2.0540672579010842e+01 -1.0735874009092362e+02 5.8655918369892206e+01 + 41 -5.8895846271372335e+01 1.1852345624639781e+01 -6.6147257724570267e+01 + 42 -9.6895512314642517e+01 3.8928741136688721e+01 -7.5791929957116153e+01 + 43 2.2476051812062425e+02 9.5505204283237461e+01 1.2309042240718746e+02 + 44 8.9817373579488660e+01 -1.0616333580628947e+02 -8.6321519086255464e+01 + 45 1.7202629662584418e+01 1.2890307246697841e+02 5.2916171301068438e+01 + 46 1.3547783972601877e+01 -2.9276223331260034e+01 2.2187412696867373e+01 + 47 3.3389762514712125e+01 -1.9217585014965050e+02 -6.9956213241088321e+01 + 48 7.3631720332112678e+01 -2.0953007324688531e+02 -2.3183566221404764e+01 + 49 -3.7589944473227263e+02 -2.4083165714763936e+01 1.0770339502610540e+02 + 50 3.8603083564823876e+01 -7.3616481568799330e+01 9.0414065019644610e+01 51 1.3736420686706188e+02 -1.0204157331506994e+02 1.5813725581150808e+02 - 52 -1.0797257051087824e+02 1.1876975735151170e+02 -1.3295758126486243e+02 - 53 -5.3807540206295350e+01 3.3259462625854701e+02 -3.8426833263187632e-03 - 54 -1.0690184616186752e+01 6.2820270853646427e+01 1.8343158343321130e+02 - 55 1.1231900459987581e+02 -1.7906654831317167e+02 7.6533681064340854e+01 - 56 -4.1027190034916586e+01 -1.4085413191133770e+02 3.7483064289953241e+01 - 57 9.9904315214040494e+01 7.0938939080461637e+01 -6.8654961257661526e+01 - 58 -2.7563642882026748e+01 -6.7445498717142405e+00 -1.8442640542823220e+01 - 59 -6.6628933617875418e+01 1.0613066354110040e+02 8.7736153919831665e+01 - 60 -1.7748415247438995e+01 6.3757605316872542e+01 -1.5086907478326543e+02 - 61 -3.3560907195791366e+01 -1.0076987083174090e+02 -7.4536106106935819e+01 - 62 1.5883428926665005e+01 -5.8433760297908881e+00 2.8392494016034941e+01 - 63 1.3294494001298787e+02 -1.2724568063770238e+02 -6.4886848316806251e+01 - 64 1.0738157273930993e+02 1.2062173788161539e+02 7.4541400611710785e+01 + 52 -1.0797257051087827e+02 1.1876975735151170e+02 -1.3295758126486243e+02 + 53 -5.3807540206295386e+01 3.3259462625854701e+02 -3.8426833262903415e-03 + 54 -1.0690184616186778e+01 6.2820270853646484e+01 1.8343158343321133e+02 + 55 1.1231900459987581e+02 -1.7906654831317167e+02 7.6533681064340868e+01 + 56 -4.1027190034916501e+01 -1.4085413191133770e+02 3.7483064289953184e+01 + 57 9.9904315214040494e+01 7.0938939080461608e+01 -6.8654961257661554e+01 + 58 -2.7563642882026748e+01 -6.7445498717142298e+00 -1.8442640542823217e+01 + 59 -6.6628933617875447e+01 1.0613066354110043e+02 8.7736153919831693e+01 + 60 -1.7748415247438984e+01 6.3757605316872557e+01 -1.5086907478326543e+02 + 61 -3.3560907195791373e+01 -1.0076987083174085e+02 -7.4536106106935819e+01 + 62 1.5883428926665005e+01 -5.8433760297908881e+00 2.8392494016034934e+01 + 63 1.3294494001298784e+02 -1.2724568063770243e+02 -6.4886848316806294e+01 + 64 1.0738157273930993e+02 1.2062173788161542e+02 7.4541400611710799e+01 run_vdwl: -3296.346882377749 run_coul: -327.0653995073912 run_stress: ! |- - -1.0521225462925122e+03 -1.2628780139889509e+03 -8.6757617693085899e+02 -2.5158592653603847e+02 2.0619472152426923e+02 -6.4312943979323541e+02 + -1.0521225462925122e+03 -1.2628780139889511e+03 -8.6757617693086104e+02 -2.5158592653603904e+02 2.0619472152426832e+02 -6.4312943979323666e+02 run_forces: ! |2 - 1 -8.8486129396001530e+01 -2.5824483374473200e+01 1.0916517213634106e+02 - 2 -1.1227648453173390e+02 -1.8093214754186130e+02 -2.2420118533940354e+02 - 3 -1.7210894875994978e+02 1.8292263268451674e+02 1.3551979435686139e+01 - 4 3.2999405001009407e+01 -5.1077312719545837e+01 9.0478579144069556e+01 - 5 1.8144963583123214e+02 1.6798391906831810e+01 -8.1723378082075570e+01 - 6 1.3640835897739447e+02 -3.0059507544862095e+02 2.9594750460783345e+01 - 7 -5.3287619129789434e+01 -1.2872953167026756e+02 -1.6348317368624129e+02 - 8 -1.5334990952322434e+02 4.0171746946780843e+01 1.5317542403106131e+02 - 9 1.8362961213927139e+01 8.1984428717784255e+01 2.8273598253027259e+01 - 10 8.4245458094789043e+01 1.4177227430519346e+02 1.2329899933660965e+02 - 11 -4.3217035356344425e+01 6.5547850976510759e+01 1.3463983671946417e+02 - 12 -9.7319343004573113e+01 -2.6236499899232278e+01 7.2232061905742402e+00 - 13 -6.3184735475530402e+01 -4.7368090836538087e+01 -3.7590268076036111e+01 - 14 7.8642680121803977e+01 -6.7994653297646451e+01 -9.9042134233434012e+01 - 15 -6.6371195967082826e+01 2.1787700653339664e+02 8.0102624694807375e+01 - 16 1.9215832443892597e+02 5.3231888618093983e+01 6.6253846562695074e+01 - 17 1.4496126989603110e+02 -3.9700366098757222e+01 -9.7506725874209380e+01 - 18 -4.4989211400008614e+01 -1.9360716191976445e+02 1.1274798810455862e+02 - 19 2.6657546213782740e+02 3.7189369483257695e+02 -3.3847202166068035e+02 - 20 -7.6352829159880940e+01 -8.8469178952301604e+01 1.3384778817072185e+00 - 21 -7.1188597560667432e+01 -5.1592404200740106e+01 -1.2279357314243519e+02 - 22 1.5504965184741241e+02 -1.3094582932680530e+02 8.1473922626938005e+01 - 23 7.8017376001392932e+01 -1.3263023728607561e+01 -2.2771654676273968e+01 - 24 -2.0547634460482251e+02 2.1612342044348730e+02 -1.2423651650061706e+02 - 25 -1.1402944116091903e+02 1.9100648219391277e+02 -8.3505645569845370e+01 - 26 2.8664542299410533e+02 -2.1774609219880716e+02 2.3144720166994406e+02 - 27 -6.3243843868043029e+01 6.9123801262965273e+01 1.8607035157681673e+02 - 28 -3.5444604841998415e+00 3.8760531647714480e+01 3.2869123667281706e+01 - 29 -7.1069494158179211e+01 3.5486459158760582e+01 2.7311657876181052e+01 - 30 -1.7037059987992399e+02 -1.9851840131669357e+02 -1.1511410156295636e+02 - 31 -1.3970663440086005e+02 1.6660841802305001e+02 -1.2914070628112796e+02 - 32 2.7179939937138432e+01 -6.0162678551485513e+01 -1.7668459764117441e+02 - 33 -6.2659124615698168e+01 -6.4421915847941520e+01 6.4151176691093482e+01 - 34 -2.2118740875419455e+01 1.0450303589341144e+02 -7.3997370482692972e+01 - 35 2.6987081482968875e+02 -2.1523754104000355e+02 1.3052736086179604e+02 - 36 1.0368798521815543e+02 1.8816694370725344e+02 -1.9748485159172907e+02 - 37 -1.8012152564003850e+02 1.2997662140302859e+02 -6.3547259053587872e+01 - 38 -2.9571525697590829e+02 1.0441941743734588e+02 1.5582112543442358e+02 - 39 8.7399620724575271e+01 -6.0025787992411310e+01 2.2209357601282150e+01 - 40 2.0541458171950978e+01 -1.0735817059033018e+02 5.8656280350524320e+01 - 41 -5.8893965304899986e+01 1.1850504754314887e+01 -6.6138932259022468e+01 - 42 -9.6894702780992361e+01 3.8926449644174809e+01 -7.5794133002764795e+01 - 43 2.2475651760389383e+02 9.5503072846836503e+01 1.2308683766845400e+02 - 44 8.9821846939843113e+01 -1.0615882525757857e+02 -8.6326896770189890e+01 - 45 1.7193681344342288e+01 1.2889564928820624e+02 5.2922372841252404e+01 - 46 1.3549091739280335e+01 -2.9276447091757493e+01 2.2187152043656500e+01 - 47 3.3389460345593150e+01 -1.9217121673024420e+02 -6.9954603582952544e+01 - 48 7.3644268618852763e+01 -2.0953201921822830e+02 -2.3192562071413278e+01 - 49 -3.7593958318941031e+02 -2.4028439106859878e+01 1.0779151134441000e+02 - 50 3.8603926624328551e+01 -7.3615255297989435e+01 9.0412505212292402e+01 + 1 -8.8486129396001502e+01 -2.5824483374473179e+01 1.0916517213634110e+02 + 2 -1.1227648453173391e+02 -1.8093214754186130e+02 -2.2420118533940348e+02 + 3 -1.7210894875994978e+02 1.8292263268451674e+02 1.3551979435686095e+01 + 4 3.2999405001009350e+01 -5.1077312719545880e+01 9.0478579144069585e+01 + 5 1.8144963583123231e+02 1.6798391906831846e+01 -8.1723378082075712e+01 + 6 1.3640835897739439e+02 -3.0059507544862095e+02 2.9594750460783359e+01 + 7 -5.3287619129789448e+01 -1.2872953167026756e+02 -1.6348317368624123e+02 + 8 -1.5334990952322434e+02 4.0171746946780829e+01 1.5317542403106131e+02 + 9 1.8362961213927182e+01 8.1984428717784269e+01 2.8273598253027302e+01 + 10 8.4245458094789058e+01 1.4177227430519352e+02 1.2329899933660965e+02 + 11 -4.3217035356344425e+01 6.5547850976510773e+01 1.3463983671946411e+02 + 12 -9.7319343004573128e+01 -2.6236499899232264e+01 7.2232061905742331e+00 + 13 -6.3184735475530417e+01 -4.7368090836538116e+01 -3.7590268076036132e+01 + 14 7.8642680121804005e+01 -6.7994653297646451e+01 -9.9042134233434012e+01 + 15 -6.6371195967082826e+01 2.1787700653339661e+02 8.0102624694807389e+01 + 16 1.9215832443892597e+02 5.3231888618093954e+01 6.6253846562695017e+01 + 17 1.4496126989603121e+02 -3.9700366098757279e+01 -9.7506725874209309e+01 + 18 -4.4989211400008635e+01 -1.9360716191976442e+02 1.1274798810455859e+02 + 19 2.6657546213782734e+02 3.7189369483257695e+02 -3.3847202166068030e+02 + 20 -7.6352829159880955e+01 -8.8469178952301633e+01 1.3384778817072787e+00 + 21 -7.1188597560667404e+01 -5.1592404200740077e+01 -1.2279357314243526e+02 + 22 1.5504965184741243e+02 -1.3094582932680530e+02 8.1473922626938020e+01 + 23 7.8017376001392918e+01 -1.3263023728607578e+01 -2.2771654676273979e+01 + 24 -2.0547634460482251e+02 2.1612342044348730e+02 -1.2423651650061711e+02 + 25 -1.1402944116091902e+02 1.9100648219391277e+02 -8.3505645569845370e+01 + 26 2.8664542299410527e+02 -2.1774609219880722e+02 2.3144720166994415e+02 + 27 -6.3243843868043086e+01 6.9123801262965259e+01 1.8607035157681676e+02 + 28 -3.5444604841998202e+00 3.8760531647714458e+01 3.2869123667281691e+01 + 29 -7.1069494158179211e+01 3.5486459158760596e+01 2.7311657876181030e+01 + 30 -1.7037059987992404e+02 -1.9851840131669360e+02 -1.1511410156295638e+02 + 31 -1.3970663440086005e+02 1.6660841802305001e+02 -1.2914070628112793e+02 + 32 2.7179939937138435e+01 -6.0162678551485499e+01 -1.7668459764117441e+02 + 33 -6.2659124615698147e+01 -6.4421915847941477e+01 6.4151176691093468e+01 + 34 -2.2118740875419469e+01 1.0450303589341145e+02 -7.3997370482692958e+01 + 35 2.6987081482968881e+02 -2.1523754104000349e+02 1.3052736086179610e+02 + 36 1.0368798521815542e+02 1.8816694370725344e+02 -1.9748485159172907e+02 + 37 -1.8012152564003850e+02 1.2997662140302853e+02 -6.3547259053587815e+01 + 38 -2.9571525697590823e+02 1.0441941743734586e+02 1.5582112543442355e+02 + 39 8.7399620724575229e+01 -6.0025787992411310e+01 2.2209357601282100e+01 + 40 2.0541458171950950e+01 -1.0735817059033015e+02 5.8656280350524284e+01 + 41 -5.8893965304899957e+01 1.1850504754314873e+01 -6.6138932259022440e+01 + 42 -9.6894702780992304e+01 3.8926449644174781e+01 -7.5794133002764809e+01 + 43 2.2475651760389385e+02 9.5503072846836503e+01 1.2308683766845402e+02 + 44 8.9821846939843127e+01 -1.0615882525757857e+02 -8.6326896770189890e+01 + 45 1.7193681344342274e+01 1.2889564928820624e+02 5.2922372841252461e+01 + 46 1.3549091739280328e+01 -2.9276447091757490e+01 2.2187152043656504e+01 + 47 3.3389460345593179e+01 -1.9217121673024417e+02 -6.9954603582952572e+01 + 48 7.3644268618852792e+01 -2.0953201921822824e+02 -2.3192562071413271e+01 + 49 -3.7593958318941031e+02 -2.4028439106859906e+01 1.0779151134441003e+02 + 50 3.8603926624328523e+01 -7.3615255297989492e+01 9.0412505212292430e+01 51 1.3736689552214156e+02 -1.0204490780187869e+02 1.5814099219652564e+02 - 52 -1.0797151154267745e+02 1.1876989597626186e+02 -1.3296150756377074e+02 - 53 -5.3843453069456601e+01 3.3257024143956778e+02 -2.3416395383797806e-02 - 54 -1.0678049522667429e+01 6.2807424617056597e+01 1.8344969045860523e+02 + 52 -1.0797151154267748e+02 1.1876989597626186e+02 -1.3296150756377079e+02 + 53 -5.3843453069456565e+01 3.3257024143956778e+02 -2.3416395383840438e-02 + 54 -1.0678049522667443e+01 6.2807424617056597e+01 1.8344969045860518e+02 55 1.1232135576105661e+02 -1.7906994470561881e+02 7.6534265234548187e+01 - 56 -4.1035945990527679e+01 -1.4084577238065074e+02 3.7489705598247994e+01 - 57 9.9903872061946146e+01 7.0936213558024505e+01 -6.8656338416452527e+01 - 58 -2.7563844572724122e+01 -6.7426705471926862e+00 -1.8442803060445037e+01 - 59 -6.6637290503389465e+01 1.0613630918459926e+02 8.7741455199772943e+01 - 60 -1.7749706497437362e+01 6.3756413885635943e+01 -1.5086911682892702e+02 - 61 -3.3559889608749941e+01 -1.0076809277084801e+02 -7.4536003122046239e+01 - 62 1.5883833834736409e+01 -5.8439916924703503e+00 2.8393403991146943e+01 - 63 1.3294237052896716e+02 -1.2724619636183067e+02 -6.4882384014219042e+01 - 64 1.0738250214938945e+02 1.2062290362868877e+02 7.4541927445529197e+01 + 56 -4.1035945990527694e+01 -1.4084577238065074e+02 3.7489705598247951e+01 + 57 9.9903872061946146e+01 7.0936213558024505e+01 -6.8656338416452499e+01 + 58 -2.7563844572724129e+01 -6.7426705471926915e+00 -1.8442803060445037e+01 + 59 -6.6637290503389465e+01 1.0613630918459928e+02 8.7741455199772943e+01 + 60 -1.7749706497437348e+01 6.3756413885635929e+01 -1.5086911682892702e+02 + 61 -3.3559889608749927e+01 -1.0076809277084796e+02 -7.4536003122046253e+01 + 62 1.5883833834736409e+01 -5.8439916924703361e+00 2.8393403991146915e+01 + 63 1.3294237052896716e+02 -1.2724619636183061e+02 -6.4882384014219113e+01 + 64 1.0738250214938944e+02 1.2062290362868877e+02 7.4541927445529197e+01 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index d91caa277c..59cb7b5261 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -1,8 +1,7 @@ --- lammps_version: 2 Jul 2021 -date_generated: Mon Jul 12 20:56:38 2021 +date_generated: Wed Jul 21 15:49:47 2021 epsilon: 1e-12 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -38,139 +37,139 @@ natoms: 64 init_vdwl: -2454.3149508399256 init_coul: -344.1380904917976 init_stress: ! |2- - 4.8195587070292022e+03 4.4865954368949351e+03 3.2679588293062784e+03 -1.8469678134590688e+03 7.6556385424846496e+02 -4.9517278307742413e+02 + 4.8195587070292022e+03 4.4865954368949333e+03 3.2679588293062807e+03 -1.8469678134590695e+03 7.6556385424846383e+02 -4.9517278307742527e+02 init_forces: ! |2 - 1 -1.9811664067580182e+02 -1.5618748554879582e+02 -1.0716617094919907e+02 - 2 -4.1075966889759563e+01 -6.7708246449675840e+01 -4.2506724189242647e+01 - 3 3.1596544789529471e+01 8.8571277602644201e+01 1.4850846557451504e+02 - 4 1.7447178183928099e+02 3.2866954415453613e+01 -3.1178861314762706e+01 - 5 1.1873199005659009e+02 5.9095115842131946e+01 2.3739439807686179e+02 - 6 1.3052453610124778e+03 -4.4208109447713031e+02 -1.4245452171137988e+03 - 7 -8.7153363585941023e+01 -1.0895261162467337e+02 -3.5604687372058106e+02 - 8 -9.1047579854191540e+01 4.4450937169776367e+01 1.1879559986803962e+02 - 9 4.7456602925193245e+01 1.7227642506022178e+02 -1.4638226748446916e+01 - 10 6.3508986324759796e+01 4.8590610415561784e+01 1.1075535682642920e+01 - 11 -5.1919052217198669e+01 7.3820742396411859e+01 5.1375340691983297e+01 - 12 -1.0171933720752882e+02 -1.9845958414353028e+01 -1.7437665462751706e+01 - 13 -7.3048376131504796e+01 -4.5586627360377669e+01 2.8533062846208733e+01 - 14 8.6287140258369817e+01 -4.1664353236768321e+01 1.7094340432182378e+01 - 15 -3.5690271737605428e+01 1.2671711108383720e+02 4.5865072089126144e+01 - 16 1.0608232372370766e+02 3.5980003156299802e+01 1.8676593635940499e+01 - 17 2.3577630118103411e+02 -9.8579505236746968e+01 4.1005658232556200e+01 - 18 -2.0815299273687735e+01 -1.1578579968450298e+02 6.5566787154472507e+01 - 19 4.3265264076046996e+01 1.0913234729250232e+02 3.0900987497773690e+02 - 20 -1.0086773950039240e+02 7.4841212143883325e+01 -1.6547856280073117e+02 - 21 -8.5974538718179744e+01 -4.5982868874732929e+00 -7.3066508052444064e+01 - 22 1.3343492132570225e+02 -1.2211943449611955e+02 9.0328124087551757e+01 - 23 5.2985077374887140e+01 2.0040750326966958e+01 -9.0416982004666480e+00 - 24 -1.8957025969382849e+02 8.1671696884795921e+01 -1.2920621849543499e+01 - 25 -1.0067836293726950e+02 1.3220054680372047e+02 -4.8975895235994550e+01 - 26 2.1849478729429609e+02 -1.9386903120078875e+02 1.7116657218419908e+02 - 27 -3.7478069218092728e+01 3.0044804022729718e+01 9.3872627169948615e+01 - 28 9.9359193467603504e+01 -5.5156189036814503e+01 -3.1541196450035848e+01 - 29 -3.9530012231991570e+01 5.6689953230829921e+01 2.5358584427671751e+01 + 1 -1.9811664067580179e+02 -1.5618748554879582e+02 -1.0716617094919901e+02 + 2 -4.1075966889759549e+01 -6.7708246449675826e+01 -4.2506724189242625e+01 + 3 3.1596544789529435e+01 8.8571277602644230e+01 1.4850846557451499e+02 + 4 1.7447178183928099e+02 3.2866954415453542e+01 -3.1178861314762706e+01 + 5 1.1873199005659021e+02 5.9095115842131932e+01 2.3739439807686179e+02 + 6 1.3052453610124783e+03 -4.4208109447713036e+02 -1.4245452171137993e+03 + 7 -8.7153363585941023e+01 -1.0895261162467335e+02 -3.5604687372058106e+02 + 8 -9.1047579854191568e+01 4.4450937169776367e+01 1.1879559986803960e+02 + 9 4.7456602925193202e+01 1.7227642506022178e+02 -1.4638226748446902e+01 + 10 6.3508986324759796e+01 4.8590610415561791e+01 1.1075535682642935e+01 + 11 -5.1919052217198654e+01 7.3820742396411859e+01 5.1375340691983297e+01 + 12 -1.0171933720752882e+02 -1.9845958414353014e+01 -1.7437665462751710e+01 + 13 -7.3048376131504796e+01 -4.5586627360377697e+01 2.8533062846208718e+01 + 14 8.6287140258369817e+01 -4.1664353236768306e+01 1.7094340432182349e+01 + 15 -3.5690271737605421e+01 1.2671711108383721e+02 4.5865072089126137e+01 + 16 1.0608232372370769e+02 3.5980003156299816e+01 1.8676593635940495e+01 + 17 2.3577630118103411e+02 -9.8579505236746911e+01 4.1005658232556200e+01 + 18 -2.0815299273687735e+01 -1.1578579968450295e+02 6.5566787154472507e+01 + 19 4.3265264076046989e+01 1.0913234729250236e+02 3.0900987497773690e+02 + 20 -1.0086773950039242e+02 7.4841212143883340e+01 -1.6547856280073117e+02 + 21 -8.5974538718179744e+01 -4.5982868874733214e+00 -7.3066508052444064e+01 + 22 1.3343492132570225e+02 -1.2211943449611955e+02 9.0328124087551771e+01 + 23 5.2985077374887155e+01 2.0040750326966961e+01 -9.0416982004666124e+00 + 24 -1.8957025969382852e+02 8.1671696884795935e+01 -1.2920621849543528e+01 + 25 -1.0067836293726948e+02 1.3220054680372053e+02 -4.8975895235994550e+01 + 26 2.1849478729429609e+02 -1.9386903120078870e+02 1.7116657218419911e+02 + 27 -3.7478069218092713e+01 3.0044804022729696e+01 9.3872627169948643e+01 + 28 9.9359193467603504e+01 -5.5156189036814489e+01 -3.1541196450035862e+01 + 29 -3.9530012231991570e+01 5.6689953230829886e+01 2.5358584427671758e+01 30 -9.7652246814367359e+01 -2.2271920242502716e+02 -1.4460601547049507e+02 - 31 -4.6192346966779532e+01 7.2790084189834928e+01 3.1159158603346764e+01 - 32 1.2013060628467292e+01 -3.4474347848945314e+01 -1.0622600014669138e+02 - 33 5.2551051115345523e+01 4.2704675585248630e+01 -3.0154896799401914e+01 - 34 1.6822864099952500e+02 -1.6889974455036809e-02 1.1832622696299902e+02 - 35 5.1185090023661428e+02 -1.3214021604987859e+03 1.1319907541000694e+03 - 36 -1.4331382529302426e+01 9.9702896436312997e+01 -1.3159358421899245e+02 - 37 -8.9317756897655033e+02 1.3544128453102780e+03 -7.5922493710251501e+02 - 38 -3.8384748878233427e+02 1.2143676601363953e+02 1.7580047976723324e+02 - 39 1.6381134310552264e+02 -1.2998574463953725e+01 -7.8542909545441546e+01 - 40 6.1412235617277197e+01 -2.0153615037331058e+01 4.3186957794586576e+01 - 41 1.3114484088383918e+01 1.7854214885793702e+00 3.3683765652624928e+01 - 42 -6.4838533708029459e+01 5.2662237041257001e+01 -6.8645855319469462e+01 + 31 -4.6192346966779525e+01 7.2790084189834928e+01 3.1159158603346764e+01 + 32 1.2013060628467285e+01 -3.4474347848945321e+01 -1.0622600014669140e+02 + 33 5.2551051115345523e+01 4.2704675585248637e+01 -3.0154896799401911e+01 + 34 1.6822864099952500e+02 -1.6889974455004834e-02 1.1832622696299902e+02 + 35 5.1185090023661456e+02 -1.3214021604987863e+03 1.1319907541000696e+03 + 36 -1.4331382529302426e+01 9.9702896436313011e+01 -1.3159358421899239e+02 + 37 -8.9317756897655045e+02 1.3544128453102783e+03 -7.5922493710251524e+02 + 38 -3.8384748878233427e+02 1.2143676601363948e+02 1.7580047976723321e+02 + 39 1.6381134310552267e+02 -1.2998574463953721e+01 -7.8542909545441532e+01 + 40 6.1412235617277204e+01 -2.0153615037331058e+01 4.3186957794586569e+01 + 41 1.3114484088383939e+01 1.7854214885793560e+00 3.3683765652624942e+01 + 42 -6.4838533708029473e+01 5.2662237041257001e+01 -6.8645855319469405e+01 43 2.0925885626252014e+02 8.2942516657430232e+01 1.1786724503954686e+02 - 44 -3.8463410277622422e+01 -7.5319916775508801e+01 -1.3445887472637639e+02 - 45 -3.4797907366084118e+01 7.6266761873332939e+01 4.3023416525122556e+01 - 46 2.3463432665038621e+01 -1.5313857576705704e+01 -3.8707451594223810e+00 - 47 -3.7271493199629646e+01 -5.4876511333920163e+01 -1.9275411927395847e+01 - 48 2.8275275023555395e+02 -1.7973942289882834e+02 -6.0167953907639014e+02 - 49 -2.0529905689923421e+03 -6.7838314309842531e+01 7.6230272883402529e+02 - 50 1.3292222637274614e+02 -9.8795036249084134e+01 9.9132259532945980e+01 + 44 -3.8463410277622415e+01 -7.5319916775508815e+01 -1.3445887472637642e+02 + 45 -3.4797907366084097e+01 7.6266761873332939e+01 4.3023416525122514e+01 + 46 2.3463432665038606e+01 -1.5313857576705701e+01 -3.8707451594223872e+00 + 47 -3.7271493199629653e+01 -5.4876511333920178e+01 -1.9275411927395869e+01 + 48 2.8275275023555378e+02 -1.7973942289882839e+02 -6.0167953907638991e+02 + 49 -2.0529905689923417e+03 -6.7838314309842517e+01 7.6230272883402574e+02 + 50 1.3292222637274611e+02 -9.8795036249084106e+01 9.9132259532945980e+01 51 2.6168921895029303e+02 -1.9761595427509062e+02 2.4062513751852873e+02 - 52 -1.2257063176561176e+02 1.3353869954874421e+02 -1.1598337420807962e+02 - 53 3.8021621191835891e+02 8.1199705966172507e+02 2.7057346247419940e+02 - 54 6.9440336670547097e+01 -1.1592524541887400e+02 2.2072297942372262e+02 - 55 8.7300666059627744e+01 -1.3907353173150560e+02 5.9541107879138558e+01 - 56 3.4771676857170326e+02 -2.4546959502036665e+02 -3.5077189358394349e+02 - 57 6.1706174952483430e+01 7.9893925286373715e+01 3.4373445887630085e+00 - 58 3.7240798760941452e+01 -1.2919400623491822e+02 3.9695110774075808e+01 - 59 -5.2076445103995331e+02 2.1046582886974142e+02 1.7083299176148790e+02 - 60 -7.8657547105875338e+01 -2.3005356890255392e+01 -1.2454833328198771e+02 + 52 -1.2257063176561179e+02 1.3353869954874421e+02 -1.1598337420807965e+02 + 53 3.8021621191835851e+02 8.1199705966172485e+02 2.7057346247419935e+02 + 54 6.9440336670547069e+01 -1.1592524541887394e+02 2.2072297942372259e+02 + 55 8.7300666059627744e+01 -1.3907353173150562e+02 5.9541107879138558e+01 + 56 3.4771676857170337e+02 -2.4546959502036671e+02 -3.5077189358394361e+02 + 57 6.1706174952483430e+01 7.9893925286373715e+01 3.4373445887630369e+00 + 58 3.7240798760941445e+01 -1.2919400623491822e+02 3.9695110774075808e+01 + 59 -5.2076445103995343e+02 2.1046582886974139e+02 1.7083299176148785e+02 + 60 -7.8657547105875310e+01 -2.3005356890255410e+01 -1.2454833328198774e+02 61 -3.9633103573229910e+01 -5.5165443660352402e+01 -4.0780192434587690e+01 - 62 -1.8742346202622763e+01 -1.3844690899539831e+01 2.2586546200036643e+00 - 63 6.5150947885422269e+01 7.1009493033300544e+01 -8.4093092375006023e+01 - 64 4.0079516427458081e+01 9.6476598333945958e+01 9.1213458480138442e+01 + 62 -1.8742346202622748e+01 -1.3844690899539831e+01 2.2586546200036359e+00 + 63 6.5150947885422283e+01 7.1009493033300544e+01 -8.4093092375006009e+01 + 64 4.0079516427458060e+01 9.6476598333945972e+01 9.1213458480138428e+01 run_vdwl: -2454.3233099608155 run_coul: -344.1379608070739 run_stress: ! |2- - 4.8194587329953674e+03 4.4865895224706956e+03 3.2679446938086498e+03 -1.8471163065259325e+03 7.6545324620049087e+02 -4.9527853267788902e+02 + 4.8194587329953692e+03 4.4865895224706946e+03 3.2679446938086485e+03 -1.8471163065259320e+03 7.6545324620049041e+02 -4.9527853267789004e+02 run_forces: ! |2 - 1 -1.9811556407056105e+02 -1.5618143620847076e+02 -1.0716119874908736e+02 - 2 -4.1073968384374822e+01 -6.7710647015369261e+01 -4.2502864658157357e+01 - 3 3.1592798331689554e+01 8.8575236369726497e+01 1.4850890801985440e+02 - 4 1.7447282006187956e+02 3.2862369867970486e+01 -3.1175721266394820e+01 - 5 1.1873112974792335e+02 5.9090963929048286e+01 2.3738916225937453e+02 - 6 1.3053008444613590e+03 -4.4210323642713990e+02 -1.4246081409032693e+03 - 7 -8.7152343512651925e+01 -1.0895314566818783e+02 -3.5604721285130660e+02 - 8 -9.1046846091347717e+01 4.4451665481009478e+01 1.1879618751723048e+02 - 9 4.7463133585713976e+01 1.7228438483982211e+02 -1.4645071927693378e+01 - 10 6.3506921990797963e+01 4.8587688349158157e+01 1.1073324095443047e+01 - 11 -5.1917951887543467e+01 7.3818630188510326e+01 5.1369234828489169e+01 - 12 -1.0172154753205886e+02 -1.9847809999838844e+01 -1.7441731987232995e+01 - 13 -7.3048126072731904e+01 -4.5586545373889699e+01 2.8534758158919548e+01 - 14 8.6288077929554390e+01 -4.1660634795038867e+01 1.7096747148188005e+01 - 15 -3.5688114877422009e+01 1.2671728980619932e+02 4.5864235397118819e+01 - 16 1.0608395201173668e+02 3.5983845233526992e+01 1.8672925070386189e+01 - 17 2.3576828121395241e+02 -9.8577850318505511e+01 4.1004495565128586e+01 - 18 -2.0815095995902741e+01 -1.1578710179047430e+02 6.5566934287391263e+01 - 19 4.3264252619509847e+01 1.0912982970441868e+02 3.0901253523346554e+02 - 20 -1.0088948935029296e+02 7.4849484282711913e+01 -1.6550538409007385e+02 - 21 -8.5974038585183081e+01 -4.5987854992617834e+00 -7.3065890363335626e+01 - 22 1.3343130763213867e+02 -1.2211553430043760e+02 9.0325064574872243e+01 - 23 5.2984912690315269e+01 2.0042805349785095e+01 -9.0417924141684995e+00 - 24 -1.8954830238390488e+02 8.1645824240164018e+01 -1.2893974448861035e+01 - 25 -1.0068116183998592e+02 1.3220505876703567e+02 -4.8977129584747800e+01 - 26 2.1847179335289820e+02 -1.9385136258527231e+02 1.7114800244815061e+02 - 27 -3.7476307441658193e+01 3.0046433191315710e+01 9.3873685757283738e+01 - 28 9.9355970623229197e+01 -5.5158350569168128e+01 -3.1544144508393853e+01 - 29 -3.9530224377035040e+01 5.6690552166969916e+01 2.5358784555346130e+01 - 30 -9.7652510697052605e+01 -2.2271892169387453e+02 -1.4460597467192864e+02 - 31 -4.6194950503295722e+01 7.2792554749932378e+01 3.1151667586195479e+01 - 32 1.2014466624027639e+01 -3.4469133688337756e+01 -1.0621837802800977e+02 - 33 5.2553699854339712e+01 4.2706400148046903e+01 -3.0154323622364608e+01 - 34 1.6822906612351349e+02 -1.7651825961895091e-02 1.1832699040444524e+02 - 35 5.1193507571856594e+02 -1.3215008853106001e+03 1.1320319719742358e+03 - 36 -1.4340338085502863e+01 9.9690347849156822e+01 -1.3158127406978679e+02 - 37 -8.9323390159980181e+02 1.3545163222654817e+03 -7.5929442355796721e+02 - 38 -3.8384755818822509e+02 1.2143789174035305e+02 1.7579570815453911e+02 - 39 1.6381197094628513e+02 -1.2998258674043836e+01 -7.8543109639931160e+01 - 40 6.1411228642100049e+01 -2.0154566391139259e+01 4.3186834298875652e+01 - 41 1.3119781105415569e+01 1.7920555043075754e+00 3.3686007139293849e+01 - 42 -6.4838490750749202e+01 5.2660553302313652e+01 -6.8647362072367542e+01 - 43 2.0926308211689772e+02 8.2945847275902722e+01 1.1786850503407649e+02 - 44 -3.8461829626420936e+01 -7.5317323697263234e+01 -1.3445959877777378e+02 - 45 -3.4805239678702840e+01 7.6262295586966061e+01 4.3024220690600892e+01 - 46 2.3465031078234954e+01 -1.5312554894709733e+01 -3.8725170500358517e+00 - 47 -3.7271036720207945e+01 -5.4879638482209749e+01 -1.9275876359755905e+01 - 48 2.8270391245290489e+02 -1.7971102191169697e+02 -6.0165064633346822e+02 - 49 -2.0529526126133592e+03 -6.7744467074995413e+01 7.6241869031244312e+02 - 50 1.3291615685330385e+02 -9.8801239572742261e+01 9.9131933784099587e+01 + 1 -1.9811556407056102e+02 -1.5618143620847070e+02 -1.0716119874908739e+02 + 2 -4.1073968384374822e+01 -6.7710647015369261e+01 -4.2502864658157385e+01 + 3 3.1592798331689583e+01 8.8575236369726497e+01 1.4850890801985437e+02 + 4 1.7447282006187959e+02 3.2862369867970457e+01 -3.1175721266394834e+01 + 5 1.1873112974792329e+02 5.9090963929048314e+01 2.3738916225937453e+02 + 6 1.3053008444613586e+03 -4.4210323642713996e+02 -1.4246081409032695e+03 + 7 -8.7152343512651953e+01 -1.0895314566818776e+02 -3.5604721285130660e+02 + 8 -9.1046846091347703e+01 4.4451665481009499e+01 1.1879618751723051e+02 + 9 4.7463133585713919e+01 1.7228438483982211e+02 -1.4645071927693349e+01 + 10 6.3506921990797963e+01 4.8587688349158142e+01 1.1073324095443047e+01 + 11 -5.1917951887543467e+01 7.3818630188510312e+01 5.1369234828489176e+01 + 12 -1.0172154753205889e+02 -1.9847809999838830e+01 -1.7441731987232995e+01 + 13 -7.3048126072731876e+01 -4.5586545373889699e+01 2.8534758158919548e+01 + 14 8.6288077929554404e+01 -4.1660634795038867e+01 1.7096747148188040e+01 + 15 -3.5688114877422024e+01 1.2671728980619932e+02 4.5864235397118847e+01 + 16 1.0608395201173666e+02 3.5983845233526999e+01 1.8672925070386196e+01 + 17 2.3576828121395238e+02 -9.8577850318505440e+01 4.1004495565128614e+01 + 18 -2.0815095995902730e+01 -1.1578710179047432e+02 6.5566934287391277e+01 + 19 4.3264252619509840e+01 1.0912982970441865e+02 3.0901253523346554e+02 + 20 -1.0088948935029293e+02 7.4849484282711913e+01 -1.6550538409007382e+02 + 21 -8.5974038585183081e+01 -4.5987854992617692e+00 -7.3065890363335626e+01 + 22 1.3343130763213867e+02 -1.2211553430043763e+02 9.0325064574872258e+01 + 23 5.2984912690315262e+01 2.0042805349785073e+01 -9.0417924141684995e+00 + 24 -1.8954830238390488e+02 8.1645824240163975e+01 -1.2893974448861021e+01 + 25 -1.0068116183998590e+02 1.3220505876703564e+02 -4.8977129584747814e+01 + 26 2.1847179335289815e+02 -1.9385136258527231e+02 1.7114800244815055e+02 + 27 -3.7476307441658179e+01 3.0046433191315703e+01 9.3873685757283724e+01 + 28 9.9355970623229169e+01 -5.5158350569168121e+01 -3.1544144508393824e+01 + 29 -3.9530224377035040e+01 5.6690552166969916e+01 2.5358784555346112e+01 + 30 -9.7652510697052577e+01 -2.2271892169387456e+02 -1.4460597467192858e+02 + 31 -4.6194950503295701e+01 7.2792554749932393e+01 3.1151667586195508e+01 + 32 1.2014466624027643e+01 -3.4469133688337770e+01 -1.0621837802800977e+02 + 33 5.2553699854339705e+01 4.2706400148046903e+01 -3.0154323622364597e+01 + 34 1.6822906612351349e+02 -1.7651825961909302e-02 1.1832699040444521e+02 + 35 5.1193507571856611e+02 -1.3215008853106001e+03 1.1320319719742361e+03 + 36 -1.4340338085502884e+01 9.9690347849156851e+01 -1.3158127406978679e+02 + 37 -8.9323390159980192e+02 1.3545163222654817e+03 -7.5929442355796743e+02 + 38 -3.8384755818822509e+02 1.2143789174035302e+02 1.7579570815453908e+02 + 39 1.6381197094628516e+02 -1.2998258674043829e+01 -7.8543109639931160e+01 + 40 6.1411228642100035e+01 -2.0154566391139259e+01 4.3186834298875652e+01 + 41 1.3119781105415534e+01 1.7920555043075754e+00 3.3686007139293856e+01 + 42 -6.4838490750749202e+01 5.2660553302313680e+01 -6.8647362072367542e+01 + 43 2.0926308211689772e+02 8.2945847275902722e+01 1.1786850503407652e+02 + 44 -3.8461829626420936e+01 -7.5317323697263234e+01 -1.3445959877777375e+02 + 45 -3.4805239678702840e+01 7.6262295586966090e+01 4.3024220690600863e+01 + 46 2.3465031078234958e+01 -1.5312554894709733e+01 -3.8725170500358588e+00 + 47 -3.7271036720207924e+01 -5.4879638482209749e+01 -1.9275876359755912e+01 + 48 2.8270391245290489e+02 -1.7971102191169686e+02 -6.0165064633346822e+02 + 49 -2.0529526126133587e+03 -6.7744467074995427e+01 7.6241869031244289e+02 + 50 1.3291615685330387e+02 -9.8801239572742261e+01 9.9131933784099587e+01 51 2.6169570171244874e+02 -1.9762541199560968e+02 2.4063463246277209e+02 - 52 -1.2256816067286560e+02 1.3353356136884040e+02 -1.1597765595389474e+02 - 53 3.8012282364003778e+02 8.1194045374755683e+02 2.7050484440708368e+02 + 52 -1.2256816067286560e+02 1.3353356136884042e+02 -1.1597765595389475e+02 + 53 3.8012282364003789e+02 8.1194045374755683e+02 2.7050484440708351e+02 54 6.9456553969440762e+01 -1.1593864337324271e+02 2.2074869335520950e+02 55 8.7303368709848343e+01 -1.3907755259033479e+02 5.9542185087028599e+01 - 56 3.4769731101937157e+02 -2.4546533348164235e+02 -3.5075782168770780e+02 - 57 6.1706155820465277e+01 7.9892471516403987e+01 3.4375912204692596e+00 - 58 3.7237511516193948e+01 -1.2919240641738722e+02 3.9695822512620317e+01 - 59 -5.2071132643271164e+02 2.1045883047165901e+02 1.7082619476821390e+02 - 60 -7.8658294909200478e+01 -2.3007149625533529e+01 -1.2454738729229325e+02 - 61 -3.9624794908666530e+01 -5.5169201638846069e+01 -4.0777145486525050e+01 - 62 -1.8741606623350261e+01 -1.3845552517299271e+01 2.2601936169388708e+00 - 63 6.5142845574860658e+01 7.0992677773634583e+01 -8.4109461087571162e+01 - 64 4.0079794681812899e+01 9.6475030340595495e+01 9.1215541718322243e+01 + 56 3.4769731101937145e+02 -2.4546533348164240e+02 -3.5075782168770780e+02 + 57 6.1706155820465291e+01 7.9892471516403972e+01 3.4375912204692454e+00 + 58 3.7237511516193933e+01 -1.2919240641738722e+02 3.9695822512620310e+01 + 59 -5.2071132643271164e+02 2.1045883047165898e+02 1.7082619476821390e+02 + 60 -7.8658294909200450e+01 -2.3007149625533501e+01 -1.2454738729229325e+02 + 61 -3.9624794908666537e+01 -5.5169201638846069e+01 -4.0777145486525072e+01 + 62 -1.8741606623350247e+01 -1.3845552517299250e+01 2.2601936169388566e+00 + 63 6.5142845574860644e+01 7.0992677773634597e+01 -8.4109461087571191e+01 + 64 4.0079794681812906e+01 9.6475030340595453e+01 9.1215541718322228e+01 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index 9cfaaf4625..97fbc95c46 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -1,8 +1,7 @@ --- lammps_version: 2 Jul 2021 -date_generated: Mon Jul 12 20:56:38 2021 +date_generated: Wed Jul 21 15:49:48 2021 epsilon: 5e-13 -skip_tests: omp prerequisites: ! | pair reax/c pre_commands: ! | @@ -33,139 +32,139 @@ natoms: 64 init_vdwl: -8975.381063460629 init_coul: 0.5928529868716559 init_stress: ! |- - -1.1526162173764683e+03 -4.6218014500723461e+02 3.1954383274884901e+02 -2.2197591028227621e+03 3.4480244373669785e+02 -1.2644452447488200e+03 + -1.1526162173764687e+03 -4.6218014500723211e+02 3.1954383274884714e+02 -2.2197591028227603e+03 3.4480244373669649e+02 -1.2644452447488172e+03 init_forces: ! |2 - 1 -2.0916057489019278e+02 -1.8819573882656792e+02 -2.2843342560290171e+02 - 2 -5.9711660034805291e+01 -1.3795294129596448e+02 -6.1450415050409106e+01 - 3 1.0924699545317881e+02 5.4683388561496884e+01 8.7122903226954129e+00 - 4 2.2394129214932286e+02 -1.2607110719575815e+02 5.6116628706921283e+01 - 5 2.1339173392425103e+01 2.3982132147793212e+02 -1.1311227256425612e+02 - 6 -2.3465218593173694e+02 8.7997863600775204e+01 7.1405034243397978e+01 - 7 1.7783507933620086e+02 3.8498185748852194e+01 -2.7669272643606155e+02 - 8 -2.1014288646597468e+01 -4.0711968506334620e+02 1.5140757706928005e+02 - 9 -5.9307137188585735e+01 2.6264734812019469e+02 1.7442573676385443e+01 - 10 -8.4525778086876372e+01 1.5450140994331881e+02 6.0015146335720981e+00 - 11 -1.1159775028831375e+02 1.8656236384929730e+02 3.4449805909515084e+02 - 12 3.3347376393571255e+02 -3.8243903563632881e+02 5.1141444486612528e+01 - 13 -3.9347479057410175e+02 -9.9340014971740487e+01 2.4784035090896253e+02 - 14 1.7611459182140416e+02 -2.8017601742944402e+02 -2.7997644562222024e+02 - 15 2.5245744141516636e+02 -5.4739900421247576e+01 -1.3455773775633745e+02 - 16 1.6595098746018405e+02 1.6278076690062335e+02 4.2176787064349710e+01 - 17 4.0560547690525915e+01 2.0278202415209444e+02 1.1655337573721710e+02 - 18 1.9349019934523830e+02 -3.1749998507536635e+01 -3.0048600991173725e+01 - 19 -5.9067561742604568e+01 1.7643823088626270e+01 -1.0450409059207502e+02 - 20 1.3106558748347643e+02 2.5186173846559516e+01 1.3540015692568889e+02 - 21 -3.2006237187616756e+02 -1.1510771805635616e+02 -2.5816513201572068e+01 - 22 -1.2737471666033539e+01 -1.3033080251953407e+02 -1.4399680837176066e+02 - 23 -1.0142123148353758e+02 2.3316671624708323e+02 2.3905950409694179e+02 - 24 4.1563056415358169e+01 -1.2911164666848796e+01 -3.1668646816892700e+01 - 25 2.1166667371090460e+02 -2.0418293867725825e+02 -3.1232107629433731e+01 - 26 -2.6320989589682614e+02 1.2065128452552987e+02 2.6277305997802796e+02 - 27 -7.4498892273813865e+01 1.0778676260209129e+02 1.6095170163345196e+02 - 28 -2.4911277843488330e+02 -9.8499434443852323e+01 2.2239731087969662e+02 - 29 4.5655943120047868e+02 -5.6181584973687457e+01 -2.7582701917178326e+02 - 30 -1.1441865289035461e+02 5.2275082681973409e+01 -1.7193995473573816e+02 - 31 -1.8373014671249769e+02 -1.0039330382749462e+02 -9.6978960598961947e+01 - 32 1.5285998335729258e+02 -1.2909970668700703e+02 -1.8526770753201481e+02 - 33 2.0676721005976013e+01 3.7957156269713232e+02 -3.0331770321178414e+01 - 34 -1.8483566994370270e+02 -8.4859568901690906e+01 -1.0334717791993535e+02 - 35 -4.3920895665271935e+01 1.3832065189158040e+00 3.2302673529697479e+01 - 36 6.0407395927653840e+02 6.3222430241983602e+02 -1.5530384927410198e+01 - 37 -1.7704334275340958e+02 -3.4711199127962510e+02 2.0757920588578631e+02 - 38 -1.5990280705026578e+02 3.4383476554695534e+01 -1.1348860416567172e+02 - 39 1.2481780186485386e+02 3.1854282379699551e+01 2.4141006149778542e+02 - 40 -3.3952439214884555e+02 -5.2081203805390805e+02 -3.2749145453037904e+01 - 41 1.5953768898032132e+01 -2.5259433402085026e+01 -6.0977489335468242e+01 - 42 -3.5152692860571921e+02 1.0103192674618649e+02 1.0057493004151380e+02 - 43 1.8325251692529525e+02 -1.7843397924740284e+01 3.5813821983655600e+01 - 44 -1.7148730839833942e+02 6.5823249480752622e+01 -3.9043544554425509e+01 - 45 6.8021934986582622e+01 -5.2957926506736321e+01 -1.1278207528809645e+02 - 46 -1.9814589514445538e+02 3.1899128186018817e+02 -1.7125192460144410e+02 - 47 2.3518092199846146e+02 1.7325250425397039e+02 -4.6491315549358909e+01 - 48 -7.0934283327750434e+00 -2.1510500994703639e+02 2.8256786369777672e+02 - 49 2.4924479910930853e+02 -2.5977407369868601e+01 -1.9539857038363738e+02 - 50 9.0194565818523955e+01 2.6674460312457484e+02 4.8188042682115714e+01 - 51 2.7001317908987642e+02 -2.5024437918679871e+02 3.3082272466414395e+02 - 52 2.6770006025654067e+02 -1.3486195976744685e+02 -1.0999251813934440e+02 - 53 -3.0038447974652507e+02 1.7427208891886863e+02 -2.8369940533043155e+02 - 54 -1.8044322949045332e+02 3.2006167622599366e+02 -2.1986764638272368e+02 - 55 -6.7026995338193785e+01 2.8420556560193825e+02 -1.8256943632991815e+02 - 56 -9.3944897793228427e+02 7.6593871052490795e+02 -4.5872941120666036e+02 - 57 -2.7671724574062154e+01 -1.7257977562305285e+02 -1.6210118849324644e+02 - 58 7.1032070297632515e+02 -8.0881938208311499e+02 4.6676948457734852e+02 - 59 1.5682857500225748e+02 5.9891527233627251e+01 1.2646558890105979e+02 - 60 9.4076874705709940e+01 -1.1749874299724536e+02 -2.9919368333582653e+01 - 61 -4.8945763699767674e+01 1.6634783727405593e+02 6.7645978441449785e+01 - 62 1.6618577867039602e+02 7.3503605317082432e+01 2.2193892218236812e+02 - 63 4.6491757293229652e+00 -3.5581179274724047e+02 -3.8944419279304846e+01 - 64 -2.0021113303887086e+02 -1.1223202348830974e+02 3.0276216112541510e+02 + 1 -2.0916057489019281e+02 -1.8819573882656800e+02 -2.2843342560290168e+02 + 2 -5.9711660034805249e+01 -1.3795294129596448e+02 -6.1450415050409148e+01 + 3 1.0924699545317881e+02 5.4683388561496862e+01 8.7122903226952957e+00 + 4 2.2394129214932281e+02 -1.2607110719575809e+02 5.6116628706921283e+01 + 5 2.1339173392425174e+01 2.3982132147793220e+02 -1.1311227256425610e+02 + 6 -2.3465218593173694e+02 8.7997863600775275e+01 7.1405034243397949e+01 + 7 1.7783507933620086e+02 3.8498185748852151e+01 -2.7669272643606143e+02 + 8 -2.1014288646597382e+01 -4.0711968506334631e+02 1.5140757706927999e+02 + 9 -5.9307137188585777e+01 2.6264734812019475e+02 1.7442573676385468e+01 + 10 -8.4525778086876414e+01 1.5450140994331875e+02 6.0015146335721816e+00 + 11 -1.1159775028831368e+02 1.8656236384929727e+02 3.4449805909515095e+02 + 12 3.3347376393571255e+02 -3.8243903563632887e+02 5.1141444486612457e+01 + 13 -3.9347479057410180e+02 -9.9340014971740459e+01 2.4784035090896259e+02 + 14 1.7611459182140419e+02 -2.8017601742944402e+02 -2.7997644562222013e+02 + 15 2.5245744141516630e+02 -5.4739900421247519e+01 -1.3455773775633745e+02 + 16 1.6595098746018419e+02 1.6278076690062332e+02 4.2176787064349682e+01 + 17 4.0560547690525858e+01 2.0278202415209441e+02 1.1655337573721701e+02 + 18 1.9349019934523832e+02 -3.1749998507536677e+01 -3.0048600991173775e+01 + 19 -5.9067561742604539e+01 1.7643823088626213e+01 -1.0450409059207507e+02 + 20 1.3106558748347641e+02 2.5186173846559530e+01 1.3540015692568889e+02 + 21 -3.2006237187616756e+02 -1.1510771805635612e+02 -2.5816513201572022e+01 + 22 -1.2737471666033581e+01 -1.3033080251953402e+02 -1.4399680837176064e+02 + 23 -1.0142123148353754e+02 2.3316671624708317e+02 2.3905950409694182e+02 + 24 4.1563056415358190e+01 -1.2911164666848924e+01 -3.1668646816892771e+01 + 25 2.1166667371090466e+02 -2.0418293867725822e+02 -3.1232107629433731e+01 + 26 -2.6320989589682620e+02 1.2065128452552996e+02 2.6277305997802802e+02 + 27 -7.4498892273813851e+01 1.0778676260209129e+02 1.6095170163345199e+02 + 28 -2.4911277843488335e+02 -9.8499434443852294e+01 2.2239731087969656e+02 + 29 4.5655943120047868e+02 -5.6181584973687627e+01 -2.7582701917178315e+02 + 30 -1.1441865289035459e+02 5.2275082681973402e+01 -1.7193995473573804e+02 + 31 -1.8373014671249769e+02 -1.0039330382749465e+02 -9.6978960598961947e+01 + 32 1.5285998335729258e+02 -1.2909970668700709e+02 -1.8526770753201484e+02 + 33 2.0676721005976084e+01 3.7957156269713232e+02 -3.0331770321178464e+01 + 34 -1.8483566994370267e+02 -8.4859568901690949e+01 -1.0334717791993538e+02 + 35 -4.3920895665272049e+01 1.3832065189158744e+00 3.2302673529697394e+01 + 36 6.0407395927653863e+02 6.3222430241983591e+02 -1.5530384927410136e+01 + 37 -1.7704334275340958e+02 -3.4711199127962510e+02 2.0757920588578634e+02 + 38 -1.5990280705026572e+02 3.4383476554695449e+01 -1.1348860416567172e+02 + 39 1.2481780186485392e+02 3.1854282379699594e+01 2.4141006149778536e+02 + 40 -3.3952439214884566e+02 -5.2081203805390805e+02 -3.2749145453037933e+01 + 41 1.5953768898032115e+01 -2.5259433402084984e+01 -6.0977489335468270e+01 + 42 -3.5152692860571921e+02 1.0103192674618646e+02 1.0057493004151388e+02 + 43 1.8325251692529523e+02 -1.7843397924740334e+01 3.5813821983655501e+01 + 44 -1.7148730839833948e+02 6.5823249480752679e+01 -3.9043544554425530e+01 + 45 6.8021934986582622e+01 -5.2957926506736349e+01 -1.1278207528809644e+02 + 46 -1.9814589514445535e+02 3.1899128186018834e+02 -1.7125192460144413e+02 + 47 2.3518092199846154e+02 1.7325250425397039e+02 -4.6491315549358909e+01 + 48 -7.0934283327749368e+00 -2.1510500994703631e+02 2.8256786369777683e+02 + 49 2.4924479910930842e+02 -2.5977407369868608e+01 -1.9539857038363732e+02 + 50 9.0194565818523870e+01 2.6674460312457489e+02 4.8188042682115714e+01 + 51 2.7001317908987642e+02 -2.5024437918679871e+02 3.3082272466414389e+02 + 52 2.6770006025654061e+02 -1.3486195976744682e+02 -1.0999251813934431e+02 + 53 -3.0038447974652496e+02 1.7427208891886863e+02 -2.8369940533043155e+02 + 54 -1.8044322949045329e+02 3.2006167622599372e+02 -2.1986764638272354e+02 + 55 -6.7026995338193800e+01 2.8420556560193813e+02 -1.8256943632991832e+02 + 56 -9.3944897793228449e+02 7.6593871052490772e+02 -4.5872941120666047e+02 + 57 -2.7671724574062118e+01 -1.7257977562305288e+02 -1.6210118849324647e+02 + 58 7.1032070297632538e+02 -8.0881938208311476e+02 4.6676948457734858e+02 + 59 1.5682857500225737e+02 5.9891527233627293e+01 1.2646558890105982e+02 + 60 9.4076874705709926e+01 -1.1749874299724534e+02 -2.9919368333582668e+01 + 61 -4.8945763699767689e+01 1.6634783727405593e+02 6.7645978441449742e+01 + 62 1.6618577867039599e+02 7.3503605317082489e+01 2.2193892218236817e+02 + 63 4.6491757293230078e+00 -3.5581179274724042e+02 -3.8944419279304846e+01 + 64 -2.0021113303887074e+02 -1.1223202348830974e+02 3.0276216112541510e+02 run_vdwl: -8975.380420767826 run_coul: 0.5928530763135977 run_stress: ! |- - -1.1524045146329231e+03 -4.6202672628887268e+02 3.1947257175242231e+02 -2.2198788293036200e+03 3.4537925625758328e+02 -1.2645006400276918e+03 + -1.1524045146329215e+03 -4.6202672628887183e+02 3.1947257175242123e+02 -2.2198788293036246e+03 3.4537925625758203e+02 -1.2645006400276918e+03 run_forces: ! |2 - 1 -2.0916271375742122e+02 -1.8819704628010820e+02 -2.2843189669574852e+02 - 2 -5.9713089401385787e+01 -1.3795344000202866e+02 -6.1452818077516426e+01 - 3 1.0924320976999630e+02 5.4687819694184142e+01 8.7119001425249518e+00 - 4 2.2394063345773969e+02 -1.2606895888134676e+02 5.6116327882122533e+01 - 5 2.1344393241529360e+01 2.3982487161745496e+02 -1.1311589687086055e+02 - 6 -2.3464311544028666e+02 8.7956955368837427e+01 7.1434549534144523e+01 - 7 1.7780879390887415e+02 3.8509431501988246e+01 -2.7664422105920835e+02 - 8 -2.1021838063645568e+01 -4.0712804090199722e+02 1.5141447171445833e+02 - 9 -5.9306114388327742e+01 2.6264890826456997e+02 1.7441651570743588e+01 - 10 -8.4526898873820201e+01 1.5450366474645668e+02 6.0033453272929940e+00 - 11 -1.1159943563282735e+02 1.8656190683525134e+02 3.4449923076959345e+02 - 12 3.3352091011374790e+02 -3.8250187755922349e+02 5.1084711927225143e+01 - 13 -3.9348220819701362e+02 -9.9340584671855126e+01 2.4784344215807911e+02 - 14 1.7611207455981244e+02 -2.8017472349270184e+02 -2.7998178961052838e+02 - 15 2.5245571069035290e+02 -5.4734821409382626e+01 -1.3455249096986566e+02 - 16 1.6596243938777351e+02 1.6278821061030078e+02 4.2193739172058962e+01 - 17 4.0563209609350160e+01 2.0278198687184394e+02 1.1655244113651584e+02 - 18 1.9349048420969314e+02 -3.1742251436587967e+01 -3.0059327012827964e+01 - 19 -5.9065305354749185e+01 1.7641117222083235e+01 -1.0450807266106713e+02 - 20 1.3106409577706648e+02 2.5186488486411651e+01 1.3539864929844231e+02 - 21 -3.2006405209533727e+02 -1.1510774059461794e+02 -2.5815972761838644e+01 - 22 -1.2758648770740034e+01 -1.3030598897381913e+02 -1.4401125298080760e+02 - 23 -1.0142069915754510e+02 2.3316707339244664e+02 2.3905997646640651e+02 - 24 4.1563103349612355e+01 -1.2912528416939978e+01 -3.1670350622584593e+01 - 25 2.1168614583214108e+02 -2.0420927517565983e+02 -3.1221859837734250e+01 - 26 -2.6321230702712649e+02 1.2065335797472038e+02 2.6277789068532360e+02 - 27 -7.4500805679154823e+01 1.0778230652943388e+02 1.6094824153641918e+02 - 28 -2.4910955893577807e+02 -9.8496280842320616e+01 2.2240251270644734e+02 - 29 4.5656377692784969e+02 -5.6186906107102686e+01 -2.7582984196898542e+02 - 30 -1.1442511837997856e+02 5.2288586072111144e+01 -1.7194888884507304e+02 - 31 -1.8372666861898108e+02 -1.0040300216200654e+02 -9.6974937189118549e+01 - 32 1.5285848611243131e+02 -1.2910298326427261e+02 -1.8526958855531907e+02 - 33 2.0676324457133298e+01 3.7958042970093453e+02 -3.0330268376879861e+01 - 34 -1.8482802426276322e+02 -8.4860106696650362e+01 -1.0335087798868081e+02 - 35 -4.3757312673305961e+01 1.3332543035332394e+00 3.2176626618113424e+01 - 36 6.0396434382165080e+02 6.3211513244050911e+02 -1.5608509994293938e+01 - 37 -1.7702865323607540e+02 -3.4710307878941217e+02 2.0756937792988572e+02 - 38 -1.5990155316495603e+02 3.4380405811165133e+01 -1.1348496857139023e+02 - 39 1.2481655186335834e+02 3.1838210934905270e+01 2.4138399128801109e+02 - 40 -3.3940174784427825e+02 -5.2071078889465889e+02 -3.2710078405858489e+01 - 41 1.5894692394219231e+01 -2.5287374067694170e+01 -6.0953115361932809e+01 - 42 -3.5153052244718293e+02 1.0102830549812477e+02 1.0056790310062641e+02 - 43 1.8327499597791055e+02 -1.7817142708111650e+01 3.5817319257754193e+01 - 44 -1.7148210647983669e+02 6.5813679084638309e+01 -3.9042611994879181e+01 - 45 6.8003425377666687e+01 -5.2977048819501960e+01 -1.1277968937633442e+02 - 46 -1.9814362259114762e+02 3.1898369061349177e+02 -1.7124898143652061e+02 - 47 2.3513270166768126e+02 1.7331295501003885e+02 -4.6450664399000594e+01 - 48 -7.0870567240296412e+00 -2.1510840134220808e+02 2.8256287551251631e+02 - 49 2.4924760680789768e+02 -2.5986199354026756e+01 -1.9539743684221278e+02 - 50 9.0194077117530043e+01 2.6674400385736777e+02 4.8189887304663067e+01 + 1 -2.0916271375742122e+02 -1.8819704628010817e+02 -2.2843189669574869e+02 + 2 -5.9713089401385758e+01 -1.3795344000202869e+02 -6.1452818077516390e+01 + 3 1.0924320976999630e+02 5.4687819694184149e+01 8.7119001425249856e+00 + 4 2.2394063345773964e+02 -1.2606895888134682e+02 5.6116327882122576e+01 + 5 2.1344393241529389e+01 2.3982487161745499e+02 -1.1311589687086055e+02 + 6 -2.3464311544028661e+02 8.7956955368837384e+01 7.1434549534144637e+01 + 7 1.7780879390887415e+02 3.8509431501988217e+01 -2.7664422105920829e+02 + 8 -2.1021838063645482e+01 -4.0712804090199722e+02 1.5141447171445827e+02 + 9 -5.9306114388327757e+01 2.6264890826456991e+02 1.7441651570743552e+01 + 10 -8.4526898873820215e+01 1.5450366474645668e+02 6.0033453272930384e+00 + 11 -1.1159943563282745e+02 1.8656190683525122e+02 3.4449923076959351e+02 + 12 3.3352091011374790e+02 -3.8250187755922354e+02 5.1084711927225193e+01 + 13 -3.9348220819701362e+02 -9.9340584671855169e+01 2.4784344215807909e+02 + 14 1.7611207455981241e+02 -2.8017472349270173e+02 -2.7998178961052844e+02 + 15 2.5245571069035296e+02 -5.4734821409382555e+01 -1.3455249096986572e+02 + 16 1.6596243938777354e+02 1.6278821061030078e+02 4.2193739172058905e+01 + 17 4.0563209609350160e+01 2.0278198687184386e+02 1.1655244113651577e+02 + 18 1.9349048420969311e+02 -3.1742251436588031e+01 -3.0059327012828049e+01 + 19 -5.9065305354749214e+01 1.7641117222083306e+01 -1.0450807266106700e+02 + 20 1.3106409577706646e+02 2.5186488486411605e+01 1.3539864929844234e+02 + 21 -3.2006405209533733e+02 -1.1510774059461774e+02 -2.5815972761838673e+01 + 22 -1.2758648770740059e+01 -1.3030598897381921e+02 -1.4401125298080763e+02 + 23 -1.0142069915754507e+02 2.3316707339244658e+02 2.3905997646640648e+02 + 24 4.1563103349612369e+01 -1.2912528416939935e+01 -3.1670350622584650e+01 + 25 2.1168614583214125e+02 -2.0420927517565985e+02 -3.1221859837734193e+01 + 26 -2.6321230702712660e+02 1.2065335797472045e+02 2.6277789068532365e+02 + 27 -7.4500805679154780e+01 1.0778230652943385e+02 1.6094824153641912e+02 + 28 -2.4910955893577795e+02 -9.8496280842320559e+01 2.2240251270644745e+02 + 29 4.5656377692784969e+02 -5.6186906107102686e+01 -2.7582984196898536e+02 + 30 -1.1442511837997850e+02 5.2288586072111215e+01 -1.7194888884507304e+02 + 31 -1.8372666861898102e+02 -1.0040300216200652e+02 -9.6974937189118549e+01 + 32 1.5285848611243128e+02 -1.2910298326427264e+02 -1.8526958855531913e+02 + 33 2.0676324457133269e+01 3.7958042970093453e+02 -3.0330268376879818e+01 + 34 -1.8482802426276319e+02 -8.4860106696650320e+01 -1.0335087798868084e+02 + 35 -4.3757312673306046e+01 1.3332543035332109e+00 3.2176626618113481e+01 + 36 6.0396434382165091e+02 6.3211513244050911e+02 -1.5608509994294000e+01 + 37 -1.7702865323607537e+02 -3.4710307878941217e+02 2.0756937792988569e+02 + 38 -1.5990155316495614e+02 3.4380405811165076e+01 -1.1348496857139016e+02 + 39 1.2481655186335830e+02 3.1838210934905284e+01 2.4138399128801106e+02 + 40 -3.3940174784427819e+02 -5.2071078889465889e+02 -3.2710078405858532e+01 + 41 1.5894692394219259e+01 -2.5287374067694170e+01 -6.0953115361932859e+01 + 42 -3.5153052244718299e+02 1.0102830549812481e+02 1.0056790310062642e+02 + 43 1.8327499597791055e+02 -1.7817142708111664e+01 3.5817319257754207e+01 + 44 -1.7148210647983674e+02 6.5813679084638309e+01 -3.9042611994879181e+01 + 45 6.8003425377666758e+01 -5.2977048819501903e+01 -1.1277968937633439e+02 + 46 -1.9814362259114759e+02 3.1898369061349172e+02 -1.7124898143652064e+02 + 47 2.3513270166768126e+02 1.7331295501003882e+02 -4.6450664399000594e+01 + 48 -7.0870567240295701e+00 -2.1510840134220823e+02 2.8256287551251637e+02 + 49 2.4924760680789757e+02 -2.5986199354026777e+01 -1.9539743684221281e+02 + 50 9.0194077117530171e+01 2.6674400385736777e+02 4.8189887304663053e+01 51 2.7001321252850289e+02 -2.5024728349358162e+02 3.3082537396992757e+02 - 52 2.6774804404985821e+02 -1.3486815275053038e+02 -1.0995893066873343e+02 - 53 -3.0038420314626603e+02 1.7427256870890602e+02 -2.8369883331393498e+02 - 54 -1.8044337650670002e+02 3.2006027628882646e+02 -2.1986948976707882e+02 - 55 -6.7001753892442011e+01 2.8430150309051572e+02 -1.8265115796763561e+02 - 56 -9.3985837397072532e+02 7.6632225180339810e+02 -4.5884355139046016e+02 - 57 -2.7678338148623979e+01 -1.7258885892537234e+02 -1.6210010817478292e+02 - 58 7.1048197789438450e+02 -8.0911013609888585e+02 4.6702832864248001e+02 - 59 1.5682431931196510e+02 5.9896412584257810e+01 1.2646734132724080e+02 - 60 9.4082766259421007e+01 -1.1751801568433156e+02 -2.9921033400739130e+01 - 61 -4.8935117837153584e+01 1.6627961752299834e+02 6.7603012413403007e+01 - 62 1.6622090697397982e+02 7.3539705289790803e+01 2.2199414281313432e+02 - 63 4.6500905620167821e+00 -3.5581268146467818e+02 -3.8945035187443878e+01 - 64 -2.0020316331354053e+02 -1.1222336846987974e+02 3.0276528613232387e+02 + 52 2.6774804404985809e+02 -1.3486815275053038e+02 -1.0995893066873337e+02 + 53 -3.0038420314626609e+02 1.7427256870890602e+02 -2.8369883331393498e+02 + 54 -1.8044337650670010e+02 3.2006027628882651e+02 -2.1986948976707873e+02 + 55 -6.7001753892442125e+01 2.8430150309051584e+02 -1.8265115796763567e+02 + 56 -9.3985837397072532e+02 7.6632225180339799e+02 -4.5884355139046050e+02 + 57 -2.7678338148624022e+01 -1.7258885892537234e+02 -1.6210010817478278e+02 + 58 7.1048197789438450e+02 -8.0911013609888573e+02 4.6702832864248001e+02 + 59 1.5682431931196504e+02 5.9896412584257810e+01 1.2646734132724080e+02 + 60 9.4082766259420993e+01 -1.1751801568433152e+02 -2.9921033400739145e+01 + 61 -4.8935117837153584e+01 1.6627961752299828e+02 6.7603012413403036e+01 + 62 1.6622090697397977e+02 7.3539705289790774e+01 2.2199414281313429e+02 + 63 4.6500905620168673e+00 -3.5581268146467818e+02 -3.8945035187443779e+01 + 64 -2.0020316331354053e+02 -1.1222336846987976e+02 3.0276528613232387e+02 ... diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml index 8afebb059b..23e046037c 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -1,8 +1,7 @@ --- lammps_version: 2 Jul 2021 -date_generated: Mon Jul 12 20:56:39 2021 +date_generated: Wed Jul 21 15:49:50 2021 epsilon: 1e-12 -skip_tests: omp prerequisites: ! | pair reax/c fix qeq/reax @@ -39,139 +38,139 @@ natoms: 64 init_vdwl: -3248.7357862540734 init_coul: -327.0655125227952 init_stress: ! |- - -9.1835020319343903e+02 -1.1070721188680500e+03 -7.1558466813462928e+02 -2.3040889388184371e+02 1.9640581541966435e+02 -6.6002885423290161e+02 + -9.1835020319343971e+02 -1.1070721188680495e+03 -7.1558466813462803e+02 -2.3040889388184610e+02 1.9640581541966480e+02 -6.6002885423290161e+02 init_forces: ! |2 - 1 -8.8484243142053771e+01 -2.5824351291806131e+01 1.0916231386685253e+02 - 2 -1.0451347832614758e+02 -1.8136974287862063e+02 -2.1792749625845642e+02 - 3 -1.7141330932870608e+02 1.8106971255162955e+02 1.2675253960497301e+01 - 4 3.2218812838204848e+01 -5.1411756251266169e+01 9.0007306757969332e+01 - 5 1.8144819687099243e+02 1.6798395592380494e+01 -8.1726053808337795e+01 - 6 1.3634126802325468e+02 -3.0056831863560092e+02 2.9662272655036674e+01 - 7 -5.2968391883957075e+01 -1.2850613949952665e+02 -1.6373506942005375e+02 - 8 -1.5240314403220790e+02 4.1133257093807195e+01 1.5386487473711944e+02 - 9 3.2812532468307630e+01 1.0176367686189140e+02 1.4294427965088833e+01 - 10 7.9509811085534508e+01 1.3053732532659748e+02 1.1246398073074913e+02 - 11 -4.3144361329385013e+01 6.5763458097239607e+01 1.3482625633510347e+02 - 12 -9.6706456479566398e+01 -2.5878068074726730e+01 7.8323180467847466e+00 - 13 -6.3851121453490357e+01 -4.6607020158192647e+01 -3.6458352736129619e+01 - 14 7.8283848679559682e+01 -6.3646790831912000e+01 -8.9030561188058030e+01 - 15 -6.4212540181982106e+01 2.1093128152294153e+02 7.9060299592798899e+01 - 16 1.8608410345576598e+02 5.8084942932974315e+01 5.8538920003760346e+01 - 17 1.4285494615811757e+02 -3.9754521764346137e+01 -9.7686742464543357e+01 + 1 -8.8484243142053771e+01 -2.5824351291806110e+01 1.0916231386685256e+02 + 2 -1.0451347832614756e+02 -1.8136974287862066e+02 -2.1792749625845636e+02 + 3 -1.7141330932870599e+02 1.8106971255162949e+02 1.2675253960497342e+01 + 4 3.2218812838204855e+01 -5.1411756251266183e+01 9.0007306757969360e+01 + 5 1.8144819687099243e+02 1.6798395592380508e+01 -8.1726053808337866e+01 + 6 1.3634126802325463e+02 -3.0056831863560092e+02 2.9662272655036702e+01 + 7 -5.2968391883957104e+01 -1.2850613949952665e+02 -1.6373506942005375e+02 + 8 -1.5240314403220790e+02 4.1133257093807174e+01 1.5386487473711946e+02 + 9 3.2812532468307580e+01 1.0176367686189141e+02 1.4294427965088833e+01 + 10 7.9509811085534523e+01 1.3053732532659751e+02 1.1246398073074913e+02 + 11 -4.3144361329385013e+01 6.5763458097239592e+01 1.3482625633510347e+02 + 12 -9.6706456479566398e+01 -2.5878068074726777e+01 7.8323180467847324e+00 + 13 -6.3851121453490386e+01 -4.6607020158192661e+01 -3.6458352736129626e+01 + 14 7.8283848679559611e+01 -6.3646790831912028e+01 -8.9030561188058030e+01 + 15 -6.4212540181982106e+01 2.1093128152294148e+02 7.9060299592798927e+01 + 16 1.8608410345576596e+02 5.8084942932974329e+01 5.8538920003760360e+01 + 17 1.4285494615811757e+02 -3.9754521764346144e+01 -9.7686742464543357e+01 18 -4.1881548239260340e+01 -1.8476992042512617e+02 1.0708048360801492e+02 - 19 2.6677589878662855e+02 3.7179534199157007e+02 -3.3866575926816608e+02 - 20 -7.3520359401756991e+01 -8.3905077072099573e+01 -2.3854316876052961e-01 - 21 -7.2528668519170566e+01 -5.5898051886914395e+01 -1.1976059789267009e+02 - 22 1.5613953224968657e+02 -1.3200393155013322e+02 8.2112641076919701e+01 - 23 8.1833165091702909e+01 -1.7531644917125782e+01 -2.5648343293479577e+01 - 24 -2.1833127742352656e+02 1.9453922798678227e+02 -1.0817823414171312e+02 - 25 -1.1414613109864892e+02 1.9088917707975912e+02 -8.3362585828151552e+01 - 26 2.8281696751420088e+02 -2.1478267582733659e+02 2.2873793580282316e+02 - 27 -5.9769124622217909e+01 6.5221508924768330e+01 1.7553584075622149e+02 - 28 -2.9606162623424783e+00 3.8183918395203605e+01 3.2190129571074365e+01 - 29 -7.1069178571897922e+01 3.5485903180456219e+01 2.7311648896337669e+01 - 30 -1.7036975157904502e+02 -1.9851849204561248e+02 -1.1511387046436195e+02 - 31 -1.3744101014029059e+02 1.6223817575815931e+02 -1.1915340963940670e+02 - 32 2.7247730686207166e+01 -6.0237587331413039e+01 -1.7664910575209962e+02 + 19 2.6677589878662843e+02 3.7179534199157007e+02 -3.3866575926816614e+02 + 20 -7.3520359401756977e+01 -8.3905077072099573e+01 -2.3854316876052761e-01 + 21 -7.2528668519170537e+01 -5.5898051886914395e+01 -1.1976059789267006e+02 + 22 1.5613953224968657e+02 -1.3200393155013327e+02 8.2112641076919701e+01 + 23 8.1833165091702966e+01 -1.7531644917125725e+01 -2.5648343293479527e+01 + 24 -2.1833127742352659e+02 1.9453922798678227e+02 -1.0817823414171309e+02 + 25 -1.1414613109864892e+02 1.9088917707975912e+02 -8.3362585828151580e+01 + 26 2.8281696751420094e+02 -2.1478267582733662e+02 2.2873793580282313e+02 + 27 -5.9769124622217880e+01 6.5221508924768301e+01 1.7553584075622149e+02 + 28 -2.9606162623424428e+00 3.8183918395203612e+01 3.2190129571074365e+01 + 29 -7.1069178571897922e+01 3.5485903180456219e+01 2.7311648896337690e+01 + 30 -1.7036975157904502e+02 -1.9851849204561248e+02 -1.1511387046436192e+02 + 31 -1.3744101014029056e+02 1.6223817575815926e+02 -1.1915340963940670e+02 + 32 2.7247730686207166e+01 -6.0237587331413046e+01 -1.7664910575209962e+02 33 -6.1822971861324099e+01 -6.2648749988189138e+01 6.4194672454603221e+01 - 34 -1.7144145154614481e+01 9.9612835226783460e+01 -6.7437146990430080e+01 - 35 2.7024145652918196e+02 -2.1533864682645708e+02 1.3021380112890139e+02 - 36 1.0192185945862100e+02 1.8671686332443795e+02 -1.9864174410201804e+02 - 37 -1.7944122400067195e+02 1.2994089095714943e+02 -6.4321354857450871e+01 - 38 -2.9675055634802862e+02 1.0371104129720518e+02 1.5526989537725160e+02 - 39 8.6949523213895674e+01 -5.9975159120196956e+01 2.1780252234486241e+01 - 40 2.1612729980868430e+01 -1.0242580356371293e+02 5.7270724021457731e+01 - 41 -5.7836015722979205e+01 1.2268076597657853e+01 -6.6177893589402757e+01 - 42 -9.4774792026636987e+01 3.6872244003647978e+01 -7.5003138682741707e+01 - 43 2.2327470123469593e+02 9.5798787537490540e+01 1.2250410628715080e+02 - 44 8.7959342085865870e+01 -9.8740455124804626e+01 -8.4938709742755535e+01 - 45 1.4089093363544144e+01 1.2499300233485909e+02 5.5864237375372056e+01 - 46 1.3547776948110229e+01 -2.9276229642219512e+01 2.2187402435965939e+01 - 47 3.3448457824361199e+01 -1.9209977417392150e+02 -6.9989895706263340e+01 - 48 6.7827627502625162e+01 -2.0361789453088664e+02 -2.8571736118815554e+01 - 49 -3.7476005148434922e+02 -2.4452451195186526e+01 1.0764661193358344e+02 - 50 4.0090993029105412e+01 -7.3201402054245932e+01 8.9025922810974976e+01 + 34 -1.7144145154614467e+01 9.9612835226783488e+01 -6.7437146990430065e+01 + 35 2.7024145652918202e+02 -2.1533864682645725e+02 1.3021380112890154e+02 + 36 1.0192185945862101e+02 1.8671686332443795e+02 -1.9864174410201804e+02 + 37 -1.7944122400067201e+02 1.2994089095714961e+02 -6.4321354857450956e+01 + 38 -2.9675055634802868e+02 1.0371104129720520e+02 1.5526989537725160e+02 + 39 8.6949523213895688e+01 -5.9975159120196956e+01 2.1780252234486241e+01 + 40 2.1612729980868444e+01 -1.0242580356371295e+02 5.7270724021457731e+01 + 41 -5.7836015722979198e+01 1.2268076597657853e+01 -6.6177893589402757e+01 + 42 -9.4774792026636959e+01 3.6872244003648007e+01 -7.5003138682741707e+01 + 43 2.2327470123469598e+02 9.5798787537490540e+01 1.2250410628715086e+02 + 44 8.7959342085865842e+01 -9.8740455124804612e+01 -8.4938709742755563e+01 + 45 1.4089093363544151e+01 1.2499300233485907e+02 5.5864237375372056e+01 + 46 1.3547776948110229e+01 -2.9276229642219498e+01 2.2187402435965936e+01 + 47 3.3448457824361142e+01 -1.9209977417392156e+02 -6.9989895706263411e+01 + 48 6.7827627502625162e+01 -2.0361789453088662e+02 -2.8571736118815590e+01 + 49 -3.7476005148434911e+02 -2.4452451195186555e+01 1.0764661193358336e+02 + 50 4.0090993029105427e+01 -7.3201402054245932e+01 8.9025922810974976e+01 51 1.3736420686697005e+02 -1.0204157331499377e+02 1.5813725581140889e+02 - 52 -1.1253479916199427e+02 1.2293268076535985e+02 -1.2940078007359961e+02 - 53 -5.3560738472921095e+01 3.3353082884518017e+02 -1.1314448604069298e+00 - 54 -1.0678339177259694e+01 6.2810937621378145e+01 1.8344988318246158e+02 + 52 -1.1253479916199434e+02 1.2293268076535988e+02 -1.2940078007359961e+02 + 53 -5.3560738472921159e+01 3.3353082884518022e+02 -1.1314448604069298e+00 + 54 -1.0678339177259721e+01 6.2810937621378216e+01 1.8344988318246158e+02 55 1.1231900459987534e+02 -1.7906654831317346e+02 7.6533681064342304e+01 - 56 -4.7772143767870944e+01 -1.3536779754026816e+02 3.4054518546944344e+01 - 57 9.6541690594806298e+01 7.5093838528685538e+01 -6.0858704719314126e+01 - 58 -2.0459002696752538e+01 -1.1535051272093606e+01 -1.4282722385693347e+01 - 59 -6.9459404830701018e+01 1.0185761321965332e+02 8.3383492919159224e+01 - 60 -1.6658947285275730e+01 6.4062738321772898e+01 -1.5162708730048112e+02 - 61 -3.5221540644535267e+01 -1.0209415023871217e+02 -7.4154806308030501e+01 - 62 1.5375061601631639e+01 -6.3257038363614946e+00 2.7511178147389188e+01 - 63 1.3464841040549373e+02 -1.2416888785900632e+02 -5.8961420295344652e+01 - 64 1.0701063550375264e+02 1.1895268715876718e+02 7.4448770962530915e+01 + 56 -4.7772143767870858e+01 -1.3536779754026813e+02 3.4054518546944287e+01 + 57 9.6541690594806283e+01 7.5093838528685495e+01 -6.0858704719314126e+01 + 58 -2.0459002696752535e+01 -1.1535051272093602e+01 -1.4282722385693351e+01 + 59 -6.9459404830701061e+01 1.0185761321965333e+02 8.3383492919159224e+01 + 60 -1.6658947285275733e+01 6.4062738321772926e+01 -1.5162708730048112e+02 + 61 -3.5221540644535281e+01 -1.0209415023871215e+02 -7.4154806308030501e+01 + 62 1.5375061601631639e+01 -6.3257038363614946e+00 2.7511178147389174e+01 + 63 1.3464841040549379e+02 -1.2416888785900632e+02 -5.8961420295344659e+01 + 64 1.0701063550375258e+02 1.1895268715876720e+02 7.4448770962530929e+01 run_vdwl: -3248.732462206598 run_coul: -327.0653994771387 run_stress: ! |- - -9.1826184153105692e+02 -1.1070021528099094e+03 -7.1550580149015514e+02 -2.3049698812230801e+02 1.9635464153062043e+02 -6.6005793264639442e+02 + -9.1826184153105646e+02 -1.1070021528099112e+03 -7.1550580149015627e+02 -2.3049698812231000e+02 1.9635464153062134e+02 -6.6005793264639556e+02 run_forces: ! |2 - 1 -8.8485813027206106e+01 -2.5824096764125731e+01 1.0916519811125200e+02 - 2 -1.0451269244764349e+02 -1.8137828885716391e+02 -2.1792302517211854e+02 - 3 -1.7141411648636478e+02 1.8106803267132440e+02 1.2674658958989376e+01 - 4 3.2220655253010904e+01 -5.1413086231065009e+01 9.0010227071396386e+01 - 5 1.8145005123751935e+02 1.6799086578426795e+01 -8.1723924656170567e+01 - 6 1.3640868425589994e+02 -3.0059549892327152e+02 2.9595528779455449e+01 - 7 -5.2968868171259700e+01 -1.2850640761855158e+02 -1.6373951876943795e+02 - 8 -1.5240417232930932e+02 4.1133578832982629e+01 1.5386572595284764e+02 - 9 3.2811395144161118e+01 1.0176141517530588e+02 1.4295529169373282e+01 - 10 7.9508569375402288e+01 1.3053469081285704e+02 1.1246210158699024e+02 - 11 -4.3142968406859097e+01 6.5760241919953828e+01 1.3481728343070949e+02 - 12 -9.6708250458847047e+01 -2.5879521605003774e+01 7.8278088000700450e+00 - 13 -6.3852523341823215e+01 -4.6607003335506526e+01 -3.6455965991574899e+01 - 14 7.8283534745824213e+01 -6.3643851884097081e+01 -8.9027881489336053e+01 - 15 -6.4209962316685647e+01 2.1093255387179667e+02 7.9059692211125324e+01 - 16 1.8608085162130908e+02 5.8088780803195149e+01 5.8532604899053126e+01 - 17 1.4285609630789870e+02 -3.9754014601715802e+01 -9.7689588113924358e+01 - 18 -4.1881237955183380e+01 -1.8477109777149900e+02 1.0708061287038568e+02 + 1 -8.8485813027206135e+01 -2.5824096764125731e+01 1.0916519811125200e+02 + 2 -1.0451269244764350e+02 -1.8137828885716391e+02 -2.1792302517211851e+02 + 3 -1.7141411648636486e+02 1.8106803267132440e+02 1.2674658958989427e+01 + 4 3.2220655253010918e+01 -5.1413086231064995e+01 9.0010227071396415e+01 + 5 1.8145005123751957e+02 1.6799086578426838e+01 -8.1723924656170610e+01 + 6 1.3640868425590003e+02 -3.0059549892327158e+02 2.9595528779455435e+01 + 7 -5.2968868171259714e+01 -1.2850640761855155e+02 -1.6373951876943804e+02 + 8 -1.5240417232930932e+02 4.1133578832982636e+01 1.5386572595284764e+02 + 9 3.2811395144161132e+01 1.0176141517530590e+02 1.4295529169373282e+01 + 10 7.9508569375402331e+01 1.3053469081285709e+02 1.1246210158699030e+02 + 11 -4.3142968406859097e+01 6.5760241919953813e+01 1.3481728343070949e+02 + 12 -9.6708250458847061e+01 -2.5879521605003742e+01 7.8278088000700370e+00 + 13 -6.3852523341823229e+01 -4.6607003335506541e+01 -3.6455965991574878e+01 + 14 7.8283534745824241e+01 -6.3643851884097224e+01 -8.9027881489336167e+01 + 15 -6.4209962316685690e+01 2.1093255387179667e+02 7.9059692211125295e+01 + 16 1.8608085162130908e+02 5.8088780803195142e+01 5.8532604899053133e+01 + 17 1.4285609630789864e+02 -3.9754014601715795e+01 -9.7689588113924316e+01 + 18 -4.1881237955183380e+01 -1.8477109777149900e+02 1.0708061287038571e+02 19 2.6677609377410010e+02 3.7179392086487712e+02 -3.3866472006706340e+02 - 20 -7.3532190353883053e+01 -8.3895301502997995e+01 -2.5591151698950659e-01 - 21 -7.2528695460850031e+01 -5.5899068566579935e+01 -1.1975970158720031e+02 - 22 1.5614083463623408e+02 -1.3200472837628521e+02 8.2112156159808862e+01 - 23 8.1835290134891864e+01 -1.7522433028942366e+01 -2.5648597332802922e+01 - 24 -2.1834038832017538e+02 1.9455197293610073e+02 -1.0818261235148485e+02 - 25 -1.1414871301032665e+02 1.9089327234338916e+02 -8.3363315092572321e+01 - 26 2.8282661127556162e+02 -2.1478990451658228e+02 2.2874215408671131e+02 - 27 -5.9765619577841512e+01 6.5223096224356411e+01 1.7553677772771837e+02 - 28 -2.9624987519851000e+00 3.8179667154298826e+01 3.2185280629057068e+01 - 29 -7.1069494187081830e+01 3.5486459200488397e+01 2.7311657807311487e+01 - 30 -1.7037047317028464e+02 -1.9851861739498079e+02 -1.1511395377375429e+02 - 31 -1.3744346258178371e+02 1.6223725554250467e+02 -1.1915482471876425e+02 - 32 2.7248541074999881e+01 -6.0231207974705434e+01 -1.7663875080811843e+02 - 33 -6.1822398570959187e+01 -6.2648503570177034e+01 6.4194898940197760e+01 + 20 -7.3532190353883053e+01 -8.3895301502997967e+01 -2.5591151698956521e-01 + 21 -7.2528695460850088e+01 -5.5899068566579977e+01 -1.1975970158720035e+02 + 22 1.5614083463623413e+02 -1.3200472837628527e+02 8.2112156159808862e+01 + 23 8.1835290134891864e+01 -1.7522433028942352e+01 -2.5648597332802964e+01 + 24 -2.1834038832017541e+02 1.9455197293610073e+02 -1.0818261235148486e+02 + 25 -1.1414871301032666e+02 1.9089327234338913e+02 -8.3363315092572321e+01 + 26 2.8282661127556162e+02 -2.1478990451658228e+02 2.2874215408671137e+02 + 27 -5.9765619577841541e+01 6.5223096224356439e+01 1.7553677772771840e+02 + 28 -2.9624987519851178e+00 3.8179667154298812e+01 3.2185280629057068e+01 + 29 -7.1069494187081830e+01 3.5486459200488405e+01 2.7311657807311473e+01 + 30 -1.7037047317028475e+02 -1.9851861739498079e+02 -1.1511395377375433e+02 + 31 -1.3744346258178373e+02 1.6223725554250467e+02 -1.1915482471876425e+02 + 32 2.7248541074999881e+01 -6.0231207974705420e+01 -1.7663875080811843e+02 + 33 -6.1822398570959159e+01 -6.2648503570177034e+01 6.4194898940197774e+01 34 -1.7143769208529751e+01 9.9611942509072080e+01 -6.7436075885014986e+01 - 35 2.7028238194296250e+02 -2.1538301386687789e+02 1.3022488558865325e+02 - 36 1.0192362247594352e+02 1.8671008619975407e+02 -1.9863711527085923e+02 + 35 2.7028238194296250e+02 -2.1538301386687783e+02 1.3022488558865331e+02 + 36 1.0192362247594350e+02 1.8671008619975410e+02 -1.9863711527085917e+02 37 -1.7946751638141498e+02 1.2998098195714172e+02 -6.4345576150932828e+01 - 38 -2.9675376021752191e+02 1.0371435865032235e+02 1.5526896750689889e+02 - 39 8.6950332148131110e+01 -5.9975388525042028e+01 2.1779869753193040e+01 - 40 2.1613442490343317e+01 -1.0242529062335393e+02 5.7271060256879871e+01 - 41 -5.7834219239599371e+01 1.2266148111030006e+01 -6.6169611760840567e+01 - 42 -9.4774021509187520e+01 3.6869981851995341e+01 -7.5005285702022732e+01 - 43 2.2327078175416057e+02 9.5796580610065675e+01 1.2250057895428364e+02 - 44 8.7963372590925971e+01 -9.8736166841311601e+01 -8.4943701327958067e+01 - 45 1.4080569929277514e+01 1.2498603359504317e+02 5.5870075675508225e+01 - 46 1.3549084713162141e+01 -2.9276453411015115e+01 2.2187141786216614e+01 - 47 3.3448153520154243e+01 -1.9209514330879989e+02 -6.9988284949882583e+01 - 48 6.7840148074199064e+01 -2.0361975956922109e+02 -2.8580806381848241e+01 - 49 -3.7480020999441342e+02 -2.4397739069897693e+01 1.0773474200196225e+02 - 50 4.0091767398974710e+01 -7.3200211843412532e+01 8.9024460533547710e+01 + 38 -2.9675376021752186e+02 1.0371435865032235e+02 1.5526896750689886e+02 + 39 8.6950332148131110e+01 -5.9975388525042071e+01 2.1779869753193026e+01 + 40 2.1613442490343314e+01 -1.0242529062335393e+02 5.7271060256879871e+01 + 41 -5.7834219239599364e+01 1.2266148111030034e+01 -6.6169611760840596e+01 + 42 -9.4774021509187506e+01 3.6869981851995398e+01 -7.5005285702022690e+01 + 43 2.2327078175416062e+02 9.5796580610065675e+01 1.2250057895428364e+02 + 44 8.7963372590925985e+01 -9.8736166841311601e+01 -8.4943701327958038e+01 + 45 1.4080569929277486e+01 1.2498603359504315e+02 5.5870075675508232e+01 + 46 1.3549084713162147e+01 -2.9276453411015140e+01 2.2187141786216618e+01 + 47 3.3448153520154271e+01 -1.9209514330879989e+02 -6.9988284949882569e+01 + 48 6.7840148074199092e+01 -2.0361975956922109e+02 -2.8580806381848255e+01 + 49 -3.7480020999441365e+02 -2.4397739069897636e+01 1.0773474200196219e+02 + 50 4.0091767398974682e+01 -7.3200211843412504e+01 8.9024460533547696e+01 51 1.3736689552057061e+02 -1.0204490779999098e+02 1.5814099219631356e+02 - 52 -1.1253380764229995e+02 1.2293290174735385e+02 -1.2940467151627448e+02 - 53 -5.3596650492501155e+01 3.3350644289105048e+02 -1.1510223807932292e+00 - 54 -1.0666202581574648e+01 6.2798090272532036e+01 1.8346799239172421e+02 - 55 1.1232135575968965e+02 -1.7906994470748415e+02 7.6534265236354301e+01 - 56 -4.7780797026174795e+01 -1.3535955159718560e+02 3.4061208199866762e+01 - 57 9.6541265005138669e+01 7.5091144884198542e+01 -6.0860069746425758e+01 - 58 -2.0459328007572658e+01 -1.1533053731831272e+01 -1.4282938438265621e+01 - 59 -6.9467796604507953e+01 1.0186323697055805e+02 8.3388794196804326e+01 - 60 -1.6660217426514649e+01 6.4061566362647156e+01 -1.5162714312949214e+02 - 61 -3.5220536021452773e+01 -1.0209241739133056e+02 -7.4154706185261873e+01 - 62 1.5375483178245863e+01 -6.3263099051314251e+00 2.7512110875657907e+01 - 63 1.3464595988109866e+02 -1.2416936634154251e+02 -5.8957063242418137e+01 - 64 1.0701154605982802e+02 1.1895382951205713e+02 7.4449321163285816e+01 + 52 -1.1253380764229996e+02 1.2293290174735381e+02 -1.2940467151627450e+02 + 53 -5.3596650492501162e+01 3.3350644289105031e+02 -1.1510223807932007e+00 + 54 -1.0666202581574661e+01 6.2798090272532008e+01 1.8346799239172421e+02 + 55 1.1232135575968968e+02 -1.7906994470748415e+02 7.6534265236354301e+01 + 56 -4.7780797026174810e+01 -1.3535955159718563e+02 3.4061208199866719e+01 + 57 9.6541265005138698e+01 7.5091144884198556e+01 -6.0860069746425658e+01 + 58 -2.0459328007572669e+01 -1.1533053731831259e+01 -1.4282938438265617e+01 + 59 -6.9467796604507981e+01 1.0186323697055799e+02 8.3388794196804326e+01 + 60 -1.6660217426514606e+01 6.4061566362647113e+01 -1.5162714312949211e+02 + 61 -3.5220536021452787e+01 -1.0209241739133054e+02 -7.4154706185261915e+01 + 62 1.5375483178245885e+01 -6.3263099051314251e+00 2.7512110875657893e+01 + 63 1.3464595988109866e+02 -1.2416936634154256e+02 -5.8957063242418101e+01 + 64 1.0701154605982798e+02 1.1895382951205715e+02 7.4449321163285845e+01 ... From aa885a9d8df4a432fdc1141fc73934412ff0f0c6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 17:06:21 -0400 Subject: [PATCH 101/119] make virial processing use the total global virial --- src/fix_external.cpp | 37 +++++++++++++++++++++++++++-------- src/library.cpp | 46 ++++++++++++++++++++++++++++++-------------- 2 files changed, 61 insertions(+), 22 deletions(-) diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 99539e86cf..f95c30c28d 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -15,6 +15,7 @@ #include "fix_external.h" #include "atom.h" +#include "comm.h" #include "error.h" #include "memory.h" #include "update.h" @@ -185,10 +186,13 @@ void FixExternal::min_post_force(int vflag) /* ---------------------------------------------------------------------- caller invokes this method to set its contribution to global energy + this is the *total* energy across all MPI ranks of the external code + and must be set for all MPI ranks. unlike other energy/virial set methods: do not just return if eflag_global is not set b/c input script could access this quantity via compute_scalar() even if eflag is not set on a particular timestep + this function is compatible with CALLBACK and ARRAY mode ------------------------------------------------------------------------- */ void FixExternal::set_energy_global(double caller_energy) @@ -197,22 +201,32 @@ void FixExternal::set_energy_global(double caller_energy) } /* ---------------------------------------------------------------------- - caller invokes this method to set its contribution to global virial + caller invokes this method to set its contribution to the global virial + for all MPI ranks. the virial value is the *total* contribution across + all MPI ranks of the external code and thus we need to divide by the + number of MPI ranks since the tallying code expects per MPI rank contributions. + this function is compatible with PF_CALLBACK and PF_ARRAY mode ------------------------------------------------------------------------- */ void FixExternal::set_virial_global(double *caller_virial) { + const double npscale = 1.0/(double)comm->nprocs; for (int i = 0; i < 6; i++) - user_virial[i] = caller_virial[i]; + user_virial[i] = npscale * caller_virial[i]; } /* ---------------------------------------------------------------------- - caller invokes this method to set its contribution to peratom energy + caller invokes this method to set its contribution to peratom energy. + this is applied to the *local* atoms only. + this function is compatible with PF_CALLBACK mode only since it tallies + its energy contributions directly into the accumulator arrays. ------------------------------------------------------------------------- */ void FixExternal::set_energy_peratom(double *caller_energy) { if (!eflag_atom) return; + if ((mode == PF_ARRAY) && (comm->me == 0)) + error->warning(FLERR,"Can only set energy/atom for fix external in pf/callback mode"); int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) @@ -221,6 +235,9 @@ void FixExternal::set_energy_peratom(double *caller_energy) /* ---------------------------------------------------------------------- caller invokes this method to set its contribution to peratom virial + this is applied to the *local* atoms only. + this function is compatible with PF_CALLBACK mode only since it tallies + its virial contributions directly into the accumulator arrays. ------------------------------------------------------------------------- */ void FixExternal::set_virial_peratom(double **caller_virial) @@ -228,6 +245,8 @@ void FixExternal::set_virial_peratom(double **caller_virial) int i,j; if (!vflag_atom) return; + if ((mode == PF_ARRAY) && (comm->me == 0)) + error->warning(FLERR,"Can only set virial/atom for fix external in pf/callback mode"); int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) @@ -236,8 +255,8 @@ void FixExternal::set_virial_peratom(double **caller_virial) } /* ---------------------------------------------------------------------- - caller invokes this method to set length of vector of values - assume all vector values are extensive, could make this an option + caller invokes this method to set length of global vector of values + assume all vector values are extensive. ------------------------------------------------------------------------- */ void FixExternal::set_vector_length(int n) @@ -252,14 +271,15 @@ void FixExternal::set_vector_length(int n) } /* ---------------------------------------------------------------------- - caller invokes this method to set Index value in vector - index ranges from 1 to N inclusive + caller invokes this method to set value for item at "index" in vector + index is 1-based, thus index ranges from 1 to N inclusively. + Must be called from all MPI ranks. ------------------------------------------------------------------------- */ void FixExternal::set_vector(int index, double value) { if (index > size_vector) - error->all(FLERR,"Invalid set_vector index in fix external"); + error->all(FLERR,"Invalid set_vector index ({} of {}) in fix external",index,size_vector); caller_vector[index-1] = value; } @@ -290,6 +310,7 @@ double FixExternal::compute_vector(int n) double FixExternal::memory_usage() { double bytes = 3*atom->nmax * sizeof(double); + bytes += 6*sizeof(double); return bytes; } diff --git a/src/library.cpp b/src/library.cpp index a6e4509c56..0c897538a1 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4806,8 +4806,8 @@ void lammps_decode_image_flags(imageint image, int *flags) /* ---------------------------------------------------------------------- */ -/** Set the callback function for a fix external instance with the given ID. - Optionally also set the pointer to the calling object. +/** Set up the callback function for a fix external instance with the given ID. + \verbatim embed:rst Fix :doc:`external ` allows programs that are running LAMMPS through @@ -4821,7 +4821,15 @@ mode. The function has to have C language bindings with the prototype: void func(void *ptr, bigint timestep, int nlocal, tagint *ids, double **x, double **fexternal); -This is an alternative to the array mechanism set up by :cpp:func:`lammps_fix_external_get_force`. +The argument *ptr* to this function will be stored in fix external and +the passed as the first argument calling the callback function `func()`. +This would usually be a pointer to the LAMMPS instance, i.e. the same +pointer as the *handle* argument. This would be needed to call +functions that set the global or per-atom energy or virial +contributions. + +The callback mechanism is on of the two modes of fix external. The +alternative is the array mode set up by :cpp:func:`lammps_fix_external_get_force`. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4865,16 +4873,24 @@ its library interface to add or modify certain LAMMPS properties on specific timesteps, similar to the way other fixes do. This function provides access to the per-atom force storage in the fix -to be added to the individual atoms when using the "pf/array" mode. The -*fexternal* array can be accessed similar to the "native" per-atom -*arrays accessible via the :cpp:func:`lammps_extract_atom` function. -Because the underlying data structures can change as atoms migrate -between MPI processes, this function should be always called immediately -before the forces are going to be set. +external instance to be added to the individual atoms when using the +"pf/array" mode. The *fexternal* array can be accessed similar to the +"native" per-atom *arrays accessible via the +:cpp:func:`lammps_extract_atom` function. Please note that the array +stores forces for *local* atoms, in the order determined by the neighbor +list build. Because the underlying data structures can change as well as +the order of atom as they migrate between MPI processes, this function +should be always called immediately before the forces are going to be +set to get an up-to-date pointer. You can use +e.g. :cpp:func:`lammps_get_natoms` to obtain the number of local atoms +and thus the dimensions of the returned force array (``double force[nlocal][3]``). -This is an alternative to the callback mechanism set up by -:cpp:func:`lammps_set_fix_external_callback` with out using the callback -mechanism to call out to the external program. +This is an alternative to the callback mechanism in fix external set up by +:cpp:func:`lammps_set_fix_external_callback`. The main difference is +that this mechanism can be used when forces can be pre-computed and the +control alternates between LAMMPS and the external command, while the +callback mechanism can call the external code to compute the force when +the fix is triggered and needs them. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4914,9 +4930,11 @@ double **lammps_fix_external_get_force(void *handle, const char *id) This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to also set the contribution -to the global energy from the external code. The value of the *eng* +to the global energy from the external code. The value of the *eng* argument will be stored in the fix and applied on the current and all -following timesteps until changed. +following timesteps until changed by another call to this function. +When running in parallel, the value is the per-MPI process contribution, +not the total energy. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an From f8f4af471ff0518776e470c2483070f207430599 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 21:36:16 -0400 Subject: [PATCH 102/119] general rename of files, styles, and keywords from "reax/c", "reax", or "reaxc" to "reaxff" --- cmake/Modules/Packages/OPENMP.cmake | 18 +- doc/src/Commands_fix.rst | 6 +- doc/src/Commands_pair.rst | 2 +- doc/src/Errors_warnings.rst | 4 +- doc/src/Packages_details.rst | 8 +- doc/src/Packages_list.rst | 2 +- doc/src/Tools.rst | 15 - doc/src/compute_pair.rst | 5 +- doc/src/fix.rst | 6 +- doc/src/fix_adapt.rst | 2 +- doc/src/fix_gcmc.rst | 2 +- doc/src/fix_qeq.rst | 20 +- doc/src/fix_qeq_comb.rst | 2 +- .../{fix_qeq_reax.rst => fix_qeq_reaxff.rst} | 36 +- ...x_reaxc_bonds.rst => fix_reaxff_bonds.rst} | 20 +- ...axc_species.rst => fix_reaxff_species.rst} | 57 ++- doc/src/kim_commands.rst | 4 +- doc/src/package.rst | 3 +- doc/src/{pair_reaxc.rst => pair_reaxff.rst} | 118 ++++--- doc/src/pair_style.rst | 2 +- doc/utils/check-styles.py | 55 ++- examples/README | 2 +- examples/{reax => reaxff}/AB/README | 0 examples/{reax => reaxff}/AB/data.AB | 0 examples/{reax => reaxff}/AB/ffield.reax.AB | 0 examples/{reax => reaxff}/AB/in.AB | 0 examples/{reax => reaxff}/AB/lmp_control | 0 .../{reax => reaxff}/AB/log.8Mar18.AB.g++.1 | 0 .../{reax => reaxff}/AB/log.8Mar18.AB.g++.4 | 0 examples/{reax => reaxff}/AB/param.qeq | 0 examples/{reax => reaxff}/AuO/README | 0 examples/{reax => reaxff}/AuO/data.AuO | 0 examples/{reax => reaxff}/AuO/ffield.reax.AuO | 0 examples/{reax => reaxff}/AuO/in.AuO | 0 examples/{reax => reaxff}/AuO/lmp_control | 0 .../{reax => reaxff}/AuO/log.8Mar18.AuO.g++.1 | 0 .../{reax => reaxff}/AuO/log.8Mar18.AuO.g++.4 | 0 examples/{reax => reaxff}/AuO/param.qeq | 0 examples/{reax => reaxff}/CHO/README | 0 examples/{reax => reaxff}/CHO/data.CHO | 0 examples/{reax => reaxff}/CHO/ffield.reax.cho | 0 examples/{reax => reaxff}/CHO/in.CHO | 0 examples/{reax => reaxff}/CHO/lmp_control | 0 .../{reax => reaxff}/CHO/log.8Mar18.CHO.g++.1 | 0 .../{reax => reaxff}/CHO/log.8Mar18.CHO.g++.4 | 0 examples/{reax => reaxff}/CHO/param.qeq | 0 examples/{reax => reaxff}/FC/README | 0 examples/{reax => reaxff}/FC/data.FC | 0 examples/{reax => reaxff}/FC/ffield.reax.FC | 0 examples/{reax => reaxff}/FC/in.FC | 0 .../{reax => reaxff}/FC/log.8Mar18.FC.g++.1 | 0 .../{reax => reaxff}/FC/log.8Mar18.FC.g++.4 | 0 examples/{reax => reaxff}/FeOH3/README | 0 examples/{reax => reaxff}/FeOH3/data.FeOH3 | 0 .../FeOH3/ffield.reax.Fe_O_C_H | 0 examples/{reax => reaxff}/FeOH3/in.FeOH3 | 0 examples/{reax => reaxff}/FeOH3/lmp_control | 0 .../FeOH3/log.5Oct16.FeOH3.g++.1 | 0 .../FeOH3/log.5Oct16.FeOH3.g++.4 | 0 examples/{reax => reaxff}/FeOH3/param.qeq | 0 examples/{reax => reaxff}/HNS/README.txt | 0 examples/{reax => reaxff}/HNS/data.hns-equil | 0 examples/{reax => reaxff}/HNS/ffield.reax.hns | 0 examples/{reax => reaxff}/HNS/in.reaxc.hns | 0 .../HNS/log.8Mar18.reaxc.hns.g++.1 | 0 .../HNS/log.8Mar18.reaxc.hns.g++.4 | 0 examples/{reax => reaxff}/RDX/README | 0 examples/{reax => reaxff}/RDX/data.RDX | 0 examples/{reax => reaxff}/RDX/ffield.reax.rdx | 0 examples/{reax => reaxff}/RDX/in.RDX | 0 examples/{reax => reaxff}/RDX/lmp_control | 0 .../{reax => reaxff}/RDX/log.8Mar18.RDX.g++.1 | 0 .../{reax => reaxff}/RDX/log.8Mar18.RDX.g++.4 | 0 examples/{reax => reaxff}/RDX/param.qeq | 0 examples/{reax => reaxff}/README | 0 examples/{reax => reaxff}/VOH/README | 0 examples/{reax => reaxff}/VOH/data.VOH | 0 .../{reax => reaxff}/VOH/ffield.reax.V_O_C_H | 0 examples/{reax => reaxff}/VOH/in.VOH | 0 examples/{reax => reaxff}/VOH/lmp_control | 0 .../{reax => reaxff}/VOH/log.8Mar18.VOH.g++.1 | 0 .../{reax => reaxff}/VOH/log.8Mar18.VOH.g++.4 | 0 examples/{reax => reaxff}/VOH/param.qeq | 0 examples/{reax => reaxff}/ZnOH2/README | 0 examples/{reax => reaxff}/ZnOH2/data.ZnOH2 | 0 .../{reax => reaxff}/ZnOH2/ffield.reax.ZnOH | 0 examples/{reax => reaxff}/ZnOH2/in.ZnOH2 | 0 examples/{reax => reaxff}/ZnOH2/lmp_control | 0 .../ZnOH2/log.8Mar18.ZnOH2.g++.1 | 0 .../ZnOH2/log.8Mar18.ZnOH2.g++.4 | 0 examples/{reax => reaxff}/ZnOH2/param.qeq | 0 examples/{reax => reaxff}/ci-reaxFF/CH4.dat | 0 .../ci-reaxFF/ci-reaxFF_ZBL.dat | 0 examples/{reax => reaxff}/ci-reaxFF/control | 0 .../ci-reaxFF/ffield.ci-reax.CH | 0 .../{reax => reaxff}/ci-reaxFF/in.ci-reax.CH | 0 .../ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 | 0 .../ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 | 0 examples/{reax => reaxff}/control.reax_c.rdx | 0 examples/{reax => reaxff}/control.reax_c.tatb | 0 examples/{reax => reaxff}/data.rdx | 0 examples/{reax => reaxff}/data.tatb | 0 examples/{reax => reaxff}/ffield.reax | 0 examples/{reax => reaxff}/in.reaxc.rdx | 0 .../{reax => reaxff}/in.reaxc.rdx-shielded | 0 examples/{reax => reaxff}/in.reaxc.tatb | 0 .../{reax => reaxff}/in.reaxc.tatb-shielded | 0 .../log.21Apr21.reaxc.rdx-shielded.g++.1 | 0 .../log.21Apr21.reaxc.rdx-shielded.g++.4 | 0 .../log.21Apr21.reaxc.rdx.g++.1 | 0 .../log.21Apr21.reaxc.rdx.g++.4 | 0 .../log.21Apr21.reaxc.tatb-shielded.g++.1 | 0 .../log.21Apr21.reaxc.tatb-shielded.g++.4 | 0 .../log.21Apr21.reaxc.tatb.g++.1 | 0 .../log.21Apr21.reaxc.tatb.g++.4 | 0 ...x_kokkos.cpp => fix_qeq_reaxff_kokkos.cpp} | 196 +++++----- ..._reax_kokkos.h => fix_qeq_reaxff_kokkos.h} | 157 ++++---- ...kokkos.cpp => fix_reaxff_bonds_kokkos.cpp} | 40 +-- ...nds_kokkos.h => fix_reaxff_bonds_kokkos.h} | 23 +- ...kkos.cpp => fix_reaxff_species_kokkos.cpp} | 32 +- ...s_kokkos.h => fix_reaxff_species_kokkos.h} | 21 +- ...eaxc_kokkos.cpp => pair_reaxff_kokkos.cpp} | 334 +++++++++--------- ...ir_reaxc_kokkos.h => pair_reaxff_kokkos.h} | 89 ++--- ...eq_reax_omp.cpp => fix_qeq_reaxff_omp.cpp} | 74 ++-- ...ix_qeq_reax_omp.h => fix_qeq_reaxff_omp.h} | 15 +- ...pair_reaxc_omp.cpp => pair_reaxff_omp.cpp} | 72 ++-- .../{pair_reaxc_omp.h => pair_reaxff_omp.h} | 17 +- ...ers_omp.cpp => reaxff_bond_orders_omp.cpp} | 6 +- ...axc_bonds_omp.cpp => reaxff_bonds_omp.cpp} | 6 +- ...c_forces_omp.cpp => reaxff_forces_omp.cpp} | 6 +- ..._omp.cpp => reaxff_hydrogen_bonds_omp.cpp} | 6 +- ...init_md_omp.cpp => reaxff_init_md_omp.cpp} | 0 ...body_omp.cpp => reaxff_multi_body_omp.cpp} | 6 +- ...onded_omp.cpp => reaxff_nonbonded_omp.cpp} | 10 +- ..._omp.cpp => reaxff_torsion_angles_omp.cpp} | 6 +- ..._omp.cpp => reaxff_valence_angles_omp.cpp} | 6 +- src/Purge.list | 46 +++ src/QEQ/fix_qeq.cpp | 2 +- src/QEQ/fix_qeq_shielded.cpp | 7 +- src/REAXFF/README | 12 +- src/REAXFF/compute_spec_atom.cpp | 68 ++-- src/REAXFF/compute_spec_atom.h | 2 +- .../{fix_qeq_reax.cpp => fix_qeq_reaxff.cpp} | 180 +++++----- .../{fix_qeq_reax.h => fix_qeq_reaxff.h} | 15 +- src/REAXFF/{fix_reaxc.cpp => fix_reaxff.cpp} | 26 +- src/REAXFF/{fix_reaxc.h => fix_reaxff.h} | 16 +- ...x_reaxc_bonds.cpp => fix_reaxff_bonds.cpp} | 80 ++--- .../{fix_reaxc_bonds.h => fix_reaxff_bonds.h} | 15 +- ...axc_species.cpp => fix_reaxff_species.cpp} | 140 ++++---- ...x_reaxc_species.h => fix_reaxff_species.h} | 13 +- .../{pair_reaxc.cpp => pair_reaxff.cpp} | 116 +++--- src/REAXFF/{pair_reaxc.h => pair_reaxff.h} | 17 +- ...reaxc_allocate.cpp => reaxff_allocate.cpp} | 0 ...bond_orders.cpp => reaxff_bond_orders.cpp} | 0 .../{reaxc_bonds.cpp => reaxff_bonds.cpp} | 0 .../{reaxc_control.cpp => reaxff_control.cpp} | 0 src/REAXFF/reaxff_defs.h | 4 +- .../{reaxc_ffield.cpp => reaxff_ffield.cpp} | 0 .../{reaxc_forces.cpp => reaxff_forces.cpp} | 0 ...en_bonds.cpp => reaxff_hydrogen_bonds.cpp} | 0 .../{reaxc_init_md.cpp => reaxff_init_md.cpp} | 0 .../{reaxc_list.cpp => reaxff_list.cpp} | 0 .../{reaxc_lookup.cpp => reaxff_lookup.cpp} | 0 ...c_multi_body.cpp => reaxff_multi_body.cpp} | 0 ...axc_nonbonded.cpp => reaxff_nonbonded.cpp} | 0 ...reset_tools.cpp => reaxff_reset_tools.cpp} | 0 ...reaxc_tool_box.cpp => reaxff_tool_box.cpp} | 0 ...n_angles.cpp => reaxff_torsion_angles.cpp} | 0 ...e_angles.cpp => reaxff_valence_angles.cpp} | 0 tools/README | 1 - tools/reax/Cutoff.dic | 14 - tools/reax/README.txt | 10 - tools/reax/reaxc_bond.pl | 152 -------- 173 files changed, 1149 insertions(+), 1298 deletions(-) rename doc/src/{fix_qeq_reax.rst => fix_qeq_reaxff.rst} (82%) rename doc/src/{fix_reaxc_bonds.rst => fix_reaxff_bonds.rst} (79%) rename doc/src/{fix_reaxc_species.rst => fix_reaxff_species.rst} (77%) rename doc/src/{pair_reaxc.rst => pair_reaxff.rst} (76%) rename examples/{reax => reaxff}/AB/README (100%) rename examples/{reax => reaxff}/AB/data.AB (100%) rename examples/{reax => reaxff}/AB/ffield.reax.AB (100%) rename examples/{reax => reaxff}/AB/in.AB (100%) rename examples/{reax => reaxff}/AB/lmp_control (100%) rename examples/{reax => reaxff}/AB/log.8Mar18.AB.g++.1 (100%) rename examples/{reax => reaxff}/AB/log.8Mar18.AB.g++.4 (100%) rename examples/{reax => reaxff}/AB/param.qeq (100%) rename examples/{reax => reaxff}/AuO/README (100%) rename examples/{reax => reaxff}/AuO/data.AuO (100%) rename examples/{reax => reaxff}/AuO/ffield.reax.AuO (100%) rename examples/{reax => reaxff}/AuO/in.AuO (100%) rename examples/{reax => reaxff}/AuO/lmp_control (100%) rename examples/{reax => reaxff}/AuO/log.8Mar18.AuO.g++.1 (100%) rename examples/{reax => reaxff}/AuO/log.8Mar18.AuO.g++.4 (100%) rename examples/{reax => reaxff}/AuO/param.qeq (100%) rename examples/{reax => reaxff}/CHO/README (100%) rename examples/{reax => reaxff}/CHO/data.CHO (100%) rename examples/{reax => reaxff}/CHO/ffield.reax.cho (100%) rename examples/{reax => reaxff}/CHO/in.CHO (100%) rename examples/{reax => reaxff}/CHO/lmp_control (100%) rename examples/{reax => reaxff}/CHO/log.8Mar18.CHO.g++.1 (100%) rename examples/{reax => reaxff}/CHO/log.8Mar18.CHO.g++.4 (100%) rename examples/{reax => reaxff}/CHO/param.qeq (100%) rename examples/{reax => reaxff}/FC/README (100%) rename examples/{reax => reaxff}/FC/data.FC (100%) rename examples/{reax => reaxff}/FC/ffield.reax.FC (100%) rename examples/{reax => reaxff}/FC/in.FC (100%) rename examples/{reax => reaxff}/FC/log.8Mar18.FC.g++.1 (100%) rename examples/{reax => reaxff}/FC/log.8Mar18.FC.g++.4 (100%) rename examples/{reax => reaxff}/FeOH3/README (100%) rename examples/{reax => reaxff}/FeOH3/data.FeOH3 (100%) rename examples/{reax => reaxff}/FeOH3/ffield.reax.Fe_O_C_H (100%) rename examples/{reax => reaxff}/FeOH3/in.FeOH3 (100%) rename examples/{reax => reaxff}/FeOH3/lmp_control (100%) rename examples/{reax => reaxff}/FeOH3/log.5Oct16.FeOH3.g++.1 (100%) rename examples/{reax => reaxff}/FeOH3/log.5Oct16.FeOH3.g++.4 (100%) rename examples/{reax => reaxff}/FeOH3/param.qeq (100%) rename examples/{reax => reaxff}/HNS/README.txt (100%) rename examples/{reax => reaxff}/HNS/data.hns-equil (100%) rename examples/{reax => reaxff}/HNS/ffield.reax.hns (100%) rename examples/{reax => reaxff}/HNS/in.reaxc.hns (100%) rename examples/{reax => reaxff}/HNS/log.8Mar18.reaxc.hns.g++.1 (100%) rename examples/{reax => reaxff}/HNS/log.8Mar18.reaxc.hns.g++.4 (100%) rename examples/{reax => reaxff}/RDX/README (100%) rename examples/{reax => reaxff}/RDX/data.RDX (100%) rename examples/{reax => reaxff}/RDX/ffield.reax.rdx (100%) rename examples/{reax => reaxff}/RDX/in.RDX (100%) rename examples/{reax => reaxff}/RDX/lmp_control (100%) rename examples/{reax => reaxff}/RDX/log.8Mar18.RDX.g++.1 (100%) rename examples/{reax => reaxff}/RDX/log.8Mar18.RDX.g++.4 (100%) rename examples/{reax => reaxff}/RDX/param.qeq (100%) rename examples/{reax => reaxff}/README (100%) rename examples/{reax => reaxff}/VOH/README (100%) rename examples/{reax => reaxff}/VOH/data.VOH (100%) rename examples/{reax => reaxff}/VOH/ffield.reax.V_O_C_H (100%) rename examples/{reax => reaxff}/VOH/in.VOH (100%) rename examples/{reax => reaxff}/VOH/lmp_control (100%) rename examples/{reax => reaxff}/VOH/log.8Mar18.VOH.g++.1 (100%) rename examples/{reax => reaxff}/VOH/log.8Mar18.VOH.g++.4 (100%) rename examples/{reax => reaxff}/VOH/param.qeq (100%) rename examples/{reax => reaxff}/ZnOH2/README (100%) rename examples/{reax => reaxff}/ZnOH2/data.ZnOH2 (100%) rename examples/{reax => reaxff}/ZnOH2/ffield.reax.ZnOH (100%) rename examples/{reax => reaxff}/ZnOH2/in.ZnOH2 (100%) rename examples/{reax => reaxff}/ZnOH2/lmp_control (100%) rename examples/{reax => reaxff}/ZnOH2/log.8Mar18.ZnOH2.g++.1 (100%) rename examples/{reax => reaxff}/ZnOH2/log.8Mar18.ZnOH2.g++.4 (100%) rename examples/{reax => reaxff}/ZnOH2/param.qeq (100%) rename examples/{reax => reaxff}/ci-reaxFF/CH4.dat (100%) rename examples/{reax => reaxff}/ci-reaxFF/ci-reaxFF_ZBL.dat (100%) rename examples/{reax => reaxff}/ci-reaxFF/control (100%) rename examples/{reax => reaxff}/ci-reaxFF/ffield.ci-reax.CH (100%) rename examples/{reax => reaxff}/ci-reaxFF/in.ci-reax.CH (100%) rename examples/{reax => reaxff}/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 (100%) rename examples/{reax => reaxff}/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 (100%) rename examples/{reax => reaxff}/control.reax_c.rdx (100%) rename examples/{reax => reaxff}/control.reax_c.tatb (100%) rename examples/{reax => reaxff}/data.rdx (100%) rename examples/{reax => reaxff}/data.tatb (100%) rename examples/{reax => reaxff}/ffield.reax (100%) rename examples/{reax => reaxff}/in.reaxc.rdx (100%) rename examples/{reax => reaxff}/in.reaxc.rdx-shielded (100%) rename examples/{reax => reaxff}/in.reaxc.tatb (100%) rename examples/{reax => reaxff}/in.reaxc.tatb-shielded (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.rdx-shielded.g++.1 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.rdx-shielded.g++.4 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.rdx.g++.1 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.rdx.g++.4 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.tatb-shielded.g++.1 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.tatb-shielded.g++.4 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.tatb.g++.1 (100%) rename examples/{reax => reaxff}/log.21Apr21.reaxc.tatb.g++.4 (100%) rename src/KOKKOS/{fix_qeq_reax_kokkos.cpp => fix_qeq_reaxff_kokkos.cpp} (87%) rename src/KOKKOS/{fix_qeq_reax_kokkos.h => fix_qeq_reaxff_kokkos.h} (75%) rename src/KOKKOS/{fix_reaxc_bonds_kokkos.cpp => fix_reaxff_bonds_kokkos.cpp} (69%) rename src/KOKKOS/{fix_reaxc_bonds_kokkos.h => fix_reaxff_bonds_kokkos.h} (59%) rename src/KOKKOS/{fix_reaxc_species_kokkos.cpp => fix_reaxff_species_kokkos.cpp} (83%) rename src/KOKKOS/{fix_reaxc_species_kokkos.h => fix_reaxff_species_kokkos.h} (58%) rename src/KOKKOS/{pair_reaxc_kokkos.cpp => pair_reaxff_kokkos.cpp} (91%) rename src/KOKKOS/{pair_reaxc_kokkos.h => pair_reaxff_kokkos.h} (86%) rename src/OPENMP/{fix_qeq_reax_omp.cpp => fix_qeq_reaxff_omp.cpp} (92%) rename src/OPENMP/{fix_qeq_reax_omp.h => fix_qeq_reaxff_omp.h} (84%) rename src/OPENMP/{pair_reaxc_omp.cpp => pair_reaxff_omp.cpp} (88%) rename src/OPENMP/{pair_reaxc_omp.h => pair_reaxff_omp.h} (92%) rename src/OPENMP/{reaxc_bond_orders_omp.cpp => reaxff_bond_orders_omp.cpp} (98%) rename src/OPENMP/{reaxc_bonds_omp.cpp => reaxff_bonds_omp.cpp} (97%) rename src/OPENMP/{reaxc_forces_omp.cpp => reaxff_forces_omp.cpp} (99%) rename src/OPENMP/{reaxc_hydrogen_bonds_omp.cpp => reaxff_hydrogen_bonds_omp.cpp} (98%) rename src/OPENMP/{reaxc_init_md_omp.cpp => reaxff_init_md_omp.cpp} (100%) rename src/OPENMP/{reaxc_multi_body_omp.cpp => reaxff_multi_body_omp.cpp} (98%) rename src/OPENMP/{reaxc_nonbonded_omp.cpp => reaxff_nonbonded_omp.cpp} (97%) rename src/OPENMP/{reaxc_torsion_angles_omp.cpp => reaxff_torsion_angles_omp.cpp} (99%) rename src/OPENMP/{reaxc_valence_angles_omp.cpp => reaxff_valence_angles_omp.cpp} (99%) rename src/REAXFF/{fix_qeq_reax.cpp => fix_qeq_reaxff.cpp} (83%) rename src/REAXFF/{fix_qeq_reax.h => fix_qeq_reaxff.h} (94%) rename src/REAXFF/{fix_reaxc.cpp => fix_reaxff.cpp} (87%) rename src/REAXFF/{fix_reaxc.h => fix_reaxff.h} (89%) rename src/REAXFF/{fix_reaxc_bonds.cpp => fix_reaxff_bonds.cpp} (79%) rename src/REAXFF/{fix_reaxc_bonds.h => fix_reaxff_bonds.h} (82%) rename src/REAXFF/{fix_reaxc_species.cpp => fix_reaxff_species.cpp} (85%) rename src/REAXFF/{fix_reaxc_species.h => fix_reaxff_species.h} (87%) rename src/REAXFF/{pair_reaxc.cpp => pair_reaxff.cpp} (88%) rename src/REAXFF/{pair_reaxc.h => pair_reaxff.h} (88%) rename src/REAXFF/{reaxc_allocate.cpp => reaxff_allocate.cpp} (100%) rename src/REAXFF/{reaxc_bond_orders.cpp => reaxff_bond_orders.cpp} (100%) rename src/REAXFF/{reaxc_bonds.cpp => reaxff_bonds.cpp} (100%) rename src/REAXFF/{reaxc_control.cpp => reaxff_control.cpp} (100%) rename src/REAXFF/{reaxc_ffield.cpp => reaxff_ffield.cpp} (100%) rename src/REAXFF/{reaxc_forces.cpp => reaxff_forces.cpp} (100%) rename src/REAXFF/{reaxc_hydrogen_bonds.cpp => reaxff_hydrogen_bonds.cpp} (100%) rename src/REAXFF/{reaxc_init_md.cpp => reaxff_init_md.cpp} (100%) rename src/REAXFF/{reaxc_list.cpp => reaxff_list.cpp} (100%) rename src/REAXFF/{reaxc_lookup.cpp => reaxff_lookup.cpp} (100%) rename src/REAXFF/{reaxc_multi_body.cpp => reaxff_multi_body.cpp} (100%) rename src/REAXFF/{reaxc_nonbonded.cpp => reaxff_nonbonded.cpp} (100%) rename src/REAXFF/{reaxc_reset_tools.cpp => reaxff_reset_tools.cpp} (100%) rename src/REAXFF/{reaxc_tool_box.cpp => reaxff_tool_box.cpp} (100%) rename src/REAXFF/{reaxc_torsion_angles.cpp => reaxff_torsion_angles.cpp} (100%) rename src/REAXFF/{reaxc_valence_angles.cpp => reaxff_valence_angles.cpp} (100%) delete mode 100644 tools/reax/Cutoff.dic delete mode 100644 tools/reax/README.txt delete mode 100755 tools/reax/reaxc_bond.pl diff --git a/cmake/Modules/Packages/OPENMP.cmake b/cmake/Modules/Packages/OPENMP.cmake index 922df86ef6..0a23e58b4b 100644 --- a/cmake/Modules/Packages/OPENMP.cmake +++ b/cmake/Modules/Packages/OPENMP.cmake @@ -25,15 +25,15 @@ endif() if(PKG_REAXFF) - list(APPEND OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/reaxc_bond_orders_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_hydrogen_bonds_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_nonbonded_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_bonds_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_init_md_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_torsion_angles_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_forces_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_multi_body_omp.cpp - ${OPENMP_SOURCES_DIR}/reaxc_valence_angles_omp.cpp) + list(APPEND OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/reaxff_bond_orders_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_hydrogen_bonds_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_nonbonded_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_bonds_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_init_md_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_torsion_angles_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_forces_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_multi_body_omp.cpp + ${OPENMP_SOURCES_DIR}/reaxff_valence_angles_omp.cpp) endif() target_sources(lammps PRIVATE ${OPENMP_SOURCES}) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 0ca71699a3..45a75ff394 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -179,14 +179,14 @@ OPT. * :doc:`qeq/dynamic ` * :doc:`qeq/fire ` * :doc:`qeq/point ` - * :doc:`qeq/reax (ko) ` + * :doc:`qeq/reaxff (ko) ` * :doc:`qeq/shielded ` * :doc:`qeq/slater ` * :doc:`qmmm ` * :doc:`qtb ` * :doc:`rattle ` - * :doc:`reax/c/bonds (k) ` - * :doc:`reax/c/species (k) ` + * :doc:`reaxff/bonds (k) ` + * :doc:`reaxff/species (k) ` * :doc:`recenter ` * :doc:`restrain ` * :doc:`rhok ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 7abb1d582a..db3d947892 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -235,7 +235,7 @@ OPT. * :doc:`python ` * :doc:`quip ` * :doc:`rann ` - * :doc:`reax/c (ko) ` + * :doc:`reaxff (ko) ` * :doc:`rebo (io) ` * :doc:`resquared (go) ` * :doc:`sdpd/taitwater/isothermal ` diff --git a/doc/src/Errors_warnings.rst b/doc/src/Errors_warnings.rst index 68d6b0451a..806dec024b 100644 --- a/doc/src/Errors_warnings.rst +++ b/doc/src/Errors_warnings.rst @@ -514,7 +514,7 @@ This will most likely cause errors in kinetic fluctuations. will integrate the body motion, but it would be more efficient to use fix rigid. -*Not using real units with pair reax* +*Not using real units with pair reaxff* This is most likely an error, unless you have created your own ReaxFF parameter file in a different set of units. @@ -805,5 +805,3 @@ This will most likely cause errors in kinetic fluctuations. *Using pair tail corrections with pair_modify compute no* The tail corrections will thus not be computed. -*pair style reax is now deprecated and will soon be retired. Users should switch to pair_style reax/c* - Self-explanatory. diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 5a4327dad6..1af1512bbf 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -2274,10 +2274,10 @@ for monitoring molecules as bonds are created and destroyed. * src/REAXFF: filenames -> commands * src/REAXFF/README -* :doc:`pair_style reax/c ` -* :doc:`fix reax/c/bonds ` -* :doc:`fix reax/c/species ` -* examples/reax +* :doc:`pair_style reaxff ` +* :doc:`fix reaxff/bonds ` +* :doc:`fix reaxff/species ` +* examples/reaxff ---------- diff --git a/doc/src/Packages_list.rst b/doc/src/Packages_list.rst index 44c05f8a39..d568976ffe 100644 --- a/doc/src/Packages_list.rst +++ b/doc/src/Packages_list.rst @@ -370,7 +370,7 @@ whether an extra library is needed to build and use the package: - no * - :ref:`REAXFF ` - ReaxFF potential (C/C++) - - :doc:`pair_style reaxc ` + - :doc:`pair_style reaxff ` - reax - no * - :ref:`REPLICA ` diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 65a96ce44a..e7cd87aa78 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -76,7 +76,6 @@ Post-processing tools * :ref:`phonon ` * :ref:`pymol_asphere ` * :ref:`python ` - * :ref:`reax ` * :ref:`replica ` * :ref:`smd ` * :ref:`spin ` @@ -947,20 +946,6 @@ while at the Shell lab at UC Santa Barbara. (tanmoy dot 7989 at gmail.com) ---------- -.. _reax_tool: - -reax tool --------------------------- - -The reax sub-directory contains stand-alone codes that can -post-process the output of the :doc:`fix reax/c/bonds ` -command from a LAMMPS simulation using :doc:`ReaxFF `. See -the README.txt file for more info. - -These tools were written by Aidan Thompson at Sandia. - ----------- - .. _smd: smd tool diff --git a/doc/src/compute_pair.rst b/doc/src/compute_pair.rst index 1b074203aa..abfd1ebed4 100644 --- a/doc/src/compute_pair.rst +++ b/doc/src/compute_pair.rst @@ -24,7 +24,7 @@ Examples compute 1 all pair gauss compute 1 all pair lj/cut/coul/cut ecoul compute 1 all pair tersoff 2 epair - compute 1 all pair reax/c + compute 1 all pair reaxff Description """"""""""" @@ -64,7 +64,8 @@ is stored as a global scalar. :doc:`pair_modify ` command. Some pair styles tally additional quantities, e.g. a breakdown of -potential energy into 14 components is tallied by the :doc:`pair_style reax/c ` command. These values (1 or more) +potential energy into 14 components is tallied by the +:doc:`pair_style reaxff ` command. These values (1 or more) are stored as a global vector by this compute. See the doc page for :doc:`individual pair styles ` for info on these values. diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 912cfad255..07a663c789 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -322,14 +322,14 @@ accelerated styles exist. * :doc:`qeq/dynamic ` - charge equilibration via dynamic method * :doc:`qeq/fire ` - charge equilibration via FIRE minimizer * :doc:`qeq/point ` - charge equilibration via point method -* :doc:`qeq/reax ` - charge equilibration for ReaxFF potential +* :doc:`qeq/reaxff ` - charge equilibration for ReaxFF potential * :doc:`qeq/shielded ` - charge equilibration via shielded method * :doc:`qeq/slater ` - charge equilibration via Slater method * :doc:`qmmm ` - functionality to enable a quantum mechanics/molecular mechanics coupling * :doc:`qtb ` - implement quantum thermal bath scheme * :doc:`rattle ` - RATTLE constraints on bonds and/or angles -* :doc:`reax/c/bonds ` - write out ReaxFF bond information -* :doc:`reax/c/species ` - write out ReaxFF molecule information +* :doc:`reaxff/bonds ` - write out ReaxFF bond information +* :doc:`reaxff/species ` - write out ReaxFF molecule information * :doc:`recenter ` - constrain the center-of-mass position of a group of atoms * :doc:`restrain ` - constrain a bond, angle, dihedral * :doc:`rhok ` - add bias potential for long-range ordered systems diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index a110d93a8d..58d86f8472 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -186,7 +186,7 @@ formulas for the meaning of these parameters: +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ | :doc:`nm/cut/coul/cut, nm/cut/coul/long ` | E0,R0,m,n,coulombic_cutoff | type pairs | +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ -| :doc:`reax/c ` | chi, eta, gamma | type global | +| :doc:`reaxff ` | chi, eta, gamma | type global | +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ | :doc:`snap ` | scale | type pairs | +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ diff --git a/doc/src/fix_gcmc.rst b/doc/src/fix_gcmc.rst index c65dace601..e360fab86e 100644 --- a/doc/src/fix_gcmc.rst +++ b/doc/src/fix_gcmc.rst @@ -374,7 +374,7 @@ in the context of NVT dynamics. has been reached. With some pair_styles, such as :doc:`Buckingham `, -:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, two +:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, two atoms placed close to each other may have an arbitrary large, negative potential energy due to the functional form of the potential. While these unphysical configurations are inaccessible to typical dynamical diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index ccacea08db..113692da9b 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -32,7 +32,7 @@ Syntax * cutoff = global cutoff for charge-charge interactions (distance unit) * tolerance = precision to which charges will be equilibrated * maxiter = maximum iterations to perform charge equilibration -* qfile = a filename with QEq parameters or *coul/streitz* or *reax/c* +* qfile = a filename with QEq parameters or *coul/streitz* or *reaxff* * zero or more keyword/value pairs may be appended * keyword = *alpha* or *qdamp* or *qstep* or *warn* @@ -91,11 +91,11 @@ on the current atom configuration), then remove the fix via the The :doc:`fix qeq/comb ` command must still be used to perform charge equilibration with the :doc:`COMB potential - `. The :doc:`fix qeq/reax ` command can be + `. The :doc:`fix qeq/reaxff ` command can be used to perform charge equilibration with the :doc:`ReaxFF force - field `, although fix qeq/shielded yields the same - results as fix qeq/reax if *Nevery*\ , *cutoff*\ , and *tolerance* - are the same. Eventually the fix qeq/reax command will be + field `, although fix qeq/shielded yields the same + results as fix qeq/reaxff if *Nevery*\ , *cutoff*\ , and *tolerance* + are the same. Eventually the fix qeq/reaxff command will be deprecated. The QEq method minimizes the electrostatic energy of the system (or @@ -150,11 +150,11 @@ interaction between a pair of charged particles. Interaction through the shielded Coulomb is given by equation (13) of the :ref:`ReaxFF force field ` paper. The shielding accounts for charge overlap between charged particles at small separation. This style is the same -as :doc:`fix qeq/reax `, and can be used with -:doc:`pair_style reax/c `. Only the *chi*\ , *eta*\ , and +as :doc:`fix qeq/reaxff `, and can be used with +:doc:`pair_style reaxff `. Only the *chi*\ , *eta*\ , and *gamma* parameters from the *qfile* file are used. When using the string -*reax/c* as filename, these parameters are extracted directly from an -active *reax/c* pair style. This style solves partial charges on atoms +*reaxff* as filename, these parameters are extracted directly from an +active *reaxff* pair style. This style solves partial charges on atoms via the matrix inversion method. A tolerance of 1.0e-6 is usually a good number. @@ -235,7 +235,7 @@ The qeq fixes are not compatible with the GPU and USER-INTEL packages. Related commands """""""""""""""" -:doc:`fix qeq/reax `, :doc:`fix qeq/comb ` +:doc:`fix qeq/reaxff `, :doc:`fix qeq/comb ` Default """"""" diff --git a/doc/src/fix_qeq_comb.rst b/doc/src/fix_qeq_comb.rst index 74a97720dc..8eeea6c5b4 100644 --- a/doc/src/fix_qeq_comb.rst +++ b/doc/src/fix_qeq_comb.rst @@ -41,7 +41,7 @@ Perform charge equilibration (QeQ) in conjunction with the COMB equilibration portion of the calculation using the so-called QEq method, whereby the charge on each atom is adjusted to minimize the energy of the system. This fix can only be used with the COMB -potential; see the :doc:`fix qeq/reax ` command for a QeQ +potential; see the :doc:`fix qeq/reaxff ` command for a QeQ calculation that can be used with any potential. Only charges on the atoms in the specified group are equilibrated. diff --git a/doc/src/fix_qeq_reax.rst b/doc/src/fix_qeq_reaxff.rst similarity index 82% rename from doc/src/fix_qeq_reax.rst rename to doc/src/fix_qeq_reaxff.rst index 89fffcf2a3..96a20d4ca6 100644 --- a/doc/src/fix_qeq_reax.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -1,31 +1,31 @@ -.. index:: fix qeq/reax -.. index:: fix qeq/reax/kk -.. index:: fix qeq/reax/omp +.. index:: fix qeq/reaxff +.. index:: fix qeq/reaxff/kk +.. index:: fix qeq/reaxff/omp -fix qeq/reax command -==================== +fix qeq/reaxff command +====================== -Accelerator Variants: *qeq/reax/kk*, *qeq/reax/omp* +Accelerator Variants: *qeq/reaxff/kk*, *qeq/reaxff/omp* Syntax """""" .. parsed-literal:: - fix ID group-ID qeq/reax Nevery cutlo cuthi tolerance params args + fix ID group-ID qeq/reaxff Nevery cutlo cuthi tolerance params args * ID, group-ID are documented in :doc:`fix ` command -* qeq/reax = style name of this fix command +* qeq/reaxff = style name of this fix command * Nevery = perform QEq every this many steps * cutlo,cuthi = lo and hi cutoff for Taper radius * tolerance = precision to which charges will be equilibrated -* params = reax/c or a filename +* params = reaxff or a filename * one or more keywords or keyword/value pairs may be appended .. parsed-literal:: keyword = *dual* or *maxiter* or *nowarn* - *dual* = process S and T matrix in parallel (only for qeq/reax/omp) + *dual* = process S and T matrix in parallel (only for qeq/reaxff/omp) *maxiter* N = limit the number of iterations to *N* *nowarn* = do not print a warning message if the maximum number of iterations was reached @@ -34,8 +34,8 @@ Examples .. code-block:: LAMMPS - fix 1 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - fix 1 all qeq/reax 1 0.0 10.0 1.0e-6 param.qeq maxiter 500 + fix 1 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff + fix 1 all qeq/reaxff 1 0.0 10.0 1.0e-6 param.qeq maxiter 500 Description """"""""""" @@ -43,19 +43,19 @@ Description Perform the charge equilibration (QEq) method as described in :ref:`(Rappe and Goddard) ` and formulated in :ref:`(Nakano) `. It is typically used in conjunction with the ReaxFF force -field model as implemented in the :doc:`pair_style reax/c ` +field model as implemented in the :doc:`pair_style reaxff ` command, but it can be used with any potential in LAMMPS, so long as it defines and uses charges on each atom. The :doc:`fix qeq/comb ` command should be used to perform charge equilibration with the :doc:`COMB potential `. For more technical details -about the charge equilibration performed by fix qeq/reax, see the +about the charge equilibration performed by fix qeq/reaxff, see the :ref:`(Aktulga) ` paper. The QEq method minimizes the electrostatic energy of the system by adjusting the partial charge on individual atoms based on interactions with their neighbors. It requires some parameters for each atom type. -If the *params* setting above is the word "reax/c", then these are -extracted from the :doc:`pair_style reax/c ` command and +If the *params* setting above is the word "reaxff", then these are +extracted from the :doc:`pair_style reaxff ` command and the ReaxFF force field file it reads in. If a file name is specified for *params*\ , then the parameters are taken from the specified file and the file must contain one line for each atom type. The latter @@ -76,7 +76,7 @@ of this fix are hard-coded to be A, eV, and electronic charge. The optional *dual* keyword allows to perform the optimization of the S and T matrices in parallel. This is only supported for -the *qeq/reax/omp* style. Otherwise they are processed separately. +the *qeq/reaxff/omp* style. Otherwise they are processed separately. The optional *maxiter* keyword allows changing the max number of iterations in the linear solver. The default value is 200. @@ -119,7 +119,7 @@ periodic cell dimensions less than 10 angstroms. Related commands """""""""""""""" -:doc:`pair_style reax/c ` +:doc:`pair_style reaxff `, :doc:`fix qeq/shielded ` Default """"""" diff --git a/doc/src/fix_reaxc_bonds.rst b/doc/src/fix_reaxff_bonds.rst similarity index 79% rename from doc/src/fix_reaxc_bonds.rst rename to doc/src/fix_reaxff_bonds.rst index 9207ee7a63..5dd4df7765 100644 --- a/doc/src/fix_reaxc_bonds.rst +++ b/doc/src/fix_reaxff_bonds.rst @@ -1,17 +1,17 @@ -.. index:: fix reax/c/bonds -.. index:: fix reax/c/bonds/kk +.. index:: fix reaxff/bonds +.. index:: fix reaxff/bonds/kk -fix reax/c/bonds command +fix reaxff/bonds command ======================== -Accelerator Variants: *reax/c/bonds/kk* +Accelerator Variants: *reaxff/bonds/kk* Syntax """""" .. parsed-literal:: - fix ID group-ID reaxc/bonds Nevery filename + fix ID group-ID reaxff/bonds Nevery filename * ID, group-ID are documented in :doc:`fix ` command * reax/bonds = style name of this fix command @@ -23,17 +23,17 @@ Examples .. code-block:: LAMMPS - fix 1 all reax/c/bonds 100 bonds.reaxc + fix 1 all reaxff/bonds 100 bonds.reaxff Description """"""""""" Write out the bond information computed by the ReaxFF potential specified -by :doc:`pair_style reax/c ` in the exact same format as the +by :doc:`pair_style reaxff ` in the exact same format as the original stand-alone ReaxFF code of Adri van Duin. The bond information is written to *filename* on timesteps that are multiples of *Nevery*\ , including timestep 0. For time-averaged chemical species analysis, -please see the :doc:`fix reaxc/c/species ` command. +please see the :doc:`fix reaxff/species ` command. The specified group-ID is ignored by this fix. @@ -76,7 +76,7 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" -The fix reax/c/bonds command requires that the :doc:`pair_style reax/c ` is invoked. This fix is part of the +The fix reaxff/bonds command requires that the :doc:`pair_style reaxff ` is invoked. This fix is part of the REAXFF package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. @@ -87,7 +87,7 @@ To write gzipped bond files, you must compile LAMMPS with the Related commands """""""""""""""" -:doc:`pair_style reax/c `, :doc:`fix reax/c/species ` +:doc:`pair_style reaxff `, :doc:`fix reaxff/species ` Default """"""" diff --git a/doc/src/fix_reaxc_species.rst b/doc/src/fix_reaxff_species.rst similarity index 77% rename from doc/src/fix_reaxc_species.rst rename to doc/src/fix_reaxff_species.rst index bce140a9af..bca9c2c726 100644 --- a/doc/src/fix_reaxc_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -1,20 +1,20 @@ -.. index:: fix reax/c/species -.. index:: fix reax/c/species/kk +.. index:: fix reaxff/species +.. index:: fix reaxff/species/kk -fix reax/c/species command +fix reaxff/species command ========================== -Accelerator Variants: *reax/c/species/kk* +Accelerator Variants: *reaxff/species/kk* Syntax """""" .. parsed-literal:: - fix ID group-ID reax/c/species Nevery Nrepeat Nfreq filename keyword value ... + fix ID group-ID reaxff/species Nevery Nrepeat Nfreq filename keyword value ... * ID, group-ID are documented in :doc:`fix ` command -* reax/c/species = style name of this command +* reaxff/species = style name of this command * Nevery = sample bond-order every this many timesteps * Nrepeat = # of bond-order samples used for calculating averages * Nfreq = calculate average bond-order every this many timesteps @@ -37,15 +37,15 @@ Examples .. code-block:: LAMMPS - fix 1 all reax/c/species 10 10 100 species.out - fix 1 all reax/c/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2 0.55 - fix 1 all reax/c/species 1 100 100 species.out element Au O H position 1000 AuOH.pos + fix 1 all reaxff/species 10 10 100 species.out + fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2 0.55 + fix 1 all reaxff/species 1 100 100 species.out element Au O H position 1000 AuOH.pos Description """"""""""" Write out the chemical species information computed by the ReaxFF -potential specified by :doc:`pair_style reax/c `. +potential specified by :doc:`pair_style reaxff `. Bond-order values (either averaged or instantaneous, depending on value of *Nrepeat*\ ) are used to determine chemical bonds. Every *Nfreq* timesteps, chemical species information is written to @@ -73,7 +73,7 @@ symbol printed for each LAMMPS atom type. The number of symbols must match the number of LAMMPS atom types and each symbol must consist of 1 or 2 alphanumeric characters. Normally, these symbols should be chosen to match the chemical identity of each LAMMPS atom type, as -specified using the :doc:`reax/c pair_coeff ` command and +specified using the :doc:`reaxff pair_coeff ` command and the ReaxFF force field file. The optional keyword *position* writes center-of-mass positions of @@ -115,12 +115,12 @@ average bond-order for the species analysis output on timestep 100. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options -are relevant to this fix. +No information about this fix is written to :doc:`binary restart files `. +None of the :doc:`fix_modify ` options are relevant to this fix. -This fix computes both a global vector of length 2 and a per-atom -vector, either of which can be accessed by various :doc:`output commands `. The values in the global vector are -"intensive". +This fix computes both a global vector of length 2 and a per-atom vector, +either of which can be accessed by various :doc:`output commands `. +The values in the global vector are "intensive". The 2 values in the global vector are as follows: @@ -134,7 +134,8 @@ will be the same and will be equal to the smallest atom ID of any atom in the molecule. No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +the :doc:`run ` command. +This fix is not invoked during :doc:`energy minimization `. ---------- @@ -145,26 +146,20 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" -The "fix reax/c/species" currently only works with :doc:`pair_style reax/c ` and it requires that the :doc:`pair_style reax/c ` be invoked. This fix is part of the -REAXFF package. It is only enabled if LAMMPS was built with that -package. See the :doc:`Build package ` doc page for more -info. +The "fix reaxff/species" requires that :doc:`pair_style reaxff ` is used. +This fix is part of the REAXFF package. It is only enabled if LAMMPS was built with that +package. See the :doc:`Build package ` doc page for more info. -To write gzipped species files, you must compile LAMMPS with the --DLAMMPS_GZIP option. - -It should be possible to extend it to other reactive pair_styles (such as -:doc:`rebo `, :doc:`airebo `, -:doc:`comb `, and :doc:`bop `), but this has not yet been done. +To write gzipped species files, you must compile LAMMPS with the -DLAMMPS_GZIP option. Related commands """""""""""""""" -:doc:`pair_style reax/c `, :doc:`fix reax/c/bonds ` +:doc:`pair_style reaxff `, :doc:`fix reaxff/bonds ` Default """"""" -The default values for bond-order cutoffs are 0.3 for all I-J pairs. The -default element symbols are C, H, O, N. Position files are not written -by default. +The default values for bond-order cutoffs are 0.3 for all I-J pairs. +The default element symbols are C, H, O, N. +Position files are not written by default. diff --git a/doc/src/kim_commands.rst b/doc/src/kim_commands.rst index f116a70922..fc00a574d2 100644 --- a/doc/src/kim_commands.rst +++ b/doc/src/kim_commands.rst @@ -372,9 +372,9 @@ the *kim interactions* command executes the following LAMMPS input commands: .. code-block:: LAMMPS - pair_style reax/c lmp_control safezone 2.0 mincap 100 + pair_style reaxff lmp_control safezone 2.0 mincap 100 pair_coeff * * ffield.reax.rdx C H N O - fix reaxqeq all qeq/reax 1 0.0 10.0 1.0e-6 param.qeq + fix reaxqeq all qeq/reaxff 1 0.0 10.0 1.0e-6 param.qeq .. note:: diff --git a/doc/src/package.rst b/doc/src/package.rst index e997dc6147..54cf74f5be 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -448,7 +448,8 @@ does not require atomic operations in the calculation of pair forces. For that reason, *full* is the default setting for GPUs. However, when running on CPUs, a *half* neighbor list is the default because it are often faster, just as it is for non-accelerated pair styles. Similarly, -the *neigh/qeq* keyword determines how neighbor lists are built for :doc:`fix qeq/reax/kk `. +the *neigh/qeq* keyword determines how neighbor lists are built for +:doc:`fix qeq/reaxff/kk `. If the *neigh/thread* keyword is set to *off*\ , then the KOKKOS package threads only over atoms. However, for small systems, this may not expose diff --git a/doc/src/pair_reaxc.rst b/doc/src/pair_reaxff.rst similarity index 76% rename from doc/src/pair_reaxc.rst rename to doc/src/pair_reaxff.rst index 352bcb4847..0389742ea5 100644 --- a/doc/src/pair_reaxc.rst +++ b/doc/src/pair_reaxff.rst @@ -1,18 +1,18 @@ -.. index:: pair_style reax/c -.. index:: pair_style reax/c/kk -.. index:: pair_style reax/c/omp +.. index:: pair_style reaxff +.. index:: pair_style reaxff/kk +.. index:: pair_style reaxff/omp -pair_style reax/c command +pair_style reaxff command ========================= -Accelerator Variants: *reax/c/kk*, *reax/c/omp* +Accelerator Variants: *reaxff/kk*, *reaxff/omp* Syntax """""" .. code-block:: LAMMPS - pair_style reax/c cfile keyword value + pair_style reaxff cfile keyword value * cfile = NULL or name of a control file * zero or more keyword/value pairs may be appended @@ -20,7 +20,7 @@ Syntax .. parsed-literal:: keyword = *checkqeq* or *lgvdw* or *safezone* or *mincap* or *minhbonds* - *checkqeq* value = *yes* or *no* = whether or not to require qeq/reax fix + *checkqeq* value = *yes* or *no* = whether or not to require qeq/reaxff fix *enobonds* value = *yes* or *no* = whether or not to tally energy of atoms with no bonds *lgvdw* value = *yes* or *no* = whether or not to use a low gradient vdW correction *safezone* = factor used for array allocation @@ -32,37 +32,38 @@ Examples .. code-block:: LAMMPS - pair_style reax/c NULL - pair_style reax/c controlfile checkqeq no - pair_style reax/c NULL lgvdw yes - pair_style reax/c NULL safezone 1.6 mincap 100 + pair_style reaxff NULL + pair_style reaxff controlfile checkqeq no + pair_style reaxff NULL lgvdw yes + pair_style reaxff NULL safezone 1.6 mincap 100 pair_coeff * * ffield.reax C H O N Description """"""""""" -Style *reax/c* computes the ReaxFF potential of van Duin, Goddard and +Style *reaxff* computes the ReaxFF potential of van Duin, Goddard and co-workers. ReaxFF uses distance-dependent bond-order functions to represent the contributions of chemical bonding to the potential energy. There is more than one version of ReaxFF. The version implemented in LAMMPS uses the functional forms documented in the -supplemental information of the following paper: :ref:`(Chenoweth et al., 2008) `. The version integrated into LAMMPS matches -the most up-to-date version of ReaxFF as of summer 2010. For more -technical details about the pair reax/c implementation of ReaxFF, see -the :ref:`(Aktulga) ` paper. The *reax/c* style was initially -implemented as a stand-alone C code and is now integrated into LAMMPS -as a package. +supplemental information of the following paper: +:ref:`(Chenoweth et al., 2008) `. The version integrated +into LAMMPS matches the version of ReaxFF From Summer 2010. For more +technical details about the pair reaxff implementation of ReaxFF, see +the :ref:`(Aktulga) ` paper. The *reaxff* style was initially +implemented as a stand-alone C code and is now converted to C++ and +integrated into LAMMPS as a package. -The *reax/c/kk* style is a Kokkos version of the ReaxFF potential that -is derived from the *reax/c* style. The Kokkos version can run on GPUs +The *reaxff/kk* style is a Kokkos version of the ReaxFF potential that +is derived from the *reaxff* style. The Kokkos version can run on GPUs and can also use OpenMP multithreading. For more information about the Kokkos package, see :doc:`Packages details ` and :doc:`Speed kokkos ` doc pages. One important -consideration when using the *reax/c/kk* style is the choice of either +consideration when using the *reaxff/kk* style is the choice of either half or full neighbor lists. This setting can be changed using the Kokkos :doc:`package ` command. -The *reax/c* style differs from the (obsolete) "pair_style reax" +The *reaxff* style differs from the (obsolete) "pair_style reax" command in the implementation details. The *reax* style was a Fortran library, linked to LAMMPS. The *reax* style has been removed from LAMMPS after the 12 December 2018 version. @@ -73,7 +74,7 @@ documented in potentials/README.reax. The default ffield.reax contains parameterizations for the following elements: C, H, O, N. The format of these files is identical to that used originally by van -Duin. We have tested the accuracy of *pair_style reax/c* potential +Duin. We have tested the accuracy of *pair_style reaxff* potential against the original ReaxFF code for the systems mentioned above. You can use other ffield files for specific chemical systems that may be available elsewhere (but note that their accuracy may not have been @@ -102,10 +103,11 @@ control variable. The format of the control file is described below. The LAMMPS default values for the ReaxFF global parameters correspond to those used by Adri van Duin's stand-alone serial - code. If these are changed by setting control variables in the control - file, the results from LAMMPS and the serial code will not agree. + code. If these are changed by setting control variables in the + control file, the results from LAMMPS and the serial code will + not agree. -Examples using *pair_style reax/c* are provided in the examples/reax +Examples using *pair_style reaxff* are provided in the examples/reax sub-directory. Use of this pair style requires that a charge be defined for every @@ -115,25 +117,28 @@ charges. The ReaxFF parameter files provided were created using a charge equilibration (QEq) model for handling the electrostatic interactions. -Therefore, by default, LAMMPS requires that the :doc:`fix qeq/reax ` command be used with *pair_style reax/c* -when simulating a ReaxFF model, to equilibrate charge each timestep. -Using the keyword *checkqeq* with the value *no* -turns off the check for *fix qeq/reax*\ , -allowing a simulation to be run without charge equilibration. -In this case, the static charges you -assign to each atom will be used for computing the electrostatic -interactions in the system. -See the :doc:`fix qeq/reax ` command for details. +Therefore, by default, LAMMPS requires that either the +:doc:`fix qeq/reaxff ` or the +:doc:`fix qeq/shielded ` command be used with +*pair_style reaxff* when simulating a ReaxFF model, to equilibrate +the charges each timestep. + +Using the keyword *checkqeq* with the value *no* turns off the check +for the QEq fixes, allowing a simulation to be run without charge +equilibration. In this case, the static charges you assign to each +atom will be used for computing the electrostatic interactions in +the system. See the :doc:`fix qeq/reaxff ` or +:doc:`fix qeq/shielded ` command documentation for more details. Using the optional keyword *lgvdw* with the value *yes* turns on the -low-gradient correction of the ReaxFF/C for long-range London -Dispersion, as described in the :ref:`(Liu) ` paper. Force field -file *ffield.reax.lg* is designed for this correction, and is trained -for several energetic materials (see "Liu"). When using lg-correction, -recommended value for parameter *thb* is 0.01, which can be set in the +low-gradient correction of ReaxFF for long-range London Dispersion, +as described in the :ref:`(Liu) ` paper. The bundled force +field file *ffield.reax.lg* is designed for this correction, and is +trained for several energetic materials (see "Liu"). When using *lgvdw yes*, +the recommended value for parameter *thb* is 0.01, which can be set in the control file. Note: Force field files are different for the original -or lg corrected pair styles, using wrong ffield file generates an -error message. +or lg corrected pair styles, using the wrong ffield file generates an +error. Using the optional keyword *enobonds* with the value *yes*\ , the energy of atoms with no bonds (i.e. isolated atoms) is included in the total @@ -144,7 +149,7 @@ discontinuities in the potential energy when the bonding of an atom drops to zero. Optional keywords *safezone*\ , *mincap*\ , and *minhbonds* are used -for allocating reax/c arrays. Increasing these values can avoid memory +for allocating reaxff arrays. Increasing these values can avoid memory problems, such as segmentation faults and bondchk failed errors, that could occur under certain conditions. These keywords are not used by the Kokkos version, which instead uses a more robust memory allocation @@ -158,7 +163,8 @@ equilibration contributions which are stored in the thermo variable :doc:`thermo ` command. This pair style tallies a breakdown of the total ReaxFF potential -energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 14. +energy into sub-categories, which can be accessed via the +:doc:`compute pair ` command as a vector of values of length 14. The 14 values correspond to the following sub-categories (the variable names in italics match those used in the original FORTRAN ReaxFF code): @@ -183,14 +189,14 @@ headings) the following commands could be included in an input script: .. code-block:: LAMMPS - compute reax all pair reax/c + compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] [...] variable eqeq equal c_reax[14] thermo_style custom step temp epair v_eb v_ea [...] v_eqeq -Only a single pair_coeff command is used with the *reax/c* style which +Only a single pair_coeff command is used with the *reaxff* style which specifies a ReaxFF potential file with parameters for all needed elements. These are mapped to LAMMPS atom types by specifying N additional arguments after the filename in the pair_coeff command, @@ -209,7 +215,7 @@ to M. Each of the N indices you specify for the N atom types of LAMMPS atoms must be an integer from 1 to M. Atoms with LAMMPS type 1 will be mapped to whatever element you specify as the first index value, etc. If a mapping value is specified as NULL, the mapping is not -performed. This can be used when the *reax/c* style is used as part +performed. This can be used when the *reaxff* style is used as part of the *hybrid* pair style. The NULL values are placeholders for atom types that will be used with other potentials. @@ -241,7 +247,7 @@ brief description of their use and default values. *simulation_name* - Output files produced by *pair_style reax/c* carry + Output files produced by *pair_style reaxff* carry this name + extensions specific to their contents. Partial energies are reported with a ".pot" extension, while the trajectory file has ".trj" extension. @@ -286,8 +292,7 @@ brief description of their use and default values. to be considered in three body interactions. (default value = 0.00001) *write_freq* - Frequency of writes into the trajectory file. (default - value = 0) + Frequency of writes into the trajectory file. (default value = 0) *traj_title* Title of the trajectory - not the name of the trajectory file. @@ -315,7 +320,8 @@ Mixing, shift, table, tail correction, restart, rRESPA info This pair style does not support the :doc:`pair_modify ` mix, shift, table, and tail options. -This pair style does not write its information to :doc:`binary restart files `, since it is stored in potential files. Thus, you +This pair style does not write its information to :doc:`binary restart files `, +since it is stored in potential files. Thus, you need to re-specify the pair_style and pair_coeff commands in an input script that reads a restart file. @@ -333,18 +339,20 @@ Restrictions """""""""""" This pair style is part of the REAXFF package. It is only enabled -if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. +if LAMMPS was built with that package. +See the :doc:`Build package ` doc page for more info. The ReaxFF potential files provided with LAMMPS in the potentials -directory are parameterized for real :doc:`units `. You can use -the ReaxFF potential with any LAMMPS units, but you would need to +directory are parameterized for *real* :doc:`units `. You can use +the ReaxFF pair style with any LAMMPS units, but you would need to create your own potential file with coefficients listed in the appropriate units if your simulation does not use "real" units. Related commands """""""""""""""" -:doc:`pair_coeff `, :doc:`fix qeq/reax `, :doc:`fix reax/c/bonds `, :doc:`fix reax/c/species ` +:doc:`pair_coeff `, :doc:`fix qeq/reaxff `, +:doc:`fix reaxff/bonds `, :doc:`fix reaxff/species ` Default """"""" diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index f0497cb931..50f49c87c9 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -299,7 +299,7 @@ accelerated styles exist. * :doc:`python ` - * :doc:`quip ` - * :doc:`rann ` - -* :doc:`reax/c ` - ReaxFF potential in C +* :doc:`reaxff ` - ReaxFF potential * :doc:`rebo ` - second generation REBO potential of Brenner * :doc:`resquared ` - Everaers RE-Squared ellipsoidal potential * :doc:`sdpd/taitwater/isothermal ` - smoothed dissipative particle dynamics for water at isothermal conditions diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index 16a7cf2a5c..6c1fd6dd35 100755 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -254,40 +254,27 @@ for command_type, entries in index.items(): print("Total number of style index entries:", total_index) +skip_fix = ('python', 'NEIGH_HISTORY/omp','qeq/reax','reax/c/bonds','reax/c/species') +skip_pair = ('meam/c','lj/sf','reax/c') + counter = 0 -counter += check_style('Commands_all.rst', doc_dir, ":doc:`(.+) <.+>`", - command,'Command',suffix=False) -counter += check_style('Commands_compute.rst', doc_dir, ":doc:`(.+) `", - compute,'Compute',suffix=True) -counter += check_style('compute.rst', doc_dir, ":doc:`(.+) ` -", - compute,'Compute',suffix=False) -counter += check_style('Commands_fix.rst', doc_dir, ":doc:`(.+) `", - fix,'Fix',skip=('python', 'NEIGH_HISTORY/omp'),suffix=True) -counter += check_style('fix.rst', doc_dir, ":doc:`(.+) ` -", - fix,'Fix',skip=('python', 'NEIGH_HISTORY/omp'),suffix=False) -counter += check_style('Commands_pair.rst', doc_dir, ":doc:`(.+) `", - pair,'Pair',skip=('meam/c','lj/sf'),suffix=True) -counter += check_style('pair_style.rst', doc_dir, ":doc:`(.+) ` -", - pair,'Pair',skip=('meam/c','lj/sf'),suffix=False) -counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `", - bond,'Bond',suffix=True) -counter += check_style('bond_style.rst', doc_dir, ":doc:`(.+) ` -", - bond,'Bond',suffix=False) -counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `", - angle,'Angle',suffix=True) -counter += check_style('angle_style.rst', doc_dir, ":doc:`(.+) ` -", - angle,'Angle',suffix=False) -counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `", - dihedral,'Dihedral',suffix=True) -counter += check_style('dihedral_style.rst', doc_dir, ":doc:`(.+) ` -", - dihedral,'Dihedral',suffix=False) -counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `", - improper,'Improper',suffix=True) -counter += check_style('improper_style.rst', doc_dir, ":doc:`(.+) ` -", - improper,'Improper',suffix=False) -counter += check_style('Commands_kspace.rst', doc_dir, ":doc:`(.+) `", - kspace,'KSpace',suffix=True) +counter += check_style('Commands_all.rst', doc_dir, ":doc:`(.+) <.+>`",command,'Command',suffix=False) +counter += check_style('Commands_compute.rst', doc_dir, ":doc:`(.+) `",compute,'Compute',suffix=True) +counter += check_style('compute.rst', doc_dir, ":doc:`(.+) ` -",compute,'Compute',suffix=False) +counter += check_style('Commands_fix.rst', doc_dir, ":doc:`(.+) `",fix,'Fix',skip=skip_fix,suffix=True) +counter += check_style('fix.rst', doc_dir, ":doc:`(.+) ` -",fix,'Fix',skip=skip_fix,suffix=False) +counter += check_style('Commands_pair.rst', doc_dir, ":doc:`(.+) `",pair,'Pair',skip=skip_pair,suffix=True) +counter += check_style('pair_style.rst', doc_dir, ":doc:`(.+) ` -",pair,'Pair',skip=skip_pair,suffix=False) +counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `",bond,'Bond',suffix=True) +counter += check_style('bond_style.rst', doc_dir, ":doc:`(.+) ` -",bond,'Bond',suffix=False) +counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `",angle,'Angle',suffix=True) +counter += check_style('angle_style.rst', doc_dir, ":doc:`(.+) ` -",angle,'Angle',suffix=False) +counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `",dihedral,'Dihedral',suffix=True) +counter += check_style('dihedral_style.rst', doc_dir, ":doc:`(.+) ` -",dihedral,'Dihedral',suffix=False) +counter += check_style('Commands_bond.rst', doc_dir, ":doc:`(.+) `",improper,'Improper',suffix=True) +counter += check_style('improper_style.rst', doc_dir, ":doc:`(.+) ` -",improper,'Improper',suffix=False) +counter += check_style('Commands_kspace.rst', doc_dir, ":doc:`(.+) `",kspace,'KSpace',suffix=True) if counter: print(f"Found {counter} issue(s) with style lists") @@ -295,13 +282,13 @@ if counter: counter = 0 counter += check_style_index("compute", compute, index["compute"]) -counter += check_style_index("fix", fix, index["fix"], skip=['python']) +counter += check_style_index("fix", fix, index["fix"], skip=['python','qeq/reax','reax/c/bonds','reax/c/species']) counter += check_style_index("angle_style", angle, index["angle_style"]) counter += check_style_index("bond_style", bond, index["bond_style"]) counter += check_style_index("dihedral_style", dihedral, index["dihedral_style"]) counter += check_style_index("improper_style", improper, index["improper_style"]) counter += check_style_index("kspace_style", kspace, index["kspace_style"]) -counter += check_style_index("pair_style", pair, index["pair_style"], skip=['meam/c', 'lj/sf']) +counter += check_style_index("pair_style", pair, index["pair_style"], skip=['meam/c', 'lj/sf','reax/c']) if counter: print(f"Found {counter} issue(s) with style index") diff --git a/examples/README b/examples/README index 4f4f671a29..68825a7dbd 100644 --- a/examples/README +++ b/examples/README @@ -103,7 +103,7 @@ pour: pouring of granular particles into a 3d box, then chute flow prd: parallel replica dynamics of vacancy diffusion in bulk Si python: use of PYTHON package to invoke Python code from input script qeq: use of QEQ package for charge equilibration -reax: RDX and TATB and several other models using ReaxFF +reaxff: RDX and TATB and several other models using ReaxFF rerun: use of rerun and read_dump commands rigid: rigid bodies modeled as independent or coupled shear: sideways shear applied to 2d solid, with and without a void diff --git a/examples/reax/AB/README b/examples/reaxff/AB/README similarity index 100% rename from examples/reax/AB/README rename to examples/reaxff/AB/README diff --git a/examples/reax/AB/data.AB b/examples/reaxff/AB/data.AB similarity index 100% rename from examples/reax/AB/data.AB rename to examples/reaxff/AB/data.AB diff --git a/examples/reax/AB/ffield.reax.AB b/examples/reaxff/AB/ffield.reax.AB similarity index 100% rename from examples/reax/AB/ffield.reax.AB rename to examples/reaxff/AB/ffield.reax.AB diff --git a/examples/reax/AB/in.AB b/examples/reaxff/AB/in.AB similarity index 100% rename from examples/reax/AB/in.AB rename to examples/reaxff/AB/in.AB diff --git a/examples/reax/AB/lmp_control b/examples/reaxff/AB/lmp_control similarity index 100% rename from examples/reax/AB/lmp_control rename to examples/reaxff/AB/lmp_control diff --git a/examples/reax/AB/log.8Mar18.AB.g++.1 b/examples/reaxff/AB/log.8Mar18.AB.g++.1 similarity index 100% rename from examples/reax/AB/log.8Mar18.AB.g++.1 rename to examples/reaxff/AB/log.8Mar18.AB.g++.1 diff --git a/examples/reax/AB/log.8Mar18.AB.g++.4 b/examples/reaxff/AB/log.8Mar18.AB.g++.4 similarity index 100% rename from examples/reax/AB/log.8Mar18.AB.g++.4 rename to examples/reaxff/AB/log.8Mar18.AB.g++.4 diff --git a/examples/reax/AB/param.qeq b/examples/reaxff/AB/param.qeq similarity index 100% rename from examples/reax/AB/param.qeq rename to examples/reaxff/AB/param.qeq diff --git a/examples/reax/AuO/README b/examples/reaxff/AuO/README similarity index 100% rename from examples/reax/AuO/README rename to examples/reaxff/AuO/README diff --git a/examples/reax/AuO/data.AuO b/examples/reaxff/AuO/data.AuO similarity index 100% rename from examples/reax/AuO/data.AuO rename to examples/reaxff/AuO/data.AuO diff --git a/examples/reax/AuO/ffield.reax.AuO b/examples/reaxff/AuO/ffield.reax.AuO similarity index 100% rename from examples/reax/AuO/ffield.reax.AuO rename to examples/reaxff/AuO/ffield.reax.AuO diff --git a/examples/reax/AuO/in.AuO b/examples/reaxff/AuO/in.AuO similarity index 100% rename from examples/reax/AuO/in.AuO rename to examples/reaxff/AuO/in.AuO diff --git a/examples/reax/AuO/lmp_control b/examples/reaxff/AuO/lmp_control similarity index 100% rename from examples/reax/AuO/lmp_control rename to examples/reaxff/AuO/lmp_control diff --git a/examples/reax/AuO/log.8Mar18.AuO.g++.1 b/examples/reaxff/AuO/log.8Mar18.AuO.g++.1 similarity index 100% rename from examples/reax/AuO/log.8Mar18.AuO.g++.1 rename to examples/reaxff/AuO/log.8Mar18.AuO.g++.1 diff --git a/examples/reax/AuO/log.8Mar18.AuO.g++.4 b/examples/reaxff/AuO/log.8Mar18.AuO.g++.4 similarity index 100% rename from examples/reax/AuO/log.8Mar18.AuO.g++.4 rename to examples/reaxff/AuO/log.8Mar18.AuO.g++.4 diff --git a/examples/reax/AuO/param.qeq b/examples/reaxff/AuO/param.qeq similarity index 100% rename from examples/reax/AuO/param.qeq rename to examples/reaxff/AuO/param.qeq diff --git a/examples/reax/CHO/README b/examples/reaxff/CHO/README similarity index 100% rename from examples/reax/CHO/README rename to examples/reaxff/CHO/README diff --git a/examples/reax/CHO/data.CHO b/examples/reaxff/CHO/data.CHO similarity index 100% rename from examples/reax/CHO/data.CHO rename to examples/reaxff/CHO/data.CHO diff --git a/examples/reax/CHO/ffield.reax.cho b/examples/reaxff/CHO/ffield.reax.cho similarity index 100% rename from examples/reax/CHO/ffield.reax.cho rename to examples/reaxff/CHO/ffield.reax.cho diff --git a/examples/reax/CHO/in.CHO b/examples/reaxff/CHO/in.CHO similarity index 100% rename from examples/reax/CHO/in.CHO rename to examples/reaxff/CHO/in.CHO diff --git a/examples/reax/CHO/lmp_control b/examples/reaxff/CHO/lmp_control similarity index 100% rename from examples/reax/CHO/lmp_control rename to examples/reaxff/CHO/lmp_control diff --git a/examples/reax/CHO/log.8Mar18.CHO.g++.1 b/examples/reaxff/CHO/log.8Mar18.CHO.g++.1 similarity index 100% rename from examples/reax/CHO/log.8Mar18.CHO.g++.1 rename to examples/reaxff/CHO/log.8Mar18.CHO.g++.1 diff --git a/examples/reax/CHO/log.8Mar18.CHO.g++.4 b/examples/reaxff/CHO/log.8Mar18.CHO.g++.4 similarity index 100% rename from examples/reax/CHO/log.8Mar18.CHO.g++.4 rename to examples/reaxff/CHO/log.8Mar18.CHO.g++.4 diff --git a/examples/reax/CHO/param.qeq b/examples/reaxff/CHO/param.qeq similarity index 100% rename from examples/reax/CHO/param.qeq rename to examples/reaxff/CHO/param.qeq diff --git a/examples/reax/FC/README b/examples/reaxff/FC/README similarity index 100% rename from examples/reax/FC/README rename to examples/reaxff/FC/README diff --git a/examples/reax/FC/data.FC b/examples/reaxff/FC/data.FC similarity index 100% rename from examples/reax/FC/data.FC rename to examples/reaxff/FC/data.FC diff --git a/examples/reax/FC/ffield.reax.FC b/examples/reaxff/FC/ffield.reax.FC similarity index 100% rename from examples/reax/FC/ffield.reax.FC rename to examples/reaxff/FC/ffield.reax.FC diff --git a/examples/reax/FC/in.FC b/examples/reaxff/FC/in.FC similarity index 100% rename from examples/reax/FC/in.FC rename to examples/reaxff/FC/in.FC diff --git a/examples/reax/FC/log.8Mar18.FC.g++.1 b/examples/reaxff/FC/log.8Mar18.FC.g++.1 similarity index 100% rename from examples/reax/FC/log.8Mar18.FC.g++.1 rename to examples/reaxff/FC/log.8Mar18.FC.g++.1 diff --git a/examples/reax/FC/log.8Mar18.FC.g++.4 b/examples/reaxff/FC/log.8Mar18.FC.g++.4 similarity index 100% rename from examples/reax/FC/log.8Mar18.FC.g++.4 rename to examples/reaxff/FC/log.8Mar18.FC.g++.4 diff --git a/examples/reax/FeOH3/README b/examples/reaxff/FeOH3/README similarity index 100% rename from examples/reax/FeOH3/README rename to examples/reaxff/FeOH3/README diff --git a/examples/reax/FeOH3/data.FeOH3 b/examples/reaxff/FeOH3/data.FeOH3 similarity index 100% rename from examples/reax/FeOH3/data.FeOH3 rename to examples/reaxff/FeOH3/data.FeOH3 diff --git a/examples/reax/FeOH3/ffield.reax.Fe_O_C_H b/examples/reaxff/FeOH3/ffield.reax.Fe_O_C_H similarity index 100% rename from examples/reax/FeOH3/ffield.reax.Fe_O_C_H rename to examples/reaxff/FeOH3/ffield.reax.Fe_O_C_H diff --git a/examples/reax/FeOH3/in.FeOH3 b/examples/reaxff/FeOH3/in.FeOH3 similarity index 100% rename from examples/reax/FeOH3/in.FeOH3 rename to examples/reaxff/FeOH3/in.FeOH3 diff --git a/examples/reax/FeOH3/lmp_control b/examples/reaxff/FeOH3/lmp_control similarity index 100% rename from examples/reax/FeOH3/lmp_control rename to examples/reaxff/FeOH3/lmp_control diff --git a/examples/reax/FeOH3/log.5Oct16.FeOH3.g++.1 b/examples/reaxff/FeOH3/log.5Oct16.FeOH3.g++.1 similarity index 100% rename from examples/reax/FeOH3/log.5Oct16.FeOH3.g++.1 rename to examples/reaxff/FeOH3/log.5Oct16.FeOH3.g++.1 diff --git a/examples/reax/FeOH3/log.5Oct16.FeOH3.g++.4 b/examples/reaxff/FeOH3/log.5Oct16.FeOH3.g++.4 similarity index 100% rename from examples/reax/FeOH3/log.5Oct16.FeOH3.g++.4 rename to examples/reaxff/FeOH3/log.5Oct16.FeOH3.g++.4 diff --git a/examples/reax/FeOH3/param.qeq b/examples/reaxff/FeOH3/param.qeq similarity index 100% rename from examples/reax/FeOH3/param.qeq rename to examples/reaxff/FeOH3/param.qeq diff --git a/examples/reax/HNS/README.txt b/examples/reaxff/HNS/README.txt similarity index 100% rename from examples/reax/HNS/README.txt rename to examples/reaxff/HNS/README.txt diff --git a/examples/reax/HNS/data.hns-equil b/examples/reaxff/HNS/data.hns-equil similarity index 100% rename from examples/reax/HNS/data.hns-equil rename to examples/reaxff/HNS/data.hns-equil diff --git a/examples/reax/HNS/ffield.reax.hns b/examples/reaxff/HNS/ffield.reax.hns similarity index 100% rename from examples/reax/HNS/ffield.reax.hns rename to examples/reaxff/HNS/ffield.reax.hns diff --git a/examples/reax/HNS/in.reaxc.hns b/examples/reaxff/HNS/in.reaxc.hns similarity index 100% rename from examples/reax/HNS/in.reaxc.hns rename to examples/reaxff/HNS/in.reaxc.hns diff --git a/examples/reax/HNS/log.8Mar18.reaxc.hns.g++.1 b/examples/reaxff/HNS/log.8Mar18.reaxc.hns.g++.1 similarity index 100% rename from examples/reax/HNS/log.8Mar18.reaxc.hns.g++.1 rename to examples/reaxff/HNS/log.8Mar18.reaxc.hns.g++.1 diff --git a/examples/reax/HNS/log.8Mar18.reaxc.hns.g++.4 b/examples/reaxff/HNS/log.8Mar18.reaxc.hns.g++.4 similarity index 100% rename from examples/reax/HNS/log.8Mar18.reaxc.hns.g++.4 rename to examples/reaxff/HNS/log.8Mar18.reaxc.hns.g++.4 diff --git a/examples/reax/RDX/README b/examples/reaxff/RDX/README similarity index 100% rename from examples/reax/RDX/README rename to examples/reaxff/RDX/README diff --git a/examples/reax/RDX/data.RDX b/examples/reaxff/RDX/data.RDX similarity index 100% rename from examples/reax/RDX/data.RDX rename to examples/reaxff/RDX/data.RDX diff --git a/examples/reax/RDX/ffield.reax.rdx b/examples/reaxff/RDX/ffield.reax.rdx similarity index 100% rename from examples/reax/RDX/ffield.reax.rdx rename to examples/reaxff/RDX/ffield.reax.rdx diff --git a/examples/reax/RDX/in.RDX b/examples/reaxff/RDX/in.RDX similarity index 100% rename from examples/reax/RDX/in.RDX rename to examples/reaxff/RDX/in.RDX diff --git a/examples/reax/RDX/lmp_control b/examples/reaxff/RDX/lmp_control similarity index 100% rename from examples/reax/RDX/lmp_control rename to examples/reaxff/RDX/lmp_control diff --git a/examples/reax/RDX/log.8Mar18.RDX.g++.1 b/examples/reaxff/RDX/log.8Mar18.RDX.g++.1 similarity index 100% rename from examples/reax/RDX/log.8Mar18.RDX.g++.1 rename to examples/reaxff/RDX/log.8Mar18.RDX.g++.1 diff --git a/examples/reax/RDX/log.8Mar18.RDX.g++.4 b/examples/reaxff/RDX/log.8Mar18.RDX.g++.4 similarity index 100% rename from examples/reax/RDX/log.8Mar18.RDX.g++.4 rename to examples/reaxff/RDX/log.8Mar18.RDX.g++.4 diff --git a/examples/reax/RDX/param.qeq b/examples/reaxff/RDX/param.qeq similarity index 100% rename from examples/reax/RDX/param.qeq rename to examples/reaxff/RDX/param.qeq diff --git a/examples/reax/README b/examples/reaxff/README similarity index 100% rename from examples/reax/README rename to examples/reaxff/README diff --git a/examples/reax/VOH/README b/examples/reaxff/VOH/README similarity index 100% rename from examples/reax/VOH/README rename to examples/reaxff/VOH/README diff --git a/examples/reax/VOH/data.VOH b/examples/reaxff/VOH/data.VOH similarity index 100% rename from examples/reax/VOH/data.VOH rename to examples/reaxff/VOH/data.VOH diff --git a/examples/reax/VOH/ffield.reax.V_O_C_H b/examples/reaxff/VOH/ffield.reax.V_O_C_H similarity index 100% rename from examples/reax/VOH/ffield.reax.V_O_C_H rename to examples/reaxff/VOH/ffield.reax.V_O_C_H diff --git a/examples/reax/VOH/in.VOH b/examples/reaxff/VOH/in.VOH similarity index 100% rename from examples/reax/VOH/in.VOH rename to examples/reaxff/VOH/in.VOH diff --git a/examples/reax/VOH/lmp_control b/examples/reaxff/VOH/lmp_control similarity index 100% rename from examples/reax/VOH/lmp_control rename to examples/reaxff/VOH/lmp_control diff --git a/examples/reax/VOH/log.8Mar18.VOH.g++.1 b/examples/reaxff/VOH/log.8Mar18.VOH.g++.1 similarity index 100% rename from examples/reax/VOH/log.8Mar18.VOH.g++.1 rename to examples/reaxff/VOH/log.8Mar18.VOH.g++.1 diff --git a/examples/reax/VOH/log.8Mar18.VOH.g++.4 b/examples/reaxff/VOH/log.8Mar18.VOH.g++.4 similarity index 100% rename from examples/reax/VOH/log.8Mar18.VOH.g++.4 rename to examples/reaxff/VOH/log.8Mar18.VOH.g++.4 diff --git a/examples/reax/VOH/param.qeq b/examples/reaxff/VOH/param.qeq similarity index 100% rename from examples/reax/VOH/param.qeq rename to examples/reaxff/VOH/param.qeq diff --git a/examples/reax/ZnOH2/README b/examples/reaxff/ZnOH2/README similarity index 100% rename from examples/reax/ZnOH2/README rename to examples/reaxff/ZnOH2/README diff --git a/examples/reax/ZnOH2/data.ZnOH2 b/examples/reaxff/ZnOH2/data.ZnOH2 similarity index 100% rename from examples/reax/ZnOH2/data.ZnOH2 rename to examples/reaxff/ZnOH2/data.ZnOH2 diff --git a/examples/reax/ZnOH2/ffield.reax.ZnOH b/examples/reaxff/ZnOH2/ffield.reax.ZnOH similarity index 100% rename from examples/reax/ZnOH2/ffield.reax.ZnOH rename to examples/reaxff/ZnOH2/ffield.reax.ZnOH diff --git a/examples/reax/ZnOH2/in.ZnOH2 b/examples/reaxff/ZnOH2/in.ZnOH2 similarity index 100% rename from examples/reax/ZnOH2/in.ZnOH2 rename to examples/reaxff/ZnOH2/in.ZnOH2 diff --git a/examples/reax/ZnOH2/lmp_control b/examples/reaxff/ZnOH2/lmp_control similarity index 100% rename from examples/reax/ZnOH2/lmp_control rename to examples/reaxff/ZnOH2/lmp_control diff --git a/examples/reax/ZnOH2/log.8Mar18.ZnOH2.g++.1 b/examples/reaxff/ZnOH2/log.8Mar18.ZnOH2.g++.1 similarity index 100% rename from examples/reax/ZnOH2/log.8Mar18.ZnOH2.g++.1 rename to examples/reaxff/ZnOH2/log.8Mar18.ZnOH2.g++.1 diff --git a/examples/reax/ZnOH2/log.8Mar18.ZnOH2.g++.4 b/examples/reaxff/ZnOH2/log.8Mar18.ZnOH2.g++.4 similarity index 100% rename from examples/reax/ZnOH2/log.8Mar18.ZnOH2.g++.4 rename to examples/reaxff/ZnOH2/log.8Mar18.ZnOH2.g++.4 diff --git a/examples/reax/ZnOH2/param.qeq b/examples/reaxff/ZnOH2/param.qeq similarity index 100% rename from examples/reax/ZnOH2/param.qeq rename to examples/reaxff/ZnOH2/param.qeq diff --git a/examples/reax/ci-reaxFF/CH4.dat b/examples/reaxff/ci-reaxFF/CH4.dat similarity index 100% rename from examples/reax/ci-reaxFF/CH4.dat rename to examples/reaxff/ci-reaxFF/CH4.dat diff --git a/examples/reax/ci-reaxFF/ci-reaxFF_ZBL.dat b/examples/reaxff/ci-reaxFF/ci-reaxFF_ZBL.dat similarity index 100% rename from examples/reax/ci-reaxFF/ci-reaxFF_ZBL.dat rename to examples/reaxff/ci-reaxFF/ci-reaxFF_ZBL.dat diff --git a/examples/reax/ci-reaxFF/control b/examples/reaxff/ci-reaxFF/control similarity index 100% rename from examples/reax/ci-reaxFF/control rename to examples/reaxff/ci-reaxFF/control diff --git a/examples/reax/ci-reaxFF/ffield.ci-reax.CH b/examples/reaxff/ci-reaxFF/ffield.ci-reax.CH similarity index 100% rename from examples/reax/ci-reaxFF/ffield.ci-reax.CH rename to examples/reaxff/ci-reaxFF/ffield.ci-reax.CH diff --git a/examples/reax/ci-reaxFF/in.ci-reax.CH b/examples/reaxff/ci-reaxFF/in.ci-reax.CH similarity index 100% rename from examples/reax/ci-reaxFF/in.ci-reax.CH rename to examples/reaxff/ci-reaxFF/in.ci-reax.CH diff --git a/examples/reax/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 b/examples/reaxff/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 similarity index 100% rename from examples/reax/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 rename to examples/reaxff/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.1 diff --git a/examples/reax/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 b/examples/reaxff/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 similarity index 100% rename from examples/reax/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 rename to examples/reaxff/ci-reaxFF/log.8Mar18.ci-reax.CH.g++.4 diff --git a/examples/reax/control.reax_c.rdx b/examples/reaxff/control.reax_c.rdx similarity index 100% rename from examples/reax/control.reax_c.rdx rename to examples/reaxff/control.reax_c.rdx diff --git a/examples/reax/control.reax_c.tatb b/examples/reaxff/control.reax_c.tatb similarity index 100% rename from examples/reax/control.reax_c.tatb rename to examples/reaxff/control.reax_c.tatb diff --git a/examples/reax/data.rdx b/examples/reaxff/data.rdx similarity index 100% rename from examples/reax/data.rdx rename to examples/reaxff/data.rdx diff --git a/examples/reax/data.tatb b/examples/reaxff/data.tatb similarity index 100% rename from examples/reax/data.tatb rename to examples/reaxff/data.tatb diff --git a/examples/reax/ffield.reax b/examples/reaxff/ffield.reax similarity index 100% rename from examples/reax/ffield.reax rename to examples/reaxff/ffield.reax diff --git a/examples/reax/in.reaxc.rdx b/examples/reaxff/in.reaxc.rdx similarity index 100% rename from examples/reax/in.reaxc.rdx rename to examples/reaxff/in.reaxc.rdx diff --git a/examples/reax/in.reaxc.rdx-shielded b/examples/reaxff/in.reaxc.rdx-shielded similarity index 100% rename from examples/reax/in.reaxc.rdx-shielded rename to examples/reaxff/in.reaxc.rdx-shielded diff --git a/examples/reax/in.reaxc.tatb b/examples/reaxff/in.reaxc.tatb similarity index 100% rename from examples/reax/in.reaxc.tatb rename to examples/reaxff/in.reaxc.tatb diff --git a/examples/reax/in.reaxc.tatb-shielded b/examples/reaxff/in.reaxc.tatb-shielded similarity index 100% rename from examples/reax/in.reaxc.tatb-shielded rename to examples/reaxff/in.reaxc.tatb-shielded diff --git a/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 b/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.1 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.1 rename to examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.1 diff --git a/examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 b/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.rdx-shielded.g++.4 rename to examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 diff --git a/examples/reax/log.21Apr21.reaxc.rdx.g++.1 b/examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.rdx.g++.1 rename to examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 diff --git a/examples/reax/log.21Apr21.reaxc.rdx.g++.4 b/examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.rdx.g++.4 rename to examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 diff --git a/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 b/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.1 rename to examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 diff --git a/examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 b/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.tatb-shielded.g++.4 rename to examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 diff --git a/examples/reax/log.21Apr21.reaxc.tatb.g++.1 b/examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.tatb.g++.1 rename to examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 diff --git a/examples/reax/log.21Apr21.reaxc.tatb.g++.4 b/examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 similarity index 100% rename from examples/reax/log.21Apr21.reaxc.tatb.g++.4 rename to examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp similarity index 87% rename from src/KOKKOS/fix_qeq_reax_kokkos.cpp rename to src/KOKKOS/fix_qeq_reaxff_kokkos.cpp index f389808cf3..77bd013ad4 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp @@ -17,7 +17,7 @@ Kamesh Arumugam (NVIDIA) ------------------------------------------------------------------------- */ -#include "fix_qeq_reax_kokkos.h" +#include "fix_qeq_reaxff_kokkos.h" #include "atom.h" #include "atom_kokkos.h" @@ -43,9 +43,9 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ template -FixQEqReaxKokkos:: -FixQEqReaxKokkos(LAMMPS *lmp, int narg, char **arg) : - FixQEqReax(lmp, narg, arg) +FixQEqReaxFFKokkos:: +FixQEqReaxFFKokkos(LAMMPS *lmp, int narg, char **arg) : + FixQEqReaxFF(lmp, narg, arg) { kokkosable = 1; forward_comm_device = 1; @@ -69,7 +69,7 @@ FixQEqReaxKokkos(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ template -FixQEqReaxKokkos::~FixQEqReaxKokkos() +FixQEqReaxFFKokkos::~FixQEqReaxFFKokkos() { if (copymode) return; @@ -80,11 +80,11 @@ FixQEqReaxKokkos::~FixQEqReaxKokkos() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::init() +void FixQEqReaxFFKokkos::init() { atomKK->sync(execution_space,Q_MASK); - FixQEqReax::init(); + FixQEqReaxFF::init(); neighflag = lmp->kokkos->neighflag_qeq; int irequest = neighbor->nrequest - 1; @@ -110,7 +110,7 @@ void FixQEqReaxKokkos::init() int ntypes = atom->ntypes; k_params = Kokkos::DualView - ("FixQEqReax::params",ntypes+1); + ("FixQEqReaxFF::params",ntypes+1); params = k_params.template view(); for (int n = 1; n <= ntypes; n++) { @@ -131,7 +131,7 @@ void FixQEqReaxKokkos::init() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::init_shielding_k() +void FixQEqReaxFFKokkos::init_shielding_k() { int i,j; int ntypes = atom->ntypes; @@ -159,7 +159,7 @@ void FixQEqReaxKokkos::init_shielding_k() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::init_hist() +void FixQEqReaxFFKokkos::init_hist() { k_s_hist.clear_sync_state(); k_t_hist.clear_sync_state(); @@ -174,7 +174,7 @@ void FixQEqReaxKokkos::init_hist() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::setup_pre_force(int vflag) +void FixQEqReaxFFKokkos::setup_pre_force(int vflag) { //neighbor->build_one(list); @@ -184,7 +184,7 @@ void FixQEqReaxKokkos::setup_pre_force(int vflag) /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::pre_force(int /*vflag*/) +void FixQEqReaxFFKokkos::pre_force(int /*vflag*/) { if (update->ntimestep % nevery) return; @@ -228,10 +228,10 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) if (execution_space == Host) { // CPU if (neighflag == FULL) { - FixQEqReaxKokkosComputeHFunctor computeH_functor(this); + FixQEqReaxFFKokkosComputeHFunctor computeH_functor(this); Kokkos::parallel_scan(inum,computeH_functor); } else { // HALF and HALFTHREAD are the same - FixQEqReaxKokkosComputeHFunctor computeH_functor(this); + FixQEqReaxFFKokkosComputeHFunctor computeH_functor(this); Kokkos::parallel_scan(inum,computeH_functor); } } else { // GPU, use teams @@ -244,11 +244,11 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) Kokkos::TeamPolicy policy(num_teams, atoms_per_team, vector_length); if (neighflag == FULL) { - FixQEqReaxKokkosComputeHFunctor computeH_functor( + FixQEqReaxFFKokkosComputeHFunctor computeH_functor( this, atoms_per_team, vector_length); Kokkos::parallel_for(policy, computeH_functor); } else { // HALF and HALFTHREAD are the same - FixQEqReaxKokkosComputeHFunctor computeH_functor( + FixQEqReaxFFKokkosComputeHFunctor computeH_functor( this, atoms_per_team, vector_length); Kokkos::parallel_for(policy, computeH_functor); } @@ -258,7 +258,7 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) k_s_hist.template sync(); k_t_hist.template sync(); - FixQEqReaxKokkosMatVecFunctor matvec_functor(this); + FixQEqReaxFFKokkosMatVecFunctor matvec_functor(this); Kokkos::parallel_for(inum,matvec_functor); // comm->forward_comm_fix(this); //Dist_vector(s); @@ -313,7 +313,7 @@ void FixQEqReaxKokkos::pre_force(int /*vflag*/) template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::num_neigh_item(int ii, int &maxneigh) const +void FixQEqReaxFFKokkos::num_neigh_item(int ii, int &maxneigh) const { const int i = d_ilist[ii]; maxneigh += d_numneigh[i]; @@ -322,7 +322,7 @@ void FixQEqReaxKokkos::num_neigh_item(int ii, int &maxneigh) const /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::allocate_matrix() +void FixQEqReaxFFKokkos::allocate_matrix() { const int inum = list->inum; @@ -331,7 +331,7 @@ void FixQEqReaxKokkos::allocate_matrix() // determine the total space for the H matrix m_cap = 0; - FixQEqReaxKokkosNumNeighFunctor neigh_functor(this); + FixQEqReaxFFKokkosNumNeighFunctor neigh_functor(this); Kokkos::parallel_reduce(inum,neigh_functor,m_cap); d_firstnbr = typename AT::t_int_1d("qeq/kk:firstnbr",nmax); @@ -343,7 +343,7 @@ void FixQEqReaxKokkos::allocate_matrix() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::allocate_array() +void FixQEqReaxFFKokkos::allocate_array() { if (atom->nmax > nmax) { nmax = atom->nmax; @@ -377,7 +377,7 @@ void FixQEqReaxKokkos::allocate_array() // init_storage - FixQEqReaxKokkosZeroFunctor zero_functor(this); + FixQEqReaxFFKokkosZeroFunctor zero_functor(this); Kokkos::parallel_for(ignum,zero_functor); } @@ -385,7 +385,7 @@ void FixQEqReaxKokkos::allocate_array() template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::zero_item(int ii) const +void FixQEqReaxFFKokkos::zero_item(int ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -409,7 +409,7 @@ void FixQEqReaxKokkos::zero_item(int ii) const template template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::compute_h_item(int ii, int &m_fill, const bool &final) const +void FixQEqReaxFFKokkos::compute_h_item(int ii, int &m_fill, const bool &final) const { const int i = d_ilist[ii]; int j,jj,jtype; @@ -477,7 +477,7 @@ void FixQEqReaxKokkos::compute_h_item(int ii, int &m_fill, const boo template template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::compute_h_team( +void FixQEqReaxFFKokkos::compute_h_team( const typename Kokkos::TeamPolicy::member_type &team, int atoms_per_team, int vector_length) const { @@ -682,7 +682,7 @@ void FixQEqReaxKokkos::compute_h_team( template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::calculate_H_k(const F_FLOAT &r, const F_FLOAT &shld) const +double FixQEqReaxFFKokkos::calculate_H_k(const F_FLOAT &r, const F_FLOAT &shld) const { F_FLOAT taper, denom; @@ -704,7 +704,7 @@ double FixQEqReaxKokkos::calculate_H_k(const F_FLOAT &r, const F_FLO template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::matvec_item(int ii) const +void FixQEqReaxFFKokkos::matvec_item(int ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -722,7 +722,7 @@ void FixQEqReaxKokkos::matvec_item(int ii) const /* ---------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::cg_solve1() +int FixQEqReaxFFKokkos::cg_solve1() // b = b_s, x = s; { const int inum = list->inum; @@ -733,15 +733,15 @@ int FixQEqReaxKokkos::cg_solve1() else teamsize = 128; // sparse_matvec(&H, x, q); - FixQEqReaxKokkosSparse12Functor sparse12_functor(this); + FixQEqReaxFFKokkosSparse12Functor sparse12_functor(this); Kokkos::parallel_for(inum,sparse12_functor); if (neighflag != FULL) { Kokkos::parallel_for(Kokkos::RangePolicy(inum,ignum),*this); if (neighflag == HALF) { - FixQEqReaxKokkosSparse13Functor sparse13_functor(this); + FixQEqReaxFFKokkosSparse13Functor sparse13_functor(this); Kokkos::parallel_for(inum,sparse13_functor); } else if (neighflag == HALFTHREAD) { - FixQEqReaxKokkosSparse13Functor sparse13_functor(this); + FixQEqReaxFFKokkosSparse13Functor sparse13_functor(this); Kokkos::parallel_for(inum,sparse13_functor); } if (need_dup) @@ -760,7 +760,7 @@ int FixQEqReaxKokkos::cg_solve1() // preconditioning: d[j] = r[j] * Hdia_inv[j]; // b_norm = parallel_norm(b, nn); F_FLOAT my_norm = 0.0; - FixQEqReaxKokkosNorm1Functor norm1_functor(this); + FixQEqReaxFFKokkosNorm1Functor norm1_functor(this); Kokkos::parallel_reduce(inum,norm1_functor,my_norm); F_FLOAT norm_sqr = 0.0; MPI_Allreduce(&my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); @@ -768,7 +768,7 @@ int FixQEqReaxKokkos::cg_solve1() // sig_new = parallel_dot(r, d, nn); F_FLOAT my_dot = 0.0; - FixQEqReaxKokkosDot1Functor dot1_functor(this); + FixQEqReaxFFKokkosDot1Functor dot1_functor(this); Kokkos::parallel_reduce(inum,dot1_functor,my_dot); F_FLOAT dot_sqr = 0.0; MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); @@ -784,17 +784,17 @@ int FixQEqReaxKokkos::cg_solve1() k_d.template sync(); // sparse_matvec(&H, d, q); - FixQEqReaxKokkosSparse22Functor sparse22_functor(this); + FixQEqReaxFFKokkosSparse22Functor sparse22_functor(this); Kokkos::parallel_for(inum,sparse22_functor); if (neighflag != FULL) { Kokkos::parallel_for(Kokkos::RangePolicy(inum,ignum),*this); if (need_dup) dup_o.reset_except(d_o); if (neighflag == HALF) { - FixQEqReaxKokkosSparse23Functor sparse23_functor(this); + FixQEqReaxFFKokkosSparse23Functor sparse23_functor(this); Kokkos::parallel_for(inum,sparse23_functor); } else if (neighflag == HALFTHREAD) { - FixQEqReaxKokkosSparse23Functor sparse23_functor(this); + FixQEqReaxFFKokkosSparse23Functor sparse23_functor(this); Kokkos::parallel_for(inum,sparse23_functor); } if (need_dup) @@ -811,7 +811,7 @@ int FixQEqReaxKokkos::cg_solve1() // tmp = parallel_dot(d, q, nn); my_dot = dot_sqr = 0.0; - FixQEqReaxKokkosDot2Functor dot2_functor(this); + FixQEqReaxFFKokkosDot2Functor dot2_functor(this); Kokkos::parallel_reduce(inum,dot2_functor,my_dot); MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); tmp = dot_sqr; @@ -823,11 +823,11 @@ int FixQEqReaxKokkos::cg_solve1() // vector_add(s, alpha, d, nn); // vector_add(r, -alpha, q, nn); my_dot = dot_sqr = 0.0; - FixQEqReaxKokkosPrecon1Functor precon1_functor(this); + FixQEqReaxFFKokkosPrecon1Functor precon1_functor(this); Kokkos::parallel_for(inum,precon1_functor); // preconditioning: p[j] = r[j] * Hdia_inv[j]; // sig_new = parallel_dot(r, p, nn); - FixQEqReaxKokkosPreconFunctor precon_functor(this); + FixQEqReaxFFKokkosPreconFunctor precon_functor(this); Kokkos::parallel_reduce(inum,precon_functor,my_dot); MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); sig_new = dot_sqr; @@ -835,12 +835,12 @@ int FixQEqReaxKokkos::cg_solve1() beta = sig_new / sig_old; // vector_sum(d, 1., p, beta, d, nn); - FixQEqReaxKokkosVecSum2Functor vecsum2_functor(this); + FixQEqReaxFFKokkosVecSum2Functor vecsum2_functor(this); Kokkos::parallel_for(inum,vecsum2_functor); } if ((loop >= imax) && maxwarn && (comm->me == 0)) - error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve1 convergence " + error->warning(FLERR,fmt::format("Fix qeq/reaxff/kk cg_solve1 convergence " "failed after {} iterations at step {}: " "{}", loop, update->ntimestep, sqrt(sig_new)/b_norm)); @@ -850,7 +850,7 @@ int FixQEqReaxKokkos::cg_solve1() /* ---------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::cg_solve2() +int FixQEqReaxFFKokkos::cg_solve2() // b = b_t, x = t; { const int inum = list->inum; @@ -861,17 +861,17 @@ int FixQEqReaxKokkos::cg_solve2() else teamsize = 128; // sparse_matvec(&H, x, q); - FixQEqReaxKokkosSparse32Functor sparse32_functor(this); + FixQEqReaxFFKokkosSparse32Functor sparse32_functor(this); Kokkos::parallel_for(inum,sparse32_functor); if (neighflag != FULL) { Kokkos::parallel_for(Kokkos::RangePolicy(inum,ignum),*this); if (need_dup) dup_o.reset_except(d_o); if (neighflag == HALF) { - FixQEqReaxKokkosSparse33Functor sparse33_functor(this); + FixQEqReaxFFKokkosSparse33Functor sparse33_functor(this); Kokkos::parallel_for(inum,sparse33_functor); } else if (neighflag == HALFTHREAD) { - FixQEqReaxKokkosSparse33Functor sparse33_functor(this); + FixQEqReaxFFKokkosSparse33Functor sparse33_functor(this); Kokkos::parallel_for(inum,sparse33_functor); } if (need_dup) @@ -890,7 +890,7 @@ int FixQEqReaxKokkos::cg_solve2() // preconditioning: d[j] = r[j] * Hdia_inv[j]; // b_norm = parallel_norm(b, nn); F_FLOAT my_norm = 0.0; - FixQEqReaxKokkosNorm2Functor norm2_functor(this); + FixQEqReaxFFKokkosNorm2Functor norm2_functor(this); Kokkos::parallel_reduce(inum,norm2_functor,my_norm); F_FLOAT norm_sqr = 0.0; MPI_Allreduce(&my_norm, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world); @@ -898,7 +898,7 @@ int FixQEqReaxKokkos::cg_solve2() // sig_new = parallel_dot(r, d, nn); F_FLOAT my_dot = 0.0; - FixQEqReaxKokkosDot1Functor dot1_functor(this); + FixQEqReaxFFKokkosDot1Functor dot1_functor(this); Kokkos::parallel_reduce(inum,dot1_functor,my_dot); F_FLOAT dot_sqr = 0.0; MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); @@ -914,17 +914,17 @@ int FixQEqReaxKokkos::cg_solve2() k_d.template sync(); // sparse_matvec(&H, d, q); - FixQEqReaxKokkosSparse22Functor sparse22_functor(this); + FixQEqReaxFFKokkosSparse22Functor sparse22_functor(this); Kokkos::parallel_for(inum,sparse22_functor); if (neighflag != FULL) { Kokkos::parallel_for(Kokkos::RangePolicy(inum,ignum),*this); if (need_dup) dup_o.reset_except(d_o); if (neighflag == HALF) { - FixQEqReaxKokkosSparse23Functor sparse23_functor(this); + FixQEqReaxFFKokkosSparse23Functor sparse23_functor(this); Kokkos::parallel_for(inum,sparse23_functor); } else if (neighflag == HALFTHREAD) { - FixQEqReaxKokkosSparse23Functor sparse23_functor(this); + FixQEqReaxFFKokkosSparse23Functor sparse23_functor(this); Kokkos::parallel_for(inum,sparse23_functor); } if (need_dup) @@ -941,7 +941,7 @@ int FixQEqReaxKokkos::cg_solve2() // tmp = parallel_dot(d, q, nn); my_dot = dot_sqr = 0.0; - FixQEqReaxKokkosDot2Functor dot2_functor(this); + FixQEqReaxFFKokkosDot2Functor dot2_functor(this); Kokkos::parallel_reduce(inum,dot2_functor,my_dot); MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); tmp = dot_sqr; @@ -953,11 +953,11 @@ int FixQEqReaxKokkos::cg_solve2() // vector_add(t, alpha, d, nn); // vector_add(r, -alpha, q, nn); my_dot = dot_sqr = 0.0; - FixQEqReaxKokkosPrecon2Functor precon2_functor(this); + FixQEqReaxFFKokkosPrecon2Functor precon2_functor(this); Kokkos::parallel_for(inum,precon2_functor); // preconditioning: p[j] = r[j] * Hdia_inv[j]; // sig_new = parallel_dot(r, p, nn); - FixQEqReaxKokkosPreconFunctor precon_functor(this); + FixQEqReaxFFKokkosPreconFunctor precon_functor(this); Kokkos::parallel_reduce(inum,precon_functor,my_dot); MPI_Allreduce(&my_dot, &dot_sqr, 1, MPI_DOUBLE, MPI_SUM, world); sig_new = dot_sqr; @@ -965,12 +965,12 @@ int FixQEqReaxKokkos::cg_solve2() beta = sig_new / sig_old; // vector_sum(d, 1., p, beta, d, nn); - FixQEqReaxKokkosVecSum2Functor vecsum2_functor(this); + FixQEqReaxFFKokkosVecSum2Functor vecsum2_functor(this); Kokkos::parallel_for(inum,vecsum2_functor); } if ((loop >= imax) && maxwarn && (comm->me == 0)) - error->warning(FLERR,fmt::format("Fix qeq/reax/kk cg_solve2 convergence " + error->warning(FLERR,fmt::format("Fix qeq/reaxff/kk cg_solve2 convergence " "failed after {} iterations at step {}: " "{}", loop, update->ntimestep, sqrt(sig_new)/b_norm)); @@ -980,21 +980,21 @@ int FixQEqReaxKokkos::cg_solve2() /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::calculate_q() +void FixQEqReaxFFKokkos::calculate_q() { F_FLOAT sum, sum_all; const int inum = list->inum; // s_sum = parallel_vector_acc(s, nn); sum = sum_all = 0.0; - FixQEqReaxKokkosVecAcc1Functor vecacc1_functor(this); + FixQEqReaxFFKokkosVecAcc1Functor vecacc1_functor(this); Kokkos::parallel_reduce(inum,vecacc1_functor,sum); MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world); const F_FLOAT s_sum = sum_all; // t_sum = parallel_vector_acc(t, nn); sum = sum_all = 0.0; - FixQEqReaxKokkosVecAcc2Functor vecacc2_functor(this); + FixQEqReaxFFKokkosVecAcc2Functor vecacc2_functor(this); Kokkos::parallel_reduce(inum,vecacc2_functor,sum); MPI_Allreduce(&sum, &sum_all, 1, MPI_DOUBLE, MPI_SUM, world); const F_FLOAT t_sum = sum_all; @@ -1003,7 +1003,7 @@ void FixQEqReaxKokkos::calculate_q() delta = s_sum/t_sum; // q[i] = s[i] - u * t[i]; - FixQEqReaxKokkosCalculateQFunctor calculateQ_functor(this); + FixQEqReaxFFKokkosCalculateQFunctor calculateQ_functor(this); Kokkos::parallel_for(inum,calculateQ_functor); atomKK->modified(execution_space,Q_MASK); @@ -1016,7 +1016,7 @@ void FixQEqReaxKokkos::calculate_q() template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse12_item(int ii) const +void FixQEqReaxFFKokkos::sparse12_item(int ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1030,7 +1030,7 @@ void FixQEqReaxKokkos::sparse12_item(int ii) const template template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse13_item(int ii) const +void FixQEqReaxFFKokkos::sparse13_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); @@ -1052,7 +1052,7 @@ void FixQEqReaxKokkos::sparse13_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator() (TagSparseMatvec1, const membertype1 &team) const +void FixQEqReaxFFKokkos::operator() (TagSparseMatvec1, const membertype1 &team) const { const int i = d_ilist[team.league_rank()]; if (mask[i] & groupbit) { @@ -1069,7 +1069,7 @@ void FixQEqReaxKokkos::operator() (TagSparseMatvec1, const membertyp template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse22_item(int ii) const +void FixQEqReaxFFKokkos::sparse22_item(int ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1083,7 +1083,7 @@ void FixQEqReaxKokkos::sparse22_item(int ii) const template template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse23_item(int ii) const +void FixQEqReaxFFKokkos::sparse23_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); @@ -1105,7 +1105,7 @@ void FixQEqReaxKokkos::sparse23_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator() (TagSparseMatvec2, const membertype2 &team) const +void FixQEqReaxFFKokkos::operator() (TagSparseMatvec2, const membertype2 &team) const { const int i = d_ilist[team.league_rank()]; if (mask[i] & groupbit) { @@ -1120,7 +1120,7 @@ void FixQEqReaxKokkos::operator() (TagSparseMatvec2, const membertyp template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator() (TagZeroQGhosts, const int &i) const +void FixQEqReaxFFKokkos::operator() (TagZeroQGhosts, const int &i) const { if (mask[i] & groupbit) d_o[i] = 0.0; @@ -1130,7 +1130,7 @@ void FixQEqReaxKokkos::operator() (TagZeroQGhosts, const int &i) con template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse32_item(int ii) const +void FixQEqReaxFFKokkos::sparse32_item(int ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1143,7 +1143,7 @@ void FixQEqReaxKokkos::sparse32_item(int ii) const template template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::sparse33_item(int ii) const +void FixQEqReaxFFKokkos::sparse33_item(int ii) const { // The q array is duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_o = ScatterViewHelper::value,decltype(dup_o),decltype(ndup_o)>::get(dup_o,ndup_o); @@ -1165,7 +1165,7 @@ void FixQEqReaxKokkos::sparse33_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator() (TagSparseMatvec3, const membertype3 &team) const +void FixQEqReaxFFKokkos::operator() (TagSparseMatvec3, const membertype3 &team) const { const int i = d_ilist[team.league_rank()]; if (mask[i] & groupbit) { @@ -1182,7 +1182,7 @@ void FixQEqReaxKokkos::operator() (TagSparseMatvec3, const membertyp template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::vecsum2_item(int ii) const +void FixQEqReaxFFKokkos::vecsum2_item(int ii) const { const int i = d_ilist[ii]; if (mask[i] & groupbit) @@ -1193,7 +1193,7 @@ void FixQEqReaxKokkos::vecsum2_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::norm1_item(int ii) const +double FixQEqReaxFFKokkos::norm1_item(int ii) const { F_FLOAT tmp = 0; const int i = d_ilist[ii]; @@ -1209,7 +1209,7 @@ double FixQEqReaxKokkos::norm1_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::norm2_item(int ii) const +double FixQEqReaxFFKokkos::norm2_item(int ii) const { F_FLOAT tmp = 0; const int i = d_ilist[ii]; @@ -1225,7 +1225,7 @@ double FixQEqReaxKokkos::norm2_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::dot1_item(int ii) const +double FixQEqReaxFFKokkos::dot1_item(int ii) const { F_FLOAT tmp = 0.0; const int i = d_ilist[ii]; @@ -1238,7 +1238,7 @@ double FixQEqReaxKokkos::dot1_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::dot2_item(int ii) const +double FixQEqReaxFFKokkos::dot2_item(int ii) const { double tmp = 0.0; const int i = d_ilist[ii]; @@ -1252,7 +1252,7 @@ double FixQEqReaxKokkos::dot2_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::precon1_item(int ii) const +void FixQEqReaxFFKokkos::precon1_item(int ii) const { const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -1265,7 +1265,7 @@ void FixQEqReaxKokkos::precon1_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::precon2_item(int ii) const +void FixQEqReaxFFKokkos::precon2_item(int ii) const { const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -1278,7 +1278,7 @@ void FixQEqReaxKokkos::precon2_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::precon_item(int ii) const +double FixQEqReaxFFKokkos::precon_item(int ii) const { F_FLOAT tmp = 0.0; const int i = d_ilist[ii]; @@ -1293,7 +1293,7 @@ double FixQEqReaxKokkos::precon_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::vecacc1_item(int ii) const +double FixQEqReaxFFKokkos::vecacc1_item(int ii) const { F_FLOAT tmp = 0.0; const int i = d_ilist[ii]; @@ -1306,7 +1306,7 @@ double FixQEqReaxKokkos::vecacc1_item(int ii) const template KOKKOS_INLINE_FUNCTION -double FixQEqReaxKokkos::vecacc2_item(int ii) const +double FixQEqReaxFFKokkos::vecacc2_item(int ii) const { F_FLOAT tmp = 0.0; const int i = d_ilist[ii]; @@ -1320,7 +1320,7 @@ double FixQEqReaxKokkos::vecacc2_item(int ii) const template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::calculate_q_item(int ii) const +void FixQEqReaxFFKokkos::calculate_q_item(int ii) const { const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -1339,20 +1339,20 @@ void FixQEqReaxKokkos::calculate_q_item(int ii) const /* ---------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::pack_forward_comm_fix_kokkos(int n, DAT::tdual_int_2d k_sendlist, +int FixQEqReaxFFKokkos::pack_forward_comm_fix_kokkos(int n, DAT::tdual_int_2d k_sendlist, int iswap_in, DAT::tdual_xfloat_1d &k_buf, int /*pbc_flag*/, int * /*pbc*/) { d_sendlist = k_sendlist.view(); iswap = iswap_in; d_buf = k_buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator()(TagFixQEqReaxPackForwardComm, const int &i) const { +void FixQEqReaxFFKokkos::operator()(TagFixQEqReaxFFPackForwardComm, const int &i) const { int j = d_sendlist(iswap, i); if (pack_flag == 1) @@ -1368,11 +1368,11 @@ void FixQEqReaxKokkos::operator()(TagFixQEqReaxPackForwardComm, cons /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::unpack_forward_comm_fix_kokkos(int n, int first_in, DAT::tdual_xfloat_1d &buf) +void FixQEqReaxFFKokkos::unpack_forward_comm_fix_kokkos(int n, int first_in, DAT::tdual_xfloat_1d &buf) { first = first_in; d_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); if (pack_flag == 4) atomKK->modified(execution_space,Q_MASK); // needed for auto_sync @@ -1380,7 +1380,7 @@ void FixQEqReaxKokkos::unpack_forward_comm_fix_kokkos(int n, int fir template KOKKOS_INLINE_FUNCTION -void FixQEqReaxKokkos::operator()(TagFixQEqReaxUnpackForwardComm, const int &i) const { +void FixQEqReaxFFKokkos::operator()(TagFixQEqReaxFFUnpackForwardComm, const int &i) const { if (pack_flag == 1) d_d[i + first] = d_buf[i]; else if (pack_flag == 2) @@ -1395,7 +1395,7 @@ void FixQEqReaxKokkos::operator()(TagFixQEqReaxUnpackForwardComm, co /* ---------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::pack_forward_comm(int n, int *list, double *buf, +int FixQEqReaxFFKokkos::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int m; @@ -1420,7 +1420,7 @@ int FixQEqReaxKokkos::pack_forward_comm(int n, int *list, double *bu /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::unpack_forward_comm(int n, int first, double *buf) +void FixQEqReaxFFKokkos::unpack_forward_comm(int n, int first, double *buf) { int i, m; @@ -1446,7 +1446,7 @@ void FixQEqReaxKokkos::unpack_forward_comm(int n, int first, double /* ---------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::pack_reverse_comm(int n, int first, double *buf) +int FixQEqReaxFFKokkos::pack_reverse_comm(int n, int first, double *buf) { k_o.sync_host(); @@ -1460,7 +1460,7 @@ int FixQEqReaxKokkos::pack_reverse_comm(int n, int first, double *bu /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double *buf) +void FixQEqReaxFFKokkos::unpack_reverse_comm(int n, int *list, double *buf) { k_o.sync_host(); @@ -1474,7 +1474,7 @@ void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double /* ---------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::cleanup_copy() +void FixQEqReaxFFKokkos::cleanup_copy() { id = style = nullptr; } @@ -1484,7 +1484,7 @@ void FixQEqReaxKokkos::cleanup_copy() ------------------------------------------------------------------------- */ template -double FixQEqReaxKokkos::memory_usage() +double FixQEqReaxFFKokkos::memory_usage() { double bytes; @@ -1502,7 +1502,7 @@ double FixQEqReaxKokkos::memory_usage() ------------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::grow_arrays(int nmax) +void FixQEqReaxFFKokkos::grow_arrays(int nmax) { k_s_hist.template sync(); k_t_hist.template sync(); @@ -1525,7 +1525,7 @@ void FixQEqReaxKokkos::grow_arrays(int nmax) ------------------------------------------------------------------------- */ template -void FixQEqReaxKokkos::copy_arrays(int i, int j, int /*delflag*/) +void FixQEqReaxFFKokkos::copy_arrays(int i, int j, int /*delflag*/) { k_s_hist.template sync(); k_t_hist.template sync(); @@ -1544,7 +1544,7 @@ void FixQEqReaxKokkos::copy_arrays(int i, int j, int /*delflag*/) ------------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::pack_exchange(int i, double *buf) +int FixQEqReaxFFKokkos::pack_exchange(int i, double *buf) { k_s_hist.template sync(); k_t_hist.template sync(); @@ -1559,7 +1559,7 @@ int FixQEqReaxKokkos::pack_exchange(int i, double *buf) ------------------------------------------------------------------------- */ template -int FixQEqReaxKokkos::unpack_exchange(int nlocal, double *buf) +int FixQEqReaxFFKokkos::unpack_exchange(int nlocal, double *buf) { k_s_hist.template sync(); k_t_hist.template sync(); @@ -1576,8 +1576,8 @@ int FixQEqReaxKokkos::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ namespace LAMMPS_NS { -template class FixQEqReaxKokkos; +template class FixQEqReaxFFKokkos; #ifdef LMP_KOKKOS_GPU -template class FixQEqReaxKokkos; +template class FixQEqReaxFFKokkos; #endif } diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.h b/src/KOKKOS/fix_qeq_reaxff_kokkos.h similarity index 75% rename from src/KOKKOS/fix_qeq_reax_kokkos.h rename to src/KOKKOS/fix_qeq_reaxff_kokkos.h index 8485c68122..71c0808b0f 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.h +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.h @@ -14,16 +14,19 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(qeq/reax/kk,FixQEqReaxKokkos); -FixStyle(qeq/reax/kk/device,FixQEqReaxKokkos); -FixStyle(qeq/reax/kk/host,FixQEqReaxKokkos); +FixStyle(qeq/reaxff/kk,FixQEqReaxFFKokkos); +FixStyle(qeq/reaxff/kk/device,FixQEqReaxFFKokkos); +FixStyle(qeq/reaxff/kk/host,FixQEqReaxFFKokkos); +FixStyle(qeq/reax/kk,FixQEqReaxFFKokkos); +FixStyle(qeq/reax/kk/device,FixQEqReaxFFKokkos); +FixStyle(qeq/reax/kk/host,FixQEqReaxFFKokkos); // clang-format on #else -#ifndef LMP_FIX_QEQ_REAX_KOKKOS_H -#define LMP_FIX_QEQ_REAX_KOKKOS_H +#ifndef LMP_FIX_QEQ_REAXFF_KOKKOS_H +#define LMP_FIX_QEQ_REAXFF_KOKKOS_H -#include "fix_qeq_reax.h" +#include "fix_qeq_reaxff.h" #include "kokkos_type.h" #include "neigh_list.h" #include "neigh_list_kokkos.h" @@ -35,16 +38,16 @@ struct TagSparseMatvec1 {}; struct TagSparseMatvec2 {}; struct TagSparseMatvec3 {}; struct TagZeroQGhosts{}; -struct TagFixQEqReaxPackForwardComm {}; -struct TagFixQEqReaxUnpackForwardComm {}; +struct TagFixQEqReaxFFPackForwardComm {}; +struct TagFixQEqReaxFFUnpackForwardComm {}; template -class FixQEqReaxKokkos : public FixQEqReax, public KokkosBase { +class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { public: typedef DeviceType device_type; typedef ArrayTypes AT; - FixQEqReaxKokkos(class LAMMPS *, int, char **); - ~FixQEqReaxKokkos(); + FixQEqReaxFFKokkos(class LAMMPS *, int, char **); + ~FixQEqReaxFFKokkos(); void cleanup_copy(); void init(); @@ -141,10 +144,10 @@ class FixQEqReaxKokkos : public FixQEqReax, public KokkosBase { double calculate_H_k(const F_FLOAT &r, const F_FLOAT &shld) const; KOKKOS_INLINE_FUNCTION - void operator()(TagFixQEqReaxPackForwardComm, const int&) const; + void operator()(TagFixQEqReaxFFPackForwardComm, const int&) const; KOKKOS_INLINE_FUNCTION - void operator()(TagFixQEqReaxUnpackForwardComm, const int&) const; + void operator()(TagFixQEqReaxFFUnpackForwardComm, const int&) const; struct params_qeq{ KOKKOS_INLINE_FUNCTION @@ -241,11 +244,11 @@ class FixQEqReaxKokkos : public FixQEqReax, public KokkosBase { }; template -struct FixQEqReaxKokkosNumNeighFunctor { +struct FixQEqReaxFFKokkosNumNeighFunctor { typedef DeviceType device_type ; typedef int value_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosNumNeighFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosNumNeighFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -255,10 +258,10 @@ struct FixQEqReaxKokkosNumNeighFunctor { }; template -struct FixQEqReaxKokkosMatVecFunctor { +struct FixQEqReaxFFKokkosMatVecFunctor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosMatVecFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosMatVecFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -268,17 +271,17 @@ struct FixQEqReaxKokkosMatVecFunctor { }; template -struct FixQEqReaxKokkosComputeHFunctor { +struct FixQEqReaxFFKokkosComputeHFunctor { int atoms_per_team, vector_length; typedef int value_type; typedef Kokkos::ScratchMemorySpace scratch_space; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; - FixQEqReaxKokkosComputeHFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosComputeHFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; - FixQEqReaxKokkosComputeHFunctor(FixQEqReaxKokkos *c_ptr, + FixQEqReaxFFKokkosComputeHFunctor(FixQEqReaxFFKokkos *c_ptr, int _atoms_per_team, int _vector_length) : atoms_per_team(_atoms_per_team), vector_length(_vector_length), c(*c_ptr) { c.cleanup_copy(); @@ -315,10 +318,10 @@ struct FixQEqReaxKokkosComputeHFunctor { }; template -struct FixQEqReaxKokkosZeroFunctor { +struct FixQEqReaxFFKokkosZeroFunctor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosZeroFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosZeroFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -328,10 +331,10 @@ struct FixQEqReaxKokkosZeroFunctor { }; template -struct FixQEqReaxKokkosSparse12Functor { +struct FixQEqReaxFFKokkosSparse12Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse12Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse12Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -341,10 +344,10 @@ struct FixQEqReaxKokkosSparse12Functor { }; template -struct FixQEqReaxKokkosSparse13Functor { +struct FixQEqReaxFFKokkosSparse13Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse13Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse13Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -354,10 +357,10 @@ struct FixQEqReaxKokkosSparse13Functor { }; template -struct FixQEqReaxKokkosSparse22Functor { +struct FixQEqReaxFFKokkosSparse22Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse22Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse22Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -367,10 +370,10 @@ struct FixQEqReaxKokkosSparse22Functor { }; template -struct FixQEqReaxKokkosSparse23Functor { +struct FixQEqReaxFFKokkosSparse23Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse23Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse23Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -380,10 +383,10 @@ struct FixQEqReaxKokkosSparse23Functor { }; template -struct FixQEqReaxKokkosSparse32Functor { +struct FixQEqReaxFFKokkosSparse32Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse32Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse32Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -393,10 +396,10 @@ struct FixQEqReaxKokkosSparse32Functor { }; template -struct FixQEqReaxKokkosSparse33Functor { +struct FixQEqReaxFFKokkosSparse33Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosSparse33Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosSparse33Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -406,10 +409,10 @@ struct FixQEqReaxKokkosSparse33Functor { }; template -struct FixQEqReaxKokkosVecSum2Functor { +struct FixQEqReaxFFKokkosVecSum2Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosVecSum2Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosVecSum2Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -419,11 +422,11 @@ struct FixQEqReaxKokkosVecSum2Functor { }; template -struct FixQEqReaxKokkosNorm1Functor { +struct FixQEqReaxFFKokkosNorm1Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosNorm1Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosNorm1Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -433,11 +436,11 @@ struct FixQEqReaxKokkosNorm1Functor { }; template -struct FixQEqReaxKokkosNorm2Functor { +struct FixQEqReaxFFKokkosNorm2Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosNorm2Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosNorm2Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -447,11 +450,11 @@ struct FixQEqReaxKokkosNorm2Functor { }; template -struct FixQEqReaxKokkosDot1Functor { +struct FixQEqReaxFFKokkosDot1Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosDot1Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosDot1Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -461,11 +464,11 @@ struct FixQEqReaxKokkosDot1Functor { }; template -struct FixQEqReaxKokkosDot2Functor { +struct FixQEqReaxFFKokkosDot2Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosDot2Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosDot2Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -475,10 +478,10 @@ struct FixQEqReaxKokkosDot2Functor { }; template -struct FixQEqReaxKokkosPrecon1Functor { +struct FixQEqReaxFFKokkosPrecon1Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosPrecon1Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosPrecon1Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -488,10 +491,10 @@ struct FixQEqReaxKokkosPrecon1Functor { }; template -struct FixQEqReaxKokkosPrecon2Functor { +struct FixQEqReaxFFKokkosPrecon2Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosPrecon2Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosPrecon2Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -501,11 +504,11 @@ struct FixQEqReaxKokkosPrecon2Functor { }; template -struct FixQEqReaxKokkosPreconFunctor { +struct FixQEqReaxFFKokkosPreconFunctor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosPreconFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosPreconFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -515,11 +518,11 @@ struct FixQEqReaxKokkosPreconFunctor { }; template -struct FixQEqReaxKokkosVecAcc1Functor { +struct FixQEqReaxFFKokkosVecAcc1Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosVecAcc1Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosVecAcc1Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -529,11 +532,11 @@ struct FixQEqReaxKokkosVecAcc1Functor { }; template -struct FixQEqReaxKokkosVecAcc2Functor { +struct FixQEqReaxFFKokkosVecAcc2Functor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; + FixQEqReaxFFKokkos c; typedef double value_type; - FixQEqReaxKokkosVecAcc2Functor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkosVecAcc2Functor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION @@ -543,10 +546,10 @@ struct FixQEqReaxKokkosVecAcc2Functor { }; template -struct FixQEqReaxKokkosCalculateQFunctor { +struct FixQEqReaxFFKokkosCalculateQFunctor { typedef DeviceType device_type ; - FixQEqReaxKokkos c; - FixQEqReaxKokkosCalculateQFunctor(FixQEqReaxKokkos* c_ptr):c(*c_ptr) { + FixQEqReaxFFKokkos c; + FixQEqReaxFFKokkosCalculateQFunctor(FixQEqReaxFFKokkos* c_ptr):c(*c_ptr) { c.cleanup_copy(); }; KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxff_bonds_kokkos.cpp similarity index 69% rename from src/KOKKOS/fix_reaxc_bonds_kokkos.cpp rename to src/KOKKOS/fix_reaxff_bonds_kokkos.cpp index 3da59ce972..2fc7d4639d 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp +++ b/src/KOKKOS/fix_reaxff_bonds_kokkos.cpp @@ -16,22 +16,22 @@ Contributing author: Stan Moore (Sandia) ------------------------------------------------------------------------- */ -#include "fix_reaxc_bonds_kokkos.h" +#include "fix_reaxff_bonds_kokkos.h" #include "atom.h" #include "atom_masks.h" #include "error.h" #include "force.h" #include "memory_kokkos.h" -#include "pair_reaxc_kokkos.h" +#include "pair_reaxff_kokkos.h" using namespace LAMMPS_NS; using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixReaxCBondsKokkos::FixReaxCBondsKokkos(LAMMPS *lmp, int narg, char **arg) : - FixReaxCBonds(lmp, narg, arg) +FixReaxFFBondsKokkos::FixReaxFFBondsKokkos(LAMMPS *lmp, int narg, char **arg) : + FixReaxFFBonds(lmp, narg, arg) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -42,25 +42,25 @@ FixReaxCBondsKokkos::FixReaxCBondsKokkos(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixReaxCBondsKokkos::~FixReaxCBondsKokkos() +FixReaxFFBondsKokkos::~FixReaxFFBondsKokkos() { } /* ---------------------------------------------------------------------- */ -void FixReaxCBondsKokkos::init() +void FixReaxFFBondsKokkos::init() { - Pair *pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " - "pair_style reax/c/kk"); + Pair *pair_kk = force->pair_match("^reax../kk",0); + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reaxff/bonds without " + "pair_style reaxff/kk"); - FixReaxCBonds::init(); + FixReaxFFBonds::init(); } /* ---------------------------------------------------------------------- */ -void FixReaxCBondsKokkos::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/) +void FixReaxFFBondsKokkos::Output_ReaxFF_Bonds() { int nbuf_local; @@ -72,23 +72,23 @@ void FixReaxCBondsKokkos::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/ int nlocal_tot = static_cast (atom->natoms); numbonds = 0; - if (reaxc->execution_space == Device) - ((PairReaxCKokkos*) reaxc)->FindBond(numbonds); + if (reaxff->execution_space == Device) + ((PairReaxFFKokkos*) reaxff)->FindBond(numbonds); else - ((PairReaxCKokkos*) reaxc)->FindBond(numbonds); + ((PairReaxFFKokkos*) reaxff)->FindBond(numbonds); // allocate a temporary buffer for the snapshot info MPI_Allreduce(&numbonds,&numbonds_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nlocal,&nlocal_max,1,MPI_INT,MPI_MAX,world); nbuf = 1+(numbonds_max*2+10)*nlocal_max; - memoryKK->create_kokkos(k_buf,buf,nbuf,"reax/c/bonds:buf"); + memoryKK->create_kokkos(k_buf,buf,nbuf,"reaxff/bonds:buf"); // Pass information to buffer - if (reaxc->execution_space == Device) - ((PairReaxCKokkos*) reaxc)->PackBondBuffer(k_buf,nbuf_local); + if (reaxff->execution_space == Device) + ((PairReaxFFKokkos*) reaxff)->PackBondBuffer(k_buf,nbuf_local); else - ((PairReaxCKokkos*) reaxc)->PackBondBuffer(k_buf,nbuf_local); + ((PairReaxFFKokkos*) reaxff)->PackBondBuffer(k_buf,nbuf_local); buf[0] = nlocal; // Receive information from buffer for output @@ -99,12 +99,12 @@ void FixReaxCBondsKokkos::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/ /* ---------------------------------------------------------------------- */ -double FixReaxCBondsKokkos::memory_usage() +double FixReaxFFBondsKokkos::memory_usage() { double bytes; bytes = nbuf*sizeof(double); - // These are accounted for in PairReaxCKokkos: + // These are accounted for in PairReaxFFKokkos: //bytes += nmax*sizeof(int); //bytes += 1.0*nmax*MAXREAXBOND*sizeof(double); //bytes += 1.0*nmax*MAXREAXBOND*sizeof(int); diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.h b/src/KOKKOS/fix_reaxff_bonds_kokkos.h similarity index 59% rename from src/KOKKOS/fix_reaxc_bonds_kokkos.h rename to src/KOKKOS/fix_reaxff_bonds_kokkos.h index 8c1bb9bef9..b1203e472d 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.h +++ b/src/KOKKOS/fix_reaxff_bonds_kokkos.h @@ -14,29 +14,32 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(reax/c/bonds/kk,FixReaxCBondsKokkos); -FixStyle(reax/c/bonds/kk/device,FixReaxCBondsKokkos); -FixStyle(reax/c/bonds/kk/host,FixReaxCBondsKokkos); +FixStyle(reaxff/bonds/kk,FixReaxFFBondsKokkos); +FixStyle(reaxff/bonds/kk/device,FixReaxFFBondsKokkos); +FixStyle(reaxff/bonds/kk/host,FixReaxFFBondsKokkos); +FixStyle(reax/c/bonds/kk,FixReaxFFBondsKokkos); +FixStyle(reax/c/bonds/kk/device,FixReaxFFBondsKokkos); +FixStyle(reax/c/bonds/kk/host,FixReaxFFBondsKokkos); // clang-format on #else -#ifndef LMP_FIX_REAXC_BONDS_KOKKOS_H -#define LMP_FIX_REAXC_BONDS_KOKKOS_H +#ifndef LMP_FIX_REAXFF_BONDS_KOKKOS_H +#define LMP_FIX_REAXFF_BONDS_KOKKOS_H -#include "fix_reaxc_bonds.h" +#include "fix_reaxff_bonds.h" #include "kokkos_type.h" namespace LAMMPS_NS { -class FixReaxCBondsKokkos : public FixReaxCBonds { +class FixReaxFFBondsKokkos : public FixReaxFFBonds { public: - FixReaxCBondsKokkos(class LAMMPS *, int, char **); - virtual ~FixReaxCBondsKokkos(); + FixReaxFFBondsKokkos(class LAMMPS *, int, char **); + virtual ~FixReaxFFBondsKokkos(); void init(); private: int nbuf; - void Output_ReaxC_Bonds(bigint, FILE *); + void Output_ReaxFF_Bonds() double memory_usage(); }; } diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxff_species_kokkos.cpp similarity index 83% rename from src/KOKKOS/fix_reaxc_species_kokkos.cpp rename to src/KOKKOS/fix_reaxff_species_kokkos.cpp index 9d01164b6f..d3d913eda8 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxff_species_kokkos.cpp @@ -16,7 +16,7 @@ Contributing authors: Stan Moore (Sandia) ------------------------------------------------------------------------- */ -#include "fix_reaxc_species_kokkos.h" +#include "fix_reaxff_species_kokkos.h" #include "atom.h" #include "atom_masks.h" @@ -29,7 +29,7 @@ #include "neigh_request.h" #include "fix_ave_atom.h" -#include "pair_reaxc_kokkos.h" +#include "pair_reaxff_kokkos.h" #include "reaxff_defs.h" using namespace LAMMPS_NS; @@ -37,8 +37,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixReaxCSpeciesKokkos::FixReaxCSpeciesKokkos(LAMMPS *lmp, int narg, char **arg) : - FixReaxCSpecies(lmp, narg, arg) +FixReaxFFSpeciesKokkos::FixReaxFFSpeciesKokkos(LAMMPS *lmp, int narg, char **arg) : + FixReaxFFSpecies(lmp, narg, arg) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -51,25 +51,25 @@ FixReaxCSpeciesKokkos::FixReaxCSpeciesKokkos(LAMMPS *lmp, int narg, char **arg) /* ---------------------------------------------------------------------- */ -FixReaxCSpeciesKokkos::~FixReaxCSpeciesKokkos() +FixReaxFFSpeciesKokkos::~FixReaxFFSpeciesKokkos() { } /* ---------------------------------------------------------------------- */ -void FixReaxCSpeciesKokkos::init() +void FixReaxFFSpeciesKokkos::init() { - Pair* pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/species/kk without " - "pair_style reax/c/kk"); + Pair* pair_kk = force->pair_match("^reax../kk",0); + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reaxff/species/kk without " + "pair_style reaxff/kk"); - FixReaxCSpecies::init(); + FixReaxFFSpecies::init(); } /* ---------------------------------------------------------------------- */ -void FixReaxCSpeciesKokkos::FindMolecule() +void FixReaxFFSpeciesKokkos::FindMolecule() { int i,j,ii,jj,inum,itype,jtype,loop,looptot; int change,done,anychange; @@ -77,14 +77,14 @@ void FixReaxCSpeciesKokkos::FindMolecule() double bo_tmp,bo_cut; double **spec_atom = f_SPECBOND->array_atom; - inum = reaxc->list->inum; + inum = reaxff->list->inum; typename ArrayTypes::t_int_1d ilist; - if (reaxc->execution_space == Host) { - NeighListKokkos* k_list = static_cast*>(reaxc->list); + if (reaxff->execution_space == Host) { + NeighListKokkos* k_list = static_cast*>(reaxff->list); k_list->k_ilist.sync(); ilist = k_list->k_ilist.h_view; } else { - NeighListKokkos* k_list = static_cast*>(reaxc->list); + NeighListKokkos* k_list = static_cast*>(reaxff->list); k_list->k_ilist.sync(); ilist = k_list->k_ilist.h_view; } @@ -116,7 +116,7 @@ void FixReaxCSpeciesKokkos::FindMolecule() itype = atom->type[i]; for (jj = 0; jj < MAXSPECBOND; jj++) { - j = reaxc->tmpid[i][jj]; + j = reaxff->tmpid[i][jj]; if ((j == 0) && (j < i)) continue; if (!(mask[j] & groupbit)) continue; diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.h b/src/KOKKOS/fix_reaxff_species_kokkos.h similarity index 58% rename from src/KOKKOS/fix_reaxc_species_kokkos.h rename to src/KOKKOS/fix_reaxff_species_kokkos.h index 1a5f204132..ad9d02319d 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.h +++ b/src/KOKKOS/fix_reaxff_species_kokkos.h @@ -14,25 +14,28 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(reax/c/species/kk,FixReaxCSpeciesKokkos); -FixStyle(reax/c/species/kk/device,FixReaxCSpeciesKokkos); -FixStyle(reax/c/species/kk/host,FixReaxCSpeciesKokkos); +FixStyle(reaxff/species/kk,FixReaxFFSpeciesKokkos); +FixStyle(reaxff/species/kk/device,FixReaxFFSpeciesKokkos); +FixStyle(reaxff/species/kk/host,FixReaxFFSpeciesKokkos); +FixStyle(reax/c/species/kk,FixReaxFFSpeciesKokkos); +FixStyle(reax/c/species/kk/device,FixReaxFFSpeciesKokkos); +FixStyle(reax/c/species/kk/host,FixReaxFFSpeciesKokkos); // clang-format on #else -#ifndef LMP_FIX_REAXC_SPECIES_KOKKOS_H -#define LMP_FIX_REAXC_SPECIES_KOKKOS_H +#ifndef LMP_FIX_REAXFF_SPECIES_KOKKOS_H +#define LMP_FIX_REAXFF_SPECIES_KOKKOS_H -#include "fix_reaxc_species.h" +#include "fix_reaxff_species.h" #define BUFLEN 1000 namespace LAMMPS_NS { -class FixReaxCSpeciesKokkos : public FixReaxCSpecies { +class FixReaxFFSpeciesKokkos : public FixReaxFFSpecies { public: - FixReaxCSpeciesKokkos(class LAMMPS *, int, char **); - virtual ~FixReaxCSpeciesKokkos(); + FixReaxFFSpeciesKokkos(class LAMMPS *, int, char **); + virtual ~FixReaxFFSpeciesKokkos(); void init(); private: diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp similarity index 91% rename from src/KOKKOS/pair_reaxc_kokkos.cpp rename to src/KOKKOS/pair_reaxff_kokkos.cpp index 266a8b09f9..6e49b5081c 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -16,7 +16,7 @@ Contributing author: Ray Shan (SNL), Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "pair_reaxc_kokkos.h" +#include "pair_reaxff_kokkos.h" #include "atom_kokkos.h" #include "atom_masks.h" @@ -44,7 +44,7 @@ using namespace MathConst; using namespace MathSpecial; template -PairReaxCKokkos::PairReaxCKokkos(LAMMPS *lmp) : PairReaxC(lmp) +PairReaxFFKokkos::PairReaxFFKokkos(LAMMPS *lmp) : PairReaxFF(lmp) { respa_enable = 0; @@ -73,7 +73,7 @@ PairReaxCKokkos::PairReaxCKokkos(LAMMPS *lmp) : PairReaxC(lmp) /* ---------------------------------------------------------------------- */ template -PairReaxCKokkos::~PairReaxCKokkos() +PairReaxFFKokkos::~PairReaxFFKokkos() { if (copymode) return; @@ -100,28 +100,28 @@ PairReaxCKokkos::~PairReaxCKokkos() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::allocate() +void PairReaxFFKokkos::allocate() { int n = atom->ntypes; k_params_sing = Kokkos::DualView - ("PairReaxC::params_sing",n+1); + ("PairReaxFF::params_sing",n+1); paramssing = k_params_sing.template view(); k_params_twbp = Kokkos::DualView - ("PairReaxC::params_twbp",n+1,n+1); + ("PairReaxFF::params_twbp",n+1,n+1); paramstwbp = k_params_twbp.template view(); k_params_thbp = Kokkos::DualView - ("PairReaxC::params_thbp",n+1,n+1,n+1); + ("PairReaxFF::params_thbp",n+1,n+1,n+1); paramsthbp = k_params_thbp.template view(); k_params_fbp = Kokkos::DualView - ("PairReaxC::params_fbp",n+1,n+1,n+1,n+1); + ("PairReaxFF::params_fbp",n+1,n+1,n+1,n+1); paramsfbp = k_params_fbp.template view(); k_params_hbp = Kokkos::DualView - ("PairReaxC::params_hbp",n+1,n+1,n+1); + ("PairReaxFF::params_hbp",n+1,n+1,n+1); paramshbp = k_params_hbp.template view(); k_tap = DAT::tdual_ffloat_1d("pair:tap",8); @@ -135,9 +135,9 @@ void PairReaxCKokkos::allocate() ------------------------------------------------------------------------- */ template -void PairReaxCKokkos::init_style() +void PairReaxFFKokkos::init_style() { - PairReaxC::init_style(); + PairReaxFF::init_style(); if (fix_reax) modify->delete_fix(fix_id); // not needed in the Kokkos version fix_reax = nullptr; @@ -157,7 +157,7 @@ void PairReaxCKokkos::init_style() neighbor->requests[irequest]->half = 1; neighbor->requests[irequest]->ghost = 1; } else { - error->all(FLERR,"Must use half neighbor list with pair style reax/c/kk"); + error->all(FLERR,"Must use half neighbor list with pair style reaxff/kk"); } allocate(); @@ -168,7 +168,7 @@ void PairReaxCKokkos::init_style() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::setup() +void PairReaxFFKokkos::setup() { int i,j,k,m; int n = atom->ntypes; @@ -335,7 +335,7 @@ void PairReaxCKokkos::setup() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::init_md() +void PairReaxFFKokkos::init_md() { // init_taper() F_FLOAT d1, d7, swa, swa2, swa3, swb, swb2, swb3; @@ -430,7 +430,7 @@ void PairReaxCKokkos::init_md() /* ---------------------------------------------------------------------- */ template -int PairReaxCKokkos::Init_Lookup_Tables() +int PairReaxFFKokkos::Init_Lookup_Tables() { int i, j, r; int num_atom_types; @@ -538,7 +538,7 @@ int PairReaxCKokkos::Init_Lookup_Tables() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::Deallocate_Lookup_Tables() +void PairReaxFFKokkos::Deallocate_Lookup_Tables() { int i, j; int ntypes; @@ -567,7 +567,7 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::LR_vdW_Coulomb(int i, int j, double r_ij, LR_data *lr) +void PairReaxFFKokkos::LR_vdW_Coulomb(int i, int j, double r_ij, LR_data *lr) { double p_vdW1 = api->system->reax_param.gp.l[28]; double p_vdW1i = 1.0 / p_vdW1; @@ -663,7 +663,7 @@ void PairReaxCKokkos::LR_vdW_Coulomb(int i, int j, double r_ij, LR_d /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::compute(int eflag_in, int vflag_in) +void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) { copymode = 1; @@ -724,14 +724,14 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) // Polarization (self) if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } ev_all += ev; pvector[13] = ev.ecoul; @@ -740,26 +740,26 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) if (api->control->tabulate) { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } } else { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } } ev_all += ev; @@ -853,34 +853,34 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) // Bond energy if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; pvector[0] = ev.evdwl; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; pvector[0] = ev.evdwl; } // Multi-body corrections if (neighflag == HALF) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[2] = ev.ereax[0]; @@ -891,15 +891,15 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) // Angular if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[4] = ev.ereax[3]; @@ -910,15 +910,15 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) // Torsion if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[8] = ev.ereax[6]; @@ -929,15 +929,15 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) if (cut_hbsq > 0.0) { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } } @@ -969,9 +969,9 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) //} if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); ev_all += ev; pvector[0] += ev.evdwl; } else { //if (neighflag == HALFTHREAD) { @@ -985,9 +985,9 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) //} if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); ev_all += ev; pvector[0] += ev.evdwl; } @@ -1049,7 +1049,7 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputePolar, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputePolar, const int &ii, EV_FLOAT_REAX& ev) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1067,9 +1067,9 @@ void PairReaxCKokkos::operator()(PairReaxComputePolar template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputePolar, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputePolar, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputePolar(), ii, ev); + this->template operator()(PairReaxFFomputePolar(), ii, ev); } @@ -1078,7 +1078,7 @@ void PairReaxCKokkos::operator()(PairReaxComputePolar template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1220,9 +1220,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeLJCoulomb template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeLJCoulomb, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeLJCoulomb(), ii, ev); + this->template operator()(PairReaxFFomputeLJCoulomb(), ii, ev); } /* ---------------------------------------------------------------------- */ @@ -1230,7 +1230,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeLJCoulomb template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeTabulatedLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeTabulatedLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1327,84 +1327,84 @@ void PairReaxCKokkos::operator()(PairReaxComputeTabulatedLJCoulomb template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeTabulatedLJCoulomb, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeTabulatedLJCoulomb, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeTabulatedLJCoulomb(), ii, ev); + this->template operator()(PairReaxFFomputeTabulatedLJCoulomb(), ii, ev); } /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::allocate_array() +void PairReaxFFKokkos::allocate_array() { if (cut_hbsq > 0.0) { - d_hb_first = typename AT::t_int_1d("reax/c/kk:hb_first",nmax); - d_hb_num = typename AT::t_int_1d("reax/c/kk:hb_num",nmax); - d_hb_list = typename AT::t_int_1d("reax/c/kk:hb_list",nmax*maxhb); + d_hb_first = typename AT::t_int_1d("reaxff/kk:hb_first",nmax); + d_hb_num = typename AT::t_int_1d("reaxff/kk:hb_num",nmax); + d_hb_list = typename AT::t_int_1d("reaxff/kk:hb_list",nmax*maxhb); } - d_bo_first = typename AT::t_int_1d("reax/c/kk:bo_first",nmax); - d_bo_num = typename AT::t_int_1d("reax/c/kk:bo_num",nmax); - d_bo_list = typename AT::t_int_1d("reax/c/kk:bo_list",nmax*maxbo); + d_bo_first = typename AT::t_int_1d("reaxff/kk:bo_first",nmax); + d_bo_num = typename AT::t_int_1d("reaxff/kk:bo_num",nmax); + d_bo_list = typename AT::t_int_1d("reaxff/kk:bo_list",nmax*maxbo); - d_BO = typename AT::t_ffloat_2d_dl("reax/c/kk:BO",nmax,maxbo); - d_BO_s = typename AT::t_ffloat_2d_dl("reax/c/kk:BO",nmax,maxbo); - d_BO_pi = typename AT::t_ffloat_2d_dl("reax/c/kk:BO_pi",nmax,maxbo); - d_BO_pi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:BO_pi2",nmax,maxbo); + d_BO = typename AT::t_ffloat_2d_dl("reaxff/kk:BO",nmax,maxbo); + d_BO_s = typename AT::t_ffloat_2d_dl("reaxff/kk:BO",nmax,maxbo); + d_BO_pi = typename AT::t_ffloat_2d_dl("reaxff/kk:BO_pi",nmax,maxbo); + d_BO_pi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:BO_pi2",nmax,maxbo); - d_dln_BOp_pix = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_pix",nmax,maxbo); - d_dln_BOp_piy = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_piy",nmax,maxbo); - d_dln_BOp_piz = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_piz",nmax,maxbo); + d_dln_BOp_pix = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_pix",nmax,maxbo); + d_dln_BOp_piy = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_piy",nmax,maxbo); + d_dln_BOp_piz = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_piz",nmax,maxbo); - d_dln_BOp_pi2x = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_pi2x",nmax,maxbo); - d_dln_BOp_pi2y = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_pi2y",nmax,maxbo); - d_dln_BOp_pi2z = typename AT::t_ffloat_2d_dl("reax/c/kk:d_dln_BOp_pi2z",nmax,maxbo); + d_dln_BOp_pi2x = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_pi2x",nmax,maxbo); + d_dln_BOp_pi2y = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_pi2y",nmax,maxbo); + d_dln_BOp_pi2z = typename AT::t_ffloat_2d_dl("reaxff/kk:d_dln_BOp_pi2z",nmax,maxbo); - d_C1dbo = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C1dbo",nmax,maxbo); - d_C2dbo = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C2dbo",nmax,maxbo); - d_C3dbo = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C3dbo",nmax,maxbo); + d_C1dbo = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C1dbo",nmax,maxbo); + d_C2dbo = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C2dbo",nmax,maxbo); + d_C3dbo = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C3dbo",nmax,maxbo); - d_C1dbopi = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C1dbopi",nmax,maxbo); - d_C2dbopi = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C2dbopi",nmax,maxbo); - d_C3dbopi = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C3dbopi",nmax,maxbo); - d_C4dbopi = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C4dbopi",nmax,maxbo); + d_C1dbopi = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C1dbopi",nmax,maxbo); + d_C2dbopi = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C2dbopi",nmax,maxbo); + d_C3dbopi = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C3dbopi",nmax,maxbo); + d_C4dbopi = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C4dbopi",nmax,maxbo); - d_C1dbopi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C1dbopi2",nmax,maxbo); - d_C2dbopi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C2dbopi2",nmax,maxbo); - d_C3dbopi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C3dbopi2",nmax,maxbo); - d_C4dbopi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:d_C4dbopi2",nmax,maxbo); + d_C1dbopi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C1dbopi2",nmax,maxbo); + d_C2dbopi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C2dbopi2",nmax,maxbo); + d_C3dbopi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C3dbopi2",nmax,maxbo); + d_C4dbopi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:d_C4dbopi2",nmax,maxbo); - d_dBOpx = typename AT::t_ffloat_2d_dl("reax/c/kk:dBOpx",nmax,maxbo); - d_dBOpy = typename AT::t_ffloat_2d_dl("reax/c/kk:dBOpy",nmax,maxbo); - d_dBOpz = typename AT::t_ffloat_2d_dl("reax/c/kk:dBOpz",nmax,maxbo); + d_dBOpx = typename AT::t_ffloat_2d_dl("reaxff/kk:dBOpx",nmax,maxbo); + d_dBOpy = typename AT::t_ffloat_2d_dl("reaxff/kk:dBOpy",nmax,maxbo); + d_dBOpz = typename AT::t_ffloat_2d_dl("reaxff/kk:dBOpz",nmax,maxbo); - d_dDeltap_self = typename AT::t_ffloat_2d_dl("reax/c/kk:dDeltap_self",nmax,3); - d_Deltap_boc = typename AT::t_ffloat_1d("reax/c/kk:Deltap_boc",nmax); - d_Deltap = typename AT::t_ffloat_1d("reax/c/kk:Deltap",nmax); - d_total_bo = typename AT::t_ffloat_1d("reax/c/kk:total_bo",nmax); + d_dDeltap_self = typename AT::t_ffloat_2d_dl("reaxff/kk:dDeltap_self",nmax,3); + d_Deltap_boc = typename AT::t_ffloat_1d("reaxff/kk:Deltap_boc",nmax); + d_Deltap = typename AT::t_ffloat_1d("reaxff/kk:Deltap",nmax); + d_total_bo = typename AT::t_ffloat_1d("reaxff/kk:total_bo",nmax); - d_Cdbo = typename AT::t_ffloat_2d_dl("reax/c/kk:Cdbo",nmax,3*maxbo); - d_Cdbopi = typename AT::t_ffloat_2d_dl("reax/c/kk:Cdbopi",nmax,3*maxbo); - d_Cdbopi2 = typename AT::t_ffloat_2d_dl("reax/c/kk:Cdbopi2",nmax,3*maxbo); + d_Cdbo = typename AT::t_ffloat_2d_dl("reaxff/kk:Cdbo",nmax,3*maxbo); + d_Cdbopi = typename AT::t_ffloat_2d_dl("reaxff/kk:Cdbopi",nmax,3*maxbo); + d_Cdbopi2 = typename AT::t_ffloat_2d_dl("reaxff/kk:Cdbopi2",nmax,3*maxbo); - d_Delta = typename AT::t_ffloat_1d("reax/c/kk:Delta",nmax); - d_Delta_boc = typename AT::t_ffloat_1d("reax/c/kk:Delta_boc",nmax); - d_dDelta_lp = typename AT::t_ffloat_1d("reax/c/kk:dDelta_lp",nmax); - d_Delta_lp = typename AT::t_ffloat_1d("reax/c/kk:Delta_lp",nmax); - d_Delta_lp_temp = typename AT::t_ffloat_1d("reax/c/kk:Delta_lp_temp",nmax); - d_CdDelta = typename AT::t_ffloat_1d("reax/c/kk:CdDelta",nmax); - d_sum_ovun = typename AT::t_ffloat_2d_dl("reax/c/kk:sum_ovun",nmax,3); + d_Delta = typename AT::t_ffloat_1d("reaxff/kk:Delta",nmax); + d_Delta_boc = typename AT::t_ffloat_1d("reaxff/kk:Delta_boc",nmax); + d_dDelta_lp = typename AT::t_ffloat_1d("reaxff/kk:dDelta_lp",nmax); + d_Delta_lp = typename AT::t_ffloat_1d("reaxff/kk:Delta_lp",nmax); + d_Delta_lp_temp = typename AT::t_ffloat_1d("reaxff/kk:Delta_lp_temp",nmax); + d_CdDelta = typename AT::t_ffloat_1d("reaxff/kk:CdDelta",nmax); + d_sum_ovun = typename AT::t_ffloat_2d_dl("reaxff/kk:sum_ovun",nmax,3); - // FixReaxCBonds - d_abo = typename AT::t_ffloat_2d("reax/c/kk:abo",nmax,maxbo); - d_neighid = typename AT::t_tagint_2d("reax/c/kk:neighid",nmax,maxbo); - d_numneigh_bonds = typename AT::t_int_1d("reax/c/kk:numneigh_bonds",nmax); + // FixReaxFFBonds + d_abo = typename AT::t_ffloat_2d("reaxff/kk:abo",nmax,maxbo); + d_neighid = typename AT::t_tagint_2d("reaxff/kk:neighid",nmax,maxbo); + d_numneigh_bonds = typename AT::t_int_1d("reaxff/kk:numneigh_bonds",nmax); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxZero, const int &n) const { +void PairReaxFFKokkos::operator()(PairReaxZero, const int &n) const { d_total_bo(n) = 0.0; d_CdDelta(n) = 0.0; d_bo_num(n) = 0.0; @@ -1415,13 +1415,13 @@ void PairReaxCKokkos::operator()(PairReaxZero, const int &n) const { template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxZeroEAtom, const int &i) const { +void PairReaxFFKokkos::operator()(PairReaxZeroEAtom, const int &i) const { d_eatom(i) = 0.0; } template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxZeroVAtom, const int &i) const { +void PairReaxFFKokkos::operator()(PairReaxZeroVAtom, const int &i) const { d_vatom(i,0) = 0.0; d_vatom(i,1) = 0.0; d_vatom(i,2) = 0.0; @@ -1434,7 +1434,7 @@ void PairReaxCKokkos::operator()(PairReaxZeroVAtom, const int &i) co template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxBuildListsFull, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxBuildListsFull, const int &ii) const { if (d_resize_bo() || d_resize_hb()) return; @@ -1592,7 +1592,7 @@ void PairReaxCKokkos::operator()(PairReaxBuildListsFull, const int & template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxBuildListsHalf, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxBuildListsHalf, const int &ii) const { if (d_resize_bo() || d_resize_hb()) return; @@ -1805,7 +1805,7 @@ void PairReaxCKokkos::operator()(PairReaxBuildListsHalf, template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxBondOrder1, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxBondOrder1, const int &ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1819,7 +1819,7 @@ void PairReaxCKokkos::operator()(PairReaxBondOrder1, const int &ii) template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxBondOrder2, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxBondOrder2, const int &ii) const { F_FLOAT exp_p1i, exp_p2i, exp_p1j, exp_p2j, f1, f2, f3, u1_ij, u1_ji, Cf1A_ij, Cf1B_ij, Cf1_ij, Cf1_ji; F_FLOAT f4, f5, exp_f4, exp_f5, f4f5, Cf45_ij, Cf45_ji; @@ -1953,7 +1953,7 @@ void PairReaxCKokkos::operator()(PairReaxBondOrder2, const int &ii) template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxBondOrder3, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxBondOrder3, const int &ii) const { // bot part of BO() const int i = d_ilist[ii]; @@ -1989,7 +1989,7 @@ void PairReaxCKokkos::operator()(PairReaxBondOrder3, const int &ii) template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeMulti1, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti1, const int &ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -2023,7 +2023,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti1 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeMulti2, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2, const int &ii, EV_FLOAT_REAX& ev) const { auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); auto a_CdDelta = v_CdDelta.template access::value>(); @@ -2164,9 +2164,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeMulti2, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeMulti2(), ii, ev); + this->template operator()(PairReaxFFomputeMulti2(), ii, ev); } @@ -2175,7 +2175,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeAngular, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2476,9 +2476,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeAngular, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeAngular(), ii, ev); + this->template operator()(PairReaxFFomputeAngular(), ii, ev); } @@ -2487,7 +2487,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeTorsion, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2497,7 +2497,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion::value,Kokkos::MemoryTraits::value> > a_Cdbo = d_Cdbo; //auto a_Cdbo = dup_Cdbo.template access::value>(); - // in reaxc_torsion_angles: j = i, k = j, i = k; + // in reaxff_torsion_angles: j = i, k = j, i = k; F_FLOAT Delta_i, Delta_j, bo_ij, bo_ik, bo_jl, BOA_ij, BOA_ik, BOA_jl; F_FLOAT p_tor1, p_cot1, V1, V2, V3; @@ -2851,9 +2851,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeTorsion, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeTorsion(), ii, ev); + this->template operator()(PairReaxFFomputeTorsion(), ii, ev); } @@ -2862,7 +2862,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeHydrogen, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeHydrogen, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2998,9 +2998,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeHydrogen template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeHydrogen, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeHydrogen, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeHydrogen(), ii, ev); + this->template operator()(PairReaxFFomputeHydrogen(), ii, ev); } @@ -3009,7 +3009,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeHydrogen template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxUpdateBond, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxUpdateBond, const int &ii) const { Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbo = d_Cdbo; Kokkos::View::value,Kokkos::MemoryTraits::value> > a_Cdbopi = d_Cdbopi; @@ -3061,7 +3061,7 @@ void PairReaxCKokkos::operator()(PairReaxUpdateBond, cons template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); @@ -3168,9 +3168,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeBond1 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeBond1, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeBond1(), ii, ev); + this->template operator()(PairReaxFFomputeBond1(), ii, ev); } @@ -3179,7 +3179,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeBond1 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeBond2, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeBond2, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -3369,9 +3369,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeBond2 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxComputeBond2, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFomputeBond2, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxComputeBond2(), ii, ev); + this->template operator()(PairReaxFFomputeBond2(), ii, ev); } @@ -3380,7 +3380,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeBond2 template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::ev_tally(EV_FLOAT_REAX &ev, const int &i, const int &j, +void PairReaxFFKokkos::ev_tally(EV_FLOAT_REAX &ev, const int &i, const int &j, const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const { @@ -3439,7 +3439,7 @@ void PairReaxCKokkos::ev_tally(EV_FLOAT_REAX &ev, const int &i, cons template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::e_tally(EV_FLOAT_REAX & /*ev*/, const int &i, const int &j, +void PairReaxFFKokkos::e_tally(EV_FLOAT_REAX & /*ev*/, const int &i, const int &j, const F_FLOAT &epair) const { @@ -3461,7 +3461,7 @@ void PairReaxCKokkos::e_tally(EV_FLOAT_REAX & /*ev*/, const int &i, template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::e_tally_single(EV_FLOAT_REAX & /*ev*/, const int &i, +void PairReaxFFKokkos::e_tally_single(EV_FLOAT_REAX & /*ev*/, const int &i, const F_FLOAT &epair) const { // The eatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -3476,7 +3476,7 @@ void PairReaxCKokkos::e_tally_single(EV_FLOAT_REAX & /*ev*/, const i template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::v_tally(EV_FLOAT_REAX &ev, const int &i, +void PairReaxFFKokkos::v_tally(EV_FLOAT_REAX &ev, const int &i, F_FLOAT *fi, F_FLOAT *drij) const { @@ -3512,7 +3512,7 @@ void PairReaxCKokkos::v_tally(EV_FLOAT_REAX &ev, const int &i, template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::v_tally3(EV_FLOAT_REAX &ev, const int &i, const int &j, const int &k, +void PairReaxFFKokkos::v_tally3(EV_FLOAT_REAX &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { @@ -3554,7 +3554,7 @@ void PairReaxCKokkos::v_tally3(EV_FLOAT_REAX &ev, const int &i, cons template template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::v_tally4(EV_FLOAT_REAX &ev, const int &i, const int &j, const int &k, +void PairReaxFFKokkos::v_tally4(EV_FLOAT_REAX &ev, const int &i, const int &j, const int &k, const int &l, F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *dril, F_FLOAT *drjl, F_FLOAT *drkl) const { @@ -3598,7 +3598,7 @@ void PairReaxCKokkos::v_tally4(EV_FLOAT_REAX &ev, const int &i, cons template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::v_tally3_atom(EV_FLOAT_REAX &ev, const int &i, const int & /*j*/, +void PairReaxFFKokkos::v_tally3_atom(EV_FLOAT_REAX &ev, const int &i, const int & /*j*/, const int & /*k*/, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const { @@ -3634,7 +3634,7 @@ void PairReaxCKokkos::v_tally3_atom(EV_FLOAT_REAX &ev, const int &i, ------------------------------------------------------------------------- */ template -void PairReaxCKokkos::ev_setup(int eflag, int vflag, int) +void PairReaxFFKokkos::ev_setup(int eflag, int vflag, int) { int i; @@ -3689,7 +3689,7 @@ void PairReaxCKokkos::ev_setup(int eflag, int vflag, int) /* ---------------------------------------------------------------------- */ template -double PairReaxCKokkos::memory_usage() +double PairReaxFFKokkos::memory_usage() { double bytes = 0.0; @@ -3703,13 +3703,13 @@ double PairReaxCKokkos::memory_usage() bytes += (double)nmax*17*sizeof(F_FLOAT); bytes += (double)maxbo*nmax*34*sizeof(F_FLOAT); - // FixReaxCSpecies + // FixReaxFFSpecies if (fixspecies_flag) { bytes += (double)MAXSPECBOND*nmax*sizeof(tagint); bytes += (double)MAXSPECBOND*nmax*sizeof(F_FLOAT); } - // FixReaxCBonds + // FixReaxFFBonds bytes += (double)maxbo*nmax*sizeof(tagint); bytes += (double)maxbo*nmax*sizeof(F_FLOAT); bytes += (double)nmax*sizeof(int); @@ -3720,7 +3720,7 @@ double PairReaxCKokkos::memory_usage() /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::FindBond(int &numbonds) +void PairReaxFFKokkos::FindBond(int &numbonds) { copymode = 1; Kokkos::parallel_for(Kokkos::RangePolicy(0,nmax),*this); @@ -3735,14 +3735,14 @@ void PairReaxCKokkos::FindBond(int &numbonds) d_ilist = k_list->d_ilist; numbonds = 0; - PairReaxCKokkosFindBondFunctor find_bond_functor(this); + PairReaxFFKokkosFindBondFunctor find_bond_functor(this); Kokkos::parallel_reduce(inum,find_bond_functor,numbonds); copymode = 0; } template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxFindBondZero, const int &i) const { +void PairReaxFFKokkos::operator()(PairReaxFindBondZero, const int &i) const { d_numneigh_bonds[i] = 0; for (int j = 0; j < maxbo; j++) { d_neighid(i,j) = 0; @@ -3752,7 +3752,7 @@ void PairReaxCKokkos::operator()(PairReaxFindBondZero, const int &i) template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::calculate_find_bond_item(int ii, int &numbonds) const +void PairReaxFFKokkos::calculate_find_bond_item(int ii, int &numbonds) const { const int i = d_ilist[ii]; int nj = 0; @@ -3779,7 +3779,7 @@ void PairReaxCKokkos::calculate_find_bond_item(int ii, int &numbonds /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::PackBondBuffer(DAT::tdual_ffloat_1d k_buf, int &nbuf_local) +void PairReaxFFKokkos::PackBondBuffer(DAT::tdual_ffloat_1d k_buf, int &nbuf_local) { d_buf = k_buf.view(); k_params_sing.template sync(); @@ -3793,7 +3793,7 @@ void PairReaxCKokkos::PackBondBuffer(DAT::tdual_ffloat_1d k_buf, int copymode = 1; nlocal = atomKK->nlocal; - PairReaxCKokkosPackBondBufferFunctor pack_bond_buffer_functor(this); + PairReaxFFKokkosPackBondBufferFunctor pack_bond_buffer_functor(this); Kokkos::parallel_scan(nlocal,pack_bond_buffer_functor); copymode = 0; @@ -3807,7 +3807,7 @@ void PairReaxCKokkos::PackBondBuffer(DAT::tdual_ffloat_1d k_buf, int template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::pack_bond_buffer_item(int i, int &j, const bool &final) const +void PairReaxFFKokkos::pack_bond_buffer_item(int i, int &j, const bool &final) const { if (i == 0) j += 2; @@ -3849,7 +3849,7 @@ void PairReaxCKokkos::pack_bond_buffer_item(int i, int &j, const boo /* ---------------------------------------------------------------------- */ template -void PairReaxCKokkos::FindBondSpecies() +void PairReaxFFKokkos::FindBondSpecies() { if (nmax > (int)k_tmpid.extent(0)) { @@ -3877,12 +3877,12 @@ void PairReaxCKokkos::FindBondSpecies() k_error_flag.sync(); if (k_error_flag.h_view()) - error->all(FLERR,"Increase MAXSPECBOND in reaxc_defs.h"); + error->all(FLERR,"Increase MAXSPECBOND in reaxff_defs.h"); } template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxFindBondSpeciesZero, const int &i) const { +void PairReaxFFKokkos::operator()(PairReaxFindBondSpeciesZero, const int &i) const { for (int j = 0; j < MAXSPECBOND; j++) { k_tmpbo.view()(i,j) = 0.0; k_tmpid.view()(i,j) = 0; @@ -3891,7 +3891,7 @@ void PairReaxCKokkos::operator()(PairReaxFindBondSpeciesZero, const template KOKKOS_INLINE_FUNCTION -void PairReaxCKokkos::operator()(PairReaxFindBondSpecies, const int &i) const { +void PairReaxFFKokkos::operator()(PairReaxFindBondSpecies, const int &i) const { int nj = 0; const int j_start = d_bo_first[i]; @@ -3913,8 +3913,8 @@ void PairReaxCKokkos::operator()(PairReaxFindBondSpecies, const int } } -template class PairReaxCKokkos; +template class PairReaxFFKokkos; #ifdef LMP_KOKKOS_GPU -template class PairReaxCKokkos; +template class PairReaxFFKokkos; #endif } diff --git a/src/KOKKOS/pair_reaxc_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h similarity index 86% rename from src/KOKKOS/pair_reaxc_kokkos.h rename to src/KOKKOS/pair_reaxff_kokkos.h index d7457f54fd..08f0911292 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -15,9 +15,12 @@ #ifdef PAIR_CLASS // clang-format off -PairStyle(reax/c/kk,PairReaxCKokkos); -PairStyle(reax/c/kk/device,PairReaxCKokkos); -PairStyle(reax/c/kk/host,PairReaxCKokkos); +PairStyle(reaxff/kk,PairReaxFFKokkos); +PairStyle(reaxff/kk/device,PairReaxFFKokkos); +PairStyle(reaxff/kk/host,PairReaxFFKokkos); +PairStyle(reax/c/kk,PairReaxFFKokkos); +PairStyle(reax/c/kk/device,PairReaxFFKokkos); +PairStyle(reax/c/kk/host,PairReaxFFKokkos); // clang-format on #else @@ -25,7 +28,7 @@ PairStyle(reax/c/kk/host,PairReaxCKokkos); #define LMP_PAIR_REAXC_KOKKOS_H #include "pair_kokkos.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "neigh_list_kokkos.h" #define C_ele 332.06371 @@ -53,13 +56,13 @@ struct LR_lookup_table_kk }; template -struct PairReaxComputePolar{}; +struct PairReaxFFomputePolar{}; template -struct PairReaxComputeLJCoulomb{}; +struct PairReaxFFomputeLJCoulomb{}; template -struct PairReaxComputeTabulatedLJCoulomb{}; +struct PairReaxFFomputeTabulatedLJCoulomb{}; struct PairReaxBuildListsFull{}; @@ -82,25 +85,25 @@ template struct PairReaxUpdateBond{}; template -struct PairReaxComputeBond1{}; +struct PairReaxFFomputeBond1{}; template -struct PairReaxComputeBond2{}; +struct PairReaxFFomputeBond2{}; template -struct PairReaxComputeMulti1{}; +struct PairReaxFFomputeMulti1{}; template -struct PairReaxComputeMulti2{}; +struct PairReaxFFomputeMulti2{}; template -struct PairReaxComputeAngular{}; +struct PairReaxFFomputeAngular{}; template -struct PairReaxComputeTorsion{}; +struct PairReaxFFomputeTorsion{}; template -struct PairReaxComputeHydrogen{}; +struct PairReaxFFomputeHydrogen{}; struct PairReaxFindBondZero{}; @@ -110,7 +113,7 @@ struct PairReaxFindBondSpecies{}; template -class PairReaxCKokkos : public PairReaxC { +class PairReaxFFKokkos : public PairReaxFF { public: enum {EnabledNeighFlags=FULL|HALF|HALFTHREAD}; enum {COUL_FLAG=1}; @@ -118,8 +121,8 @@ class PairReaxCKokkos : public PairReaxC { typedef ArrayTypes AT; typedef EV_FLOAT_REAX value_type; - PairReaxCKokkos(class LAMMPS *); - virtual ~PairReaxCKokkos(); + PairReaxFFKokkos(class LAMMPS *); + virtual ~PairReaxFFKokkos(); void ev_setup(int, int, int alloc = 1); void compute(int, int); @@ -131,27 +134,27 @@ class PairReaxCKokkos : public PairReaxC { template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputePolar, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputePolar, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputePolar, const int&) const; + void operator()(PairReaxFFomputePolar, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeLJCoulomb, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeLJCoulomb, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeLJCoulomb, const int&) const; + void operator()(PairReaxFFomputeLJCoulomb, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeTabulatedLJCoulomb, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeTabulatedLJCoulomb, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeTabulatedLJCoulomb, const int&) const; + void operator()(PairReaxFFomputeTabulatedLJCoulomb, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(PairReaxBuildListsFull, const int&) const; @@ -184,55 +187,55 @@ class PairReaxCKokkos : public PairReaxC { template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeBond1, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeBond1, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeBond1, const int&) const; + void operator()(PairReaxFFomputeBond1, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeBond2, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeBond2, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeBond2, const int&) const; + void operator()(PairReaxFFomputeBond2, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeMulti1, const int&) const; + void operator()(PairReaxFFomputeMulti1, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeMulti2, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeMulti2, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeMulti2, const int&) const; + void operator()(PairReaxFFomputeMulti2, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeAngular, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeAngular, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeAngular, const int&) const; + void operator()(PairReaxFFomputeAngular, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeTorsion, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeTorsion, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeTorsion, const int&) const; + void operator()(PairReaxFFomputeTorsion, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeHydrogen, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFomputeHydrogen, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxComputeHydrogen, const int&) const; + void operator()(PairReaxFFomputeHydrogen, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(PairReaxFindBondZero, const int&) const; @@ -433,7 +436,7 @@ class PairReaxCKokkos : public PairReaxC { int vdwflag, lgflag; F_FLOAT gp[39], p_boc1, p_boc2; - friend void pair_virial_fdotr_compute(PairReaxCKokkos*); + friend void pair_virial_fdotr_compute(PairReaxFFKokkos*); int bocnt,hbcnt,enobondsflag; @@ -458,11 +461,11 @@ class PairReaxCKokkos : public PairReaxC { }; template -struct PairReaxCKokkosFindBondFunctor { +struct PairReaxFFKokkosFindBondFunctor { typedef DeviceType device_type; typedef int value_type; - PairReaxCKokkos c; - PairReaxCKokkosFindBondFunctor(PairReaxCKokkos* c_ptr):c(*c_ptr) {}; + PairReaxFFKokkos c; + PairReaxFFKokkosFindBondFunctor(PairReaxFFKokkos* c_ptr):c(*c_ptr) {}; KOKKOS_INLINE_FUNCTION void join(volatile int &dst, @@ -477,11 +480,11 @@ struct PairReaxCKokkosFindBondFunctor { }; template -struct PairReaxCKokkosPackBondBufferFunctor { +struct PairReaxFFKokkosPackBondBufferFunctor { typedef DeviceType device_type; typedef int value_type; - PairReaxCKokkos c; - PairReaxCKokkosPackBondBufferFunctor(PairReaxCKokkos* c_ptr):c(*c_ptr) {}; + PairReaxFFKokkos c; + PairReaxFFKokkosPackBondBufferFunctor(PairReaxFFKokkos* c_ptr):c(*c_ptr) {}; KOKKOS_INLINE_FUNCTION void operator()(const int ii, int &j, const bool &final) const { diff --git a/src/OPENMP/fix_qeq_reax_omp.cpp b/src/OPENMP/fix_qeq_reaxff_omp.cpp similarity index 92% rename from src/OPENMP/fix_qeq_reax_omp.cpp rename to src/OPENMP/fix_qeq_reaxff_omp.cpp index 4cdab8a6fa..89b75bfe7a 100644 --- a/src/OPENMP/fix_qeq_reax_omp.cpp +++ b/src/OPENMP/fix_qeq_reaxff_omp.cpp @@ -18,11 +18,11 @@ Hybrid & sub-group capabilities added by Ray Shan (Materials Design) - OpenMP based threading support for fix qeq/reax/omp added + OpenMP based threading support for fix qeq/reaxff/omp added by Hasan Metin Aktulga (MSU), Chris Knight (ALCF), Paul Coffman (ALCF), Kurt O'Hearn (MSU), Ray Shan (Materials Design), Wei Jiang (ALCF) - Integration of the pair_style reax/c/omp into the OPENMP package + Integration of the pair_style reaxff/omp into the OPENMP package by Axel Kohlmeyer (Temple U.) Please cite the related publication: @@ -32,7 +32,7 @@ High Performance Computing Applications, to appear. ------------------------------------------------------------------------- */ -#include "fix_qeq_reax_omp.h" +#include "fix_qeq_reaxff_omp.h" #include "atom.h" #include "comm.h" @@ -41,7 +41,7 @@ #include "neigh_list.h" #include "update.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "reaxff_defs.h" #include @@ -55,8 +55,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : - FixQEqReax(lmp, narg, arg) +FixQEqReaxFFOMP::FixQEqReaxFFOMP(LAMMPS *lmp, int narg, char **arg) : + FixQEqReaxFF(lmp, narg, arg) { b_temp = nullptr; @@ -69,14 +69,14 @@ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : aspc_b = nullptr; } -FixQEqReaxOMP::~FixQEqReaxOMP() +FixQEqReaxFFOMP::~FixQEqReaxFFOMP() { memory->destroy(b_temp); } /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::post_constructor() +void FixQEqReaxFFOMP::post_constructor() { grow_arrays(atom->nmax); for (int i = 0; i < atom->nmax; i++) @@ -88,34 +88,34 @@ void FixQEqReaxOMP::post_constructor() /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::allocate_storage() +void FixQEqReaxFFOMP::allocate_storage() { - FixQEqReax::allocate_storage(); + FixQEqReaxFF::allocate_storage(); // dual CG support int size = nmax; if (dual_enabled) size*= 2; - memory->create(b_temp, comm->nthreads, size, "qeq/reax/omp:b_temp"); + memory->create(b_temp, comm->nthreads, size, "qeq/reaxff/omp:b_temp"); } /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::deallocate_storage() +void FixQEqReaxFFOMP::deallocate_storage() { memory->destroy(b_temp); - FixQEqReax::deallocate_storage(); + FixQEqReaxFF::deallocate_storage(); } /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::init() +void FixQEqReaxFFOMP::init() { - FixQEqReax::init(); + FixQEqReaxFF::init(); // APSC setup if (do_aspc) { - memory->create(aspc_b, aspc_order_max+2, "qeq/reax/aspc_b"); + memory->create(aspc_b, aspc_order_max+2, "qeq/reaxff/aspc_b"); // Calculate damping factor double o = double(aspc_order); @@ -144,7 +144,7 @@ void FixQEqReaxOMP::init() /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::compute_H() +void FixQEqReaxFFOMP::compute_H() { double SMALL = 0.0001; @@ -224,13 +224,13 @@ void FixQEqReaxOMP::compute_H() } // omp if (m_fill >= H.m) - error->all(FLERR,fmt::format("Fix qeq/reax: H matrix size has been " + error->all(FLERR,fmt::format("Fix qeq/reaxff: H matrix size has been " "exceeded: m_fill={} H.m={}\n", m_fill, H.m)); } /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::init_storage() +void FixQEqReaxFFOMP::init_storage() { #if defined(_OPENMP) #pragma omp parallel for schedule(static) @@ -247,18 +247,18 @@ void FixQEqReaxOMP::init_storage() /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::pre_force(int /* vflag */) +void FixQEqReaxFFOMP::pre_force(int /* vflag */) { if (update->ntimestep % nevery) return; int n = atom->nlocal; - if (reaxc) { - nn = reaxc->list->inum; - NN = reaxc->list->inum + reaxc->list->gnum; - ilist = reaxc->list->ilist; - numneigh = reaxc->list->numneigh; - firstneigh = reaxc->list->firstneigh; + if (reaxff) { + nn = reaxff->list->inum; + NN = reaxff->list->inum + reaxff->list->gnum; + ilist = reaxff->list->ilist; + numneigh = reaxff->list->numneigh; + firstneigh = reaxff->list->firstneigh; } else { nn = list->inum; NN = list->inum + list->gnum; @@ -289,7 +289,7 @@ void FixQEqReaxOMP::pre_force(int /* vflag */) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::init_matvec() +void FixQEqReaxFFOMP::init_matvec() { /* fill-in H matrix */ compute_H(); @@ -363,7 +363,7 @@ void FixQEqReaxOMP::init_matvec() /* ---------------------------------------------------------------------- */ -int FixQEqReaxOMP::CG(double *b, double *x) +int FixQEqReaxFFOMP::CG(double *b, double *x) { int i; double alpha, beta, b_norm; @@ -464,7 +464,7 @@ int FixQEqReaxOMP::CG(double *b, double *x) } if ((i >= imax) && maxwarn && (comm->me == 0)) - error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " + error->warning(FLERR,fmt::format("Fix qeq/reaxff/omp CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); return i; @@ -472,7 +472,7 @@ int FixQEqReaxOMP::CG(double *b, double *x) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::sparse_matvec(sparse_matrix *A, double *x, double *b) +void FixQEqReaxFFOMP::sparse_matvec(sparse_matrix *A, double *x, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) @@ -539,7 +539,7 @@ void FixQEqReaxOMP::sparse_matvec(sparse_matrix *A, double *x, double *b) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::calculate_Q() +void FixQEqReaxFFOMP::calculate_Q() { int i; double *q = atom->q; @@ -592,7 +592,7 @@ void FixQEqReaxOMP::calculate_Q() /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::vector_sum(double* dest, double c, double* v, +void FixQEqReaxFFOMP::vector_sum(double* dest, double c, double* v, double d, double* y, int k) { int i; @@ -608,7 +608,7 @@ void FixQEqReaxOMP::vector_sum(double* dest, double c, double* v, /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::vector_add(double* dest, double c, double* v, int k) +void FixQEqReaxFFOMP::vector_add(double* dest, double c, double* v, int k) { int i; @@ -627,7 +627,7 @@ void FixQEqReaxOMP::vector_add(double* dest, double c, double* v, int k) /* dual CG support */ /* ---------------------------------------------------------------------- */ -int FixQEqReaxOMP::dual_CG(double *b1, double *b2, double *x1, double *x2) +int FixQEqReaxFFOMP::dual_CG(double *b1, double *b2, double *x1, double *x2) { int i; double alpha_s, alpha_t, beta_s, beta_t, b_norm_s, b_norm_t; @@ -791,7 +791,7 @@ int FixQEqReaxOMP::dual_CG(double *b1, double *b2, double *x1, double *x2) } if ((i >= imax) && maxwarn && (comm->me == 0)) - error->warning(FLERR,fmt::format("Fix qeq/reax/omp CG convergence failed " + error->warning(FLERR,fmt::format("Fix qeq/reaxff/omp CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); return matvecs_s + matvecs_t; @@ -799,7 +799,7 @@ int FixQEqReaxOMP::dual_CG(double *b1, double *b2, double *x1, double *x2) /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::dual_sparse_matvec(sparse_matrix *A, double *x1, double *x2, double *b) +void FixQEqReaxFFOMP::dual_sparse_matvec(sparse_matrix *A, double *x1, double *x2, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) @@ -890,7 +890,7 @@ void FixQEqReaxOMP::dual_sparse_matvec(sparse_matrix *A, double *x1, double *x2, /* ---------------------------------------------------------------------- */ -void FixQEqReaxOMP::dual_sparse_matvec(sparse_matrix *A, double *x, double *b) +void FixQEqReaxFFOMP::dual_sparse_matvec(sparse_matrix *A, double *x, double *b) { #if defined(_OPENMP) #pragma omp parallel default(shared) diff --git a/src/OPENMP/fix_qeq_reax_omp.h b/src/OPENMP/fix_qeq_reaxff_omp.h similarity index 84% rename from src/OPENMP/fix_qeq_reax_omp.h rename to src/OPENMP/fix_qeq_reaxff_omp.h index 62855a6f78..b99034edf0 100644 --- a/src/OPENMP/fix_qeq_reax_omp.h +++ b/src/OPENMP/fix_qeq_reaxff_omp.h @@ -13,22 +13,23 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(qeq/reax/omp,FixQEqReaxOMP); +FixStyle(qeq/reaxff/omp,FixQEqReaxFFOMP); +FixStyle(qeq/reax/omp,FixQEqReaxFFOMP); // clang-format on #else -#ifndef LMP_FIX_QEQ_REAX_OMP_H -#define LMP_FIX_QEQ_REAX_OMP_H +#ifndef LMP_FIX_QEQ_REAXFF_OMP_H +#define LMP_FIX_QEQ_REAXFF_OMP_H -#include "fix_qeq_reax.h" +#include "fix_qeq_reaxff.h" namespace LAMMPS_NS { -class FixQEqReaxOMP : public FixQEqReax { +class FixQEqReaxFFOMP : public FixQEqReaxFF { public: - FixQEqReaxOMP(class LAMMPS *, int, char **); - ~FixQEqReaxOMP(); + FixQEqReaxFFOMP(class LAMMPS *, int, char **); + ~FixQEqReaxFFOMP(); virtual void init(); virtual void init_storage(); virtual void pre_force(int); diff --git a/src/OPENMP/pair_reaxc_omp.cpp b/src/OPENMP/pair_reaxff_omp.cpp similarity index 88% rename from src/OPENMP/pair_reaxc_omp.cpp rename to src/OPENMP/pair_reaxff_omp.cpp index b65c9a391f..48fa9e8312 100644 --- a/src/OPENMP/pair_reaxc_omp.cpp +++ b/src/OPENMP/pair_reaxff_omp.cpp @@ -17,14 +17,14 @@ Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu Per-atom energy/virial added by Ray Shan (Materials Design, Inc.) - Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added + Fix reaxff/bonds and fix reaxff/species for pair_style reaxff added by Ray Shan (Materials Design) - OpenMP based threading support for pair_style reax/c/omp added + OpenMP based threading support for pair_style reaxff/omp added by Hasan Metin Aktulga (MSU), Chris Knight (ALCF), Paul Coffman (ALCF), Kurt O'Hearn (MSU), Ray Shan (Materials Design), Wei Jiang (ALCF) - Integration of the pair_style reax/c/omp into the OPENMP package + Integration of the pair_style reaxff/omp into the OPENMP package by Axel Kohlmeyer (Temple U.) Please cite the related publication: @@ -34,13 +34,13 @@ High Performance Computing Applications, to appear. ------------------------------------------------------------------------- */ -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "atom.h" #include "citeme.h" #include "comm.h" #include "error.h" -#include "fix_reaxc.h" +#include "fix_reaxff.h" #include "force.h" #include "memory.h" #include "modify.h" @@ -62,8 +62,8 @@ using namespace LAMMPS_NS; using namespace ReaxFF; -static const char cite_pair_reax_c_omp[] = - "pair reax/c/omp and fix qeq/reax/omp command:\n\n" +static const char cite_pair_reaxff_omp[] = + "pair reaxff/omp and fix qeq/reaxff/omp command:\n\n" "@Article{Aktulga17,\n" " author = {H. M. Aktulga, C. Knight, P. Coffman, K. A. OHearn, T. R. Shan, W. Jiang},\n" " title = {Optimizing the performance of reactive molecular dynamics simulations for multi-core architectures},\n" @@ -73,9 +73,9 @@ static const char cite_pair_reax_c_omp[] = /* ---------------------------------------------------------------------- */ -PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) +PairReaxFFOMP::PairReaxFFOMP(LAMMPS *lmp) : PairReaxFF(lmp), ThrOMP(lmp, THR_PAIR) { - if (lmp->citeme) lmp->citeme->add(cite_pair_reax_c_omp); + if (lmp->citeme) lmp->citeme->add(cite_pair_reaxff_omp); suffix_flag |= Suffix::OMP; api->system->pair_ptr = this; @@ -86,7 +86,7 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) /* ---------------------------------------------------------------------- */ -PairReaxCOMP::~PairReaxCOMP() +PairReaxFFOMP::~PairReaxFFOMP() { if (setup_flag) { reax_list * bonds = api->lists+BONDS; @@ -98,15 +98,15 @@ PairReaxCOMP::~PairReaxCOMP() /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::init_style() +void PairReaxFFOMP::init_style() { if (!atom->q_flag) - error->all(FLERR,"Pair style reax/c/omp requires atom attribute q"); + error->all(FLERR,"Pair style reaxff/omp requires atom attribute q"); bool have_qeq = ((modify->find_fix_by_style("^qeq/reax") != -1) || (modify->find_fix_by_style("^qeq/shielded") != -1)); if (!have_qeq && qeqflag == 1) - error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); + error->all(FLERR,"Pair reaxff/omp requires use of fix qeq/reaxff or qeq/shielded"); api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts @@ -114,14 +114,14 @@ void PairReaxCOMP::init_style() api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) - error->all(FLERR,"Pair style reax/c/omp requires atom IDs"); + error->all(FLERR,"Pair style reaxff/omp requires atom IDs"); if (force->newton_pair == 0) - error->all(FLERR,"Pair style reax/c/omp requires newton pair on"); + error->all(FLERR,"Pair style reaxff/omp requires newton pair on"); // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT if (atom->natoms > MAXSMALLINT) - error->all(FLERR,"Too many atoms for pair style reax/c/omp"); + error->all(FLERR,"Too many atoms for pair style reaxff/omp"); // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs @@ -135,9 +135,9 @@ void PairReaxCOMP::init_style() error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - if (fix_reax == nullptr) { - modify->add_fix(fmt::format("{} all REAXC",fix_id)); - fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; + if (fix_reaxff == nullptr) { + modify->add_fix(fmt::format("{} all REAXFF",fix_id)); + fix_reaxff = (FixReaxFF *) modify->fix[modify->nfix-1]; } api->control->nthreads = comm->nthreads; @@ -145,7 +145,7 @@ void PairReaxCOMP::init_style() /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::setup() +void PairReaxFFOMP::setup() { int oldN; int mincap = api->system->mincap; @@ -166,8 +166,8 @@ void PairReaxCOMP::setup() setup_flag = 1; - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; // determine the local and total capacity @@ -183,7 +183,7 @@ void PairReaxCOMP::setup() int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) - error->all(FLERR,"Too many neighbors for pair style reax/c"); + error->all(FLERR,"Too many neighbors for pair style reaxff"); Make_List(api->system->total_cap,num_nbrs,TYP_FAR_NEIGHBOR,api->lists+FAR_NBRS); (api->lists+FAR_NBRS)->error_ptr=error; @@ -219,16 +219,16 @@ void PairReaxCOMP::setup() /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::compute(int eflag, int vflag) +void PairReaxFFOMP::compute(int eflag, int vflag) { double evdwl,ecoul; // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them - if (neighbor->ago == 0) comm->forward_comm_fix(fix_reax); - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + if (neighbor->ago == 0) comm->forward_comm_fix(fix_reaxff); + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; evdwl = ecoul = 0.0; ev_init(eflag,vflag); @@ -304,7 +304,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) api->data->step = update->ntimestep; - // populate tmpid and tmpbo arrays for fix reax/c/species + // populate tmpid and tmpbo arrays for fix reaxff/species if (fixspecies_flag) { if (api->system->N > nmax) { @@ -330,10 +330,10 @@ void PairReaxCOMP::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::write_reax_atoms() +void PairReaxFFOMP::write_reax_atoms() { - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; if (api->system->N > api->system->total_cap) error->all(FLERR,"Too many ghost atoms"); @@ -355,7 +355,7 @@ void PairReaxCOMP::write_reax_atoms() /* ---------------------------------------------------------------------- */ -int PairReaxCOMP::estimate_reax_lists() +int PairReaxFFOMP::estimate_reax_lists() { int i; int *ilist = list->ilist; @@ -384,7 +384,7 @@ int PairReaxCOMP::estimate_reax_lists() /* ---------------------------------------------------------------------- */ -int PairReaxCOMP::write_reax_lists() +int PairReaxFFOMP::write_reax_lists() { int itr_i, itr_j, i, j, num_mynbrs; int *jlist; @@ -450,7 +450,7 @@ int PairReaxCOMP::write_reax_lists() /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::read_reax_forces(int /* vflag */) +void PairReaxFFOMP::read_reax_forces(int /* vflag */) { #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) @@ -468,7 +468,7 @@ void PairReaxCOMP::read_reax_forces(int /* vflag */) /* ---------------------------------------------------------------------- */ -void PairReaxCOMP::FindBond() +void PairReaxFFOMP::FindBond() { const double bo_cut = 0.10; @@ -492,7 +492,7 @@ void PairReaxCOMP::FindBond() tmpid[i][nj] = j; tmpbo[i][nj] = bo_tmp; nj ++; - if (nj > MAXSPECBOND) error->all(FLERR,"Increase MAXSPECBOND in fix_reaxc_species.h"); + if (nj > MAXSPECBOND) error->all(FLERR,"Increase MAXSPECBOND in fix_reaxff_species.h"); } } } diff --git a/src/OPENMP/pair_reaxc_omp.h b/src/OPENMP/pair_reaxff_omp.h similarity index 92% rename from src/OPENMP/pair_reaxc_omp.h rename to src/OPENMP/pair_reaxff_omp.h index 81d1c35b0e..cced5861be 100644 --- a/src/OPENMP/pair_reaxc_omp.h +++ b/src/OPENMP/pair_reaxff_omp.h @@ -13,22 +13,23 @@ #ifdef PAIR_CLASS // clang-format off -PairStyle(reax/c/omp,PairReaxCOMP); +PairStyle(reaxff/omp,PairReaxFFOMP); +PairStyle(reax/c/omp,PairReaxFFOMP); // clang-format on #else -#ifndef LMP_PAIR_REAXC_OMP_H -#define LMP_PAIR_REAXC_OMP_H +#ifndef LMP_PAIR_REAXFF_OMP_H +#define LMP_PAIR_REAXFF_OMP_H -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "thr_omp.h" namespace LAMMPS_NS { -class PairReaxCOMP : public PairReaxC, public ThrOMP { +class PairReaxFFOMP : public PairReaxFF, public ThrOMP { public: - PairReaxCOMP(class LAMMPS *); - ~PairReaxCOMP(); + PairReaxFFOMP(class LAMMPS *); + ~PairReaxFFOMP(); virtual void compute(int, int); virtual void init_style(); @@ -120,7 +121,7 @@ class PairReaxCOMP : public PairReaxC, public ThrOMP { E: Too many ghost atoms Number of ghost atoms has increased too much during simulation and has exceeded -the size of reax/c arrays. Increase safe_zone and min_cap in pair_style reax/c +the size of reaxff arrays. Increase safe_zone and min_cap in pair_style reaxff command */ diff --git a/src/OPENMP/reaxc_bond_orders_omp.cpp b/src/OPENMP/reaxff_bond_orders_omp.cpp similarity index 98% rename from src/OPENMP/reaxc_bond_orders_omp.cpp rename to src/OPENMP/reaxff_bond_orders_omp.cpp index 3e419792d9..2fe68280d1 100644 --- a/src/OPENMP/reaxc_bond_orders_omp.cpp +++ b/src/OPENMP/reaxff_bond_orders_omp.cpp @@ -29,7 +29,7 @@ #include "reaxff_omp.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" #include @@ -45,7 +45,7 @@ namespace ReaxFF { dbond_coefficients coef; int pk, k, j; - PairReaxCOMP *pair_reax_ptr = static_cast(system->pair_ptr); + PairReaxFFOMP *pair_reax_ptr = static_cast(system->pair_ptr); int tid = get_tid(); ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); @@ -173,7 +173,7 @@ namespace ReaxFF { j = nbr_pj->nbr; rr2 = 1.0 / SQR(nbr_pj->d); - // Top portion of BOp() moved to reaxc_forces_omp.cpp::Init_Forces_noQEq_OMP() + // Top portion of BOp() moved to reaxff_forces_omp.cpp::Init_Forces_noQEq_OMP() /* Initially BO values are the uncorrected ones, page 1 */ diff --git a/src/OPENMP/reaxc_bonds_omp.cpp b/src/OPENMP/reaxff_bonds_omp.cpp similarity index 97% rename from src/OPENMP/reaxc_bonds_omp.cpp rename to src/OPENMP/reaxff_bonds_omp.cpp index 784af432cc..1a97f2a6af 100644 --- a/src/OPENMP/reaxc_bonds_omp.cpp +++ b/src/OPENMP/reaxff_bonds_omp.cpp @@ -28,7 +28,7 @@ #include "reaxff_omp.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" #include @@ -67,8 +67,8 @@ namespace ReaxFF { int tid = get_tid(); long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, diff --git a/src/OPENMP/reaxc_forces_omp.cpp b/src/OPENMP/reaxff_forces_omp.cpp similarity index 99% rename from src/OPENMP/reaxc_forces_omp.cpp rename to src/OPENMP/reaxff_forces_omp.cpp index 26f36f1357..77106a5e44 100644 --- a/src/OPENMP/reaxc_forces_omp.cpp +++ b/src/OPENMP/reaxff_forces_omp.cpp @@ -31,7 +31,7 @@ #include "error.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" @@ -90,8 +90,8 @@ namespace ReaxFF { int tid = get_tid(); bond_order_data *bo_jk; - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, diff --git a/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp similarity index 98% rename from src/OPENMP/reaxc_hydrogen_bonds_omp.cpp rename to src/OPENMP/reaxff_hydrogen_bonds_omp.cpp index 1b174aef81..64bbbf56b1 100644 --- a/src/OPENMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp @@ -30,7 +30,7 @@ #include "reaxff_omp.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" @@ -87,8 +87,8 @@ namespace ReaxFF { long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); diff --git a/src/OPENMP/reaxc_init_md_omp.cpp b/src/OPENMP/reaxff_init_md_omp.cpp similarity index 100% rename from src/OPENMP/reaxc_init_md_omp.cpp rename to src/OPENMP/reaxff_init_md_omp.cpp diff --git a/src/OPENMP/reaxc_multi_body_omp.cpp b/src/OPENMP/reaxff_multi_body_omp.cpp similarity index 98% rename from src/OPENMP/reaxc_multi_body_omp.cpp rename to src/OPENMP/reaxff_multi_body_omp.cpp index 6b7a7c76f4..17b93d7487 100644 --- a/src/OPENMP/reaxc_multi_body_omp.cpp +++ b/src/OPENMP/reaxff_multi_body_omp.cpp @@ -30,7 +30,7 @@ #include "reaxff_omp.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" @@ -84,8 +84,8 @@ namespace ReaxFF { int tid = get_tid(); long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) diff --git a/src/OPENMP/reaxc_nonbonded_omp.cpp b/src/OPENMP/reaxff_nonbonded_omp.cpp similarity index 97% rename from src/OPENMP/reaxc_nonbonded_omp.cpp rename to src/OPENMP/reaxff_nonbonded_omp.cpp index 595731b005..a57542f550 100644 --- a/src/OPENMP/reaxc_nonbonded_omp.cpp +++ b/src/OPENMP/reaxff_nonbonded_omp.cpp @@ -29,7 +29,7 @@ #include "reaxff_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" #include @@ -72,8 +72,8 @@ namespace ReaxFF { long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); e_core = 0; @@ -254,8 +254,8 @@ namespace ReaxFF { long froffset = (system->N * tid); LR_lookup_table ** & LR = system->LR; - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) diff --git a/src/OPENMP/reaxc_torsion_angles_omp.cpp b/src/OPENMP/reaxff_torsion_angles_omp.cpp similarity index 99% rename from src/OPENMP/reaxc_torsion_angles_omp.cpp rename to src/OPENMP/reaxff_torsion_angles_omp.cpp index 83f49e96de..648603b143 100644 --- a/src/OPENMP/reaxc_torsion_angles_omp.cpp +++ b/src/OPENMP/reaxff_torsion_angles_omp.cpp @@ -30,7 +30,7 @@ #include "reaxff_omp.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" #include @@ -100,8 +100,8 @@ namespace ReaxFF { int tid = get_tid(); long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); #if defined(_OPENMP) diff --git a/src/OPENMP/reaxc_valence_angles_omp.cpp b/src/OPENMP/reaxff_valence_angles_omp.cpp similarity index 99% rename from src/OPENMP/reaxc_valence_angles_omp.cpp rename to src/OPENMP/reaxff_valence_angles_omp.cpp index ed457c96fe..423b6336df 100644 --- a/src/OPENMP/reaxc_valence_angles_omp.cpp +++ b/src/OPENMP/reaxff_valence_angles_omp.cpp @@ -31,7 +31,7 @@ #include "error.h" #include "fix_omp.h" -#include "pair_reaxc_omp.h" +#include "pair_reaxff_omp.h" #include "reaxff_api.h" #include @@ -154,8 +154,8 @@ namespace ReaxFF { int tid = get_tid(); long reductionOffset = (system->N * tid); - class PairReaxCOMP *pair_reax_ptr; - pair_reax_ptr = static_cast(system->pair_ptr); + class PairReaxFFOMP *pair_reax_ptr; + pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); // Run through a minimal for (jpair_match("^reax/c",0); - if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); + Pair *pair = force->pair_match("^reax..",0); + if (pair == nullptr) error->all(FLERR,"No pair reaxff for fix qeq/shielded"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); if (chi == nullptr || eta == nullptr || gamma == nullptr) - error->all(FLERR, - "Fix qeq/slater could not extract params from pair reax/c"); + error->all(FLERR, "Fix qeq/shielded could not extract params from pair reaxff"); } diff --git a/src/REAXFF/README b/src/REAXFF/README index 485a56785e..528b782932 100644 --- a/src/REAXFF/README +++ b/src/REAXFF/README @@ -4,16 +4,6 @@ represent the contributions of chemical bonding to the potential energy. It was originally developed by Adri van Duin and the Goddard group at CalTech. -The REAXFF version of ReaxFF (pair_style reax/c), implemented in -C, should give identical or very similar results to pair_style reax, -which is a ReaxFF implementation on top of a Fortran library, a -version of which library was originally authored by Adri van Duin. - -The reax/c version should be somewhat faster and more scalable, -particularly with respect to the charge equilibration calculation. It -should also be easier to build and use since there are no complicating -issues with Fortran memory allocation or linking to a Fortran library. - For technical details about this implementation of ReaxFF, see this paper: @@ -21,7 +11,7 @@ Parallel and Scalable Reactive Molecular Dynamics: Numerical Methods and Algorithmic Techniques, H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, Parallel Computing, in press (2011). -See the doc page for the pair_style reax/c command for details +See the doc page for the pair_style reaxff command for details of how to use it in LAMMPS. The person who created this package is Hasan Metin Aktulga (hmaktulga diff --git a/src/REAXFF/compute_spec_atom.cpp b/src/REAXFF/compute_spec_atom.cpp index 1381f2cf96..66886cd1e2 100644 --- a/src/REAXFF/compute_spec_atom.cpp +++ b/src/REAXFF/compute_spec_atom.cpp @@ -13,13 +13,15 @@ ------------------------------------------------------------------------- */ #include "compute_spec_atom.h" -#include + #include "atom.h" -#include "update.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -30,15 +32,15 @@ enum{KEYWORD,COMPUTE,FIX,VARIABLE}; ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR,"Illegal compute reax/c/atom command"); + if (narg < 4) error->all(FLERR,"Illegal compute spec/atom command"); peratom_flag = 1; nvalues = narg - 3; if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - // Initiate reaxc - reaxc = (PairReaxC *) force->pair_match("reax/c",0); + // get reference to ReaxFF pair style + reaxff = (PairReaxFF *) force->pair_match("^reax..",0); pack_choice = new FnPtrPack[nvalues]; @@ -64,7 +66,7 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"vz") == 0) { pack_choice[i] = &ComputeSpecAtom::pack_vz; - // from pair_reaxc + // from pair_reaxff } else if (strcmp(arg[iarg],"abo01") == 0) { pack_choice[i] = &ComputeSpecAtom::pack_abo01; } else if (strcmp(arg[iarg],"abo02") == 0) { @@ -114,7 +116,7 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"abo24") == 0) { pack_choice[i] = &ComputeSpecAtom::pack_abo24; - } else error->all(FLERR,"Invalid keyword in compute reax/c/atom command"); + } else error->all(FLERR,"Invalid keyword in compute spec/atom command"); } nmax = 0; @@ -310,7 +312,7 @@ void ComputeSpecAtom::pack_abo01(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][0]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][0]; else buf[n] = 0.0; n += nvalues; } @@ -324,7 +326,7 @@ void ComputeSpecAtom::pack_abo02(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][1]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][1]; else buf[n] = 0.0; n += nvalues; } @@ -338,7 +340,7 @@ void ComputeSpecAtom::pack_abo03(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][2]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][2]; else buf[n] = 0.0; n += nvalues; } @@ -352,7 +354,7 @@ void ComputeSpecAtom::pack_abo04(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][3]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][3]; else buf[n] = 0.0; n += nvalues; } @@ -366,7 +368,7 @@ void ComputeSpecAtom::pack_abo05(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][4]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][4]; else buf[n] = 0.0; n += nvalues; } @@ -380,7 +382,7 @@ void ComputeSpecAtom::pack_abo06(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][5]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][5]; else buf[n] = 0.0; n += nvalues; } @@ -394,7 +396,7 @@ void ComputeSpecAtom::pack_abo07(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][6]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][6]; else buf[n] = 0.0; n += nvalues; } @@ -408,7 +410,7 @@ void ComputeSpecAtom::pack_abo08(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][7]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][7]; else buf[n] = 0.0; n += nvalues; } @@ -422,7 +424,7 @@ void ComputeSpecAtom::pack_abo09(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][8]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][8]; else buf[n] = 0.0; n += nvalues; } @@ -436,7 +438,7 @@ void ComputeSpecAtom::pack_abo10(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][9]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][9]; else buf[n] = 0.0; n += nvalues; } @@ -450,7 +452,7 @@ void ComputeSpecAtom::pack_abo11(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][10]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][10]; else buf[n] = 0.0; n += nvalues; } @@ -464,7 +466,7 @@ void ComputeSpecAtom::pack_abo12(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][11]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][11]; else buf[n] = 0.0; n += nvalues; } @@ -478,7 +480,7 @@ void ComputeSpecAtom::pack_abo13(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][12]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][12]; else buf[n] = 0.0; n += nvalues; } @@ -492,7 +494,7 @@ void ComputeSpecAtom::pack_abo14(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][13]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][13]; else buf[n] = 0.0; n += nvalues; } @@ -506,7 +508,7 @@ void ComputeSpecAtom::pack_abo15(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][14]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][14]; else buf[n] = 0.0; n += nvalues; } @@ -520,7 +522,7 @@ void ComputeSpecAtom::pack_abo16(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][15]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][15]; else buf[n] = 0.0; n += nvalues; } @@ -534,7 +536,7 @@ void ComputeSpecAtom::pack_abo17(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][16]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][16]; else buf[n] = 0.0; n += nvalues; } @@ -548,7 +550,7 @@ void ComputeSpecAtom::pack_abo18(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][17]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][17]; else buf[n] = 0.0; n += nvalues; } @@ -562,7 +564,7 @@ void ComputeSpecAtom::pack_abo19(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][18]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][18]; else buf[n] = 0.0; n += nvalues; } @@ -576,7 +578,7 @@ void ComputeSpecAtom::pack_abo20(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][19]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][19]; else buf[n] = 0.0; n += nvalues; } @@ -590,7 +592,7 @@ void ComputeSpecAtom::pack_abo21(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][20]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][20]; else buf[n] = 0.0; n += nvalues; } @@ -604,7 +606,7 @@ void ComputeSpecAtom::pack_abo22(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][21]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][21]; else buf[n] = 0.0; n += nvalues; } @@ -618,7 +620,7 @@ void ComputeSpecAtom::pack_abo23(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][22]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][22]; else buf[n] = 0.0; n += nvalues; } @@ -632,7 +634,7 @@ void ComputeSpecAtom::pack_abo24(int n) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = reaxc->tmpbo[i][23]; + if (mask[i] & groupbit) buf[n] = reaxff->tmpbo[i][23]; else buf[n] = 0.0; n += nvalues; } diff --git a/src/REAXFF/compute_spec_atom.h b/src/REAXFF/compute_spec_atom.h index ce4ce5b1cc..61dd63e272 100644 --- a/src/REAXFF/compute_spec_atom.h +++ b/src/REAXFF/compute_spec_atom.h @@ -75,7 +75,7 @@ class ComputeSpecAtom : public Compute { void pack_abo23(int); void pack_abo24(int); - class PairReaxC *reaxc; + class PairReaxFF *reaxff; }; } diff --git a/src/REAXFF/fix_qeq_reax.cpp b/src/REAXFF/fix_qeq_reaxff.cpp similarity index 83% rename from src/REAXFF/fix_qeq_reax.cpp rename to src/REAXFF/fix_qeq_reaxff.cpp index 2591813534..fd197a156a 100644 --- a/src/REAXFF/fix_qeq_reax.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -19,7 +19,7 @@ Hybrid and sub-group capabilities: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "fix_qeq_reax.h" +#include "fix_qeq_reaxff.h" #include "atom.h" #include "citeme.h" @@ -37,7 +37,7 @@ #include "tokenizer.h" #include "update.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "reaxff_api.h" #include @@ -57,8 +57,8 @@ public: #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) -static const char cite_fix_qeq_reax[] = - "fix qeq/reax command:\n\n" +static const char cite_fix_qeq_reaxff[] = + "fix qeq/reaxff command:\n\n" "@Article{Aktulga12,\n" " author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama},\n" " title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques},\n" @@ -70,7 +70,7 @@ static const char cite_fix_qeq_reax[] = /* ---------------------------------------------------------------------- */ -FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : +FixQEqReaxFF::FixQEqReaxFF(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), matvecs(0), pertype_option(nullptr) { scalar_flag = 1; @@ -78,10 +78,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : imax = 200; maxwarn = 1; - if ((narg < 8) || (narg > 12)) error->all(FLERR,"Illegal fix qeq/reax command"); + if ((narg < 8) || (narg > 12)) error->all(FLERR,"Illegal fix qeq/reaxff command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix qeq/reax command"); + if (nevery <= 0) error->all(FLERR,"Illegal fix qeq/reaxff command"); swa = utils::numeric(FLERR,arg[4],false,lmp); swb = utils::numeric(FLERR,arg[5],false,lmp); @@ -99,10 +99,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg],"nowarn") == 0) maxwarn = 0; else if (strcmp(arg[iarg],"maxiter") == 0) { if (iarg+1 > narg-1) - error->all(FLERR,"Illegal fix qeq/reax command"); + error->all(FLERR,"Illegal fix qeq/reaxff command"); imax = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg++; - } else error->all(FLERR,"Illegal fix qeq/reax command"); + } else error->all(FLERR,"Illegal fix qeq/reaxff command"); iarg++; } shld = nullptr; @@ -144,7 +144,7 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - reaxc = (PairReaxC *) force->pair_match("^reax/c",0); + reaxff = (PairReaxFF *) force->pair_match("^reax..",0); s_hist = t_hist = nullptr; atom->add_callback(Atom::GROW); @@ -152,7 +152,7 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixQEqReax::~FixQEqReax() +FixQEqReaxFF::~FixQEqReaxFF() { if (copymode) return; @@ -179,9 +179,9 @@ FixQEqReax::~FixQEqReax() /* ---------------------------------------------------------------------- */ -void FixQEqReax::post_constructor() +void FixQEqReaxFF::post_constructor() { - if (lmp->citeme) lmp->citeme->add(cite_fix_qeq_reax); + if (lmp->citeme) lmp->citeme->add(cite_fix_qeq_reaxff); grow_arrays(atom->nmax); for (int i = 0; i < atom->nmax; i++) @@ -190,12 +190,12 @@ void FixQEqReax::post_constructor() pertype_parameters(pertype_option); if (dual_enabled) - error->all(FLERR,"Dual keyword only supported with fix qeq/reax/omp"); + error->all(FLERR,"Dual keyword only supported with fix qeq/reaxff/omp"); } /* ---------------------------------------------------------------------- */ -int FixQEqReax::setmask() +int FixQEqReaxFF::setmask() { int mask = 0; mask |= PRE_FORCE; @@ -206,47 +206,47 @@ int FixQEqReax::setmask() /* ---------------------------------------------------------------------- */ -void FixQEqReax::pertype_parameters(char *arg) +void FixQEqReaxFF::pertype_parameters(char *arg) { - if (strcmp(arg,"reax/c") == 0) { + // match either new keyword "reaxff" or old keyword "reax/c" + if (utils::strmatch(arg,"^reax..$")) { reaxflag = 1; - Pair *pair = force->pair_match("^reax/c",0); - if (!pair) error->all(FLERR,"No reax/c pair style for fix qeq/reax"); + Pair *pair = force->pair_match("^reax..",0); + if (!pair) error->all(FLERR,"No reaxff pair style for fix qeq/reaxff"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); if (chi == nullptr || eta == nullptr || gamma == nullptr) - error->all(FLERR, - "Fix qeq/reax could not extract params from pair reax/c"); + error->all(FLERR, "Fix qeq/reaxff could not extract params from pair reaxff"); return; } reaxflag = 0; const int ntypes = atom->ntypes; - memory->create(chi,ntypes+1,"qeq/reax:chi"); - memory->create(eta,ntypes+1,"qeq/reax:eta"); - memory->create(gamma,ntypes+1,"qeq/reax:gamma"); + memory->create(chi,ntypes+1,"qeq/reaxff:chi"); + memory->create(eta,ntypes+1,"qeq/reaxff:eta"); + memory->create(gamma,ntypes+1,"qeq/reaxff:gamma"); if (comm->me == 0) { chi[0] = eta[0] = gamma[0] = 0.0; try { - TextFileReader reader(arg,"qeq/reax parameter"); + TextFileReader reader(arg,"qeq/reaxff parameter"); reader.ignore_comments = false; for (int i = 1; i <= ntypes; i++) { const char *line = reader.next_line(); if (!line) - throw parser_error("Invalid param file for fix qeq/reax"); + throw parser_error("Invalid param file for fix qeq/reaxff"); ValueTokenizer values(line); if (values.count() != 4) - throw parser_error("Fix qeq/reax: Incorrect format of param file"); + throw parser_error("Fix qeq/reaxff: Incorrect format of param file"); int itype = values.next_int(); if ((itype < 1) || (itype > ntypes)) - throw parser_error("Fix qeq/reax: invalid atom type in param file"); + throw parser_error("Fix qeq/reaxff: invalid atom type in param file"); chi[itype] = values.next_double(); eta[itype] = values.next_double(); @@ -264,7 +264,7 @@ void FixQEqReax::pertype_parameters(char *arg) /* ---------------------------------------------------------------------- */ -void FixQEqReax::allocate_storage() +void FixQEqReaxFF::allocate_storage() { nmax = atom->nmax; @@ -289,7 +289,7 @@ void FixQEqReax::allocate_storage() /* ---------------------------------------------------------------------- */ -void FixQEqReax::deallocate_storage() +void FixQEqReaxFF::deallocate_storage() { memory->destroy(s); memory->destroy(t); @@ -308,7 +308,7 @@ void FixQEqReax::deallocate_storage() /* ---------------------------------------------------------------------- */ -void FixQEqReax::reallocate_storage() +void FixQEqReaxFF::reallocate_storage() { deallocate_storage(); allocate_storage(); @@ -317,7 +317,7 @@ void FixQEqReax::reallocate_storage() /* ---------------------------------------------------------------------- */ -void FixQEqReax::allocate_matrix() +void FixQEqReaxFF::allocate_matrix() { int i,ii,n,m; @@ -325,8 +325,8 @@ void FixQEqReax::allocate_matrix() double safezone; if (reaxflag) { - mincap = reaxc->api->system->mincap; - safezone = reaxc->api->system->safezone; + mincap = reaxff->api->system->mincap; + safezone = reaxff->api->system->safezone; } else { mincap = REAX_MIN_CAP; safezone = REAX_SAFE_ZONE; @@ -354,7 +354,7 @@ void FixQEqReax::allocate_matrix() /* ---------------------------------------------------------------------- */ -void FixQEqReax::deallocate_matrix() +void FixQEqReaxFF::deallocate_matrix() { memory->destroy(H.firstnbr); memory->destroy(H.numnbrs); @@ -364,7 +364,7 @@ void FixQEqReax::deallocate_matrix() /* ---------------------------------------------------------------------- */ -void FixQEqReax::reallocate_matrix() +void FixQEqReaxFF::reallocate_matrix() { deallocate_matrix(); allocate_matrix(); @@ -372,13 +372,13 @@ void FixQEqReax::reallocate_matrix() /* ---------------------------------------------------------------------- */ -void FixQEqReax::init() +void FixQEqReaxFF::init() { if (!atom->q_flag) - error->all(FLERR,"Fix qeq/reax requires atom attribute q"); + error->all(FLERR,"Fix qeq/reaxff requires atom attribute q"); if (group->count(igroup) == 0) - error->all(FLERR,"Fix qeq/reax group has no atoms"); + error->all(FLERR,"Fix qeq/reaxff group has no atoms"); // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs @@ -398,21 +398,21 @@ void FixQEqReax::init() /* ---------------------------------------------------------------------- */ -double FixQEqReax::compute_scalar() +double FixQEqReaxFF::compute_scalar() { return matvecs/2.0; } /* ---------------------------------------------------------------------- */ -void FixQEqReax::init_list(int /*id*/, NeighList *ptr) +void FixQEqReaxFF::init_list(int /*id*/, NeighList *ptr) { list = ptr; } /* ---------------------------------------------------------------------- */ -void FixQEqReax::init_shielding() +void FixQEqReaxFF::init_shielding() { int i,j; int ntypes; @@ -428,16 +428,16 @@ void FixQEqReax::init_shielding() /* ---------------------------------------------------------------------- */ -void FixQEqReax::init_taper() +void FixQEqReaxFF::init_taper() { double d7, swa2, swa3, swb2, swb3; if (fabs(swa) > 0.01 && comm->me == 0) - error->warning(FLERR,"Fix qeq/reax has non-zero lower Taper radius cutoff"); + error->warning(FLERR,"Fix qeq/reaxff has non-zero lower Taper radius cutoff"); if (swb < 0) - error->all(FLERR, "Fix qeq/reax has negative upper Taper radius cutoff"); + error->all(FLERR, "Fix qeq/reaxff has negative upper Taper radius cutoff"); else if (swb < 5 && comm->me == 0) - error->warning(FLERR,"Fix qeq/reax has very low Taper radius cutoff"); + error->warning(FLERR,"Fix qeq/reaxff has very low Taper radius cutoff"); d7 = pow(swb - swa, 7); swa2 = SQR(swa); @@ -458,14 +458,14 @@ void FixQEqReax::init_taper() /* ---------------------------------------------------------------------- */ -void FixQEqReax::setup_pre_force(int vflag) +void FixQEqReaxFF::setup_pre_force(int vflag) { - if (reaxc) { - nn = reaxc->list->inum; - NN = reaxc->list->inum + reaxc->list->gnum; - ilist = reaxc->list->ilist; - numneigh = reaxc->list->numneigh; - firstneigh = reaxc->list->firstneigh; + if (reaxff) { + nn = reaxff->list->inum; + NN = reaxff->list->inum + reaxff->list->gnum; + ilist = reaxff->list->ilist; + numneigh = reaxff->list->numneigh; + firstneigh = reaxff->list->firstneigh; } else { nn = list->inum; NN = list->inum + list->gnum; @@ -487,7 +487,7 @@ void FixQEqReax::setup_pre_force(int vflag) /* ---------------------------------------------------------------------- */ -void FixQEqReax::setup_pre_force_respa(int vflag, int ilevel) +void FixQEqReaxFF::setup_pre_force_respa(int vflag, int ilevel) { if (ilevel < nlevels_respa-1) return; setup_pre_force(vflag); @@ -495,21 +495,21 @@ void FixQEqReax::setup_pre_force_respa(int vflag, int ilevel) /* ---------------------------------------------------------------------- */ -void FixQEqReax::min_setup_pre_force(int vflag) +void FixQEqReaxFF::min_setup_pre_force(int vflag) { setup_pre_force(vflag); } /* ---------------------------------------------------------------------- */ -void FixQEqReax::init_storage() +void FixQEqReaxFF::init_storage() { int NN; int *ilist; - if (reaxc) { - NN = reaxc->list->inum + reaxc->list->gnum; - ilist = reaxc->list->ilist; + if (reaxff) { + NN = reaxff->list->inum + reaxff->list->gnum; + ilist = reaxff->list->ilist; } else { NN = list->inum + list->gnum; ilist = list->ilist; @@ -530,18 +530,18 @@ void FixQEqReax::init_storage() /* ---------------------------------------------------------------------- */ -void FixQEqReax::pre_force(int /*vflag*/) +void FixQEqReaxFF::pre_force(int /*vflag*/) { if (update->ntimestep % nevery) return; int n = atom->nlocal; - if (reaxc) { - nn = reaxc->list->inum; - NN = reaxc->list->inum + reaxc->list->gnum; - ilist = reaxc->list->ilist; - numneigh = reaxc->list->numneigh; - firstneigh = reaxc->list->firstneigh; + if (reaxff) { + nn = reaxff->list->inum; + NN = reaxff->list->inum + reaxff->list->gnum; + ilist = reaxff->list->ilist; + numneigh = reaxff->list->numneigh; + firstneigh = reaxff->list->firstneigh; } else { nn = list->inum; NN = list->inum + list->gnum; @@ -568,21 +568,21 @@ void FixQEqReax::pre_force(int /*vflag*/) /* ---------------------------------------------------------------------- */ -void FixQEqReax::pre_force_respa(int vflag, int ilevel, int /*iloop*/) +void FixQEqReaxFF::pre_force_respa(int vflag, int ilevel, int /*iloop*/) { if (ilevel == nlevels_respa-1) pre_force(vflag); } /* ---------------------------------------------------------------------- */ -void FixQEqReax::min_pre_force(int vflag) +void FixQEqReaxFF::min_pre_force(int vflag) { pre_force(vflag); } /* ---------------------------------------------------------------------- */ -void FixQEqReax::init_matvec() +void FixQEqReaxFF::init_matvec() { /* fill-in H matrix */ compute_H(); @@ -614,7 +614,7 @@ void FixQEqReax::init_matvec() /* ---------------------------------------------------------------------- */ -void FixQEqReax::compute_H() +void FixQEqReaxFF::compute_H() { int jnum; int i, j, ii, jj, flag; @@ -670,13 +670,13 @@ void FixQEqReax::compute_H() } if (m_fill >= H.m) - error->all(FLERR,fmt::format("Fix qeq/reax: H matrix size has been " + error->all(FLERR,fmt::format("Fix qeq/reaxff H matrix size has been " "exceeded: m_fill={} H.m={}\n", m_fill, H.m)); } /* ---------------------------------------------------------------------- */ -double FixQEqReax::calculate_H(double r, double gamma) +double FixQEqReaxFF::calculate_H(double r, double gamma) { double Taper, denom; @@ -696,7 +696,7 @@ double FixQEqReax::calculate_H(double r, double gamma) /* ---------------------------------------------------------------------- */ -int FixQEqReax::CG(double *b, double *x) +int FixQEqReaxFF::CG(double *b, double *x) { int i, j; double tmp, alpha, beta, b_norm; @@ -745,7 +745,7 @@ int FixQEqReax::CG(double *b, double *x) } if ((i >= imax) && maxwarn && (comm->me == 0)) - error->warning(FLERR,fmt::format("Fix qeq/reax CG convergence failed " + error->warning(FLERR,fmt::format("Fix qeq/reaxff CG convergence failed " "after {} iterations at step {}", i,update->ntimestep)); return i; @@ -754,7 +754,7 @@ int FixQEqReax::CG(double *b, double *x) /* ---------------------------------------------------------------------- */ -void FixQEqReax::sparse_matvec(sparse_matrix *A, double *x, double *b) +void FixQEqReaxFF::sparse_matvec(sparse_matrix *A, double *x, double *b) { int i, j, itr_j; int ii; @@ -786,7 +786,7 @@ void FixQEqReax::sparse_matvec(sparse_matrix *A, double *x, double *b) /* ---------------------------------------------------------------------- */ -void FixQEqReax::calculate_Q() +void FixQEqReaxFF::calculate_Q() { int i, k; double u, s_sum, t_sum; @@ -819,7 +819,7 @@ void FixQEqReax::calculate_Q() /* ---------------------------------------------------------------------- */ -int FixQEqReax::pack_forward_comm(int n, int *list, double *buf, +int FixQEqReaxFF::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int m; @@ -846,7 +846,7 @@ int FixQEqReax::pack_forward_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void FixQEqReax::unpack_forward_comm(int n, int first, double *buf) +void FixQEqReaxFF::unpack_forward_comm(int n, int first, double *buf) { int i, m; @@ -871,7 +871,7 @@ void FixQEqReax::unpack_forward_comm(int n, int first, double *buf) /* ---------------------------------------------------------------------- */ -int FixQEqReax::pack_reverse_comm(int n, int first, double *buf) +int FixQEqReaxFF::pack_reverse_comm(int n, int first, double *buf) { int i, m; if (pack_flag == 5) { @@ -891,7 +891,7 @@ int FixQEqReax::pack_reverse_comm(int n, int first, double *buf) /* ---------------------------------------------------------------------- */ -void FixQEqReax::unpack_reverse_comm(int n, int *list, double *buf) +void FixQEqReaxFF::unpack_reverse_comm(int n, int *list, double *buf) { if (pack_flag == 5) { int m = 0; @@ -909,7 +909,7 @@ void FixQEqReax::unpack_reverse_comm(int n, int *list, double *buf) memory usage of local atom-based arrays ------------------------------------------------------------------------- */ -double FixQEqReax::memory_usage() +double FixQEqReaxFF::memory_usage() { double bytes; @@ -929,7 +929,7 @@ double FixQEqReax::memory_usage() allocate fictitious charge arrays ------------------------------------------------------------------------- */ -void FixQEqReax::grow_arrays(int nmax) +void FixQEqReaxFF::grow_arrays(int nmax) { memory->grow(s_hist,nmax,nprev,"qeq:s_hist"); memory->grow(t_hist,nmax,nprev,"qeq:t_hist"); @@ -939,7 +939,7 @@ void FixQEqReax::grow_arrays(int nmax) copy values within fictitious charge arrays ------------------------------------------------------------------------- */ -void FixQEqReax::copy_arrays(int i, int j, int /*delflag*/) +void FixQEqReaxFF::copy_arrays(int i, int j, int /*delflag*/) { for (int m = 0; m < nprev; m++) { s_hist[j][m] = s_hist[i][m]; @@ -951,7 +951,7 @@ void FixQEqReax::copy_arrays(int i, int j, int /*delflag*/) pack values in local atom-based array for exchange with another proc ------------------------------------------------------------------------- */ -int FixQEqReax::pack_exchange(int i, double *buf) +int FixQEqReaxFF::pack_exchange(int i, double *buf) { for (int m = 0; m < nprev; m++) buf[m] = s_hist[i][m]; for (int m = 0; m < nprev; m++) buf[nprev+m] = t_hist[i][m]; @@ -962,7 +962,7 @@ int FixQEqReax::pack_exchange(int i, double *buf) unpack values in local atom-based array from exchange with another proc ------------------------------------------------------------------------- */ -int FixQEqReax::unpack_exchange(int nlocal, double *buf) +int FixQEqReaxFF::unpack_exchange(int nlocal, double *buf) { for (int m = 0; m < nprev; m++) s_hist[nlocal][m] = buf[m]; for (int m = 0; m < nprev; m++) t_hist[nlocal][m] = buf[nprev+m]; @@ -971,7 +971,7 @@ int FixQEqReax::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_norm(double *v, int n) +double FixQEqReaxFF::parallel_norm(double *v, int n) { int i; double my_sum, norm_sqr; @@ -993,7 +993,7 @@ double FixQEqReax::parallel_norm(double *v, int n) /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_dot(double *v1, double *v2, int n) +double FixQEqReaxFF::parallel_dot(double *v1, double *v2, int n) { int i; double my_dot, res; @@ -1015,7 +1015,7 @@ double FixQEqReax::parallel_dot(double *v1, double *v2, int n) /* ---------------------------------------------------------------------- */ -double FixQEqReax::parallel_vector_acc(double *v, int n) +double FixQEqReaxFF::parallel_vector_acc(double *v, int n) { int i; double my_acc, res; @@ -1037,7 +1037,7 @@ double FixQEqReax::parallel_vector_acc(double *v, int n) /* ---------------------------------------------------------------------- */ -void FixQEqReax::vector_sum(double* dest, double c, double* v, +void FixQEqReaxFF::vector_sum(double* dest, double c, double* v, double d, double* y, int k) { int kk; @@ -1051,7 +1051,7 @@ void FixQEqReax::vector_sum(double* dest, double c, double* v, /* ---------------------------------------------------------------------- */ -void FixQEqReax::vector_add(double* dest, double c, double* v, int k) +void FixQEqReaxFF::vector_add(double* dest, double c, double* v, int k) { int kk; diff --git a/src/REAXFF/fix_qeq_reax.h b/src/REAXFF/fix_qeq_reaxff.h similarity index 94% rename from src/REAXFF/fix_qeq_reax.h rename to src/REAXFF/fix_qeq_reaxff.h index cf05096fe6..b787bb9c7a 100644 --- a/src/REAXFF/fix_qeq_reax.h +++ b/src/REAXFF/fix_qeq_reaxff.h @@ -24,21 +24,22 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(qeq/reax,FixQEqReax); +FixStyle(qeq/reaxff,FixQEqReaxFF); +FixStyle(qeq/reax,FixQEqReaxFF); // clang-format on #else -#ifndef LMP_FIX_QEQ_REAX_H -#define LMP_FIX_QEQ_REAX_H +#ifndef LMP_FIX_QEQ_REAXFF_H +#define LMP_FIX_QEQ_REAXFF_H #include "fix.h" namespace LAMMPS_NS { -class FixQEqReax : public Fix { +class FixQEqReaxFF : public Fix { public: - FixQEqReax(class LAMMPS *, int, char **); - ~FixQEqReax(); + FixQEqReaxFF(class LAMMPS *, int, char **); + ~FixQEqReaxFF(); int setmask(); virtual void post_constructor(); virtual void init(); @@ -63,7 +64,7 @@ class FixQEqReax : public Fix { int pack_flag; int nlevels_respa; class NeighList *list; - class PairReaxC *reaxc; + class PairReaxFF *reaxff; int *ilist, *jlist, *numneigh, **firstneigh; double swa, swb; // lower/upper Taper cutoff radius diff --git a/src/REAXFF/fix_reaxc.cpp b/src/REAXFF/fix_reaxff.cpp similarity index 87% rename from src/REAXFF/fix_reaxc.cpp rename to src/REAXFF/fix_reaxff.cpp index 2b39ef5a0e..bd95dbcb38 100644 --- a/src/REAXFF/fix_reaxc.cpp +++ b/src/REAXFF/fix_reaxff.cpp @@ -22,7 +22,7 @@ Algorithmic Techniques", Parallel Computing, in press. ------------------------------------------------------------------------- */ -#include "fix_reaxc.h" +#include "fix_reaxff.h" #include "atom.h" #include "memory.h" @@ -35,7 +35,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : +FixReaxFF::FixReaxFF(LAMMPS *lmp,int narg, char **arg) : Fix(lmp, narg, arg) { // perform initial allocation of atom-based arrays @@ -57,7 +57,7 @@ FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixReaxC::~FixReaxC() +FixReaxFF::~FixReaxFF() { // unregister this fix so atom class doesn't invoke it any more @@ -71,7 +71,7 @@ FixReaxC::~FixReaxC() /* ---------------------------------------------------------------------- */ -int FixReaxC::setmask() +int FixReaxFF::setmask() { int mask = 0; return mask; @@ -81,7 +81,7 @@ int FixReaxC::setmask() memory usage of local atom-based arrays ------------------------------------------------------------------------- */ -double FixReaxC::memory_usage() +double FixReaxFF::memory_usage() { int nmax = atom->nmax; double bytes = (double)nmax * 2 * sizeof(int); @@ -92,10 +92,10 @@ double FixReaxC::memory_usage() allocate local atom-based arrays ------------------------------------------------------------------------- */ -void FixReaxC::grow_arrays(int nmax) +void FixReaxFF::grow_arrays(int nmax) { - memory->grow(num_bonds,nmax,"reaxc:num_bonds"); - memory->grow(num_hbonds,nmax,"reaxc:num_hbonds"); + memory->grow(num_bonds,nmax,"reaxff:num_bonds"); + memory->grow(num_hbonds,nmax,"reaxff:num_hbonds"); for (int i = oldnmax; i < nmax; i++) { num_hbonds[i] = MIN_REAX_HBONDS; num_bonds[i] = MIN_REAX_BONDS; @@ -107,7 +107,7 @@ void FixReaxC::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixReaxC::copy_arrays(int i, int j, int /*delflag*/) +void FixReaxFF::copy_arrays(int i, int j, int /*delflag*/) { num_bonds[j] = num_bonds[i]; num_hbonds[j] = num_hbonds[i]; @@ -117,7 +117,7 @@ void FixReaxC::copy_arrays(int i, int j, int /*delflag*/) pack values in local atom-based arrays for exchange with another proc ------------------------------------------------------------------------- */ -int FixReaxC::pack_exchange(int i, double *buf) +int FixReaxFF::pack_exchange(int i, double *buf) { buf[0] = num_bonds[i]; buf[1] = num_hbonds[i]; @@ -128,7 +128,7 @@ int FixReaxC::pack_exchange(int i, double *buf) unpack values in local atom-based arrays from exchange with another proc ------------------------------------------------------------------------- */ -int FixReaxC::unpack_exchange(int nlocal, double *buf) +int FixReaxFF::unpack_exchange(int nlocal, double *buf) { num_bonds[nlocal] = static_cast (buf[0]); num_hbonds[nlocal] = static_cast (buf[1]); @@ -137,7 +137,7 @@ int FixReaxC::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixReaxC::pack_forward_comm(int n, int *list, double *buf, +int FixReaxFF::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,m; @@ -152,7 +152,7 @@ int FixReaxC::pack_forward_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void FixReaxC::unpack_forward_comm(int n, int first, double *buf) +void FixReaxFF::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/REAXFF/fix_reaxc.h b/src/REAXFF/fix_reaxff.h similarity index 89% rename from src/REAXFF/fix_reaxc.h rename to src/REAXFF/fix_reaxff.h index 6347f30c23..0b18f6d118 100644 --- a/src/REAXFF/fix_reaxc.h +++ b/src/REAXFF/fix_reaxff.h @@ -24,24 +24,24 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(REAXC,FixReaxC); +FixStyle(REAXFF,FixReaxFF); // clang-format on #else -#ifndef LMP_FIX_REAXC_H -#define LMP_FIX_REAXC_H +#ifndef LMP_FIX_REAXFF_H +#define LMP_FIX_REAXFF_H #include "fix.h" namespace LAMMPS_NS { -class FixReaxC : public Fix { - friend class PairReaxC; - friend class PairReaxCOMP; +class FixReaxFF : public Fix { + friend class PairReaxFF; + friend class PairReaxFFOMP; public: - FixReaxC(class LAMMPS *,int, char **); - ~FixReaxC(); + FixReaxFF(class LAMMPS *,int, char **); + ~FixReaxFF(); int setmask(); double memory_usage(); diff --git a/src/REAXFF/fix_reaxc_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp similarity index 79% rename from src/REAXFF/fix_reaxc_bonds.cpp rename to src/REAXFF/fix_reaxff_bonds.cpp index 0ef3c351e6..f13056c5b6 100644 --- a/src/REAXFF/fix_reaxc_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -16,7 +16,7 @@ Contributing author: Ray Shan (Sandia, tnshan@sandia.gov) ------------------------------------------------------------------------- */ -#include "fix_reaxc_bonds.h" +#include "fix_reaxff_bonds.h" #include "atom.h" #include "error.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "update.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "reaxff_api.h" #include @@ -36,10 +36,10 @@ using namespace ReaxFF; /* ---------------------------------------------------------------------- */ -FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : +FixReaxFFBonds::FixReaxFFBonds(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 5) error->all(FLERR,"Illegal fix reax/c/bonds command"); + if (narg != 5) error->all(FLERR,"Illegal fix reaxff/bonds command"); MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -49,7 +49,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) - error->all(FLERR,"Illegal fix reax/c/bonds command"); + error->all(FLERR,"Illegal fix reaxff/bonds command"); if (me == 0) { char *suffix = strrchr(arg[4],'.'); @@ -67,12 +67,12 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : } else fp = fopen(arg[4],"w"); if (!fp) - error->one(FLERR,fmt::format("Cannot open fix reax/c/bonds file {}: " + error->one(FLERR,fmt::format("Cannot open fix reaxff/bonds file {}: " "{}",arg[4],utils::getsyserror())); } if (atom->tag_consecutive() == 0) - error->all(FLERR,"Atom IDs must be consecutive for fix reax/c bonds"); + error->all(FLERR,"Atom IDs must be consecutive for fix reaxff bonds"); abo = nullptr; neighid = nullptr; @@ -83,7 +83,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixReaxCBonds::~FixReaxCBonds() +FixReaxFFBonds::~FixReaxFFBonds() { MPI_Comm_rank(world,&me); @@ -94,7 +94,7 @@ FixReaxCBonds::~FixReaxCBonds() /* ---------------------------------------------------------------------- */ -int FixReaxCBonds::setmask() +int FixReaxFFBonds::setmask() { int mask = 0; mask |= END_OF_STEP; @@ -103,32 +103,31 @@ int FixReaxCBonds::setmask() /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::setup(int /*vflag*/) +void FixReaxFFBonds::setup(int /*vflag*/) { end_of_step(); } /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::init() +void FixReaxFFBonds::init() { - reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " - "pair_style reax/c, reax/c/kk, or reax/c/omp"); - + reaxff = (PairReaxFF *) force->pair_match("^reax..",0); + if (reaxff == nullptr) error->all(FLERR,"Cannot use fix reaxff/bonds without " + "pair_style reaxff, reaxff/kk, or reaxff/omp"); } /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::end_of_step() +void FixReaxFFBonds::end_of_step() { - Output_ReaxC_Bonds(update->ntimestep,fp); + Output_ReaxFF_Bonds(); if (me == 0) fflush(fp); } /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/) +void FixReaxFFBonds::Output_ReaxFF_Bonds() { int i, j; @@ -152,16 +151,14 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/) abo[i][j] = 0.0; } } - numbonds = 0; - - FindBond(lists, numbonds); + numbonds = FindBond(); // allocate a temporary buffer for the snapshot info MPI_Allreduce(&numbonds,&numbonds_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nlocal,&nlocal_max,1,MPI_INT,MPI_MAX,world); nbuf = 1+(numbonds_max*2+10)*nlocal_max; - memory->create(buf,nbuf,"reax/c/bonds:buf"); + memory->create(buf,nbuf,"reaxff/bonds:buf"); for (i = 0; i < nbuf; i ++) buf[i] = 0.0; // Pass information to buffer @@ -176,26 +173,27 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint /*ntimestep*/, FILE * /*fp*/) /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) +int FixReaxFFBonds::FindBond() { int *ilist, i, ii, inum; int j, pj, nj; tagint jtag; double bo_tmp,bo_cut; - inum = reaxc->list->inum; - ilist = reaxc->list->ilist; + inum = reaxff->list->inum; + ilist = reaxff->list->ilist; bond_data *bo_ij; - bo_cut = reaxc->api->control->bg_cut; + bo_cut = reaxff->api->control->bg_cut; tagint *tag = atom->tag; + int numbonds = 0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; nj = 0; - for (pj = Start_Index(i, reaxc->api->lists); pj < End_Index(i, reaxc->api->lists); ++pj) { - bo_ij = &(reaxc->api->lists->select.bond_list[pj]); + for (pj = Start_Index(i, reaxff->api->lists); pj < End_Index(i, reaxff->api->lists); ++pj) { + bo_ij = &(reaxff->api->lists->select.bond_list[pj]); j = bo_ij->nbr; jtag = tag[j]; bo_tmp = bo_ij->bo_data.BO; @@ -209,11 +207,11 @@ void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) numneigh[i] = nj; if (nj > numbonds) numbonds = nj; } - + return numbonds; } /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) +void FixReaxFFBonds::PassBuffer(double *buf, int &nbuf_local) { int i, j, k, numbonds; int nlocal = atom->nlocal; @@ -223,8 +221,8 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) for (i = 0; i < nlocal; i++) { buf[j-1] = atom->tag[i]; buf[j+0] = atom->type[i]; - buf[j+1] = reaxc->api->workspace->total_bond_order[i]; - buf[j+2] = reaxc->api->workspace->nlp[i]; + buf[j+1] = reaxff->api->workspace->total_bond_order[i]; + buf[j+2] = reaxff->api->workspace->nlp[i]; buf[j+3] = atom->q[i]; buf[j+4] = numneigh[i]; numbonds = nint(buf[j+4]); @@ -248,7 +246,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, +void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, int natoms, int maxnum) { int i, j, k, itype; @@ -258,7 +256,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, bigint ntimestep = update->ntimestep; double sbotmp, nlptmp, avqtmp, abotmp; - double cutof3 = reaxc->api->control->bg_cut; + double cutof3 = reaxff->api->control->bg_cut; MPI_Request irequest, irequest2; if (me == 0) { @@ -320,7 +318,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, /* ---------------------------------------------------------------------- */ -int FixReaxCBonds::nint(const double &r) +int FixReaxFFBonds::nint(const double &r) { int i = 0; if (r>0.0) i = static_cast(r+0.5); @@ -330,7 +328,7 @@ int FixReaxCBonds::nint(const double &r) /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::destroy() +void FixReaxFFBonds::destroy() { memory->destroy(abo); memory->destroy(neighid); @@ -339,16 +337,16 @@ void FixReaxCBonds::destroy() /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::allocate() +void FixReaxFFBonds::allocate() { - memory->create(abo,nmax,MAXREAXBOND,"reax/c/bonds:abo"); - memory->create(neighid,nmax,MAXREAXBOND,"reax/c/bonds:neighid"); - memory->create(numneigh,nmax,"reax/c/bonds:numneigh"); + memory->create(abo,nmax,MAXREAXBOND,"reaxff/bonds:abo"); + memory->create(neighid,nmax,MAXREAXBOND,"reaxff/bonds:neighid"); + memory->create(numneigh,nmax,"reaxff/bonds:numneigh"); } /* ---------------------------------------------------------------------- */ -double FixReaxCBonds::memory_usage() +double FixReaxFFBonds::memory_usage() { double bytes; diff --git a/src/REAXFF/fix_reaxc_bonds.h b/src/REAXFF/fix_reaxff_bonds.h similarity index 82% rename from src/REAXFF/fix_reaxc_bonds.h rename to src/REAXFF/fix_reaxff_bonds.h index fbca39fa95..ceb763b205 100644 --- a/src/REAXFF/fix_reaxc_bonds.h +++ b/src/REAXFF/fix_reaxff_bonds.h @@ -14,7 +14,8 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(reax/c/bonds,FixReaxCBonds); +FixStyle(reaxff/bonds,FixReaxFFBonds); +FixStyle(reax/c/bonds,FixReaxFFBonds); // clang-format on #else @@ -25,10 +26,10 @@ FixStyle(reax/c/bonds,FixReaxCBonds); namespace LAMMPS_NS { -class FixReaxCBonds : public Fix { +class FixReaxFFBonds : public Fix { public: - FixReaxCBonds(class LAMMPS *, int, char **); - virtual ~FixReaxCBonds(); + FixReaxFFBonds(class LAMMPS *, int, char **); + virtual ~FixReaxFFBonds(); int setmask(); virtual void init(); void setup(int); @@ -43,8 +44,8 @@ class FixReaxCBonds : public Fix { void allocate(); void destroy(); - virtual void Output_ReaxC_Bonds(bigint, FILE *); - void FindBond(struct _reax_list*, int &); + virtual void Output_ReaxFF_Bonds(); + int FindBond(); void PassBuffer(double *, int &); void RecvBuffer(double *, int, int, int, int); int nint(const double &); @@ -52,7 +53,7 @@ class FixReaxCBonds : public Fix { bigint nvalid, nextvalid(); struct _reax_list *lists; - class PairReaxC *reaxc; + class PairReaxFF *reaxff; class NeighList *list; }; } diff --git a/src/REAXFF/fix_reaxc_species.cpp b/src/REAXFF/fix_reaxff_species.cpp similarity index 85% rename from src/REAXFF/fix_reaxc_species.cpp rename to src/REAXFF/fix_reaxff_species.cpp index da1307ac79..53746b968b 100644 --- a/src/REAXFF/fix_reaxc_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -17,7 +17,7 @@ Oleg Sergeev (VNIIA, sergeev@vniia.ru) ------------------------------------------------------------------------- */ -#include "fix_reaxc_species.h" +#include "fix_reaxff_species.h" #include "atom.h" #include "comm.h" @@ -31,7 +31,7 @@ #include "neighbor.h" #include "update.h" -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "reaxff_defs.h" #include @@ -41,10 +41,10 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : +FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 7) error->all(FLERR,"Illegal fix reax/c/species command"); + if (narg < 7) error->all(FLERR,"Illegal fix reaxff/species command"); force_reneighbor = 0; @@ -69,9 +69,9 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : comm_forward = 4; if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); if (nfreq % nevery || nrepeat*nevery > nfreq) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); // Neighbor lists must stay unchanged during averaging of bonds, // but may be updated when no averaging is performed. @@ -96,11 +96,11 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } if (me == 0 && rene_flag) { - error->warning(FLERR,"Resetting reneighboring criteria for fix reax/c/species"); + error->warning(FLERR,"Resetting reneighboring criteria for fix reaxff/species"); } tmparg = nullptr; - memory->create(tmparg,4,4,"reax/c/species:tmparg"); + memory->create(tmparg,4,4,"reaxff/species:tmparg"); strcpy(tmparg[0],arg[3]); strcpy(tmparg[1],arg[4]); strcpy(tmparg[2],arg[5]); @@ -121,7 +121,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else fp = fopen(arg[6],"w"); if (!fp) - error->one(FLERR,fmt::format("Cannot open fix reax/c/species file {}: " + error->one(FLERR,fmt::format("Cannot open fix reaxff/species file {}: " "{}",arg[6],utils::getsyserror())); } @@ -129,8 +129,8 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : clusterID = nullptr; int ntmp = 1; - memory->create(x0,ntmp,"reax/c/species:x0"); - memory->create(clusterID,ntmp,"reax/c/species:clusterID"); + memory->create(x0,ntmp,"reaxff/species:x0"); + memory->create(clusterID,ntmp,"reaxff/species:clusterID"); vector_atom = clusterID; BOCut = nullptr; @@ -149,7 +149,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : double bo_cut; bg_cut = 0.30; n = ntypes+1; - memory->create(BOCut,n,n,"reax/c/species:BOCut"); + memory->create(BOCut,n,n,"reaxff/species:BOCut"); for (i = 1; i < n; i ++) for (j = 1; j < n; j ++) BOCut[i][j] = bg_cut; @@ -168,16 +168,16 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : // set BO cutoff if (strcmp(arg[iarg],"cutoff") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal fix reax/c/species command"); + if (iarg+4 > narg) error->all(FLERR,"Illegal fix reaxff/species command"); itype = atoi(arg[iarg+1]); jtype = atoi(arg[iarg+2]); bo_cut = atof(arg[iarg+3]); if (itype > ntypes || jtype > ntypes) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); if (itype <= 0 || jtype <= 0) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); if (bo_cut > 1.0 || bo_cut < 0.0) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); BOCut[itype][jtype] = bo_cut; BOCut[jtype][itype] = bo_cut; @@ -185,7 +185,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : // modify element type names } else if (strcmp(arg[iarg],"element") == 0) { - if (iarg+ntypes+1 > narg) error->all(FLERR,"Illegal fix reax/c/species command"); + if (iarg+ntypes+1 > narg) error->all(FLERR,"Illegal fix reaxff/species command"); eletype = (char**) malloc(ntypes*sizeof(char*)); int len; @@ -199,11 +199,11 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : // position of molecules } else if (strcmp(arg[iarg],"position") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix reax/c/species command"); + if (iarg+3 > narg) error->all(FLERR,"Illegal fix reaxff/species command"); posflag = 1; posfreq = atoi(arg[iarg+1]); if (posfreq < nfreq || (posfreq%nfreq != 0)) - error->all(FLERR,"Illegal fix reax/c/species command"); + error->all(FLERR,"Illegal fix reaxff/species command"); filepos = new char[255]; strcpy(filepos,arg[iarg+2]); @@ -212,17 +212,17 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else { if (me == 0) { pos = fopen(filepos, "w"); - if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); + if (pos == nullptr) error->one(FLERR,"Cannot open fix reaxff/species position file"); } singlepos_opened = 1; multipos = 0; } iarg += 3; - } else error->all(FLERR,"Illegal fix reax/c/species command"); + } else error->all(FLERR,"Illegal fix reaxff/species command"); } if (!eleflag) { - memory->create(ele,ntypes+1,"reax/c/species:ele"); + memory->create(ele,ntypes+1,"reaxff/species:ele"); ele[0]='C'; if (ntypes > 1) ele[1]='H'; @@ -239,7 +239,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixReaxCSpecies::~FixReaxCSpecies() +FixReaxFFSpecies::~FixReaxFFSpecies() { memory->destroy(ele); memory->destroy(BOCut); @@ -265,7 +265,7 @@ FixReaxCSpecies::~FixReaxCSpecies() /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::setmask() +int FixReaxFFSpecies::setmask() { int mask = 0; mask |= POST_INTEGRATE; @@ -274,27 +274,27 @@ int FixReaxCSpecies::setmask() /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::setup(int /*vflag*/) +void FixReaxFFSpecies::setup(int /*vflag*/) { ntotal = static_cast (atom->natoms); if (Name == nullptr) - memory->create(Name,ntypes,"reax/c/species:Name"); + memory->create(Name,ntypes,"reaxff/species:Name"); post_integrate(); } /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::init() +void FixReaxFFSpecies::init() { if (atom->tag_enable == 0) - error->all(FLERR,"Cannot use fix reax/c/species unless atoms have IDs"); + error->all(FLERR,"Cannot use fix reaxff/species unless atoms have IDs"); - reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/species without " - "pair_style reax/c, reax/c/kk, or reax/c/omp"); + reaxff = (PairReaxFF *) force->pair_match("^reax..",0); + if (reaxff == nullptr) error->all(FLERR,"Cannot use fix reaxff/species without " + "pair_style reaxff, reaxff/kk, or reaxff/omp"); - reaxc->fixspecies_flag = 1; + reaxff->fixspecies_flag = 1; // reset next output timestep if not yet set or timestep has been reset if (nvalid != update->ntimestep) @@ -303,9 +303,9 @@ void FixReaxCSpecies::init() // check if this fix has been called twice int count = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"reax/c/species") == 0) count++; + if (strcmp(modify->fix[i]->style,"reaxff/species") == 0) count++; if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one fix reax/c/species"); + error->warning(FLERR,"More than one fix reaxff/species"); if (!setupflag) { // create a compute to store properties @@ -321,7 +321,7 @@ void FixReaxCSpecies::init() /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::create_compute() +void FixReaxFFSpecies::create_compute() { int narg; char **args; @@ -368,7 +368,7 @@ void FixReaxCSpecies::create_compute() /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::create_fix() +void FixReaxFFSpecies::create_fix() { int narg; char **args; @@ -420,22 +420,22 @@ void FixReaxCSpecies::create_fix() /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::init_list(int /*id*/, NeighList *ptr) +void FixReaxFFSpecies::init_list(int /*id*/, NeighList *ptr) { list = ptr; } /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::post_integrate() +void FixReaxFFSpecies::post_integrate() { - Output_ReaxC_Bonds(update->ntimestep,fp); + Output_ReaxFF_Bonds(update->ntimestep,fp); if (me == 0) fflush(fp); } /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE * /*fp*/) +void FixReaxFFSpecies::Output_ReaxFF_Bonds(bigint ntimestep, FILE * /*fp*/) { int Nmole, Nspec; @@ -451,8 +451,8 @@ void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE * /*fp*/) nmax = atom->nmax; memory->destroy(x0); memory->destroy(clusterID); - memory->create(x0,nmax,"reax/c/species:x0"); - memory->create(clusterID,nmax,"reax/c/species:clusterID"); + memory->create(x0,nmax,"reaxff/species:x0"); + memory->create(clusterID,nmax,"reaxff/species:clusterID"); vector_atom = clusterID; } @@ -484,7 +484,7 @@ void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE * /*fp*/) /* ---------------------------------------------------------------------- */ -AtomCoord FixReaxCSpecies::chAnchor(AtomCoord in1, AtomCoord in2) +AtomCoord FixReaxFFSpecies::chAnchor(AtomCoord in1, AtomCoord in2) { if (in1.x < in2.x) return in1; @@ -501,7 +501,7 @@ AtomCoord FixReaxCSpecies::chAnchor(AtomCoord in1, AtomCoord in2) /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::FindMolecule () +void FixReaxFFSpecies::FindMolecule () { int i,j,ii,jj,inum,itype,jtype,loop,looptot; int change,done,anychange; @@ -510,8 +510,8 @@ void FixReaxCSpecies::FindMolecule () double bo_tmp,bo_cut; double **spec_atom = f_SPECBOND->array_atom; - inum = reaxc->list->inum; - ilist = reaxc->list->ilist; + inum = reaxff->list->inum; + ilist = reaxff->list->ilist; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -540,7 +540,7 @@ void FixReaxCSpecies::FindMolecule () itype = atom->type[i]; for (jj = 0; jj < MAXSPECBOND; jj++) { - j = reaxc->tmpid[i][jj]; + j = reaxff->tmpid[i][jj]; if ((j == 0) || (j < i)) continue; if (!(mask[j] & groupbit)) continue; @@ -575,7 +575,7 @@ void FixReaxCSpecies::FindMolecule () /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::SortMolecule(int &Nmole) +void FixReaxFFSpecies::SortMolecule(int &Nmole) { memory->destroy(molmap); molmap = nullptr; @@ -595,16 +595,16 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall && me == 0) error->warning(FLERR,"Atom with cluster ID = 0 included in " - "fix reax/c/species group"); + "fix reaxff/species group"); MPI_Allreduce(&lo,&idlo,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&hi,&idhi,1,MPI_INT,MPI_MAX,world); if (idlo == ntotal) if (me == 0) error->warning(FLERR,"Atom with cluster ID = maxmol " - "included in fix reax/c/species group"); + "included in fix reaxff/species group"); int nlen = idhi - idlo + 1; - memory->create(molmap,nlen,"reax/c/species:molmap"); + memory->create(molmap,nlen,"reaxff/species:molmap"); for (n = 0; n < nlen; n++) molmap[n] = 0; for (n = 0; n < nlocal; n++) { @@ -613,7 +613,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) } int *molmapall; - memory->create(molmapall,nlen,"reax/c/species:molmapall"); + memory->create(molmapall,nlen,"reaxff/species:molmapall"); MPI_Allreduce(molmap,molmapall,nlen,MPI_INT,MPI_MAX,world); Nmole = 0; @@ -646,7 +646,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) +void FixReaxFFSpecies::FindSpecies(int Nmole, int &Nspec) { int k, l, m, n, itype, cid; int flag_identity, flag_mol, flag_spec; @@ -656,16 +656,16 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) memory->destroy(MolName); MolName = nullptr; - memory->create(MolName,Nmole*(ntypes+1),"reax/c/species:MolName"); + memory->create(MolName,Nmole*(ntypes+1),"reaxff/species:MolName"); memory->destroy(NMol); NMol = nullptr; - memory->create(NMol,Nmole,"reax/c/species:NMol"); + memory->create(NMol,Nmole,"reaxff/species:NMol"); for (m = 0; m < Nmole; m ++) NMol[m] = 1; - memory->create(Nameall,ntypes,"reax/c/species:Nameall"); - memory->create(NMolall,Nmole,"reax/c/species:NMolall"); + memory->create(Nameall,ntypes,"reaxff/species:Nameall"); + memory->create(NMolall,Nmole,"reaxff/species:NMolall"); for (m = 1, Nspec = 0; m <= Nmole; m ++) { for (n = 0; n < ntypes; n ++) Name[n] = 0; @@ -705,16 +705,16 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) memory->destroy(nd); nd = nullptr; - memory->create(nd,Nspec,"reax/c/species:nd"); + memory->create(nd,Nspec,"reaxff/species:nd"); memory->destroy(MolType); MolType = nullptr; - memory->create(MolType,Nspec*(ntypes+2),"reax/c/species:MolType"); + memory->create(MolType,Nspec*(ntypes+2),"reaxff/species:MolType"); } /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::CheckExistence(int id, int ntypes) +int FixReaxFFSpecies::CheckExistence(int id, int ntypes) { int i, j, molid, flag; @@ -735,7 +735,7 @@ int FixReaxCSpecies::CheckExistence(int id, int ntypes) /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::WriteFormulas(int Nmole, int Nspec) +void FixReaxFFSpecies::WriteFormulas(int Nmole, int Nspec) { int i, j, itemp; bigint ntimestep = update->ntimestep; @@ -771,7 +771,7 @@ void FixReaxCSpecies::WriteFormulas(int Nmole, int Nspec) /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::OpenPos() +void FixReaxFFSpecies::OpenPos() { char *filecurrent; bigint ntimestep = update->ntimestep; @@ -792,7 +792,7 @@ void FixReaxCSpecies::OpenPos() if (me == 0) { pos = fopen(filecurrent, "w"); - if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); + if (pos == nullptr) error->one(FLERR,"Cannot open fix reaxff/species position file"); } else pos = nullptr; multipos_opened = 1; @@ -801,7 +801,7 @@ void FixReaxCSpecies::OpenPos() /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::WritePos(int Nmole, int Nspec) +void FixReaxFFSpecies::WritePos(int Nmole, int Nspec) { int i, itype, cid; int count, count_tmp, m, n, k; @@ -831,7 +831,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) } Nameall = nullptr; - memory->create(Nameall,ntypes,"reax/c/species:Nameall"); + memory->create(Nameall,ntypes,"reaxff/species:Nameall"); for (m = 1; m <= Nmole; m ++) { @@ -916,7 +916,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) /* ---------------------------------------------------------------------- */ -double FixReaxCSpecies::compute_vector(int n) +double FixReaxFFSpecies::compute_vector(int n) { if (n == 0) return vector_nmole; @@ -928,7 +928,7 @@ double FixReaxCSpecies::compute_vector(int n) /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::nint(const double &r) +int FixReaxFFSpecies::nint(const double &r) { int i = 0; if (r>0.0) i = static_cast(r+0.5); @@ -938,7 +938,7 @@ int FixReaxCSpecies::nint(const double &r) /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, +int FixReaxFFSpecies::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,m; @@ -957,7 +957,7 @@ int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::unpack_forward_comm(int n, int first, double *buf) +void FixReaxFFSpecies::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -974,7 +974,7 @@ void FixReaxCSpecies::unpack_forward_comm(int n, int first, double *buf) /* ---------------------------------------------------------------------- */ -double FixReaxCSpecies::memory_usage() +double FixReaxFFSpecies::memory_usage() { double bytes; diff --git a/src/REAXFF/fix_reaxc_species.h b/src/REAXFF/fix_reaxff_species.h similarity index 87% rename from src/REAXFF/fix_reaxc_species.h rename to src/REAXFF/fix_reaxff_species.h index 225e0bcf24..1957c1f8b1 100644 --- a/src/REAXFF/fix_reaxc_species.h +++ b/src/REAXFF/fix_reaxff_species.h @@ -14,7 +14,8 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(reax/c/species,FixReaxCSpecies); +FixStyle(reaxff/species,FixReaxFFSpecies); +FixStyle(reax/c/species,FixReaxFFSpecies); // clang-format on #else @@ -31,10 +32,10 @@ typedef struct { double x, y, z; } AtomCoord; -class FixReaxCSpecies : public Fix { +class FixReaxFFSpecies : public Fix { public: - FixReaxCSpecies(class LAMMPS *, int, char **); - virtual ~FixReaxCSpecies(); + FixReaxFFSpecies(class LAMMPS *, int, char **); + virtual ~FixReaxFFSpecies(); int setmask(); virtual void init(); void init_list(int, class NeighList *); @@ -59,7 +60,7 @@ class FixReaxCSpecies : public Fix { int singlepos_opened, multipos_opened; char *ele, **eletype, *filepos; - void Output_ReaxC_Bonds(bigint, FILE *); + void Output_ReaxFF_Bonds(bigint, FILE *); void create_compute(); void create_fix(); AtomCoord chAnchor(AtomCoord, AtomCoord); @@ -80,7 +81,7 @@ class FixReaxCSpecies : public Fix { class NeighList *list; class FixAveAtom *f_SPECBOND; - class PairReaxC *reaxc; + class PairReaxFF *reaxff; }; } diff --git a/src/REAXFF/pair_reaxc.cpp b/src/REAXFF/pair_reaxff.cpp similarity index 88% rename from src/REAXFF/pair_reaxc.cpp rename to src/REAXFF/pair_reaxff.cpp index 389b7d9e13..0aea45b9cd 100644 --- a/src/REAXFF/pair_reaxc.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -17,18 +17,18 @@ Hasan Metin Aktulga, Michigan State University, hma@cse.msu.edu Per-atom energy/virial added by Ray Shan (Sandia) - Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added by + Fix reaxff/bonds and fix reaxff/species for pair_style reaxff added by Ray Shan (Sandia) Hybrid and hybrid/overlay compatibility added by Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "pair_reaxc.h" +#include "pair_reaxff.h" #include "atom.h" #include "citeme.h" #include "comm.h" #include "error.h" -#include "fix_reaxc.h" +#include "fix_reaxff.h" #include "force.h" #include "memory.h" #include "modify.h" @@ -47,7 +47,7 @@ using namespace LAMMPS_NS; using namespace ReaxFF; static const char cite_pair_reax_c[] = - "pair reax/c command:\n\n" + "pair reaxff command:\n\n" "@Article{Aktulga12,\n" " author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama},\n" " title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques},\n" @@ -59,7 +59,7 @@ static const char cite_pair_reax_c[] = /* ---------------------------------------------------------------------- */ -PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) +PairReaxFF::PairReaxFF(LAMMPS *lmp) : Pair(lmp) { if (lmp->citeme) lmp->citeme->add(cite_pair_reax_c); @@ -70,7 +70,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; ghostneigh = 1; - fix_id = utils::strdup("REAXC_" + std::to_string(instance_me)); + fix_id = utils::strdup("REAXFF_" + std::to_string(instance_me)); api = new API; @@ -102,7 +102,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) api->system->omp_active = 0; - fix_reax = nullptr; + fix_reaxff = nullptr; tmpid = nullptr; tmpbo = nullptr; @@ -117,11 +117,11 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) /* ---------------------------------------------------------------------- */ -PairReaxC::~PairReaxC() +PairReaxFF::~PairReaxFF() { if (copymode) return; - if (fix_reax) modify->delete_fix(fix_id); + if (fix_reaxff) modify->delete_fix(fix_id); delete[] fix_id; if (setup_flag) { @@ -166,7 +166,7 @@ PairReaxC::~PairReaxC() /* ---------------------------------------------------------------------- */ -void PairReaxC::allocate() +void PairReaxFF::allocate() { allocated = 1; int n = atom->ntypes; @@ -183,7 +183,7 @@ void PairReaxC::allocate() /* ---------------------------------------------------------------------- */ -void PairReaxC::settings(int narg, char **arg) +void PairReaxFF::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal pair_style command"); @@ -226,49 +226,49 @@ void PairReaxC::settings(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"checkqeq") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); if (strcmp(arg[iarg+1],"yes") == 0) qeqflag = 1; else if (strcmp(arg[iarg+1],"no") == 0) qeqflag = 0; - else error->all(FLERR,"Illegal pair_style reax/c command"); + else error->all(FLERR,"Illegal pair_style reaxff command"); iarg += 2; } else if (strcmp(arg[iarg],"enobonds") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); if (strcmp(arg[iarg+1],"yes") == 0) api->control->enobondsflag = 1; else if (strcmp(arg[iarg+1],"no") == 0) api->control->enobondsflag = 0; - else error->all(FLERR,"Illegal pair_style reax/c command"); + else error->all(FLERR,"Illegal pair_style reaxff command"); iarg += 2; } else if (strcmp(arg[iarg],"lgvdw") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); if (strcmp(arg[iarg+1],"yes") == 0) api->control->lgflag = 1; else if (strcmp(arg[iarg+1],"no") == 0) api->control->lgflag = 0; - else error->all(FLERR,"Illegal pair_style reax/c command"); + else error->all(FLERR,"Illegal pair_style reaxff command"); iarg += 2; } else if (strcmp(arg[iarg],"safezone") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); api->system->safezone = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (api->system->safezone < 0.0) - error->all(FLERR,"Illegal pair_style reax/c safezone command"); + error->all(FLERR,"Illegal pair_style reaxff safezone command"); api->system->saferzone = api->system->safezone*1.2 + 0.2; iarg += 2; } else if (strcmp(arg[iarg],"mincap") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); api->system->mincap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (api->system->mincap < 0) - error->all(FLERR,"Illegal pair_style reax/c mincap command"); + error->all(FLERR,"Illegal pair_style reaxff mincap command"); iarg += 2; } else if (strcmp(arg[iarg],"minhbonds") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reaxff command"); api->system->minhbonds = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (api->system->minhbonds < 0) - error->all(FLERR,"Illegal pair_style reax/c minhbonds command"); + error->all(FLERR,"Illegal pair_style reaxff minhbonds command"); iarg += 2; - } else error->all(FLERR,"Illegal pair_style reax/c command"); + } else error->all(FLERR,"Illegal pair_style reaxff command"); } } /* ---------------------------------------------------------------------- */ -void PairReaxC::coeff(int nargs, char **args) +void PairReaxFF::coeff(int nargs, char **args) { if (!allocated) allocate(); @@ -331,15 +331,15 @@ void PairReaxC::coeff(int nargs, char **args) /* ---------------------------------------------------------------------- */ -void PairReaxC::init_style() +void PairReaxFF::init_style() { if (!atom->q_flag) - error->all(FLERR,"Pair style reax/c requires atom attribute q"); + error->all(FLERR,"Pair style reaxff requires atom attribute q"); bool have_qeq = ((modify->find_fix_by_style("^qeq/reax") != -1) || (modify->find_fix_by_style("^qeq/shielded") != -1)); if (!have_qeq && qeqflag == 1) - error->all(FLERR,"Pair reax/c requires use of fix qeq/reax or qeq/shielded"); + error->all(FLERR,"Pair reaxff requires use of fix qeq/reaxff or qeq/shielded"); api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts @@ -347,14 +347,14 @@ void PairReaxC::init_style() api->system->wsize = comm->nprocs; if (atom->tag_enable == 0) - error->all(FLERR,"Pair style reax/c requires atom IDs"); + error->all(FLERR,"Pair style reaxff requires atom IDs"); if (force->newton_pair == 0) - error->all(FLERR,"Pair style reax/c requires newton pair on"); + error->all(FLERR,"Pair style reaxff requires newton pair on"); // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT if (atom->natoms > MAXSMALLINT) - error->all(FLERR,"Too many atoms for pair style reax/c"); + error->all(FLERR,"Too many atoms for pair style reaxff"); // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs @@ -368,15 +368,15 @@ void PairReaxC::init_style() error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - if (fix_reax == nullptr) { - modify->add_fix(fmt::format("{} all REAXC",fix_id)); - fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; + if (fix_reaxff == nullptr) { + modify->add_fix(fmt::format("{} all REAXFF",fix_id)); + fix_reaxff = (FixReaxFF *) modify->fix[modify->nfix-1]; } } /* ---------------------------------------------------------------------- */ -void PairReaxC::setup() +void PairReaxFF::setup() { int oldN; int mincap = api->system->mincap; @@ -391,8 +391,8 @@ void PairReaxC::setup() setup_flag = 1; - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; // determine the local and total capacity @@ -408,7 +408,7 @@ void PairReaxC::setup() int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) - error->all(FLERR,"Too many neighbors for pair style reax/c"); + error->all(FLERR,"Too many neighbors for pair style reaxff"); Make_List(api->system->total_cap,num_nbrs,TYP_FAR_NEIGHBOR,api->lists+FAR_NBRS); (api->lists+FAR_NBRS)->error_ptr=error; @@ -440,7 +440,7 @@ void PairReaxC::setup() /* ---------------------------------------------------------------------- */ -double PairReaxC::init_one(int i, int j) +double PairReaxFF::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); @@ -450,16 +450,16 @@ double PairReaxC::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -void PairReaxC::compute(int eflag, int vflag) +void PairReaxFF::compute(int eflag, int vflag) { double evdwl,ecoul; // communicate num_bonds once every reneighboring // 2 num arrays stored by fix, grab ptr to them - if (neighbor->ago == 0) comm->forward_comm_fix(fix_reax); - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + if (neighbor->ago == 0) comm->forward_comm_fix(fix_reaxff); + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; evdwl = ecoul = 0.0; ev_init(eflag,vflag); @@ -528,7 +528,7 @@ void PairReaxC::compute(int eflag, int vflag) api->data->step = update->ntimestep; - // populate tmpid and tmpbo arrays for fix reax/c/species + // populate tmpid and tmpbo arrays for fix reaxff/species int i, j; if (fixspecies_flag) { @@ -552,10 +552,10 @@ void PairReaxC::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairReaxC::write_reax_atoms() +void PairReaxFF::write_reax_atoms() { - int *num_bonds = fix_reax->num_bonds; - int *num_hbonds = fix_reax->num_hbonds; + int *num_bonds = fix_reaxff->num_bonds; + int *num_hbonds = fix_reaxff->num_hbonds; if (api->system->N > api->system->total_cap) error->all(FLERR,"Too many ghost atoms"); @@ -574,7 +574,7 @@ void PairReaxC::write_reax_atoms() /* ---------------------------------------------------------------------- */ -void PairReaxC::get_distance(rvec xj, rvec xi, double *d_sqr, rvec *dvec) +void PairReaxFF::get_distance(rvec xj, rvec xi, double *d_sqr, rvec *dvec) { (*dvec)[0] = xj[0] - xi[0]; (*dvec)[1] = xj[1] - xi[1]; @@ -584,7 +584,7 @@ void PairReaxC::get_distance(rvec xj, rvec xi, double *d_sqr, rvec *dvec) /* ---------------------------------------------------------------------- */ -void PairReaxC::set_far_nbr(far_neighbor_data *fdest, +void PairReaxFF::set_far_nbr(far_neighbor_data *fdest, int j, double d, rvec dvec) { fdest->nbr = j; @@ -595,7 +595,7 @@ void PairReaxC::set_far_nbr(far_neighbor_data *fdest, /* ---------------------------------------------------------------------- */ -int PairReaxC::estimate_reax_lists() +int PairReaxFF::estimate_reax_lists() { int itr_i, itr_j, i, j; int num_nbrs, num_marked; @@ -641,7 +641,7 @@ int PairReaxC::estimate_reax_lists() /* ---------------------------------------------------------------------- */ -int PairReaxC::write_reax_lists() +int PairReaxFF::write_reax_lists() { int itr_i, itr_j, i, j; int num_nbrs; @@ -697,7 +697,7 @@ int PairReaxC::write_reax_lists() /* ---------------------------------------------------------------------- */ -void PairReaxC::read_reax_forces(int /*vflag*/) +void PairReaxFF::read_reax_forces(int /*vflag*/) { for (int i = 0; i < api->system->N; ++i) { api->system->my_atoms[i].f[0] = api->workspace->f[i][0]; @@ -713,7 +713,7 @@ void PairReaxC::read_reax_forces(int /*vflag*/) /* ---------------------------------------------------------------------- */ -void *PairReaxC::extract(const char *str, int &dim) +void *PairReaxFF::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"chi") == 0 && chi) { @@ -739,7 +739,7 @@ void *PairReaxC::extract(const char *str, int &dim) /* ---------------------------------------------------------------------- */ -double PairReaxC::memory_usage() +double PairReaxFF::memory_usage() { double bytes = 0.0; @@ -747,12 +747,12 @@ double PairReaxC::memory_usage() bytes += (double)1.0 * api->system->N * sizeof(int); bytes += (double)1.0 * api->system->N * sizeof(double); - // From reaxc_allocate: BO + // From reaxff_allocate: BO bytes += (double)1.0 * api->system->total_cap * sizeof(reax_atom); bytes += (double)19.0 * api->system->total_cap * sizeof(double); bytes += (double)3.0 * api->system->total_cap * sizeof(int); - // From reaxc_lists + // From reaxff_lists bytes += (double)2.0 * api->lists->n * sizeof(int); bytes += (double)api->lists->num_intrs * sizeof(three_body_interaction_data); bytes += (double)api->lists->num_intrs * sizeof(bond_data); @@ -767,7 +767,7 @@ double PairReaxC::memory_usage() /* ---------------------------------------------------------------------- */ -void PairReaxC::FindBond() +void PairReaxFF::FindBond() { int i, j, pj, nj; double bo_tmp, bo_cut; @@ -788,7 +788,7 @@ void PairReaxC::FindBond() tmpid[i][nj] = j; tmpbo[i][nj] = bo_tmp; nj ++; - if (nj > MAXSPECBOND) error->all(FLERR,"Increase MAXSPECBOND in reaxc_defs.h"); + if (nj > MAXSPECBOND) error->all(FLERR,"Increase MAXSPECBOND in reaxff_defs.h"); } } } diff --git a/src/REAXFF/pair_reaxc.h b/src/REAXFF/pair_reaxff.h similarity index 88% rename from src/REAXFF/pair_reaxc.h rename to src/REAXFF/pair_reaxff.h index 36f5bf61d5..f9f3b636c3 100644 --- a/src/REAXFF/pair_reaxc.h +++ b/src/REAXFF/pair_reaxff.h @@ -24,12 +24,13 @@ #ifdef PAIR_CLASS // clang-format off -PairStyle(reax/c,PairReaxC); +PairStyle(reaxff,PairReaxFF); +PairStyle(reax/c,PairReaxFF); // clang-format on #else -#ifndef LMP_PAIR_REAXC_H -#define LMP_PAIR_REAXC_H +#ifndef LMP_PAIR_REAXFF_H +#define LMP_PAIR_REAXFF_H #include "pair.h" @@ -40,10 +41,10 @@ namespace ReaxFF { namespace LAMMPS_NS { -class PairReaxC : public Pair { +class PairReaxFF : public Pair { public: - PairReaxC(class LAMMPS *); - ~PairReaxC(); + PairReaxFF(class LAMMPS *); + ~PairReaxFF(); void compute(int, int); void settings(int, char **); void coeff(int, char **); @@ -60,7 +61,7 @@ class PairReaxC : public Pair { protected: char *fix_id; double cutmax; - class FixReaxC *fix_reax; + class FixReaxFF *fix_reaxff; double *chi,*eta,*gamma; int qeqflag; @@ -93,7 +94,7 @@ protected: E: Too many ghost atoms Number of ghost atoms has increased too much during simulation and has exceeded -the size of reax/c arrays. Increase safe_zone and min_cap in pair_style reax/c +the size of reaxff arrays. Increase safe_zone and min_cap in pair_style reaxff command */ diff --git a/src/REAXFF/reaxc_allocate.cpp b/src/REAXFF/reaxff_allocate.cpp similarity index 100% rename from src/REAXFF/reaxc_allocate.cpp rename to src/REAXFF/reaxff_allocate.cpp diff --git a/src/REAXFF/reaxc_bond_orders.cpp b/src/REAXFF/reaxff_bond_orders.cpp similarity index 100% rename from src/REAXFF/reaxc_bond_orders.cpp rename to src/REAXFF/reaxff_bond_orders.cpp diff --git a/src/REAXFF/reaxc_bonds.cpp b/src/REAXFF/reaxff_bonds.cpp similarity index 100% rename from src/REAXFF/reaxc_bonds.cpp rename to src/REAXFF/reaxff_bonds.cpp diff --git a/src/REAXFF/reaxc_control.cpp b/src/REAXFF/reaxff_control.cpp similarity index 100% rename from src/REAXFF/reaxc_control.cpp rename to src/REAXFF/reaxff_control.cpp diff --git a/src/REAXFF/reaxff_defs.h b/src/REAXFF/reaxff_defs.h index 868f6e22c2..c6df5de0ea 100644 --- a/src/REAXFF/reaxff_defs.h +++ b/src/REAXFF/reaxff_defs.h @@ -50,8 +50,8 @@ #define DANGER_ZONE 0.90 #define LOOSE_ZONE 0.75 -#define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reaxc.cpp */ -#define MAXSPECBOND 24 /* used in fix_reaxc_species.cpp and pair_reaxc.cpp */ +#define MAXREAXBOND 24 /* used in fix_reaxff_bonds.cpp and pair_reaxff.cpp */ +#define MAXSPECBOND 24 /* used in fix_reaxff_species.cpp and pair_reaxff.cpp */ #define REAX_MAX_3BODY_PARAM 5 #define REAX_MAX_4BODY_PARAM 5 diff --git a/src/REAXFF/reaxc_ffield.cpp b/src/REAXFF/reaxff_ffield.cpp similarity index 100% rename from src/REAXFF/reaxc_ffield.cpp rename to src/REAXFF/reaxff_ffield.cpp diff --git a/src/REAXFF/reaxc_forces.cpp b/src/REAXFF/reaxff_forces.cpp similarity index 100% rename from src/REAXFF/reaxc_forces.cpp rename to src/REAXFF/reaxff_forces.cpp diff --git a/src/REAXFF/reaxc_hydrogen_bonds.cpp b/src/REAXFF/reaxff_hydrogen_bonds.cpp similarity index 100% rename from src/REAXFF/reaxc_hydrogen_bonds.cpp rename to src/REAXFF/reaxff_hydrogen_bonds.cpp diff --git a/src/REAXFF/reaxc_init_md.cpp b/src/REAXFF/reaxff_init_md.cpp similarity index 100% rename from src/REAXFF/reaxc_init_md.cpp rename to src/REAXFF/reaxff_init_md.cpp diff --git a/src/REAXFF/reaxc_list.cpp b/src/REAXFF/reaxff_list.cpp similarity index 100% rename from src/REAXFF/reaxc_list.cpp rename to src/REAXFF/reaxff_list.cpp diff --git a/src/REAXFF/reaxc_lookup.cpp b/src/REAXFF/reaxff_lookup.cpp similarity index 100% rename from src/REAXFF/reaxc_lookup.cpp rename to src/REAXFF/reaxff_lookup.cpp diff --git a/src/REAXFF/reaxc_multi_body.cpp b/src/REAXFF/reaxff_multi_body.cpp similarity index 100% rename from src/REAXFF/reaxc_multi_body.cpp rename to src/REAXFF/reaxff_multi_body.cpp diff --git a/src/REAXFF/reaxc_nonbonded.cpp b/src/REAXFF/reaxff_nonbonded.cpp similarity index 100% rename from src/REAXFF/reaxc_nonbonded.cpp rename to src/REAXFF/reaxff_nonbonded.cpp diff --git a/src/REAXFF/reaxc_reset_tools.cpp b/src/REAXFF/reaxff_reset_tools.cpp similarity index 100% rename from src/REAXFF/reaxc_reset_tools.cpp rename to src/REAXFF/reaxff_reset_tools.cpp diff --git a/src/REAXFF/reaxc_tool_box.cpp b/src/REAXFF/reaxff_tool_box.cpp similarity index 100% rename from src/REAXFF/reaxc_tool_box.cpp rename to src/REAXFF/reaxff_tool_box.cpp diff --git a/src/REAXFF/reaxc_torsion_angles.cpp b/src/REAXFF/reaxff_torsion_angles.cpp similarity index 100% rename from src/REAXFF/reaxc_torsion_angles.cpp rename to src/REAXFF/reaxff_torsion_angles.cpp diff --git a/src/REAXFF/reaxc_valence_angles.cpp b/src/REAXFF/reaxff_valence_angles.cpp similarity index 100% rename from src/REAXFF/reaxc_valence_angles.cpp rename to src/REAXFF/reaxff_valence_angles.cpp diff --git a/tools/README b/tools/README index 0f6f36e78a..eb329e27cd 100644 --- a/tools/README +++ b/tools/README @@ -43,7 +43,6 @@ phonon post-process output of the fix phonon command polybond Python tool for programmable polymer bonding pymol_asphere convert LAMMPS output of ellipsoids to PyMol format python Python scripts for post-processing LAMMPS output -reax Tools for analyzing output of ReaxFF simulations replica tool to reorder LAMMPS replica trajectories according to temperature singularity Singularity container descriptions suitable for LAMMPS development smd convert Smooth Mach Dynamics triangles to VTK diff --git a/tools/reax/Cutoff.dic b/tools/reax/Cutoff.dic deleted file mode 100644 index 7c52b74468..0000000000 --- a/tools/reax/Cutoff.dic +++ /dev/null @@ -1,14 +0,0 @@ -# Interesting name. This file contains -# the bond-order cut off for each -# pair of ReaxFF elements -C N 0.3 -C C 0.55 -C O 0.65 -C H 0.4 -O O 0.65 -N O 0.40 -O H 0.4 -H H 0.55 -H N 0.55 -N N 0.55 -# diff --git a/tools/reax/README.txt b/tools/reax/README.txt deleted file mode 100644 index 3c9fe4506b..0000000000 --- a/tools/reax/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -=== ReaxFF tools === -=============================== - -The programs in this folder can be used to analyze the -output of simulations using the ReaxFF potentials; - -reaxc_bond.pl: reads the bonding information in the - .trj file produced by pair_style reax/c and - outputs molecule counts for each frame. - diff --git a/tools/reax/reaxc_bond.pl b/tools/reax/reaxc_bond.pl deleted file mode 100755 index cc0fd8f238..0000000000 --- a/tools/reax/reaxc_bond.pl +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl -use Getopt::Long; -Getopt::Long::Configure ('bundling'); - -################################################################# -# # -# This script is designed to take the bond information from a # -# Lammps/reaxc *.trj file and output a molecular fraction file # -# for each frame. # -# # -# written by Mike Russo, PSU # -# modified by Aidan Thompson, 5/12/2011 # -# # -# The required .trj file is generated by running LAMMPS # -# with pair_style reax/c and the following settings in # -# the corresponding reax/c control file # -# write_freq 25 ! write trajectory after so many steps -# traj_compress 0 ! 0: no compression 1: uses zlib to compress trajectory output -# traj_title TATB ! (no white spaces) -# atom_info 0 ! 0: no atom info, 1: print basic atom info in the trajectory file -# atom_forces 0 ! 0: basic atom format, 1: print force on each atom in the trajectory file -# atom_velocities 0 ! 0: basic atom format, 1: print the velocity of each atom in the trajectory file -# bond_info 1 ! 0: do not print bonds, 1: print bonds in the trajectory file -# angle_info 0 ! 0: do not print angles, 1: print angles in the trajectory file -# # -################################################################# - -################################################################# -# Setting up some default variables, and options for the user # -# to input. # -################################################################# -$in_file = "bonds.trj"; -@test = qw(C H O N); -GetOptions ('f|file=s' => \$in_file, 'a|atoms=s' => \@atoms, 'h|help' => \$help); -if($help) { - print "Options for this program:\n-f --file for input file default= bonds.trj\n-a --atoms atom types (in correct order and input separately) default= @test\n"; - exit; -} -open INPUT, "<$in_file" or die "Cannot open $in_file: $!"; -open OUTPUT, ">frac.dat" or die "Cannot open output file: $!"; - -if(@atoms) { - @test = @atoms; -} - -print "Input for this run:\n Input file = $in_file\n Atom types = @test\n"; -################################################################# - -################################################################# -# Main loop of the script. Goes through each frames bond list. # -################################################################# -$i = 0; -$section = 0; -$at_count = -1; -while() { - if(/chars_to_skip_section/) { - $section++; - &bonds if($section > 2); - next; - } - next if($section <= 0); #skipping the header section - next if(/\s*[A-Za-z]/); #skip text lines - - split; - if ($section == 1) { - $q = $_[0]; - $temp = $_[1]; - $q--; - $at_type[$q] = $temp; - next; - } - - $_[0]--; - $_[1]--; -# Add i-j and j-i entries - push @{$list[$_[0]]}, $_[1]; - push @{$list[$_[1]]}, $_[0]; - $at_count++ if($section == 2); -} -$section++; -&bonds; -close(INPUT); -################################################################# - -################################################################# -# Subroutine bonds: Uses the bond information to generate a # -# count for each species, put them into molecules, and then # -# count the number of each molecule type. # -################################################################# -sub bonds { - $flag = (); - $k = 0; - for(0..$#list) { - if($flag[$_] == 0) { - push @{$full_list[$k]}, $_; - foreach $atom (@{$full_list[$k]}) { - for($o = 0; $o <= $#{$list[$atom]}; $o++) { - unless(grep /^$list[$atom][$o]$/, @{$full_list[$k]}) { - push @{$full_list[$k]}, $list[$atom][$o]; - $flag[$list[$atom][$o]] = 1; - } - } - } - } else { - next; - } - $k++; - } - -### Output section ### - $frame = $section - 2; - open OUTPUT2, ">temp_$frame.dat" or die "Cannot open temp file: $!"; - print OUTPUT2 "Frame # $frame\n"; - for($m = 0; $m < $k; $m++) { #cycle through each molecule - foreach $atom ((@{$full_list[$m]})) { #for each atom in this molecule - ${"$test[$at_type[$atom]]"} += 1; #Create variable named C,H,O, etc and set it to count - } - print OUTPUT2 "Mol $m = "; - foreach $atom (@test) { - print OUTPUT2 "$atom${$atom}" if(${$atom} > 0); - } - print OUTPUT2 "\n"; - for($r = 0; $r <= $#test; $r++) { - ${"$test[$r]"} = 0; - } - } - - close (OUTPUT2); #close the temp file as output - open INPUT3, ") { - next if(/Frame/); - split; - push @mol_list, $_[3] unless(grep /^$_[3]$/, @mol_list); - ${"$_[3]"}++; - } - print OUTPUT "Frame # $frame\n"; - foreach $mol (@mol_list) { - printf OUTPUT "%4d %s\n", ${"$mol"}, $mol; - ${"$mol"} = 0; - } - @mol_list = (); -### - -### Cleanup between frames ### - for(0..$at_count) { - @{$full_list[$_]} = (); - @{$list[$_]} = (); - } -### -} -################################################################# - From e12070316b4f8c30b8904a6cdd9fc29c8d6696ba Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:00:18 -0400 Subject: [PATCH 103/119] fix spelling issue --- doc/utils/sphinx-config/false_positives.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 45728b5caf..778fa93e84 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -2744,6 +2744,7 @@ reamin reax REAXFF ReaxFF +reaxff rebo recursing Ree From 03249dec8bf86e59906db4c6cc9102847e8ac4c9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:00:27 -0400 Subject: [PATCH 104/119] reformat --- src/compute_pair.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index a5bf54d5ef..7e1b6fc062 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -14,12 +14,13 @@ #include "compute_pair.h" -#include -#include -#include "update.h" +#include "error.h" #include "force.h" #include "pair.h" -#include "error.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -89,9 +90,9 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : ComputePair::~ComputePair() { - delete [] pstyle; - delete [] one; - delete [] vector; + delete[] pstyle; + delete[] one; + delete[] vector; } /* ---------------------------------------------------------------------- */ From 5b46e679c818535a78723c33110c109dc954deb4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:00:43 -0400 Subject: [PATCH 105/119] update style names --- unittest/force-styles/tests/atomic-pair-reax_c.yaml | 8 ++++---- unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml | 8 ++++---- unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml | 4 ++-- .../force-styles/tests/atomic-pair-reax_c_tabulate.yaml | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index 9eaad2a949..c4d41a2f2a 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -3,8 +3,8 @@ lammps_version: 2 Jul 2021 date_generated: Wed Jul 21 15:49:45 2021 epsilon: 1e-11 prerequisites: ! | - pair reax/c - fix qeq/reax + pair reaxff + fix qeq/reaxff pre_commands: ! | echo screen variable newton_pair delete @@ -27,9 +27,9 @@ pre_commands: ! | set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c + fix qeq all qeq/reaxff 1 0.0 8.0 1.0e-20 reaxff input_file: in.empty -pair_style: reax/c NULL checkqeq yes +pair_style: reaxff NULL checkqeq yes pair_coeff: ! | * * ffield.reax.mattsson H C O extract: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index 59cb7b5261..c766c242f9 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -3,8 +3,8 @@ lammps_version: 2 Jul 2021 date_generated: Wed Jul 21 15:49:47 2021 epsilon: 1e-12 prerequisites: ! | - pair reax/c - fix qeq/reax + pair reaxff + fix qeq/reaxff pre_commands: ! | echo screen variable newton_pair delete @@ -27,9 +27,9 @@ pre_commands: ! | set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c + fix qeq all qeq/reaxff 1 0.0 8.0 1.0e-20 reaxff input_file: in.empty -pair_style: reax/c NULL checkqeq yes lgvdw yes safezone 1.6 +pair_style: reaxff NULL checkqeq yes lgvdw yes safezone 1.6 pair_coeff: ! | * * ffield.reax.lg H C O extract: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index 97fbc95c46..de9527d99e 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -3,7 +3,7 @@ lammps_version: 2 Jul 2021 date_generated: Wed Jul 21 15:49:48 2021 epsilon: 5e-13 prerequisites: ! | - pair reax/c + pair reaxff pre_commands: ! | echo screen variable newton_pair delete @@ -24,7 +24,7 @@ pre_commands: ! | velocity all create 100 4534624 loop geom post_commands: ! "" input_file: in.empty -pair_style: reax/c NULL checkqeq no +pair_style: reaxff NULL checkqeq no pair_coeff: ! | * * ffield.reax.mattsson C C extract: ! "" diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml index 23e046037c..59a7f2eea4 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_tabulate.yaml @@ -3,8 +3,8 @@ lammps_version: 2 Jul 2021 date_generated: Wed Jul 21 15:49:50 2021 epsilon: 1e-12 prerequisites: ! | - pair reax/c - fix qeq/reax + pair reaxff + fix qeq/reaxff pre_commands: ! | echo screen shell cp ${input_dir}/reaxff.control reaxff-1.control @@ -28,9 +28,9 @@ pre_commands: ! | set type 3 charge -0.01 velocity all create 100 4534624 loop geom post_commands: ! | - fix qeq all qeq/reax 1 0.0 8.0 1.0e-20 reax/c + fix qeq all qeq/reaxff 1 0.0 8.0 1.0e-20 reaxff input_file: in.empty -pair_style: reax/c reaxff-1.control checkqeq yes +pair_style: reaxff reaxff-1.control checkqeq yes pair_coeff: ! | * * ffield.reax.mattsson H C O extract: ! "" From 9cf50eb4db669ee7f6b9a0e5fc5647db535eba8a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:44:18 -0400 Subject: [PATCH 106/119] add allocation and reduction for per-atom stress with OpenMP --- src/OPENMP/pair_reaxff_omp.cpp | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/OPENMP/pair_reaxff_omp.cpp b/src/OPENMP/pair_reaxff_omp.cpp index 48fa9e8312..69d68e67e8 100644 --- a/src/OPENMP/pair_reaxff_omp.cpp +++ b/src/OPENMP/pair_reaxff_omp.cpp @@ -58,6 +58,7 @@ #include #endif +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; using namespace ReaxFF; @@ -236,7 +237,21 @@ void PairReaxFFOMP::compute(int eflag, int vflag) api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts api->system->bigN = static_cast (atom->natoms); // all atoms in the system + const int nall = api->system->N; +#if defined(_OPENMP) +#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag) +#endif + { +#if defined(_OPENMP) + int tid = omp_get_thread_num(); +#else + int tid = 0; +#endif + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::START); + ev_setup_thr(eflag, vflag, api->system->N, eatom, vatom, nullptr, thr); + } // setup data structures setup(); @@ -253,6 +268,27 @@ void PairReaxFFOMP::compute(int eflag, int vflag) Compute_ForcesOMP(api->system,api->control,api->data,api->workspace,&api->lists); read_reax_forces(vflag); + const int nthreads = comm->nthreads; +#if defined(_OPENMP) +#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(vflag) +#endif + { +#if defined(_OPENMP) + int tid = omp_get_thread_num(); +#else + int tid = 0; +#endif + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::PAIR); + + // the pair style reduces energy and forces directly. so only reduce virial/ + // per-atom virial and per-atom centroid virial are the same for two-body + // many-body pair styles not yet implemented + if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) { + data_reduce_thr(&(vatom[0][0]), nall , nthreads, 6, tid); + } + } + #if defined(_OPENMP) #pragma omp parallel for schedule(static) #endif From c78d4eab36dcc36be52884fb93519b2d8ec05258 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:52:43 -0400 Subject: [PATCH 107/119] update standard examples for new style names --- .../reaxff/{in.reaxc.rdx => in.reaxff.rdx} | 9 +- ...xc.rdx-shielded => in.reaxff.rdx-shielded} | 9 +- .../reaxff/{in.reaxc.tatb => in.reaxff.tatb} | 13 +- ....tatb-shielded => in.reaxff.tatb-shielded} | 13 +- .../log.21Apr21.reaxc.rdx-shielded.g++.4 | 154 ------------------ examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 | 154 ------------------ examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 | 154 ------------------ .../log.21Apr21.reaxc.tatb-shielded.g++.1 | 154 ------------------ .../log.21Apr21.reaxc.tatb-shielded.g++.4 | 154 ------------------ examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 | 154 ------------------ examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 | 154 ------------------ .../log.21Jul21.reaxff.rdx-shielded.g++.1 | 144 ++++++++++++++++ .../log.21Jul21.reaxff.rdx-shielded.g++.4 | 144 ++++++++++++++++ ...ded.g++.1 => log.21Jul21.reaxff.rdx.g++.1} | 60 +++---- examples/reaxff/log.21Jul21.reaxff.rdx.g++.4 | 154 ++++++++++++++++++ .../log.21Jul21.reaxff.tatb-shielded.g++.1 | 142 ++++++++++++++++ .../log.21Jul21.reaxff.tatb-shielded.g++.4 | 142 ++++++++++++++++ examples/reaxff/log.21Jul21.reaxff.tatb.g++.1 | 151 +++++++++++++++++ examples/reaxff/log.21Jul21.reaxff.tatb.g++.4 | 151 +++++++++++++++++ 19 files changed, 1078 insertions(+), 1132 deletions(-) rename examples/reaxff/{in.reaxc.rdx => in.reaxff.rdx} (84%) rename examples/reaxff/{in.reaxc.rdx-shielded => in.reaxff.rdx-shielded} (84%) rename examples/reaxff/{in.reaxc.tatb => in.reaxff.tatb} (78%) rename examples/reaxff/{in.reaxc.tatb-shielded => in.reaxff.tatb-shielded} (77%) delete mode 100644 examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 delete mode 100644 examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 create mode 100644 examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.1 create mode 100644 examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.4 rename examples/reaxff/{log.21Apr21.reaxc.rdx-shielded.g++.1 => log.21Jul21.reaxff.rdx.g++.1} (78%) create mode 100644 examples/reaxff/log.21Jul21.reaxff.rdx.g++.4 create mode 100644 examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.1 create mode 100644 examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.4 create mode 100644 examples/reaxff/log.21Jul21.reaxff.tatb.g++.1 create mode 100644 examples/reaxff/log.21Jul21.reaxff.tatb.g++.4 diff --git a/examples/reaxff/in.reaxc.rdx b/examples/reaxff/in.reaxff.rdx similarity index 84% rename from examples/reaxff/in.reaxc.rdx rename to examples/reaxff/in.reaxff.rdx index 36bf2a6e8c..82a582e958 100644 --- a/examples/reaxff/in.reaxc.rdx +++ b/examples/reaxff/in.reaxff.rdx @@ -1,15 +1,14 @@ # ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx units real atom_style charge read_data data.rdx -pair_style reax/c control.reax_c.rdx +pair_style reaxff control.reax_c.rdx pair_coeff * * ffield.reax C H O N -compute reax all pair reax/c +compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] @@ -30,7 +29,7 @@ neighbor 2.5 bin neigh_modify every 10 delay 0 check no fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff variable nqeq equal f_2 @@ -41,7 +40,7 @@ thermo_style custom step temp epair etotal press & timestep 1.0 -#dump 1 all atom 10 dump.reaxc.rdx +#dump 1 all atom 10 dump.reaxff.rdx #dump 2 all image 25 image.*.jpg type type & # axes yes 0.8 0.02 view 60 -30 diff --git a/examples/reaxff/in.reaxc.rdx-shielded b/examples/reaxff/in.reaxff.rdx-shielded similarity index 84% rename from examples/reaxff/in.reaxc.rdx-shielded rename to examples/reaxff/in.reaxff.rdx-shielded index 2151f63a5f..d1a5f0beaa 100644 --- a/examples/reaxff/in.reaxc.rdx-shielded +++ b/examples/reaxff/in.reaxff.rdx-shielded @@ -1,15 +1,14 @@ # ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx units real atom_style charge read_data data.rdx -pair_style reax/c control.reax_c.rdx +pair_style reaxff control.reax_c.rdx pair_coeff * * ffield.reax C H O N -compute reax all pair reax/c +compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] @@ -30,7 +29,7 @@ neighbor 2.5 bin neigh_modify every 10 delay 0 check no fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff variable nqeq equal f_2 thermo 10 @@ -40,7 +39,7 @@ thermo_style custom step temp epair etotal press & timestep 1.0 -#dump 1 all atom 10 dump.reaxc.rdx +#dump 1 all atom 10 dump.reaxff.rdx #dump 2 all image 25 image.*.jpg type type & # axes yes 0.8 0.02 view 60 -30 diff --git a/examples/reaxff/in.reaxc.tatb b/examples/reaxff/in.reaxff.tatb similarity index 78% rename from examples/reaxff/in.reaxc.tatb rename to examples/reaxff/in.reaxff.tatb index 474290340f..6cf7828cf1 100644 --- a/examples/reaxff/in.reaxc.tatb +++ b/examples/reaxff/in.reaxff.tatb @@ -1,15 +1,14 @@ # ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, units real atom_style charge read_data data.tatb -pair_style reax/c control.reax_c.tatb +pair_style reaxff control.reax_c.tatb pair_coeff * * ffield.reax C H O N -compute reax all pair reax/c +compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] @@ -30,8 +29,8 @@ neighbor 2.5 bin neigh_modify delay 0 every 5 check no fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff variable nqeq equal f_2 thermo 5 @@ -41,7 +40,7 @@ thermo_style custom step temp epair etotal press & timestep 0.0625 -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z #dump 2 all image 5 image.*.jpg type type & # axes yes 0.8 0.02 view 60 -30 @@ -51,6 +50,6 @@ timestep 0.0625 # axes yes 0.8 0.02 view 60 -30 #dump_modify 3 pad 3 -fix 3 all reax/c/species 1 5 5 species.tatb +fix 3 all reaxff/species 1 5 5 species.tatb run 25 diff --git a/examples/reaxff/in.reaxc.tatb-shielded b/examples/reaxff/in.reaxff.tatb-shielded similarity index 77% rename from examples/reaxff/in.reaxc.tatb-shielded rename to examples/reaxff/in.reaxff.tatb-shielded index aeac3308a8..5a809ecdd2 100644 --- a/examples/reaxff/in.reaxc.tatb-shielded +++ b/examples/reaxff/in.reaxff.tatb-shielded @@ -1,15 +1,14 @@ # ReaxFF potential for TATB system -# this run is equivalent to reax/in.reax.tatb, units real atom_style charge read_data data.tatb -pair_style reax/c control.reax_c.tatb +pair_style reaxff control.reax_c.tatb pair_coeff * * ffield.reax C H O N -compute reax all pair reax/c +compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] @@ -30,8 +29,8 @@ neighbor 2.5 bin neigh_modify delay 0 every 5 check no fix 1 all nve -fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reax/c -fix 4 all reax/c/bonds 5 bonds.reaxc +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff variable nqeq equal f_2 thermo 5 @@ -41,7 +40,7 @@ thermo_style custom step temp epair etotal press & timestep 0.0625 -#dump 1 all custom 100 dump.reaxc.tatb id type q x y z +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z #dump 2 all image 5 image.*.jpg type type & # axes yes 0.8 0.02 view 60 -30 @@ -51,6 +50,6 @@ timestep 0.0625 # axes yes 0.8 0.02 view 60 -30 #dump_modify 3 pad 3 -fix 3 all reax/c/species 1 5 5 species.tatb +fix 3 all reaxff/species 1 5 5 species.tatb run 25 diff --git a/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 b/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 deleted file mode 100644 index 79fa5f77b2..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.4 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.617778 on 1 procs for 100 steps with 21 atoms - -Performance: 13.986 ns/day, 1.716 hours/ns, 161.871 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52159 | 0.52159 | 0.52159 | 0.0 | 84.43 -Neigh | 0.03479 | 0.03479 | 0.03479 | 0.0 | 5.63 -Comm | 0.0017166 | 0.0017166 | 0.0017166 | 0.0 | 0.28 -Output | 0.00061226 | 0.00061226 | 0.00061226 | 0.0 | 0.10 -Modify | 0.058924 | 0.058924 | 0.058924 | 0.0 | 9.54 -Other | | 0.0001466 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 b/examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 deleted file mode 100644 index 38347ffce7..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.rdx.g++.1 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.618477 on 1 procs for 100 steps with 21 atoms - -Performance: 13.970 ns/day, 1.718 hours/ns, 161.687 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52329 | 0.52329 | 0.52329 | 0.0 | 84.61 -Neigh | 0.03397 | 0.03397 | 0.03397 | 0.0 | 5.49 -Comm | 0.0017006 | 0.0017006 | 0.0017006 | 0.0 | 0.27 -Output | 0.00060892 | 0.00060892 | 0.00060892 | 0.0 | 0.10 -Modify | 0.058764 | 0.058764 | 0.058764 | 0.0 | 9.50 -Other | | 0.0001407 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 b/examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 deleted file mode 100644 index a409cbe358..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.rdx.g++.4 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.618479 on 1 procs for 100 steps with 21 atoms - -Performance: 13.970 ns/day, 1.718 hours/ns, 161.687 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52299 | 0.52299 | 0.52299 | 0.0 | 84.56 -Neigh | 0.034338 | 0.034338 | 0.034338 | 0.0 | 5.55 -Comm | 0.0017166 | 0.0017166 | 0.0017166 | 0.0 | 0.28 -Output | 0.00060272 | 0.00060272 | 0.00060272 | 0.0 | 0.10 -Modify | 0.058692 | 0.058692 | 0.058692 | 0.0 | 9.49 -Other | | 0.0001385 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 b/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 deleted file mode 100644 index dac271442b..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.1 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.618214 on 1 procs for 100 steps with 21 atoms - -Performance: 13.976 ns/day, 1.717 hours/ns, 161.756 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52298 | 0.52298 | 0.52298 | 0.0 | 84.60 -Neigh | 0.033964 | 0.033964 | 0.033964 | 0.0 | 5.49 -Comm | 0.001708 | 0.001708 | 0.001708 | 0.0 | 0.28 -Output | 0.00060844 | 0.00060844 | 0.00060844 | 0.0 | 0.10 -Modify | 0.058812 | 0.058812 | 0.058812 | 0.0 | 9.51 -Other | | 0.0001411 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 b/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 deleted file mode 100644 index 74c2a13875..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.tatb-shielded.g++.4 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.617311 on 1 procs for 100 steps with 21 atoms - -Performance: 13.996 ns/day, 1.715 hours/ns, 161.993 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52226 | 0.52226 | 0.52226 | 0.0 | 84.60 -Neigh | 0.033952 | 0.033952 | 0.033952 | 0.0 | 5.50 -Comm | 0.0017183 | 0.0017183 | 0.0017183 | 0.0 | 0.28 -Output | 0.00060129 | 0.00060129 | 0.00060129 | 0.0 | 0.10 -Modify | 0.058648 | 0.058648 | 0.058648 | 0.0 | 9.50 -Other | | 0.0001364 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 b/examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 deleted file mode 100644 index d79287b694..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.tatb.g++.1 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.617401 on 1 procs for 100 steps with 21 atoms - -Performance: 13.994 ns/day, 1.715 hours/ns, 161.969 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52185 | 0.52185 | 0.52185 | 0.0 | 84.52 -Neigh | 0.034507 | 0.034507 | 0.034507 | 0.0 | 5.59 -Comm | 0.0017211 | 0.0017211 | 0.0017211 | 0.0 | 0.28 -Output | 0.00060844 | 0.00060844 | 0.00060844 | 0.0 | 0.10 -Modify | 0.058573 | 0.058573 | 0.058573 | 0.0 | 9.49 -Other | | 0.0001466 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 b/examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 deleted file mode 100644 index e0cb6b6760..0000000000 --- a/examples/reaxff/log.21Apr21.reaxc.tatb.g++.4 +++ /dev/null @@ -1,154 +0,0 @@ -LAMMPS (8 Apr 2021) - using 1 OpenMP thread(s) per MPI task -# ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx - -units real - -atom_style charge -read_data data.rdx -Reading data file ... - orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 21 atoms - read_data CPU = 0.001 seconds - -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) -pair_coeff * * ffield.reax C H O N -Reading potential file ffield.reax with DATE: 2010-02-19 - -compute reax all pair reax/c - -variable eb equal c_reax[1] -variable ea equal c_reax[2] -variable elp equal c_reax[3] -variable emol equal c_reax[4] -variable ev equal c_reax[5] -variable epen equal c_reax[6] -variable ecoa equal c_reax[7] -variable ehb equal c_reax[8] -variable et equal c_reax[9] -variable eco equal c_reax[10] -variable ew equal c_reax[11] -variable ep equal c_reax[12] -variable efi equal c_reax[13] -variable eqeq equal c_reax[14] - -neighbor 2.5 bin -neigh_modify every 10 delay 0 check no - -fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c - -variable nqeq equal f_2 - -thermo 10 -thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - -timestep 1.0 - -#dump 1 all atom 10 dump.reaxc.rdx - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -run 100 - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Your simulation uses code contributions which should be cited: - -- pair reax/c command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -- fix qeq/reax command: - -@Article{Aktulga12, - author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, - title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, - journal = {Parallel Computing}, - year = 2012, - volume = 38, - pages = {245--259} -} - -CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE - -Neighbor list info ... - update every 10 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12.5 - ghost atom cutoff = 12.5 - binsize = 6.25, bins = 3 3 3 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual - attributes: half, newton off, ghost - pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff - bin: standard - (2) fix qeq/reax, perpetual, copy from (1) - attributes: half, newton off, ghost - pair build: copy - stencil: none - bin: none -Per MPI rank memory allocation (min/avg/max) = 13.36 | 13.36 | 13.36 Mbytes -Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq - 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79931 0 168.88396 12.5 - 10 1288.6116 -1989.6644 -1912.8422 -19456.353 -2734.6769 -15.607221 0.2017796 0 54.629557 3.125229 -77.7067 0 14.933901 -5.8108541 843.92073 -180.43321 0 107.75935 8 - 20 538.95819 -1942.7037 -1910.5731 -10725.639 -2803.7394 7.9078269 0.07792668 0 81.610053 0.22951941 -57.557107 0 30.331207 -10.178049 878.99009 -159.68914 0 89.313379 7 - 30 463.09535 -1933.5765 -1905.9686 -33255.546 -2749.859 -8.0154745 0.02762893 0 81.627395 0.11972413 -50.262293 0 20.820303 -9.6327015 851.88715 -149.49499 0 79.205727 8 - 40 885.49171 -1958.9125 -1906.1229 -4814.6856 -2795.644 9.150669 0.13747498 0 70.947982 0.24360485 -57.862663 0 19.076496 -11.141218 873.73893 -159.99393 0 92.434096 11 - 50 861.16578 -1954.4599 -1903.1205 -1896.7713 -2784.845 3.8270515 0.15793266 0 79.851823 3.3492142 -78.06613 0 32.629016 -7.956541 872.81838 -190.98567 0 114.75995 10 - 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 - 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 - 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 - 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.617397 on 1 procs for 100 steps with 21 atoms - -Performance: 13.994 ns/day, 1.715 hours/ns, 161.970 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.52183 | 0.52183 | 0.52183 | 0.0 | 84.52 -Neigh | 0.034217 | 0.034217 | 0.034217 | 0.0 | 5.54 -Comm | 0.0017104 | 0.0017104 | 0.0017104 | 0.0 | 0.28 -Output | 0.00059891 | 0.00059891 | 0.00059891 | 0.0 | 0.10 -Modify | 0.0589 | 0.0589 | 0.0589 | 0.0 | 9.54 -Other | | 0.0001419 | | | 0.02 - -Nlocal: 21.0000 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 546.000 ave 546 max 546 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1096.00 ave 1096 max 1096 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1096 -Ave neighs/atom = 52.190476 -Neighbor list builds = 10 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.1 b/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.1 new file mode 100644 index 0000000000..7a0fcf53b5 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.1 @@ -0,0 +1,144 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reaxff control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxff.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 13.86 | 13.86 | 13.86 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.181 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79932 0 168.88397 12 + 10 1288.6114 -1989.6644 -1912.8422 -19456.349 -2734.6769 -15.607218 0.20177961 0 54.629555 3.1252297 -77.7067 0 14.933901 -5.810854 843.92074 -180.43322 0 107.75935 8 + 20 538.95852 -1942.7037 -1910.5731 -10725.667 -2803.7395 7.9078343 0.077926704 0 81.610044 0.22951937 -57.557105 0 30.331203 -10.178049 878.99016 -159.69263 0 89.316862 7 + 30 463.09515 -1933.5765 -1905.9685 -33255.499 -2749.8591 -8.0154635 0.02762867 0 81.627413 0.1197239 -50.262272 0 20.82032 -9.632703 851.88721 -149.49497 0 79.205707 8 + 40 885.49689 -1958.9125 -1906.1226 -4814.6325 -2795.644 9.1505916 0.13747481 0 70.948074 0.24360544 -57.862695 0 19.076518 -11.14121 873.73893 -159.9939 0 92.434061 11 + 50 861.16008 -1954.4602 -1903.1211 -1896.648 -2784.8451 3.8269988 0.1579331 0 79.851597 3.349208 -78.066133 0 32.628942 -7.9565363 872.8186 -190.98572 0 114.76001 10 + 60 1167.7831 -1971.8435 -1902.2247 -3482.927 -2705.8639 -17.121541 0.22749081 0 44.507721 7.8559737 -74.789039 0 16.2565 -4.6046718 835.8307 -188.33687 0 114.19412 10 + 70 1439.9897 -1989.3024 -1903.4557 23845.83 -2890.7894 31.958658 0.26671716 0 85.758318 3.1804201 -71.002959 0 24.35723 -10.31128 905.86819 -175.38505 0 106.79678 10 + 80 502.39931 -1930.7551 -1900.804 -20356.375 -2703.8109 -18.66274 0.1128617 0 99.80351 2.0329611 -76.171312 0 19.236815 -6.2786426 826.47424 -166.03148 0 92.539616 9 + 90 749.08601 -1946.984 -1902.3264 17798.716 -2863.7585 42.068606 0.24338046 0 96.181674 0.96183581 -69.955564 0 24.615514 -11.582742 903.68878 -190.13822 0 120.69121 11 + 100 1109.6946 -1968.588 -1902.4322 -4490.4001 -2755.899 -7.1224954 0.21757676 0 61.805955 7.0825894 -75.645488 0 20.115437 -6.2372635 863.56481 -198.56946 0 122.09935 10 +Loop time of 0.23792 on 1 procs for 100 steps with 21 atoms + +Performance: 36.315 ns/day, 0.661 hours/ns, 420.310 timesteps/s +99.3% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.21046 | 0.21046 | 0.21046 | 0.0 | 88.46 +Neigh | 0.010947 | 0.010947 | 0.010947 | 0.0 | 4.60 +Comm | 0.00060345 | 0.00060345 | 0.00060345 | 0.0 | 0.25 +Output | 0.00071705 | 0.00071705 | 0.00071705 | 0.0 | 0.30 +Modify | 0.014873 | 0.014873 | 0.014873 | 0.0 | 6.25 +Other | | 0.0003213 | | | 0.14 + +Nlocal: 21.0000 ave 21 max 21 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 546.000 ave 546 max 546 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1096.00 ave 1096 max 1096 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 1306.00 ave 1306 max 1306 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1306 +Ave neighs/atom = 62.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.4 b/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.4 new file mode 100644 index 0000000000..4840b5fa2b --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.rdx-shielded.g++.4 @@ -0,0 +1,144 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.003 seconds + +pair_style reaxff control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxff.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 9.856 | 11.02 | 12.23 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.179 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79963 0 168.88428 12 + 10 1288.6115 -1989.6644 -1912.8422 -19456.352 -2734.6769 -15.607219 0.20177961 0 54.629556 3.1252291 -77.7067 0 14.933901 -5.8108542 843.92074 -180.43321 0 107.75934 8 + 20 538.95831 -1942.7037 -1910.5731 -10725.628 -2803.7395 7.9078316 0.077926725 0 81.610046 0.22951948 -57.55711 0 30.331206 -10.178049 878.99011 -159.68964 0 89.313879 6 + 30 463.09528 -1933.5765 -1905.9685 -33255.523 -2749.859 -8.015479 0.027628772 0 81.627413 0.11972402 -50.262283 0 20.82031 -9.6327014 851.88714 -149.49498 0 79.205717 8 + 40 885.49492 -1958.9125 -1906.1227 -4814.6646 -2795.6439 9.1506063 0.13747482 0 70.948055 0.2436053 -57.862686 0 19.076515 -11.141211 873.73888 -159.99391 0 92.434067 11 + 50 861.15982 -1954.4602 -1903.1212 -1896.7209 -2784.845 3.8269674 0.15793308 0 79.851587 3.3492059 -78.06613 0 32.628933 -7.9565341 872.81849 -190.9857 0 114.75999 10 + 60 1167.7827 -1971.8436 -1902.2248 -3482.8501 -2705.8641 -17.121497 0.22749093 0 44.507698 7.8559911 -74.78902 0 16.256511 -4.6046743 835.83081 -188.33692 0 114.19416 10 + 70 1439.9904 -1989.3026 -1903.4558 23846.02 -2890.7894 31.95863 0.26671716 0 85.758232 3.1804311 -71.002978 0 24.357223 -10.311272 905.86809 -175.38506 0 106.79678 10 + 80 502.39774 -1930.7552 -1900.8041 -20356.27 -2703.8119 -18.66246 0.11286127 0 99.803504 2.0329528 -76.171312 0 19.236983 -6.278675 826.47474 -166.03143 0 92.539573 9 + 90 749.07673 -1946.984 -1902.3269 17798.497 -2863.7581 42.06868 0.24338043 0 96.181508 0.9618341 -69.955454 0 24.615416 -11.582759 903.68853 -190.13817 0 120.69116 11 + 100 1109.6909 -1968.5881 -1902.4325 -4490.3603 -2755.8994 -7.1223998 0.21757662 0 61.805909 7.0826145 -75.645472 0 20.115466 -6.2372802 863.565 -198.56948 0 122.09938 10 +Loop time of 0.427646 on 4 procs for 100 steps with 21 atoms + +Performance: 20.204 ns/day, 1.188 hours/ns, 233.838 timesteps/s +88.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.1373 | 0.20047 | 0.27938 | 11.8 | 46.88 +Neigh | 0.0067 | 0.009334 | 0.01249 | 2.1 | 2.18 +Comm | 0.057132 | 0.13685 | 0.19972 | 14.4 | 32.00 +Output | 0.00078935 | 0.0013884 | 0.0031266 | 2.7 | 0.32 +Modify | 0.075213 | 0.079164 | 0.082556 | 0.9 | 18.51 +Other | | 0.0004359 | | | 0.10 + +Nlocal: 5.25000 ave 15 max 0 min +Histogram: 1 0 2 0 0 0 0 0 0 1 +Nghost: 355.500 ave 432 max 282 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Neighs: 298.750 ave 822 max 0 min +Histogram: 1 0 2 0 0 0 0 0 0 1 +FullNghs: 326.500 ave 927 max 0 min +Histogram: 1 0 2 0 0 0 0 0 0 1 + +Total # of neighbors = 1306 +Ave neighs/atom = 62.190476 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.1 b/examples/reaxff/log.21Jul21.reaxff.rdx.g++.1 similarity index 78% rename from examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.1 rename to examples/reaxff/log.21Jul21.reaxff.rdx.g++.1 index 5ff8307135..89e5c606c2 100644 --- a/examples/reaxff/log.21Apr21.reaxc.rdx-shielded.g++.1 +++ b/examples/reaxff/log.21Jul21.reaxff.rdx.g++.1 @@ -1,7 +1,7 @@ -LAMMPS (8 Apr 2021) +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) using 1 OpenMP thread(s) per MPI task # ReaxFF potential for RDX system -# this run is equivalent to reax/in.reax.rdx units real @@ -14,20 +14,20 @@ Reading data file ... 21 atoms read_data CPU = 0.001 seconds -pair_style reax/c control.reax_c.rdx -WARNING: Ignoring inactive control parameter: simulation_name (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: energy_update_freq (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/USER-REAXC/reaxc_control.cpp:113) -WARNING: Ignoring inactive control parameter: traj_title (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_forces (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: atom_velocities (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: bond_info (src/USER-REAXC/reaxc_control.cpp:97) -WARNING: Ignoring inactive control parameter: angle_info (src/USER-REAXC/reaxc_control.cpp:97) +pair_style reaxff control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) pair_coeff * * ffield.reax C H O N Reading potential file ffield.reax with DATE: 2010-02-19 -compute reax all pair reax/c +compute reax all pair reaxff variable eb equal c_reax[1] variable ea equal c_reax[2] @@ -48,7 +48,7 @@ neighbor 2.5 bin neigh_modify every 10 delay 0 check no fix 1 all nve -fix 2 all qeq/reax 1 0.0 10.0 1.0e-6 reax/c +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff variable nqeq equal f_2 @@ -57,7 +57,7 @@ thermo_style custom step temp epair etotal press v_eb v_ea v_ timestep 1.0 -#dump 1 all atom 10 dump.reaxc.rdx +#dump 1 all atom 10 dump.reaxff.rdx #dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 #dump_modify 2 pad 3 @@ -71,7 +71,7 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- pair reax/c command: +- pair reaxff command: @Article{Aktulga12, author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, @@ -82,7 +82,7 @@ Your simulation uses code contributions which should be cited: pages = {245--259} } -- fix qeq/reax command: +- fix qeq/reaxff command: @Article{Aktulga12, author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, @@ -102,12 +102,12 @@ Neighbor list info ... ghost atom cutoff = 12.5 binsize = 6.25, bins = 3 3 3 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair reax/c, perpetual + (1) pair reaxff, perpetual attributes: half, newton off, ghost pair build: half/bin/newtoff/ghost - stencil: half/ghost/bin/3d/newtoff + stencil: full/ghost/bin/3d bin: standard - (2) fix qeq/reax, perpetual, copy from (1) + (2) fix qeq/reaxff, perpetual, copy from (1) attributes: half, newton off, ghost pair build: copy stencil: none @@ -123,22 +123,22 @@ Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_ 60 1167.7852 -1971.8429 -1902.224 -3482.7305 -2705.863 -17.12171 0.22749077 0 44.507654 7.8560745 -74.788955 0 16.256483 -4.6046431 835.8304 -188.33691 0 114.19413 10 70 1439.9966 -1989.3024 -1903.4553 23845.651 -2890.7895 31.958845 0.26671721 0 85.758695 3.1803544 -71.002903 0 24.357134 -10.31131 905.86775 -175.38471 0 106.79648 10 80 502.39438 -1930.7544 -1900.8035 -20356.316 -2703.8115 -18.662467 0.11286011 0 99.804201 2.0329024 -76.171317 0 19.237028 -6.2786907 826.47451 -166.03125 0 92.539398 9 - 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068716 0.2433807 0 96.181613 0.96184888 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 + 90 749.08499 -1946.9838 -1902.3262 17798.51 -2863.7576 42.068717 0.2433807 0 96.181613 0.96184887 -69.955448 0 24.615302 -11.582765 903.68818 -190.13843 0 120.69141 11 100 1109.6968 -1968.5874 -1902.4315 -4490.1018 -2755.8965 -7.1231014 0.21757699 0 61.806018 7.0827673 -75.645345 0 20.114997 -6.2371964 863.5635 -198.56976 0 122.09961 10.5 -Loop time of 0.617026 on 1 procs for 100 steps with 21 atoms +Loop time of 0.231802 on 1 procs for 100 steps with 21 atoms -Performance: 14.003 ns/day, 1.714 hours/ns, 162.068 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 37.273 ns/day, 0.644 hours/ns, 431.402 timesteps/s +99.2% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.52176 | 0.52176 | 0.52176 | 0.0 | 84.56 -Neigh | 0.033948 | 0.033948 | 0.033948 | 0.0 | 5.50 -Comm | 0.0017188 | 0.0017188 | 0.0017188 | 0.0 | 0.28 -Output | 0.00059319 | 0.00059319 | 0.00059319 | 0.0 | 0.10 -Modify | 0.05887 | 0.05887 | 0.05887 | 0.0 | 9.54 -Other | | 0.0001347 | | | 0.02 +Pair | 0.20857 | 0.20857 | 0.20857 | 0.0 | 89.98 +Neigh | 0.010489 | 0.010489 | 0.010489 | 0.0 | 4.52 +Comm | 0.00059632 | 0.00059632 | 0.00059632 | 0.0 | 0.26 +Output | 0.00067498 | 0.00067498 | 0.00067498 | 0.0 | 0.29 +Modify | 0.011161 | 0.011161 | 0.011161 | 0.0 | 4.82 +Other | | 0.000307 | | | 0.13 Nlocal: 21.0000 ave 21 max 21 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/reaxff/log.21Jul21.reaxff.rdx.g++.4 b/examples/reaxff/log.21Jul21.reaxff.rdx.g++.4 new file mode 100644 index 0000000000..29c36c54f0 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.rdx.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for RDX system + +units real + +atom_style charge +read_data data.rdx +Reading data file ... + orthogonal box = (35.000000 35.000000 35.000000) to (48.000000 48.000000 48.000000) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 21 atoms + read_data CPU = 0.001 seconds + +pair_style reaxff control.reax_c.rdx +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff + +variable nqeq equal f_2 + +thermo 10 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 1.0 + +#dump 1 all atom 10 dump.reaxff.rdx + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +run 100 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 10 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 3 3 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/reaxff, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.353 | 10.52 | 11.73 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -1884.3081 -1884.3081 27186.18 -2958.4712 79.527715 0.31082031 0 98.589783 25.846176 -0.18034154 0 16.709078 -9.1620736 938.43732 -244.79953 0 168.88418 12 + 10 1288.6115 -1989.6644 -1912.8422 -19456.352 -2734.6769 -15.607219 0.20177961 0 54.629556 3.1252292 -77.7067 0 14.933901 -5.8108542 843.92074 -180.43321 0 107.75934 8 + 20 538.95847 -1942.7037 -1910.5731 -10725.668 -2803.7395 7.9078328 0.077926688 0 81.610045 0.22951933 -57.557103 0 30.331203 -10.178049 878.99015 -159.69262 0 89.316856 7 + 30 463.09521 -1933.5765 -1905.9685 -33255.503 -2749.8591 -8.0154614 0.027628708 0 81.627408 0.11972393 -50.262275 0 20.820319 -9.6327031 851.88721 -149.49497 0 79.205707 8 + 40 885.49559 -1958.9126 -1906.1227 -4814.661 -2795.644 9.1506103 0.13747486 0 70.948058 0.24360549 -57.862693 0 19.076514 -11.141211 873.73894 -159.9939 0 92.434063 11 + 50 861.16222 -1954.4601 -1903.1209 -1896.7328 -2784.8449 3.8269573 0.15793301 0 79.851661 3.3492101 -78.066131 0 32.628939 -7.9565311 872.81847 -190.9857 0 114.75999 10 + 60 1167.7838 -1971.8434 -1902.2246 -3482.8253 -2705.8639 -17.121553 0.22749078 0 44.507707 7.8560156 -74.789002 0 16.256509 -4.6046674 835.83076 -188.33689 0 114.19413 10 + 70 1439.9922 -1989.3024 -1903.4556 23845.682 -2890.7894 31.958742 0.26671722 0 85.758402 3.1803955 -71.002937 0 24.357176 -10.311293 905.86805 -175.38494 0 106.79668 10 + 80 502.39847 -1930.7549 -1900.8038 -20356.357 -2703.8111 -18.662668 0.11286141 0 99.803668 2.0329484 -76.17132 0 19.236866 -6.2786536 826.47435 -166.03145 0 92.539587 9 + 90 749.0857 -1946.984 -1902.3263 17798.657 -2863.7584 42.068704 0.24338054 0 96.181666 0.96183837 -69.955527 0 24.615445 -11.58275 903.68864 -190.13828 0 120.69127 11 + 100 1109.695 -1968.5879 -1902.4321 -4490.3441 -2755.8984 -7.1226574 0.21757683 0 61.806014 7.0826278 -75.645456 0 20.115306 -6.2372466 863.56451 -198.56953 0 122.09941 10.5 +Loop time of 0.371707 on 4 procs for 100 steps with 21 atoms + +Performance: 23.244 ns/day, 1.033 hours/ns, 269.029 timesteps/s +91.8% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.13518 | 0.19123 | 0.24947 | 9.7 | 51.45 +Neigh | 0.0073075 | 0.0096968 | 0.012228 | 1.8 | 2.61 +Comm | 0.034511 | 0.093329 | 0.14912 | 14.0 | 25.11 +Output | 0.00081416 | 0.0011345 | 0.0019655 | 1.4 | 0.31 +Modify | 0.073177 | 0.075449 | 0.078618 | 0.7 | 20.30 +Other | | 0.0008711 | | | 0.23 + +Nlocal: 5.25000 ave 15 max 0 min +Histogram: 1 0 2 0 0 0 0 0 0 1 +Nghost: 355.500 ave 432 max 282 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Neighs: 298.750 ave 822 max 0 min +Histogram: 1 0 2 0 0 0 0 0 0 1 + +Total # of neighbors = 1195 +Ave neighs/atom = 56.904762 +Neighbor list builds = 10 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.1 b/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.1 new file mode 100644 index 0000000000..4c84081d44 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.1 @@ -0,0 +1,142 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for TATB system + +units real + +atom_style charge +read_data data.tatb +Reading data file ... + triclinic box = (0.0000000 0.0000000 0.0000000) to (13.624000 17.114915 15.182639) with tilt (-5.7531563 -6.3254660 7.4257288) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 384 atoms + read_data CPU = 0.002 seconds + +pair_style reaxff control.reax_c.tatb +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no + +fix 1 all nve +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff +variable nqeq equal f_2 + +thermo 5 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 0.0625 + +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z + +#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +fix 3 all reaxff/species 1 5 5 species.tatb + +run 25 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 5 4 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 141.3 | 141.3 | 141.3 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -44760.998 -44760.998 7827.7874 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6395 0 6391.0275 31 + 5 0.61603968 -44761.698 -44760.994 8934.6339 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1905 0 6388.6665 8 + 10 2.3525543 -44763.227 -44760.541 12288.589 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9762 0 6381.714 10 + 15 4.9013256 -44766.36 -44760.764 17716.957 -61103.434 489.14721 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2536 0 6370.4198 9 + 20 7.8294699 -44769.686 -44760.747 25205.552 -61089.006 490.21314 4.7193021 0 1571.7022 20.420943 -260.85565 -1573.7378 253.3539 -654.31623 18816.07 -8703.5055 0 6355.2567 8 + 25 10.697916 -44772.904 -44760.691 34232.955 -61069.308 490.25886 4.7163736 0 1570.7397 20.181347 -251.91377 -1582.3261 253.82253 -653.53184 18791.975 -8684.308 0 6336.7889 7 +Loop time of 3.31728 on 1 procs for 25 steps with 384 atoms + +Performance: 0.041 ns/day, 589.738 hours/ns, 7.536 timesteps/s +99.4% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.9321 | 1.9321 | 1.9321 | 0.0 | 58.24 +Neigh | 0.6452 | 0.6452 | 0.6452 | 0.0 | 19.45 +Comm | 0.0020122 | 0.0020122 | 0.0020122 | 0.0 | 0.06 +Output | 0.00030173 | 0.00030173 | 0.00030173 | 0.0 | 0.01 +Modify | 0.73726 | 0.73726 | 0.73726 | 0.0 | 22.22 +Other | | 0.0003829 | | | 0.01 + +Nlocal: 384.000 ave 384 max 384 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 7559.00 ave 7559 max 7559 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 286828.0 ave 286828 max 286828 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 336304.0 ave 336304 max 336304 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 336304 +Ave neighs/atom = 875.79167 +Neighbor list builds = 5 +Dangerous builds not checked +Total wall time: 0:00:03 diff --git a/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.4 b/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.4 new file mode 100644 index 0000000000..d4cb8a0190 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.tatb-shielded.g++.4 @@ -0,0 +1,142 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for TATB system + +units real + +atom_style charge +read_data data.tatb +Reading data file ... + triclinic box = (0.0000000 0.0000000 0.0000000) to (13.624000 17.114915 15.182639) with tilt (-5.7531563 -6.3254660 7.4257288) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 384 atoms + read_data CPU = 0.004 seconds + +pair_style reaxff control.reax_c.tatb +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no + +fix 1 all nve +fix 2 all qeq/shielded 1 10.0 1.0e-6 100 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff +variable nqeq equal f_2 + +thermo 5 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 0.0625 + +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z + +#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +fix 3 all reaxff/species 1 5 5 species.tatb + +run 25 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 5 4 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/shielded, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 94.50 | 94.50 | 94.50 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -44760.998 -44760.998 7827.7865 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6398 0 6391.0278 31 + 5 0.61603964 -44761.698 -44760.994 8934.6344 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1911 0 6388.6671 9 + 10 2.3525559 -44763.227 -44760.541 12288.611 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9712 0 6381.7089 11 + 15 4.9013319 -44766.36 -44760.764 17716.965 -61103.434 489.14721 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2514 0 6370.4176 9 + 20 7.8294706 -44769.686 -44760.747 25205.511 -61089.006 490.21313 4.719302 0 1571.7022 20.420943 -260.85565 -1573.7378 253.3539 -654.31623 18816.07 -8703.5196 0 6355.2708 7 + 25 10.69792 -44772.904 -44760.691 34232.831 -61069.308 490.25885 4.7163736 0 1570.7397 20.181346 -251.91377 -1582.3261 253.82253 -653.53184 18791.975 -8684.353 0 6336.8339 11 +Loop time of 2.66226 on 4 procs for 25 steps with 384 atoms + +Performance: 0.051 ns/day, 473.290 hours/ns, 9.391 timesteps/s +96.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.7311 | 1.7619 | 1.794 | 2.0 | 66.18 +Neigh | 0.46483 | 0.46901 | 0.47348 | 0.5 | 17.62 +Comm | 0.039253 | 0.073989 | 0.10705 | 10.7 | 2.78 +Output | 0.0012206 | 0.0080282 | 0.010299 | 4.4 | 0.30 +Modify | 0.34359 | 0.3488 | 0.36264 | 1.4 | 13.10 +Other | | 0.0005529 | | | 0.02 + +Nlocal: 96.0000 ave 96 max 96 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 5118.00 ave 5118 max 5118 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 79754.0 ave 79754 max 79754 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 84076.0 ave 84076 max 84076 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 336304 +Ave neighs/atom = 875.79167 +Neighbor list builds = 5 +Dangerous builds not checked +Total wall time: 0:00:03 diff --git a/examples/reaxff/log.21Jul21.reaxff.tatb.g++.1 b/examples/reaxff/log.21Jul21.reaxff.tatb.g++.1 new file mode 100644 index 0000000000..2e1c7a5b26 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.tatb.g++.1 @@ -0,0 +1,151 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for TATB system + +units real + +atom_style charge +read_data data.tatb +Reading data file ... + triclinic box = (0.0000000 0.0000000 0.0000000) to (13.624000 17.114915 15.182639) with tilt (-5.7531563 -6.3254660 7.4257288) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 384 atoms + read_data CPU = 0.008 seconds + +pair_style reaxff control.reax_c.tatb +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no + +fix 1 all nve +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff +variable nqeq equal f_2 + +thermo 5 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 0.0625 + +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z + +#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +fix 3 all reaxff/species 1 5 5 species.tatb + +run 25 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 5 4 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/reaxff, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 148.1 | 148.1 | 148.1 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -44760.998 -44760.998 7827.7878 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6394 0 6391.0274 31.5 + 5 0.61603968 -44761.698 -44760.994 8934.6346 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.1911 0 6388.6671 9 + 10 2.3525552 -44763.227 -44760.541 12288.581 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50357 -1560.7569 252.85309 -655.44063 18850.391 -8730.9765 0 6381.7142 10.5 + 15 4.9013309 -44766.36 -44760.764 17716.918 -61103.434 489.14722 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2622 0 6370.4284 9.5 + 20 7.829469 -44769.686 -44760.747 25205.568 -61089.006 490.21314 4.719302 0 1571.7022 20.420943 -260.85564 -1573.7378 253.3539 -654.31623 18816.07 -8703.5126 0 6355.2639 8 + 25 10.697899 -44772.904 -44760.691 34232.788 -61069.308 490.25886 4.7163736 0 1570.7397 20.181346 -251.91377 -1582.3261 253.82253 -653.53184 18791.975 -8684.3619 0 6336.8427 11 +Loop time of 2.91659 on 1 procs for 25 steps with 384 atoms + +Performance: 0.046 ns/day, 518.504 hours/ns, 8.572 timesteps/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.9139 | 1.9139 | 1.9139 | 0.0 | 65.62 +Neigh | 0.5948 | 0.5948 | 0.5948 | 0.0 | 20.39 +Comm | 0.0020205 | 0.0020205 | 0.0020205 | 0.0 | 0.07 +Output | 0.00031287 | 0.00031287 | 0.00031287 | 0.0 | 0.01 +Modify | 0.40513 | 0.40513 | 0.40513 | 0.0 | 13.89 +Other | | 0.0003856 | | | 0.01 + +Nlocal: 384.000 ave 384 max 384 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 7559.00 ave 7559 max 7559 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 286828.0 ave 286828 max 286828 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 286828 +Ave neighs/atom = 746.94792 +Neighbor list builds = 5 +Dangerous builds not checked +Total wall time: 0:00:03 diff --git a/examples/reaxff/log.21Jul21.reaxff.tatb.g++.4 b/examples/reaxff/log.21Jul21.reaxff.tatb.g++.4 new file mode 100644 index 0000000000..100c2f7ca4 --- /dev/null +++ b/examples/reaxff/log.21Jul21.reaxff.tatb.g++.4 @@ -0,0 +1,151 @@ +LAMMPS (2 Jul 2021) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# ReaxFF potential for TATB system + +units real + +atom_style charge +read_data data.tatb +Reading data file ... + triclinic box = (0.0000000 0.0000000 0.0000000) to (13.624000 17.114915 15.182639) with tilt (-5.7531563 -6.3254660 7.4257288) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 384 atoms + read_data CPU = 0.002 seconds + +pair_style reaxff control.reax_c.tatb +WARNING: Ignoring inactive control parameter: simulation_name (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: energy_update_freq (src/REAXFF/reaxff_control.cpp:97) +WARNING: Support for writing native trajectories has been removed after LAMMPS version 8 April 2021 (src/REAXFF/reaxff_control.cpp:113) +WARNING: Ignoring inactive control parameter: traj_title (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_forces (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: atom_velocities (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: bond_info (src/REAXFF/reaxff_control.cpp:97) +WARNING: Ignoring inactive control parameter: angle_info (src/REAXFF/reaxff_control.cpp:97) +pair_coeff * * ffield.reax C H O N +Reading potential file ffield.reax with DATE: 2010-02-19 + +compute reax all pair reaxff + +variable eb equal c_reax[1] +variable ea equal c_reax[2] +variable elp equal c_reax[3] +variable emol equal c_reax[4] +variable ev equal c_reax[5] +variable epen equal c_reax[6] +variable ecoa equal c_reax[7] +variable ehb equal c_reax[8] +variable et equal c_reax[9] +variable eco equal c_reax[10] +variable ew equal c_reax[11] +variable ep equal c_reax[12] +variable efi equal c_reax[13] +variable eqeq equal c_reax[14] + +neighbor 2.5 bin +neigh_modify delay 0 every 5 check no + +fix 1 all nve +fix 2 all qeq/reaxff 1 0.0 10.0 1.0e-6 reaxff +fix 4 all reaxff/bonds 5 bonds.reaxff +variable nqeq equal f_2 + +thermo 5 +thermo_style custom step temp epair etotal press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + +timestep 0.0625 + +#dump 1 all custom 100 dump.reaxff.tatb id type q x y z + +#dump 2 all image 5 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 5 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +fix 3 all reaxff/species 1 5 5 species.tatb + +run 25 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- pair reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +- fix qeq/reaxff command: + +@Article{Aktulga12, + author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama}, + title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques}, + journal = {Parallel Computing}, + year = 2012, + volume = 38, + pages = {245--259} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12.5 + ghost atom cutoff = 12.5 + binsize = 6.25, bins = 5 4 3 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair reaxff, perpetual + attributes: half, newton off, ghost + pair build: half/bin/newtoff/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) fix qeq/reaxff, perpetual, copy from (1) + attributes: half, newton off, ghost + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 99.27 | 99.27 | 99.27 Mbytes +Step Temp E_pair TotEng Press v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq v_nqeq + 0 0 -44760.998 -44760.998 7827.7866 -61120.591 486.4378 4.7236377 0 1574.1033 20.788929 -279.51642 -1556.4696 252.57147 -655.84699 18862.412 -8740.6397 0 6391.0277 31 + 5 0.61603941 -44761.698 -44760.994 8934.6279 -61118.769 486.81263 4.7234094 0 1573.9241 20.768834 -278.24084 -1557.6713 252.64377 -655.74435 18859.379 -8738.193 0 6388.6691 10 + 10 2.352555 -44763.227 -44760.541 12288.61 -61113.174 487.82738 4.7226863 0 1573.411 20.705939 -274.50358 -1560.7569 252.85309 -655.44063 18850.391 -8730.9686 0 6381.7064 9 + 15 4.9013339 -44766.36 -44760.764 17716.995 -61103.434 489.14721 4.7213644 0 1572.6349 20.593139 -268.56847 -1566.3829 252.95174 -654.96611 18835.777 -8719.2413 0 6370.4076 10.5 + 20 7.8294636 -44769.686 -44760.747 25205.611 -61089.006 490.21313 4.719302 0 1571.7022 20.420943 -260.85565 -1573.7378 253.3539 -654.31623 18816.07 -8703.4966 0 6355.2478 10 + 25 10.6979 -44772.904 -44760.691 34232.798 -61069.308 490.25886 4.7163736 0 1570.7397 20.181346 -251.91378 -1582.3261 253.82253 -653.53184 18791.975 -8684.3574 0 6336.8382 10.5 +Loop time of 2.53633 on 4 procs for 25 steps with 384 atoms + +Performance: 0.053 ns/day, 450.902 hours/ns, 9.857 timesteps/s +97.8% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.7343 | 1.7637 | 1.815 | 2.4 | 69.54 +Neigh | 0.44441 | 0.44869 | 0.45403 | 0.6 | 17.69 +Comm | 0.025287 | 0.074702 | 0.10592 | 11.9 | 2.95 +Output | 0.0016916 | 0.0080527 | 0.010178 | 4.1 | 0.32 +Modify | 0.23126 | 0.24065 | 0.25706 | 2.1 | 9.49 +Other | | 0.000566 | | | 0.02 + +Nlocal: 96.0000 ave 96 max 96 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 5118.00 ave 5118 max 5118 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 79754.0 ave 79754 max 79754 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 319016 +Ave neighs/atom = 830.77083 +Neighbor list builds = 5 +Dangerous builds not checked +Total wall time: 0:00:02 From c59dc079dbb2b453cb71bef3bd78c2704649c7e3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 22:53:18 -0400 Subject: [PATCH 108/119] correctly detect when to retrieve parameters from pair style reaxff --- src/QEQ/fix_qeq.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 964cc26cc9..a0d012bb5b 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -126,7 +126,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[7],"coul/streitz") == 0) { streitz_flag = 1; - } else if (utils::strmatch(arg[7],"^reax..") == 0) { + } else if (utils::strmatch(arg[7],"^reax..")) { reax_flag = 1; } else { read_file(arg[7]); From f79b6ac3737e95f0f6b5bf185c97ca14c93e1f99 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jul 2021 23:12:06 -0400 Subject: [PATCH 109/119] recover compilation of KOKKOS package --- src/KOKKOS/fix_reaxff_bonds_kokkos.h | 2 +- src/KOKKOS/pair_reaxff_kokkos.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/fix_reaxff_bonds_kokkos.h b/src/KOKKOS/fix_reaxff_bonds_kokkos.h index b1203e472d..b39dfa3c17 100644 --- a/src/KOKKOS/fix_reaxff_bonds_kokkos.h +++ b/src/KOKKOS/fix_reaxff_bonds_kokkos.h @@ -39,7 +39,7 @@ class FixReaxFFBondsKokkos : public FixReaxFFBonds { private: int nbuf; - void Output_ReaxFF_Bonds() + void Output_ReaxFF_Bonds(); double memory_usage(); }; } diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index 6e49b5081c..26d5450046 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -138,8 +138,8 @@ template void PairReaxFFKokkos::init_style() { PairReaxFF::init_style(); - if (fix_reax) modify->delete_fix(fix_id); // not needed in the Kokkos version - fix_reax = nullptr; + if (fix_reaxff) modify->delete_fix(fix_id); // not needed in the Kokkos version + fix_reaxff = nullptr; // irequest = neigh request made by parent class From bb46dd7d1f765a3e9c5b926b102e59662ec39f9f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 13:14:49 -0400 Subject: [PATCH 110/119] update embedded documentation for the library interface functions for accessing fix external --- src/library.cpp | 122 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index 0c897538a1..b9c2fbe4e9 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4823,13 +4823,14 @@ mode. The function has to have C language bindings with the prototype: The argument *ptr* to this function will be stored in fix external and the passed as the first argument calling the callback function `func()`. -This would usually be a pointer to the LAMMPS instance, i.e. the same +This would usually be a pointer to the active LAMMPS instance, i.e. the same pointer as the *handle* argument. This would be needed to call -functions that set the global or per-atom energy or virial -contributions. +functions that set the global or per-atom energy or virial contributions +from within the callback function. -The callback mechanism is on of the two modes of fix external. The -alternative is the array mode set up by :cpp:func:`lammps_fix_external_get_force`. +The callback mechanism is one of the two modes of how forces and can be +applied to a simulation with the help of fix external. The alternative +is the array mode where you call :cpp:func:`lammps_fix_external_get_force`. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4872,23 +4873,25 @@ Fix :doc:`external ` allows programs that are running LAMMPS throu its library interface to add or modify certain LAMMPS properties on specific timesteps, similar to the way other fixes do. -This function provides access to the per-atom force storage in the fix -external instance to be added to the individual atoms when using the -"pf/array" mode. The *fexternal* array can be accessed similar to the -"native" per-atom *arrays accessible via the +This function provides access to the per-atom force storage in a fix +external instance with the given fix-ID to be added to the individual +atoms when using the "pf/array" mode. The *fexternal* array can be +accessed like other "native" per-atom arrays accessible via the :cpp:func:`lammps_extract_atom` function. Please note that the array -stores forces for *local* atoms, in the order determined by the neighbor -list build. Because the underlying data structures can change as well as -the order of atom as they migrate between MPI processes, this function -should be always called immediately before the forces are going to be -set to get an up-to-date pointer. You can use -e.g. :cpp:func:`lammps_get_natoms` to obtain the number of local atoms -and thus the dimensions of the returned force array (``double force[nlocal][3]``). +stores holds the forces for *local* atoms for each MPI ranks, in the +order determined by the neighbor list build. Because the underlying +data structures can change as well as the order of atom as they migrate +between MPI processes because of the domain decomposition +parallelization, this function should be always called immediately +before the forces are going to be set to get an up-to-date pointer. + You can use e.g. :cpp:func:`lammps_get_natoms` to obtain the number +of local atoms `nlocal` and then assume the dimensions of the returned +force array as ``double force[nlocal][3]``. This is an alternative to the callback mechanism in fix external set up by :cpp:func:`lammps_set_fix_external_callback`. The main difference is -that this mechanism can be used when forces can be pre-computed and the -control alternates between LAMMPS and the external command, while the +that this mechanism can be used when forces are be pre-computed and the +control alternates between LAMMPS and the external code, while the callback mechanism can call the external code to compute the force when the fix is triggered and needs them. @@ -4933,8 +4936,12 @@ This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and to the global energy from the external code. The value of the *eng* argument will be stored in the fix and applied on the current and all following timesteps until changed by another call to this function. -When running in parallel, the value is the per-MPI process contribution, -not the total energy. +The energy is in energy units as determined by the current :doc:`units ` +settings and is the **total** energy of the contribution. Thus when +running in parallel all MPI processes have to call this function with +the **same** value and this will be returned as scalar property of the +fix external instance when accessed in LAMMPS input commands or from +variables. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -4944,7 +4951,7 @@ external code. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param id fix ID of fix external instance - * \param eng energy to be added to the global energy */ + * \param eng total energy to be added to the global energy */ void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng) { @@ -4972,10 +4979,18 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst This is a companion function to :cpp:func:`lammps_set_fix_external_callback` -to set the contribution to the global virial from the external code -as part of the callback function. For this to work, the handle to the -LAMMPS object must be passed as the *ptr* argument when registering the -callback function. +and :cpp:func:`lammps_fix_external_get_force` to set the contribution to +the global virial from the external code. + +The 6 values of the *virial* array will be stored in the fix and applied +on the current and all following timesteps until changed by another call +to this function. The components of the virial need to be stored in the +order: *xx*, *yy*, *zz*, *xy*, *xz*, *yz*. In LAMMPS the virial is +stored internally as `stress*volume` in units of `pressure*volume` as +determined by the current :doc:`units ` settings and is the +**total** contribution. Thus when running in parallel all MPI processes +have to call this function with the **same** value and this will then +be added by fix external. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5016,8 +5031,15 @@ This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom energy contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the LAMMPS object must be passed as the *ptr* argument when registering the -callback function. No check is made whether the sum of the -contributions are consistent with any global added energy. +callback function. + +.. note:: + + This function is fully independent from :cpp:func:`lammps_fix_external_set_energy_global` + and will **NOT** add any contributions to the global energy tally + and **NOT** check whether the sum of the contributions added here are + consistent with the global added energy. + Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5027,7 +5049,7 @@ external code. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param id fix ID of fix external instance - * \param eng energy to be added to the per-atom energy */ + * \param eng pointer to array of length nlocal with the energy to be added to the per-atom energy */ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng) { @@ -5058,8 +5080,18 @@ This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom virial contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the LAMMPS object must be passed as the *ptr* argument when registering the -callback function. No check is made whether the sum of the -contributions are consistent with any globally added virial components. +callback function. + +.. note:: + + This function is fully independent from :cpp:func:`lammps_fix_external_set_virial_global` + and will **NOT** add any contributions to the global virial tally + and **NOT** check whether the sum of the contributions added here are + consistent with the global added virial. + +The order and units of the per-atom stress tensor elements are the same +as for the global virial. The code in fix external assumes the +dimensions of the per-atom virial array is ``double virial[nlocal][6]``. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5069,7 +5101,7 @@ external code. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param id fix ID of fix external instance - * \param virial the 6 per-atom stress tensor components to be added to the per-atom virial */ + * \param virial a list of nlocal entries with the 6 per-atom stress tensor components to be added to the per-atom virial */ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial) { @@ -5098,7 +5130,13 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of -properties that will be stored with the fix via :cpp:func:`lammps_fix_external_set_vector`. +properties that will be stored with the fix via +:cpp:func:`lammps_fix_external_set_vector`. + +This function needs to be called **before** a call to +:cpp:func:`lammps_fix_external_set_vector` and **before** a run or minimize +command. When running in parallel it must be called from **all** MPI +processes and with the same length parameter. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5137,8 +5175,22 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of -properties that will be stored with the fix. The length of the vector -must be set beforehand with :cpp:func:`lammps_fix_external_set_vector_length`. +properties that will be stored with the fix. And can be accessed from +within LAMMPS input commands (e.g. fix ave/time or variables) when used +in a vector context. + +This function needs to be called **after** a call to +:cpp:func:`lammps_fix_external_set_vector_length` and the and **before** a run or minimize +command. When running in parallel it must be called from **all** MPI +processes and with the **same** index and value parameters. The value +is assumed to be extensive. + +.. note:: + + The index in the *idx* parameter is 1-based, i.e. the first element + is set with idx = 1 and the last element of the vector with idx = N, + where N is the value of the *len* parameter of the call to + :cpp:func:`lammps_fix_external_set_vector_length`. Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an @@ -5148,7 +5200,7 @@ external code. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param id fix ID of fix external instance - * \param idx 1 based index of in global vector + * \param idx 1-based index of in global vector * \param val value to be stored in global vector */ void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val) From 2d93edab1b4b7631eaf50d87a726d237d56cbccd Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Thu, 22 Jul 2021 12:22:34 -0600 Subject: [PATCH 111/119] Added one line of diagnostic output to create_atoms command --- src/create_atoms.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 02efba7e93..96e1476228 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -596,10 +596,13 @@ void CreateAtoms::command(int narg, char **arg) // print status MPI_Barrier(world); - if (me == 0) - utils::logmesg(lmp,"Created {} atoms\n" - " create_atoms CPU = {:.3f} seconds\n", - atom->natoms - natoms_previous, MPI_Wtime() - time1); + if (me == 0) { + utils::logmesg(lmp,"Created {} atoms\n", atom->natoms - natoms_previous); + if (scaleflag) domain->print_box(" using lattice units in "); + else domain->print_box(" using box units in "); + utils::logmesg(lmp," create_atoms CPU = {:.3f} seconds\n", + MPI_Wtime() - time1); + } } /* ---------------------------------------------------------------------- From d211cea89864d2872249ab13a9e15e40b9990708 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 14:58:33 -0400 Subject: [PATCH 112/119] bugfix from Dan Bolintineanu. closes #2812 --- src/GRANULAR/fix_wall_gran.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 52311f64a7..a604782993 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -1193,7 +1193,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, knfac = E; //Hooke a = sqrt(dR); Fne = knfac*delta; - if (normal_model != HOOKE) { + if (normal_model != NORMAL_HOOKE) { Fne *= a; knfac *= a; } From 324ae3181bcfee8b1eca651136fe78073b0067e4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 15:27:51 -0400 Subject: [PATCH 113/119] python interface for per-atom data for fix external --- python/lammps/core.py | 52 ++++++++++++++++++++++++-- python/lammps/numpy_wrapper.py | 20 ++++++++++ unittest/python/python-fix-external.py | 41 +++++++++++++++++++- 3 files changed, 109 insertions(+), 4 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 9ea2530cdc..e5ff88cda0 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1749,8 +1749,8 @@ class lammps(object): - ntimestep is the current timestep - nlocal is the number of local atoms on the current MPI process - tag is a 1d NumPy array of integers representing the atom IDs of the local atoms - - x is a 2d NumPy array of floating point numbers of the coordinates of the local atoms - - f is a 2d NumPy array of floating point numbers of the forces on the local atoms that will be added + - x is a 2d NumPy array of doubles of the coordinates of the local atoms + - f is a 2d NumPy array of doubles of the forces on the local atoms that will be added :param fix_id: Fix-ID of a fix external instance :type: string @@ -1777,7 +1777,7 @@ class lammps(object): # ------------------------------------------------------------------------- def fix_external_get_force(self, fix_id): - """Get access to that array with per-atom forces of a fix external instance with a given fix ID. + """Get access to the array with per-atom forces of a fix external instance with a given fix ID. This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function of the C-library interface. @@ -1827,6 +1827,52 @@ class lammps(object): with ExceptionCheck(self): return self.lib.lammps_fix_external_set_virial_global(self.lmp, fix_id.encode(), cvirial) + # ------------------------------------------------------------------------- + + def fix_external_set_energy_peratom(self, fix_id, eatom): + """Set the global energy contribution for a fix external instance with the given ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_peratom` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eatom: list of potential energy values for local atoms to be added by fix external + :type: float + """ + + nlocal = self.extract_setting('nlocal') + ceatom = (nlocal*c_double)(*eatom) + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_energy_peratom(self.lmp, fix_id.encode(), ceatom) + + # ------------------------------------------------------------------------- + + def fix_external_set_virial_peratom(self, fix_id, virial): + """Set the global virial contribution for a fix external instance with the given ID. + + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_peratom` function + of the C-library interface. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eng: list of natoms lists with 6 floating point numbers to be added by fix external + :type: float + """ + + # copy virial data to C compatible buffer + nlocal = self.extract_setting('nlocal') + vbuf = (c_double * 6) + vptr = POINTER(c_double) + cvirial = (vptr * nlocal)() + for i in range(nlocal): + cvirial[i] = vbuf() + for j in range(6): + cvirial[i][j] = virial[i][j] + + with ExceptionCheck(self): + return self.lib.lammps_fix_external_set_virial_peratom(self.lmp, fix_id.encode(), cvirial) + # ------------------------------------------------------------------------- def fix_external_set_vector_length(self, fix_id, length): """Set the vector length for a global vector stored with fix external for analysis diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 20fdf4cc68..1998930319 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -246,6 +246,26 @@ class numpy_wrapper: return np.ctypeslib.as_array(value) return value + # ------------------------------------------------------------------------- + + def fix_external_get_force(self, fix_id): + """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + + This function is a wrapper around the + :py:meth:`lammps.fix_external_get_force() ` + method. It behaves the same as the original method, but returns a NumPy array instead + of a ``ctypes`` pointer. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :return: requested data + :rtype: numpy.array + """ + import numpy as np + nlocal = self.lmp.extract_setting('nlocal') + value = self.lmp.fix_external_get_force(fix_id) + return self.darray(value,nlocal,3) + # ------------------------------------------------------------------------- def get_neighlist(self, idx): diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index 2d4c50e454..8b85d2ccd1 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -20,6 +20,18 @@ def callback_one(lmp, ntimestep, nlocal, tag, x, f): lmp.fix_external_set_vector("ext", 5, -1.0) lmp.fix_external_set_vector("ext", 6, 0.25) + eatom = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7] + vatom = [ [0.1,0.0,0.0,0.0,0.0,0.0], + [0.0,0.2,0.0,0.0,0.0,0.0], + [0.0,0.0,0.3,0.0,0.0,0.0], + [0.0,0.0,0.0,0.4,0.0,0.0], + [0.0,0.0,0.0,0.0,0.5,0.0], + [0.0,0.0,0.0,0.0,0.0,0.6], + [0.0,0.0,0.0,0.0,-7.0,0.0], + [0.0,-8.0,0.0,0.0,0.0,0.0] ] + lmp.fix_external_set_energy_peratom("ext",eatom) + lmp.fix_external_set_virial_peratom("ext",vatom) + class PythonExternal(unittest.TestCase): def testExternalCallback(self): """Test fix external from Python with pf/callback""" @@ -42,6 +54,10 @@ class PythonExternal(unittest.TestCase): thermo 5 fix 1 all nve fix ext all external pf/callback 5 1 + compute eatm all pe/atom fix + compute vatm all stress/atom NULL fix + compute sum all reduce sum c_eatm c_vatm[*] + thermo_style custom step temp pe ke etotal press c_sum[*] fix_modify ext energy yes virial yes """ lmp.commands_string(basic_system) @@ -51,6 +67,14 @@ class PythonExternal(unittest.TestCase): self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) self.assertAlmostEqual(lmp.get_thermo("press"),0.15416666666666667,14) + reduce = lmp.extract_compute("sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) + self.assertAlmostEqual(reduce[0],2.8,14) + self.assertAlmostEqual(reduce[1],-0.1,14) + self.assertAlmostEqual(reduce[2],7.8,14) + self.assertAlmostEqual(reduce[3],-0.3,14) + self.assertAlmostEqual(reduce[4],-0.4,14) + self.assertAlmostEqual(reduce[5],6.5,14) + self.assertAlmostEqual(reduce[6],-0.6,14) val = 0.0 for i in range(0,6): val += lmp.extract_fix("ext",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=i) @@ -59,6 +83,12 @@ class PythonExternal(unittest.TestCase): def testExternalArray(self): """Test fix external from Python with pf/array""" + try: + import numpy + NUMPY_INSTALLED = True + except ImportError: + NUMPY_INSTALLED = False + machine=None if 'LAMMPS_MACHINE_NAME' in os.environ: machine=os.environ['LAMMPS_MACHINE_NAME'] @@ -93,6 +123,11 @@ class PythonExternal(unittest.TestCase): self.assertAlmostEqual(lmp.get_thermo("temp"),4.0/525.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/16.0,14) self.assertAlmostEqual(lmp.get_thermo("press"),0.06916666666666667,14) + if NUMPY_INSTALLED: + npforce = lmp.numpy.fix_external_get_force("ext") + self.assertEqual(len(npforce),8) + self.assertEqual(len(npforce[0]),3) + self.assertEqual(npforce[1][1],0.0) force = lmp.fix_external_get_force("ext"); nlocal = lmp.extract_setting("nlocal"); @@ -106,8 +141,12 @@ class PythonExternal(unittest.TestCase): self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) self.assertAlmostEqual(lmp.get_thermo("press"),0.15416666666666667,14) + if NUMPY_INSTALLED: + npforce = lmp.numpy.fix_external_get_force("ext") + self.assertEqual(npforce[0][0],6.0) + self.assertEqual(npforce[3][1],6.0) + self.assertEqual(npforce[7][2],6.0) ############################## if __name__ == "__main__": unittest.main() - From 74c306b32bc01eb8988053dbb5a695dbaaa15c6d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 16:37:06 -0400 Subject: [PATCH 114/119] whitespace --- src/create_atoms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 96e1476228..2d11a5a3bc 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -599,7 +599,7 @@ void CreateAtoms::command(int narg, char **arg) if (me == 0) { utils::logmesg(lmp,"Created {} atoms\n", atom->natoms - natoms_previous); if (scaleflag) domain->print_box(" using lattice units in "); - else domain->print_box(" using box units in "); + else domain->print_box(" using box units in "); utils::logmesg(lmp," create_atoms CPU = {:.3f} seconds\n", MPI_Wtime() - time1); } From fbf3bcae708150bfb4189ba32735e25c043828d9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 16:45:30 -0400 Subject: [PATCH 115/119] correct automated substition mistake --- src/KOKKOS/pair_reaxff_kokkos.cpp | 132 +++++++++++++++--------------- src/KOKKOS/pair_reaxff_kokkos.h | 58 ++++++------- 2 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index 26d5450046..aac0229f87 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -724,14 +724,14 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) // Polarization (self) if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } ev_all += ev; pvector[13] = ev.ecoul; @@ -740,26 +740,26 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) if (api->control->tabulate) { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } } else { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); } } ev_all += ev; @@ -853,34 +853,34 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) // Bond energy if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; pvector[0] = ev.evdwl; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; pvector[0] = ev.evdwl; } // Multi-body corrections if (neighflag == HALF) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[2] = ev.ereax[0]; @@ -891,15 +891,15 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) // Angular if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[4] = ev.ereax[3]; @@ -910,15 +910,15 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) // Torsion if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } pvector[8] = ev.ereax[6]; @@ -929,15 +929,15 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) if (cut_hbsq > 0.0) { if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else { //if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } } @@ -969,9 +969,9 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) //} if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); ev_all += ev; pvector[0] += ev.evdwl; } else { //if (neighflag == HALFTHREAD) { @@ -985,9 +985,9 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) //} if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); ev_all += ev; pvector[0] += ev.evdwl; } @@ -1049,7 +1049,7 @@ void PairReaxFFKokkos::compute(int eflag_in, int vflag_in) template template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputePolar, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputePolar, const int &ii, EV_FLOAT_REAX& ev) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -1067,9 +1067,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputePolar template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputePolar, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputePolar, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputePolar(), ii, ev); + this->template operator()(PairReaxFFComputePolar(), ii, ev); } @@ -1078,7 +1078,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputePolar template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1220,9 +1220,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeLJCoulomb, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeLJCoulomb(), ii, ev); + this->template operator()(PairReaxFFComputeLJCoulomb(), ii, ev); } /* ---------------------------------------------------------------------- */ @@ -1230,7 +1230,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeLJCoulomb template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeTabulatedLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeTabulatedLJCoulomb, const int &ii, EV_FLOAT_REAX& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1327,9 +1327,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeTabulatedLJCoulomb template template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeTabulatedLJCoulomb, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeTabulatedLJCoulomb, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeTabulatedLJCoulomb(), ii, ev); + this->template operator()(PairReaxFFComputeTabulatedLJCoulomb(), ii, ev); } /* ---------------------------------------------------------------------- */ @@ -1989,7 +1989,7 @@ void PairReaxFFKokkos::operator()(PairReaxBondOrder3, const int &ii) template template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti1, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeMulti1, const int &ii) const { const int i = d_ilist[ii]; const int itype = type(i); @@ -2023,7 +2023,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti1 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeMulti2, const int &ii, EV_FLOAT_REAX& ev) const { auto v_CdDelta = ScatterViewHelper::value,decltype(dup_CdDelta),decltype(ndup_CdDelta)>::get(dup_CdDelta,ndup_CdDelta); auto a_CdDelta = v_CdDelta.template access::value>(); @@ -2164,9 +2164,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeMulti2, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeMulti2(), ii, ev); + this->template operator()(PairReaxFFComputeMulti2(), ii, ev); } @@ -2175,7 +2175,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeMulti2 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeAngular, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2476,9 +2476,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeAngular, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeAngular(), ii, ev); + this->template operator()(PairReaxFFComputeAngular(), ii, ev); } @@ -2487,7 +2487,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeAngular template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeTorsion, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2851,9 +2851,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeTorsion, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeTorsion(), ii, ev); + this->template operator()(PairReaxFFComputeTorsion(), ii, ev); } @@ -2862,7 +2862,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeTorsion template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeHydrogen, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeHydrogen, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -2998,9 +2998,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeHydrogen template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeHydrogen, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeHydrogen, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeHydrogen(), ii, ev); + this->template operator()(PairReaxFFComputeHydrogen(), ii, ev); } @@ -3061,7 +3061,7 @@ void PairReaxFFKokkos::operator()(PairReaxUpdateBond, con template template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeBond1, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); @@ -3168,9 +3168,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeBond1, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeBond1(), ii, ev); + this->template operator()(PairReaxFFComputeBond1(), ii, ev); } @@ -3179,7 +3179,7 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeBond1 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeBond2, const int &ii, EV_FLOAT_REAX& ev) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeBond2, const int &ii, EV_FLOAT_REAX& ev) const { auto v_f = ScatterViewHelper::value,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access::value>(); @@ -3369,9 +3369,9 @@ void PairReaxFFKokkos::operator()(PairReaxFFomputeBond2 template KOKKOS_INLINE_FUNCTION -void PairReaxFFKokkos::operator()(PairReaxFFomputeBond2, const int &ii) const { +void PairReaxFFKokkos::operator()(PairReaxFFComputeBond2, const int &ii) const { EV_FLOAT_REAX ev; - this->template operator()(PairReaxFFomputeBond2(), ii, ev); + this->template operator()(PairReaxFFComputeBond2(), ii, ev); } diff --git a/src/KOKKOS/pair_reaxff_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h index 08f0911292..e60533f61e 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -56,13 +56,13 @@ struct LR_lookup_table_kk }; template -struct PairReaxFFomputePolar{}; +struct PairReaxFFComputePolar{}; template -struct PairReaxFFomputeLJCoulomb{}; +struct PairReaxFFComputeLJCoulomb{}; template -struct PairReaxFFomputeTabulatedLJCoulomb{}; +struct PairReaxFFComputeTabulatedLJCoulomb{}; struct PairReaxBuildListsFull{}; @@ -85,25 +85,25 @@ template struct PairReaxUpdateBond{}; template -struct PairReaxFFomputeBond1{}; +struct PairReaxFFComputeBond1{}; template -struct PairReaxFFomputeBond2{}; +struct PairReaxFFComputeBond2{}; template -struct PairReaxFFomputeMulti1{}; +struct PairReaxFFComputeMulti1{}; template -struct PairReaxFFomputeMulti2{}; +struct PairReaxFFComputeMulti2{}; template -struct PairReaxFFomputeAngular{}; +struct PairReaxFFComputeAngular{}; template -struct PairReaxFFomputeTorsion{}; +struct PairReaxFFComputeTorsion{}; template -struct PairReaxFFomputeHydrogen{}; +struct PairReaxFFComputeHydrogen{}; struct PairReaxFindBondZero{}; @@ -134,27 +134,27 @@ class PairReaxFFKokkos : public PairReaxFF { template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputePolar, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputePolar, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputePolar, const int&) const; + void operator()(PairReaxFFComputePolar, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeLJCoulomb, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeLJCoulomb, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeLJCoulomb, const int&) const; + void operator()(PairReaxFFComputeLJCoulomb, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeTabulatedLJCoulomb, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeTabulatedLJCoulomb, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeTabulatedLJCoulomb, const int&) const; + void operator()(PairReaxFFComputeTabulatedLJCoulomb, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(PairReaxBuildListsFull, const int&) const; @@ -187,55 +187,55 @@ class PairReaxFFKokkos : public PairReaxFF { template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeBond1, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeBond1, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeBond1, const int&) const; + void operator()(PairReaxFFComputeBond1, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeBond2, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeBond2, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeBond2, const int&) const; + void operator()(PairReaxFFComputeBond2, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeMulti1, const int&) const; + void operator()(PairReaxFFComputeMulti1, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeMulti2, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeMulti2, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeMulti2, const int&) const; + void operator()(PairReaxFFComputeMulti2, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeAngular, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeAngular, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeAngular, const int&) const; + void operator()(PairReaxFFComputeAngular, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeTorsion, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeTorsion, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeTorsion, const int&) const; + void operator()(PairReaxFFComputeTorsion, const int&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeHydrogen, const int&, EV_FLOAT_REAX&) const; + void operator()(PairReaxFFComputeHydrogen, const int&, EV_FLOAT_REAX&) const; template KOKKOS_INLINE_FUNCTION - void operator()(PairReaxFFomputeHydrogen, const int&) const; + void operator()(PairReaxFFComputeHydrogen, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(PairReaxFindBondZero, const int&) const; From bf8bde5b03a4d00010375c4889d164209c965242 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 16:59:04 -0400 Subject: [PATCH 116/119] implement numpy wrapper for setting per-atom energy. virial not yet implemented --- python/lammps/core.py | 16 ++++----- python/lammps/numpy_wrapper.py | 45 +++++++++++++++++++++++++- src/library.cpp | 2 +- unittest/python/python-fix-external.py | 7 ++++ 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index e5ff88cda0..269b716c13 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1830,7 +1830,7 @@ class lammps(object): # ------------------------------------------------------------------------- def fix_external_set_energy_peratom(self, fix_id, eatom): - """Set the global energy contribution for a fix external instance with the given ID. + """Set the per-atom energy contribution for a fix external instance with the given ID. This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_peratom` function of the C-library interface. @@ -1848,15 +1848,15 @@ class lammps(object): # ------------------------------------------------------------------------- - def fix_external_set_virial_peratom(self, fix_id, virial): - """Set the global virial contribution for a fix external instance with the given ID. + def fix_external_set_virial_peratom(self, fix_id, vatom): + """Set the per-atom virial contribution for a fix external instance with the given ID. This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_peratom` function of the C-library interface. :param fix_id: Fix-ID of a fix external instance :type: string - :param eng: list of natoms lists with 6 floating point numbers to be added by fix external + :param vatom: list of natoms lists with 6 floating point numbers to be added by fix external :type: float """ @@ -1864,14 +1864,14 @@ class lammps(object): nlocal = self.extract_setting('nlocal') vbuf = (c_double * 6) vptr = POINTER(c_double) - cvirial = (vptr * nlocal)() + c_virial = (vptr * nlocal)() for i in range(nlocal): - cvirial[i] = vbuf() + c_virial[i] = vbuf() for j in range(6): - cvirial[i][j] = virial[i][j] + c_virial[i][j] = vatom[i][j] with ExceptionCheck(self): - return self.lib.lammps_fix_external_set_virial_peratom(self.lmp, fix_id.encode(), cvirial) + return self.lib.lammps_fix_external_set_virial_peratom(self.lmp, fix_id.encode(), c_virial) # ------------------------------------------------------------------------- def fix_external_set_vector_length(self, fix_id, length): diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 1998930319..7752d7902e 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -266,7 +266,50 @@ class numpy_wrapper: value = self.lmp.fix_external_get_force(fix_id) return self.darray(value,nlocal,3) - # ------------------------------------------------------------------------- + # ------------------------------------------------------------------------- + + def fix_external_set_energy_peratom(self, fix_id, eatom): + """Set the per-atom energy contribution for a fix external instance with the given ID. + + This function is an alternative to + :py:meth:`lammps.fix_external_set_energy_peratom() ` + method. It behaves the same as the original method, but accepts a NumPy array + instead of a list as argument. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eatom: per-atom potential energy + :type: numpy.array + """ + import numpy as np + nlocal = self.lmp.extract_setting('nlocal') + c_double_p = POINTER(c_double) + value = eatom.astype(np.double) + return self.lmp.lib.lammps_fix_external_set_energy_peratom(self.lmp.lmp, fix_id.encode(), + value.ctypes.data_as(c_double_p)) + + # ------------------------------------------------------------------------- + + def fix_external_set_virial_peratom(self, fix_id, vatom): + """Set the per-atom virial contribution for a fix external instance with the given ID. + + This function is an alternative to + :py:meth:`lammps.fix_external_set_virial_peratom() ` + method. It behaves the same as the original method, but accepts a NumPy array + instead of a list as argument. + + .. note:: + + This function is not yet implemented. + + :param fix_id: Fix-ID of a fix external instance + :type: string + :param eatom: per-atom potential energy + :type: numpy.array + """ + raise Exception('fix_external_set_virial_peratom() not yet implemented for NumPy arrays') + + # ------------------------------------------------------------------------- def get_neighlist(self, idx): """Returns an instance of :class:`NumPyNeighList` which wraps access to the neighbor list with the given index diff --git a/src/library.cpp b/src/library.cpp index b9c2fbe4e9..7d49868158 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -5189,7 +5189,7 @@ is assumed to be extensive. The index in the *idx* parameter is 1-based, i.e. the first element is set with idx = 1 and the last element of the vector with idx = N, - where N is the value of the *len* parameter of the call to + where N is the value of the *len* parameter of the call to :cpp:func:`lammps_fix_external_set_vector_length`. Please see the documentation for :doc:`fix external ` for diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index 8b85d2ccd1..d7928ccbe2 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -32,6 +32,13 @@ def callback_one(lmp, ntimestep, nlocal, tag, x, f): lmp.fix_external_set_energy_peratom("ext",eatom) lmp.fix_external_set_virial_peratom("ext",vatom) + #import numpy as np + #eng = np.array(eatom) + #vir = np.array(vatom) + + #lmp.numpy.fix_external_set_energy_peratom("ext",eng) + #lmp.numpy.fix_external_set_virial_peratom("ext",vir) # not yet implemented + class PythonExternal(unittest.TestCase): def testExternalCallback(self): """Test fix external from Python with pf/callback""" From a078d1ba53f5698ea58b11456a01a6437bab7d10 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 22:49:16 -0400 Subject: [PATCH 117/119] check energy and virial per atom arrays for correct size --- python/lammps/core.py | 6 ++++++ python/lammps/numpy_wrapper.py | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 269b716c13..d981243503 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1842,6 +1842,8 @@ class lammps(object): """ nlocal = self.extract_setting('nlocal') + if len(eatom) < nlocal: + raise Exception('per-atom energy list length must be at least nlocal') ceatom = (nlocal*c_double)(*eatom) with ExceptionCheck(self): return self.lib.lammps_fix_external_set_energy_peratom(self.lmp, fix_id.encode(), ceatom) @@ -1862,6 +1864,10 @@ class lammps(object): # copy virial data to C compatible buffer nlocal = self.extract_setting('nlocal') + if len(vatom) < nlocal: + raise Exception('per-atom virial first dimension must be at least nlocal') + if len(vatom[0]) != 6: + raise Exception('per-atom virial second dimension must be 6') vbuf = (c_double * 6) vptr = POINTER(c_double) c_virial = (vptr * nlocal)() diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 7752d7902e..29a6f9d74e 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -283,6 +283,9 @@ class numpy_wrapper: """ import numpy as np nlocal = self.lmp.extract_setting('nlocal') + if len(eatom) < nlocal: + raise Exception('per-atom energy dimension must be at least nlocal') + c_double_p = POINTER(c_double) value = eatom.astype(np.double) return self.lmp.lib.lammps_fix_external_set_energy_peratom(self.lmp.lmp, fix_id.encode(), @@ -307,7 +310,13 @@ class numpy_wrapper: :param eatom: per-atom potential energy :type: numpy.array """ - raise Exception('fix_external_set_virial_peratom() not yet implemented for NumPy arrays') + import numpy as np + nlocal = self.lmp.extract_setting('nlocal') + if len(vatom) < nlocal: + raise Exception('per-atom virial first dimension must be at least nlocal') + if len(vatom[0]) != 6: + raise Exception('per-atom virial second dimension must be 6') + # ------------------------------------------------------------------------- From c8cc5ecb9fcc4848e2c4447a7d420fc839f433a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 22:50:05 -0400 Subject: [PATCH 118/119] implement setting per-atom virial from numpy array (thanks to stackoverflow) --- python/lammps/numpy_wrapper.py | 16 +++++++--- unittest/python/python-fix-external.py | 43 ++++++++++++++++++-------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 29a6f9d74e..6f4503a9c8 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -17,7 +17,7 @@ ################################################################################ import warnings -from ctypes import POINTER, c_double, c_int, c_int32, c_int64, cast +from ctypes import POINTER, c_void_p, c_char_p, c_double, c_int, c_int32, c_int64, cast from .constants import * # lgtm [py/polluting-import] @@ -301,10 +301,6 @@ class numpy_wrapper: method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. note:: - - This function is not yet implemented. - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy @@ -317,6 +313,16 @@ class numpy_wrapper: if len(vatom[0]) != 6: raise Exception('per-atom virial second dimension must be 6') + c_double_pp = np.ctypeslib.ndpointer(dtype=np.uintp, ndim=1, flags='C') + + # recast numpy array to be compatible with library interface + value = (vatom.__array_interface__['data'][0] + + np.arange(vatom.shape[0])*vatom.strides[0]).astype(np.uintp) + + # change prototype to our custom type + self.lmp.lib.lammps_fix_external_set_virial_peratom.argtypes = [ c_void_p, c_char_p, c_double_pp ] + + self.lmp.lib.lammps_fix_external_set_virial_peratom(self.lmp.lmp, fix_id.encode(), value) # ------------------------------------------------------------------------- diff --git a/unittest/python/python-fix-external.py b/unittest/python/python-fix-external.py index d7928ccbe2..c061b9f466 100644 --- a/unittest/python/python-fix-external.py +++ b/unittest/python/python-fix-external.py @@ -2,6 +2,12 @@ import sys,os,unittest from ctypes import * from lammps import lammps, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR +try: + import numpy + NUMPY_INSTALLED = True +except ImportError: + NUMPY_INSTALLED = False + # add timestep dependent force def callback_one(lmp, ntimestep, nlocal, tag, x, f): lmp.fix_external_set_virial_global("ext",[1.0, 1.0, 1.0, 0.0, 0.0, 0.0]) @@ -29,17 +35,21 @@ def callback_one(lmp, ntimestep, nlocal, tag, x, f): [0.0,0.0,0.0,0.0,0.0,0.6], [0.0,0.0,0.0,0.0,-7.0,0.0], [0.0,-8.0,0.0,0.0,0.0,0.0] ] - lmp.fix_external_set_energy_peratom("ext",eatom) - lmp.fix_external_set_virial_peratom("ext",vatom) + if ntimestep < 5: + lmp.fix_external_set_energy_peratom("ext",eatom) + lmp.fix_external_set_virial_peratom("ext",vatom) + else: + import numpy as np + eng = np.array(eatom) + vir = np.array(vatom) - #import numpy as np - #eng = np.array(eatom) - #vir = np.array(vatom) + lmp.numpy.fix_external_set_energy_peratom("ext",eng) + lmp.numpy.fix_external_set_virial_peratom("ext",vir) - #lmp.numpy.fix_external_set_energy_peratom("ext",eng) - #lmp.numpy.fix_external_set_virial_peratom("ext",vir) # not yet implemented + # ------------------------------------------------------------------------ class PythonExternal(unittest.TestCase): + @unittest.skipIf(not NUMPY_INSTALLED, "NumPy is not available") def testExternalCallback(self): """Test fix external from Python with pf/callback""" @@ -70,10 +80,23 @@ class PythonExternal(unittest.TestCase): lmp.commands_string(basic_system) lmp.fix_external_set_vector_length("ext",6); lmp.set_fix_external_callback("ext",callback_one,lmp) + + # check setting per-atom data with python lists + lmp.command("run 0 post no") + reduce = lmp.extract_compute("sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) + self.assertAlmostEqual(reduce[0],2.8,14) + self.assertAlmostEqual(reduce[1],-0.1,14) + self.assertAlmostEqual(reduce[2],7.8,14) + self.assertAlmostEqual(reduce[3],-0.3,14) + self.assertAlmostEqual(reduce[4],-0.4,14) + self.assertAlmostEqual(reduce[5],6.5,14) + self.assertAlmostEqual(reduce[6],-0.6,14) + lmp.command("run 10 post no") self.assertAlmostEqual(lmp.get_thermo("temp"),1.0/30.0,14) self.assertAlmostEqual(lmp.get_thermo("pe"),1.0/8.0,14) self.assertAlmostEqual(lmp.get_thermo("press"),0.15416666666666667,14) + # check setting per-atom data numpy arrays reduce = lmp.extract_compute("sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) self.assertAlmostEqual(reduce[0],2.8,14) self.assertAlmostEqual(reduce[1],-0.1,14) @@ -90,12 +113,6 @@ class PythonExternal(unittest.TestCase): def testExternalArray(self): """Test fix external from Python with pf/array""" - try: - import numpy - NUMPY_INSTALLED = True - except ImportError: - NUMPY_INSTALLED = False - machine=None if 'LAMMPS_MACHINE_NAME' in os.environ: machine=os.environ['LAMMPS_MACHINE_NAME'] From c33bead8b1a9b2c412666f178d8edf23b5c31303 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jul 2021 23:26:22 -0400 Subject: [PATCH 119/119] silence static code analysis warning --- src/MISC/fix_pair_tracker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MISC/fix_pair_tracker.cpp b/src/MISC/fix_pair_tracker.cpp index 7939485aff..755025baed 100644 --- a/src/MISC/fix_pair_tracker.cpp +++ b/src/MISC/fix_pair_tracker.cpp @@ -246,7 +246,7 @@ void FixPairTracker::reallocate(int n) double FixPairTracker::memory_usage() { - double bytes = nmax * nvalues * sizeof(double); + double bytes = nmax * (double) nvalues * sizeof(double); bytes += nmax * 2 * sizeof(int); return bytes; }