From 146e2f283a7d717cff840f0b3696fc27c8826931 Mon Sep 17 00:00:00 2001 From: mkanski Date: Tue, 5 Mar 2019 19:11:33 +0100 Subject: [PATCH 01/68] Better error handling in reaxc_forces --- src/USER-REAXC/pair_reaxc.cpp | 11 ++++++----- src/USER-REAXC/reaxc_allocate.cpp | 12 ++++++++---- src/USER-REAXC/reaxc_allocate.h | 7 ++++++- src/USER-REAXC/reaxc_forces.cpp | 18 +++++++++++------- src/USER-REAXC/reaxc_forces.h | 2 +- src/USER-REAXC/reaxc_init_md.cpp | 12 +++++++----- src/USER-REAXC/reaxc_init_md.h | 5 ++++- src/USER-REAXC/reaxc_reset_tools.cpp | 12 +++++++----- src/USER-REAXC/reaxc_reset_tools.h | 8 ++++++-- 9 files changed, 56 insertions(+), 31 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index b68e0d0779..0f4b3a5b3d 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -394,7 +394,8 @@ void PairReaxC::init_style( ) "increased neighbor list skin."); for( int i = 0; i < LIST_N; ++i ) - lists[i].allocated = 0; + if (lists[i].allacated != 1) + lists[i].allocated = 0; if (fix_reax == NULL) { char **fixarg = new char*[3]; @@ -445,7 +446,7 @@ void PairReaxC::setup( ) error->all(FLERR,"Pair reax/c problem in far neighbor list"); write_reax_lists(); - Initialize( system, control, data, workspace, &lists, out_control, + Initialize( lmp, system, control, data, workspace, &lists, out_control, mpi_data, world ); for( int k = 0; k < system->N; ++k ) { num_bonds[k] = system->my_atoms[k].num_bonds; @@ -465,7 +466,7 @@ void PairReaxC::setup( ) // check if I need to shrink/extend my data-structs - ReAllocate( system, control, data, workspace, &lists, mpi_data ); + ReAllocate( lmp, system, control, data, workspace, &lists, mpi_data ); } bigint local_ngroup = list->inum; @@ -517,7 +518,7 @@ void PairReaxC::compute(int eflag, int vflag) setup(); - Reset( system, control, data, workspace, &lists, world ); + Reset( lmp, system, control, data, workspace, &lists, world ); workspace->realloc.num_far = write_reax_lists(); // timing for filling in the reax lists if (comm->me == 0) { @@ -527,7 +528,7 @@ void PairReaxC::compute(int eflag, int vflag) // forces - Compute_Forces(system,control,data,workspace,&lists,out_control,mpi_data); + Compute_Forces(lmp, system,control,data,workspace,&lists,out_control,mpi_data); read_reax_forces(vflag); for(int k = 0; k < system->N; ++k) { diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 700e68514c..ebf0684389 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -35,6 +35,10 @@ #include #endif +#include "lammps.h" +#include "error.h" +using namespace LAMMPS_NS; + /* 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 @@ -353,7 +357,7 @@ static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, } -static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, +static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *bonds, int *total_bonds, int *est_3body, MPI_Comm comm ) { @@ -379,7 +383,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, Delete_List( bonds, comm ); if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { fprintf( stderr, "not enough space for bonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Can't allocate space for hbonds."); } #ifdef LMP_USER_OMP @@ -399,7 +403,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, } -void ReAllocate( reax_system *system, control_params *control, +void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, mpi_datatypes *mpi_data ) { @@ -490,7 +494,7 @@ void ReAllocate( reax_system *system, control_params *control, /* bonds list */ num_bonds = est_3body = -1; if (Nflag || realloc->bonds) { - Reallocate_Bonds_List( system, (*lists)+BONDS, &num_bonds, + Reallocate_Bonds_List( lmp, system, (*lists)+BONDS, &num_bonds, &est_3body, comm ); realloc->bonds = 0; realloc->num_3body = MAX( realloc->num_3body, est_3body ) * 2; diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index f8814859af..786ee6ee8b 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -28,6 +28,11 @@ #define __ALLOCATE_H_ #include "reaxc_types.h" + +#include "lammps.h" +#include "error.h" +using namespace LAMMPS_NS; + int PreAllocate_Space( reax_system*, control_params*, storage*, MPI_Comm ); int Allocate_System( reax_system*, int, int, char* ); @@ -37,6 +42,6 @@ int Allocate_Workspace( reax_system*, control_params*, storage*, int, int, MPI_Comm, char* ); void DeAllocate_Workspace( control_params*, storage* ); -void ReAllocate( reax_system*, control_params*, simulation_data*, storage*, +void ReAllocate( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, reax_list**, mpi_datatypes* ); #endif diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 19b3cc4975..848c03f5a1 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -39,7 +39,11 @@ #include "reaxc_valence_angles.h" #include "reaxc_vector.h" +#include "lammps.h" +#include "error.h" + interaction_function Interaction_Functions[NUM_INTRS]; +using namespace LAMMPS_NS; void Dummy_Interaction( reax_system * /*system*/, control_params * /*control*/, simulation_data * /*data*/, storage * /*workspace*/, @@ -114,7 +118,7 @@ void Compute_Total_Force( reax_system *system, control_params *control, } -void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **lists, +void Validate_Lists( LAMMPS *lmp, reax_system *system, storage * /*workspace*/, reax_list **lists, int step, int /*n*/, int N, int numH, MPI_Comm comm ) { int i, comp, Hindex; @@ -136,7 +140,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l if (End_Index(i, bonds) > comp) { fprintf( stderr, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n", step, i, End_Index(i,bonds), comp ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR,"Failure in bond list."); } } } @@ -163,7 +167,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l if (End_Index(Hindex, hbonds) > comp) { fprintf(stderr,"step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", step, Hindex, End_Index(Hindex,hbonds), comp ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Failure in hydrogen bonds."); } } } @@ -171,7 +175,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l } -void Init_Forces_noQEq( reax_system *system, control_params *control, +void Init_Forces_noQEq( LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls * /*out_control*/, MPI_Comm comm ) { @@ -307,7 +311,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, workspace->realloc.num_bonds = num_bonds; workspace->realloc.num_hbonds = num_hbonds; - Validate_Lists( system, workspace, lists, data->step, + Validate_Lists( lmp, system, workspace, lists, data->step, system->n, system->N, system->numH, comm ); } @@ -431,14 +435,14 @@ void Estimate_Storages( reax_system *system, control_params *control, } -void Compute_Forces( reax_system *system, control_params *control, +void Compute_Forces( LAMMPS *lmp, 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_data->world; - Init_Forces_noQEq( system, control, data, workspace, + Init_Forces_noQEq( lmp, system, control, data, workspace, lists, out_control, comm ); /********* bonded interactions ************/ diff --git a/src/USER-REAXC/reaxc_forces.h b/src/USER-REAXC/reaxc_forces.h index 6c839a7023..31cfc03a6b 100644 --- a/src/USER-REAXC/reaxc_forces.h +++ b/src/USER-REAXC/reaxc_forces.h @@ -33,7 +33,7 @@ extern interaction_function Interaction_Functions[NUM_INTRS]; void Init_Force_Functions( control_params* ); -void Compute_Forces( reax_system*, control_params*, simulation_data*, +void Compute_Forces( LAMMPS_NS::LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes* ); void Estimate_Storages( reax_system*, control_params*, reax_list**, int*, int*, int*, int*, MPI_Comm ); diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 5901b76326..4565fd067d 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -36,6 +36,8 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" +using namespace LAMMPS_NS; + int Init_System( reax_system *system, control_params *control, char * /*msg*/ ) { int i; @@ -150,7 +152,7 @@ int Init_MPI_Datatypes( reax_system *system, storage * /*workspace*/, return SUCCESS; } -int Init_Lists( reax_system *system, control_params *control, +int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, simulation_data * /*data*/, storage * /*workspace*/, reax_list **lists, mpi_datatypes *mpi_data, char * /*msg*/ ) { @@ -180,7 +182,7 @@ int Init_Lists( reax_system *system, control_params *control, if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS, comm ) ) { fprintf( stderr, "not enough space for hbonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Can't allocate space for hbonds."); } } @@ -194,7 +196,7 @@ int Init_Lists( reax_system *system, control_params *control, if( !Make_List( system->total_cap, bond_cap, TYP_BOND, *lists+BONDS, comm ) ) { fprintf( stderr, "not enough space for bonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Can't allocate space for hbonds."); } /* 3bodies list */ @@ -211,7 +213,7 @@ int Init_Lists( reax_system *system, control_params *control, return SUCCESS; } -void Initialize( reax_system *system, control_params *control, +void Initialize( LAMMPS *lmp, 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 ) @@ -250,7 +252,7 @@ void Initialize( reax_system *system, control_params *control, MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); } - if (Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) == + if (Init_Lists( lmp, system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); fprintf( stderr, "p%d: system could not be initialized! terminating.\n", diff --git a/src/USER-REAXC/reaxc_init_md.h b/src/USER-REAXC/reaxc_init_md.h index 25333c744f..2baa70245b 100644 --- a/src/USER-REAXC/reaxc_init_md.h +++ b/src/USER-REAXC/reaxc_init_md.h @@ -29,6 +29,9 @@ #include "reaxc_types.h" -void Initialize( reax_system*, control_params*, simulation_data*, storage*, +#include "lammps.h" +#include "error.h" + +void Initialize( LAMMPS_NS::LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); #endif diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 80faed1e9f..d9cb5f22fe 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -30,6 +30,8 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" +using namespace LAMMPS_NS; + void Reset_Atoms( reax_system* system, control_params *control ) { int i; @@ -119,7 +121,7 @@ void Reset_Workspace( reax_system *system, storage *workspace ) } -void Reset_Neighbor_Lists( reax_system *system, control_params *control, +void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *control, storage *workspace, reax_list **lists, MPI_Comm comm ) { @@ -145,7 +147,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, fprintf(stderr, "p%d: not enough space for bonds! total=%d allocated=%d\n", system->my_rank, total_bonds, bonds->num_intrs ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Can't allocate space for hbonds."); } } } @@ -171,14 +173,14 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, fprintf(stderr, "p%d: not enough space for hbonds! total=%d allocated=%d\n", system->my_rank, total_hbonds, hbonds->num_intrs ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->all(FLERR, "Can't allocate space for hbonds."); } } } } -void Reset( reax_system *system, control_params *control, simulation_data *data, +void Reset( LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, MPI_Comm comm ) { Reset_Atoms( system, control ); @@ -187,6 +189,6 @@ void Reset( reax_system *system, control_params *control, simulation_data *data, Reset_Workspace( system, workspace ); - Reset_Neighbor_Lists( system, control, workspace, lists, comm ); + Reset_Neighbor_Lists( lmp, system, control, workspace, lists, comm ); } diff --git a/src/USER-REAXC/reaxc_reset_tools.h b/src/USER-REAXC/reaxc_reset_tools.h index c2a90072d5..9e2b9de980 100644 --- a/src/USER-REAXC/reaxc_reset_tools.h +++ b/src/USER-REAXC/reaxc_reset_tools.h @@ -29,12 +29,16 @@ #include "reaxc_types.h" +#include "lammps.h" +#include "error.h" +using namespace LAMMPS_NS; + 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*, +void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system*, control_params*, storage*, reax_list**, MPI_Comm ); -void Reset( reax_system*, control_params*, simulation_data*, storage*, +void Reset( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, reax_list**, MPI_Comm ); #endif From 3a4bb6f9802b33d29fa510af7e90f3f0907a63cd Mon Sep 17 00:00:00 2001 From: mkanski Date: Tue, 12 Mar 2019 20:19:56 +0100 Subject: [PATCH 02/68] All errors and warning are now printed through LAMMPS --- src/USER-REAXC/pair_reaxc.cpp | 28 +- src/USER-REAXC/reaxc_allocate.cpp | 326 ++++++++++++------------ src/USER-REAXC/reaxc_allocate.h | 8 +- src/USER-REAXC/reaxc_bond_orders.cpp | 3 +- src/USER-REAXC/reaxc_bond_orders.h | 2 +- src/USER-REAXC/reaxc_bonds.cpp | 2 +- src/USER-REAXC/reaxc_bonds.h | 2 +- src/USER-REAXC/reaxc_control.cpp | 12 +- src/USER-REAXC/reaxc_control.h | 5 +- src/USER-REAXC/reaxc_ffield.cpp | 149 +++++------ src/USER-REAXC/reaxc_ffield.h | 2 +- src/USER-REAXC/reaxc_forces.cpp | 23 +- src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 2 +- src/USER-REAXC/reaxc_hydrogen_bonds.h | 2 +- src/USER-REAXC/reaxc_init_md.cpp | 94 ++++--- src/USER-REAXC/reaxc_io_tools.cpp | 8 +- src/USER-REAXC/reaxc_io_tools.h | 4 +- src/USER-REAXC/reaxc_list.cpp | 68 ++--- src/USER-REAXC/reaxc_list.h | 4 +- src/USER-REAXC/reaxc_lookup.cpp | 102 ++++---- src/USER-REAXC/reaxc_lookup.h | 8 +- src/USER-REAXC/reaxc_multi_body.cpp | 2 +- src/USER-REAXC/reaxc_multi_body.h | 2 +- src/USER-REAXC/reaxc_reset_tools.cpp | 16 +- src/USER-REAXC/reaxc_tool_box.cpp | 44 ++-- src/USER-REAXC/reaxc_tool_box.h | 6 +- src/USER-REAXC/reaxc_torsion_angles.cpp | 3 +- src/USER-REAXC/reaxc_torsion_angles.h | 3 +- src/USER-REAXC/reaxc_traj.cpp | 56 ++-- src/USER-REAXC/reaxc_traj.h | 4 +- src/USER-REAXC/reaxc_types.h | 7 +- src/USER-REAXC/reaxc_valence_angles.cpp | 9 +- src/USER-REAXC/reaxc_valence_angles.h | 2 +- 33 files changed, 506 insertions(+), 502 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 0f4b3a5b3d..24612a3a40 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -137,15 +137,15 @@ PairReaxC::~PairReaxC() // deallocate reax data-structures - if (control->tabulate ) Deallocate_Lookup_Tables( system); + if (control->tabulate ) Deallocate_Lookup_Tables( lmp, system); - if (control->hbond_cut > 0 ) Delete_List( lists+HBONDS, world); - Delete_List( lists+BONDS, world ); - Delete_List( lists+THREE_BODIES, world ); - Delete_List( lists+FAR_NBRS, world ); + if (control->hbond_cut > 0 ) Delete_List( lmp, lists+HBONDS, world); + Delete_List( lmp, lists+BONDS, world ); + Delete_List( lmp, lists+THREE_BODIES, world ); + Delete_List( lmp, lists+FAR_NBRS, world ); - DeAllocate_Workspace( control, workspace ); - DeAllocate_System( system ); + DeAllocate_Workspace( lmp, control, workspace ); + DeAllocate_System( lmp, system ); } memory->destroy( system ); @@ -223,7 +223,7 @@ void PairReaxC::settings(int narg, char **arg) out_control->atom_info = 0; out_control->bond_info = 0; out_control->angle_info = 0; - } else Read_Control_File(arg[0], control, out_control); + } else Read_Control_File(lmp, arg[0], control, out_control); // default values @@ -298,7 +298,7 @@ void PairReaxC::coeff( int nargs, char **args ) FILE *fp; fp = force->open_potential(file); if (fp != NULL) - Read_Force_Field(fp, &(system->reax_param), control); + Read_Force_Field(lmp, fp, &(system->reax_param), control); else { char str[128]; snprintf(str,128,"Cannot open ReaxFF potential file %s",file); @@ -394,7 +394,7 @@ void PairReaxC::init_style( ) "increased neighbor list skin."); for( int i = 0; i < LIST_N; ++i ) - if (lists[i].allacated != 1) + if (lists[i].allocated != 1) lists[i].allocated = 0; if (fix_reax == NULL) { @@ -437,13 +437,13 @@ void PairReaxC::setup( ) // initialize my data structures - PreAllocate_Space( system, control, workspace, world ); + PreAllocate_Space( lmp, system, control, workspace, world ); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); - if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + if(!Make_List(lmp, system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, lists+FAR_NBRS, world)) - error->all(FLERR,"Pair reax/c problem in far neighbor list"); + error->one(FLERR,"Pair reax/c problem in far neighbor list"); write_reax_lists(); Initialize( lmp, system, control, data, workspace, &lists, out_control, @@ -582,7 +582,7 @@ void PairReaxC::compute(int eflag, int vflag) data->step = update->ntimestep; - Output_Results( system, control, data, &lists, out_control, mpi_data ); + Output_Results( lmp, system, control, data, &lists, out_control, mpi_data ); // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index ebf0684389..2f970399f2 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -43,7 +43,7 @@ using namespace LAMMPS_NS; 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*/, +int PreAllocate_Space( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * /*control*/, storage * workspace, MPI_Comm comm ) { int mincap = system->mincap; @@ -55,7 +55,7 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, system->total_cap = MAX( (int)(system->N * safezone), mincap ); system->my_atoms = (reax_atom*) - scalloc( system->total_cap, sizeof(reax_atom), "my_atoms", comm ); + scalloc(lmp, system->total_cap, sizeof(reax_atom), "my_atoms", comm ); // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); @@ -84,45 +84,45 @@ int Allocate_System( reax_system *system, int /*local_cap*/, int total_cap, } -void DeAllocate_System( reax_system *system ) +void DeAllocate_System( LAMMPS_NS::LAMMPS *lmp, reax_system *system ) { int i, j, k; int ntypes; reax_interaction *ff_params; // dealloocate the atom list - sfree( system->my_atoms, "system->my_atoms" ); + sfree(lmp, system->my_atoms, "system->my_atoms" ); // deallocate the ffield parameters storage ff_params = &(system->reax_param); ntypes = ff_params->num_atom_types; - sfree( ff_params->gp.l, "ff:globals" ); + sfree(lmp, 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( ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); + sfree(lmp, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); } - sfree( ff_params->fbp[i][j], "ff:fbp[i,j]" ); - sfree( ff_params->thbp[i][j], "ff:thbp[i,j]" ); - sfree( ff_params->hbp[i][j], "ff:hbp[i,j]" ); + sfree(lmp, ff_params->fbp[i][j], "ff:fbp[i,j]" ); + sfree(lmp, ff_params->thbp[i][j], "ff:thbp[i,j]" ); + sfree(lmp, ff_params->hbp[i][j], "ff:hbp[i,j]" ); } - sfree( ff_params->fbp[i], "ff:fbp[i]" ); - sfree( ff_params->thbp[i], "ff:thbp[i]" ); - sfree( ff_params->hbp[i], "ff:hbp[i]" ); - sfree( ff_params->tbp[i], "ff:tbp[i]" ); + sfree(lmp, ff_params->fbp[i], "ff:fbp[i]" ); + sfree(lmp, ff_params->thbp[i], "ff:thbp[i]" ); + sfree(lmp, ff_params->hbp[i], "ff:hbp[i]" ); + sfree(lmp, ff_params->tbp[i], "ff:tbp[i]" ); } - sfree( ff_params->fbp, "ff:fbp" ); - sfree( ff_params->thbp, "ff:thbp" ); - sfree( ff_params->hbp, "ff:hbp" ); - sfree( ff_params->tbp, "ff:tbp" ); - sfree( ff_params->sbp, "ff:sbp" ); + sfree(lmp, ff_params->fbp, "ff:fbp" ); + sfree(lmp, ff_params->thbp, "ff:thbp" ); + sfree(lmp, ff_params->hbp, "ff:hbp" ); + sfree(lmp, ff_params->tbp, "ff:tbp" ); + sfree(lmp, ff_params->sbp, "ff:sbp" ); } /************* workspace *************/ -void DeAllocate_Workspace( control_params * /*control*/, storage *workspace ) +void DeAllocate_Workspace( LAMMPS_NS::LAMMPS* lmp, control_params * /*control*/, storage *workspace ) { int i; @@ -133,84 +133,84 @@ void DeAllocate_Workspace( control_params * /*control*/, storage *workspace ) /* communication storage */ for( i = 0; i < MAX_NBRS; ++i ) { - sfree( workspace->tmp_dbl[i], "tmp_dbl[i]" ); - sfree( workspace->tmp_rvec[i], "tmp_rvec[i]" ); - sfree( workspace->tmp_rvec2[i], "tmp_rvec2[i]" ); + sfree(lmp, workspace->tmp_dbl[i], "tmp_dbl[i]" ); + sfree(lmp, workspace->tmp_rvec[i], "tmp_rvec[i]" ); + sfree(lmp, workspace->tmp_rvec2[i], "tmp_rvec2[i]" ); } /* bond order storage */ - sfree( workspace->within_bond_box, "skin" ); - sfree( workspace->total_bond_order, "total_bo" ); - sfree( workspace->Deltap, "Deltap" ); - sfree( workspace->Deltap_boc, "Deltap_boc" ); - sfree( workspace->dDeltap_self, "dDeltap_self" ); - sfree( workspace->Delta, "Delta" ); - sfree( workspace->Delta_lp, "Delta_lp" ); - sfree( workspace->Delta_lp_temp, "Delta_lp_temp" ); - sfree( workspace->dDelta_lp, "dDelta_lp" ); - sfree( workspace->dDelta_lp_temp, "dDelta_lp_temp" ); - sfree( workspace->Delta_e, "Delta_e" ); - sfree( workspace->Delta_boc, "Delta_boc" ); - sfree( workspace->Delta_val, "Delta_val" ); - sfree( workspace->nlp, "nlp" ); - sfree( workspace->nlp_temp, "nlp_temp" ); - sfree( workspace->Clp, "Clp" ); - sfree( workspace->vlpex, "vlpex" ); - sfree( workspace->bond_mark, "bond_mark" ); - sfree( workspace->done_after, "done_after" ); + sfree(lmp, workspace->within_bond_box, "skin" ); + sfree(lmp, workspace->total_bond_order, "total_bo" ); + sfree(lmp, workspace->Deltap, "Deltap" ); + sfree(lmp, workspace->Deltap_boc, "Deltap_boc" ); + sfree(lmp, workspace->dDeltap_self, "dDeltap_self" ); + sfree(lmp, workspace->Delta, "Delta" ); + sfree(lmp, workspace->Delta_lp, "Delta_lp" ); + sfree(lmp, workspace->Delta_lp_temp, "Delta_lp_temp" ); + sfree(lmp, workspace->dDelta_lp, "dDelta_lp" ); + sfree(lmp, workspace->dDelta_lp_temp, "dDelta_lp_temp" ); + sfree(lmp, workspace->Delta_e, "Delta_e" ); + sfree(lmp, workspace->Delta_boc, "Delta_boc" ); + sfree(lmp, workspace->Delta_val, "Delta_val" ); + sfree(lmp, workspace->nlp, "nlp" ); + sfree(lmp, workspace->nlp_temp, "nlp_temp" ); + sfree(lmp, workspace->Clp, "Clp" ); + sfree(lmp, workspace->vlpex, "vlpex" ); + sfree(lmp, workspace->bond_mark, "bond_mark" ); + sfree(lmp, workspace->done_after, "done_after" ); /* QEq storage */ - sfree( workspace->Hdia_inv, "Hdia_inv" ); - sfree( workspace->b_s, "b_s" ); - sfree( workspace->b_t, "b_t" ); - sfree( workspace->b_prc, "b_prc" ); - sfree( workspace->b_prm, "b_prm" ); - sfree( workspace->s, "s" ); - sfree( workspace->t, "t" ); - sfree( workspace->droptol, "droptol" ); - sfree( workspace->b, "b" ); - sfree( workspace->x, "x" ); + sfree(lmp, workspace->Hdia_inv, "Hdia_inv" ); + sfree(lmp, workspace->b_s, "b_s" ); + sfree(lmp, workspace->b_t, "b_t" ); + sfree(lmp, workspace->b_prc, "b_prc" ); + sfree(lmp, workspace->b_prm, "b_prm" ); + sfree(lmp, workspace->s, "s" ); + sfree(lmp, workspace->t, "t" ); + sfree(lmp, workspace->droptol, "droptol" ); + sfree(lmp, workspace->b, "b" ); + sfree(lmp, workspace->x, "x" ); /* GMRES storage */ for( i = 0; i < RESTART+1; ++i ) { - sfree( workspace->h[i], "h[i]" ); - sfree( workspace->v[i], "v[i]" ); + sfree(lmp, workspace->h[i], "h[i]" ); + sfree(lmp, workspace->v[i], "v[i]" ); } - sfree( workspace->h, "h" ); - sfree( workspace->v, "v" ); - sfree( workspace->y, "y" ); - sfree( workspace->z, "z" ); - sfree( workspace->g, "g" ); - sfree( workspace->hs, "hs" ); - sfree( workspace->hc, "hc" ); + sfree(lmp, workspace->h, "h" ); + sfree(lmp, workspace->v, "v" ); + sfree(lmp, workspace->y, "y" ); + sfree(lmp, workspace->z, "z" ); + sfree(lmp, workspace->g, "g" ); + sfree(lmp, workspace->hs, "hs" ); + sfree(lmp, workspace->hc, "hc" ); /* CG storage */ - sfree( workspace->r, "r" ); - sfree( workspace->d, "d" ); - sfree( workspace->q, "q" ); - sfree( workspace->p, "p" ); - sfree( workspace->r2, "r2" ); - sfree( workspace->d2, "d2" ); - sfree( workspace->q2, "q2" ); - sfree( workspace->p2, "p2" ); + sfree(lmp, workspace->r, "r" ); + sfree(lmp, workspace->d, "d" ); + sfree(lmp, workspace->q, "q" ); + sfree(lmp, workspace->p, "p" ); + sfree(lmp, workspace->r2, "r2" ); + sfree(lmp, workspace->d2, "d2" ); + sfree(lmp, workspace->q2, "q2" ); + sfree(lmp, workspace->p2, "p2" ); /* integrator storage */ - sfree( workspace->v_const, "v_const" ); + sfree(lmp, workspace->v_const, "v_const" ); /* force related storage */ - sfree( workspace->f, "f" ); - sfree( workspace->CdDelta, "CdDelta" ); + sfree(lmp, workspace->f, "f" ); + sfree(lmp, workspace->CdDelta, "CdDelta" ); /* reductions */ #ifdef LMP_USER_OMP - if (workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" ); - if (workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" ); - if (workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); - if (workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce"); + if (workspace->CdDeltaReduction) sfree(lmp, workspace->CdDeltaReduction, "cddelta_reduce" ); + if (workspace->forceReduction) sfree(lmp, workspace->forceReduction, "f_reduce" ); + if (workspace->valence_angle_atom_myoffset) sfree(lmp, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); + if (workspace->my_ext_pressReduction) sfree(lmp, workspace->my_ext_pressReduction, "ext_press_reduce"); #endif } -int Allocate_Workspace( reax_system * /*system*/, control_params * control, +int Allocate_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system * /*system*/, control_params * control, storage *workspace, int local_cap, int total_cap, MPI_Comm comm, char * /*msg*/ ) { @@ -224,94 +224,94 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, /* communication storage */ for( i = 0; i < MAX_NBRS; ++i ) { workspace->tmp_dbl[i] = (double*) - scalloc( total_cap, sizeof(double), "tmp_dbl", comm ); + scalloc(lmp, total_cap, sizeof(double), "tmp_dbl", comm ); workspace->tmp_rvec[i] = (rvec*) - scalloc( total_cap, sizeof(rvec), "tmp_rvec", comm ); + scalloc(lmp, total_cap, sizeof(rvec), "tmp_rvec", comm ); workspace->tmp_rvec2[i] = (rvec2*) - scalloc( total_cap, sizeof(rvec2), "tmp_rvec2", comm ); + scalloc(lmp, total_cap, sizeof(rvec2), "tmp_rvec2", comm ); } /* bond order related storage */ workspace->within_bond_box = (int*) - scalloc( total_cap, sizeof(int), "skin", comm ); - workspace->total_bond_order = (double*) smalloc( total_real, "total_bo", comm ); - workspace->Deltap = (double*) smalloc( total_real, "Deltap", comm ); - workspace->Deltap_boc = (double*) smalloc( total_real, "Deltap_boc", comm ); - workspace->dDeltap_self = (rvec*) smalloc( total_rvec, "dDeltap_self", comm ); - workspace->Delta = (double*) smalloc( total_real, "Delta", comm ); - workspace->Delta_lp = (double*) smalloc( total_real, "Delta_lp", comm ); + scalloc(lmp, total_cap, sizeof(int), "skin", comm ); + workspace->total_bond_order = (double*) smalloc(lmp, total_real, "total_bo", comm ); + workspace->Deltap = (double*) smalloc(lmp, total_real, "Deltap", comm ); + workspace->Deltap_boc = (double*) smalloc(lmp, total_real, "Deltap_boc", comm ); + workspace->dDeltap_self = (rvec*) smalloc(lmp, total_rvec, "dDeltap_self", comm ); + workspace->Delta = (double*) smalloc(lmp, total_real, "Delta", comm ); + workspace->Delta_lp = (double*) smalloc(lmp, total_real, "Delta_lp", comm ); workspace->Delta_lp_temp = (double*) - smalloc( total_real, "Delta_lp_temp", comm ); - workspace->dDelta_lp = (double*) smalloc( total_real, "dDelta_lp", comm ); + smalloc(lmp, total_real, "Delta_lp_temp", comm ); + workspace->dDelta_lp = (double*) smalloc(lmp, total_real, "dDelta_lp", comm ); workspace->dDelta_lp_temp = (double*) - smalloc( total_real, "dDelta_lp_temp", comm ); - workspace->Delta_e = (double*) smalloc( total_real, "Delta_e", comm ); - workspace->Delta_boc = (double*) smalloc( total_real, "Delta_boc", comm ); - workspace->Delta_val = (double*) smalloc( total_real, "Delta_val", comm ); - workspace->nlp = (double*) smalloc( total_real, "nlp", comm ); - workspace->nlp_temp = (double*) smalloc( total_real, "nlp_temp", comm ); - workspace->Clp = (double*) smalloc( total_real, "Clp", comm ); - workspace->vlpex = (double*) smalloc( total_real, "vlpex", comm ); + smalloc(lmp, total_real, "dDelta_lp_temp", comm ); + workspace->Delta_e = (double*) smalloc(lmp, total_real, "Delta_e", comm ); + workspace->Delta_boc = (double*) smalloc(lmp, total_real, "Delta_boc", comm ); + workspace->Delta_val = (double*) smalloc(lmp, total_real, "Delta_val", comm ); + workspace->nlp = (double*) smalloc(lmp, total_real, "nlp", comm ); + workspace->nlp_temp = (double*) smalloc(lmp, total_real, "nlp_temp", comm ); + workspace->Clp = (double*) smalloc(lmp, total_real, "Clp", comm ); + workspace->vlpex = (double*) smalloc(lmp, total_real, "vlpex", comm ); workspace->bond_mark = (int*) - scalloc( total_cap, sizeof(int), "bond_mark", comm ); + scalloc(lmp, total_cap, sizeof(int), "bond_mark", comm ); workspace->done_after = (int*) - scalloc( total_cap, sizeof(int), "done_after", comm ); + scalloc(lmp, total_cap, sizeof(int), "done_after", comm ); /* QEq storage */ workspace->Hdia_inv = (double*) - scalloc( total_cap, sizeof(double), "Hdia_inv", comm ); - workspace->b_s = (double*) scalloc( total_cap, sizeof(double), "b_s", comm ); - workspace->b_t = (double*) scalloc( total_cap, sizeof(double), "b_t", comm ); - workspace->b_prc = (double*) scalloc( total_cap, sizeof(double), "b_prc", comm ); - workspace->b_prm = (double*) scalloc( total_cap, sizeof(double), "b_prm", comm ); - workspace->s = (double*) scalloc( total_cap, sizeof(double), "s", comm ); - workspace->t = (double*) scalloc( total_cap, sizeof(double), "t", comm ); + scalloc(lmp, total_cap, sizeof(double), "Hdia_inv", comm ); + workspace->b_s = (double*) scalloc(lmp, total_cap, sizeof(double), "b_s", comm ); + workspace->b_t = (double*) scalloc(lmp, total_cap, sizeof(double), "b_t", comm ); + workspace->b_prc = (double*) scalloc(lmp, total_cap, sizeof(double), "b_prc", comm ); + workspace->b_prm = (double*) scalloc(lmp, total_cap, sizeof(double), "b_prm", comm ); + workspace->s = (double*) scalloc(lmp, total_cap, sizeof(double), "s", comm ); + workspace->t = (double*) scalloc(lmp, total_cap, sizeof(double), "t", comm ); workspace->droptol = (double*) - scalloc( total_cap, sizeof(double), "droptol", comm ); - workspace->b = (rvec2*) scalloc( total_cap, sizeof(rvec2), "b", comm ); - workspace->x = (rvec2*) scalloc( total_cap, sizeof(rvec2), "x", comm ); + scalloc(lmp, total_cap, sizeof(double), "droptol", comm ); + workspace->b = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "b", comm ); + workspace->x = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "x", comm ); /* GMRES storage */ - workspace->y = (double*) scalloc( RESTART+1, sizeof(double), "y", comm ); - workspace->z = (double*) scalloc( RESTART+1, sizeof(double), "z", comm ); - workspace->g = (double*) scalloc( RESTART+1, sizeof(double), "g", comm ); - workspace->h = (double**) scalloc( RESTART+1, sizeof(double*), "h", comm ); - workspace->hs = (double*) scalloc( RESTART+1, sizeof(double), "hs", comm ); - workspace->hc = (double*) scalloc( RESTART+1, sizeof(double), "hc", comm ); - workspace->v = (double**) scalloc( RESTART+1, sizeof(double*), "v", comm ); + workspace->y = (double*) scalloc(lmp, RESTART+1, sizeof(double), "y", comm ); + workspace->z = (double*) scalloc(lmp, RESTART+1, sizeof(double), "z", comm ); + workspace->g = (double*) scalloc(lmp, RESTART+1, sizeof(double), "g", comm ); + workspace->h = (double**) scalloc(lmp, RESTART+1, sizeof(double*), "h", comm ); + workspace->hs = (double*) scalloc(lmp, RESTART+1, sizeof(double), "hs", comm ); + workspace->hc = (double*) scalloc(lmp, RESTART+1, sizeof(double), "hc", comm ); + workspace->v = (double**) scalloc(lmp, RESTART+1, sizeof(double*), "v", comm ); for( i = 0; i < RESTART+1; ++i ) { - workspace->h[i] = (double*) scalloc( RESTART+1, sizeof(double), "h[i]", comm ); - workspace->v[i] = (double*) scalloc( total_cap, sizeof(double), "v[i]", comm ); + workspace->h[i] = (double*) scalloc(lmp, RESTART+1, sizeof(double), "h[i]", comm ); + workspace->v[i] = (double*) scalloc(lmp, total_cap, sizeof(double), "v[i]", comm ); } /* CG storage */ - workspace->r = (double*) scalloc( total_cap, sizeof(double), "r", comm ); - workspace->d = (double*) scalloc( total_cap, sizeof(double), "d", comm ); - workspace->q = (double*) scalloc( total_cap, sizeof(double), "q", comm ); - workspace->p = (double*) scalloc( total_cap, sizeof(double), "p", comm ); - workspace->r2 = (rvec2*) scalloc( total_cap, sizeof(rvec2), "r2", comm ); - workspace->d2 = (rvec2*) scalloc( total_cap, sizeof(rvec2), "d2", comm ); - workspace->q2 = (rvec2*) scalloc( total_cap, sizeof(rvec2), "q2", comm ); - workspace->p2 = (rvec2*) scalloc( total_cap, sizeof(rvec2), "p2", comm ); + workspace->r = (double*) scalloc(lmp, total_cap, sizeof(double), "r", comm ); + workspace->d = (double*) scalloc(lmp, total_cap, sizeof(double), "d", comm ); + workspace->q = (double*) scalloc(lmp, total_cap, sizeof(double), "q", comm ); + workspace->p = (double*) scalloc(lmp, total_cap, sizeof(double), "p", comm ); + workspace->r2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "r2", comm ); + workspace->d2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "d2", comm ); + workspace->q2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "q2", comm ); + workspace->p2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "p2", comm ); /* integrator storage */ - workspace->v_const = (rvec*) smalloc( local_rvec, "v_const", comm ); + workspace->v_const = (rvec*) smalloc(lmp, local_rvec, "v_const", comm ); /* force related storage */ - workspace->f = (rvec*) scalloc( total_cap, sizeof(rvec), "f", comm ); + workspace->f = (rvec*) scalloc(lmp, total_cap, sizeof(rvec), "f", comm ); workspace->CdDelta = (double*) - scalloc( total_cap, sizeof(double), "CdDelta", comm ); + scalloc(lmp, total_cap, sizeof(double), "CdDelta", comm ); // storage for reductions with multiple threads #ifdef LMP_USER_OMP - workspace->CdDeltaReduction = (double *) scalloc(sizeof(double), total_cap*control->nthreads, + workspace->CdDeltaReduction = (double *) scalloc(lmp, sizeof(double), total_cap*control->nthreads, "cddelta_reduce", comm); - workspace->forceReduction = (rvec *) scalloc(sizeof(rvec), total_cap*control->nthreads, + workspace->forceReduction = (rvec *) scalloc(lmp, sizeof(rvec), total_cap*control->nthreads, "forceReduction", comm); - workspace->valence_angle_atom_myoffset = (int *) scalloc(sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); + workspace->valence_angle_atom_myoffset = (int *) scalloc(lmp, sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads); #else LMP_UNUSED_PARAM(control); @@ -321,18 +321,17 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, } -static void Reallocate_Neighbor_List( reax_list *far_nbrs, int n, +static void Reallocate_Neighbor_List( LAMMPS* lmp, reax_list *far_nbrs, int n, int num_intrs, MPI_Comm comm ) { - Delete_List( far_nbrs, comm ); - if(!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs, comm )){ - fprintf(stderr, "Problem in initializing far nbrs list. Terminating!\n"); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + Delete_List( lmp, far_nbrs, comm ); + if(!Make_List( lmp, n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs, comm )){ + lmp->error->one(FLERR,"Problem in initializing far neighbors list"); } } -static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, +static int Reallocate_HBonds_List( LAMMPS *lmp, reax_system *system, reax_list *hbonds, MPI_Comm comm ) { int i, total_hbonds; @@ -347,10 +346,9 @@ static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, } total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); - Delete_List( hbonds, comm ); - if (!Make_List( system->Hcap, total_hbonds, TYP_HBOND, hbonds, comm )) { - fprintf( stderr, "not enough space for hbonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + Delete_List( lmp, hbonds, comm ); + if (!Make_List( lmp, system->Hcap, total_hbonds, TYP_HBOND, hbonds, comm )) { + lmp->error->one(FLERR, "Not enough space for hydrogen bonds list"); } return total_hbonds; @@ -377,13 +375,12 @@ static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *b #ifdef LMP_USER_OMP if (system->omp_active) for (i = 0; i < bonds->num_intrs; ++i) - sfree(bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); + sfree(lmp, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); #endif - Delete_List( bonds, comm ); - if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { - fprintf( stderr, "not enough space for bonds list. terminating!\n" ); - lmp->error->all(FLERR, "Can't allocate space for hbonds."); + Delete_List( lmp, bonds, comm ); + if(!Make_List(lmp, system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { + lmp->error->one(FLERR, "Not enough space for bonds list"); } #ifdef LMP_USER_OMP @@ -396,7 +393,7 @@ static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *b if (system->omp_active) for (i = 0; i < bonds->num_intrs; ++i) bonds->select.bond_list[i].bo_data.CdboReduction = - (double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm); + (double*) smalloc(lmp, sizeof(double)*nthreads, "CdboReduction", comm); #endif return SUCCESS; @@ -437,21 +434,19 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, /* system */ ret = Allocate_System( system, system->local_cap, system->total_cap, msg ); if (ret != SUCCESS) { - fprintf( stderr, "not enough space for atom_list: total_cap=%d", - system->total_cap ); - fprintf( stderr, "terminating...\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + char errmsg[128]; + snprintf(errmsg, 128, "Not enough space for atom_list: total_cap=%d", system->total_cap); + lmp->error->one(FLERR, errmsg); } /* workspace */ - DeAllocate_Workspace( control, workspace ); - ret = Allocate_Workspace( system, control, workspace, system->local_cap, + DeAllocate_Workspace( lmp, control, workspace ); + ret = Allocate_Workspace( lmp, system, control, workspace, system->local_cap, system->total_cap, comm, msg ); if (ret != SUCCESS) { - fprintf( stderr, "no space for workspace: local_cap=%d total_cap=%d", - system->local_cap, system->total_cap ); - fprintf( stderr, "terminating...\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + char errmsg[128]; + snprintf(errmsg, 128, "Not enough space for workspace: local_cap=%d total_cap=%d", system->local_cap, system->total_cap); + lmp->error->one(FLERR, errmsg); } } @@ -463,15 +458,15 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, if (Nflag || realloc->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { if (realloc->num_far > far_nbrs->num_intrs) { - fprintf( stderr, "step%d-ran out of space on far_nbrs: top=%d, max=%d", - data->step, realloc->num_far, far_nbrs->num_intrs ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + char errmsg[128]; + snprintf(errmsg, 128, "step%d-ran out of space on far_nbrs: top=%d, max=%d", data->step, realloc->num_far, far_nbrs->num_intrs); + lmp->error->one(FLERR, errmsg); } newsize = static_cast (MAX( realloc->num_far*safezone, mincap*MIN_NBRS )); - Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize, comm ); + Reallocate_Neighbor_List( lmp, far_nbrs, system->total_cap, newsize, comm ); realloc->num_far = 0; } } @@ -486,7 +481,7 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, } if (Hflag || realloc->hbonds) { - ret = Reallocate_HBonds_List( system, (*lists)+HBONDS, comm ); + ret = Reallocate_HBonds_List( lmp, system, (*lists)+HBONDS, comm ); realloc->hbonds = 0; } } @@ -502,17 +497,16 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, /* 3-body list */ if (realloc->num_3body > 0) { - Delete_List( (*lists)+THREE_BODIES, comm ); + Delete_List( lmp, (*lists)+THREE_BODIES, comm ); if (num_bonds == -1) num_bonds = ((*lists)+BONDS)->num_intrs; realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); - if( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, + if( !Make_List( lmp, num_bonds, realloc->num_3body, TYP_THREE_BODY, (*lists)+THREE_BODIES, comm ) ) { - fprintf( stderr, "Problem in initializing angles list. Terminating!\n" ); - MPI_Abort( comm, CANNOT_INITIALIZE ); + lmp->error->one(FLERR, "Problem in initializing angles list"); } realloc->num_3body = -1; } diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index 786ee6ee8b..9f009b0916 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -33,14 +33,14 @@ #include "error.h" using namespace LAMMPS_NS; -int PreAllocate_Space( reax_system*, control_params*, storage*, MPI_Comm ); +int PreAllocate_Space( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, MPI_Comm ); int Allocate_System( reax_system*, int, int, char* ); -void DeAllocate_System( reax_system* ); +void DeAllocate_System( LAMMPS_NS::LAMMPS*, reax_system* ); -int Allocate_Workspace( reax_system*, control_params*, storage*, +int Allocate_Workspace( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, int, int, MPI_Comm, char* ); -void DeAllocate_Workspace( control_params*, storage* ); +void DeAllocate_Workspace( LAMMPS_NS::LAMMPS*, control_params*, storage* ); void ReAllocate( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, reax_list**, mpi_datatypes* ); diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index 1ed58a0bfd..924be8809d 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -360,7 +360,8 @@ int BOp( storage *workspace, reax_list *bonds, double bo_cut, void BO( reax_system *system, control_params * /*control*/, simulation_data * /*data*/, - storage *workspace, reax_list **lists, output_controls * /*out_control*/ ) + storage *workspace, reax_list **lists, output_controls * /*out_control*/, + LAMMPS_NS::LAMMPS* lmp ) { int i, j, pj, type_i, type_j; int start_i, end_i, sym_index; diff --git a/src/USER-REAXC/reaxc_bond_orders.h b/src/USER-REAXC/reaxc_bond_orders.h index 3631d90c89..8de60ba2f2 100644 --- a/src/USER-REAXC/reaxc_bond_orders.h +++ b/src/USER-REAXC/reaxc_bond_orders.h @@ -42,5 +42,5 @@ void Add_dBond_to_Forces_NPT( int, int, simulation_data*, 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* ); + storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); #endif diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index 48fb872324..d5ac4f1ed4 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -33,7 +33,7 @@ void Bonds( reax_system *system, control_params * /*control*/, simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/ ) + output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) { int i, j, pj, natoms; int start_i, end_i; diff --git a/src/USER-REAXC/reaxc_bonds.h b/src/USER-REAXC/reaxc_bonds.h index a4a1fb0b44..b425598b42 100644 --- a/src/USER-REAXC/reaxc_bonds.h +++ b/src/USER-REAXC/reaxc_bonds.h @@ -30,5 +30,5 @@ #include "reaxc_types.h" void Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); + storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); #endif diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index dd2b5a32ad..bf221a6266 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -28,7 +28,9 @@ #include "reaxc_control.h" #include "reaxc_tool_box.h" -char Read_Control_File( char *control_file, control_params* control, +using namespace LAMMPS_NS; + +char Read_Control_File( LAMMPS *lmp, char *control_file, control_params* control, output_controls *out_control ) { FILE *fp; @@ -38,8 +40,7 @@ char Read_Control_File( char *control_file, control_params* control, /* open control file */ if ( (fp = fopen( control_file, "r" ) ) == NULL ) { - fprintf( stderr, "error opening the control file! terminating...\n" ); - MPI_Abort( MPI_COMM_WORLD, FILE_NOT_FOUND ); + lmp->error->all(FLERR, "The control file cannot be opened"); } /* assign default values */ @@ -364,8 +365,9 @@ char Read_Control_File( char *control_file, control_params* control, control->restrict_type = ival; } else { - fprintf( stderr, "WARNING: unknown parameter %s\n", tmp[0] ); - MPI_Abort( MPI_COMM_WORLD, 15 ); + char errmsg[128]; + snprintf(errmsg,128,"Unknown parameter %s in the control file", tmp[0]); + lmp->error->all(FLERR, errmsg); } } diff --git a/src/USER-REAXC/reaxc_control.h b/src/USER-REAXC/reaxc_control.h index b2b455d6b8..4546a894f6 100644 --- a/src/USER-REAXC/reaxc_control.h +++ b/src/USER-REAXC/reaxc_control.h @@ -29,6 +29,9 @@ #include "reaxc_types.h" -char Read_Control_File( char*, control_params*, output_controls* ); +#include "lammps.h" +#include "error.h" + +char Read_Control_File( LAMMPS_NS::LAMMPS *lmp, char*, control_params*, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index dd8f12f9d2..6096e3e614 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -29,7 +29,10 @@ #include "reaxc_ffield.h" #include "reaxc_tool_box.h" -char Read_Force_Field( FILE *fp, reax_interaction *reax, +#include "lammps.h" +#include "error.h" + +char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, control_params *control ) { char *s; @@ -41,7 +44,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, double val; MPI_Comm comm; int me; - + comm = MPI_COMM_WORLD; MPI_Comm_rank(comm, &me); @@ -61,7 +64,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, n = atoi(tmp[0]); if (n < 1) { if (me == 0) - fprintf( stderr, "WARNING: number of globals in ffield file is 0!\n" ); + lmp->error->warning( FLERR, "Number of globals in ffield file is 0" ); fclose(fp); free(s); free(tmp); @@ -96,54 +99,54 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Allocating structures in reax_interaction */ reax->sbp = (single_body_parameters*) - scalloc( reax->num_atom_types, sizeof(single_body_parameters), "sbp", + scalloc(lmp, reax->num_atom_types, sizeof(single_body_parameters), "sbp", comm ); reax->tbp = (two_body_parameters**) - scalloc( reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); reax->thbp= (three_body_header***) - scalloc( reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); reax->hbp = (hbond_parameters***) - scalloc( reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); reax->fbp = (four_body_header****) - scalloc( reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); tor_flag = (char****) - scalloc( reax->num_atom_types, sizeof(char***), "tor_flag", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(char***), "tor_flag", comm ); for( i = 0; i < reax->num_atom_types; i++ ) { reax->tbp[i] = (two_body_parameters*) - scalloc( reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", + scalloc(lmp, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", comm ); reax->thbp[i]= (three_body_header**) - scalloc( reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", + scalloc(lmp, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", comm ); reax->hbp[i] = (hbond_parameters**) - scalloc( reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", + scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", comm ); reax->fbp[i] = (four_body_header***) - scalloc( reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", + scalloc(lmp, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", comm ); tor_flag[i] = (char***) - scalloc( reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); for( j = 0; j < reax->num_atom_types; j++ ) { reax->thbp[i][j]= (three_body_header*) - scalloc( reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", + scalloc(lmp, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", comm ); reax->hbp[i][j] = (hbond_parameters*) - scalloc( reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", + scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", comm ); reax->fbp[i][j] = (four_body_header**) - scalloc( reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", + scalloc(lmp, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", comm ); tor_flag[i][j] = (char**) - scalloc( reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); + scalloc(lmp, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); for (k=0; k < reax->num_atom_types; k++) { reax->fbp[i][j][k] = (four_body_header*) - scalloc( reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", + scalloc(lmp, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", comm ); tor_flag[i][j][k] = (char*) - scalloc( reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", + scalloc(lmp, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", comm ); } } @@ -158,15 +161,9 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, c = Tokenize( s, &tmp ); /* Sanity checks */ - if (c == 2 && !lgflag) { - if (me == 0) - fprintf(stderr, "Force field file requires using 'lgvdw yes'\n"); - MPI_Abort( comm, FILE_NOT_FOUND ); - } + if (c < 9) { - if (me == 0) - fprintf(stderr, "Inconsistent ffield file (reaxc_ffield.cpp) \n"); - MPI_Abort( comm, FILE_NOT_FOUND ); + lmp->error->one(FLERR,"Inconsistent ffield file"); } for( j = 0; j < (int)(strlen(tmp[0])); ++j ) @@ -188,9 +185,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - if (me == 0) - fprintf(stderr, "Inconsistent ffield file (reaxc_ffield.cpp) \n"); - MPI_Abort( comm, FILE_NOT_FOUND ); + lmp->error->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].alpha = val; @@ -208,9 +203,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - if (me == 0) - fprintf(stderr, "Inconsistent ffield file (reaxc_ffield.cpp) \n"); - MPI_Abort( comm, FILE_NOT_FOUND ); + lmp->error->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; @@ -228,9 +221,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - if (me == 0) - fprintf(stderr, "Inconsistent ffield file (reaxc_ffield.cpp) \n"); - MPI_Abort( comm, FILE_NOT_FOUND ); + lmp->error->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; @@ -249,9 +240,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c > 2) { - if (me == 0) - fprintf(stderr, "Force field file incompatible with 'lgvdw yes'\n"); - MPI_Abort( comm, FILE_NOT_FOUND ); + lmp->error->one(FLERR,"Force field file incompatible with 'lgvdw yes'"); } val = atof(tmp[0]); reax->sbp[i].lgcij = val; @@ -261,28 +250,32 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, 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)) - fprintf( stderr, "Warning: inconsistent vdWaals-parameters\n" \ - "Force field parameters for element %s\n" \ - "indicate inner wall+shielding, but earlier\n" \ - "atoms indicate different vdWaals-method.\n" \ - "This may cause division-by-zero errors.\n" \ - "Keeping vdWaals-setting for earlier atoms.\n", - reax->sbp[i].name ); + 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); + lmp->error->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) - fprintf( stderr, "Warning: inconsistent vdWaals-parameters\n" \ - "Force field parameters for element %s\n" \ - "indicate inner wall without shielding, but earlier\n" \ - "atoms indicate different vdWaals-method.\n" \ - "This may cause division-by-zero errors.\n" \ - "Keeping vdWaals-setting for earlier atoms.\n", - reax->sbp[i].name ); + 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); + lmp->error->warning(FLERR,errmsg); + } } else { reax->gp.vdw_type = 2; } @@ -290,23 +283,25 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } 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) - fprintf( stderr, "Warning: inconsistent vdWaals-parameters\n" \ - "Force field parameters for element %s\n" \ - "indicate shielding without inner wall, but earlier\n" \ - "atoms indicate different vdWaals-method.\n" \ - "This may cause division-by-zero errors.\n" \ - "Keeping vdWaals-setting for earlier atoms.\n", - reax->sbp[i].name ); + 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); + lmp->error->warning(FLERR,errmsg); + } } else { reax->gp.vdw_type = 1; } } else { - if (me == 0) - fprintf( stderr, "Error: inconsistent vdWaals-parameters\n" \ - "No shielding or inner-wall set for element %s\n", - reax->sbp[i].name ); - MPI_Abort( comm, INVALID_INPUT ); + char errmsg[256]; + snprintf(errmsg, 256, "Inconsistent vdWaals-parameters " + "No shielding or inner-wall set for element %s", + reax->sbp[i].name); + lmp->error->all(FLERR, errmsg); } } } @@ -315,15 +310,23 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, 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) - fprintf(stderr,"Warning: changed valency_val to valency_boc for %s\n", - reax->sbp[i].name ); + if (me == 0) { + char errmsg[256]; + snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", + reax->sbp[i].name); + lmp->error->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) { + lmp->error->all(FLERR, "Force field file requires using 'lgvdw yes'"); + } + l = atoi(tmp[0]); /* a line of comments */ @@ -334,6 +337,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, fgets(s,MAX_LINE,fp); c=Tokenize(s,&tmp); + + j = atoi(tmp[0]) - 1; k = atoi(tmp[1]) - 1; diff --git a/src/USER-REAXC/reaxc_ffield.h b/src/USER-REAXC/reaxc_ffield.h index 7cef730f91..225f207de9 100644 --- a/src/USER-REAXC/reaxc_ffield.h +++ b/src/USER-REAXC/reaxc_ffield.h @@ -29,6 +29,6 @@ #include "reaxc_types.h" -char Read_Force_Field( FILE*, reax_interaction*, control_params* ); +char Read_Force_Field( LAMMPS_NS::LAMMPS*, FILE*, reax_interaction*, control_params* ); #endif diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 848c03f5a1..4adec04f0c 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -39,15 +39,12 @@ #include "reaxc_valence_angles.h" #include "reaxc_vector.h" -#include "lammps.h" -#include "error.h" interaction_function Interaction_Functions[NUM_INTRS]; -using namespace LAMMPS_NS; void Dummy_Interaction( reax_system * /*system*/, control_params * /*control*/, simulation_data * /*data*/, storage * /*workspace*/, - reax_list **/*lists*/, output_controls * /*out_control*/ ) + reax_list ** /*lists*/, output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* = NULL ) { } @@ -79,7 +76,7 @@ void Compute_Bonded_Forces( reax_system *system, control_params *control, /* Implement all force calls as function pointers */ for( i = 0; i < NUM_INTRS; i++ ) { (Interaction_Functions[i])( system, control, data, workspace, - lists, out_control ); + lists, out_control, NULL ); } } @@ -118,7 +115,7 @@ void Compute_Total_Force( reax_system *system, control_params *control, } -void Validate_Lists( LAMMPS *lmp, reax_system *system, storage * /*workspace*/, reax_list **lists, +void Validate_Lists( LAMMPS_NS::LAMMPS *lmp, reax_system *system, storage * /*workspace*/, reax_list **lists, int step, int /*n*/, int N, int numH, MPI_Comm comm ) { int i, comp, Hindex; @@ -138,9 +135,10 @@ void Validate_Lists( LAMMPS *lmp, reax_system *system, storage * /*workspace*/, else comp = bonds->num_intrs; if (End_Index(i, bonds) > comp) { - fprintf( stderr, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n", + 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 ); - lmp->error->all(FLERR,"Failure in bond list."); + lmp->error->all(FLERR,errmsg); } } } @@ -165,9 +163,10 @@ void Validate_Lists( LAMMPS *lmp, reax_system *system, storage * /*workspace*/, else comp = hbonds->num_intrs; if (End_Index(Hindex, hbonds) > comp) { - fprintf(stderr,"step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", + 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 ); - lmp->error->all(FLERR, "Failure in hydrogen bonds."); + lmp->error->all(FLERR, errmsg); } } } @@ -175,7 +174,7 @@ void Validate_Lists( LAMMPS *lmp, reax_system *system, storage * /*workspace*/, } -void Init_Forces_noQEq( LAMMPS *lmp, reax_system *system, control_params *control, +void Init_Forces_noQEq( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls * /*out_control*/, MPI_Comm comm ) { @@ -435,7 +434,7 @@ void Estimate_Storages( reax_system *system, control_params *control, } -void Compute_Forces( LAMMPS *lmp, reax_system *system, control_params *control, +void Compute_Forces( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index be34df7571..489a43cfc1 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -33,7 +33,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) + reax_list **lists, output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) { int i, j, k, pi, pk; int type_i, type_j, type_k; diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.h b/src/USER-REAXC/reaxc_hydrogen_bonds.h index 04d3d26d5c..2a448439ea 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.h +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.h @@ -30,6 +30,6 @@ #include "reaxc_types.h" void Hydrogen_Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); + storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); #endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 4565fd067d..6ee68d6c46 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -82,7 +82,7 @@ int Init_Simulation_Data( reax_system *system, control_params *control, return SUCCESS; } -void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) +void Init_Taper( LAMMPS_NS::LAMMPS* lmp, control_params *control, storage *workspace, MPI_Comm comm ) { double d1, d7; double swa, swa2, swa3; @@ -92,14 +92,16 @@ void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) swb = control->nonb_cut; if (fabs( swa ) > 0.01) - fprintf( stderr, "Warning: non-zero lower Taper-radius cutoff\n" ); + lmp->error->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); if (swb < 0) { - fprintf( stderr, "Negative upper Taper-radius cutoff\n" ); - MPI_Abort( comm, INVALID_INPUT ); + lmp->error->all(FLERR,"Negative upper Taper-radius cutoff"); + } + else if( swb < 5 ) { + char errmsg[256]; + snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb ); + lmp->error->warning( FLERR, errmsg ); } - else if( swb < 5 ) - fprintf( stderr, "Warning: very low Taper-radius cutoff: %f\n", swb ); d1 = swb - swa; d7 = pow( d1, 7.0 ); @@ -120,12 +122,12 @@ void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) } -int Init_Workspace( reax_system *system, control_params *control, +int Init_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, storage *workspace, MPI_Comm comm, char *msg ) { int ret; - ret = Allocate_Workspace( system, control, workspace, + ret = Allocate_Workspace( lmp, system, control, workspace, system->local_cap, system->total_cap, comm, msg ); if (ret != SUCCESS) return ret; @@ -134,7 +136,7 @@ int Init_Workspace( reax_system *system, control_params *control, Reset_Workspace( system, workspace ); /* Initialize the Taper function */ - Init_Taper( control, workspace, comm ); + Init_Taper( lmp, control, workspace, comm ); return SUCCESS; } @@ -179,10 +181,9 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, } total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); - if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, + if( !Make_List( lmp, system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS, comm ) ) { - fprintf( stderr, "not enough space for hbonds list. terminating!\n" ); - lmp->error->all(FLERR, "Can't allocate space for hbonds."); + lmp->error->one(FLERR, "Not enough space for hbonds list."); } } @@ -193,18 +194,16 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, } bond_cap = (int)(MAX( total_bonds*safezone, mincap*MIN_BONDS )); - if( !Make_List( system->total_cap, bond_cap, TYP_BOND, + if( !Make_List( lmp, system->total_cap, bond_cap, TYP_BOND, *lists+BONDS, comm ) ) { - fprintf( stderr, "not enough space for bonds list. terminating!\n" ); - lmp->error->all(FLERR, "Can't allocate space for hbonds."); + lmp->error->one(FLERR, "Not enough space for bonds list."); } /* 3bodies list */ cap_3body = (int)(MAX( num_3body*safezone, MIN_3BODIES )); - if( !Make_List( bond_cap, cap_3body, TYP_THREE_BODY, + if( !Make_List( lmp, bond_cap, cap_3body, TYP_THREE_BODY, *lists+THREE_BODIES, comm ) ){ - fprintf( stderr, "Problem in initializing angles list. Terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + lmp->error->one(FLERR,"Problem in initializing angles list."); } free( hb_top ); @@ -219,60 +218,53 @@ void Initialize( LAMMPS *lmp, reax_system *system, control_params *control, mpi_datatypes *mpi_data, MPI_Comm comm ) { char msg[MAX_STR]; + char errmsg[128]; if (Init_MPI_Datatypes(system, workspace, mpi_data, comm, msg) == FAILURE) { - fprintf( stderr, "p%d: init_mpi_datatypes: could not create datatypes\n", - system->my_rank ); - fprintf( stderr, "p%d: mpi_data couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + + snprintf(errmsg, 128, "Could not create datatypes on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } if (Init_System(system, control, msg) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: system could not be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf(errmsg, 128, "System could not be initialized on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: sim_data couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf(errmsg, 128, "Sim_data could not be initialized on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } - if (Init_Workspace( system, control, workspace, mpi_data->world, msg ) == + if (Init_Workspace( lmp, system, control, workspace, mpi_data->world, msg ) == FAILURE) { - fprintf( stderr, "p%d:init_workspace: not enough memory\n", - system->my_rank ); - fprintf( stderr, "p%d:workspace couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf(errmsg, 128, "Workspace could not be initialized on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } if (Init_Lists( lmp, system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: system could not be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf(errmsg, 128, "System could not be initialized on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } - if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: could not open output files! terminating...\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + if (Init_Output_Files(lmp, system,control,out_control,mpi_data,msg)== FAILURE) { + snprintf(errmsg, 128, "Could not open output files on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } if (control->tabulate) { - if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: couldn't create lookup table! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + if (Init_Lookup_Tables( lmp, system, control, workspace, mpi_data, msg ) == FAILURE) { + snprintf(errmsg, 128, "Lookup table could not be created on thread %d", + system->my_rank); + lmp->error->one(FLERR,errmsg); } } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index f71fcbec8e..aa7e7fcea7 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -34,7 +34,7 @@ #include "reaxc_traj.h" #include "reaxc_vector.h" -int Init_Output_Files( reax_system *system, control_params *control, +int Init_Output_Files( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data, char *msg ) { @@ -42,7 +42,7 @@ int Init_Output_Files( reax_system *system, control_params *control, int ret; if (out_control->write_steps > 0) { - ret = Init_Traj( system, control, out_control, mpi_data, msg ); + ret = Init_Traj( lmp, system, control, out_control, mpi_data, msg ); if (ret == FAILURE) return ret; } @@ -107,7 +107,7 @@ int Close_Output_Files( reax_system *system, control_params *control, } -void Output_Results( reax_system *system, control_params *control, +void Output_Results( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, simulation_data *data, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { @@ -146,7 +146,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( lmp, system, control, data, lists, out_control, mpi_data ); } } diff --git a/src/USER-REAXC/reaxc_io_tools.h b/src/USER-REAXC/reaxc_io_tools.h index a3f22fccc2..80202d5c83 100644 --- a/src/USER-REAXC/reaxc_io_tools.h +++ b/src/USER-REAXC/reaxc_io_tools.h @@ -29,10 +29,10 @@ #include "reaxc_types.h" -int Init_Output_Files( reax_system*, control_params*, +int Init_Output_Files( LAMMPS_NS::LAMMPS*, 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*, +void Output_Results( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, simulation_data*, reax_list**, output_controls*, mpi_datatypes* ); #endif diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 8a3bb9d322..5d4ab2f3c8 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -29,116 +29,118 @@ #include "reaxc_tool_box.h" /************* allocate list space ******************/ -int Make_List(int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) +int Make_List( LAMMPS_NS::LAMMPS *lmp, int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) { l->allocated = 1; l->n = n; l->num_intrs = num_intrs; - if (l->index) sfree(l->index, "list:index"); - if (l->end_index) sfree(l->end_index, "list:end_index"); - l->index = (int*) smalloc( n * sizeof(int), "list:index", comm ); - l->end_index = (int*) smalloc( n * sizeof(int), "list:end_index", comm ); + if (l->index) sfree(lmp, l->index, "list:index"); + if (l->end_index) sfree(lmp, l->end_index, "list:end_index"); + l->index = (int*) smalloc(lmp, n * sizeof(int), "list:index", comm ); + l->end_index = (int*) smalloc(lmp, n * sizeof(int), "list:end_index", comm ); l->type = type; switch(l->type) { case TYP_VOID: - if (l->select.v) sfree(l->select.v, "list:v"); - l->select.v = (void*) smalloc(l->num_intrs * sizeof(void*), "list:v", comm); + if (l->select.v) sfree(lmp, l->select.v, "list:v"); + l->select.v = (void*) smalloc(lmp, l->num_intrs * sizeof(void*), "list:v", comm); break; case TYP_THREE_BODY: - if (l->select.three_body_list) sfree(l->select.three_body_list,"list:three_bodies"); + if (l->select.three_body_list) sfree(lmp, l->select.three_body_list,"list:three_bodies"); l->select.three_body_list = (three_body_interaction_data*) - smalloc( l->num_intrs * sizeof(three_body_interaction_data), + smalloc(lmp, l->num_intrs * sizeof(three_body_interaction_data), "list:three_bodies", comm ); break; case TYP_BOND: - if (l->select.bond_list) sfree(l->select.bond_list,"list:bonds"); + if (l->select.bond_list) sfree(lmp, l->select.bond_list,"list:bonds"); l->select.bond_list = (bond_data*) - smalloc( l->num_intrs * sizeof(bond_data), "list:bonds", comm ); + smalloc(lmp, l->num_intrs * sizeof(bond_data), "list:bonds", comm ); break; case TYP_DBO: - if (l->select.dbo_list) sfree(l->select.dbo_list,"list:dbonds"); + if (l->select.dbo_list) sfree(lmp, l->select.dbo_list,"list:dbonds"); l->select.dbo_list = (dbond_data*) - smalloc( l->num_intrs * sizeof(dbond_data), "list:dbonds", comm ); + smalloc(lmp, l->num_intrs * sizeof(dbond_data), "list:dbonds", comm ); break; case TYP_DDELTA: - if (l->select.dDelta_list) sfree(l->select.dDelta_list,"list:dDeltas"); + if (l->select.dDelta_list) sfree(lmp, l->select.dDelta_list,"list:dDeltas"); l->select.dDelta_list = (dDelta_data*) - smalloc( l->num_intrs * sizeof(dDelta_data), "list:dDeltas", comm ); + smalloc(lmp, l->num_intrs * sizeof(dDelta_data), "list:dDeltas", comm ); break; case TYP_FAR_NEIGHBOR: - if (l->select.far_nbr_list) sfree(l->select.far_nbr_list,"list:far_nbrs"); + if (l->select.far_nbr_list) sfree(lmp, l->select.far_nbr_list,"list:far_nbrs"); l->select.far_nbr_list = (far_neighbor_data*) - smalloc(l->num_intrs * sizeof(far_neighbor_data), "list:far_nbrs", comm); + smalloc(lmp, l->num_intrs * sizeof(far_neighbor_data), "list:far_nbrs", comm); break; case TYP_HBOND: - if (l->select.hbond_list) sfree(l->select.hbond_list,"list:hbonds"); + if (l->select.hbond_list) sfree(lmp, l->select.hbond_list,"list:hbonds"); l->select.hbond_list = (hbond_data*) - smalloc( l->num_intrs * sizeof(hbond_data), "list:hbonds", comm ); + smalloc(lmp, l->num_intrs * sizeof(hbond_data), "list:hbonds", comm ); break; default: - fprintf( stderr, "ERROR: no %d list type defined!\n", l->type ); - MPI_Abort( comm, INVALID_INPUT ); + char errmsg[128]; + snprintf(errmsg, 128, "No %d list type defined", l->type); + lmp->error->all(FLERR,errmsg); } return SUCCESS; } -void Delete_List( reax_list *l, MPI_Comm comm ) +void Delete_List( LAMMPS_NS::LAMMPS *lmp, reax_list *l, MPI_Comm comm ) { if (l->allocated == 0) return; l->allocated = 0; - sfree( l->index, "list:index" ); - sfree( l->end_index, "list:end_index" ); + sfree(lmp, l->index, "list:index" ); + sfree(lmp, l->end_index, "list:end_index" ); l->index = NULL; l->end_index = NULL; switch(l->type) { case TYP_VOID: - sfree( l->select.v, "list:v" ); + sfree(lmp, l->select.v, "list:v" ); l->select.v = NULL; break; case TYP_HBOND: - sfree( l->select.hbond_list, "list:hbonds" ); + sfree(lmp, l->select.hbond_list, "list:hbonds" ); l->select.hbond_list = NULL; break; case TYP_FAR_NEIGHBOR: - sfree( l->select.far_nbr_list, "list:far_nbrs" ); + sfree(lmp, l->select.far_nbr_list, "list:far_nbrs" ); l->select.far_nbr_list = NULL; break; case TYP_BOND: - sfree( l->select.bond_list, "list:bonds" ); + sfree(lmp, l->select.bond_list, "list:bonds" ); l->select.bond_list = NULL; break; case TYP_DBO: - sfree( l->select.dbo_list, "list:dbos" ); + sfree(lmp, l->select.dbo_list, "list:dbos" ); l->select.dbo_list = NULL; break; case TYP_DDELTA: - sfree( l->select.dDelta_list, "list:dDeltas" ); + sfree(lmp, l->select.dDelta_list, "list:dDeltas" ); l->select.dDelta_list = NULL; break; case TYP_THREE_BODY: - sfree( l->select.three_body_list, "list:three_bodies" ); + sfree(lmp, l->select.three_body_list, "list:three_bodies" ); l->select.three_body_list = NULL; break; default: - fprintf( stderr, "ERROR: no %d list type defined!\n", l->type ); - MPI_Abort( comm, INVALID_INPUT ); + char errmsg[128]; + snprintf(errmsg, 128, "No %d list type defined", l->type); + lmp->error->all(FLERR,errmsg); } } diff --git a/src/USER-REAXC/reaxc_list.h b/src/USER-REAXC/reaxc_list.h index ab7fbce19c..1df2338b0f 100644 --- a/src/USER-REAXC/reaxc_list.h +++ b/src/USER-REAXC/reaxc_list.h @@ -29,8 +29,8 @@ #include "reaxc_types.h" -int Make_List( int, int, int, reax_list*, MPI_Comm ); -void Delete_List( reax_list*, MPI_Comm ); +int Make_List( LAMMPS_NS::LAMMPS*, int, int, int, reax_list*, MPI_Comm ); +void Delete_List( LAMMPS_NS::LAMMPS*, reax_list*, MPI_Comm ); inline int Num_Entries(int,reax_list*); inline int Start_Index( int, reax_list* ); diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index 92945ebdb5..41ad5e99d4 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -50,7 +50,7 @@ void Tridiagonal_Solve( const double *a, const double *b, } -void Natural_Cubic_Spline( const double *h, const double *f, +void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double *f, cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ) { @@ -58,11 +58,11 @@ void Natural_Cubic_Spline( const double *h, const double *f, double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = a[1] = a[n-1] = 0; @@ -92,16 +92,16 @@ void Natural_Cubic_Spline( const double *h, const double *f, coef[i-1].a = f[i]; } - sfree( a, "cubic_spline:a" ); - sfree( b, "cubic_spline:b" ); - sfree( c, "cubic_spline:c" ); - sfree( d, "cubic_spline:d" ); - sfree( v, "cubic_spline:v" ); + sfree(lmp, a, "cubic_spline:a" ); + sfree(lmp, b, "cubic_spline:b" ); + sfree(lmp, c, "cubic_spline:c" ); + sfree(lmp, d, "cubic_spline:d" ); + sfree(lmp, v, "cubic_spline:v" ); } -void Complete_Cubic_Spline( const double *h, const double *f, double v0, double vlast, +void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double *f, double v0, double vlast, cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ) { @@ -109,11 +109,11 @@ void Complete_Cubic_Spline( const double *h, const double *f, double v0, double double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc( n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = 0; @@ -142,15 +142,15 @@ void Complete_Cubic_Spline( const double *h, const double *f, double v0, double coef[i-1].a = f[i]; } - sfree( a, "cubic_spline:a" ); - sfree( b, "cubic_spline:b" ); - sfree( c, "cubic_spline:c" ); - sfree( d, "cubic_spline:d" ); - sfree( v, "cubic_spline:v" ); + sfree(lmp, a, "cubic_spline:a" ); + sfree(lmp, b, "cubic_spline:b" ); + sfree(lmp, c, "cubic_spline:c" ); + sfree(lmp, d, "cubic_spline:d" ); + sfree(lmp, v, "cubic_spline:v" ); } -int Init_Lookup_Tables( reax_system *system, control_params *control, +int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, storage *workspace, mpi_datatypes *mpi_data, char * /*msg*/ ) { int i, j, r; @@ -171,23 +171,23 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, num_atom_types = system->reax_param.num_atom_types; dr = control->nonb_cut / control->tabulate; h = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:h", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:h", comm ); fh = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); fvdw = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); fCEvd = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); fele = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); fCEclmb = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); + smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); LR = (LR_lookup_table**) - scalloc( num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); + scalloc(lmp, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); for( i = 0; i < num_atom_types; ++i ) LR[i] = (LR_lookup_table*) - scalloc( num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); + scalloc(lmp, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); for( i = 0; i < MAX_ATOM_TYPES; ++i ) existing_types[i] = 0; @@ -207,21 +207,21 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, LR[i][j].dx = dr; LR[i][j].inv_dx = control->tabulate / control->nonb_cut; LR[i][j].y = (LR_data*) - smalloc( LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); + smalloc(lmp, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); LR[i][j].H = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , + smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , comm ); LR[i][j].vdW = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", + smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", comm); LR[i][j].CEvd = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", + smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", comm); LR[i][j].ele = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", + smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", comm ); LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef), + smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb", comm ); for( r = 1; r <= control->tabulate; ++r ) { @@ -246,22 +246,22 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, vlast_vdw = fCEvd[r-1]; vlast_ele = fele[r-1]; - Natural_Cubic_Spline( &h[1], &fh[1], + Natural_Cubic_Spline( lmp, &h[1], &fh[1], &(LR[i][j].H[1]), control->tabulate+1, comm ); - Complete_Cubic_Spline( &h[1], &fvdw[1], v0_vdw, vlast_vdw, + Complete_Cubic_Spline( lmp, &h[1], &fvdw[1], v0_vdw, vlast_vdw, &(LR[i][j].vdW[1]), control->tabulate+1, comm ); - Natural_Cubic_Spline( &h[1], &fCEvd[1], + Natural_Cubic_Spline( lmp, &h[1], &fCEvd[1], &(LR[i][j].CEvd[1]), control->tabulate+1, comm ); - Complete_Cubic_Spline( &h[1], &fele[1], v0_ele, vlast_ele, + Complete_Cubic_Spline( lmp, &h[1], &fele[1], v0_ele, vlast_ele, &(LR[i][j].ele[1]), control->tabulate+1, comm ); - Natural_Cubic_Spline( &h[1], &fCEclmb[1], + Natural_Cubic_Spline( lmp, &h[1], &fCEclmb[1], &(LR[i][j].CEclmb[1]), control->tabulate+1, comm ); } else { @@ -281,7 +281,7 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, } -void Deallocate_Lookup_Tables( reax_system *system ) +void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system ) { int i, j; int ntypes; @@ -291,14 +291,14 @@ void Deallocate_Lookup_Tables( reax_system *system ) for( i = 0; i < ntypes; ++i ) { for( j = i; j < ntypes; ++j ) if (LR[i][j].n) { - sfree( LR[i][j].y, "LR[i,j].y" ); - sfree( LR[i][j].H, "LR[i,j].H" ); - sfree( LR[i][j].vdW, "LR[i,j].vdW" ); - sfree( LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree( LR[i][j].ele, "LR[i,j].ele" ); - sfree( LR[i][j].CEclmb, "LR[i,j].CEclmb" ); + sfree(lmp, LR[i][j].y, "LR[i,j].y" ); + sfree(lmp, LR[i][j].H, "LR[i,j].H" ); + sfree(lmp, LR[i][j].vdW, "LR[i,j].vdW" ); + sfree(lmp, LR[i][j].CEvd, "LR[i,j].CEvd" ); + sfree(lmp, LR[i][j].ele, "LR[i,j].ele" ); + sfree(lmp, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); } - sfree( LR[i], "LR[i]" ); + sfree(lmp, LR[i], "LR[i]" ); } - sfree( LR, "LR" ); + sfree(lmp, LR, "LR" ); } diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h index 66fa3c407c..2d33ad82de 100644 --- a/src/USER-REAXC/reaxc_lookup.h +++ b/src/USER-REAXC/reaxc_lookup.h @@ -32,17 +32,17 @@ void Tridiagonal_Solve( const double *a, const double *b, double *c, double *d, double *x, unsigned int n); -void Natural_Cubic_Spline( const double *h, const double *f, +void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f, cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ); -void Complete_Cubic_Spline( const double *h, const double *f, double v0, double vlast, +void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f, double v0, double vlast, cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ); -int Init_Lookup_Tables( reax_system*, control_params*, storage*, +int Init_Lookup_Tables( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, mpi_datatypes*, char* ); -void Deallocate_Lookup_Tables( reax_system* ); +void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS*, reax_system* ); #endif diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index f7d72a2678..a16c4eb42b 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -32,7 +32,7 @@ void Atom_Energy( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/ ) + output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) { int i, j, pj, type_i, type_j; double Delta_lpcorr, dfvl; diff --git a/src/USER-REAXC/reaxc_multi_body.h b/src/USER-REAXC/reaxc_multi_body.h index a17c9f484e..dc2c1040eb 100644 --- a/src/USER-REAXC/reaxc_multi_body.h +++ b/src/USER-REAXC/reaxc_multi_body.h @@ -30,6 +30,6 @@ #include "reaxc_types.h" void Atom_Energy( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); + storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); #endif diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index d9cb5f22fe..49a9f096dd 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -144,10 +144,10 @@ void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *con if (total_bonds >= bonds->num_intrs * DANGER_ZONE) { workspace->realloc.bonds = 1; if (total_bonds >= bonds->num_intrs) { - fprintf(stderr, - "p%d: not enough space for bonds! total=%d allocated=%d\n", - system->my_rank, total_bonds, bonds->num_intrs ); - lmp->error->all(FLERR, "Can't allocate space for hbonds."); + char errmsg[256]; + snprintf(errmsg, 256, "p%d: not enough space for bonds! total=%d allocated=%d\n", + system->my_rank, total_bonds, bonds->num_intrs); + lmp->error->one(FLERR, errmsg); } } } @@ -170,10 +170,10 @@ void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *con if (total_hbonds >= hbonds->num_intrs * 0.90/*DANGER_ZONE*/) { workspace->realloc.hbonds = 1; if (total_hbonds >= hbonds->num_intrs) { - fprintf(stderr, - "p%d: not enough space for hbonds! total=%d allocated=%d\n", - system->my_rank, total_hbonds, hbonds->num_intrs ); - lmp->error->all(FLERR, "Can't allocate space for hbonds."); + char errmsg[256]; + snprintf(errmsg, 256, "p%d: not enough space for hbonds! total=%d allocated=%d\n", + system->my_rank, total_hbonds, hbonds->num_intrs); + lmp->error->one(FLERR, errmsg); } } } diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index 9e662e7a45..eaa6765f36 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -53,23 +53,25 @@ int Tokenize( char* s, char*** tok ) return count; } + + /* safe malloc */ -void *smalloc( rc_bigint n, const char *name, MPI_Comm comm ) +void *smalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, const char *name, MPI_Comm comm ) { void *ptr; + char errmsg[256]; if (n <= 0) { - fprintf( stderr, "WARNING: trying to allocate %ld bytes for array %s. ", - n, name ); - fprintf( stderr, "returning NULL.\n" ); + snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. " + "returning NULL.", n, name); + lmp->error->warning(FLERR,errmsg); return NULL; } ptr = malloc( n ); if (ptr == NULL) { - fprintf( stderr, "ERROR: failed to allocate %ld bytes for array %s", - n, name ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); + lmp->error->one(FLERR,errmsg); } return ptr; @@ -77,29 +79,30 @@ void *smalloc( rc_bigint n, const char *name, MPI_Comm comm ) /* safe calloc */ -void *scalloc( rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) +void *scalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) { void *ptr; + char errmsg[256]; if (n <= 0) { - fprintf( stderr, "WARNING: trying to allocate %ld elements for array %s. ", - n, name ); - fprintf( stderr, "returning NULL.\n" ); + snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. " + "returning NULL.\n", n, name ); + lmp->error->warning(FLERR,errmsg); return NULL; } if (size <= 0) { - fprintf( stderr, "WARNING: elements size for array %s is %ld. ", - name, size ); - fprintf( stderr, "returning NULL.\n" ); + snprintf(errmsg, 256, "Elements size for array %s is %ld. " + "returning NULL", name, size ); + lmp->error->warning(FLERR,errmsg); return NULL; } ptr = calloc( n, size ); if (ptr == NULL) { - fprintf( stderr, "ERROR: failed to allocate %ld bytes for array %s", - n*size, name ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + char errmsg[256]; + snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); + lmp->error->one(FLERR,errmsg); } return ptr; @@ -107,11 +110,12 @@ void *scalloc( rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) /* safe free */ -void sfree( void *ptr, const char *name ) +void sfree( LAMMPS_NS::LAMMPS* lmp, void *ptr, const char *name ) { if (ptr == NULL) { - fprintf( stderr, "WARNING: trying to free the already NULL pointer %s!\n", - name ); + char errmsg[256]; + snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); + lmp->error->one(FLERR,errmsg); return; } diff --git a/src/USER-REAXC/reaxc_tool_box.h b/src/USER-REAXC/reaxc_tool_box.h index 7f8dd455ca..7c5ab12587 100644 --- a/src/USER-REAXC/reaxc_tool_box.h +++ b/src/USER-REAXC/reaxc_tool_box.h @@ -37,7 +37,7 @@ double Get_Time( ); int Tokenize( char*, char*** ); /* from lammps */ -void *smalloc( rc_bigint, const char*, MPI_Comm ); -void *scalloc( rc_bigint, rc_bigint, const char*, MPI_Comm ); -void sfree( void*, const char* ); +void *smalloc( LAMMPS_NS::LAMMPS*, rc_bigint, const char*, MPI_Comm ); +void *scalloc( LAMMPS_NS::LAMMPS*, rc_bigint, rc_bigint, const char*, MPI_Comm ); +void sfree( LAMMPS_NS::LAMMPS*, void*, const char* ); #endif diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index ed76368d68..50c3412928 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -120,7 +120,8 @@ double Calculate_Omega( rvec dvec_ij, double r_ij, void Torsion_Angles( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control ) + reax_list **lists, output_controls *out_control, + LAMMPS_NS::LAMMPS* lmp ) { int i, j, k, l, pi, pj, pk, pl, pij, plk, natoms; int type_i, type_j, type_k, type_l; diff --git a/src/USER-REAXC/reaxc_torsion_angles.h b/src/USER-REAXC/reaxc_torsion_angles.h index 755e8c6532..38236cb7dc 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.h +++ b/src/USER-REAXC/reaxc_torsion_angles.h @@ -30,6 +30,7 @@ #include "reaxc_types.h" void Torsion_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); + storage*, reax_list**, output_controls*, + LAMMPS_NS::LAMMPS* = NULL ); #endif diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 54d8b3219c..ee2939d662 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -29,7 +29,7 @@ #include "reaxc_list.h" #include "reaxc_tool_box.h" -int Reallocate_Output_Buffer( output_controls *out_control, int req_space, +int Reallocate_Output_Buffer( LAMMPS_NS::LAMMPS *lmp, output_controls *out_control, int req_space, MPI_Comm comm ) { if (out_control->buffer_len > 0) @@ -38,10 +38,9 @@ int Reallocate_Output_Buffer( output_controls *out_control, int req_space, out_control->buffer_len = (int)(req_space*SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); if (out_control->buffer == NULL) { - fprintf( stderr, - "insufficient memory for required buffer size %d. terminating!\n", - (int) (req_space*SAFE_ZONE) ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + char errmsg[256]; + snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*SAFE_ZONE)); + lmp->error->one(FLERR,errmsg); } return SUCCESS; @@ -57,7 +56,7 @@ void Write_Skip_Line( output_controls *out_control, mpi_datatypes * /*mpi_data*/ } -int Write_Header( reax_system *system, control_params *control, +int Write_Header( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data ) { int num_hdr_lines, my_hdr_lines, buffer_req; @@ -83,7 +82,7 @@ int Write_Header( reax_system *system, control_params *control, 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( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); /* only the master node writes into trajectory header */ if (system->my_rank == MASTER_NODE) { @@ -259,7 +258,7 @@ int Write_Header( reax_system *system, control_params *control, } -int Write_Init_Desc( reax_system *system, control_params * /*control*/, +int Write_Init_Desc( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params * /*control*/, output_controls *out_control, mpi_datatypes *mpi_data ) { int i, me, np, cnt, buffer_len, buffer_req; @@ -278,7 +277,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, else buffer_req = system->n * INIT_DESC_LEN + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); out_control->line[0] = 0; out_control->buffer[0] = 0; @@ -311,7 +310,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, } -int Init_Traj( reax_system *system, control_params *control, +int Init_Traj( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data, char *msg ) { @@ -348,14 +347,14 @@ int Init_Traj( reax_system *system, control_params *control, 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( lmp, system, control, out_control, mpi_data ); + Write_Init_Desc( lmp, system, control, out_control, mpi_data ); return SUCCESS; } -int Write_Frame_Header( reax_system *system, control_params *control, +int Write_Frame_Header( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, output_controls *out_control, mpi_datatypes *mpi_data ) { @@ -367,7 +366,7 @@ int Write_Frame_Header( reax_system *system, control_params *control, 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( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); /* only the master node writes into trajectory header */ if (me == MASTER_NODE) { @@ -481,7 +480,7 @@ int Write_Frame_Header( reax_system *system, control_params *control, -int Write_Atoms( reax_system *system, control_params * /*control*/, +int Write_Atoms( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * /*control*/, output_controls *out_control, mpi_datatypes *mpi_data ) { int i, me, np, line_len, buffer_len, buffer_req, cnt; @@ -500,7 +499,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, else buffer_req = system->n * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); /* fill in buffer */ out_control->line[0] = 0; @@ -531,9 +530,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q ); break; default: - fprintf( stderr, - "write_traj_atoms: unknown atom trajectroy format!\n"); - MPI_Abort( mpi_data->world, UNKNOWN_OPTION ); + lmp->error->all(FLERR,"Write_traj_atoms: unknown atom trajectory format"); } strncpy( out_control->buffer + i*line_len, out_control->line, line_len+1 ); @@ -559,7 +556,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, } -int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, +int Write_Bonds( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, reax_list *bonds, output_controls *out_control, mpi_datatypes *mpi_data) { int i, j, pj, me, np; @@ -592,7 +589,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, else buffer_req = my_bonds * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); /* fill in the buffer */ out_control->line[0] = 0; @@ -619,8 +616,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2 ); break; default: - fprintf(stderr, "write_traj_bonds: FATAL! invalid bond_info option"); - MPI_Abort( mpi_data->world, UNKNOWN_OPTION ); + lmp->error->all(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); } strncpy( out_control->buffer + my_bonds*line_len, out_control->line, line_len+1 ); @@ -649,7 +645,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, } -int Write_Angles( reax_system *system, control_params *control, +int Write_Angles( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, reax_list *bonds, reax_list *thb_intrs, output_controls *out_control, mpi_datatypes *mpi_data ) { @@ -693,7 +689,7 @@ int Write_Angles( reax_system *system, control_params *control, else buffer_req = my_angles * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); /* fill in the buffer */ my_angles = 0; @@ -744,20 +740,20 @@ int Write_Angles( reax_system *system, control_params *control, } -int Append_Frame( reax_system *system, control_params *control, +int Append_Frame( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, simulation_data *data, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { - Write_Frame_Header( system, control, data, out_control, mpi_data ); + Write_Frame_Header( lmp, system, control, data, out_control, mpi_data ); if (out_control->write_atoms) - Write_Atoms( system, control, out_control, mpi_data ); + Write_Atoms( lmp, system, control, out_control, mpi_data ); if (out_control->write_bonds) - Write_Bonds( system, control, (*lists + BONDS), out_control, mpi_data ); + Write_Bonds( lmp, system, control, (*lists + BONDS), out_control, mpi_data ); if (out_control->write_angles) - Write_Angles( system, control, (*lists + BONDS), (*lists + THREE_BODIES), + Write_Angles( lmp, system, control, (*lists + BONDS), (*lists + THREE_BODIES), out_control, mpi_data ); return SUCCESS; diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 72c56637eb..5508d27cdb 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -73,11 +73,11 @@ 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*, +int Init_Traj( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, output_controls*, mpi_datatypes*, char* ); int End_Traj( int, output_controls* ); -int Append_Frame( reax_system*, control_params*, simulation_data*, +int Append_Frame( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, simulation_data*, reax_list**, output_controls*, mpi_datatypes* ); #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 2666fcf85c..cf6d5dcddc 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -39,6 +39,9 @@ #include #include "accelerator_kokkos.h" +#include "lammps.h" +#include "error.h" + #if defined LMP_USER_OMP #define OMP_TIMING 0 @@ -899,9 +902,9 @@ 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*, +typedef void (*interaction_function) ( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*); + reax_list**, output_controls*, LAMMPS_NS::LAMMPS*); typedef void (*print_interaction)(reax_system*, control_params*, simulation_data*, storage*, diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index af1f1f8003..d762dc1611 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -76,7 +76,7 @@ void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, void Valence_Angles( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) + reax_list **lists, output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp) { int i, j, pi, k, pk, t; int type_i, type_j, type_k; @@ -405,9 +405,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) { - fprintf( stderr, "step%d-ran out of space on angle_list: top=%d, max=%d", - data->step, num_thb_intrs, thb_intrs->num_intrs ); - MPI_Abort( MPI_COMM_WORLD, INSUFFICIENT_MEMORY ); + 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); + lmp->error->one(FLERR, errmsg); } } diff --git a/src/USER-REAXC/reaxc_valence_angles.h b/src/USER-REAXC/reaxc_valence_angles.h index 31936ba190..27bda3ba09 100644 --- a/src/USER-REAXC/reaxc_valence_angles.h +++ b/src/USER-REAXC/reaxc_valence_angles.h @@ -30,7 +30,7 @@ #include "reaxc_types.h" void Valence_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls* ); + storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL); void Calculate_Theta( rvec, double, rvec, double, double*, double* ); From 111ff4475e86419e21698fe7f950c2e589ba3ebe Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 14:18:55 +0100 Subject: [PATCH 03/68] Pointer moved to reax lists --- src/USER-REAXC/pair_reaxc.cpp | 21 +- src/USER-REAXC/reaxc_allocate.cpp | 316 +++++++++++++++--------------- src/USER-REAXC/reaxc_allocate.h | 10 +- src/USER-REAXC/reaxc_ffield.cpp | 34 ++-- src/USER-REAXC/reaxc_init_md.cpp | 11 +- src/USER-REAXC/reaxc_list.cpp | 62 +++--- src/USER-REAXC/reaxc_list.h | 4 +- src/USER-REAXC/reaxc_lookup.cpp | 84 ++++---- src/USER-REAXC/reaxc_tool_box.cpp | 18 +- src/USER-REAXC/reaxc_tool_box.h | 6 +- src/USER-REAXC/reaxc_types.h | 4 + 11 files changed, 290 insertions(+), 280 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 24612a3a40..58142b122a 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -108,6 +108,8 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->bndry_cuts.ghost_cutoff = 0; system->my_atoms = NULL; system->pair_ptr = this; + system->error_ptr = this->lmp->error; + control->error_ptr = this->lmp->error; system->omp_active = 0; @@ -139,13 +141,13 @@ PairReaxC::~PairReaxC() if (control->tabulate ) Deallocate_Lookup_Tables( lmp, system); - if (control->hbond_cut > 0 ) Delete_List( lmp, lists+HBONDS, world); - Delete_List( lmp, lists+BONDS, world ); - Delete_List( lmp, lists+THREE_BODIES, world ); - Delete_List( lmp, lists+FAR_NBRS, world ); + if (control->hbond_cut > 0 ) Delete_List( lists+HBONDS, world); + Delete_List( lists+BONDS, world ); + Delete_List( lists+THREE_BODIES, world ); + Delete_List( lists+FAR_NBRS, world ); - DeAllocate_Workspace( lmp, control, workspace ); - DeAllocate_System( lmp, system ); + DeAllocate_Workspace( control, workspace ); + DeAllocate_System( system ); } memory->destroy( system ); @@ -437,13 +439,14 @@ void PairReaxC::setup( ) // initialize my data structures - PreAllocate_Space( lmp, system, control, workspace, world ); + PreAllocate_Space( system, control, workspace, world ); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); - if(!Make_List(lmp, system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, lists+FAR_NBRS, world)) error->one(FLERR,"Pair reax/c problem in far neighbor list"); + (lists+FAR_NBRS)->error_ptr=lmp->error; write_reax_lists(); Initialize( lmp, system, control, data, workspace, &lists, out_control, @@ -466,7 +469,7 @@ void PairReaxC::setup( ) // check if I need to shrink/extend my data-structs - ReAllocate( lmp, system, control, data, workspace, &lists, mpi_data ); + ReAllocate( system, control, data, workspace, &lists, mpi_data ); } bigint local_ngroup = list->inum; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 2f970399f2..8784c854b5 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -43,7 +43,7 @@ using namespace LAMMPS_NS; 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( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * /*control*/, +int PreAllocate_Space( reax_system *system, control_params * /*control*/, storage * workspace, MPI_Comm comm ) { int mincap = system->mincap; @@ -55,7 +55,7 @@ int PreAllocate_Space( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_para system->total_cap = MAX( (int)(system->N * safezone), mincap ); system->my_atoms = (reax_atom*) - scalloc(lmp, system->total_cap, sizeof(reax_atom), "my_atoms", comm ); + scalloc(system->error_ptr, system->total_cap, sizeof(reax_atom), "my_atoms", comm ); // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); @@ -84,45 +84,45 @@ int Allocate_System( reax_system *system, int /*local_cap*/, int total_cap, } -void DeAllocate_System( LAMMPS_NS::LAMMPS *lmp, reax_system *system ) +void DeAllocate_System( reax_system *system ) { int i, j, k; int ntypes; reax_interaction *ff_params; - // dealloocate the atom list - sfree(lmp, system->my_atoms, "system->my_atoms" ); + // deallocate the atom list + sfree(system->error_ptr, system->my_atoms, "system->my_atoms" ); // deallocate the ffield parameters storage ff_params = &(system->reax_param); ntypes = ff_params->num_atom_types; - sfree(lmp, ff_params->gp.l, "ff:globals" ); + sfree(system->error_ptr, 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(lmp, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); + sfree(system->error_ptr, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); } - sfree(lmp, ff_params->fbp[i][j], "ff:fbp[i,j]" ); - sfree(lmp, ff_params->thbp[i][j], "ff:thbp[i,j]" ); - sfree(lmp, 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(lmp, ff_params->fbp[i], "ff:fbp[i]" ); - sfree(lmp, ff_params->thbp[i], "ff:thbp[i]" ); - sfree(lmp, ff_params->hbp[i], "ff:hbp[i]" ); - sfree(lmp, 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(lmp, ff_params->fbp, "ff:fbp" ); - sfree(lmp, ff_params->thbp, "ff:thbp" ); - sfree(lmp, ff_params->hbp, "ff:hbp" ); - sfree(lmp, ff_params->tbp, "ff:tbp" ); - sfree(lmp, 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( LAMMPS_NS::LAMMPS* lmp, control_params * /*control*/, storage *workspace ) +void DeAllocate_Workspace( control_params * control, storage *workspace ) { int i; @@ -133,84 +133,84 @@ void DeAllocate_Workspace( LAMMPS_NS::LAMMPS* lmp, control_params * /*control*/, /* communication storage */ for( i = 0; i < MAX_NBRS; ++i ) { - sfree(lmp, workspace->tmp_dbl[i], "tmp_dbl[i]" ); - sfree(lmp, workspace->tmp_rvec[i], "tmp_rvec[i]" ); - sfree(lmp, workspace->tmp_rvec2[i], "tmp_rvec2[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(lmp, workspace->within_bond_box, "skin" ); - sfree(lmp, workspace->total_bond_order, "total_bo" ); - sfree(lmp, workspace->Deltap, "Deltap" ); - sfree(lmp, workspace->Deltap_boc, "Deltap_boc" ); - sfree(lmp, workspace->dDeltap_self, "dDeltap_self" ); - sfree(lmp, workspace->Delta, "Delta" ); - sfree(lmp, workspace->Delta_lp, "Delta_lp" ); - sfree(lmp, workspace->Delta_lp_temp, "Delta_lp_temp" ); - sfree(lmp, workspace->dDelta_lp, "dDelta_lp" ); - sfree(lmp, workspace->dDelta_lp_temp, "dDelta_lp_temp" ); - sfree(lmp, workspace->Delta_e, "Delta_e" ); - sfree(lmp, workspace->Delta_boc, "Delta_boc" ); - sfree(lmp, workspace->Delta_val, "Delta_val" ); - sfree(lmp, workspace->nlp, "nlp" ); - sfree(lmp, workspace->nlp_temp, "nlp_temp" ); - sfree(lmp, workspace->Clp, "Clp" ); - sfree(lmp, workspace->vlpex, "vlpex" ); - sfree(lmp, workspace->bond_mark, "bond_mark" ); - sfree(lmp, workspace->done_after, "done_after" ); + 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" ); + 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" ); + sfree(control->error_ptr, workspace->done_after, "done_after" ); /* QEq storage */ - sfree(lmp, workspace->Hdia_inv, "Hdia_inv" ); - sfree(lmp, workspace->b_s, "b_s" ); - sfree(lmp, workspace->b_t, "b_t" ); - sfree(lmp, workspace->b_prc, "b_prc" ); - sfree(lmp, workspace->b_prm, "b_prm" ); - sfree(lmp, workspace->s, "s" ); - sfree(lmp, workspace->t, "t" ); - sfree(lmp, workspace->droptol, "droptol" ); - sfree(lmp, workspace->b, "b" ); - sfree(lmp, workspace->x, "x" ); + 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->droptol, "droptol" ); + sfree(control->error_ptr, workspace->b, "b" ); + sfree(control->error_ptr, workspace->x, "x" ); /* GMRES storage */ for( i = 0; i < RESTART+1; ++i ) { - sfree(lmp, workspace->h[i], "h[i]" ); - sfree(lmp, workspace->v[i], "v[i]" ); + sfree(control->error_ptr, workspace->h[i], "h[i]" ); + sfree(control->error_ptr, workspace->v[i], "v[i]" ); } - sfree(lmp, workspace->h, "h" ); - sfree(lmp, workspace->v, "v" ); - sfree(lmp, workspace->y, "y" ); - sfree(lmp, workspace->z, "z" ); - sfree(lmp, workspace->g, "g" ); - sfree(lmp, workspace->hs, "hs" ); - sfree(lmp, workspace->hc, "hc" ); + 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(lmp, workspace->r, "r" ); - sfree(lmp, workspace->d, "d" ); - sfree(lmp, workspace->q, "q" ); - sfree(lmp, workspace->p, "p" ); - sfree(lmp, workspace->r2, "r2" ); - sfree(lmp, workspace->d2, "d2" ); - sfree(lmp, workspace->q2, "q2" ); - sfree(lmp, workspace->p2, "p2" ); + 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" ); /* integrator storage */ - sfree(lmp, workspace->v_const, "v_const" ); + sfree(control->error_ptr, workspace->v_const, "v_const" ); /* force related storage */ - sfree(lmp, workspace->f, "f" ); - sfree(lmp, workspace->CdDelta, "CdDelta" ); + sfree(control->error_ptr, workspace->f, "f" ); + sfree(control->error_ptr, workspace->CdDelta, "CdDelta" ); /* reductions */ #ifdef LMP_USER_OMP - if (workspace->CdDeltaReduction) sfree(lmp, workspace->CdDeltaReduction, "cddelta_reduce" ); - if (workspace->forceReduction) sfree(lmp, workspace->forceReduction, "f_reduce" ); - if (workspace->valence_angle_atom_myoffset) sfree(lmp, workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); - if (workspace->my_ext_pressReduction) sfree(lmp, workspace->my_ext_pressReduction, "ext_press_reduce"); + 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 } -int Allocate_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system * /*system*/, control_params * control, +int Allocate_Workspace( reax_system * /*system*/, control_params * control, storage *workspace, int local_cap, int total_cap, MPI_Comm comm, char * /*msg*/ ) { @@ -224,94 +224,94 @@ int Allocate_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system * /*system*/, contro /* communication storage */ for( i = 0; i < MAX_NBRS; ++i ) { workspace->tmp_dbl[i] = (double*) - scalloc(lmp, total_cap, sizeof(double), "tmp_dbl", comm ); + scalloc(control->error_ptr, total_cap, sizeof(double), "tmp_dbl", comm ); workspace->tmp_rvec[i] = (rvec*) - scalloc(lmp, total_cap, sizeof(rvec), "tmp_rvec", comm ); + scalloc(control->error_ptr, total_cap, sizeof(rvec), "tmp_rvec", comm ); workspace->tmp_rvec2[i] = (rvec2*) - scalloc(lmp, total_cap, sizeof(rvec2), "tmp_rvec2", comm ); + scalloc(control->error_ptr, total_cap, sizeof(rvec2), "tmp_rvec2", comm ); } /* bond order related storage */ workspace->within_bond_box = (int*) - scalloc(lmp, total_cap, sizeof(int), "skin", comm ); - workspace->total_bond_order = (double*) smalloc(lmp, total_real, "total_bo", comm ); - workspace->Deltap = (double*) smalloc(lmp, total_real, "Deltap", comm ); - workspace->Deltap_boc = (double*) smalloc(lmp, total_real, "Deltap_boc", comm ); - workspace->dDeltap_self = (rvec*) smalloc(lmp, total_rvec, "dDeltap_self", comm ); - workspace->Delta = (double*) smalloc(lmp, total_real, "Delta", comm ); - workspace->Delta_lp = (double*) smalloc(lmp, total_real, "Delta_lp", comm ); + scalloc(control->error_ptr, total_cap, sizeof(int), "skin", comm ); + workspace->total_bond_order = (double*) smalloc(control->error_ptr, total_real, "total_bo", comm ); + workspace->Deltap = (double*) smalloc(control->error_ptr, total_real, "Deltap", comm ); + workspace->Deltap_boc = (double*) smalloc(control->error_ptr, total_real, "Deltap_boc", comm ); + workspace->dDeltap_self = (rvec*) smalloc(control->error_ptr, total_rvec, "dDeltap_self", comm ); + workspace->Delta = (double*) smalloc(control->error_ptr, total_real, "Delta", comm ); + workspace->Delta_lp = (double*) smalloc(control->error_ptr, total_real, "Delta_lp", comm ); workspace->Delta_lp_temp = (double*) - smalloc(lmp, total_real, "Delta_lp_temp", comm ); - workspace->dDelta_lp = (double*) smalloc(lmp, total_real, "dDelta_lp", comm ); + smalloc(control->error_ptr, total_real, "Delta_lp_temp", comm ); + workspace->dDelta_lp = (double*) smalloc(control->error_ptr, total_real, "dDelta_lp", comm ); workspace->dDelta_lp_temp = (double*) - smalloc(lmp, total_real, "dDelta_lp_temp", comm ); - workspace->Delta_e = (double*) smalloc(lmp, total_real, "Delta_e", comm ); - workspace->Delta_boc = (double*) smalloc(lmp, total_real, "Delta_boc", comm ); - workspace->Delta_val = (double*) smalloc(lmp, total_real, "Delta_val", comm ); - workspace->nlp = (double*) smalloc(lmp, total_real, "nlp", comm ); - workspace->nlp_temp = (double*) smalloc(lmp, total_real, "nlp_temp", comm ); - workspace->Clp = (double*) smalloc(lmp, total_real, "Clp", comm ); - workspace->vlpex = (double*) smalloc(lmp, total_real, "vlpex", comm ); + smalloc(control->error_ptr, total_real, "dDelta_lp_temp", comm ); + workspace->Delta_e = (double*) smalloc(control->error_ptr, total_real, "Delta_e", comm ); + workspace->Delta_boc = (double*) smalloc(control->error_ptr, total_real, "Delta_boc", comm ); + workspace->Delta_val = (double*) smalloc(control->error_ptr, total_real, "Delta_val", comm ); + workspace->nlp = (double*) smalloc(control->error_ptr, total_real, "nlp", comm ); + workspace->nlp_temp = (double*) smalloc(control->error_ptr, total_real, "nlp_temp", comm ); + workspace->Clp = (double*) smalloc(control->error_ptr, total_real, "Clp", comm ); + workspace->vlpex = (double*) smalloc(control->error_ptr, total_real, "vlpex", comm ); workspace->bond_mark = (int*) - scalloc(lmp, total_cap, sizeof(int), "bond_mark", comm ); + scalloc(control->error_ptr, total_cap, sizeof(int), "bond_mark", comm ); workspace->done_after = (int*) - scalloc(lmp, total_cap, sizeof(int), "done_after", comm ); + scalloc(control->error_ptr, total_cap, sizeof(int), "done_after", comm ); /* QEq storage */ workspace->Hdia_inv = (double*) - scalloc(lmp, total_cap, sizeof(double), "Hdia_inv", comm ); - workspace->b_s = (double*) scalloc(lmp, total_cap, sizeof(double), "b_s", comm ); - workspace->b_t = (double*) scalloc(lmp, total_cap, sizeof(double), "b_t", comm ); - workspace->b_prc = (double*) scalloc(lmp, total_cap, sizeof(double), "b_prc", comm ); - workspace->b_prm = (double*) scalloc(lmp, total_cap, sizeof(double), "b_prm", comm ); - workspace->s = (double*) scalloc(lmp, total_cap, sizeof(double), "s", comm ); - workspace->t = (double*) scalloc(lmp, total_cap, sizeof(double), "t", comm ); + scalloc(control->error_ptr, total_cap, sizeof(double), "Hdia_inv", comm ); + workspace->b_s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_s", comm ); + workspace->b_t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_t", comm ); + workspace->b_prc = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prc", comm ); + workspace->b_prm = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prm", comm ); + workspace->s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "s", comm ); + workspace->t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "t", comm ); workspace->droptol = (double*) - scalloc(lmp, total_cap, sizeof(double), "droptol", comm ); - workspace->b = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "b", comm ); - workspace->x = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "x", comm ); + scalloc(control->error_ptr, total_cap, sizeof(double), "droptol", comm ); + workspace->b = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "b", comm ); + workspace->x = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "x", comm ); /* GMRES storage */ - workspace->y = (double*) scalloc(lmp, RESTART+1, sizeof(double), "y", comm ); - workspace->z = (double*) scalloc(lmp, RESTART+1, sizeof(double), "z", comm ); - workspace->g = (double*) scalloc(lmp, RESTART+1, sizeof(double), "g", comm ); - workspace->h = (double**) scalloc(lmp, RESTART+1, sizeof(double*), "h", comm ); - workspace->hs = (double*) scalloc(lmp, RESTART+1, sizeof(double), "hs", comm ); - workspace->hc = (double*) scalloc(lmp, RESTART+1, sizeof(double), "hc", comm ); - workspace->v = (double**) scalloc(lmp, RESTART+1, sizeof(double*), "v", comm ); + workspace->y = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "y", comm ); + workspace->z = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "z", comm ); + workspace->g = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "g", comm ); + workspace->h = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "h", comm ); + workspace->hs = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hs", comm ); + workspace->hc = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hc", comm ); + workspace->v = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "v", comm ); for( i = 0; i < RESTART+1; ++i ) { - workspace->h[i] = (double*) scalloc(lmp, RESTART+1, sizeof(double), "h[i]", comm ); - workspace->v[i] = (double*) scalloc(lmp, total_cap, sizeof(double), "v[i]", comm ); + workspace->h[i] = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "h[i]", comm ); + workspace->v[i] = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "v[i]", comm ); } /* CG storage */ - workspace->r = (double*) scalloc(lmp, total_cap, sizeof(double), "r", comm ); - workspace->d = (double*) scalloc(lmp, total_cap, sizeof(double), "d", comm ); - workspace->q = (double*) scalloc(lmp, total_cap, sizeof(double), "q", comm ); - workspace->p = (double*) scalloc(lmp, total_cap, sizeof(double), "p", comm ); - workspace->r2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "r2", comm ); - workspace->d2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "d2", comm ); - workspace->q2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "q2", comm ); - workspace->p2 = (rvec2*) scalloc(lmp, total_cap, sizeof(rvec2), "p2", comm ); + workspace->r = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "r", comm ); + workspace->d = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "d", comm ); + workspace->q = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "q", comm ); + workspace->p = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "p", comm ); + workspace->r2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "r2", comm ); + workspace->d2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "d2", comm ); + workspace->q2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "q2", comm ); + workspace->p2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "p2", comm ); /* integrator storage */ - workspace->v_const = (rvec*) smalloc(lmp, local_rvec, "v_const", comm ); + workspace->v_const = (rvec*) smalloc(control->error_ptr, local_rvec, "v_const", comm ); /* force related storage */ - workspace->f = (rvec*) scalloc(lmp, total_cap, sizeof(rvec), "f", comm ); + workspace->f = (rvec*) scalloc(control->error_ptr, total_cap, sizeof(rvec), "f", comm ); workspace->CdDelta = (double*) - scalloc(lmp, total_cap, sizeof(double), "CdDelta", comm ); + scalloc(control->error_ptr, total_cap, sizeof(double), "CdDelta", comm ); // storage for reductions with multiple threads #ifdef LMP_USER_OMP - workspace->CdDeltaReduction = (double *) scalloc(lmp, sizeof(double), total_cap*control->nthreads, + workspace->CdDeltaReduction = (double *) scalloc(control->error_ptr, sizeof(double), total_cap*control->nthreads, "cddelta_reduce", comm); - workspace->forceReduction = (rvec *) scalloc(lmp, sizeof(rvec), total_cap*control->nthreads, + workspace->forceReduction = (rvec *) scalloc(control->error_ptr, sizeof(rvec), total_cap*control->nthreads, "forceReduction", comm); - workspace->valence_angle_atom_myoffset = (int *) scalloc(lmp, sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); + workspace->valence_angle_atom_myoffset = (int *) scalloc(control->error_ptr, sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads); #else LMP_UNUSED_PARAM(control); @@ -321,17 +321,17 @@ int Allocate_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system * /*system*/, contro } -static void Reallocate_Neighbor_List( LAMMPS* lmp, reax_list *far_nbrs, int n, +static void Reallocate_Neighbor_List( reax_list *far_nbrs, int n, int num_intrs, MPI_Comm comm ) { - Delete_List( lmp, far_nbrs, comm ); - if(!Make_List( lmp, n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs, comm )){ - lmp->error->one(FLERR,"Problem in initializing far neighbors list"); + Delete_List( far_nbrs, comm ); + if(!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs, comm )){ + far_nbrs->error_ptr->one(FLERR,"Problem in initializing far neighbors list"); } } -static int Reallocate_HBonds_List( LAMMPS *lmp, reax_system *system, reax_list *hbonds, +static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, MPI_Comm comm ) { int i, total_hbonds; @@ -346,16 +346,16 @@ static int Reallocate_HBonds_List( LAMMPS *lmp, reax_system *system, reax_list * } total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); - Delete_List( lmp, hbonds, comm ); - if (!Make_List( lmp, system->Hcap, total_hbonds, TYP_HBOND, hbonds, comm )) { - lmp->error->one(FLERR, "Not enough space for hydrogen bonds list"); + Delete_List( hbonds, comm ); + if (!Make_List( system->Hcap, total_hbonds, TYP_HBOND, hbonds, comm )) { + hbonds->error_ptr->one(FLERR, "Not enough space for hydrogen bonds list"); } return total_hbonds; } -static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *bonds, +static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, int *total_bonds, int *est_3body, MPI_Comm comm ) { @@ -375,12 +375,12 @@ static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *b #ifdef LMP_USER_OMP if (system->omp_active) for (i = 0; i < bonds->num_intrs; ++i) - sfree(lmp, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); + sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); #endif - Delete_List( lmp, bonds, comm ); - if(!Make_List(lmp, system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { - lmp->error->one(FLERR, "Not enough space for bonds list"); + Delete_List( bonds, comm ); + if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { + bonds->error_ptr->one(FLERR, "Not enough space for bonds list"); } #ifdef LMP_USER_OMP @@ -393,14 +393,14 @@ static int Reallocate_Bonds_List( LAMMPS *lmp, reax_system *system, reax_list *b if (system->omp_active) for (i = 0; i < bonds->num_intrs; ++i) bonds->select.bond_list[i].bo_data.CdboReduction = - (double*) smalloc(lmp, sizeof(double)*nthreads, "CdboReduction", comm); + (double*) smalloc(system->error_ptr, sizeof(double)*nthreads, "CdboReduction", comm); #endif return SUCCESS; } -void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, +void ReAllocate( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, mpi_datatypes *mpi_data ) { @@ -436,17 +436,17 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, if (ret != SUCCESS) { char errmsg[128]; snprintf(errmsg, 128, "Not enough space for atom_list: total_cap=%d", system->total_cap); - lmp->error->one(FLERR, errmsg); + system->error_ptr->one(FLERR, errmsg); } /* workspace */ - DeAllocate_Workspace( lmp, control, workspace ); - ret = Allocate_Workspace( lmp, system, control, workspace, system->local_cap, + DeAllocate_Workspace( control, workspace ); + ret = Allocate_Workspace( system, control, workspace, system->local_cap, system->total_cap, comm, msg ); if (ret != SUCCESS) { char errmsg[128]; snprintf(errmsg, 128, "Not enough space for workspace: local_cap=%d total_cap=%d", system->local_cap, system->total_cap); - lmp->error->one(FLERR, errmsg); + system->error_ptr->one(FLERR, errmsg); } } @@ -460,13 +460,13 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, if (realloc->num_far > far_nbrs->num_intrs) { char errmsg[128]; snprintf(errmsg, 128, "step%d-ran out of space on far_nbrs: top=%d, max=%d", data->step, realloc->num_far, far_nbrs->num_intrs); - lmp->error->one(FLERR, errmsg); + system->error_ptr->one(FLERR, errmsg); } newsize = static_cast (MAX( realloc->num_far*safezone, mincap*MIN_NBRS )); - Reallocate_Neighbor_List( lmp, far_nbrs, system->total_cap, newsize, comm ); + Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize, comm ); realloc->num_far = 0; } } @@ -481,7 +481,7 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, } if (Hflag || realloc->hbonds) { - ret = Reallocate_HBonds_List( lmp, system, (*lists)+HBONDS, comm ); + ret = Reallocate_HBonds_List( system, (*lists)+HBONDS, comm ); realloc->hbonds = 0; } } @@ -489,7 +489,7 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, /* bonds list */ num_bonds = est_3body = -1; if (Nflag || realloc->bonds) { - Reallocate_Bonds_List( lmp, system, (*lists)+BONDS, &num_bonds, + Reallocate_Bonds_List( system, (*lists)+BONDS, &num_bonds, &est_3body, comm ); realloc->bonds = 0; realloc->num_3body = MAX( realloc->num_3body, est_3body ) * 2; @@ -497,16 +497,16 @@ void ReAllocate( LAMMPS *lmp, reax_system *system, control_params *control, /* 3-body list */ if (realloc->num_3body > 0) { - Delete_List( lmp, (*lists)+THREE_BODIES, comm ); + Delete_List( (*lists)+THREE_BODIES, comm ); if (num_bonds == -1) num_bonds = ((*lists)+BONDS)->num_intrs; realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); - if( !Make_List( lmp, num_bonds, realloc->num_3body, TYP_THREE_BODY, + if( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, (*lists)+THREE_BODIES, comm ) ) { - lmp->error->one(FLERR, "Problem in initializing angles list"); + system->error_ptr->one(FLERR, "Problem in initializing angles list"); } realloc->num_3body = -1; } diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index 9f009b0916..f813204006 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -33,15 +33,15 @@ #include "error.h" using namespace LAMMPS_NS; -int PreAllocate_Space( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, MPI_Comm ); +int PreAllocate_Space( reax_system*, control_params*, storage*, MPI_Comm ); int Allocate_System( reax_system*, int, int, char* ); -void DeAllocate_System( LAMMPS_NS::LAMMPS*, reax_system* ); +void DeAllocate_System( reax_system* ); -int Allocate_Workspace( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, +int Allocate_Workspace( reax_system*, control_params*, storage*, int, int, MPI_Comm, char* ); -void DeAllocate_Workspace( LAMMPS_NS::LAMMPS*, control_params*, storage* ); +void DeAllocate_Workspace( control_params*, storage* ); -void ReAllocate( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, +void ReAllocate( reax_system*, control_params*, simulation_data*, storage*, reax_list**, mpi_datatypes* ); #endif diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 6096e3e614..8316c188b3 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -99,54 +99,54 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Allocating structures in reax_interaction */ reax->sbp = (single_body_parameters*) - scalloc(lmp, reax->num_atom_types, sizeof(single_body_parameters), "sbp", + scalloc(lmp->error, reax->num_atom_types, sizeof(single_body_parameters), "sbp", comm ); reax->tbp = (two_body_parameters**) - scalloc(lmp, reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); reax->thbp= (three_body_header***) - scalloc(lmp, reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); reax->hbp = (hbond_parameters***) - scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); reax->fbp = (four_body_header****) - scalloc(lmp, reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); tor_flag = (char****) - scalloc(lmp, reax->num_atom_types, sizeof(char***), "tor_flag", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(char***), "tor_flag", comm ); for( i = 0; i < reax->num_atom_types; i++ ) { reax->tbp[i] = (two_body_parameters*) - scalloc(lmp, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", + scalloc(lmp->error, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", comm ); reax->thbp[i]= (three_body_header**) - scalloc(lmp, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", + scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", comm ); reax->hbp[i] = (hbond_parameters**) - scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", + scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", comm ); reax->fbp[i] = (four_body_header***) - scalloc(lmp, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", + scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", comm ); tor_flag[i] = (char***) - scalloc(lmp, reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); for( j = 0; j < reax->num_atom_types; j++ ) { reax->thbp[i][j]= (three_body_header*) - scalloc(lmp, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", + scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", comm ); reax->hbp[i][j] = (hbond_parameters*) - scalloc(lmp, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", + scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", comm ); reax->fbp[i][j] = (four_body_header**) - scalloc(lmp, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", + scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", comm ); tor_flag[i][j] = (char**) - scalloc(lmp, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); + scalloc(lmp->error, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); for (k=0; k < reax->num_atom_types; k++) { reax->fbp[i][j][k] = (four_body_header*) - scalloc(lmp, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", + scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", comm ); tor_flag[i][j][k] = (char*) - scalloc(lmp, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", + scalloc(lmp->error, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", comm ); } } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 6ee68d6c46..8c60db0846 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -127,7 +127,7 @@ int Init_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params { int ret; - ret = Allocate_Workspace( lmp, system, control, workspace, + ret = Allocate_Workspace( system, control, workspace, system->local_cap, system->total_cap, comm, msg ); if (ret != SUCCESS) return ret; @@ -181,10 +181,11 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, } total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); - if( !Make_List( lmp, system->Hcap, total_hbonds, TYP_HBOND, + if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS, comm ) ) { lmp->error->one(FLERR, "Not enough space for hbonds list."); } + (*lists+HBONDS)->error_ptr = system->error_ptr; } total_bonds = 0; @@ -194,17 +195,19 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, } bond_cap = (int)(MAX( total_bonds*safezone, mincap*MIN_BONDS )); - if( !Make_List( lmp, system->total_cap, bond_cap, TYP_BOND, + if( !Make_List( system->total_cap, bond_cap, TYP_BOND, *lists+BONDS, comm ) ) { lmp->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( lmp, bond_cap, cap_3body, TYP_THREE_BODY, + if( !Make_List( bond_cap, cap_3body, TYP_THREE_BODY, *lists+THREE_BODIES, comm ) ){ lmp->error->one(FLERR,"Problem in initializing angles list."); } + (*lists+THREE_BODIES)->error_ptr = system->error_ptr; free( hb_top ); free( bond_top ); diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 5d4ab2f3c8..f103e520e8 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -29,118 +29,118 @@ #include "reaxc_tool_box.h" /************* allocate list space ******************/ -int Make_List( LAMMPS_NS::LAMMPS *lmp, int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) +int Make_List( int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) { l->allocated = 1; l->n = n; l->num_intrs = num_intrs; - if (l->index) sfree(lmp, l->index, "list:index"); - if (l->end_index) sfree(lmp, l->end_index, "list:end_index"); - l->index = (int*) smalloc(lmp, n * sizeof(int), "list:index", comm ); - l->end_index = (int*) smalloc(lmp, n * sizeof(int), "list:end_index", comm ); + 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", comm ); + l->end_index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:end_index", comm ); l->type = type; switch(l->type) { case TYP_VOID: - if (l->select.v) sfree(lmp, l->select.v, "list:v"); - l->select.v = (void*) smalloc(lmp, l->num_intrs * sizeof(void*), "list:v", comm); + if (l->select.v) sfree(l->error_ptr, l->select.v, "list:v"); + l->select.v = (void*) smalloc(l->error_ptr, l->num_intrs * sizeof(void*), "list:v", comm); break; case TYP_THREE_BODY: - if (l->select.three_body_list) sfree(lmp, l->select.three_body_list,"list:three_bodies"); + 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(lmp, l->num_intrs * sizeof(three_body_interaction_data), + smalloc(l->error_ptr, l->num_intrs * sizeof(three_body_interaction_data), "list:three_bodies", comm ); break; case TYP_BOND: - if (l->select.bond_list) sfree(lmp, l->select.bond_list,"list:bonds"); + if (l->select.bond_list) sfree(l->error_ptr, l->select.bond_list,"list:bonds"); l->select.bond_list = (bond_data*) - smalloc(lmp, l->num_intrs * sizeof(bond_data), "list:bonds", comm ); + smalloc(l->error_ptr, l->num_intrs * sizeof(bond_data), "list:bonds", comm ); break; case TYP_DBO: - if (l->select.dbo_list) sfree(lmp, l->select.dbo_list,"list:dbonds"); + if (l->select.dbo_list) sfree(l->error_ptr, l->select.dbo_list,"list:dbonds"); l->select.dbo_list = (dbond_data*) - smalloc(lmp, l->num_intrs * sizeof(dbond_data), "list:dbonds", comm ); + smalloc(l->error_ptr, l->num_intrs * sizeof(dbond_data), "list:dbonds", comm ); break; case TYP_DDELTA: - if (l->select.dDelta_list) sfree(lmp, l->select.dDelta_list,"list:dDeltas"); + if (l->select.dDelta_list) sfree(l->error_ptr, l->select.dDelta_list,"list:dDeltas"); l->select.dDelta_list = (dDelta_data*) - smalloc(lmp, l->num_intrs * sizeof(dDelta_data), "list:dDeltas", comm ); + smalloc(l->error_ptr, l->num_intrs * sizeof(dDelta_data), "list:dDeltas", comm ); break; case TYP_FAR_NEIGHBOR: - if (l->select.far_nbr_list) sfree(lmp, l->select.far_nbr_list,"list:far_nbrs"); + 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(lmp, l->num_intrs * sizeof(far_neighbor_data), "list:far_nbrs", comm); + smalloc(l->error_ptr, l->num_intrs * sizeof(far_neighbor_data), "list:far_nbrs", comm); break; case TYP_HBOND: - if (l->select.hbond_list) sfree(lmp, l->select.hbond_list,"list:hbonds"); + if (l->select.hbond_list) sfree(l->error_ptr, l->select.hbond_list,"list:hbonds"); l->select.hbond_list = (hbond_data*) - smalloc(lmp, l->num_intrs * sizeof(hbond_data), "list:hbonds", comm ); + smalloc(l->error_ptr, l->num_intrs * sizeof(hbond_data), "list:hbonds", comm ); break; default: char errmsg[128]; snprintf(errmsg, 128, "No %d list type defined", l->type); - lmp->error->all(FLERR,errmsg); + l->error_ptr->all(FLERR,errmsg); } return SUCCESS; } -void Delete_List( LAMMPS_NS::LAMMPS *lmp, reax_list *l, MPI_Comm comm ) +void Delete_List( reax_list *l, MPI_Comm comm ) { if (l->allocated == 0) return; l->allocated = 0; - sfree(lmp, l->index, "list:index" ); - sfree(lmp, l->end_index, "list:end_index" ); + sfree(l->error_ptr, l->index, "list:index" ); + sfree(l->error_ptr, l->end_index, "list:end_index" ); l->index = NULL; l->end_index = NULL; switch(l->type) { case TYP_VOID: - sfree(lmp, l->select.v, "list:v" ); + sfree(l->error_ptr, l->select.v, "list:v" ); l->select.v = NULL; break; case TYP_HBOND: - sfree(lmp, l->select.hbond_list, "list:hbonds" ); + sfree(l->error_ptr, l->select.hbond_list, "list:hbonds" ); l->select.hbond_list = NULL; break; case TYP_FAR_NEIGHBOR: - sfree(lmp, l->select.far_nbr_list, "list:far_nbrs" ); + sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs" ); l->select.far_nbr_list = NULL; break; case TYP_BOND: - sfree(lmp, l->select.bond_list, "list:bonds" ); + sfree(l->error_ptr, l->select.bond_list, "list:bonds" ); l->select.bond_list = NULL; break; case TYP_DBO: - sfree(lmp, l->select.dbo_list, "list:dbos" ); + sfree(l->error_ptr, l->select.dbo_list, "list:dbos" ); l->select.dbo_list = NULL; break; case TYP_DDELTA: - sfree(lmp, l->select.dDelta_list, "list:dDeltas" ); + sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas" ); l->select.dDelta_list = NULL; break; case TYP_THREE_BODY: - sfree(lmp, l->select.three_body_list, "list:three_bodies" ); + sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies" ); l->select.three_body_list = NULL; break; default: char errmsg[128]; snprintf(errmsg, 128, "No %d list type defined", l->type); - lmp->error->all(FLERR,errmsg); + l->error_ptr->all(FLERR,errmsg); } } diff --git a/src/USER-REAXC/reaxc_list.h b/src/USER-REAXC/reaxc_list.h index 1df2338b0f..ab7fbce19c 100644 --- a/src/USER-REAXC/reaxc_list.h +++ b/src/USER-REAXC/reaxc_list.h @@ -29,8 +29,8 @@ #include "reaxc_types.h" -int Make_List( LAMMPS_NS::LAMMPS*, int, int, int, reax_list*, MPI_Comm ); -void Delete_List( LAMMPS_NS::LAMMPS*, reax_list*, MPI_Comm ); +int Make_List( int, int, int, reax_list*, MPI_Comm ); +void Delete_List( reax_list*, MPI_Comm ); inline int Num_Entries(int,reax_list*); inline int Start_Index( int, reax_list* ); diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index 41ad5e99d4..c16ca9af52 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -58,11 +58,11 @@ void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = a[1] = a[n-1] = 0; @@ -92,11 +92,11 @@ void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double coef[i-1].a = f[i]; } - sfree(lmp, a, "cubic_spline:a" ); - sfree(lmp, b, "cubic_spline:b" ); - sfree(lmp, c, "cubic_spline:c" ); - sfree(lmp, d, "cubic_spline:d" ); - sfree(lmp, v, "cubic_spline:v" ); + sfree(lmp->error, a, "cubic_spline:a" ); + sfree(lmp->error, b, "cubic_spline:b" ); + sfree(lmp->error, c, "cubic_spline:c" ); + sfree(lmp->error, d, "cubic_spline:d" ); + sfree(lmp->error, v, "cubic_spline:v" ); } @@ -109,11 +109,11 @@ void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const doubl double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(lmp, n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = 0; @@ -142,11 +142,11 @@ void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const doubl coef[i-1].a = f[i]; } - sfree(lmp, a, "cubic_spline:a" ); - sfree(lmp, b, "cubic_spline:b" ); - sfree(lmp, c, "cubic_spline:c" ); - sfree(lmp, d, "cubic_spline:d" ); - sfree(lmp, v, "cubic_spline:v" ); + sfree(lmp->error, a, "cubic_spline:a" ); + sfree(lmp->error, b, "cubic_spline:b" ); + sfree(lmp->error, c, "cubic_spline:c" ); + sfree(lmp->error, d, "cubic_spline:d" ); + sfree(lmp->error, v, "cubic_spline:v" ); } @@ -171,23 +171,23 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par num_atom_types = system->reax_param.num_atom_types; dr = control->nonb_cut / control->tabulate; h = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:h", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:h", comm ); fh = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); fvdw = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); fCEvd = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); fele = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); fCEclmb = (double*) - smalloc(lmp, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); + smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); LR = (LR_lookup_table**) - scalloc(lmp, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); + scalloc(lmp->error, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); for( i = 0; i < num_atom_types; ++i ) LR[i] = (LR_lookup_table*) - scalloc(lmp, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); + scalloc(lmp->error, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); for( i = 0; i < MAX_ATOM_TYPES; ++i ) existing_types[i] = 0; @@ -207,21 +207,21 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par LR[i][j].dx = dr; LR[i][j].inv_dx = control->tabulate / control->nonb_cut; LR[i][j].y = (LR_data*) - smalloc(lmp, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); + smalloc(lmp->error, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); LR[i][j].H = (cubic_spline_coef*) - smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , + smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , comm ); LR[i][j].vdW = (cubic_spline_coef*) - smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", + smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", comm); LR[i][j].CEvd = (cubic_spline_coef*) - smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", + smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", comm); LR[i][j].ele = (cubic_spline_coef*) - smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", + smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", comm ); LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc(lmp, LR[i][j].n*sizeof(cubic_spline_coef), + smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb", comm ); for( r = 1; r <= control->tabulate; ++r ) { @@ -291,14 +291,14 @@ void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system ) for( i = 0; i < ntypes; ++i ) { for( j = i; j < ntypes; ++j ) if (LR[i][j].n) { - sfree(lmp, LR[i][j].y, "LR[i,j].y" ); - sfree(lmp, LR[i][j].H, "LR[i,j].H" ); - sfree(lmp, LR[i][j].vdW, "LR[i,j].vdW" ); - sfree(lmp, LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree(lmp, LR[i][j].ele, "LR[i,j].ele" ); - sfree(lmp, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); + sfree(lmp->error, LR[i][j].y, "LR[i,j].y" ); + sfree(lmp->error, LR[i][j].H, "LR[i,j].H" ); + sfree(lmp->error, LR[i][j].vdW, "LR[i,j].vdW" ); + sfree(lmp->error, LR[i][j].CEvd, "LR[i,j].CEvd" ); + sfree(lmp->error, LR[i][j].ele, "LR[i,j].ele" ); + sfree(lmp->error, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); } - sfree(lmp, LR[i], "LR[i]" ); + sfree(lmp->error, LR[i], "LR[i]" ); } - sfree(lmp, LR, "LR" ); + sfree(lmp->error, LR, "LR" ); } diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index eaa6765f36..cd339af556 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -56,7 +56,7 @@ int Tokenize( char* s, char*** tok ) /* safe malloc */ -void *smalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, const char *name, MPI_Comm comm ) +void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name, MPI_Comm comm ) { void *ptr; char errmsg[256]; @@ -64,14 +64,14 @@ void *smalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, const char *name, MPI_Comm c if (n <= 0) { snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. " "returning NULL.", n, name); - lmp->error->warning(FLERR,errmsg); + error_ptr->warning(FLERR,errmsg); return NULL; } ptr = malloc( n ); if (ptr == NULL) { snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); - lmp->error->one(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); } return ptr; @@ -79,7 +79,7 @@ void *smalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, const char *name, MPI_Comm c /* safe calloc */ -void *scalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) +void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) { void *ptr; char errmsg[256]; @@ -87,14 +87,14 @@ void *scalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, rc_bigint size, const char * if (n <= 0) { snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. " "returning NULL.\n", n, name ); - lmp->error->warning(FLERR,errmsg); + error_ptr->warning(FLERR,errmsg); return NULL; } if (size <= 0) { snprintf(errmsg, 256, "Elements size for array %s is %ld. " "returning NULL", name, size ); - lmp->error->warning(FLERR,errmsg); + error_ptr->warning(FLERR,errmsg); return NULL; } @@ -102,7 +102,7 @@ void *scalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, rc_bigint size, const char * if (ptr == NULL) { char errmsg[256]; snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); - lmp->error->one(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); } return ptr; @@ -110,12 +110,12 @@ void *scalloc( LAMMPS_NS::LAMMPS *lmp, rc_bigint n, rc_bigint size, const char * /* safe free */ -void sfree( LAMMPS_NS::LAMMPS* lmp, void *ptr, const char *name ) +void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) { if (ptr == NULL) { char errmsg[256]; snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); - lmp->error->one(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); return; } diff --git a/src/USER-REAXC/reaxc_tool_box.h b/src/USER-REAXC/reaxc_tool_box.h index 7c5ab12587..257ff1813f 100644 --- a/src/USER-REAXC/reaxc_tool_box.h +++ b/src/USER-REAXC/reaxc_tool_box.h @@ -37,7 +37,7 @@ double Get_Time( ); int Tokenize( char*, char*** ); /* from lammps */ -void *smalloc( LAMMPS_NS::LAMMPS*, rc_bigint, const char*, MPI_Comm ); -void *scalloc( LAMMPS_NS::LAMMPS*, rc_bigint, rc_bigint, const char*, MPI_Comm ); -void sfree( LAMMPS_NS::LAMMPS*, void*, const char* ); +void *smalloc( LAMMPS_NS::Error*, rc_bigint, const char*, MPI_Comm ); +void *scalloc( LAMMPS_NS::Error*, rc_bigint, rc_bigint, const char*, MPI_Comm ); +void sfree( LAMMPS_NS::Error*, void*, const char* ); #endif diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index cf6d5dcddc..b7845a0510 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -41,6 +41,7 @@ #include "lammps.h" #include "error.h" +using LAMMPS_NS::Error; #if defined LMP_USER_OMP #define OMP_TIMING 0 @@ -414,6 +415,7 @@ struct _reax_system boundary_cutoff bndry_cuts; reax_atom *my_atoms; + class Error *error_ptr; class Pair *pair_ptr; int my_bonds; int mincap; @@ -491,6 +493,7 @@ typedef struct int lgflag; int enobondsflag; + class Error *error_ptr; } control_params; @@ -777,6 +780,7 @@ struct _reax_list int type; list_type select; + class Error *error_ptr; }; typedef _reax_list reax_list; From 99acb4ac541847c4620208831e2e2d9cfa03297e Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 15:00:52 +0100 Subject: [PATCH 04/68] Cleaning changes 1 --- src/USER-REAXC/pair_reaxc.cpp | 10 +-- src/USER-REAXC/reaxc_control.cpp | 7 +- src/USER-REAXC/reaxc_control.h | 2 +- src/USER-REAXC/reaxc_ffield.cpp | 60 +++++++++--------- src/USER-REAXC/reaxc_ffield.h | 2 +- src/USER-REAXC/reaxc_init_md.cpp | 45 +++++++------ src/USER-REAXC/reaxc_init_md.h | 2 +- src/USER-REAXC/reaxc_io_tools.cpp | 8 +-- src/USER-REAXC/reaxc_io_tools.h | 4 +- src/USER-REAXC/reaxc_lookup.cpp | 102 +++++++++++++++--------------- src/USER-REAXC/reaxc_lookup.h | 4 +- src/USER-REAXC/reaxc_traj.cpp | 48 +++++++------- src/USER-REAXC/reaxc_traj.h | 4 +- 13 files changed, 148 insertions(+), 150 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 58142b122a..b1f7799cb2 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -139,7 +139,7 @@ PairReaxC::~PairReaxC() // deallocate reax data-structures - if (control->tabulate ) Deallocate_Lookup_Tables( lmp, system); + if (control->tabulate ) Deallocate_Lookup_Tables( system); if (control->hbond_cut > 0 ) Delete_List( lists+HBONDS, world); Delete_List( lists+BONDS, world ); @@ -225,7 +225,7 @@ void PairReaxC::settings(int narg, char **arg) out_control->atom_info = 0; out_control->bond_info = 0; out_control->angle_info = 0; - } else Read_Control_File(lmp, arg[0], control, out_control); + } else Read_Control_File(arg[0], control, out_control); // default values @@ -300,7 +300,7 @@ void PairReaxC::coeff( int nargs, char **args ) FILE *fp; fp = force->open_potential(file); if (fp != NULL) - Read_Force_Field(lmp, fp, &(system->reax_param), control); + Read_Force_Field(fp, &(system->reax_param), control); else { char str[128]; snprintf(str,128,"Cannot open ReaxFF potential file %s",file); @@ -449,7 +449,7 @@ void PairReaxC::setup( ) (lists+FAR_NBRS)->error_ptr=lmp->error; write_reax_lists(); - Initialize( lmp, system, control, data, workspace, &lists, out_control, + Initialize( system, control, data, workspace, &lists, out_control, mpi_data, world ); for( int k = 0; k < system->N; ++k ) { num_bonds[k] = system->my_atoms[k].num_bonds; @@ -585,7 +585,7 @@ void PairReaxC::compute(int eflag, int vflag) data->step = update->ntimestep; - Output_Results( lmp, system, control, data, &lists, out_control, mpi_data ); + Output_Results( system, control, data, &lists, out_control, mpi_data ); // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index bf221a6266..14b28615fb 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -28,9 +28,8 @@ #include "reaxc_control.h" #include "reaxc_tool_box.h" -using namespace LAMMPS_NS; -char Read_Control_File( LAMMPS *lmp, char *control_file, control_params* control, +char Read_Control_File( char *control_file, control_params* control, output_controls *out_control ) { FILE *fp; @@ -40,7 +39,7 @@ char Read_Control_File( LAMMPS *lmp, char *control_file, control_params* control /* open control file */ if ( (fp = fopen( control_file, "r" ) ) == NULL ) { - lmp->error->all(FLERR, "The control file cannot be opened"); + control->error_ptr->all(FLERR, "The control file cannot be opened"); } /* assign default values */ @@ -367,7 +366,7 @@ char Read_Control_File( LAMMPS *lmp, char *control_file, control_params* control else { char errmsg[128]; snprintf(errmsg,128,"Unknown parameter %s in the control file", tmp[0]); - lmp->error->all(FLERR, errmsg); + control->error_ptr->all(FLERR, errmsg); } } diff --git a/src/USER-REAXC/reaxc_control.h b/src/USER-REAXC/reaxc_control.h index 4546a894f6..47627aed61 100644 --- a/src/USER-REAXC/reaxc_control.h +++ b/src/USER-REAXC/reaxc_control.h @@ -32,6 +32,6 @@ #include "lammps.h" #include "error.h" -char Read_Control_File( LAMMPS_NS::LAMMPS *lmp, char*, control_params*, output_controls* ); +char Read_Control_File( char*, control_params*, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 8316c188b3..987a11d252 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -32,7 +32,7 @@ #include "lammps.h" #include "error.h" -char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, +char Read_Force_Field( FILE *fp, reax_interaction *reax, control_params *control ) { char *s; @@ -64,7 +64,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, n = atoi(tmp[0]); if (n < 1) { if (me == 0) - lmp->error->warning( FLERR, "Number of globals in ffield file is 0" ); + control->error_ptr->warning( FLERR, "Number of globals in ffield file is 0" ); fclose(fp); free(s); free(tmp); @@ -99,54 +99,54 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Allocating structures in reax_interaction */ reax->sbp = (single_body_parameters*) - scalloc(lmp->error, reax->num_atom_types, sizeof(single_body_parameters), "sbp", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(single_body_parameters), "sbp", comm ); reax->tbp = (two_body_parameters**) - scalloc(lmp->error, reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm ); reax->thbp= (three_body_header***) - scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header**), "thbp", comm ); reax->hbp = (hbond_parameters***) - scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm ); reax->fbp = (four_body_header****) - scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header***), "fbp", comm ); tor_flag = (char****) - scalloc(lmp->error, reax->num_atom_types, sizeof(char***), "tor_flag", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char***), "tor_flag", comm ); for( i = 0; i < reax->num_atom_types; i++ ) { reax->tbp[i] = (two_body_parameters*) - scalloc(lmp->error, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]", comm ); reax->thbp[i]= (three_body_header**) - scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header*), "thbp[i]", comm ); reax->hbp[i] = (hbond_parameters**) - scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]", comm ); reax->fbp[i] = (four_body_header***) - scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header**), "fbp[i]", comm ); tor_flag[i] = (char***) - scalloc(lmp->error, reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm ); for( j = 0; j < reax->num_atom_types; j++ ) { reax->thbp[i][j]= (three_body_header*) - scalloc(lmp->error, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]", comm ); reax->hbp[i][j] = (hbond_parameters*) - scalloc(lmp->error, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]", comm ); reax->fbp[i][j] = (four_body_header**) - scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]", comm ); tor_flag[i][j] = (char**) - scalloc(lmp->error, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm ); for (k=0; k < reax->num_atom_types; k++) { reax->fbp[i][j][k] = (four_body_header*) - scalloc(lmp->error, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]", comm ); tor_flag[i][j][k] = (char*) - scalloc(lmp->error, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]", comm ); } } @@ -163,7 +163,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Sanity checks */ if (c < 9) { - lmp->error->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->one(FLERR,"Inconsistent ffield file"); } for( j = 0; j < (int)(strlen(tmp[0])); ++j ) @@ -185,7 +185,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - lmp->error->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].alpha = val; @@ -203,7 +203,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - lmp->error->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; @@ -221,7 +221,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - lmp->error->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->one(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; @@ -240,7 +240,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, /* Sanity check */ if (c > 2) { - lmp->error->one(FLERR,"Force field file incompatible with 'lgvdw yes'"); + control->error_ptr->one(FLERR,"Force field file incompatible with 'lgvdw yes'"); } val = atof(tmp[0]); reax->sbp[i].lgcij = val; @@ -258,7 +258,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, "This may cause division-by-zero errors. " "Keeping vdWaals-setting for earlier atoms.", reax->sbp[i].name); - lmp->error->warning(FLERR,errmsg); + control->error_ptr->warning(FLERR,errmsg); } errorflag = 0; } else { @@ -274,7 +274,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, "This may cause division-by-zero errors. " "Keeping vdWaals-setting for earlier atoms.", reax->sbp[i].name); - lmp->error->warning(FLERR,errmsg); + control->error_ptr->warning(FLERR,errmsg); } } else { reax->gp.vdw_type = 2; @@ -291,7 +291,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, "This may cause division-by-zero errors. " "Keeping vdWaals-setting for earlier atoms.", reax->sbp[i].name); - lmp->error->warning(FLERR,errmsg); + control->error_ptr->warning(FLERR,errmsg); } } else { reax->gp.vdw_type = 1; @@ -301,7 +301,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, snprintf(errmsg, 256, "Inconsistent vdWaals-parameters " "No shielding or inner-wall set for element %s", reax->sbp[i].name); - lmp->error->all(FLERR, errmsg); + control->error_ptr->all(FLERR, errmsg); } } } @@ -314,7 +314,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, char errmsg[256]; snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", reax->sbp[i].name); - lmp->error->warning(FLERR,errmsg); + control->error_ptr->warning(FLERR,errmsg); } reax->sbp[i].valency_val = reax->sbp[i].valency_boc; } @@ -324,7 +324,7 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax, c=Tokenize(s,&tmp); if (c == 2 && !lgflag) { - lmp->error->all(FLERR, "Force field file requires using 'lgvdw yes'"); + control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); } l = atoi(tmp[0]); diff --git a/src/USER-REAXC/reaxc_ffield.h b/src/USER-REAXC/reaxc_ffield.h index 225f207de9..7cef730f91 100644 --- a/src/USER-REAXC/reaxc_ffield.h +++ b/src/USER-REAXC/reaxc_ffield.h @@ -29,6 +29,6 @@ #include "reaxc_types.h" -char Read_Force_Field( LAMMPS_NS::LAMMPS*, FILE*, reax_interaction*, control_params* ); +char Read_Force_Field( FILE*, reax_interaction*, control_params* ); #endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 8c60db0846..27e60c580c 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -36,7 +36,6 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" -using namespace LAMMPS_NS; int Init_System( reax_system *system, control_params *control, char * /*msg*/ ) { @@ -82,7 +81,7 @@ int Init_Simulation_Data( reax_system *system, control_params *control, return SUCCESS; } -void Init_Taper( LAMMPS_NS::LAMMPS* lmp, control_params *control, storage *workspace, MPI_Comm comm ) +void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) { double d1, d7; double swa, swa2, swa3; @@ -92,15 +91,15 @@ void Init_Taper( LAMMPS_NS::LAMMPS* lmp, control_params *control, storage *work swb = control->nonb_cut; if (fabs( swa ) > 0.01) - lmp->error->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); + control->error_ptr->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); if (swb < 0) { - lmp->error->all(FLERR,"Negative upper Taper-radius cutoff"); + control->error_ptr->all(FLERR,"Negative upper Taper-radius cutoff"); } else if( swb < 5 ) { char errmsg[256]; snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb ); - lmp->error->warning( FLERR, errmsg ); + control->error_ptr->warning( FLERR, errmsg ); } d1 = swb - swa; @@ -122,7 +121,7 @@ void Init_Taper( LAMMPS_NS::LAMMPS* lmp, control_params *control, storage *work } -int Init_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, +int Init_Workspace( reax_system *system, control_params *control, storage *workspace, MPI_Comm comm, char *msg ) { int ret; @@ -136,7 +135,7 @@ int Init_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params Reset_Workspace( system, workspace ); /* Initialize the Taper function */ - Init_Taper( lmp, control, workspace, comm ); + Init_Taper( control, workspace, comm ); return SUCCESS; } @@ -154,7 +153,7 @@ int Init_MPI_Datatypes( reax_system *system, storage * /*workspace*/, return SUCCESS; } -int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, +int Init_Lists( reax_system *system, control_params *control, simulation_data * /*data*/, storage * /*workspace*/, reax_list **lists, mpi_datatypes *mpi_data, char * /*msg*/ ) { @@ -183,7 +182,7 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS, comm ) ) { - lmp->error->one(FLERR, "Not enough space for hbonds list."); + control->error_ptr->one(FLERR, "Not enough space for hbonds list."); } (*lists+HBONDS)->error_ptr = system->error_ptr; } @@ -197,7 +196,7 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, if( !Make_List( system->total_cap, bond_cap, TYP_BOND, *lists+BONDS, comm ) ) { - lmp->error->one(FLERR, "Not enough space for bonds list."); + control->error_ptr->one(FLERR, "Not enough space for bonds list."); } (*lists+BONDS)->error_ptr = system->error_ptr; @@ -205,7 +204,7 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, cap_3body = (int)(MAX( num_3body*safezone, MIN_3BODIES )); if( !Make_List( bond_cap, cap_3body, TYP_THREE_BODY, *lists+THREE_BODIES, comm ) ){ - lmp->error->one(FLERR,"Problem in initializing angles list."); + control->error_ptr->one(FLERR,"Problem in initializing angles list."); } (*lists+THREE_BODIES)->error_ptr = system->error_ptr; @@ -215,7 +214,7 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control, return SUCCESS; } -void Initialize( LAMMPS *lmp, 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 ) @@ -228,46 +227,46 @@ void Initialize( LAMMPS *lmp, reax_system *system, control_params *control, snprintf(errmsg, 128, "Could not create datatypes on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } if (Init_System(system, control, msg) == FAILURE) { snprintf(errmsg, 128, "System could not be initialized on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) { snprintf(errmsg, 128, "Sim_data could not be initialized on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } - if (Init_Workspace( lmp, system, control, workspace, mpi_data->world, msg ) == + if (Init_Workspace( system, control, workspace, mpi_data->world, msg ) == FAILURE) { snprintf(errmsg, 128, "Workspace could not be initialized on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } - if (Init_Lists( lmp, system, control, data, workspace, lists, mpi_data, msg ) == + if (Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { snprintf(errmsg, 128, "System could not be initialized on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } - if (Init_Output_Files(lmp, system,control,out_control,mpi_data,msg)== FAILURE) { + if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) { snprintf(errmsg, 128, "Could not open output files on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } if (control->tabulate) { - if (Init_Lookup_Tables( lmp, system, control, workspace, mpi_data, msg ) == FAILURE) { + if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) { snprintf(errmsg, 128, "Lookup table could not be created on thread %d", system->my_rank); - lmp->error->one(FLERR,errmsg); + control->error_ptr->one(FLERR,errmsg); } } diff --git a/src/USER-REAXC/reaxc_init_md.h b/src/USER-REAXC/reaxc_init_md.h index 2baa70245b..546a9e33c9 100644 --- a/src/USER-REAXC/reaxc_init_md.h +++ b/src/USER-REAXC/reaxc_init_md.h @@ -32,6 +32,6 @@ #include "lammps.h" #include "error.h" -void Initialize( LAMMPS_NS::LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, +void Initialize( reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); #endif diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index aa7e7fcea7..f71fcbec8e 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -34,7 +34,7 @@ #include "reaxc_traj.h" #include "reaxc_vector.h" -int Init_Output_Files( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, +int Init_Output_Files( reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data, char *msg ) { @@ -42,7 +42,7 @@ int Init_Output_Files( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_para int ret; if (out_control->write_steps > 0) { - ret = Init_Traj( lmp, system, control, out_control, mpi_data, msg ); + ret = Init_Traj( system, control, out_control, mpi_data, msg ); if (ret == FAILURE) return ret; } @@ -107,7 +107,7 @@ int Close_Output_Files( reax_system *system, control_params *control, } -void Output_Results( LAMMPS_NS::LAMMPS* lmp, 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 ) { @@ -146,7 +146,7 @@ void Output_Results( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params /* write current frame */ if( out_control->write_steps > 0 && (data->step-data->prev_steps) % out_control->write_steps == 0 ) { - Append_Frame( lmp, system, control, data, lists, out_control, mpi_data ); + Append_Frame( system, control, data, lists, out_control, mpi_data ); } } diff --git a/src/USER-REAXC/reaxc_io_tools.h b/src/USER-REAXC/reaxc_io_tools.h index 80202d5c83..a3f22fccc2 100644 --- a/src/USER-REAXC/reaxc_io_tools.h +++ b/src/USER-REAXC/reaxc_io_tools.h @@ -29,10 +29,10 @@ #include "reaxc_types.h" -int Init_Output_Files( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, +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( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, simulation_data*, +void Output_Results( reax_system*, control_params*, simulation_data*, reax_list**, output_controls*, mpi_datatypes* ); #endif diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index c16ca9af52..b140b0cadf 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -50,7 +50,7 @@ void Tridiagonal_Solve( const double *a, const double *b, } -void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double *f, +void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const double *f, cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ) { @@ -58,11 +58,11 @@ void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = a[1] = a[n-1] = 0; @@ -92,16 +92,16 @@ void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const double coef[i-1].a = f[i]; } - sfree(lmp->error, a, "cubic_spline:a" ); - sfree(lmp->error, b, "cubic_spline:b" ); - sfree(lmp->error, c, "cubic_spline:c" ); - sfree(lmp->error, d, "cubic_spline:d" ); - sfree(lmp->error, 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::LAMMPS* lmp, const double *h, const double *f, double v0, double vlast, +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, MPI_Comm comm ) { @@ -109,11 +109,11 @@ void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const doubl double *a, *b, *c, *d, *v; /* allocate space for the linear system */ - a = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - b = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(lmp->error, n * sizeof(double), "cubic_spline:a", comm ); + a = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); /* build the linear system */ a[0] = 0; @@ -142,15 +142,15 @@ void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS* lmp, const double *h, const doubl coef[i-1].a = f[i]; } - sfree(lmp->error, a, "cubic_spline:a" ); - sfree(lmp->error, b, "cubic_spline:b" ); - sfree(lmp->error, c, "cubic_spline:c" ); - sfree(lmp->error, d, "cubic_spline:d" ); - sfree(lmp->error, 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" ); } -int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, +int Init_Lookup_Tables( reax_system *system, control_params *control, storage *workspace, mpi_datatypes *mpi_data, char * /*msg*/ ) { int i, j, r; @@ -171,23 +171,23 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par num_atom_types = system->reax_param.num_atom_types; dr = control->nonb_cut / control->tabulate; h = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:h", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h", comm ); fh = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); fvdw = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); fCEvd = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); fele = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); fCEclmb = (double*) - smalloc(lmp->error, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); LR = (LR_lookup_table**) - scalloc(lmp->error, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); + scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); for( i = 0; i < num_atom_types; ++i ) LR[i] = (LR_lookup_table*) - scalloc(lmp->error, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); + scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]", comm ); for( i = 0; i < MAX_ATOM_TYPES; ++i ) existing_types[i] = 0; @@ -207,21 +207,21 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par LR[i][j].dx = dr; LR[i][j].inv_dx = control->tabulate / control->nonb_cut; LR[i][j].y = (LR_data*) - smalloc(lmp->error, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); + smalloc(system->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", comm ); LR[i][j].H = (cubic_spline_coef*) - smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , comm ); LR[i][j].vdW = (cubic_spline_coef*) - smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", comm); LR[i][j].CEvd = (cubic_spline_coef*) - smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", comm); LR[i][j].ele = (cubic_spline_coef*) - smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", comm ); LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc(lmp->error, LR[i][j].n*sizeof(cubic_spline_coef), + smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb", comm ); for( r = 1; r <= control->tabulate; ++r ) { @@ -246,22 +246,22 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par vlast_vdw = fCEvd[r-1]; vlast_ele = fele[r-1]; - Natural_Cubic_Spline( lmp, &h[1], &fh[1], + Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1], &(LR[i][j].H[1]), control->tabulate+1, comm ); - Complete_Cubic_Spline( lmp, &h[1], &fvdw[1], v0_vdw, vlast_vdw, + Complete_Cubic_Spline( control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw, &(LR[i][j].vdW[1]), control->tabulate+1, comm ); - Natural_Cubic_Spline( lmp, &h[1], &fCEvd[1], + Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEvd[1], &(LR[i][j].CEvd[1]), control->tabulate+1, comm ); - Complete_Cubic_Spline( lmp, &h[1], &fele[1], v0_ele, vlast_ele, + Complete_Cubic_Spline( control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele, &(LR[i][j].ele[1]), control->tabulate+1, comm ); - Natural_Cubic_Spline( lmp, &h[1], &fCEclmb[1], + Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEclmb[1], &(LR[i][j].CEclmb[1]), control->tabulate+1, comm ); } else { @@ -281,7 +281,7 @@ int Init_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_par } -void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system ) +void Deallocate_Lookup_Tables( reax_system *system ) { int i, j; int ntypes; @@ -291,14 +291,14 @@ void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS* lmp, reax_system *system ) for( i = 0; i < ntypes; ++i ) { for( j = i; j < ntypes; ++j ) if (LR[i][j].n) { - sfree(lmp->error, LR[i][j].y, "LR[i,j].y" ); - sfree(lmp->error, LR[i][j].H, "LR[i,j].H" ); - sfree(lmp->error, LR[i][j].vdW, "LR[i,j].vdW" ); - sfree(lmp->error, LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree(lmp->error, LR[i][j].ele, "LR[i,j].ele" ); - sfree(lmp->error, LR[i][j].CEclmb, "LR[i,j].CEclmb" ); + 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(lmp->error, LR[i], "LR[i]" ); + sfree(system->error_ptr, LR[i], "LR[i]" ); } - sfree(lmp->error, LR, "LR" ); + sfree(system->error_ptr, LR, "LR" ); } diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h index 2d33ad82de..9b1b14a34d 100644 --- a/src/USER-REAXC/reaxc_lookup.h +++ b/src/USER-REAXC/reaxc_lookup.h @@ -40,9 +40,9 @@ void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f cubic_spline_coef *coef, unsigned int n, MPI_Comm comm ); -int Init_Lookup_Tables( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, +int Init_Lookup_Tables( reax_system*, control_params*, storage*, mpi_datatypes*, char* ); -void Deallocate_Lookup_Tables( LAMMPS_NS::LAMMPS*, reax_system* ); +void Deallocate_Lookup_Tables( reax_system* ); #endif diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index ee2939d662..d3b9e799d2 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -29,7 +29,7 @@ #include "reaxc_list.h" #include "reaxc_tool_box.h" -int Reallocate_Output_Buffer( LAMMPS_NS::LAMMPS *lmp, output_controls *out_control, int req_space, +int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space, MPI_Comm comm ) { if (out_control->buffer_len > 0) @@ -40,7 +40,7 @@ int Reallocate_Output_Buffer( LAMMPS_NS::LAMMPS *lmp, output_controls *out_contr if (out_control->buffer == NULL) { char errmsg[256]; snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*SAFE_ZONE)); - lmp->error->one(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); } return SUCCESS; @@ -56,7 +56,7 @@ void Write_Skip_Line( output_controls *out_control, mpi_datatypes * /*mpi_data*/ } -int Write_Header( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, +int Write_Header( reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data ) { int num_hdr_lines, my_hdr_lines, buffer_req; @@ -82,7 +82,7 @@ int Write_Header( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *c 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( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req, mpi_data->world ); /* only the master node writes into trajectory header */ if (system->my_rank == MASTER_NODE) { @@ -258,7 +258,7 @@ int Write_Header( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *c } -int Write_Init_Desc( LAMMPS_NS::LAMMPS *lmp, 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 i, me, np, cnt, buffer_len, buffer_req; @@ -277,7 +277,7 @@ int Write_Init_Desc( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params else buffer_req = system->n * INIT_DESC_LEN + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req, mpi_data->world ); out_control->line[0] = 0; out_control->buffer[0] = 0; @@ -310,7 +310,7 @@ int Write_Init_Desc( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params } -int Init_Traj( LAMMPS_NS::LAMMPS* lmp, 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 ) { @@ -347,14 +347,14 @@ int Init_Traj( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *cont strcpy( msg, "init_traj: unknown trajectory option" ); return FAILURE; } - Write_Header( lmp, system, control, out_control, mpi_data ); - Write_Init_Desc( lmp, system, control, out_control, mpi_data ); + Write_Header( system, control, out_control, mpi_data ); + Write_Init_Desc( system, control, out_control, mpi_data ); return SUCCESS; } -int Write_Frame_Header( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params *control, +int Write_Frame_Header( reax_system *system, control_params *control, simulation_data *data, output_controls *out_control, mpi_datatypes *mpi_data ) { @@ -366,7 +366,7 @@ int Write_Frame_Header( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_par 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( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req, mpi_data->world ); /* only the master node writes into trajectory header */ if (me == MASTER_NODE) { @@ -480,7 +480,7 @@ int Write_Frame_Header( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_par -int Write_Atoms( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * /*control*/, +int Write_Atoms( reax_system *system, control_params * /*control*/, output_controls *out_control, mpi_datatypes *mpi_data ) { int i, me, np, line_len, buffer_len, buffer_req, cnt; @@ -499,7 +499,7 @@ int Write_Atoms( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * / else buffer_req = system->n * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req, mpi_data->world ); /* fill in buffer */ out_control->line[0] = 0; @@ -530,7 +530,7 @@ int Write_Atoms( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * / p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q ); break; default: - lmp->error->all(FLERR,"Write_traj_atoms: unknown atom trajectory format"); + system->error_ptr->all(FLERR,"Write_traj_atoms: unknown atom trajectory format"); } strncpy( out_control->buffer + i*line_len, out_control->line, line_len+1 ); @@ -556,7 +556,7 @@ int Write_Atoms( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params * / } -int Write_Bonds( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, reax_list *bonds, +int Write_Bonds( reax_system *system, control_params *control, reax_list *bonds, output_controls *out_control, mpi_datatypes *mpi_data) { int i, j, pj, me, np; @@ -589,7 +589,7 @@ int Write_Bonds( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *co else buffer_req = my_bonds * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req, mpi_data->world ); /* fill in the buffer */ out_control->line[0] = 0; @@ -616,7 +616,7 @@ int Write_Bonds( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *co bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2 ); break; default: - lmp->error->all(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); + system->error_ptr->all(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); } strncpy( out_control->buffer + my_bonds*line_len, out_control->line, line_len+1 ); @@ -645,7 +645,7 @@ int Write_Bonds( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *co } -int Write_Angles( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *control, +int Write_Angles( reax_system *system, control_params *control, reax_list *bonds, reax_list *thb_intrs, output_controls *out_control, mpi_datatypes *mpi_data ) { @@ -689,7 +689,7 @@ int Write_Angles( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *c else buffer_req = my_angles * line_len + 1; if (buffer_req > out_control->buffer_len * DANGER_ZONE) - Reallocate_Output_Buffer( lmp, out_control, buffer_req, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req, mpi_data->world ); /* fill in the buffer */ my_angles = 0; @@ -740,20 +740,20 @@ int Write_Angles( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params *c } -int Append_Frame( LAMMPS_NS::LAMMPS* lmp, 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 ) { - Write_Frame_Header( lmp, system, control, data, out_control, mpi_data ); + Write_Frame_Header( system, control, data, out_control, mpi_data ); if (out_control->write_atoms) - Write_Atoms( lmp, system, control, out_control, mpi_data ); + Write_Atoms( system, control, out_control, mpi_data ); if (out_control->write_bonds) - Write_Bonds( lmp, system, control, (*lists + BONDS), out_control, mpi_data ); + Write_Bonds( system, control, (*lists + BONDS), out_control, mpi_data ); if (out_control->write_angles) - Write_Angles( lmp, system, control, (*lists + BONDS), (*lists + THREE_BODIES), + Write_Angles( system, control, (*lists + BONDS), (*lists + THREE_BODIES), out_control, mpi_data ); return SUCCESS; diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 5508d27cdb..72c56637eb 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -73,11 +73,11 @@ 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( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, output_controls*, +int Init_Traj( reax_system*, control_params*, output_controls*, mpi_datatypes*, char* ); int End_Traj( int, output_controls* ); -int Append_Frame( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, simulation_data*, +int Append_Frame( reax_system*, control_params*, simulation_data*, reax_list**, output_controls*, mpi_datatypes* ); #endif From 83e458af0bb552c94b0aa1e48132cdcbca23aa8b Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 15:22:20 +0100 Subject: [PATCH 05/68] Cleaning changes 2 --- src/USER-REAXC/pair_reaxc.cpp | 4 ++-- src/USER-REAXC/reaxc_bond_orders.cpp | 3 +-- src/USER-REAXC/reaxc_bond_orders.h | 2 +- src/USER-REAXC/reaxc_bonds.cpp | 2 +- src/USER-REAXC/reaxc_bonds.h | 2 +- src/USER-REAXC/reaxc_forces.cpp | 18 +++++++++--------- src/USER-REAXC/reaxc_forces.h | 2 +- src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 2 +- src/USER-REAXC/reaxc_hydrogen_bonds.h | 2 +- src/USER-REAXC/reaxc_multi_body.cpp | 2 +- src/USER-REAXC/reaxc_multi_body.h | 2 +- src/USER-REAXC/reaxc_reset_tools.cpp | 11 +++++------ src/USER-REAXC/reaxc_reset_tools.h | 8 ++------ src/USER-REAXC/reaxc_torsion_angles.cpp | 3 +-- src/USER-REAXC/reaxc_torsion_angles.h | 3 +-- src/USER-REAXC/reaxc_traj.cpp | 2 +- src/USER-REAXC/reaxc_types.h | 4 ++-- src/USER-REAXC/reaxc_valence_angles.cpp | 4 ++-- src/USER-REAXC/reaxc_valence_angles.h | 2 +- 19 files changed, 35 insertions(+), 43 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index b1f7799cb2..a9501dac9d 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -521,7 +521,7 @@ void PairReaxC::compute(int eflag, int vflag) setup(); - Reset( lmp, system, control, data, workspace, &lists, world ); + Reset( system, control, data, workspace, &lists, world ); workspace->realloc.num_far = write_reax_lists(); // timing for filling in the reax lists if (comm->me == 0) { @@ -531,7 +531,7 @@ void PairReaxC::compute(int eflag, int vflag) // forces - Compute_Forces(lmp, system,control,data,workspace,&lists,out_control,mpi_data); + Compute_Forces(system,control,data,workspace,&lists,out_control,mpi_data); read_reax_forces(vflag); for(int k = 0; k < system->N; ++k) { diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index 924be8809d..1ed58a0bfd 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -360,8 +360,7 @@ int BOp( storage *workspace, reax_list *bonds, double bo_cut, void BO( reax_system *system, control_params * /*control*/, simulation_data * /*data*/, - storage *workspace, reax_list **lists, output_controls * /*out_control*/, - LAMMPS_NS::LAMMPS* lmp ) + storage *workspace, reax_list **lists, output_controls * /*out_control*/ ) { int i, j, pj, type_i, type_j; int start_i, end_i, sym_index; diff --git a/src/USER-REAXC/reaxc_bond_orders.h b/src/USER-REAXC/reaxc_bond_orders.h index 8de60ba2f2..3631d90c89 100644 --- a/src/USER-REAXC/reaxc_bond_orders.h +++ b/src/USER-REAXC/reaxc_bond_orders.h @@ -42,5 +42,5 @@ void Add_dBond_to_Forces_NPT( int, int, simulation_data*, 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*, LAMMPS_NS::LAMMPS* = NULL ); + storage*, reax_list**, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index d5ac4f1ed4..48fb872324 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -33,7 +33,7 @@ void Bonds( reax_system *system, control_params * /*control*/, simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) + output_controls * /*out_control*/ ) { int i, j, pj, natoms; int start_i, end_i; diff --git a/src/USER-REAXC/reaxc_bonds.h b/src/USER-REAXC/reaxc_bonds.h index b425598b42..a4a1fb0b44 100644 --- a/src/USER-REAXC/reaxc_bonds.h +++ b/src/USER-REAXC/reaxc_bonds.h @@ -30,5 +30,5 @@ #include "reaxc_types.h" void Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); + storage*, reax_list**, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 4adec04f0c..ff1dd839fb 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -44,7 +44,7 @@ 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*/, LAMMPS_NS::LAMMPS* = NULL ) + reax_list ** /*lists*/, output_controls * /*out_control*/ ) { } @@ -76,7 +76,7 @@ void Compute_Bonded_Forces( reax_system *system, control_params *control, /* Implement all force calls as function pointers */ for( i = 0; i < NUM_INTRS; i++ ) { (Interaction_Functions[i])( system, control, data, workspace, - lists, out_control, NULL ); + lists, out_control ); } } @@ -115,7 +115,7 @@ void Compute_Total_Force( reax_system *system, control_params *control, } -void Validate_Lists( LAMMPS_NS::LAMMPS *lmp, reax_system *system, storage * /*workspace*/, reax_list **lists, +void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **lists, int step, int /*n*/, int N, int numH, MPI_Comm comm ) { int i, comp, Hindex; @@ -138,7 +138,7 @@ void Validate_Lists( LAMMPS_NS::LAMMPS *lmp, reax_system *system, storage * /*wo 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 ); - lmp->error->all(FLERR,errmsg); + system->error_ptr->all(FLERR,errmsg); } } } @@ -166,7 +166,7 @@ void Validate_Lists( LAMMPS_NS::LAMMPS *lmp, reax_system *system, storage * /*wo 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 ); - lmp->error->all(FLERR, errmsg); + system->error_ptr->all(FLERR, errmsg); } } } @@ -174,7 +174,7 @@ void Validate_Lists( LAMMPS_NS::LAMMPS *lmp, reax_system *system, storage * /*wo } -void Init_Forces_noQEq( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_params *control, +void Init_Forces_noQEq( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls * /*out_control*/, MPI_Comm comm ) { @@ -310,7 +310,7 @@ void Init_Forces_noQEq( LAMMPS_NS::LAMMPS *lmp, reax_system *system, control_par workspace->realloc.num_bonds = num_bonds; workspace->realloc.num_hbonds = num_hbonds; - Validate_Lists( lmp, system, workspace, lists, data->step, + Validate_Lists( system, workspace, lists, data->step, system->n, system->N, system->numH, comm ); } @@ -434,14 +434,14 @@ void Estimate_Storages( reax_system *system, control_params *control, } -void Compute_Forces( LAMMPS_NS::LAMMPS *lmp, 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 ) { MPI_Comm comm = mpi_data->world; - Init_Forces_noQEq( lmp, system, control, data, workspace, + Init_Forces_noQEq( system, control, data, workspace, lists, out_control, comm ); /********* bonded interactions ************/ diff --git a/src/USER-REAXC/reaxc_forces.h b/src/USER-REAXC/reaxc_forces.h index 31cfc03a6b..6c839a7023 100644 --- a/src/USER-REAXC/reaxc_forces.h +++ b/src/USER-REAXC/reaxc_forces.h @@ -33,7 +33,7 @@ extern interaction_function Interaction_Functions[NUM_INTRS]; void Init_Force_Functions( control_params* ); -void Compute_Forces( LAMMPS_NS::LAMMPS *lmp, reax_system*, control_params*, simulation_data*, +void Compute_Forces( reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes* ); void Estimate_Storages( reax_system*, control_params*, reax_list**, int*, int*, int*, int*, MPI_Comm ); diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index 489a43cfc1..be34df7571 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -33,7 +33,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) + reax_list **lists, output_controls * /*out_control*/ ) { int i, j, k, pi, pk; int type_i, type_j, type_k; diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.h b/src/USER-REAXC/reaxc_hydrogen_bonds.h index 2a448439ea..04d3d26d5c 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.h +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.h @@ -30,6 +30,6 @@ #include "reaxc_types.h" void Hydrogen_Bonds( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); + storage*, reax_list**, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index a16c4eb42b..f7d72a2678 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -32,7 +32,7 @@ void Atom_Energy( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, - output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp ) + output_controls * /*out_control*/ ) { int i, j, pj, type_i, type_j; double Delta_lpcorr, dfvl; diff --git a/src/USER-REAXC/reaxc_multi_body.h b/src/USER-REAXC/reaxc_multi_body.h index dc2c1040eb..a17c9f484e 100644 --- a/src/USER-REAXC/reaxc_multi_body.h +++ b/src/USER-REAXC/reaxc_multi_body.h @@ -30,6 +30,6 @@ #include "reaxc_types.h" void Atom_Energy( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL ); + storage*, reax_list**, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 49a9f096dd..d273a417f8 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -30,7 +30,6 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" -using namespace LAMMPS_NS; void Reset_Atoms( reax_system* system, control_params *control ) { @@ -121,7 +120,7 @@ void Reset_Workspace( reax_system *system, storage *workspace ) } -void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *control, +void Reset_Neighbor_Lists( reax_system *system, control_params *control, storage *workspace, reax_list **lists, MPI_Comm comm ) { @@ -147,7 +146,7 @@ void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *con char errmsg[256]; snprintf(errmsg, 256, "p%d: not enough space for bonds! total=%d allocated=%d\n", system->my_rank, total_bonds, bonds->num_intrs); - lmp->error->one(FLERR, errmsg); + control->error_ptr->one(FLERR, errmsg); } } } @@ -173,14 +172,14 @@ void Reset_Neighbor_Lists( LAMMPS *lmp, reax_system *system, control_params *con char errmsg[256]; snprintf(errmsg, 256, "p%d: not enough space for hbonds! total=%d allocated=%d\n", system->my_rank, total_hbonds, hbonds->num_intrs); - lmp->error->one(FLERR, errmsg); + control->error_ptr->one(FLERR, errmsg); } } } } -void Reset( LAMMPS *lmp, reax_system *system, control_params *control, simulation_data *data, +void Reset( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, MPI_Comm comm ) { Reset_Atoms( system, control ); @@ -189,6 +188,6 @@ void Reset( LAMMPS *lmp, reax_system *system, control_params *control, simulatio Reset_Workspace( system, workspace ); - Reset_Neighbor_Lists( lmp, system, control, workspace, lists, comm ); + Reset_Neighbor_Lists( system, control, workspace, lists, comm ); } diff --git a/src/USER-REAXC/reaxc_reset_tools.h b/src/USER-REAXC/reaxc_reset_tools.h index 9e2b9de980..c2a90072d5 100644 --- a/src/USER-REAXC/reaxc_reset_tools.h +++ b/src/USER-REAXC/reaxc_reset_tools.h @@ -29,16 +29,12 @@ #include "reaxc_types.h" -#include "lammps.h" -#include "error.h" -using namespace LAMMPS_NS; - 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( LAMMPS *lmp, reax_system*, control_params*, storage*, +void Reset_Neighbor_Lists( reax_system*, control_params*, storage*, reax_list**, MPI_Comm ); -void Reset( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*, +void Reset( reax_system*, control_params*, simulation_data*, storage*, reax_list**, MPI_Comm ); #endif diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index 50c3412928..ed76368d68 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -120,8 +120,7 @@ double Calculate_Omega( rvec dvec_ij, double r_ij, void Torsion_Angles( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls *out_control, - LAMMPS_NS::LAMMPS* lmp ) + 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; diff --git a/src/USER-REAXC/reaxc_torsion_angles.h b/src/USER-REAXC/reaxc_torsion_angles.h index 38236cb7dc..755e8c6532 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.h +++ b/src/USER-REAXC/reaxc_torsion_angles.h @@ -30,7 +30,6 @@ #include "reaxc_types.h" void Torsion_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, - LAMMPS_NS::LAMMPS* = NULL ); + storage*, reax_list**, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index d3b9e799d2..90f3d1e668 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -556,7 +556,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, } -int Write_Bonds( reax_system *system, control_params *control, reax_list *bonds, +int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, output_controls *out_control, mpi_datatypes *mpi_data) { int i, j, pj, me, np; diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index b7845a0510..310ef42bdf 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -906,9 +906,9 @@ 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*, +typedef void (*interaction_function) (reax_system*, control_params*, simulation_data*, storage*, - reax_list**, output_controls*, LAMMPS_NS::LAMMPS*); + reax_list**, output_controls*); typedef void (*print_interaction)(reax_system*, control_params*, simulation_data*, storage*, diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index d762dc1611..e0e94d18f8 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -76,7 +76,7 @@ void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, void Valence_Angles( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/, LAMMPS_NS::LAMMPS* lmp) + reax_list **lists, output_controls * /*out_control*/ ) { int i, j, pi, k, pk, t; int type_i, type_j, type_k; @@ -408,7 +408,7 @@ void Valence_Angles( reax_system *system, control_params *control, 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); - lmp->error->one(FLERR, errmsg); + control->error_ptr->one(FLERR, errmsg); } } diff --git a/src/USER-REAXC/reaxc_valence_angles.h b/src/USER-REAXC/reaxc_valence_angles.h index 27bda3ba09..51eac5a95e 100644 --- a/src/USER-REAXC/reaxc_valence_angles.h +++ b/src/USER-REAXC/reaxc_valence_angles.h @@ -30,7 +30,7 @@ #include "reaxc_types.h" void Valence_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*, LAMMPS_NS::LAMMPS* = NULL); + storage*, reax_list**, output_controls*); void Calculate_Theta( rvec, double, rvec, double, double*, double* ); From a89a2de9d4a9912aaa5f50feed6e2e020c5cfee4 Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 16:45:59 +0100 Subject: [PATCH 06/68] Removed unnecessary MPI_comm --- src/USER-REAXC/pair_reaxc.cpp | 16 +-- src/USER-REAXC/reaxc_allocate.cpp | 159 +++++++++++++------------- src/USER-REAXC/reaxc_allocate.h | 11 +- src/USER-REAXC/reaxc_control.cpp | 1 - src/USER-REAXC/reaxc_control.h | 3 - src/USER-REAXC/reaxc_ffield.cpp | 57 ++++----- src/USER-REAXC/reaxc_forces.cpp | 12 +- src/USER-REAXC/reaxc_forces.h | 2 +- src/USER-REAXC/reaxc_init_md.cpp | 20 ++-- src/USER-REAXC/reaxc_init_md.h | 2 - src/USER-REAXC/reaxc_list.cpp | 22 ++-- src/USER-REAXC/reaxc_list.h | 4 +- src/USER-REAXC/reaxc_lookup.cpp | 74 +++++------- src/USER-REAXC/reaxc_lookup.h | 6 +- src/USER-REAXC/reaxc_reset_tools.cpp | 15 ++- src/USER-REAXC/reaxc_reset_tools.h | 4 +- src/USER-REAXC/reaxc_tool_box.cpp | 4 +- src/USER-REAXC/reaxc_tool_box.h | 4 +- src/USER-REAXC/reaxc_traj.cpp | 15 ++- src/USER-REAXC/reaxc_valence_angles.h | 2 +- 20 files changed, 192 insertions(+), 241 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index a9501dac9d..8b36019881 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -141,10 +141,10 @@ PairReaxC::~PairReaxC() if (control->tabulate ) Deallocate_Lookup_Tables( system); - if (control->hbond_cut > 0 ) Delete_List( lists+HBONDS, world); - Delete_List( lists+BONDS, world ); - Delete_List( lists+THREE_BODIES, world ); - Delete_List( lists+FAR_NBRS, world ); + 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 ); @@ -439,12 +439,12 @@ void PairReaxC::setup( ) // initialize my data structures - PreAllocate_Space( system, control, workspace, world ); + PreAllocate_Space( system, control, workspace ); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - lists+FAR_NBRS, world)) + lists+FAR_NBRS)) error->one(FLERR,"Pair reax/c problem in far neighbor list"); (lists+FAR_NBRS)->error_ptr=lmp->error; @@ -469,7 +469,7 @@ void PairReaxC::setup( ) // check if I need to shrink/extend my data-structs - ReAllocate( system, control, data, workspace, &lists, mpi_data ); + ReAllocate( system, control, data, workspace, &lists ); } bigint local_ngroup = list->inum; @@ -521,7 +521,7 @@ void PairReaxC::compute(int eflag, int vflag) setup(); - Reset( system, control, data, workspace, &lists, world ); + Reset( system, control, data, workspace, &lists ); workspace->realloc.num_far = write_reax_lists(); // timing for filling in the reax lists if (comm->me == 0) { diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 8784c854b5..7649c110ef 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; 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, MPI_Comm comm ) + storage * workspace ) { int mincap = system->mincap; double safezone = system->safezone; @@ -55,7 +55,7 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, system->total_cap = MAX( (int)(system->N * safezone), mincap ); system->my_atoms = (reax_atom*) - scalloc(system->error_ptr, system->total_cap, sizeof(reax_atom), "my_atoms", comm ); + scalloc(system->error_ptr, system->total_cap, sizeof(reax_atom), "my_atoms"); // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); @@ -212,7 +212,7 @@ 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, - MPI_Comm comm, char * /*msg*/ ) + char * /*msg*/ ) { int i, total_real, total_rvec, local_rvec; @@ -224,84 +224,84 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, /* communication storage */ for( i = 0; i < MAX_NBRS; ++i ) { workspace->tmp_dbl[i] = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "tmp_dbl", comm ); + 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", comm ); + 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", comm ); + 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", comm ); - workspace->total_bond_order = (double*) smalloc(control->error_ptr, total_real, "total_bo", comm ); - workspace->Deltap = (double*) smalloc(control->error_ptr, total_real, "Deltap", comm ); - workspace->Deltap_boc = (double*) smalloc(control->error_ptr, total_real, "Deltap_boc", comm ); - workspace->dDeltap_self = (rvec*) smalloc(control->error_ptr, total_rvec, "dDeltap_self", comm ); - workspace->Delta = (double*) smalloc(control->error_ptr, total_real, "Delta", comm ); - workspace->Delta_lp = (double*) smalloc(control->error_ptr, total_real, "Delta_lp", comm ); + 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"); + 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", comm ); - workspace->dDelta_lp = (double*) smalloc(control->error_ptr, total_real, "dDelta_lp", comm ); + 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", comm ); - workspace->Delta_e = (double*) smalloc(control->error_ptr, total_real, "Delta_e", comm ); - workspace->Delta_boc = (double*) smalloc(control->error_ptr, total_real, "Delta_boc", comm ); - workspace->Delta_val = (double*) smalloc(control->error_ptr, total_real, "Delta_val", comm ); - workspace->nlp = (double*) smalloc(control->error_ptr, total_real, "nlp", comm ); - workspace->nlp_temp = (double*) smalloc(control->error_ptr, total_real, "nlp_temp", comm ); - workspace->Clp = (double*) smalloc(control->error_ptr, total_real, "Clp", comm ); - workspace->vlpex = (double*) smalloc(control->error_ptr, total_real, "vlpex", comm ); + 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", comm ); + scalloc(control->error_ptr, total_cap, sizeof(int), "bond_mark"); workspace->done_after = (int*) - scalloc(control->error_ptr, total_cap, sizeof(int), "done_after", comm ); + scalloc(control->error_ptr, total_cap, sizeof(int), "done_after"); /* QEq storage */ workspace->Hdia_inv = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "Hdia_inv", comm ); - workspace->b_s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_s", comm ); - workspace->b_t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_t", comm ); - workspace->b_prc = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prc", comm ); - workspace->b_prm = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "b_prm", comm ); - workspace->s = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "s", comm ); - workspace->t = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "t", comm ); + 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->droptol = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "droptol", comm ); - workspace->b = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "b", comm ); - workspace->x = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "x", comm ); + 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"); /* GMRES storage */ - workspace->y = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "y", comm ); - workspace->z = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "z", comm ); - workspace->g = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "g", comm ); - workspace->h = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "h", comm ); - workspace->hs = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hs", comm ); - workspace->hc = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hc", comm ); - workspace->v = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "v", comm ); + 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]", comm ); - workspace->v[i] = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "v[i]", comm ); + 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", comm ); - workspace->d = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "d", comm ); - workspace->q = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "q", comm ); - workspace->p = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "p", comm ); - workspace->r2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "r2", comm ); - workspace->d2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "d2", comm ); - workspace->q2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "q2", comm ); - workspace->p2 = (rvec2*) scalloc(control->error_ptr, total_cap, sizeof(rvec2), "p2", comm ); + 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"); /* integrator storage */ - workspace->v_const = (rvec*) smalloc(control->error_ptr, local_rvec, "v_const", comm ); + 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", comm ); + workspace->f = (rvec*) scalloc(control->error_ptr, total_cap, sizeof(rvec), "f"); workspace->CdDelta = (double*) - scalloc(control->error_ptr, total_cap, sizeof(double), "CdDelta", comm ); + scalloc(control->error_ptr, total_cap, sizeof(double), "CdDelta"); // storage for reductions with multiple threads #ifdef LMP_USER_OMP @@ -322,17 +322,16 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, static void Reallocate_Neighbor_List( reax_list *far_nbrs, int n, - int num_intrs, MPI_Comm comm ) + int num_intrs ) { - Delete_List( far_nbrs, comm ); - if(!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs, comm )){ + 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"); } } -static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, - MPI_Comm comm ) +static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds ) { int i, total_hbonds; @@ -346,8 +345,8 @@ static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, } total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); - Delete_List( hbonds, comm ); - if (!Make_List( system->Hcap, total_hbonds, TYP_HBOND, hbonds, comm )) { + 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"); } @@ -356,8 +355,7 @@ static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds, static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, - int *total_bonds, int *est_3body, - MPI_Comm comm ) + int *total_bonds, int *est_3body ) { int i; @@ -378,8 +376,8 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, sfree(system->error_ptr, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); #endif - Delete_List( bonds, comm ); - if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { + 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"); } @@ -401,14 +399,12 @@ 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, - mpi_datatypes *mpi_data ) + simulation_data *data, storage *workspace, reax_list **lists ) { int num_bonds, est_3body, Hflag, ret; int renbr, newsize; reallocate_data *realloc; reax_list *far_nbrs; - MPI_Comm comm; char msg[200]; int mincap = system->mincap; @@ -416,7 +412,6 @@ void ReAllocate( reax_system *system, control_params *control, double saferzone = system->saferzone; realloc = &(workspace->realloc); - comm = mpi_data->world; if( system->n >= DANGER_ZONE * system->local_cap || (0 && system->n <= LOOSE_ZONE * system->local_cap) ) { @@ -434,18 +429,18 @@ void ReAllocate( reax_system *system, control_params *control, /* system */ ret = Allocate_System( system, system->local_cap, system->total_cap, msg ); if (ret != SUCCESS) { - char errmsg[128]; - snprintf(errmsg, 128, "Not enough space for atom_list: total_cap=%d", system->total_cap); + char errmsg[256]; + snprintf(errmsg, 256, "Not enough space for atom_list: total_cap=%d", system->total_cap); system->error_ptr->one(FLERR, errmsg); } /* workspace */ DeAllocate_Workspace( control, workspace ); ret = Allocate_Workspace( system, control, workspace, system->local_cap, - system->total_cap, comm, msg ); + system->total_cap, msg ); if (ret != SUCCESS) { - char errmsg[128]; - snprintf(errmsg, 128, "Not enough space for workspace: local_cap=%d total_cap=%d", system->local_cap, system->total_cap); + 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); } } @@ -458,15 +453,15 @@ void ReAllocate( reax_system *system, control_params *control, if (Nflag || realloc->num_far >= far_nbrs->num_intrs * DANGER_ZONE) { if (realloc->num_far > far_nbrs->num_intrs) { - char errmsg[128]; - snprintf(errmsg, 128, "step%d-ran out of space on far_nbrs: top=%d, max=%d", data->step, 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); } newsize = static_cast (MAX( realloc->num_far*safezone, mincap*MIN_NBRS )); - Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize, comm ); + Reallocate_Neighbor_List( far_nbrs, system->total_cap, newsize); realloc->num_far = 0; } } @@ -481,7 +476,7 @@ void ReAllocate( reax_system *system, control_params *control, } if (Hflag || realloc->hbonds) { - ret = Reallocate_HBonds_List( system, (*lists)+HBONDS, comm ); + ret = Reallocate_HBonds_List( system, (*lists)+HBONDS); realloc->hbonds = 0; } } @@ -490,14 +485,14 @@ void ReAllocate( reax_system *system, control_params *control, num_bonds = est_3body = -1; if (Nflag || realloc->bonds) { Reallocate_Bonds_List( system, (*lists)+BONDS, &num_bonds, - &est_3body, comm ); + &est_3body); realloc->bonds = 0; realloc->num_3body = MAX( realloc->num_3body, est_3body ) * 2; } /* 3-body list */ if (realloc->num_3body > 0) { - Delete_List( (*lists)+THREE_BODIES, comm ); + Delete_List( (*lists)+THREE_BODIES); if (num_bonds == -1) num_bonds = ((*lists)+BONDS)->num_intrs; @@ -505,7 +500,7 @@ void ReAllocate( reax_system *system, control_params *control, realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); if( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, - (*lists)+THREE_BODIES, comm ) ) { + (*lists)+THREE_BODIES ) ) { system->error_ptr->one(FLERR, "Problem in initializing angles list"); } realloc->num_3body = -1; diff --git a/src/USER-REAXC/reaxc_allocate.h b/src/USER-REAXC/reaxc_allocate.h index f813204006..be203340f6 100644 --- a/src/USER-REAXC/reaxc_allocate.h +++ b/src/USER-REAXC/reaxc_allocate.h @@ -28,20 +28,15 @@ #define __ALLOCATE_H_ #include "reaxc_types.h" - -#include "lammps.h" -#include "error.h" -using namespace LAMMPS_NS; - -int PreAllocate_Space( reax_system*, control_params*, storage*, MPI_Comm ); +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, MPI_Comm, char* ); + int, int, char* ); void DeAllocate_Workspace( control_params*, storage* ); void ReAllocate( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, mpi_datatypes* ); + reax_list** ); #endif diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 14b28615fb..0caae40156 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -28,7 +28,6 @@ #include "reaxc_control.h" #include "reaxc_tool_box.h" - char Read_Control_File( char *control_file, control_params* control, output_controls *out_control ) { diff --git a/src/USER-REAXC/reaxc_control.h b/src/USER-REAXC/reaxc_control.h index 47627aed61..b2b455d6b8 100644 --- a/src/USER-REAXC/reaxc_control.h +++ b/src/USER-REAXC/reaxc_control.h @@ -29,9 +29,6 @@ #include "reaxc_types.h" -#include "lammps.h" -#include "error.h" - char Read_Control_File( char*, control_params*, output_controls* ); #endif diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 987a11d252..28bc0429cc 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -44,7 +44,6 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, double val; MPI_Comm comm; int me; - comm = MPI_COMM_WORLD; MPI_Comm_rank(comm, &me); @@ -99,55 +98,45 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Allocating structures in reax_interaction */ reax->sbp = (single_body_parameters*) - scalloc(control->error_ptr, reax->num_atom_types, sizeof(single_body_parameters), "sbp", - comm ); + 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", comm ); + 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", comm ); + 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", comm ); + 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", comm ); + 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", comm ); + 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]", - comm ); + 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]", - comm ); + 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]", - comm ); + 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]", - comm ); + 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]", comm ); + 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]", - comm ); + 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]", - comm ); + 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]", - comm ); + 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]", comm ); + 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]", - comm ); + 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]", - comm ); + scalloc(control->error_ptr, reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]"); } } } @@ -163,7 +152,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity checks */ if (c < 9) { - control->error_ptr->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->all(FLERR,"Inconsistent ffield file"); } for( j = 0; j < (int)(strlen(tmp[0])); ++j ) @@ -185,7 +174,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->all(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].alpha = val; @@ -203,7 +192,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->all(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val; @@ -221,7 +210,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->one(FLERR,"Inconsistent ffield file"); + control->error_ptr->all(FLERR,"Inconsistent ffield file"); } val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val; @@ -240,7 +229,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c > 2) { - control->error_ptr->one(FLERR,"Force field file incompatible with 'lgvdw yes'"); + control->error_ptr->all(FLERR,"Force field file incompatible with 'lgvdw yes'"); } val = atof(tmp[0]); reax->sbp[i].lgcij = val; @@ -337,8 +326,6 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, fgets(s,MAX_LINE,fp); c=Tokenize(s,&tmp); - - j = atoi(tmp[0]) - 1; k = atoi(tmp[1]) - 1; diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index ff1dd839fb..afe9a059ed 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -116,7 +116,7 @@ void Compute_Total_Force( reax_system *system, control_params *control, } void Validate_Lists( 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 i, comp, Hindex; reax_list *bonds, *hbonds; @@ -176,8 +176,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l void Init_Forces_noQEq( 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, j, pj; int start_i, end_i; int type_i, type_j; @@ -311,13 +310,13 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, workspace->realloc.num_hbonds = num_hbonds; Validate_Lists( system, workspace, lists, data->step, - system->n, system->N, system->numH, comm ); + 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, MPI_Comm /*comm*/ ) + int *bond_top, int *num_3body ) { int i, j, pj; int start_i, end_i; @@ -439,10 +438,9 @@ void Compute_Forces( reax_system *system, control_params *control, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { - MPI_Comm comm = mpi_data->world; Init_Forces_noQEq( system, control, data, workspace, - lists, out_control, comm ); + lists, out_control); /********* bonded interactions ************/ Compute_Bonded_Forces( system, control, data, workspace, diff --git a/src/USER-REAXC/reaxc_forces.h b/src/USER-REAXC/reaxc_forces.h index 6c839a7023..bfad2e9b71 100644 --- a/src/USER-REAXC/reaxc_forces.h +++ b/src/USER-REAXC/reaxc_forces.h @@ -36,5 +36,5 @@ void Init_Force_Functions( control_params* ); void Compute_Forces( reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes* ); void Estimate_Storages( reax_system*, control_params*, reax_list**, - int*, int*, int*, int*, MPI_Comm ); + int*, int*, int*, int* ); #endif diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 27e60c580c..913bc241de 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -81,7 +81,7 @@ int Init_Simulation_Data( reax_system *system, control_params *control, return SUCCESS; } -void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) +void Init_Taper( control_params *control, storage *workspace ) { double d1, d7; double swa, swa2, swa3; @@ -122,12 +122,12 @@ void Init_Taper( control_params *control, storage *workspace, MPI_Comm comm ) int Init_Workspace( reax_system *system, control_params *control, - storage *workspace, MPI_Comm comm, char *msg ) + storage *workspace, char *msg ) { int ret; ret = Allocate_Workspace( system, control, workspace, - system->local_cap, system->total_cap, comm, msg ); + system->local_cap, system->total_cap, msg ); if (ret != SUCCESS) return ret; @@ -135,7 +135,7 @@ int Init_Workspace( reax_system *system, control_params *control, Reset_Workspace( system, workspace ); /* Initialize the Taper function */ - Init_Taper( control, workspace, comm ); + Init_Taper( control, workspace); return SUCCESS; } @@ -159,17 +159,15 @@ int Init_Lists( reax_system *system, control_params *control, { int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int *hb_top, *bond_top; - MPI_Comm comm; int mincap = system->mincap; double safezone = system->safezone; double saferzone = system->saferzone; - comm = mpi_data->world; 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, comm ); + &Htop, hb_top, bond_top, &num_3body); if (control->hbond_cut > 0) { /* init H indexes */ @@ -181,7 +179,7 @@ int Init_Lists( reax_system *system, control_params *control, total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS, comm ) ) { + *lists+HBONDS ) ) { control->error_ptr->one(FLERR, "Not enough space for hbonds list."); } (*lists+HBONDS)->error_ptr = system->error_ptr; @@ -195,7 +193,7 @@ int Init_Lists( reax_system *system, control_params *control, bond_cap = (int)(MAX( total_bonds*safezone, mincap*MIN_BONDS )); if( !Make_List( system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS, comm ) ) { + *lists+BONDS ) ) { control->error_ptr->one(FLERR, "Not enough space for bonds list."); } (*lists+BONDS)->error_ptr = system->error_ptr; @@ -203,7 +201,7 @@ int Init_Lists( reax_system *system, control_params *control, /* 3bodies list */ cap_3body = (int)(MAX( num_3body*safezone, MIN_3BODIES )); if( !Make_List( bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES, comm ) ){ + *lists+THREE_BODIES ) ){ control->error_ptr->one(FLERR,"Problem in initializing angles list."); } (*lists+THREE_BODIES)->error_ptr = system->error_ptr; @@ -242,7 +240,7 @@ void Initialize( reax_system *system, control_params *control, control->error_ptr->one(FLERR,errmsg); } - if (Init_Workspace( system, control, workspace, mpi_data->world, msg ) == + if (Init_Workspace( system, control, workspace, msg ) == FAILURE) { snprintf(errmsg, 128, "Workspace could not be initialized on thread %d", system->my_rank); diff --git a/src/USER-REAXC/reaxc_init_md.h b/src/USER-REAXC/reaxc_init_md.h index 546a9e33c9..ab519a4c72 100644 --- a/src/USER-REAXC/reaxc_init_md.h +++ b/src/USER-REAXC/reaxc_init_md.h @@ -29,8 +29,6 @@ #include "reaxc_types.h" -#include "lammps.h" -#include "error.h" void Initialize( reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index f103e520e8..d0143ec9ae 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -29,7 +29,7 @@ #include "reaxc_tool_box.h" /************* allocate list space ******************/ -int Make_List( int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) +int Make_List(int n, int num_intrs, int type, reax_list *l ) { l->allocated = 1; @@ -38,52 +38,52 @@ int Make_List( int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) 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", comm ); - l->end_index = (int*) smalloc(l->error_ptr, n * sizeof(int), "list:end_index", comm ); + 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; 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, l->num_intrs * sizeof(void*), "list:v", comm); + l->select.v = (void*) smalloc(l->error_ptr, l->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, l->num_intrs * sizeof(three_body_interaction_data), - "list:three_bodies", comm ); + "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, l->num_intrs * sizeof(bond_data), "list:bonds", comm ); + smalloc(l->error_ptr, l->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, l->num_intrs * sizeof(dbond_data), "list:dbonds", comm ); + smalloc(l->error_ptr, l->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, l->num_intrs * sizeof(dDelta_data), "list:dDeltas", comm ); + smalloc(l->error_ptr, l->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, l->num_intrs * sizeof(far_neighbor_data), "list:far_nbrs", comm); + smalloc(l->error_ptr, l->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, l->num_intrs * sizeof(hbond_data), "list:hbonds", comm ); + smalloc(l->error_ptr, l->num_intrs * sizeof(hbond_data), "list:hbonds"); break; default: @@ -96,7 +96,7 @@ int Make_List( int n, int num_intrs, int type, reax_list *l, MPI_Comm comm) } -void Delete_List( reax_list *l, MPI_Comm comm ) +void Delete_List( reax_list *l ) { if (l->allocated == 0) return; diff --git a/src/USER-REAXC/reaxc_list.h b/src/USER-REAXC/reaxc_list.h index ab7fbce19c..28567252da 100644 --- a/src/USER-REAXC/reaxc_list.h +++ b/src/USER-REAXC/reaxc_list.h @@ -29,8 +29,8 @@ #include "reaxc_types.h" -int Make_List( int, int, int, reax_list*, MPI_Comm ); -void Delete_List( reax_list*, MPI_Comm ); +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* ); diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index b140b0cadf..74d8176522 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -51,18 +51,17 @@ void Tridiagonal_Solve( const double *a, const double *b, void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const double *f, - cubic_spline_coef *coef, unsigned int n, - MPI_Comm comm ) + 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", comm ); - b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + 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] = a[1] = a[n-1] = 0; @@ -102,18 +101,17 @@ void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const d 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, - MPI_Comm comm ) + 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", comm ); - b = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - c = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - d = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); - v = (double*) smalloc(error_ptr, n * sizeof(double), "cubic_spline:a", comm ); + 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; @@ -159,35 +157,33 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, double dr; double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb; double v0_vdw, v0_ele, vlast_vdw, vlast_ele; - MPI_Comm comm; /* initializations */ v0_vdw = 0; v0_ele = 0; vlast_vdw = 0; vlast_ele = 0; - comm = mpi_data->world; 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", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); fh = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh"); fvdw = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw"); fCEvd = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd"); fele = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele"); fCEclmb = (double*) - smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", comm ); + smalloc(system->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); LR = (LR_lookup_table**) - scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR", comm ); + 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]", comm ); + scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); for( i = 0; i < MAX_ATOM_TYPES; ++i ) existing_types[i] = 0; @@ -207,22 +203,18 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, 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", comm ); + 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" , - comm ); + 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", - comm); + 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", - comm); + 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", - comm ); + 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", comm ); + "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]) ); @@ -247,23 +239,19 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, vlast_ele = fele[r-1]; Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1], - &(LR[i][j].H[1]), control->tabulate+1, comm ); + &(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, - comm ); + &(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, - comm ); + &(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, - comm ); + &(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, - comm ); + &(LR[i][j].CEclmb[1]), control->tabulate+1); } else { LR[i][j].n = 0; } diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h index 9b1b14a34d..6d6aae2f8e 100644 --- a/src/USER-REAXC/reaxc_lookup.h +++ b/src/USER-REAXC/reaxc_lookup.h @@ -33,12 +33,10 @@ void Tridiagonal_Solve( const double *a, const double *b, double *c, double *d, double *x, unsigned int n); void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f, - cubic_spline_coef *coef, unsigned int n, - MPI_Comm comm ); + cubic_spline_coef *coef, unsigned int n ); void Complete_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f, double v0, double vlast, - cubic_spline_coef *coef, unsigned int n, - MPI_Comm comm ); + cubic_spline_coef *coef, unsigned int n ); int Init_Lookup_Tables( reax_system*, control_params*, storage*, mpi_datatypes*, char* ); diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index d273a417f8..8954e344df 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -121,8 +121,7 @@ void Reset_Workspace( reax_system *system, storage *workspace ) void Reset_Neighbor_Lists( reax_system *system, control_params *control, - storage *workspace, reax_list **lists, - MPI_Comm comm ) + storage *workspace, reax_list **lists ) { int i, total_bonds, Hindex, total_hbonds; reax_list *bonds, *hbonds; @@ -144,8 +143,8 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, workspace->realloc.bonds = 1; if (total_bonds >= bonds->num_intrs) { char errmsg[256]; - snprintf(errmsg, 256, "p%d: not enough space for bonds! total=%d allocated=%d\n", - system->my_rank, total_bonds, bonds->num_intrs); + snprintf(errmsg, 256, "Not enough space for bonds! total=%d allocated=%d\n", + total_bonds, bonds->num_intrs); control->error_ptr->one(FLERR, errmsg); } } @@ -170,8 +169,8 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, workspace->realloc.hbonds = 1; if (total_hbonds >= hbonds->num_intrs) { char errmsg[256]; - snprintf(errmsg, 256, "p%d: not enough space for hbonds! total=%d allocated=%d\n", - system->my_rank, total_hbonds, hbonds->num_intrs); + snprintf(errmsg, 256, "Not enough space for hbonds! total=%d allocated=%d\n", + total_hbonds, hbonds->num_intrs); control->error_ptr->one(FLERR, errmsg); } } @@ -180,7 +179,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, void Reset( reax_system *system, control_params *control, simulation_data *data, - storage *workspace, reax_list **lists, MPI_Comm comm ) + storage *workspace, reax_list **lists ) { Reset_Atoms( system, control ); @@ -188,6 +187,6 @@ void Reset( reax_system *system, control_params *control, simulation_data *data, Reset_Workspace( system, workspace ); - Reset_Neighbor_Lists( system, control, workspace, lists, comm ); + 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 index c2a90072d5..20d1ab6964 100644 --- a/src/USER-REAXC/reaxc_reset_tools.h +++ b/src/USER-REAXC/reaxc_reset_tools.h @@ -34,7 +34,7 @@ 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**, MPI_Comm ); + reax_list** ); void Reset( reax_system*, control_params*, simulation_data*, storage*, - reax_list**, MPI_Comm ); + reax_list** ); #endif diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index cd339af556..05ebc34c1b 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -56,7 +56,7 @@ int Tokenize( char* s, char*** tok ) /* safe malloc */ -void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name, MPI_Comm comm ) +void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) { void *ptr; char errmsg[256]; @@ -79,7 +79,7 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name, MPI_C /* safe calloc */ -void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name, MPI_Comm comm ) +void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name ) { void *ptr; char errmsg[256]; diff --git a/src/USER-REAXC/reaxc_tool_box.h b/src/USER-REAXC/reaxc_tool_box.h index 257ff1813f..0465376dba 100644 --- a/src/USER-REAXC/reaxc_tool_box.h +++ b/src/USER-REAXC/reaxc_tool_box.h @@ -37,7 +37,7 @@ double Get_Time( ); int Tokenize( char*, char*** ); /* from lammps */ -void *smalloc( LAMMPS_NS::Error*, rc_bigint, const char*, MPI_Comm ); -void *scalloc( LAMMPS_NS::Error*, rc_bigint, rc_bigint, const char*, MPI_Comm ); +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_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 90f3d1e668..27bebb6327 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -29,8 +29,7 @@ #include "reaxc_list.h" #include "reaxc_tool_box.h" -int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space, - MPI_Comm comm ) +int 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 ); @@ -82,7 +81,7 @@ int Write_Header( reax_system *system, control_params *control, 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, mpi_data->world ); + Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req ); /* only the master node writes into trajectory header */ if (system->my_rank == MASTER_NODE) { @@ -277,7 +276,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*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, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); out_control->line[0] = 0; out_control->buffer[0] = 0; @@ -366,7 +365,7 @@ int Write_Frame_Header( reax_system *system, control_params *control, 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, mpi_data->world ); + Reallocate_Output_Buffer( control->error_ptr, out_control, buffer_req ); /* only the master node writes into trajectory header */ if (me == MASTER_NODE) { @@ -499,7 +498,7 @@ int Write_Atoms( reax_system *system, control_params * /*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, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); /* fill in buffer */ out_control->line[0] = 0; @@ -589,7 +588,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, 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, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); /* fill in the buffer */ out_control->line[0] = 0; @@ -689,7 +688,7 @@ int Write_Angles( reax_system *system, control_params *control, 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, mpi_data->world ); + Reallocate_Output_Buffer( system->error_ptr, out_control, buffer_req ); /* fill in the buffer */ my_angles = 0; diff --git a/src/USER-REAXC/reaxc_valence_angles.h b/src/USER-REAXC/reaxc_valence_angles.h index 51eac5a95e..31936ba190 100644 --- a/src/USER-REAXC/reaxc_valence_angles.h +++ b/src/USER-REAXC/reaxc_valence_angles.h @@ -30,7 +30,7 @@ #include "reaxc_types.h" void Valence_Angles( reax_system*, control_params*, simulation_data*, - storage*, reax_list**, output_controls*); + storage*, reax_list**, output_controls* ); void Calculate_Theta( rvec, double, rvec, double, double*, double* ); From 88755aefcadd1af3ee17e932d875e502f30b0748 Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 17:44:52 +0100 Subject: [PATCH 07/68] Added support for reax/c/omp --- src/USER-OMP/pair_reaxc_omp.cpp | 10 ++-- src/USER-OMP/reaxc_forces_omp.cpp | 12 ++-- src/USER-OMP/reaxc_init_md_omp.cpp | 73 ++++++++++------------- src/USER-OMP/reaxc_valence_angles_omp.cpp | 19 +++--- src/USER-REAXC/reaxc_allocate.cpp | 8 +-- 5 files changed, 56 insertions(+), 66 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 63beb61be6..fe158e30d4 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -113,7 +113,7 @@ PairReaxCOMP::~PairReaxCOMP() if (setup_flag) { reax_list * bonds = lists+BONDS; for (int i=0; inum_intrs; ++i) - sfree(bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); + sfree(LAMMPS_NS::Pointers::lmp->error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); } memory->destroy(num_nbrs_offset); @@ -210,7 +210,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) setup(); - Reset( system, control, data, workspace, &lists, world ); + Reset( system, control, data, workspace, &lists ); // Why not update workspace like in MPI-only code? // Using the MPI-only way messes up the hb energy @@ -411,12 +411,12 @@ void PairReaxCOMP::setup( ) // initialize my data structures - PreAllocate_Space( system, control, workspace, world ); + PreAllocate_Space( system, control, workspace ); write_reax_atoms(); int num_nbrs = estimate_reax_lists(); if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, - lists+FAR_NBRS, world)) + lists+FAR_NBRS)) error->all(FLERR,"Pair reax/c problem in far neighbor list"); write_reax_lists(); @@ -446,7 +446,7 @@ void PairReaxCOMP::setup( ) // check if I need to shrink/extend my data-structs - ReAllocate( system, control, data, workspace, &lists, mpi_data ); + ReAllocate( system, control, data, workspace, &lists ); } } diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 80741a46a8..96b27c4c26 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -289,9 +289,10 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list else comp = bonds->num_intrs; if (End_Index(i, bonds) > comp) { - fprintf( stderr, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n", - step, i, End_Index(i,bonds), comp ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + 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->all(FLERR,errmsg); } } } @@ -315,9 +316,10 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list else comp = hbonds->num_intrs; if (End_Index(Hindex, hbonds) > comp) { - fprintf(stderr,"step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n", + 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 ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + system->error_ptr->all(FLERR, errmsg); } } } diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index bd15b3b9df..fe7682d035 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -43,7 +43,7 @@ extern int Init_MPI_Datatypes(reax_system*, storage*, mpi_datatypes*, MPI_Comm, char*); extern int Init_System(reax_system*, control_params*, char*); extern int Init_Simulation_Data(reax_system*, control_params*, simulation_data*, char*); -extern int Init_Workspace(reax_system*, control_params*, storage*, MPI_Comm, char*); +extern int Init_Workspace(reax_system*, control_params*, storage*, char*); /* ---------------------------------------------------------------------- */ @@ -63,7 +63,7 @@ int Init_ListsOMP( reax_system *system, control_params *control, 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, comm ); + &Htop, hb_top, bond_top, &num_3body ); if (control->hbond_cut > 0) { /* init H indexes */ @@ -75,9 +75,8 @@ int Init_ListsOMP( reax_system *system, control_params *control, total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS )); if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND, - *lists+HBONDS, comm ) ) { - fprintf( stderr, "not enough space for hbonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + *lists+HBONDS ) ) { + system->error_ptr->one( FLERR, "Not enough space for hbonds list. Terminating!" ); } } @@ -89,9 +88,8 @@ int Init_ListsOMP( reax_system *system, control_params *control, bond_cap = (int)(MAX( total_bonds*safezone, mincap*MIN_BONDS )); if( !Make_List( system->total_cap, bond_cap, TYP_BOND, - *lists+BONDS, comm ) ) { - fprintf( stderr, "not enough space for bonds list. terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + *lists+BONDS ) ) { + system->error_ptr->one( FLERR, "Not enough space for bonds list. Terminating!\n" ); } int nthreads = control->nthreads; @@ -99,15 +97,14 @@ int Init_ListsOMP( reax_system *system, control_params *control, for (i = 0; i < bonds->num_intrs; ++i) bonds->select.bond_list[i].bo_data.CdboReduction = - (double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm); + (double*) smalloc(system->error_ptr, 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, comm ) ){ + *lists+THREE_BODIES ) ){ - fprintf( stderr, "Problem in initializing angles list. Terminating!\n" ); - MPI_Abort( comm, INSUFFICIENT_MEMORY ); + system->error_ptr->one( FLERR, "Problem in initializing angles list. Terminating!" ); } free( hb_top ); @@ -125,60 +122,50 @@ void InitializeOMP( reax_system *system, control_params *control, mpi_datatypes *mpi_data, MPI_Comm comm ) { char msg[MAX_STR]; + char errmsg[512]; if (Init_MPI_Datatypes(system, workspace, mpi_data, comm, msg) == FAILURE) { - fprintf( stderr, "p%d: init_mpi_datatypes: could not create datatypes\n", - system->my_rank ); - fprintf( stderr, "p%d: mpi_data couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + system->error_ptr->one( FLERR, "init_mpi_datatypes: could not create datatypes. " + "Mpi_data couldn't be initialized! Terminating."); } if (Init_System(system, control, msg) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: system could not be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf( errmsg, 512, "Error on: %s. " + "System could not be initialized! Terminating.", msg ); + system->error_ptr->one(FLERR, errmsg); } if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: sim_data couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf( errmsg, 512, "Error on: %s. " + "Sim_data couldn't be initialized! Terminating.", msg ); + system->error_ptr->one(FLERR, errmsg); } - if (Init_Workspace( system, control, workspace, mpi_data->world, msg ) == + if (Init_Workspace( system, control, workspace, msg ) == FAILURE) { - fprintf( stderr, "p%d:init_workspace: not enough memory\n", - system->my_rank ); - fprintf( stderr, "p%d:workspace couldn't be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + system->error_ptr->one(FLERR, "init_workspace: not enough memory. " + "Workspace couldn't be initialized! Terminating."); } if (Init_ListsOMP( system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: system could not be initialized! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf( errmsg, 512, "Error on: %s. " + "System could not be initialized! Terminating.", msg ); + system->error_ptr->one(FLERR, errmsg); } if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: could not open output files! terminating...\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf( errmsg, 512, "Error on: %s" + "Could not open output files! Terminating.", msg ); + system->error_ptr->one(FLERR, errmsg); } if (control->tabulate) { if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) { - fprintf( stderr, "p%d: %s\n", system->my_rank, msg ); - fprintf( stderr, "p%d: couldn't create lookup table! terminating.\n", - system->my_rank ); - MPI_Abort( mpi_data->world, CANNOT_INITIALIZE ); + snprintf( errmsg, 512, "Error on: %s." + " Couldn't create lookup table! Terminating.", msg ); + system->error_ptr->one(FLERR, errmsg); } } diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 4164d39cab..195f16a75d 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -237,12 +237,12 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, // Confirm that thb_intrs->num_intrs / nthreads is enough to hold all angles from a single atom if(my_offset >= (tid+1)*per_thread) { - int me; - MPI_Comm_rank(MPI_COMM_WORLD,&me); - fprintf( stderr, "step%d-ran out of space on angle_list on proc %i for atom %i:", data->step, me, j); - fprintf( stderr, " nthreads= %d, tid=%d, my_offset=%d, per_thread=%d\n", nthreads, tid, my_offset, per_thread); - fprintf( stderr, " num_intrs= %i N= %i\n",thb_intrs->num_intrs , system->N); - MPI_Abort( MPI_COMM_WORLD, INSUFFICIENT_MEMORY ); + 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); } // Number of angles owned by this atom @@ -601,9 +601,10 @@ 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) { - fprintf( stderr, "step%d-ran out of space on angle_list: top=%d, max=%d", - data->step, num_thb_intrs, thb_intrs->num_intrs ); - MPI_Abort( MPI_COMM_WORLD, INSUFFICIENT_MEMORY ); + 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); } } diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 7649c110ef..ff829db3dc 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -306,12 +306,12 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, // storage for reductions with multiple threads #ifdef LMP_USER_OMP workspace->CdDeltaReduction = (double *) scalloc(control->error_ptr, sizeof(double), total_cap*control->nthreads, - "cddelta_reduce", comm); + "cddelta_reduce"); workspace->forceReduction = (rvec *) scalloc(control->error_ptr, sizeof(rvec), total_cap*control->nthreads, - "forceReduction", comm); + "forceReduction"); - workspace->valence_angle_atom_myoffset = (int *) scalloc(control->error_ptr, sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); + 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); @@ -391,7 +391,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *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)*nthreads, "CdboReduction", comm); + (double*) smalloc(system->error_ptr, sizeof(double)*nthreads, "CdboReduction"); #endif return SUCCESS; From eedc88eb9b82701740e48903634395e7990b2cf3 Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 25 Mar 2019 18:01:31 +0100 Subject: [PATCH 08/68] MPI_Abort removed from reax/c/kk + fixed some declarations --- src/KOKKOS/pair_reaxc_kokkos.cpp | 74 ++++++++++++++------------------ src/USER-REAXC/reaxc_lookup.h | 4 +- 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 9930894f45..ec9ba79682 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -447,23 +447,23 @@ int PairReaxCKokkos::Init_Lookup_Tables() num_atom_types = atom->ntypes; dr = control->nonb_cut / control->tabulate; h = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:h", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h"); fh = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fh", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh"); fvdw = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fvdw", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw"); fCEvd = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEvd", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd"); fele = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fele", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele"); fCEclmb = (double*) - smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", world ); + smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb"); LR = (LR_lookup_table**) - scalloc( num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR", world ); + scalloc( 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( num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]", world ); + scalloc( 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 ) { @@ -473,22 +473,18 @@ int PairReaxCKokkos::Init_Lookup_Tables() LR[i][j].dx = dr; LR[i][j].inv_dx = control->tabulate / control->nonb_cut; LR[i][j].y = (LR_data*) - smalloc( LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", world ); + smalloc( control->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y"); LR[i][j].H = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" , - world ); + smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H"); LR[i][j].vdW = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW", - world); + smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW"); LR[i][j].CEvd = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd", - world); + smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd"); LR[i][j].ele = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele", - world ); + smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele"); LR[i][j].CEclmb = (cubic_spline_coef*) - smalloc( LR[i][j].n*sizeof(cubic_spline_coef), - "lookup:LR[i,j].CEclmb", world ); + smalloc( 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]) ); @@ -512,24 +508,20 @@ int PairReaxCKokkos::Init_Lookup_Tables() vlast_vdw = fCEvd[r-1]; vlast_ele = fele[r-1]; - Natural_Cubic_Spline( &h[1], &fh[1], - &(LR[i][j].H[1]), control->tabulate+1, world ); + Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1], + &(LR[i][j].H[1]), control->tabulate+1 ); - Complete_Cubic_Spline( &h[1], &fvdw[1], v0_vdw, vlast_vdw, - &(LR[i][j].vdW[1]), control->tabulate+1, - world ); + 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( &h[1], &fCEvd[1], - &(LR[i][j].CEvd[1]), control->tabulate+1, - world ); + Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEvd[1], + &(LR[i][j].CEvd[1]), control->tabulate+1 ); - Complete_Cubic_Spline( &h[1], &fele[1], v0_ele, vlast_ele, - &(LR[i][j].ele[1]), control->tabulate+1, - world ); + 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( &h[1], &fCEclmb[1], - &(LR[i][j].CEclmb[1]), control->tabulate+1, - world ); + Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEclmb[1], + &(LR[i][j].CEclmb[1]), control->tabulate+1 ); } } free(h); @@ -555,16 +547,16 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() for( i = 0; i <= ntypes; ++i ) { for( j = i; j <= ntypes; ++j ) if (LR[i][j].n) { - sfree( LR[i][j].y, "LR[i,j].y" ); - sfree( LR[i][j].H, "LR[i,j].H" ); - sfree( LR[i][j].vdW, "LR[i,j].vdW" ); - sfree( LR[i][j].CEvd, "LR[i,j].CEvd" ); - sfree( LR[i][j].ele, "LR[i,j].ele" ); - sfree( LR[i][j].CEclmb, "LR[i,j].CEclmb" ); + 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( LR[i], "LR[i]" ); + sfree( control->error_ptr, LR[i], "LR[i]" ); } - sfree( LR, "LR" ); + sfree( control->error_ptr, LR, "LR" ); } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/reaxc_lookup.h b/src/USER-REAXC/reaxc_lookup.h index 6d6aae2f8e..3fd0c2581a 100644 --- a/src/USER-REAXC/reaxc_lookup.h +++ b/src/USER-REAXC/reaxc_lookup.h @@ -32,10 +32,10 @@ void Tridiagonal_Solve( const double *a, const double *b, double *c, double *d, double *x, unsigned int n); -void Natural_Cubic_Spline( LAMMPS_NS::LAMMPS*, const double *h, const double *f, +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::LAMMPS*, const double *h, const double *f, double v0, double vlast, +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*, From 74489621c41f89e96bcdd1be3f8d4829bde904b9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 30 Mar 2019 22:35:41 -0400 Subject: [PATCH 09/68] correct misleading indentation to follow syntax --- src/GRANULAR/pair_granular.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 973acbbaf4..ce6cae75e4 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -872,16 +872,16 @@ void PairGranular::coeff(int narg, char **arg) if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for twist model"); - twist_model_one = TWIST_SDS; - twist_history = 1; - // kt and gammat and friction coeff - twist_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); - twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); - twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); - iarg += 5; + twist_model_one = TWIST_SDS; + twist_history = 1; + // kt and gammat and friction coeff + twist_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); + twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); + twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); + iarg += 5; } else { - error->all(FLERR, "Illegal pair_coeff command, " - "twisting friction model not recognized"); + error->all(FLERR, "Illegal pair_coeff command, " + "twisting friction model not recognized"); } } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) From 506535008125ede5a9a549f4dcbd30721a387a8b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 30 Mar 2019 23:19:31 -0400 Subject: [PATCH 10/68] improve kim-query documentation --- doc/src/kim_query.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/src/kim_query.txt b/doc/src/kim_query.txt index be46783d82..c581de0ebb 100644 --- a/doc/src/kim_query.txt +++ b/doc/src/kim_query.txt @@ -26,12 +26,13 @@ kim_query latconst get_test_result test=TE_156715955670 model=MO_800509458712 & The kim_query command allows to retrieve properties from the OpenKIM through a web query. The result is stored in a string style "variable"_variable.html, the name of which must be given as the first -argument of the kim_query command. The second required argument is the -name of the actual query function (e.g. {get_test_result}). All following +argument of the kim_query command. The second required argument is the +name of the actual query function (e.g. {get_test_result}). All following arguments are parameters handed over to the web query in the format -{keyword=value}. This list of supported keywords and the type of how -the value has to be encoded depends on the query function used. -For more details on this, please refer to the OpenKIM homepage. +{keyword=value}. The list of supported keywords and the type of how +the value has to be encoded depends on the query function used. This +mirrors the functionality available on the OpenKIM webpage at +"https://query.openkim.org"_https://query.openkim.org/ [Restrictions:] From 971bce74283388f0f5d3b280144ed20f307270a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 30 Mar 2019 23:33:54 -0400 Subject: [PATCH 11/68] address formatting issue in pair granular docs --- doc/src/pair_granular.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_granular.txt b/doc/src/pair_granular.txt index e4b9bb3250..d287123246 100644 --- a/doc/src/pair_granular.txt +++ b/doc/src/pair_granular.txt @@ -19,7 +19,7 @@ pair_style granular command :h3 pair_style granular cutoff :pre -cutoff = global cutoff (optional). See discussion below. :l +cutoff = global cutoff (optional). See discussion below. :ul [Examples:] From fa407c05a1f8ecd6281889ea388909c525b89ffc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 31 Mar 2019 14:59:20 -0400 Subject: [PATCH 12/68] neither KOKKOS nor USER-INTEL require OpenMP; they can be built without --- cmake/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c15011b2af..77ca136b81 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -322,7 +322,7 @@ pkg_depends(USER-SCAFACOS MPI) find_package(OpenMP QUIET) option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND}) -if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL) +if(BUILD_OMP) find_package(OpenMP REQUIRED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") @@ -1068,10 +1068,6 @@ if(PKG_USER-INTEL) message(FATAL_ERROR "USER-INTEL needs at least a 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") endif() - if(NOT BUILD_OMP) - message(FATAL_ERROR "USER-INTEL requires OpenMP") - endif() - if(NOT ${LAMMPS_MEMALIGN} STREQUAL "64") message(FATAL_ERROR "USER-INTEL is only useful with LAMMPS_MEMALIGN=64") endif() From 4d3c1785c6bade7552bf705e389abd14f71d1edc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 31 Mar 2019 17:12:11 -0400 Subject: [PATCH 13/68] add utility function to add custom integrate style --- cmake/Modules/StyleHeaderUtils.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index a7b23b4cf1..ebaa5dae8e 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -91,6 +91,10 @@ function(RegisterFixStyle path) AddStyleHeader(${path} FIX) endfunction(RegisterFixStyle) +function(RegisterIntegrateStyle path) + AddStyleHeader(${path} INTEGRATE) +endfunction(RegisterIntegrateStyle) + function(RegisterStyles search_path) FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid From 3bf4cd9c01858d595b4bdc9c453058ea5704dcca Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 31 Mar 2019 17:17:07 -0400 Subject: [PATCH 14/68] major refactor of USER-INTEL support in CMake - decouple from USER-OMP - decouple from OpenMP support - make MKL and TBB optional - support compilers other than Intel (but print warning about bad performance) - expose Long-range thread support selection to CMake - fix bugs and typos and add missing code, so that it actually compiles and includes all styles --- cmake/CMakeLists.txt | 131 ++++++++++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 46 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 77ca136b81..b730324a0d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -944,7 +944,7 @@ if(PKG_USER-OMP) # detects styles which have USER-OMP version RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES) - RegisterFixStyle("${USER-OMP_SOURCES_DIR}/fix_omp.h") + RegisterFixStyle(${USER-OMP_SOURCES_DIR}/fix_omp.h) get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES) @@ -1057,33 +1057,72 @@ if(PKG_OPT) endif() if(PKG_USER-INTEL) - find_package(TBB REQUIRED) - find_package(MKL REQUIRED) + add_definitions(-DLMP_USER_INTEL) - if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler") - endif() + set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)") + set(INTEL_ARCH_VALUES cpu knl) + set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES}) + validate_option(INTEL_ARCH INTEL_ARCH_VALUES) + string(TOUPPER ${INTEL_ARCH} INTEL_ARCH) - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) - message(FATAL_ERROR "USER-INTEL needs at least a 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") - endif() - - if(NOT ${LAMMPS_MEMALIGN} STREQUAL "64") - message(FATAL_ERROR "USER-INTEL is only useful with LAMMPS_MEMALIGN=64") - endif() - - set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)") - set(INTEL_ARCH_VALUES cpu knl) - set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES}) - validate_option(INTEL_ARCH INTEL_ARCH_VALUES) - string(TOUPPER ${INTEL_ARCH} INTEL_ARCH) - - if(INTEL_ARCH STREQUAL "KNL") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload") - set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"") - add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS}) - add_definitions(-DLMP_INTEL_OFFLOAD) + # add_definitions(-DLMP_INTEL_USELRT) + find_package(Threads QUIET) + if(Threads_FOUND) + set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)") + else() + set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)") + endif() + set(INTEL_LRT_VALUES none threads c++11) + set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES}) + validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES) + string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE) + if(INTEL_LRT_MODE STREQUAL "THREADS") + if(Threads_FOUND) + add_definitions(-DLMP_INTEL_USELRT) + list(APPEND LAMMPS_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT}) else() + message(FATAL_ERROR "Must have working threads library for Long-range thread support") + endif() + endif() + if(INTEL_LRT_MODE STREQUAL "C++11") + add_definitions(-DLMP_INTEL_USERLRT -DLMP_INTEL_LRT11) + endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + message(FATAL_ERROR "USER-INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") + endif() + else() + message(WARNING "USER-INTEL gives best performance with Intel compilers") + endif() + + find_package(TBB QUIET) + if(TBB_FOUND) + list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES}) + else() + add_definitions(-DLMP_INTEL_NO_TBB) + endif() + + find_package(MKL QUIET) + if(MKL_FOUND) + add_definitions(-DLMP_USE_MKL_RNG) + list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) + endif() + + if((NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256")) + message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256") + endif() + + if(INTEL_ARCH STREQUAL "KNL") + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture") + endif() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload") + set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"") + add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS}) + add_definitions(-DLMP_INTEL_OFFLOAD) + else() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512") else() @@ -1096,33 +1135,33 @@ if(PKG_USER-INTEL) add_compile_options(${_FLAG}) endif() endforeach() + else() + add_compile_options(-O3 -ffast-math) endif() + endif() - add_definitions(-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG) + # collect sources + set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) + set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp + ${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp + ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp + ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp + ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp + ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp) - list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES} ${MKL_LIBRARIES}) + set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") - set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) - set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h - ${USER-INTEL_SOURCES_DIR}/intel_buffers.h - ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp - ${USER-INTEL_SOURCES_DIR}/math_extra_intel.h - ${USER-INTEL_SOURCES_DIR}/nbin_intel.h - ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp - ${USER-INTEL_SOURCES_DIR}/npair_intel.h - ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp - ${USER-INTEL_SOURCES_DIR}/intel_simd.h - ${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h) + # detect styles which have a USER-INTEL version + RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES) + RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h) + RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h) + RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h) + RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h) - set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") + get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) - # detects styles which have USER-INTEL version - RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES) - - get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) - - list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) - include_directories(${USER-INTEL_SOURCES_DIR}) + list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) + include_directories(${USER-INTEL_SOURCES_DIR}) endif() if(PKG_GPU) From 7688ead60fd8f56ddf96a846420303dfb0614733 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 04:42:56 -0400 Subject: [PATCH 15/68] add pair style granular to pair style overview page in manual --- doc/src/Commands_pair.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/Commands_pair.txt b/doc/src/Commands_pair.txt index b18d852c09..e887f0178a 100644 --- a/doc/src/Commands_pair.txt +++ b/doc/src/Commands_pair.txt @@ -98,6 +98,7 @@ OPT. "gran/hertz/history (o)"_pair_gran.html, "gran/hooke (o)"_pair_gran.html, "gran/hooke/history (ko)"_pair_gran.html, +"granular"_pair_granular.html, "gw"_pair_gw.html, "gw/zbl"_pair_gw.html, "hbond/dreiding/lj (o)"_pair_hbond_dreiding.html, From 2e7316a9e34f1b888a58ab05b58d0946a6fcc637 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 08:11:22 -0400 Subject: [PATCH 16/68] fix another windows portability issue in USER-PTM by adding missing header include --- src/USER-PTM/ptm_polar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-PTM/ptm_polar.cpp b/src/USER-PTM/ptm_polar.cpp index 7a2695b504..5e234127a9 100644 --- a/src/USER-PTM/ptm_polar.cpp +++ b/src/USER-PTM/ptm_polar.cpp @@ -88,6 +88,7 @@ #include #include #include +#include "ptm_polar.h" #include "ptm_quat.h" From adbc64b45e30b5199a97027a12de90fed29366b8 Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 1 Apr 2019 16:34:34 +0200 Subject: [PATCH 17/68] Cleaning includes + changing error->all to error->one --- src/USER-OMP/reaxc_forces_omp.cpp | 4 ++-- src/USER-REAXC/reaxc_allocate.cpp | 2 -- src/USER-REAXC/reaxc_control.cpp | 2 ++ src/USER-REAXC/reaxc_ffield.cpp | 2 -- src/USER-REAXC/reaxc_forces.cpp | 4 +++- src/USER-REAXC/reaxc_init_md.cpp | 1 + src/USER-REAXC/reaxc_list.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_types.h | 12 ++++++------ src/USER-REAXC/reaxc_valence_angles.cpp | 2 ++ 12 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 96b27c4c26..1e1cf44f50 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -292,7 +292,7 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list 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->all(FLERR,errmsg); + system->error_ptr->one(FLERR,errmsg); } } } @@ -319,7 +319,7 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list 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->all(FLERR, errmsg); + system->error_ptr->one(FLERR, errmsg); } } } diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index ff829db3dc..460f8aeb6a 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -35,9 +35,7 @@ #include #endif -#include "lammps.h" #include "error.h" -using namespace LAMMPS_NS; /* allocate space for my_atoms important: we cannot know the exact number of atoms that will fall into a diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 0caae40156..535226fff8 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -28,6 +28,8 @@ #include "reaxc_control.h" #include "reaxc_tool_box.h" +#include "error.h" + char Read_Control_File( char *control_file, control_params* control, output_controls *out_control ) { diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 28bc0429cc..eea1696cd6 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -29,8 +29,6 @@ #include "reaxc_ffield.h" #include "reaxc_tool_box.h" -#include "lammps.h" -#include "error.h" char Read_Force_Field( FILE *fp, reax_interaction *reax, control_params *control ) diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index afe9a059ed..8c602e9156 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -39,6 +39,8 @@ #include "reaxc_valence_angles.h" #include "reaxc_vector.h" +#include "error.h" + interaction_function Interaction_Functions[NUM_INTRS]; @@ -138,7 +140,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l 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->all(FLERR,errmsg); + system->error_ptr->one(FLERR,errmsg); } } } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 913bc241de..fbef5e42d1 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -36,6 +36,7 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" +#include "error.h" int Init_System( reax_system *system, control_params *control, char * /*msg*/ ) { diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index d0143ec9ae..2e86c3c06b 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -28,6 +28,8 @@ #include "reaxc_list.h" #include "reaxc_tool_box.h" +#include "error.h" + /************* allocate list space ******************/ int Make_List(int n, int num_intrs, int type, reax_list *l ) { diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 8954e344df..5439ee33a4 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -30,6 +30,8 @@ #include "reaxc_tool_box.h" #include "reaxc_vector.h" +#include "error.h" + void Reset_Atoms( reax_system* system, control_params *control ) { diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index 05ebc34c1b..df8d7c85bf 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -27,6 +27,8 @@ #include "pair_reaxc.h" #include "reaxc_tool_box.h" +#include "error.h" + struct timeval tim; double t_end; diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 27bebb6327..d25221512e 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -29,6 +29,8 @@ #include "reaxc_list.h" #include "reaxc_tool_box.h" +#include "error.h" + int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_control, int req_space ) { if (out_control->buffer_len > 0) diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 310ef42bdf..d390768ac6 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -39,9 +39,8 @@ #include #include "accelerator_kokkos.h" -#include "lammps.h" -#include "error.h" -using LAMMPS_NS::Error; + +namespace LAMMPS_NS { class Error;} #if defined LMP_USER_OMP #define OMP_TIMING 0 @@ -415,7 +414,7 @@ struct _reax_system boundary_cutoff bndry_cuts; reax_atom *my_atoms; - class Error *error_ptr; + class LAMMPS_NS::Error *error_ptr; class Pair *pair_ptr; int my_bonds; int mincap; @@ -493,7 +492,8 @@ typedef struct int lgflag; int enobondsflag; - class Error *error_ptr; + class LAMMPS_NS::Error *error_ptr; + int me; } control_params; @@ -780,7 +780,7 @@ struct _reax_list int type; list_type select; - class Error *error_ptr; + class LAMMPS_NS::Error *error_ptr; }; typedef _reax_list reax_list; diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index e0e94d18f8..4ba870b6d9 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -30,6 +30,8 @@ #include "reaxc_list.h" #include "reaxc_vector.h" +#include "error.h" + static double Dot( double* v1, double* v2, int k ) { double ret = 0.0; From 799c16a8b29922838994d6381662ad77692d4a92 Mon Sep 17 00:00:00 2001 From: mkanski Date: Mon, 1 Apr 2019 17:04:09 +0200 Subject: [PATCH 18/68] restore a removed check + print some warnings only once --- src/USER-REAXC/reaxc_ffield.cpp | 2 ++ src/USER-REAXC/reaxc_init_md.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index eea1696cd6..36b7105ce8 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -148,6 +148,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, 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) { control->error_ptr->all(FLERR,"Inconsistent ffield file"); diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index fbef5e42d1..8ac9f0e53c 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -91,13 +91,13 @@ void Init_Taper( control_params *control, storage *workspace ) swa = control->nonb_low; swb = control->nonb_cut; - if (fabs( swa ) > 0.01) + if (fabs( swa ) > 0.01 && control->me == 0) control->error_ptr->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); if (swb < 0) { control->error_ptr->all(FLERR,"Negative upper Taper-radius cutoff"); } - else if( swb < 5 ) { + else if( swb < 5 && control->me == 0) { char errmsg[256]; snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb ); control->error_ptr->warning( FLERR, errmsg ); From b7aecc0d5928244de708f4127d0d87584f49c0cd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:22:53 -0400 Subject: [PATCH 19/68] avoid linking with -ldl on windows, as it is not needed or supported --- cmake/CMakeLists.txt | 5 ++++- cmake/presets/mingw-cross.cmake | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 cmake/presets/mingw-cross.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c15011b2af..eb7e419ec9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -607,7 +607,10 @@ if(PKG_USER-MOLFILE) set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") add_library(molfile INTERFACE) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) - target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) + # no need to link with -ldl on windows + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) + endif() list(APPEND LAMMPS_LINK_LIBS molfile) endif() diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake new file mode 100644 index 0000000000..5c41509d5f --- /dev/null +++ b/cmake/presets/mingw-cross.cmake @@ -0,0 +1,12 @@ +set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE + GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS + PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI + USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS + USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP + USER-MANIFOLD USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE + USER-OMP USER-PHONON USER-QTB USER-REAXC USER-SDPD USER-SMD + USER-SMTBQ USER-SPH USER-TALLY USER-UEF) + +foreach(PKG ${WIN_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() From d5aa60dbfe2b62046bf56096eec00e5a63c23f7c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:23:27 -0400 Subject: [PATCH 20/68] skip inline function optimizations for windows when compiling with mingw --- src/lmpwindows.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lmpwindows.h b/src/lmpwindows.h index 546fa62535..92a248a05e 100644 --- a/src/lmpwindows.h +++ b/src/lmpwindows.h @@ -24,14 +24,13 @@ inline double pow(int i, int j){ return pow((double)i,j); } -#endif -inline double sqrt(int i){ - return sqrt((double) i); -} - inline double fabs(int i){ return fabs((double) i); } +inline double sqrt(int i){ + return sqrt((double) i); +} +#endif inline double trunc(double x) { return x > 0 ? floor(x) : ceil(x); From 8d8f0af7a626fb6a6cc93263cea6b05189af2b32 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:38:53 -0400 Subject: [PATCH 21/68] add download flags to mingw preset --- cmake/presets/mingw-cross.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 5c41509d5f..841972b858 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -10,3 +10,5 @@ set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE foreach(PKG ${WIN_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) endforeach() +set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) +set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) From 70ae5f41e35df1fa7c1fa2ab7011edb47bd36a3e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:46:25 -0400 Subject: [PATCH 22/68] tweaks for compiling USER-INTEL in cpu mode on Windows with GCC --- cmake/CMakeLists.txt | 2 +- cmake/presets/mingw-cross.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a9147bf8c7..9402ec0663 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1112,7 +1112,7 @@ if(PKG_USER-INTEL) list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) endif() - if((NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256")) + if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256")) message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256") endif() diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 841972b858..d8edf95403 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -12,3 +12,4 @@ foreach(PKG ${WIN_PACKAGES}) endforeach() set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) +set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) From 35129c0881991c028ab549ea48de83a39e88bddf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:51:53 -0400 Subject: [PATCH 23/68] posix_memalign() does not exist on windows, so we have to workaround using it with USER-INTEL --- src/memory.cpp | 2 +- src/my_page.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory.cpp b/src/memory.cpp index 971de3dce6..b2f8a95b17 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -26,7 +26,7 @@ #endif #endif -#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) +#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) #define LAMMPS_MEMALIGN 64 #endif diff --git a/src/my_page.h b/src/my_page.h index 5cd7098d8c..01542a9174 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -48,7 +48,7 @@ methods: #ifndef LAMMPS_MY_PAGE_H #define LAMMPS_MY_PAGE_H -#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) +#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) #define LAMMPS_MEMALIGN 64 #endif From 76b848bb0ad2028deff14c37584f22922c9387ca Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 17:58:19 -0400 Subject: [PATCH 24/68] include USER-INTEL, but need to disable support for LRT mode --- cmake/presets/mingw-cross.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index d8edf95403..11921c05c9 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -2,7 +2,7 @@ set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP + USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP USER-PHONON USER-QTB USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF) @@ -13,3 +13,4 @@ endforeach() set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) +set(INTEL_LRT_MODE "none" CACHE STRING "" FORCE) From 3a0b108f914401e7b1328611888471ba55acbd07 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 18:22:06 -0400 Subject: [PATCH 25/68] reformat --- cmake/presets/mingw-cross.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 11921c05c9..cab5a3ca41 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -1,15 +1,16 @@ -set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE - GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI - USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL - USER-MANIFOLD USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE +set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR + KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS QEQ REPLICA + RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-BOCS + USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD + USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD + USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP USER-PHONON USER-QTB USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF) foreach(PKG ${WIN_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) endforeach() + set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) From 200aa2d06fc6c52171eb7e2211947b5fb130d059 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 18:50:53 -0400 Subject: [PATCH 26/68] missed a few packages in cross-compiler preset --- cmake/presets/mingw-cross.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index cab5a3ca41..b53e5a7b93 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -1,11 +1,11 @@ -set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR - KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS QEQ REPLICA - RIGID SHOCK SNAP SRD VORONOI USER-ATC USER-AWPMD USER-BOCS - USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD - USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD - USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE - USER-OMP USER-PHONON USER-QTB USER-REAXC USER-SDPD USER-SMD - USER-SMTBQ USER-SPH USER-TALLY USER-UEF) +set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI POEMS QEQ + REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-ATC USER-AWPMD + USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION + USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD + USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP + USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SDPD USER-SMD + USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-YAFF) foreach(PKG ${WIN_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) From b1badb6555f595d5bd8a44597ed2a18552b1ef26 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 22:09:58 -0400 Subject: [PATCH 27/68] update all-on and all-off presets for recently added and removed packages --- cmake/presets/all_off.cmake | 4 ---- cmake/presets/all_on.cmake | 4 ---- 2 files changed, 8 deletions(-) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index b434796d7c..cdcf5fc675 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -11,10 +11,6 @@ set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVA USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK) -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) - set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) foreach(PKG ${ALL_PACKAGES}) diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 3a1100f337..1351eb8315 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -11,10 +11,6 @@ set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVA USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK) -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) - set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) foreach(PKG ${ALL_PACKAGES}) From 719a74a02fc8ab2f84652b9edcb2a7054cf3729f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 22:10:55 -0400 Subject: [PATCH 28/68] must include omp.h header when using OpenMP API functions --- src/KOKKOS/pair_exp6_rx_kokkos.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index fa10c6d30f..0a6372fdf8 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -36,6 +36,10 @@ #include "atom_kokkos.h" #include "kokkos.h" +#ifdef _OPENMP +#include +#endif + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecialKokkos; From 2fc7395c140224d493c19de02ef7f660bdb03702 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 22:22:31 -0400 Subject: [PATCH 29/68] add some comments to updated all-on / all-off presets --- cmake/presets/all_off.cmake | 3 +++ cmake/presets/all_on.cmake | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index cdcf5fc675..80a12c6991 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -1,3 +1,6 @@ +# preset that turns on all existing packages off. can be used to reset +# an existing package selection without losing any other settings + set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC MOLECULE MPIIO MSCG OPT PERI POEMS diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 1351eb8315..b66434df63 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -1,3 +1,7 @@ +# preset that turns on all existing packages. using the combination +# this preset with the nolib.cmake preset should configure a LAMMPS +# binary, that can be compiled with just a working C++ compiler. + set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC MOLECULE MPIIO MSCG OPT PERI POEMS From c044eeb482467ff4687cb3b35883120ff0ef0b86 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Apr 2019 22:23:36 -0400 Subject: [PATCH 30/68] update nolib.cmake and change it so it disables all packages requiring some external library or equivalent --- cmake/presets/nolib.cmake | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index 4c02fb6210..663f87122b 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -1,21 +1,10 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) +# preset that turns off all packages that require some form of external +# library or special compiler (fortran or cuda) or equivalent. -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON + VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB + USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP + USER-SMD USER-VTK) foreach(PKG ${PACKAGES_WITH_LIB}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) From 91f3a948510bf75128c8765e5aa28fee6b6bc4d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 05:49:25 -0400 Subject: [PATCH 31/68] fix typo in docs --- doc/src/velocity.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/velocity.txt b/doc/src/velocity.txt index 96d3fa6dc4..decdf2a923 100644 --- a/doc/src/velocity.txt +++ b/doc/src/velocity.txt @@ -134,7 +134,7 @@ The {mom} and {rot} keywords are used by {create}. If mom = yes, the linear momentum of the newly created ensemble of velocities is zeroed; if rot = yes, the angular momentum is zeroed. -*line +:line If specified, the {temp} keyword is used by {create} and {scale} to specify a "compute"_compute.html that calculates temperature in a From 800f3a81b1152895b8e9af89a957172f505ca781 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 06:59:19 -0400 Subject: [PATCH 32/68] update documentation for changes in USER-INTEL support in CMake --- cmake/README.md | 21 +++++++++++++++++---- doc/src/Build_extras.txt | 25 ++++++++++++++++++------- doc/src/Speed_intel.txt | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/cmake/README.md b/cmake/README.md index 1c37ecc92e..a635f3e06d 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -155,11 +155,13 @@ make The CMake build exposes a lot of different options. In the old build system some of the package selections were possible by using special make target like -`make yes-std` or `make no-lib`. Achieving the same result with cmake requires +`make yes-std` or `make no-lib`. Achieving a similar result with cmake requires specifying all options manually. This can quickly become a very long command line that is hard to handle. While these could be stored in a simple script file, there is another way of defining "presets" to compile LAMMPS in a certain -way. +way. Since the cmake build process - contrary to the conventional build system - +includes the compilation of the bundled libraries into the standard build process, +the grouping of those presets is somewhat different. A preset is a regular CMake script file that can use constructs such as variables, lists and for-loops to manipulate configuration options and create @@ -171,10 +173,10 @@ Such a file can then be passed to cmake via the `-C` flag. Several examples of presets can be found in the `cmake/presets` folder. ```bash -# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package +# build LAMMPS with all packages enabled which don't use external libraries and enable GPU package mkdir build cd build -cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake +cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake ``` # Reference @@ -1429,6 +1431,17 @@ TODO + + INTEL_LRT_MODE + How to support Long-range thread mode in Verlet integration + +
+
threads (default, if pthreads available)
+
none (default, if pthreads not available)
+
c++11
+
+ + diff --git a/doc/src/Build_extras.txt b/doc/src/Build_extras.txt index 2aa304faff..17d18243f2 100644 --- a/doc/src/Build_extras.txt +++ b/doc/src/Build_extras.txt @@ -859,23 +859,34 @@ file. USER-INTEL package :h4,link(user-intel) To build with this package, you must choose which hardware you want to -build for, either Intel CPUs or Intel KNLs. You should also typically -"install the USER-OMP package"_#user-omp, as it can be used in tandem -with the USER-INTEL package to good effect, as explained on the "Speed -intel"_Speed_intel.html doc page. +build for, either x86 CPUs or Intel KNLs in offload mode. You should +also typically "install the USER-OMP package"_#user-omp, as it can be +used in tandem with the USER-INTEL package to good effect, as explained +on the "Speed intel"_Speed_intel.html doc page. [CMake build]: -D INTEL_ARCH=value # value = cpu (default) or knl --D BUILD_OMP=yes # also required to build with the USER-INTEl package :pre +-D INTEL_LRT_MODE=value # value = threads, none, or c++11 :pre -Requires an Intel compiler as well as the Intel TBB and MKL libraries. +In Long-range thread mode (LRT) a modified verlet style is used, that +operates the Kspace calculation in a separate thread concurrently to +other calculations. This has to be enabled in the "package intel"_package.html +command at runtime. With the setting "threads" it used the pthreads +library, while c++11 will use the built-in thread support of C++11 +compilers. The option "none" skips compilation of this feature. The +default is to use "threads" if pthreads is available and otherwise "none". + +Best performance is achieved with Intel hardware, Intel compilers, as well as +the Intel TBB and MKL libraries. However, the code also compiles, links, and +runs with other compilers and without TBB and MKL. [Traditional make]: Choose which hardware to compile for in Makefile.machine via the following settings. See src/MAKE/OPTIONS/Makefile.intel_cpu* and -Makefile.knl files for examples. +Makefile.knl files for examples. and src/USER-INTEL/README for +additional information. For CPUs: diff --git a/doc/src/Speed_intel.txt b/doc/src/Speed_intel.txt index dc38cb0956..2688b43e6f 100644 --- a/doc/src/Speed_intel.txt +++ b/doc/src/Speed_intel.txt @@ -24,7 +24,7 @@ LAMMPS to run on the CPU cores and co-processor cores simultaneously. Angle Styles: charmm, harmonic :ulb,l Bond Styles: fene, fourier, harmonic :l -Dihedral Styles: charmm, harmonic, opls :l +Dihedral Styles: charmm, fourier, harmonic, opls :l Fixes: nve, npt, nvt, nvt/sllod, nve/asphere :l Improper Styles: cvff, harmonic :l Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long, From 0ab65c0343bfefb88618cad078fa70583d928f65 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 07:12:55 -0400 Subject: [PATCH 33/68] update docs for building LAMMPS for windows --- doc/src/Build_windows.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/src/Build_windows.txt b/doc/src/Build_windows.txt index bf1ec265a1..b3dbf775c9 100644 --- a/doc/src/Build_windows.txt +++ b/doc/src/Build_windows.txt @@ -51,11 +51,10 @@ provides a unix/linux interface to low-level Windows functions, so LAMMPS can be compiled on Windows. The necessary (minor) modifications to LAMMPS are included, but may not always up-to-date for recently added functionality and the corresponding new code. A machine makefile for using cygwin for -the old build system is provided. The CMake build system is untested -for this; you will have to request that makefiles are generated and -manually set the compiler. +the old build system is provided. Using CMake for this mode of compilation +is untested and not likely to work. -When compiling for Windows [not] set the -DLAMMPS_MEMALIGN define +When compiling for Windows do [not] set the -DLAMMPS_MEMALIGN define in the LMP_INC makefile variable and add -lwsock32 -lpsapi to the linker flags in LIB makefile variable. Try adding -static-libgcc or -static or both to the linker flags when your resulting LAMMPS Windows executable @@ -79,7 +78,13 @@ probably the currently best tested and supported way to build LAMMPS executables for Windows. There are makefiles provided for the traditional build system, but CMake has also been successfully tested using the mingw32-cmake and mingw64-cmake wrappers that are bundled -with the cross-compiler environment on Fedora machines. +with the cross-compiler environment on Fedora machines. A CMake preset +selecting all packages compatible with this cross-compilation build +is provided. You likely need to disable the GPU package unless you +download and install the contents of the pre-compiled "OpenCL ICD loader +library"_https://download.lammps.org/thirdparty/opencl-win-devel.tar.gz +into your MinGW64 cross-compiler environment. The cross-compilation +currently will only produce non-MPI serial binaries. Please keep in mind, though, that this only applies to compiling LAMMPS. Whether the resulting binaries do work correctly is no tested by the From ef184c9b1b73f0e55f7393d8320250f925edbe0e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 09:34:03 -0400 Subject: [PATCH 34/68] remove presets, that try to mimic settings from the conventional build, but make little sense with cmake --- cmake/presets/manual_selection.cmake | 71 ---------------------------- cmake/presets/std.cmake | 22 --------- cmake/presets/std_nolib.cmake | 26 ---------- cmake/presets/user.cmake | 22 --------- 4 files changed, 141 deletions(-) delete mode 100644 cmake/presets/manual_selection.cmake delete mode 100644 cmake/presets/std.cmake delete mode 100644 cmake/presets/std_nolib.cmake delete mode 100644 cmake/presets/user.cmake diff --git a/cmake/presets/manual_selection.cmake b/cmake/presets/manual_selection.cmake deleted file mode 100644 index 6db41b708c..0000000000 --- a/cmake/presets/manual_selection.cmake +++ /dev/null @@ -1,71 +0,0 @@ -set(PKG_ASPHERE OFF CACHE BOOL "" FORCE) -set(PKG_BODY OFF CACHE BOOL "" FORCE) -set(PKG_CLASS2 OFF CACHE BOOL "" FORCE) -set(PKG_COLLOID OFF CACHE BOOL "" FORCE) -set(PKG_COMPRESS OFF CACHE BOOL "" FORCE) -set(PKG_CORESHELL OFF CACHE BOOL "" FORCE) -set(PKG_DIPOLE OFF CACHE BOOL "" FORCE) -set(PKG_GPU OFF CACHE BOOL "" FORCE) -set(PKG_GRANULAR OFF CACHE BOOL "" FORCE) -set(PKG_KIM OFF CACHE BOOL "" FORCE) -set(PKG_KOKKOS OFF CACHE BOOL "" FORCE) -set(PKG_KSPACE OFF CACHE BOOL "" FORCE) -set(PKG_LATTE OFF CACHE BOOL "" FORCE) -set(PKG_LIB OFF CACHE BOOL "" FORCE) -set(PKG_MANYBODY OFF CACHE BOOL "" FORCE) -set(PKG_MC OFF CACHE BOOL "" FORCE) -set(PKG_MEAM OFF CACHE BOOL "" FORCE) -set(PKG_MISC OFF CACHE BOOL "" FORCE) -set(PKG_MOLECULE OFF CACHE BOOL "" FORCE) -set(PKG_MPIIO OFF CACHE BOOL "" FORCE) -set(PKG_MSCG OFF CACHE BOOL "" FORCE) -set(PKG_OPT OFF CACHE BOOL "" FORCE) -set(PKG_PERI OFF CACHE BOOL "" FORCE) -set(PKG_POEMS OFF CACHE BOOL "" FORCE) -set(PKG_PYTHOFF OFF CACHE BOOL "" FORCE) -set(PKG_QEQ OFF CACHE BOOL "" FORCE) -set(PKG_REAX OFF CACHE BOOL "" FORCE) -set(PKG_REPLICA OFF CACHE BOOL "" FORCE) -set(PKG_RIGID OFF CACHE BOOL "" FORCE) -set(PKG_SHOCK OFF CACHE BOOL "" FORCE) -set(PKG_SNAP OFF CACHE BOOL "" FORCE) -set(PKG_SRD OFF CACHE BOOL "" FORCE) -set(PKG_VOROFFOI OFF CACHE BOOL "" FORCE) - -set(PKG_USER OFF CACHE BOOL "" FORCE) -set(PKG_USER-ATC OFF CACHE BOOL "" FORCE) -set(PKG_USER-AWPMD OFF CACHE BOOL "" FORCE) -set(PKG_USER-BOCS OFF CACHE BOOL "" FORCE) -set(PKG_USER-CGDNA OFF CACHE BOOL "" FORCE) -set(PKG_USER-CGSDK OFF CACHE BOOL "" FORCE) -set(PKG_USER-COLVARS OFF CACHE BOOL "" FORCE) -set(PKG_USER-DIFFRACTIOFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-DPD OFF CACHE BOOL "" FORCE) -set(PKG_USER-DRUDE OFF CACHE BOOL "" FORCE) -set(PKG_USER-EFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-FEP OFF CACHE BOOL "" FORCE) -set(PKG_USER-H5MD OFF CACHE BOOL "" FORCE) -set(PKG_USER-INTEL OFF CACHE BOOL "" FORCE) -set(PKG_USER-LB OFF CACHE BOOL "" FORCE) -set(PKG_USER-MANIFOLD OFF CACHE BOOL "" FORCE) -set(PKG_USER-MEAMC OFF CACHE BOOL "" FORCE) -set(PKG_USER-MESO OFF CACHE BOOL "" FORCE) -set(PKG_USER-MGPT OFF CACHE BOOL "" FORCE) -set(PKG_USER-MISC OFF CACHE BOOL "" FORCE) -set(PKG_USER-MOFFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-MOLFILE OFF CACHE BOOL "" FORCE) -set(PKG_USER-NETCDF OFF CACHE BOOL "" FORCE) -set(PKG_USER-OMP OFF CACHE BOOL "" FORCE) -set(PKG_USER-PHONON OFF CACHE BOOL "" FORCE) -set(PKG_USER-PLUMED OFF CACHE BOOL "" FORCE) -set(PKG_USER-QMMM OFF CACHE BOOL "" FORCE) -set(PKG_USER-QTB OFF CACHE BOOL "" FORCE) -set(PKG_USER-QUIP OFF CACHE BOOL "" FORCE) -set(PKG_USER-REAXC OFF CACHE BOOL "" FORCE) -set(PKG_USER-SDPD OFF CACHE BOOL "" FORCE) -set(PKG_USER-SMD OFF CACHE BOOL "" FORCE) -set(PKG_USER-SMTBQ OFF CACHE BOOL "" FORCE) -set(PKG_USER-SPH OFF CACHE BOOL "" FORCE) -set(PKG_USER-TALLY OFF CACHE BOOL "" FORCE) -set(PKG_USER-UEF OFF CACHE BOOL "" FORCE) -set(PKG_USER-VTK OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/std.cmake b/cmake/presets/std.cmake deleted file mode 100644 index 4176aba44e..0000000000 --- a/cmake/presets/std.cmake +++ /dev/null @@ -1,22 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${STANDARD_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() diff --git a/cmake/presets/std_nolib.cmake b/cmake/presets/std_nolib.cmake deleted file mode 100644 index aa067f2ba0..0000000000 --- a/cmake/presets/std_nolib.cmake +++ /dev/null @@ -1,26 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${STANDARD_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() - -foreach(PKG ${PACKAGES_WITH_LIB}) - set(PKG_${PKG} OFF CACHE BOOL "" FORCE) -endforeach() diff --git a/cmake/presets/user.cmake b/cmake/presets/user.cmake deleted file mode 100644 index af606203e9..0000000000 --- a/cmake/presets/user.cmake +++ /dev/null @@ -1,22 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${USER_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() From 764fb2522b705130929df8a3af1e5051fffc78ab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 11:21:25 -0400 Subject: [PATCH 35/68] abort already in cmake when including USER-INTEL with -DLAMMPS_BIGBIG --- cmake/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9402ec0663..39d1e4e382 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1060,6 +1060,9 @@ if(PKG_OPT) endif() if(PKG_USER-INTEL) + if(LAMMPS_SIZES STREQUAL BIGBIG) + message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG") + endif() add_definitions(-DLMP_USER_INTEL) set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)") @@ -1068,7 +1071,6 @@ if(PKG_USER-INTEL) validate_option(INTEL_ARCH INTEL_ARCH_VALUES) string(TOUPPER ${INTEL_ARCH} INTEL_ARCH) - # add_definitions(-DLMP_INTEL_USELRT) find_package(Threads QUIET) if(Threads_FOUND) set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)") From fd7c680654ba57cfa1302b90cf97e22fd6de367c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 11:39:46 -0400 Subject: [PATCH 36/68] the lammps_gather_atom*() and lammps_scatter_atom() library functions are not compatible with -DLAMMPS_BIGBIG. divert to dummy functions resulting in error exists. --- src/library.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/library.cpp b/src/library.cpp index d8c55159a2..da4ebaf479 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -801,6 +801,13 @@ void lammps_reset_box(void *ptr, double *boxlo, double *boxhi, Allreduce to sum vector into data across all procs ------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather_atoms(void * /*ptr*/, char * /*name */, + int /*type*/, int /*count*/, void * /*data*/) +{ + lmp->error->all(FLERR,"Library function lammps_gather_atoms() not compatible with -DLAMMPS_BIGBIG"); +} +#else void lammps_gather_atoms(void *ptr, char *name, int type, int count, void *data) { @@ -905,6 +912,7 @@ void lammps_gather_atoms(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- gather the named atom-based entity for all atoms @@ -927,6 +935,13 @@ void lammps_gather_atoms(void *ptr, char *name, Allgather Nlocal atoms from each proc into data ------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather_atoms_concat(void * /*ptr*/, char * /*name */, + int /*type*/, int /*count*/, void * /*data*/) +{ + lmp->error->all(FLERR,"Library function lammps_gather_atoms_concat() not compatible with -DLAMMPS_BIGBIG"); +} +#else void lammps_gather_atoms_concat(void *ptr, char *name, int type, int count, void *data) { @@ -1047,6 +1062,7 @@ void lammps_gather_atoms_concat(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- gather the named atom-based entity for a subset of atoms @@ -1071,6 +1087,14 @@ void lammps_gather_atoms_concat(void *ptr, char *name, Allreduce to sum vector into data across all procs ------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather_atoms_subset(void * /*ptr*/, char * /*name */, + int /*type*/, int /*count*/, + int /*ndata*/, int * /*ids*/, void * /*data*/) +{ + lmp->error->all(FLERR,"Library function lammps_gather_atoms_subset() not compatible with -DLAMMPS_BIGBIG"); +} +#else void lammps_gather_atoms_subset(void *ptr, char *name, int type, int count, int ndata, int *ids, void *data) @@ -1188,6 +1212,7 @@ void lammps_gather_atoms_subset(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- scatter the named atom-based entity in data to all atoms @@ -1205,6 +1230,13 @@ void lammps_gather_atoms_subset(void *ptr, char *name, loop over Natoms, if I own atom ID, set its values from data ------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_scatter_atoms(void * /*ptr*/, char * /*name */, + int /*type*/, int /*count*/, void * /*data*/) +{ + lmp->error->all(FLERR,"Library function lammps_scatter_atoms() not compatible with -DLAMMPS_BIGBIG"); +} +#else void lammps_scatter_atoms(void *ptr, char *name, int type, int count, void *data) { @@ -1299,6 +1331,7 @@ void lammps_scatter_atoms(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- scatter the named atom-based entity in data to a subset of atoms @@ -1318,6 +1351,14 @@ void lammps_scatter_atoms(void *ptr, char *name, loop over Ndata, if I own atom ID, set its values from data ------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_scatter_atoms_subset(void * /*ptr*/, char * /*name */, + int /*type*/, int /*count*/, + int /*ndata*/, int * /*ids*/, void * /*data*/) +{ + lmp->error->all(FLERR,"Library function lammps_scatter_atoms_subset() not compatible with -DLAMMPS_BIGBIG"); +} +#else void lammps_scatter_atoms_subset(void *ptr, char *name, int type, int count, int ndata, int *ids, void *data) @@ -1420,6 +1461,7 @@ void lammps_scatter_atoms_subset(void *ptr, char *name, } END_CAPTURE } +#endif /* ---------------------------------------------------------------------- create N atoms and assign them to procs based on coords From 3eab343821792d9f82d6d0be1f2485a1e5ba244c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 11:49:08 -0400 Subject: [PATCH 37/68] give access to LAMMPS object and wrap in macros for optional exception handling --- src/library.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index da4ebaf479..a653b83adb 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -802,10 +802,14 @@ void lammps_reset_box(void *ptr, double *boxlo, double *boxhi, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms(void * /*ptr*/, char * /*name */, +void lammps_gather_atoms(void *ptr, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE lmp->error->all(FLERR,"Library function lammps_gather_atoms() not compatible with -DLAMMPS_BIGBIG"); + END_CAPTURE } #else void lammps_gather_atoms(void *ptr, char *name, @@ -936,10 +940,14 @@ void lammps_gather_atoms(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms_concat(void * /*ptr*/, char * /*name */, +void lammps_gather_atoms_concat(void *ptr, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE lmp->error->all(FLERR,"Library function lammps_gather_atoms_concat() not compatible with -DLAMMPS_BIGBIG"); + END_CAPTURE } #else void lammps_gather_atoms_concat(void *ptr, char *name, @@ -1088,11 +1096,15 @@ void lammps_gather_atoms_concat(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms_subset(void * /*ptr*/, char * /*name */, +void lammps_gather_atoms_subset(void *ptr, char * /*name */, int /*type*/, int /*count*/, int /*ndata*/, int * /*ids*/, void * /*data*/) { + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE lmp->error->all(FLERR,"Library function lammps_gather_atoms_subset() not compatible with -DLAMMPS_BIGBIG"); + END_CAPTURE } #else void lammps_gather_atoms_subset(void *ptr, char *name, @@ -1231,10 +1243,14 @@ void lammps_gather_atoms_subset(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_scatter_atoms(void * /*ptr*/, char * /*name */, +void lammps_scatter_atoms(void *ptr, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE lmp->error->all(FLERR,"Library function lammps_scatter_atoms() not compatible with -DLAMMPS_BIGBIG"); + END_CAPTURE } #else void lammps_scatter_atoms(void *ptr, char *name, @@ -1352,11 +1368,15 @@ void lammps_scatter_atoms(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_scatter_atoms_subset(void * /*ptr*/, char * /*name */, +void lammps_scatter_atoms_subset(void *ptr, char * /*name */, int /*type*/, int /*count*/, int /*ndata*/, int * /*ids*/, void * /*data*/) { + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE lmp->error->all(FLERR,"Library function lammps_scatter_atoms_subset() not compatible with -DLAMMPS_BIGBIG"); + END_CAPTURE } #else void lammps_scatter_atoms_subset(void *ptr, char *name, From 74ce164457494ddb4ced33721214199ab729ee2e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 12:06:51 -0400 Subject: [PATCH 38/68] restore lost edit to all_on.cmake and all_off.cmake that syncs the list of packages --- cmake/presets/all_off.cmake | 25 +++++++++++-------------- cmake/presets/all_on.cmake | 25 +++++++++++-------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index 80a12c6991..0e37611da4 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -1,20 +1,17 @@ # preset that turns on all existing packages off. can be used to reset # an existing package selection without losing any other settings -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO + MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD + VORONOI + USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK + USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP + USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO + USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP + USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP + USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index b66434df63..a24403c847 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -2,20 +2,17 @@ # this preset with the nolib.cmake preset should configure a LAMMPS # binary, that can be compiled with just a working C++ compiler. -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS - USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD - USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO + MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD + VORONOI + USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK + USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP + USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO + USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP + USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP + USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) From cb5c3f900ef3edf4268b071779f819b951f5142a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 12:41:12 -0400 Subject: [PATCH 39/68] add minimal.cmake and most.cmake presets --- cmake/presets/all_on.cmake | 5 +++-- cmake/presets/minimal.cmake | 8 ++++++++ cmake/presets/most.cmake | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 cmake/presets/minimal.cmake create mode 100644 cmake/presets/most.cmake diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index a24403c847..57f1228abe 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -1,6 +1,7 @@ # preset that turns on all existing packages. using the combination -# this preset with the nolib.cmake preset should configure a LAMMPS -# binary, that can be compiled with just a working C++ compiler. +# this preset followed by the nolib.cmake preset should configure a +# LAMMPS binary, with as many packages included, that can be compiled +# with just a working C++ compiler and an MPI library. set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO diff --git a/cmake/presets/minimal.cmake b/cmake/presets/minimal.cmake new file mode 100644 index 0000000000..e9ce6d6103 --- /dev/null +++ b/cmake/presets/minimal.cmake @@ -0,0 +1,8 @@ +# preset that turns on just a few, frequently used packages +# this will be compiled quickly and handle a lot of common inputs. + +set(ALL_PACKAGES KSPACE MANYBODY MOLECULE RIGID) + +foreach(PKG ${ALL_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake new file mode 100644 index 0000000000..eed4599670 --- /dev/null +++ b/cmake/presets/most.cmake @@ -0,0 +1,15 @@ +# preset that turns on a wide range of packages none of which require +# external libraries. Some more unusual packages are removed as well. +# The resulting binary should be able to run most inputs. + +set(ALL_PACKAGES ASPHERE CLASS2 COLLOID CORESHELL DIPOLE + GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI + QEQ REPLICA RIGID SHOCK SRD + USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD + USER-DRUDE USER-FEP USER-MEAMC USER-MESO + USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REAXC + USER-SPH USER-UEF USER-YAFF) + +foreach(PKG ${ALL_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() From 5a751254262718bc8f3a4293c3311b923b82a735 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 14:30:34 -0400 Subject: [PATCH 40/68] add some popular packages requiring libraries to most.cmake preset --- cmake/presets/most.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index eed4599670..35ad7ba55c 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -1,14 +1,14 @@ -# preset that turns on a wide range of packages none of which require -# external libraries. Some more unusual packages are removed as well. -# The resulting binary should be able to run most inputs. +# preset that turns on a wide range of packages, some of which require +# external libraries. Compared to all_on.cmake some more unusual packages +# are removed. The resulting binary should be able to run most inputs. set(ALL_PACKAGES ASPHERE CLASS2 COLLOID CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI - QEQ REPLICA RIGID SHOCK SRD + PYTHON QEQ REPLICA RIGID SHOCK SRD VORONOI USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-FEP USER-MEAMC USER-MESO - USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REAXC - USER-SPH USER-UEF USER-YAFF) + USER-MISC USER-MOFFF USER-OMP USER-PLUMED USER-PHONON USER-REAXC + USER-SPH USER-SMD USER-UEF USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) From 4824992a1e2f367f026daefeeb4ed19857df4124 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 14:31:13 -0400 Subject: [PATCH 41/68] update documentation for recent changes to CMake presets --- doc/src/Build_cmake.txt | 3 ++- doc/src/Build_package.txt | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/src/Build_cmake.txt b/doc/src/Build_cmake.txt index 5c29e11280..69d5d31f54 100644 --- a/doc/src/Build_cmake.txt +++ b/doc/src/Build_cmake.txt @@ -108,7 +108,8 @@ command-line options. Several useful ones are: -D CMAKE_BUILD_TYPE=type # type = Release or Debug -G output # style of output CMake generates -DVARIABLE=value # setting for a LAMMPS feature to enable --D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir :pre +-D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir +-C path/to/preset/file # load some CMake settings before configuring :pre All the LAMMPS-specific -D variables that a LAMMPS build supports are described on the pages linked to from the "Build"_Build.html doc page. diff --git a/doc/src/Build_package.txt b/doc/src/Build_package.txt index c5eca96edb..774cdda6a1 100644 --- a/doc/src/Build_package.txt +++ b/doc/src/Build_package.txt @@ -149,26 +149,32 @@ system. Using these files you can enable/disable portions of the available packages in LAMMPS. If you need a custom preset you can take one of them as a starting point and customize it to your needs. -cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake | enable all packages +cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake | enable all packages cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake | disable all packages -cmake -C ../cmake/presets/std.cmake \[OPTIONS\] ../cmake | enable standard packages -cmake -C ../cmake/presets/user.cmake \[OPTIONS\] ../cmake | enable user packages -cmake -C ../cmake/presets/std_nolib.cmake \[OPTIONS\] ../cmake | enable standard packages that do not require extra libraries -cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | disable all packages that do not require extra libraries -cmake -C ../cmake/presets/manual_selection.cmake \[OPTIONS\] ../cmake | example of how to create a manual selection of packages :tb(s=|,a=l) +cmake -C ../cmake/presets/minimal.cmake \[OPTIONS\] ../cmake | enable just a few core packages +cmake -C ../cmake/presets/most.cmake \[OPTIONS\] ../cmake | enable most common packages +cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | disable packages that do require extra libraries or tools +cmake -C ../cmake/presets/mingw.cmake \[OPTIONS\] ../cmake | enable all packages compatible with MinGW (cross-)compilation on Windows :tb(s=|,a=l)s NOTE: Running cmake this way manipulates the variable cache in your -current build directory. You can combine presets and options with -multiple cmake runs. +current build directory. You can combine multiple presets and options +with multiple cmake runs. [Example:] -# build LAMMPS with all "standard" packages which don't -# use libraries and enable GPU package +# build LAMMPS with most commonly used packages, but then remove +# those requiring additional library or tools, but still enable +# GPU package and configure it for using CUDA. You can run. mkdir build cd build -cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake :pre +cmake -C ../cmake/presets/most.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on -D GPU_API=cuda ../cmake :pre +# to add another package, say BODY to the previous configuration you can run: +cmake -D PKG_BODY=on . :pre + +# to reset the package selection from above to the default of no packages +# but leaving all other settings untouched. You can run: +cmake -C ../cmake/presets/no_all.cmake . :pre :line [Make shortcuts for installing many packages]: From 98bd720c684cd3f56c4925b763b070a0270cffb7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 14:56:51 -0400 Subject: [PATCH 42/68] improved formatting of cmake settings and presets related docs --- doc/src/Build_cmake.txt | 5 +++-- doc/src/Build_package.txt | 21 ++++++++++++++------- doc/src/Build_settings.txt | 13 ++++++++----- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/doc/src/Build_cmake.txt b/doc/src/Build_cmake.txt index 69d5d31f54..265c16e3d4 100644 --- a/doc/src/Build_cmake.txt +++ b/doc/src/Build_cmake.txt @@ -28,7 +28,7 @@ Makefile(s). Example: cd lammps # change to the LAMMPS distribution directory mkdir build; cd build # create a new directory (folder) for build -cmake ../cmake \[options ...\] # configuration with (command-line) cmake +cmake \[options ...\] ../cmake # configuration with (command-line) cmake make # compilation :pre The cmake command will detect available features, enable selected @@ -41,7 +41,8 @@ If your machine has multiple CPU cores (most do these days), using a command like "make -jN" (with N being the number of available local CPU cores) can be much faster. If you plan to do development on LAMMPS or need to re-compile LAMMPS repeatedly, installation of the -ccache (= Compiler Cache) software may speed up compilation even more. +ccache (= Compiler Cache) software may speed up repeated compilation +even more. After compilation, you can optionally copy the LAMMPS executable and library into your system folders (by default under $HOME/.local) with: diff --git a/doc/src/Build_package.txt b/doc/src/Build_package.txt index 774cdda6a1..e37936e052 100644 --- a/doc/src/Build_package.txt +++ b/doc/src/Build_package.txt @@ -149,16 +149,23 @@ system. Using these files you can enable/disable portions of the available packages in LAMMPS. If you need a custom preset you can take one of them as a starting point and customize it to your needs. -cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake | enable all packages -cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake | disable all packages -cmake -C ../cmake/presets/minimal.cmake \[OPTIONS\] ../cmake | enable just a few core packages -cmake -C ../cmake/presets/most.cmake \[OPTIONS\] ../cmake | enable most common packages -cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | disable packages that do require extra libraries or tools -cmake -C ../cmake/presets/mingw.cmake \[OPTIONS\] ../cmake | enable all packages compatible with MinGW (cross-)compilation on Windows :tb(s=|,a=l)s +cmake -C ../cmake/presets/all_on.cmake \[OPTIONS\] ../cmake | + enable all packages | +cmake -C ../cmake/presets/all_off.cmake \[OPTIONS\] ../cmake | + disable all packages | +cmake -C ../cmake/presets/minimal.cmake \[OPTIONS\] ../cmake | + enable just a few core packages | +cmake -C ../cmake/presets/most.cmake \[OPTIONS\] ../cmake | + enable most common packages | +cmake -C ../cmake/presets/nolib.cmake \[OPTIONS\] ../cmake | + disable packages that do require extra libraries or tools | +cmake -C ../cmake/presets/mingw.cmake \[OPTIONS\] ../cmake | + enable all packages compatible with MinGW compilers :tb(c=2,s=|,a=l) NOTE: Running cmake this way manipulates the variable cache in your current build directory. You can combine multiple presets and options -with multiple cmake runs. +in a single cmake run, or change settings incrementally by running +cmake with new flags. [Example:] diff --git a/doc/src/Build_settings.txt b/doc/src/Build_settings.txt index f1db9f0130..287cd39ff6 100644 --- a/doc/src/Build_settings.txt +++ b/doc/src/Build_settings.txt @@ -57,10 +57,10 @@ FFT_INC = -DFFT_SINGLE # do not specify for double precision FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY :pre # default is FFT_PACK_ARRAY if not specified -FFT_INC = -I/usr/local/include +FFT_INC = -I/usr/local/include FFT_PATH = -L/usr/local/lib -FFT_LIB = -lfftw3 # FFTW3 double precision -FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision +FFT_LIB = -lfftw3 # FFTW3 double precision +FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compier :pre @@ -179,8 +179,11 @@ e.g. from 511 to -512, which can cause diagnostics like the mean-squared displacement, as calculated by the "compute msd"_compute_msd.html command, to be faulty. -Note that the USER-ATC package is not currently compatible with the -"bigbig" setting. +Note that the USER-ATC package and the USER-INTEL package are currently +not compatible with the "bigbig" setting. Also, there are limitations +when using the library interface. Some functions with known issues +have been replaced by dummy calls printing a corresponding error rather +than crashing randomly or corrupting data. Also note that the GPU package requires its lib/gpu library to be compiled with the same size setting, or the link will fail. A CMake From 978b52ee8c90a74ee316e3f9578d05ce2409a5fd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 15:06:56 -0400 Subject: [PATCH 43/68] add warning/status messages about skipping TBB malloc and MKL RNG --- cmake/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 39d1e4e382..dd693255a6 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1106,16 +1106,21 @@ if(PKG_USER-INTEL) list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES}) else() add_definitions(-DLMP_INTEL_NO_TBB) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries") + endif() endif() find_package(MKL QUIET) if(MKL_FOUND) add_definitions(-DLMP_USE_MKL_RNG) list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) + else() + message(STATUS "Pair style dpd/intel will be faster with MKL libraries") endif() if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256")) - message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256") + message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256 on this platform") endif() if(INTEL_ARCH STREQUAL "KNL") From 34b023456b6c0b0f57ab7a7fb6d37e03eeee16f9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 15:28:48 -0400 Subject: [PATCH 44/68] add message about -DLAMMPS_BIGBIG incompatibility of scatter/gather functions --- doc/src/Howto_library.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/src/Howto_library.txt b/doc/src/Howto_library.txt index 40a8bf0a70..7bbf08a964 100644 --- a/doc/src/Howto_library.txt +++ b/doc/src/Howto_library.txt @@ -166,9 +166,6 @@ void lammps_gather_atoms_subset(void *, char *, int, int, int, int *, void *) void lammps_scatter_atoms(void *, char *, int, int, void *) void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *) :pre -void lammps_create_atoms(void *, int, tagint *, int *, double *, double *, - imageint *, int) :pre - The gather functions collect peratom info of the requested type (atom coords, atom types, forces, etc) from all processors, and returns the same vector of values to each calling processor. The scatter @@ -176,6 +173,11 @@ functions do the inverse. They distribute a vector of peratom values, passed by all calling processors, to individual atoms, which may be owned by different processors. +IMPORTANT NOTE: These functions are not compatible with the +-DLAMMPS_BIGBIG setting when compiling LAMMPS. Dummy functions +that result in an error message and abort will be subsituted +instead of resulting in random crashes and memory corruption. + The lammps_gather_atoms() function does this for all N atoms in the system, ordered by atom ID, from 1 to N. The lammps_gather_atoms_concat() function does it for all N atoms, but @@ -196,6 +198,9 @@ those values to each atom in the system. The lammps_scatter_atoms_subset() function takes a subset of IDs as an argument and only scatters those values to the owning atoms. +void lammps_create_atoms(void *, int, tagint *, int *, double *, double *, + imageint *, int) :pre + The lammps_create_atoms() function takes a list of N atoms as input with atom types and coords (required), an optionally atom IDs and velocities and image flags. It uses the coords of each atom to assign From 365166fef0f0b898b61dbf6de818e8f4f2c804fd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 16:01:42 -0400 Subject: [PATCH 45/68] print warning messages about calls to self only once --- src/STUBS/mpi.c | 60 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/STUBS/mpi.c b/src/STUBS/mpi.c index 053108fee8..09bb48ecdc 100644 --- a/src/STUBS/mpi.c +++ b/src/STUBS/mpi.c @@ -200,7 +200,11 @@ int MPI_Request_free(MPI_Request *request) int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } return 0; } @@ -209,7 +213,11 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } return 0; } @@ -218,7 +226,11 @@ int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { - printf("MPI Stub WARNING: Should not rsend message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not rsend message to self\n"); + ++callcount; + } return 0; } @@ -227,7 +239,11 @@ int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) { - printf("MPI Stub WARNING: Should not recv message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not recv message from self\n"); + ++callcount; + } return 0; } @@ -236,7 +252,11 @@ int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) { - printf("MPI Stub WARNING: Should not recv message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not recv message from self\n"); + ++callcount; + } return 0; } @@ -244,7 +264,11 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int MPI_Wait(MPI_Request *request, MPI_Status *status) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } return 0; } @@ -252,7 +276,11 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status) int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } return 0; } @@ -261,7 +289,11 @@ int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status) int MPI_Waitany(int count, MPI_Request *request, int *index, MPI_Status *status) { - printf("MPI Stub WARNING: Should not wait on message from self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not wait on message from self\n"); + ++callcount; + } return 0; } @@ -272,7 +304,11 @@ int MPI_Sendrecv(const void *sbuf, int scount, MPI_Datatype sdatatype, MPI_Datatype rdatatype, int source, int rtag, MPI_Comm comm, MPI_Status *status) { - printf("MPI Stub WARNING: Should not send message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not send message to self\n"); + ++callcount; + } return 0; } @@ -280,7 +316,11 @@ int MPI_Sendrecv(const void *sbuf, int scount, MPI_Datatype sdatatype, int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) { - printf("MPI Stub WARNING: Should not get count of message to self\n"); + static int callcount=0; + if (callcount == 0) { + printf("MPI Stub WARNING: Should not get count of message to self\n"); + ++callcount; + } return 0; } From 4a003644feb7d7c9fb2fdd034803da7c364132f3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 16:41:02 -0400 Subject: [PATCH 46/68] fix typo --- doc/src/Howto_library.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Howto_library.txt b/doc/src/Howto_library.txt index 7bbf08a964..7695fd59e2 100644 --- a/doc/src/Howto_library.txt +++ b/doc/src/Howto_library.txt @@ -175,7 +175,7 @@ owned by different processors. IMPORTANT NOTE: These functions are not compatible with the -DLAMMPS_BIGBIG setting when compiling LAMMPS. Dummy functions -that result in an error message and abort will be subsituted +that result in an error message and abort will be substiuted instead of resulting in random crashes and memory corruption. The lammps_gather_atoms() function does this for all N atoms in the From 6411ff8359cfbb1d05ec943bf86017ac119d6773 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 17:25:26 -0400 Subject: [PATCH 47/68] transfer MPI/OpenMP selection from LAMMPS to downloaded Plumed library configuration --- cmake/CMakeLists.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index dd693255a6..59caf8ca9f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -560,6 +560,20 @@ if(PKG_USER-PLUMED) option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" OFF) if(DOWNLOAD_PLUMED) + if(BUILD_MPI) + set(PLUMED_CONFIG_MPI "--enable-mpi") + set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER}) + set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER}) + else() + set(PLUMED_CONFIG_MPI "--disable-mpi") + set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER}) + set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER}) + endif() + if(BUILD_OMP) + set(PLUMED_CONFIG_OMP "--enable-openmp") + else() + set(PLUMED_CONFIG_OMP "--disable-openmp") + endif() message(STATUS "PLUMED download requested - we will build our own") include(ExternalProject) ExternalProject_Add(plumed_build @@ -568,9 +582,11 @@ if(PKG_USER-PLUMED) BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} - --enable-modules=all - CXX=${CMAKE_MPI_CXX_COMPILER} - CC=${CMAKE_MPI_C_COMPILER} + --enable-modules=all + ${PLUMED_CONFIG_MPI} + ${PLUMED_CONFIG_OMP} + CXX=${PLUMED_CONFIG_CXX} + CC=${PLUMED_CONFIG_CC} ) ExternalProject_get_property(plumed_build INSTALL_DIR) set(PLUMED_INSTALL_DIR ${INSTALL_DIR}) From bd923d8bd4c2b07a830fdd92b8cb50c41d4a799f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 17:33:35 -0400 Subject: [PATCH 48/68] fix second typo in the same word. i need a break... :-( --- doc/src/Howto_library.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Howto_library.txt b/doc/src/Howto_library.txt index 7695fd59e2..ba009cfad9 100644 --- a/doc/src/Howto_library.txt +++ b/doc/src/Howto_library.txt @@ -175,7 +175,7 @@ owned by different processors. IMPORTANT NOTE: These functions are not compatible with the -DLAMMPS_BIGBIG setting when compiling LAMMPS. Dummy functions -that result in an error message and abort will be substiuted +that result in an error message and abort will be substituted instead of resulting in random crashes and memory corruption. The lammps_gather_atoms() function does this for all N atoms in the From 778537e73490d8e6c53f4bc2dd5bd5addcbb0246 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 22:32:15 -0400 Subject: [PATCH 49/68] update micelle example for improved reproducibility --- examples/micelle/in.micelle | 4 +- examples/micelle/in.micelle-rigid | 87 ++++++ examples/micelle/log.28Feb2019.micelle.g++.1 | 259 ---------------- examples/micelle/log.28Feb2019.micelle.g++.4 | 259 ---------------- .../micelle/log.28Feb2019.micelle.rigid.g++.1 | 290 ------------------ .../micelle/log.28Feb2019.micelle.rigid.g++.4 | 290 ------------------ .../micelle/log.29Mar2019.micelle-rigid.g++.1 | 260 ++++++++++++++++ .../micelle/log.29Mar2019.micelle-rigid.g++.4 | 260 ++++++++++++++++ examples/micelle/log.29Mar2019.micelle.g++.1 | 218 +++++++++++++ examples/micelle/log.29Mar2019.micelle.g++.4 | 218 +++++++++++++ 10 files changed, 1045 insertions(+), 1100 deletions(-) create mode 100644 examples/micelle/in.micelle-rigid delete mode 100644 examples/micelle/log.28Feb2019.micelle.g++.1 delete mode 100644 examples/micelle/log.28Feb2019.micelle.g++.4 delete mode 100644 examples/micelle/log.28Feb2019.micelle.rigid.g++.1 delete mode 100644 examples/micelle/log.28Feb2019.micelle.rigid.g++.4 create mode 100644 examples/micelle/log.29Mar2019.micelle-rigid.g++.1 create mode 100644 examples/micelle/log.29Mar2019.micelle-rigid.g++.4 create mode 100644 examples/micelle/log.29Mar2019.micelle.g++.1 create mode 100644 examples/micelle/log.29Mar2019.micelle.g++.4 diff --git a/examples/micelle/in.micelle b/examples/micelle/in.micelle index 2abdd18734..34bc9ad359 100644 --- a/examples/micelle/in.micelle +++ b/examples/micelle/in.micelle @@ -58,7 +58,7 @@ pair_coeff 1 4 1.0 1.0 1.12246 pair_coeff 2 3 1.0 0.88 1.12246 pair_coeff 2 4 1.0 0.75 1.12246 -thermo 1000 +thermo 50 #dump 1 all atom 2000 dump.micelle @@ -69,4 +69,4 @@ thermo 1000 #dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 reset_timestep 0 -run 60000 +run 1000 diff --git a/examples/micelle/in.micelle-rigid b/examples/micelle/in.micelle-rigid new file mode 100644 index 0000000000..93cb2655f8 --- /dev/null +++ b/examples/micelle/in.micelle-rigid @@ -0,0 +1,87 @@ +# 2d micelle simulation + +dimension 2 + +neighbor 0.3 bin +neigh_modify delay 5 + +atom_style bond + +# Soft potential push-off + +read_data data.micelle +special_bonds fene + +pair_style soft 1.12246 +pair_coeff * * 0.0 1.12246 + +bond_style harmonic +bond_coeff 1 50.0 0.75 + +velocity all create 0.45 2349852 + +variable prefactor equal ramp(1.0,20.0) + +fix 1 all nve +fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 +fix 3 all adapt 1 pair soft a * * v_prefactor +fix 4 all enforce2d + +thermo 50 +run 500 + +unfix 3 + +# Main run + +pair_style lj/cut 2.5 + +# solvent/head - full-size and long-range + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 2 2 1.0 1.0 2.5 +pair_coeff 1 2 1.0 1.0 2.5 + +# tail/tail - size-averaged and long-range + +pair_coeff 3 3 1.0 0.75 2.5 +pair_coeff 4 4 1.0 0.50 2.5 +pair_coeff 3 4 1.0 0.67 2.5 + +# solvent/tail - full-size and repulsive + +pair_coeff 1 3 1.0 1.0 1.12246 +pair_coeff 1 4 1.0 1.0 1.12246 + +# head/tail - size-averaged and repulsive + +pair_coeff 2 3 1.0 0.88 1.12246 +pair_coeff 2 4 1.0 0.75 1.12246 + +thermo 50 + +#dump 1 all atom 2000 dump.micelle + +#dump 2 all image 2000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +#dump 3 all movie 2000 movie.mpg type type zoom 1.6 +#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +reset_timestep 0 +group solvent molecule 0 +group solute subtract all solvent +unfix 1 +unfix 2 +unfix 4 +fix 1 solvent nve +fix 2 solvent temp/rescale 100 0.45 0.45 0.02 1.0 +fix 5 solute rigid molecule langevin 0.45 0.45 0.5 112211 +fix 4 all enforce2d +run 500 +unfix 2 +unfix 4 +unfix 5 +fix 5 solute rigid/small molecule +fix 4 all enforce2d +run 500 diff --git a/examples/micelle/log.28Feb2019.micelle.g++.1 b/examples/micelle/log.28Feb2019.micelle.g++.1 deleted file mode 100644 index c2bbc7cde4..0000000000 --- a/examples/micelle/log.28Feb2019.micelle.g++.1 +++ /dev/null @@ -1,259 +0,0 @@ -LAMMPS (28 Feb 2019) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:88) - using 1 OpenMP thread(s) per MPI task -# 2d micelle simulation - -dimension 2 - -neighbor 0.3 bin -neigh_modify delay 5 - -atom_style bond - -# Soft potential push-off - -read_data data.micelle - orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 1200 atoms - scanning bonds ... - 1 = max bonds/atom - reading bonds ... - 300 bonds - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.000394821 secs - read_data CPU = 0.00212336 secs -special_bonds fene - 2 = max # of 1-2 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.00018549 secs - -pair_style soft 1.12246 -pair_coeff * * 0.0 1.12246 - -bond_style harmonic -bond_coeff 1 50.0 0.75 - -velocity all create 0.45 2349852 - -variable prefactor equal ramp(1.0,20.0) - -fix 1 all nve -fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 -fix 3 all adapt 1 pair soft a * * v_prefactor -fix 4 all enforce2d - -thermo 50 -run 1000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.42246 - ghost atom cutoff = 1.42246 - binsize = 0.71123, bins = 51 51 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair soft, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.799 | 3.799 | 3.799 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 - 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 - 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 - 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 - 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 - 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 - 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 - 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 - 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 - 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 - 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 - 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 - 600 0.45 0.58193041 0.088386617 1.119942 5.131481 - 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 - 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 - 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 - 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 - 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 - 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 - 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 - 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 -Loop time of 0.113919 on 1 procs for 1000 steps with 1200 atoms - -Performance: 3792167.464 tau/day, 8778.165 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.076825 | 0.076825 | 0.076825 | 0.0 | 67.44 -Bond | 0.0041864 | 0.0041864 | 0.0041864 | 0.0 | 3.67 -Neigh | 0.017061 | 0.017061 | 0.017061 | 0.0 | 14.98 -Comm | 0.0019042 | 0.0019042 | 0.0019042 | 0.0 | 1.67 -Output | 0.00017285 | 0.00017285 | 0.00017285 | 0.0 | 0.15 -Modify | 0.011218 | 0.011218 | 0.011218 | 0.0 | 9.85 -Other | | 0.002551 | | | 2.24 - -Nlocal: 1200 ave 1200 max 1200 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 195 ave 195 max 195 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3136 ave 3136 max 3136 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 3136 -Ave neighs/atom = 2.61333 -Ave special neighs/atom = 0.5 -Neighbor list builds = 92 -Dangerous builds = 0 - -unfix 3 - -# Main run - -pair_style lj/cut 2.5 - -# solvent/head - full-size and long-range - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 2 2 1.0 1.0 2.5 -pair_coeff 1 2 1.0 1.0 2.5 - -# tail/tail - size-averaged and long-range - -pair_coeff 3 3 1.0 0.75 2.5 -pair_coeff 4 4 1.0 0.50 2.5 -pair_coeff 3 4 1.0 0.67 2.5 - -# solvent/tail - full-size and repulsive - -pair_coeff 1 3 1.0 1.0 1.12246 -pair_coeff 1 4 1.0 1.0 1.12246 - -# head/tail - size-averaged and repulsive - -pair_coeff 2 3 1.0 0.88 1.12246 -pair_coeff 2 4 1.0 0.75 1.12246 - -thermo 1000 - -#dump 1 all atom 2000 dump.micelle - -#dump 2 all image 2000 image.*.jpg type type zoom 1.6 -#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -#dump 3 all movie 2000 movie.mpg type type zoom 1.6 -#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -reset_timestep 0 -run 60000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 26 26 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.024 | 4.024 | 4.024 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 -1.7056163 0.08808163 -1.1679097 3.9431686 - 1000 0.45 -1.9727644 0.05860769 -1.4645317 1.9982326 - 2000 0.46143408 -1.9889684 0.058103225 -1.4698156 1.7806269 - 3000 0.44459291 -1.9997961 0.068724164 -1.4868496 1.4369618 - 4000 0.46939549 -2.0330437 0.073499424 -1.4905399 1.3780016 - 5000 0.44411088 -2.0339936 0.05862049 -1.5316323 1.2544164 - 6000 0.44034597 -2.0265475 0.066481992 -1.5200864 1.2362891 - 7000 0.45097378 -2.0331083 0.058467565 -1.5240428 1.2762333 - 8000 0.45797632 -2.0330255 0.060048036 -1.5153828 1.3862396 - 9000 0.45297811 -2.0383417 0.067056519 -1.5186845 1.2762554 - 10000 0.45 -2.0628269 0.065650067 -1.5475518 1.0566213 - 11000 0.44466757 -2.0593977 0.06190999 -1.5531907 1.1452469 - 12000 0.46743534 -2.0684295 0.061056278 -1.5403274 1.0824225 - 13000 0.45601091 -2.0689708 0.054868536 -1.5584713 0.96703283 - 14000 0.44111882 -2.0553174 0.058249816 -1.5563164 1.0986427 - 15000 0.43894405 -2.0866829 0.064117804 -1.5839869 0.90031836 - 16000 0.43856814 -2.0879319 0.056024166 -1.593705 0.96387323 - 17000 0.45977841 -2.103188 0.058097306 -1.5856955 0.83352919 - 18000 0.43423341 -2.0813151 0.066623991 -1.5808196 0.98157638 - 19000 0.44245939 -2.0851261 0.057637655 -1.5853978 0.84228341 - 20000 0.43144678 -2.0895403 0.06536727 -1.5930858 0.88177768 - 21000 0.45014968 -2.106686 0.059137572 -1.5977739 0.89408935 - 22000 0.4575126 -2.1024115 0.063013023 -1.5822672 0.84886734 - 23000 0.45 -2.10897 0.06724784 -1.5920971 0.66205013 - 24000 0.43055602 -2.0894725 0.061566464 -1.5977089 0.81764789 - 25000 0.4366384 -2.0926743 0.059609321 -1.5967905 0.85549875 - 26000 0.4521714 -2.0963996 0.062031863 -1.5825731 0.80137118 - 27000 0.45734834 -2.1060987 0.061712636 -1.5874188 0.82899415 - 28000 0.44803467 -2.0859226 0.061871856 -1.5763894 0.97007526 - 29000 0.45 -2.1106243 0.063825481 -1.5971738 0.63798376 - 30000 0.44932806 -2.1006036 0.053053934 -1.598596 0.63907113 - 31000 0.44713779 -2.1096164 0.066470416 -1.5963808 0.66832708 - 32000 0.4373357 -2.0941237 0.058871613 -1.5982808 0.78176106 - 33000 0.44030485 -2.105644 0.058804306 -1.6069017 0.66286458 - 34000 0.43781175 -2.1233209 0.064611206 -1.6212628 0.56342584 - 35000 0.45670132 -2.1059408 0.053049584 -1.5965705 0.73992396 - 36000 0.45555427 -2.1149877 0.057627709 -1.6021854 0.85854939 - 37000 0.44134236 -2.1106202 0.064444306 -1.6052013 0.74674603 - 38000 0.44812623 -2.1003681 0.057266258 -1.5953491 0.78239359 - 39000 0.44167062 -2.11141 0.055354 -1.6147534 0.7066385 - 40000 0.46103176 -2.1166687 0.062155412 -1.5938657 0.73620955 - 41000 0.44537102 -2.0993898 0.05631213 -1.5980778 0.87348756 - 42000 0.44752506 -2.1115212 0.057506521 -1.6068625 0.72999561 - 43000 0.4483886 -2.1184719 0.066943915 -1.6035131 0.78112063 - 44000 0.45944897 -2.0916657 0.055242781 -1.5773568 0.98660473 - 45000 0.46238513 -2.1163075 0.0530031 -1.6013046 0.74416054 - 46000 0.45979064 -2.1165545 0.060657581 -1.5964895 0.63516974 - 47000 0.45936546 -2.1140678 0.049931919 -1.6051532 0.76425182 - 48000 0.45424613 -2.1122681 0.061885599 -1.5965149 0.71981142 - 49000 0.44449524 -2.1147361 0.06626748 -1.6043438 0.78720467 - 50000 0.4641185 -2.1114668 0.055104874 -1.5926302 0.70195865 - 51000 0.44220655 -2.1075773 0.0589109 -1.6068283 0.73806859 - 52000 0.43097906 -2.1189493 0.061502241 -1.6268271 0.69622593 - 53000 0.45 -2.137688 0.053631829 -1.6344311 0.48269158 - 54000 0.43777118 -2.1089246 0.047098534 -1.6244197 0.70423814 - 55000 0.46061985 -2.1129502 0.062520353 -1.5901938 0.72492307 - 56000 0.4524841 -2.1195648 0.06580089 -1.6016569 0.52709892 - 57000 0.44914574 -2.1041993 0.061040876 -1.594387 0.7979988 - 58000 0.46446286 -2.1181238 0.055741995 -1.598306 0.51009146 - 59000 0.4632674 -2.1169321 0.050672678 -1.6033781 0.83110911 - 60000 0.46340478 -2.122846 0.058485209 -1.6013422 0.69966471 -Loop time of 8.01683 on 1 procs for 60000 steps with 1200 atoms - -Performance: 3233199.903 tau/day, 7484.259 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 | 5.4027 | 5.4027 | 5.4027 | 0.0 | 67.39 -Bond | 0.23585 | 0.23585 | 0.23585 | 0.0 | 2.94 -Neigh | 1.5188 | 1.5188 | 1.5188 | 0.0 | 18.95 -Comm | 0.14452 | 0.14452 | 0.14452 | 0.0 | 1.80 -Output | 0.00060487 | 0.00060487 | 0.00060487 | 0.0 | 0.01 -Modify | 0.56352 | 0.56352 | 0.56352 | 0.0 | 7.03 -Other | | 0.1508 | | | 1.88 - -Nlocal: 1200 ave 1200 max 1200 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 395 ave 395 max 395 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 9652 ave 9652 max 9652 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 9652 -Ave neighs/atom = 8.04333 -Ave special neighs/atom = 0.5 -Neighbor list builds = 4886 -Dangerous builds = 0 -Total wall time: 0:00:08 diff --git a/examples/micelle/log.28Feb2019.micelle.g++.4 b/examples/micelle/log.28Feb2019.micelle.g++.4 deleted file mode 100644 index 6af9051ed2..0000000000 --- a/examples/micelle/log.28Feb2019.micelle.g++.4 +++ /dev/null @@ -1,259 +0,0 @@ -LAMMPS (28 Feb 2019) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:88) - using 1 OpenMP thread(s) per MPI task -# 2d micelle simulation - -dimension 2 - -neighbor 0.3 bin -neigh_modify delay 5 - -atom_style bond - -# Soft potential push-off - -read_data data.micelle - orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 1200 atoms - scanning bonds ... - 1 = max bonds/atom - reading bonds ... - 300 bonds - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.000130415 secs - read_data CPU = 0.00132132 secs -special_bonds fene - 2 = max # of 1-2 neighbors - 2 = max # of special neighbors - special bonds CPU = 4.76837e-05 secs - -pair_style soft 1.12246 -pair_coeff * * 0.0 1.12246 - -bond_style harmonic -bond_coeff 1 50.0 0.75 - -velocity all create 0.45 2349852 - -variable prefactor equal ramp(1.0,20.0) - -fix 1 all nve -fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 -fix 3 all adapt 1 pair soft a * * v_prefactor -fix 4 all enforce2d - -thermo 50 -run 1000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.42246 - ghost atom cutoff = 1.42246 - binsize = 0.71123, bins = 51 51 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair soft, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.758 | 3.85 | 4.126 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 - 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 - 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 - 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 - 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 - 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 - 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 - 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 - 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 - 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 - 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 - 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 - 600 0.45 0.58193041 0.088386617 1.119942 5.131481 - 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 - 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 - 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 - 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 - 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 - 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 - 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 - 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 -Loop time of 0.0377742 on 4 procs for 1000 steps with 1200 atoms - -Performance: 11436375.633 tau/day, 26473.092 timesteps/s -96.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.016871 | 0.017299 | 0.018185 | 0.4 | 45.80 -Bond | 0.0010128 | 0.0010633 | 0.001116 | 0.1 | 2.81 -Neigh | 0.004832 | 0.0048565 | 0.0048807 | 0.0 | 12.86 -Comm | 0.0066509 | 0.0077528 | 0.0084352 | 0.8 | 20.52 -Output | 0.00022054 | 0.00028259 | 0.00046587 | 0.0 | 0.75 -Modify | 0.0035386 | 0.0036086 | 0.0036943 | 0.1 | 9.55 -Other | | 0.002912 | | | 7.71 - -Nlocal: 300 ave 305 max 292 min -Histogram: 1 0 0 0 0 0 1 0 1 1 -Nghost: 100.25 ave 108 max 93 min -Histogram: 1 0 1 0 0 0 1 0 0 1 -Neighs: 784 ave 815 max 739 min -Histogram: 1 0 0 0 0 0 1 1 0 1 - -Total # of neighbors = 3136 -Ave neighs/atom = 2.61333 -Ave special neighs/atom = 0.5 -Neighbor list builds = 92 -Dangerous builds = 0 - -unfix 3 - -# Main run - -pair_style lj/cut 2.5 - -# solvent/head - full-size and long-range - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 2 2 1.0 1.0 2.5 -pair_coeff 1 2 1.0 1.0 2.5 - -# tail/tail - size-averaged and long-range - -pair_coeff 3 3 1.0 0.75 2.5 -pair_coeff 4 4 1.0 0.50 2.5 -pair_coeff 3 4 1.0 0.67 2.5 - -# solvent/tail - full-size and repulsive - -pair_coeff 1 3 1.0 1.0 1.12246 -pair_coeff 1 4 1.0 1.0 1.12246 - -# head/tail - size-averaged and repulsive - -pair_coeff 2 3 1.0 0.88 1.12246 -pair_coeff 2 4 1.0 0.75 1.12246 - -thermo 1000 - -#dump 1 all atom 2000 dump.micelle - -#dump 2 all image 2000 image.*.jpg type type zoom 1.6 -#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -#dump 3 all movie 2000 movie.mpg type type zoom 1.6 -#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -reset_timestep 0 -run 60000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 26 26 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.001 | 4.032 | 4.124 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 -1.7056163 0.08808163 -1.1679097 3.9431686 - 1000 0.45 -1.9727652 0.058608073 -1.4645321 1.9982444 - 2000 0.44428815 -1.9902282 0.064240544 -1.4820698 1.7051263 - 3000 0.46641766 -1.9856844 0.065017468 -1.4546379 1.6939772 - 4000 0.45734058 -2.0242583 0.070494626 -1.4968042 1.3474276 - 5000 0.44904747 -2.0086954 0.058801142 -1.501221 1.4632351 - 6000 0.44961405 -2.0334509 0.05721299 -1.5269985 1.3093586 - 7000 0.45474928 -2.0453645 0.064725006 -1.5262692 1.1581035 - 8000 0.44274767 -2.0375379 0.062216035 -1.5329431 1.312914 - 9000 0.46176571 -2.0473031 0.065581966 -1.5203402 1.2013868 - 10000 0.45046977 -2.0540466 0.065402724 -1.5385495 0.95819581 - 11000 0.45016671 -2.0610028 0.056993955 -1.5542172 1.0433435 - 12000 0.43823039 -2.073155 0.065171939 -1.5701178 1.1400059 - 13000 0.44482161 -2.0678338 0.063901045 -1.5594819 0.97993813 - 14000 0.45 -2.0892562 0.061753632 -1.5778776 0.89841778 - 15000 0.44328626 -2.0859346 0.059956258 -1.5830615 0.90664821 - 16000 0.45666508 -2.0859262 0.059582346 -1.5700593 0.9702235 - 17000 0.44832038 -2.0762124 0.059153394 -1.5691122 0.93020504 - 18000 0.4555831 -2.0844959 0.057986324 -1.5713062 0.87398232 - 19000 0.45257867 -2.0671736 0.062190389 -1.5527816 0.89208496 - 20000 0.44010419 -2.1020944 0.062053708 -1.6003033 0.84140973 - 21000 0.45239369 -2.0820308 0.060981799 -1.5690323 0.98502522 - 22000 0.44607468 -2.0820602 0.051731316 -1.5846259 0.86120529 - 23000 0.45088473 -2.0865286 0.05727778 -1.5787418 1.1479844 - 24000 0.45526919 -2.1086678 0.057378327 -1.5963997 0.86944138 - 25000 0.46536624 -2.1055425 0.05665328 -1.5839108 0.72895438 - 26000 0.46716668 -2.1035267 0.057498747 -1.5792505 0.85105386 - 27000 0.44374699 -2.0932213 0.060937242 -1.5889069 0.93200759 - 28000 0.45944001 -2.0968869 0.053052954 -1.5847768 0.78909249 - 29000 0.4543632 -2.10493 0.061511018 -1.5894345 0.85862527 - 30000 0.44987776 -2.0942536 0.062431086 -1.5823197 0.7349894 - 31000 0.43829016 -2.0951259 0.060245682 -1.5969553 0.86702973 - 32000 0.45416601 -2.0991679 0.055978905 -1.5894015 0.75777153 - 33000 0.4605079 -2.1118364 0.058205688 -1.5935066 0.86041104 - 34000 0.43638213 -2.0925345 0.067533519 -1.5889825 0.85100425 - 35000 0.46912252 -2.1082718 0.051646432 -1.5878938 0.73613751 - 36000 0.45 -2.0966442 0.052507159 -1.5945121 0.88722487 - 37000 0.44970507 -2.1029685 0.065454263 -1.588184 0.76033821 - 38000 0.44910233 -2.097751 0.05767009 -1.5913528 0.95830923 - 39000 0.4322161 -2.1060426 0.062453704 -1.611733 0.74681695 - 40000 0.46143858 -2.1328575 0.057333011 -1.6144704 0.58326322 - 41000 0.43180549 -2.1070656 0.064150563 -1.6114694 0.82842684 - 42000 0.46738909 -2.1067947 0.058017036 -1.5817781 0.73292362 - 43000 0.43699124 -2.1171964 0.062817262 -1.6177521 0.73354741 - 44000 0.45262916 -2.1281307 0.055228619 -1.6206502 0.64167946 - 45000 0.43905419 -2.088789 0.055597999 -1.5945027 0.8002542 - 46000 0.44485569 -2.1035061 0.067828181 -1.5911929 0.71861494 - 47000 0.44496824 -2.0968296 0.0632326 -1.5889996 0.75202899 - 48000 0.46567244 -2.1235948 0.061032118 -1.5972783 0.64094556 - 49000 0.43202506 -2.0986097 0.053464022 -1.6134806 0.83857984 - 50000 0.45454698 -2.1263344 0.058119708 -1.6140465 0.67030037 - 51000 0.43702766 -2.1292347 0.074047424 -1.6185238 0.52896462 - 52000 0.46367081 -2.1177288 0.06726625 -1.5871781 0.74343227 - 53000 0.45 -2.1341074 0.062769314 -1.6217131 0.51130365 - 54000 0.44862492 -2.1272108 0.057723381 -1.6212364 0.54735429 - 55000 0.44926027 -2.1350444 0.066186625 -1.6199719 0.66821299 - 56000 0.4544227 -2.1325537 0.065298628 -1.6132111 0.63597556 - 57000 0.45697003 -2.1323238 0.053312855 -1.6224218 0.55572633 - 58000 0.45698902 -2.1043208 0.055835989 -1.5918766 0.63502658 - 59000 0.4425306 -2.1120353 0.056617261 -1.6132563 0.65681272 - 60000 0.44319296 -2.1171981 0.058330294 -1.6160442 0.63602511 -Loop time of 2.63918 on 4 procs for 60000 steps with 1200 atoms - -Performance: 9821248.084 tau/day, 22734.371 timesteps/s -97.3% 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.1742 | 1.278 | 1.3471 | 5.9 | 48.43 -Bond | 0.046621 | 0.06565 | 0.081322 | 5.1 | 2.49 -Neigh | 0.46642 | 0.46917 | 0.47105 | 0.3 | 17.78 -Comm | 0.47295 | 0.55928 | 0.67758 | 10.5 | 21.19 -Output | 0.00073624 | 0.00173 | 0.0047016 | 4.1 | 0.07 -Modify | 0.14511 | 0.15226 | 0.15887 | 1.5 | 5.77 -Other | | 0.1131 | | | 4.28 - -Nlocal: 300 ave 309 max 281 min -Histogram: 1 0 0 0 0 0 0 1 0 2 -Nghost: 232.75 ave 234 max 231 min -Histogram: 1 0 0 1 0 0 0 0 0 2 -Neighs: 2450.25 ave 2576 max 2179 min -Histogram: 1 0 0 0 0 0 0 0 1 2 - -Total # of neighbors = 9801 -Ave neighs/atom = 8.1675 -Ave special neighs/atom = 0.5 -Neighbor list builds = 4887 -Dangerous builds = 0 -Total wall time: 0:00:02 diff --git a/examples/micelle/log.28Feb2019.micelle.rigid.g++.1 b/examples/micelle/log.28Feb2019.micelle.rigid.g++.1 deleted file mode 100644 index ec0079818d..0000000000 --- a/examples/micelle/log.28Feb2019.micelle.rigid.g++.1 +++ /dev/null @@ -1,290 +0,0 @@ -LAMMPS (28 Feb 2019) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:88) - using 1 OpenMP thread(s) per MPI task -# 2d micelle simulation - -dimension 2 - -neighbor 0.3 bin -neigh_modify delay 5 - -atom_style bond - -# Soft potential push-off - -read_data data.micelle - orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 1200 atoms - scanning bonds ... - 1 = max bonds/atom - reading bonds ... - 300 bonds - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.000271559 secs - read_data CPU = 0.00115585 secs -special_bonds fene - 2 = max # of 1-2 neighbors - 2 = max # of special neighbors - special bonds CPU = 8.39233e-05 secs - -pair_style soft 1.12246 -pair_coeff * * 0.0 1.12246 - -bond_style harmonic -bond_coeff 1 50.0 0.75 - -velocity all create 0.45 2349852 - -variable prefactor equal ramp(1.0,20.0) - -fix 1 all nve -fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 -fix 3 all adapt 1 pair soft a * * v_prefactor -fix 4 all enforce2d - -thermo 50 -run 1000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.42246 - ghost atom cutoff = 1.42246 - binsize = 0.71123, bins = 51 51 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair soft, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.799 | 3.799 | 3.799 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 - 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 - 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 - 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 - 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 - 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 - 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 - 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 - 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 - 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 - 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 - 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 - 600 0.45 0.58193041 0.088386617 1.119942 5.131481 - 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 - 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 - 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 - 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 - 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 - 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 - 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 - 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 -Loop time of 0.107201 on 1 procs for 1000 steps with 1200 atoms - -Performance: 4029800.456 tau/day, 9328.242 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.072035 | 0.072035 | 0.072035 | 0.0 | 67.20 -Bond | 0.0039918 | 0.0039918 | 0.0039918 | 0.0 | 3.72 -Neigh | 0.016078 | 0.016078 | 0.016078 | 0.0 | 15.00 -Comm | 0.0018375 | 0.0018375 | 0.0018375 | 0.0 | 1.71 -Output | 0.00016379 | 0.00016379 | 0.00016379 | 0.0 | 0.15 -Modify | 0.010665 | 0.010665 | 0.010665 | 0.0 | 9.95 -Other | | 0.002429 | | | 2.27 - -Nlocal: 1200 ave 1200 max 1200 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 195 ave 195 max 195 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3136 ave 3136 max 3136 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 3136 -Ave neighs/atom = 2.61333 -Ave special neighs/atom = 0.5 -Neighbor list builds = 92 -Dangerous builds = 0 - -unfix 3 - -# Main run - -pair_style lj/cut 2.5 - -# solvent/head - full-size and long-range - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 2 2 1.0 1.0 2.5 -pair_coeff 1 2 1.0 1.0 2.5 - -# tail/tail - size-averaged and long-range - -pair_coeff 3 3 1.0 0.75 2.5 -pair_coeff 4 4 1.0 0.50 2.5 -pair_coeff 3 4 1.0 0.67 2.5 - -# solvent/tail - full-size and repulsive - -pair_coeff 1 3 1.0 1.0 1.12246 -pair_coeff 1 4 1.0 1.0 1.12246 - -# head/tail - size-averaged and repulsive - -pair_coeff 2 3 1.0 0.88 1.12246 -pair_coeff 2 4 1.0 0.75 1.12246 - -thermo 1000 - -#dump 1 all atom 2000 dump.micelle - -#dump 2 all image 2000 image.*.jpg type type zoom 1.6 -#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -#dump 3 all movie 2000 movie.mpg type type zoom 1.6 -#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -reset_timestep 0 -group solvent molecule 0 -750 atoms in group solvent -group solute subtract all solvent -450 atoms in group solute -unfix 1 -unfix 2 -unfix 4 -fix 1 solvent nve -fix 2 solvent temp/rescale 100 0.45 0.45 0.02 1.0 -fix 5 solute rigid molecule langevin 0.45 0.45 0.5 112211 -150 rigid bodies with 450 atoms -fix 4 all enforce2d -run 20000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 26 26 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.274 | 5.274 | 5.274 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.44603578 -1.7056163 0.08808163 -1.2555023 3.4039736 - 1000 0.46008168 -1.9040837 0.08808163 -1.4425691 0.93225457 - 2000 0.44520658 -1.9317253 0.08808163 -1.4822843 3.8192896 - 3000 0.43988556 -1.945898 0.08808163 -1.5007759 3.0371634 - 4000 0.4646519 -1.9753553 0.08808163 -1.5101312 -1.8041178 - 5000 0.4362993 -1.9763715 0.08808163 -1.5341603 1.5037284 - 6000 0.47007384 -1.9833154 0.08808163 -1.5136905 2.1227653 - 7000 0.44854623 -1.9914288 0.08808163 -1.5392772 3.9458099 - 8000 0.43841372 -1.9779603 0.08808163 -1.5340328 -4.5429769 - 9000 0.4518303 -1.9834387 0.08808163 -1.5286215 4.4230447 - 10000 0.43562904 -2.001471 0.08808163 -1.5598038 1.8919582 - 11000 0.44014575 -1.9820611 0.08808163 -1.5367278 -2.1189418 - 12000 0.44466956 -2.0134014 0.08808163 -1.5643963 -2.5218497 - 13000 0.45274369 -2.021443 0.08808163 -1.5658844 2.4795173 - 14000 0.44742645 -2.011108 0.08808163 -1.5598653 -0.74697767 - 15000 0.4674843 -2.024737 0.08808163 -1.5572139 -1.9539999 - 16000 0.45610154 -2.0401029 0.08808163 -1.5818189 -0.53082066 - 17000 0.44679292 -2.0365577 0.08808163 -1.5858291 -6.5040295 - 18000 0.44279107 -2.0500326 0.08808163 -1.6025522 -0.051597102 - 19000 0.45603993 -2.0306289 0.08808163 -1.5723948 1.0986608 - 20000 0.44519606 -2.0412229 0.08808163 -1.5917904 -1.0406746 -Loop time of 3.68102 on 1 procs for 20000 steps with 1200 atoms - -Performance: 2347175.802 tau/day, 5433.277 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 | 1.7349 | 1.7349 | 1.7349 | 0.0 | 47.13 -Bond | 0.079483 | 0.079483 | 0.079483 | 0.0 | 2.16 -Neigh | 0.49063 | 0.49063 | 0.49063 | 0.0 | 13.33 -Comm | 0.049093 | 0.049093 | 0.049093 | 0.0 | 1.33 -Output | 0.00022578 | 0.00022578 | 0.00022578 | 0.0 | 0.01 -Modify | 1.273 | 1.273 | 1.273 | 0.0 | 34.58 -Other | | 0.05369 | | | 1.46 - -Nlocal: 1200 ave 1200 max 1200 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 395 ave 395 max 395 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 8915 ave 8915 max 8915 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8915 -Ave neighs/atom = 7.42917 -Ave special neighs/atom = 0.5 -Neighbor list builds = 1580 -Dangerous builds = 0 -unfix 5 -unfix 4 -fix 5 solute rigid/small molecule langevin 0.45 0.45 0.5 112211 - create bodies CPU = 0.00012517 secs -150 rigid bodies with 450 atoms - 1.04536 = max distance from body owner to body atom -fix 4 all enforce2d -run 20000 -Per MPI rank memory allocation (min/avg/max) = 8.633 | 8.633 | 8.633 Mbytes -Step Temp E_pair E_mol TotEng Press - 20000 0.44519606 -2.0412229 0.08808163 -1.5917904 1.3058893 - 21000 0.4353376 -2.0483342 0.08808163 -1.6069035 0.53023317 - 22000 0.44034324 -2.0416876 0.08808163 -1.5961941 4.0327077 - 23000 0.4685403 -2.05295 0.08808163 -1.5845698 3.6792349 - 24000 0.44872075 -2.0320623 0.08808163 -1.579769 -2.0476923 - 25000 0.46829594 -2.0671408 0.08808163 -1.5989589 2.180811 - 26000 0.45257544 -2.0418792 0.08808163 -1.5864572 3.3924018 - 27000 0.44269664 -2.0409905 0.08808163 -1.5935868 -0.17012673 - 28000 0.46961216 -2.0552479 0.08808163 -1.5859978 -7.2870888 - 29000 0.46683129 -2.0438334 0.08808163 -1.5768404 3.0583141 - 30000 0.44262228 -2.036737 0.08808163 -1.5893937 0.087520915 - 31000 0.43517227 -2.0479672 0.08808163 -1.6066708 -0.3426009 - 32000 0.44543779 -2.0538031 0.08808163 -1.6041744 -0.2093148 - 33000 0.44629079 -2.0409901 0.08808163 -1.5906691 3.310113 - 34000 0.43058831 -2.0713827 0.08808163 -1.6338069 0.14128843 - 35000 0.44546512 -2.0427068 0.08808163 -1.593056 -3.1386697 - 36000 0.42971129 -2.0527435 0.08808163 -1.6158795 -2.7334963 - 37000 0.44707969 -2.0461803 0.08808163 -1.595219 -3.8777678 - 38000 0.43150818 -2.0435276 0.08808163 -1.6052052 0.2905487 - 39000 0.44463343 -2.0522113 0.08808163 -1.6032355 3.543123 - 40000 0.44582593 -2.052213 0.08808163 -1.6022693 1.1486536 -Loop time of 3.69012 on 1 procs for 20000 steps with 1200 atoms - -Performance: 2341388.948 tau/day, 5419.882 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 | 1.756 | 1.756 | 1.756 | 0.0 | 47.59 -Bond | 0.079221 | 0.079221 | 0.079221 | 0.0 | 2.15 -Neigh | 0.49085 | 0.49085 | 0.49085 | 0.0 | 13.30 -Comm | 0.048317 | 0.048317 | 0.048317 | 0.0 | 1.31 -Output | 0.0002315 | 0.0002315 | 0.0002315 | 0.0 | 0.01 -Modify | 1.2616 | 1.2616 | 1.2616 | 0.0 | 34.19 -Other | | 0.05386 | | | 1.46 - -Nlocal: 1200 ave 1200 max 1200 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 393 ave 393 max 393 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 9091 ave 9091 max 9091 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 9091 -Ave neighs/atom = 7.57583 -Ave special neighs/atom = 0.5 -Neighbor list builds = 1582 -Dangerous builds = 0 -Total wall time: 0:00:07 diff --git a/examples/micelle/log.28Feb2019.micelle.rigid.g++.4 b/examples/micelle/log.28Feb2019.micelle.rigid.g++.4 deleted file mode 100644 index a6687a3c00..0000000000 --- a/examples/micelle/log.28Feb2019.micelle.rigid.g++.4 +++ /dev/null @@ -1,290 +0,0 @@ -LAMMPS (28 Feb 2019) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:88) - using 1 OpenMP thread(s) per MPI task -# 2d micelle simulation - -dimension 2 - -neighbor 0.3 bin -neigh_modify delay 5 - -atom_style bond - -# Soft potential push-off - -read_data data.micelle - orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 1200 atoms - scanning bonds ... - 1 = max bonds/atom - reading bonds ... - 300 bonds - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.000175714 secs - read_data CPU = 0.00145626 secs -special_bonds fene - 2 = max # of 1-2 neighbors - 2 = max # of special neighbors - special bonds CPU = 7.22408e-05 secs - -pair_style soft 1.12246 -pair_coeff * * 0.0 1.12246 - -bond_style harmonic -bond_coeff 1 50.0 0.75 - -velocity all create 0.45 2349852 - -variable prefactor equal ramp(1.0,20.0) - -fix 1 all nve -fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 -fix 3 all adapt 1 pair soft a * * v_prefactor -fix 4 all enforce2d - -thermo 50 -run 1000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.42246 - ghost atom cutoff = 1.42246 - binsize = 0.71123, bins = 51 51 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair soft, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.758 | 3.85 | 4.126 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 - 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 - 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 - 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 - 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 - 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 - 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 - 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 - 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 - 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 - 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 - 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 - 600 0.45 0.58193041 0.088386617 1.119942 5.131481 - 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 - 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 - 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 - 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 - 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 - 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 - 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 - 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 -Loop time of 0.0389124 on 4 procs for 1000 steps with 1200 atoms - -Performance: 11101855.138 tau/day, 25698.739 timesteps/s -95.7% 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.016776 | 0.017405 | 0.018435 | 0.5 | 44.73 -Bond | 0.0010033 | 0.0011995 | 0.0015519 | 0.6 | 3.08 -Neigh | 0.0044944 | 0.0045093 | 0.0045218 | 0.0 | 11.59 -Comm | 0.0080328 | 0.0093863 | 0.010242 | 0.9 | 24.12 -Output | 0.00021577 | 0.00027579 | 0.00045323 | 0.0 | 0.71 -Modify | 0.0034575 | 0.0036355 | 0.0040002 | 0.4 | 9.34 -Other | | 0.002501 | | | 6.43 - -Nlocal: 300 ave 305 max 292 min -Histogram: 1 0 0 0 0 0 1 0 1 1 -Nghost: 100.25 ave 108 max 93 min -Histogram: 1 0 1 0 0 0 1 0 0 1 -Neighs: 784 ave 815 max 739 min -Histogram: 1 0 0 0 0 0 1 1 0 1 - -Total # of neighbors = 3136 -Ave neighs/atom = 2.61333 -Ave special neighs/atom = 0.5 -Neighbor list builds = 92 -Dangerous builds = 0 - -unfix 3 - -# Main run - -pair_style lj/cut 2.5 - -# solvent/head - full-size and long-range - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 2 2 1.0 1.0 2.5 -pair_coeff 1 2 1.0 1.0 2.5 - -# tail/tail - size-averaged and long-range - -pair_coeff 3 3 1.0 0.75 2.5 -pair_coeff 4 4 1.0 0.50 2.5 -pair_coeff 3 4 1.0 0.67 2.5 - -# solvent/tail - full-size and repulsive - -pair_coeff 1 3 1.0 1.0 1.12246 -pair_coeff 1 4 1.0 1.0 1.12246 - -# head/tail - size-averaged and repulsive - -pair_coeff 2 3 1.0 0.88 1.12246 -pair_coeff 2 4 1.0 0.75 1.12246 - -thermo 1000 - -#dump 1 all atom 2000 dump.micelle - -#dump 2 all image 2000 image.*.jpg type type zoom 1.6 -#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -#dump 3 all movie 2000 movie.mpg type type zoom 1.6 -#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 - -reset_timestep 0 -group solvent molecule 0 -750 atoms in group solvent -group solute subtract all solvent -450 atoms in group solute -unfix 1 -unfix 2 -unfix 4 -fix 1 solvent nve -fix 2 solvent temp/rescale 100 0.45 0.45 0.02 1.0 -fix 5 solute rigid molecule langevin 0.45 0.45 0.5 112211 -150 rigid bodies with 450 atoms -fix 4 all enforce2d -run 20000 -Neighbor list info ... - update every 1 steps, delay 5 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 26 26 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.251 | 5.282 | 5.374 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 0.44603578 -1.7056163 0.08808163 -1.2555023 3.4039736 - 1000 0.46008163 -1.9040835 0.08808163 -1.4425689 0.93225869 - 2000 0.44943348 -1.9355135 0.08808163 -1.4826417 3.8399671 - 3000 0.4448437 -1.9480307 0.08808163 -1.4988842 2.5506553 - 4000 0.46013872 -1.9783821 0.08808163 -1.5168212 -1.8963215 - 5000 0.45520233 -1.9659462 0.08808163 -1.5083921 1.9238897 - 6000 0.44942049 -1.9663403 0.08808163 -1.513479 3.0633512 - 7000 0.45975758 -1.988462 0.08808163 -1.5272105 4.8267309 - 8000 0.45125238 -1.9913522 0.08808163 -1.5370041 -4.6644852 - 9000 0.45863606 -1.9792375 0.08808163 -1.5188962 4.3655071 - 10000 0.46264541 -1.9864611 0.08808163 -1.5228656 2.2176464 - 11000 0.45048361 -1.9907235 0.08808163 -1.5369994 -0.055360699 - 12000 0.44536719 -2.012875 0.08808163 -1.5633037 -0.2583823 - 13000 0.44212663 -2.0060111 0.08808163 -1.55907 3.3616171 - 14000 0.44984353 -2.0335408 0.08808163 -1.5803361 -0.21585645 - 15000 0.44896672 -2.0385265 0.08808163 -1.5860335 -4.6186206 - 16000 0.46694997 -2.032795 0.08808163 -1.5657056 0.53443281 - 17000 0.43208201 -2.0272255 0.08808163 -1.5884373 -6.5239975 - 18000 0.43281873 -2.0331268 0.08808163 -1.5937406 -0.048319943 - 19000 0.44704527 -2.0286742 0.08808163 -1.5777408 1.6356417 - 20000 0.44279735 -2.0443561 0.08808163 -1.5968706 -3.8337952 -Loop time of 1.71924 on 4 procs for 20000 steps with 1200 atoms - -Performance: 5025468.853 tau/day, 11633.030 timesteps/s -98.2% 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.39864 | 0.40873 | 0.42192 | 1.6 | 23.77 -Bond | 0.02118 | 0.021816 | 0.022785 | 0.4 | 1.27 -Neigh | 0.13931 | 0.14031 | 0.14117 | 0.2 | 8.16 -Comm | 0.13974 | 0.15328 | 0.16884 | 3.3 | 8.92 -Output | 0.00026131 | 0.00044435 | 0.00099206 | 0.0 | 0.03 -Modify | 0.93275 | 0.94138 | 0.95072 | 0.7 | 54.76 -Other | | 0.05327 | | | 3.10 - -Nlocal: 300 ave 303 max 298 min -Histogram: 1 0 1 0 1 0 0 0 0 1 -Nghost: 218.5 ave 226 max 215 min -Histogram: 2 1 0 0 0 0 0 0 0 1 -Neighs: 2258.75 ave 2283 max 2216 min -Histogram: 1 0 0 0 0 0 1 0 1 1 - -Total # of neighbors = 9035 -Ave neighs/atom = 7.52917 -Ave special neighs/atom = 0.5 -Neighbor list builds = 1580 -Dangerous builds = 0 -unfix 5 -unfix 4 -fix 5 solute rigid/small molecule langevin 0.45 0.45 0.5 112211 - create bodies CPU = 5.43594e-05 secs -150 rigid bodies with 450 atoms - 0.916597 = max distance from body owner to body atom -fix 4 all enforce2d -run 20000 -Per MPI rank memory allocation (min/avg/max) = 8.568 | 8.6 | 8.691 Mbytes -Step Temp E_pair E_mol TotEng Press - 20000 0.44279735 -2.0443561 0.08808163 -1.5968706 -1.033643 - 21000 0.4529129 -2.049461 0.08808163 -1.5937651 0.93160285 - 22000 0.45039188 -2.0530092 0.08808163 -1.5993595 -0.10608965 - 23000 0.45261583 -2.0336042 0.08808163 -1.5781494 -2.5769871 - 24000 0.4608331 -2.0404645 0.08808163 -1.57834 3.1931675 - 25000 0.43479001 -2.0617104 0.08808163 -1.6207242 2.8190122 - 26000 0.47009651 -2.0754873 0.08808163 -1.605844 -0.9158501 - 27000 0.45002704 -2.0782104 0.08808163 -1.6248568 0.98629661 - 28000 0.45126136 -2.0592619 0.08808163 -1.6049065 0.03305448 - 29000 0.44355328 -2.0572858 0.08808163 -1.6091868 -6.0797989 - 30000 0.45053899 -2.0530953 0.08808163 -1.5993261 0.38382951 - 31000 0.46931923 -2.0718827 0.08808163 -1.6028703 2.2346891 - 32000 0.45348857 -2.0744024 0.08808163 -1.6182393 4.5028966 - 33000 0.44767742 -2.0597127 0.08808163 -1.6082662 -2.8021641 - 34000 0.45287544 -2.0857303 0.08808163 -1.6300648 -5.384091 - 35000 0.44743898 -2.0927246 0.08808163 -1.6414717 1.4800508 - 36000 0.45627028 -2.0720546 0.08808163 -1.6136336 -2.9961696 - 37000 0.4641334 -2.0701098 0.08808163 -1.6053065 8.4186854 - 38000 0.45922901 -2.0962331 0.08808163 -1.6354106 0.38361763 - 39000 0.4692834 -2.0573815 0.08808163 -1.5883982 -2.2177345 - 40000 0.46206931 -2.057851 0.08808163 -1.5947231 -1.0405727 -Loop time of 1.25476 on 4 procs for 20000 steps with 1200 atoms - -Performance: 6885775.862 tau/day, 15939.296 timesteps/s -98.1% 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.40627 | 0.43037 | 0.45515 | 2.6 | 34.30 -Bond | 0.020504 | 0.021573 | 0.022739 | 0.5 | 1.72 -Neigh | 0.14337 | 0.14438 | 0.1453 | 0.2 | 11.51 -Comm | 0.13776 | 0.16647 | 0.19351 | 5.0 | 13.27 -Output | 0.00025082 | 0.00052994 | 0.0013635 | 0.0 | 0.04 -Modify | 0.45467 | 0.45822 | 0.46259 | 0.5 | 36.52 -Other | | 0.03321 | | | 2.65 - -Nlocal: 300 ave 304 max 293 min -Histogram: 1 0 0 0 0 1 0 0 0 2 -Nghost: 215.25 ave 217 max 213 min -Histogram: 1 0 0 0 0 1 0 1 0 1 -Neighs: 2340 ave 2378 max 2290 min -Histogram: 1 0 0 1 0 0 0 0 0 2 - -Total # of neighbors = 9360 -Ave neighs/atom = 7.8 -Ave special neighs/atom = 0.5 -Neighbor list builds = 1579 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/micelle/log.29Mar2019.micelle-rigid.g++.1 b/examples/micelle/log.29Mar2019.micelle-rigid.g++.1 new file mode 100644 index 0000000000..f1001e6cea --- /dev/null +++ b/examples/micelle/log.29Mar2019.micelle-rigid.g++.1 @@ -0,0 +1,260 @@ +LAMMPS (29 Mar 2019) + using 1 OpenMP thread(s) per MPI task +# 2d micelle simulation + +dimension 2 + +neighbor 0.3 bin +neigh_modify delay 5 + +atom_style bond + +# Soft potential push-off + +read_data data.micelle + orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1200 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 300 bonds + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000473022 secs + read_data CPU = 0.0024147 secs +special_bonds fene + 2 = max # of 1-2 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.00022316 secs + +pair_style soft 1.12246 +pair_coeff * * 0.0 1.12246 + +bond_style harmonic +bond_coeff 1 50.0 0.75 + +velocity all create 0.45 2349852 + +variable prefactor equal ramp(1.0,20.0) + +fix 1 all nve +fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 +fix 3 all adapt 1 pair soft a * * v_prefactor +fix 4 all enforce2d + +thermo 50 +run 500 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.42246 + ghost atom cutoff = 1.42246 + binsize = 0.71123, bins = 51 51 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair soft, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.799 | 3.799 | 3.799 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 + 50 0.54981866 0.93548899 0.068440043 1.5532895 1.9232786 + 100 0.45 0.99659327 0.079228519 1.5254468 3.2135679 + 150 0.86965411 0.90456016 0.07493355 1.8484231 4.3821925 + 200 0.45 1.01454 0.10663502 1.5708 4.7598476 + 250 0.79636561 0.82567712 0.12105337 1.7424325 5.4983899 + 300 0.45 0.86475538 0.11819875 1.4325791 5.8554758 + 350 0.72135464 0.70693069 0.10912636 1.5368106 6.0388247 + 400 0.45 0.75067331 0.14165013 1.3419484 6.3840708 + 450 0.64839221 0.62402486 0.14173679 1.4136135 6.4791009 + 500 0.45 0.66669513 0.13695201 1.2532721 6.807146 +Loop time of 0.103162 on 1 procs for 500 steps with 1200 atoms + +Performance: 2093802.885 tau/day, 4846.766 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 | 0.068308 | 0.068308 | 0.068308 | 0.0 | 66.21 +Bond | 0.004235 | 0.004235 | 0.004235 | 0.0 | 4.11 +Neigh | 0.014069 | 0.014069 | 0.014069 | 0.0 | 13.64 +Comm | 0.0019219 | 0.0019219 | 0.0019219 | 0.0 | 1.86 +Output | 0.00017262 | 0.00017262 | 0.00017262 | 0.0 | 0.17 +Modify | 0.011728 | 0.011728 | 0.011728 | 0.0 | 11.37 +Other | | 0.002726 | | | 2.64 + +Nlocal: 1200 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 197 ave 197 max 197 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3094 ave 3094 max 3094 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3094 +Ave neighs/atom = 2.57833 +Ave special neighs/atom = 0.5 +Neighbor list builds = 52 +Dangerous builds = 0 + +unfix 3 + +# Main run + +pair_style lj/cut 2.5 + +# solvent/head - full-size and long-range + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 2 2 1.0 1.0 2.5 +pair_coeff 1 2 1.0 1.0 2.5 + +# tail/tail - size-averaged and long-range + +pair_coeff 3 3 1.0 0.75 2.5 +pair_coeff 4 4 1.0 0.50 2.5 +pair_coeff 3 4 1.0 0.67 2.5 + +# solvent/tail - full-size and repulsive + +pair_coeff 1 3 1.0 1.0 1.12246 +pair_coeff 1 4 1.0 1.0 1.12246 + +# head/tail - size-averaged and repulsive + +pair_coeff 2 3 1.0 0.88 1.12246 +pair_coeff 2 4 1.0 0.75 1.12246 + +thermo 50 + +#dump 1 all atom 2000 dump.micelle + +#dump 2 all image 2000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +#dump 3 all movie 2000 movie.mpg type type zoom 1.6 +#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +reset_timestep 0 +group solvent molecule 0 +750 atoms in group solvent +group solute subtract all solvent +450 atoms in group solute +unfix 1 +unfix 2 +unfix 4 +fix 1 solvent nve +fix 2 solvent temp/rescale 100 0.45 0.45 0.02 1.0 +fix 5 solute rigid molecule langevin 0.45 0.45 0.5 112211 +150 rigid bodies with 450 atoms +fix 4 all enforce2d +run 500 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 26 26 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.274 | 5.274 | 5.274 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45318168 -1.3753652 0.13695201 -0.8705807 1.975423 + 50 0.77871641 -1.6955252 0.13695201 -0.92651507 0.64222539 + 100 0.5336062 -1.7124572 0.13695201 -1.1423948 -0.11959696 + 150 0.58789067 -1.7926109 0.13695201 -1.1784877 1.2592743 + 200 0.47864796 -1.8040298 0.13695201 -1.2785752 3.6739793 + 250 0.51124651 -1.8614797 0.13695201 -1.309566 2.5817722 + 300 0.45695639 -1.8708384 0.13695201 -1.3629901 3.0833794 + 350 0.477504 -1.8924359 0.13695201 -1.3679098 -5.1605926 + 400 0.45328205 -1.87754 0.13695201 -1.372674 -4.0355858 + 450 0.47465031 -1.9071924 0.13695201 -1.3849826 3.1949617 + 500 0.45533691 -1.9072316 0.13695201 -1.4006978 0.48079061 +Loop time of 0.178806 on 1 procs for 500 steps with 1200 atoms + +Performance: 1208012.705 tau/day, 2796.326 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 | 0.086131 | 0.086131 | 0.086131 | 0.0 | 48.17 +Bond | 0.0042472 | 0.0042472 | 0.0042472 | 0.0 | 2.38 +Neigh | 0.021317 | 0.021317 | 0.021317 | 0.0 | 11.92 +Comm | 0.0025985 | 0.0025985 | 0.0025985 | 0.0 | 1.45 +Output | 0.000175 | 0.000175 | 0.000175 | 0.0 | 0.10 +Modify | 0.061408 | 0.061408 | 0.061408 | 0.0 | 34.34 +Other | | 0.00293 | | | 1.64 + +Nlocal: 1200 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 416 ave 416 max 416 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 8769 ave 8769 max 8769 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8769 +Ave neighs/atom = 7.3075 +Ave special neighs/atom = 0.5 +Neighbor list builds = 47 +Dangerous builds = 2 +unfix 2 +unfix 4 +unfix 5 +fix 5 solute rigid/small molecule + create bodies CPU = 0.00015378 secs +150 rigid bodies with 450 atoms + 1.30435 = max distance from body owner to body atom +fix 4 all enforce2d +run 500 +Per MPI rank memory allocation (min/avg/max) = 8.64 | 8.64 | 8.64 Mbytes +Step Temp E_pair E_mol TotEng Press + 500 0.45533691 -1.9072316 0.13695201 -1.4006978 2.4545793 + 550 0.45627282 -1.912409 0.13695201 -1.4051155 2.1845065 + 600 0.44734553 -1.8890695 0.13695201 -1.389022 2.3458965 + 650 0.46444648 -1.9042462 0.13695201 -1.3903185 2.1609319 + 700 0.47113236 -1.8977576 0.13695201 -1.3784032 2.2420351 + 750 0.48554548 -1.9253545 0.13695201 -1.3943015 2.143907 + 800 0.46350091 -1.8865749 0.13695201 -1.3734146 2.294431 + 850 0.4766104 -1.9094039 0.13695201 -1.3856031 2.2077157 + 900 0.48988467 -1.9051538 0.13695201 -1.3705787 2.0107056 + 950 0.48351943 -1.9162485 0.13695201 -1.3868399 2.1891332 + 1000 0.49033701 -1.9115165 0.13695201 -1.3765742 2.1508141 +Loop time of 0.166502 on 1 procs for 500 steps with 1200 atoms + +Performance: 1297278.008 tau/day, 3002.958 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 | 0.085767 | 0.085767 | 0.085767 | 0.0 | 51.51 +Bond | 0.0042562 | 0.0042562 | 0.0042562 | 0.0 | 2.56 +Neigh | 0.018039 | 0.018039 | 0.018039 | 0.0 | 10.83 +Comm | 0.0024002 | 0.0024002 | 0.0024002 | 0.0 | 1.44 +Output | 0.00018239 | 0.00018239 | 0.00018239 | 0.0 | 0.11 +Modify | 0.052717 | 0.052717 | 0.052717 | 0.0 | 31.66 +Other | | 0.003141 | | | 1.89 + +Nlocal: 1200 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 415 ave 415 max 415 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 8743 ave 8743 max 8743 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8743 +Ave neighs/atom = 7.28583 +Ave special neighs/atom = 0.5 +Neighbor list builds = 40 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/micelle/log.29Mar2019.micelle-rigid.g++.4 b/examples/micelle/log.29Mar2019.micelle-rigid.g++.4 new file mode 100644 index 0000000000..e65f67a527 --- /dev/null +++ b/examples/micelle/log.29Mar2019.micelle-rigid.g++.4 @@ -0,0 +1,260 @@ +LAMMPS (29 Mar 2019) + using 1 OpenMP thread(s) per MPI task +# 2d micelle simulation + +dimension 2 + +neighbor 0.3 bin +neigh_modify delay 5 + +atom_style bond + +# Soft potential push-off + +read_data data.micelle + orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 1200 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 300 bonds + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000422001 secs + read_data CPU = 0.00473404 secs +special_bonds fene + 2 = max # of 1-2 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000183344 secs + +pair_style soft 1.12246 +pair_coeff * * 0.0 1.12246 + +bond_style harmonic +bond_coeff 1 50.0 0.75 + +velocity all create 0.45 2349852 + +variable prefactor equal ramp(1.0,20.0) + +fix 1 all nve +fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 +fix 3 all adapt 1 pair soft a * * v_prefactor +fix 4 all enforce2d + +thermo 50 +run 500 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.42246 + ghost atom cutoff = 1.42246 + binsize = 0.71123, bins = 51 51 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair soft, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.758 | 3.85 | 4.126 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 + 50 0.54981866 0.93548899 0.068440043 1.5532895 1.9232786 + 100 0.45 0.99659327 0.079228519 1.5254468 3.2135679 + 150 0.86965411 0.90456016 0.07493355 1.8484231 4.3821925 + 200 0.45 1.01454 0.10663502 1.5708 4.7598476 + 250 0.79636561 0.82567712 0.12105337 1.7424325 5.4983899 + 300 0.45 0.86475538 0.11819875 1.4325791 5.8554758 + 350 0.72135464 0.70693069 0.10912636 1.5368106 6.0388247 + 400 0.45 0.75067331 0.14165013 1.3419484 6.3840708 + 450 0.64839221 0.62402486 0.14173679 1.4136135 6.4791009 + 500 0.45 0.66669513 0.13695201 1.2532721 6.807146 +Loop time of 0.0426326 on 4 procs for 500 steps with 1200 atoms + +Performance: 5066547.720 tau/day, 11728.120 timesteps/s +98.7% 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.016784 | 0.019254 | 0.022154 | 1.5 | 45.16 +Bond | 0.0010612 | 0.0012558 | 0.0014153 | 0.4 | 2.95 +Neigh | 0.0046048 | 0.0046697 | 0.0047245 | 0.1 | 10.95 +Comm | 0.0064592 | 0.0097114 | 0.012527 | 2.4 | 22.78 +Output | 0.00022507 | 0.00026393 | 0.00033951 | 0.0 | 0.62 +Modify | 0.0041659 | 0.0048084 | 0.0053945 | 0.8 | 11.28 +Other | | 0.002669 | | | 6.26 + +Nlocal: 300 ave 304 max 292 min +Histogram: 1 0 0 0 0 0 0 0 2 1 +Nghost: 103.5 ave 108 max 98 min +Histogram: 1 0 0 1 0 0 0 0 0 2 +Neighs: 773.5 ave 792 max 735 min +Histogram: 1 0 0 0 0 0 0 0 2 1 + +Total # of neighbors = 3094 +Ave neighs/atom = 2.57833 +Ave special neighs/atom = 0.5 +Neighbor list builds = 52 +Dangerous builds = 0 + +unfix 3 + +# Main run + +pair_style lj/cut 2.5 + +# solvent/head - full-size and long-range + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 2 2 1.0 1.0 2.5 +pair_coeff 1 2 1.0 1.0 2.5 + +# tail/tail - size-averaged and long-range + +pair_coeff 3 3 1.0 0.75 2.5 +pair_coeff 4 4 1.0 0.50 2.5 +pair_coeff 3 4 1.0 0.67 2.5 + +# solvent/tail - full-size and repulsive + +pair_coeff 1 3 1.0 1.0 1.12246 +pair_coeff 1 4 1.0 1.0 1.12246 + +# head/tail - size-averaged and repulsive + +pair_coeff 2 3 1.0 0.88 1.12246 +pair_coeff 2 4 1.0 0.75 1.12246 + +thermo 50 + +#dump 1 all atom 2000 dump.micelle + +#dump 2 all image 2000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +#dump 3 all movie 2000 movie.mpg type type zoom 1.6 +#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +reset_timestep 0 +group solvent molecule 0 +750 atoms in group solvent +group solute subtract all solvent +450 atoms in group solute +unfix 1 +unfix 2 +unfix 4 +fix 1 solvent nve +fix 2 solvent temp/rescale 100 0.45 0.45 0.02 1.0 +fix 5 solute rigid molecule langevin 0.45 0.45 0.5 112211 +150 rigid bodies with 450 atoms +fix 4 all enforce2d +run 500 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 26 26 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.251 | 5.282 | 5.374 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45318168 -1.3753652 0.13695201 -0.8705807 1.975423 + 50 0.77871641 -1.6955252 0.13695201 -0.92651507 0.64222539 + 100 0.5336062 -1.7124572 0.13695201 -1.1423948 -0.11959696 + 150 0.58789067 -1.7926109 0.13695201 -1.1784877 1.2592743 + 200 0.47864796 -1.8040298 0.13695201 -1.2785752 3.6739793 + 250 0.51124651 -1.8614797 0.13695201 -1.309566 2.5817722 + 300 0.45695639 -1.8708384 0.13695201 -1.3629901 3.0833794 + 350 0.477504 -1.8924359 0.13695201 -1.3679098 -5.1605926 + 400 0.45328205 -1.87754 0.13695201 -1.372674 -4.0355858 + 450 0.47465031 -1.9071924 0.13695201 -1.3849826 3.1949617 + 500 0.45533691 -1.9072316 0.13695201 -1.4006978 0.48079061 +Loop time of 0.0887392 on 4 procs for 500 steps with 1200 atoms + +Performance: 2434100.210 tau/day, 5634.491 timesteps/s +98.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.022611 | 0.022839 | 0.023082 | 0.1 | 25.74 +Bond | 0.0010793 | 0.0011569 | 0.0012515 | 0.2 | 1.30 +Neigh | 0.0064609 | 0.0064996 | 0.0065265 | 0.0 | 7.32 +Comm | 0.0071712 | 0.0073687 | 0.0077734 | 0.3 | 8.30 +Output | 0.00023389 | 0.00025356 | 0.00030327 | 0.0 | 0.29 +Modify | 0.047258 | 0.047683 | 0.048503 | 0.2 | 53.73 +Other | | 0.002938 | | | 3.31 + +Nlocal: 300 ave 309 max 291 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Nghost: 218.75 ave 223 max 216 min +Histogram: 1 0 2 0 0 0 0 0 0 1 +Neighs: 2192.25 ave 2251 max 2113 min +Histogram: 1 0 0 1 0 0 0 0 0 2 + +Total # of neighbors = 8769 +Ave neighs/atom = 7.3075 +Ave special neighs/atom = 0.5 +Neighbor list builds = 47 +Dangerous builds = 2 +unfix 2 +unfix 4 +unfix 5 +fix 5 solute rigid/small molecule + create bodies CPU = 7.70092e-05 secs +150 rigid bodies with 450 atoms + 1.30435 = max distance from body owner to body atom +fix 4 all enforce2d +run 500 +Per MPI rank memory allocation (min/avg/max) = 8.565 | 8.597 | 8.69 Mbytes +Step Temp E_pair E_mol TotEng Press + 500 0.45533691 -1.9072316 0.13695201 -1.4006978 2.4545793 + 550 0.45627282 -1.912409 0.13695201 -1.4051155 2.1845065 + 600 0.44734553 -1.8890695 0.13695201 -1.389022 2.3458965 + 650 0.46444648 -1.9042462 0.13695201 -1.3903185 2.1609319 + 700 0.47113236 -1.8977576 0.13695201 -1.3784032 2.2420351 + 750 0.48554548 -1.9253545 0.13695201 -1.3943015 2.143907 + 800 0.46350091 -1.8865749 0.13695201 -1.3734146 2.294431 + 850 0.4766104 -1.9094039 0.13695201 -1.3856031 2.2077157 + 900 0.48988467 -1.9051538 0.13695201 -1.3705787 2.0107056 + 950 0.48351942 -1.9162485 0.13695201 -1.3868399 2.1891332 + 1000 0.490337 -1.9115164 0.13695201 -1.3765742 2.1508141 +Loop time of 0.0588261 on 4 procs for 500 steps with 1200 atoms + +Performance: 3671840.233 tau/day, 8499.630 timesteps/s +98.3% 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.022407 | 0.022631 | 0.0229 | 0.1 | 38.47 +Bond | 0.0010669 | 0.0011355 | 0.0012124 | 0.2 | 1.93 +Neigh | 0.0052333 | 0.00528 | 0.0053182 | 0.0 | 8.98 +Comm | 0.0063677 | 0.0066406 | 0.0068488 | 0.2 | 11.29 +Output | 0.00023055 | 0.00024778 | 0.00028086 | 0.0 | 0.42 +Modify | 0.020577 | 0.020651 | 0.020834 | 0.1 | 35.11 +Other | | 0.00224 | | | 3.81 + +Nlocal: 300 ave 303 max 295 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Nghost: 219 ave 224 max 215 min +Histogram: 1 0 0 1 1 0 0 0 0 1 +Neighs: 2185.75 ave 2244 max 2143 min +Histogram: 1 1 0 0 0 1 0 0 0 1 + +Total # of neighbors = 8743 +Ave neighs/atom = 7.28583 +Ave special neighs/atom = 0.5 +Neighbor list builds = 40 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/micelle/log.29Mar2019.micelle.g++.1 b/examples/micelle/log.29Mar2019.micelle.g++.1 new file mode 100644 index 0000000000..d482d6c890 --- /dev/null +++ b/examples/micelle/log.29Mar2019.micelle.g++.1 @@ -0,0 +1,218 @@ +LAMMPS (29 Mar 2019) + using 1 OpenMP thread(s) per MPI task +# 2d micelle simulation + +dimension 2 + +neighbor 0.3 bin +neigh_modify delay 5 + +atom_style bond + +# Soft potential push-off + +read_data data.micelle + orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1200 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 300 bonds + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.00037837 secs + read_data CPU = 0.00206876 secs +special_bonds fene + 2 = max # of 1-2 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000177383 secs + +pair_style soft 1.12246 +pair_coeff * * 0.0 1.12246 + +bond_style harmonic +bond_coeff 1 50.0 0.75 + +velocity all create 0.45 2349852 + +variable prefactor equal ramp(1.0,20.0) + +fix 1 all nve +fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 +fix 3 all adapt 1 pair soft a * * v_prefactor +fix 4 all enforce2d + +thermo 50 +run 1000 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.42246 + ghost atom cutoff = 1.42246 + binsize = 0.71123, bins = 51 51 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair soft, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.799 | 3.799 | 3.799 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 + 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 + 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 + 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 + 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 + 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 + 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 + 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 + 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 + 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 + 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 + 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 + 600 0.45 0.58193041 0.088386617 1.119942 5.131481 + 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 + 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 + 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 + 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 + 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 + 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 + 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 + 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 +Loop time of 0.208895 on 1 procs for 1000 steps with 1200 atoms + +Performance: 2068027.282 tau/day, 4787.100 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 | 0.14142 | 0.14142 | 0.14142 | 0.0 | 67.70 +Bond | 0.008441 | 0.008441 | 0.008441 | 0.0 | 4.04 +Neigh | 0.025716 | 0.025716 | 0.025716 | 0.0 | 12.31 +Comm | 0.0036864 | 0.0036864 | 0.0036864 | 0.0 | 1.76 +Output | 0.0003562 | 0.0003562 | 0.0003562 | 0.0 | 0.17 +Modify | 0.023699 | 0.023699 | 0.023699 | 0.0 | 11.35 +Other | | 0.00558 | | | 2.67 + +Nlocal: 1200 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 195 ave 195 max 195 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3136 ave 3136 max 3136 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3136 +Ave neighs/atom = 2.61333 +Ave special neighs/atom = 0.5 +Neighbor list builds = 92 +Dangerous builds = 0 + +unfix 3 + +# Main run + +pair_style lj/cut 2.5 + +# solvent/head - full-size and long-range + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 2 2 1.0 1.0 2.5 +pair_coeff 1 2 1.0 1.0 2.5 + +# tail/tail - size-averaged and long-range + +pair_coeff 3 3 1.0 0.75 2.5 +pair_coeff 4 4 1.0 0.50 2.5 +pair_coeff 3 4 1.0 0.67 2.5 + +# solvent/tail - full-size and repulsive + +pair_coeff 1 3 1.0 1.0 1.12246 +pair_coeff 1 4 1.0 1.0 1.12246 + +# head/tail - size-averaged and repulsive + +pair_coeff 2 3 1.0 0.88 1.12246 +pair_coeff 2 4 1.0 0.75 1.12246 + +thermo 50 + +#dump 1 all atom 2000 dump.micelle + +#dump 2 all image 2000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +#dump 3 all movie 2000 movie.mpg type type zoom 1.6 +#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +reset_timestep 0 +run 1000 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 26 26 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.024 | 4.024 | 4.024 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 -1.7056163 0.08808163 -1.1679097 3.9431686 + 50 0.59734982 -1.8103783 0.076066922 -1.1374593 3.2770557 + 100 0.45 -1.8347112 0.093132329 -1.2919539 3.024661 + 150 0.51924311 -1.8943977 0.076004124 -1.2995832 2.5570373 + 200 0.45 -1.8918672 0.082422107 -1.3598201 2.5629655 + 250 0.50281134 -1.920406 0.074011331 -1.3440023 2.3518682 + 300 0.45 -1.9351047 0.075337265 -1.4101424 2.3249947 + 350 0.47650026 -1.9313687 0.072115117 -1.3831504 2.1987532 + 400 0.45 -1.9554318 0.081603939 -1.4242028 2.0787066 + 450 0.47220236 -1.9468502 0.065625624 -1.4094157 2.0984288 + 500 0.4684673 -1.9444333 0.076696283 -1.3996601 2.0528682 + 550 0.47683128 -1.958676 0.070589719 -1.4116523 2.0856022 + 600 0.46851243 -1.9338267 0.07060548 -1.3950992 2.26405 + 650 0.46874142 -1.9462493 0.069134685 -1.4087638 2.1070263 + 700 0.46437384 -1.9309953 0.071977522 -1.3950309 2.2256923 + 750 0.47326225 -1.9484255 0.075435845 -1.4001218 2.0880254 + 800 0.45 -1.9646005 0.064159585 -1.4508159 2.0612696 + 850 0.46748307 -1.970559 0.060384874 -1.4430806 1.9472879 + 900 0.46909484 -1.953723 0.062470295 -1.4225488 2.0222909 + 950 0.45631531 -1.9387753 0.067536568 -1.4153037 2.0638421 + 1000 0.45 -1.9727646 0.058607721 -1.4645318 1.9982315 +Loop time of 0.252254 on 1 procs for 1000 steps with 1200 atoms + +Performance: 1712557.882 tau/day, 3964.254 timesteps/s +99.0% 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.17177 | 0.17177 | 0.17177 | 0.0 | 68.09 +Bond | 0.0084555 | 0.0084555 | 0.0084555 | 0.0 | 3.35 +Neigh | 0.03991 | 0.03991 | 0.03991 | 0.0 | 15.82 +Comm | 0.0049119 | 0.0049119 | 0.0049119 | 0.0 | 1.95 +Output | 0.00039077 | 0.00039077 | 0.00039077 | 0.0 | 0.15 +Modify | 0.021131 | 0.021131 | 0.021131 | 0.0 | 8.38 +Other | | 0.005685 | | | 2.25 + +Nlocal: 1200 ave 1200 max 1200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 415 ave 415 max 415 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 8586 ave 8586 max 8586 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8586 +Ave neighs/atom = 7.155 +Ave special neighs/atom = 0.5 +Neighbor list builds = 86 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/micelle/log.29Mar2019.micelle.g++.4 b/examples/micelle/log.29Mar2019.micelle.g++.4 new file mode 100644 index 0000000000..f3a54970cf --- /dev/null +++ b/examples/micelle/log.29Mar2019.micelle.g++.4 @@ -0,0 +1,218 @@ +LAMMPS (29 Mar 2019) + using 1 OpenMP thread(s) per MPI task +# 2d micelle simulation + +dimension 2 + +neighbor 0.3 bin +neigh_modify delay 5 + +atom_style bond + +# Soft potential push-off + +read_data data.micelle + orthogonal box = (0 0 -0.1) to (35.8569 35.8569 0.1) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 1200 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 300 bonds + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000413656 secs + read_data CPU = 0.00487924 secs +special_bonds fene + 2 = max # of 1-2 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000178576 secs + +pair_style soft 1.12246 +pair_coeff * * 0.0 1.12246 + +bond_style harmonic +bond_coeff 1 50.0 0.75 + +velocity all create 0.45 2349852 + +variable prefactor equal ramp(1.0,20.0) + +fix 1 all nve +fix 2 all temp/rescale 100 0.45 0.45 0.02 1.0 +fix 3 all adapt 1 pair soft a * * v_prefactor +fix 4 all enforce2d + +thermo 50 +run 1000 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.42246 + ghost atom cutoff = 1.42246 + binsize = 0.71123, bins = 51 51 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair soft, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.758 | 3.85 | 4.126 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 0.40003481 2.2200223e-06 0.84966203 0.78952518 + 50 0.47411013 0.67721272 0.057404514 1.2083323 1.3375852 + 100 0.45 0.73046745 0.054836584 1.234929 2.3196516 + 150 0.67521742 0.72402001 0.043490075 1.4421648 2.8744416 + 200 0.45 0.78481891 0.076931503 1.3113754 3.0412388 + 250 0.66479018 0.69790602 0.081075564 1.4432178 3.6917024 + 300 0.45 0.76820218 0.066727591 1.2845548 3.7861054 + 350 0.67619136 0.625715 0.072722727 1.3740656 4.2861621 + 400 0.45 0.68527759 0.090724527 1.2256271 4.4725214 + 450 0.56702844 0.64402767 0.080555563 1.2911391 4.7402211 + 500 0.45 0.64883009 0.078376672 1.1768318 4.7919294 + 550 0.564664 0.58260368 0.080779475 1.2275766 4.9855705 + 600 0.45 0.58193041 0.088386617 1.119942 5.131481 + 650 0.52110993 0.5415273 0.097683746 1.1598867 5.2500294 + 700 0.45 0.50856787 0.088471208 1.0466641 5.2550165 + 750 0.51510855 0.47441291 0.089429375 1.0785216 5.375763 + 800 0.45 0.49926696 0.085958476 1.0348504 5.4665914 + 850 0.50688494 0.46614429 0.088962292 1.0615691 5.556932 + 900 0.45 0.47785593 0.10150857 1.0289895 5.7765975 + 950 0.49590559 0.46050477 0.096404887 1.052402 5.8649245 + 1000 0.45 0.47691182 0.08808163 1.0146185 6.0177568 +Loop time of 0.0906248 on 4 procs for 1000 steps with 1200 atoms + +Performance: 4766906.584 tau/day, 11034.506 timesteps/s +98.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.036572 | 0.039266 | 0.041216 | 1.0 | 43.33 +Bond | 0.0023205 | 0.0024512 | 0.0025697 | 0.2 | 2.70 +Neigh | 0.0088909 | 0.0089301 | 0.0089679 | 0.0 | 9.85 +Comm | 0.022308 | 0.024047 | 0.027175 | 1.3 | 26.53 +Output | 0.00057411 | 0.00061274 | 0.00071025 | 0.0 | 0.68 +Modify | 0.0083182 | 0.0092374 | 0.0098341 | 0.6 | 10.19 +Other | | 0.006081 | | | 6.71 + +Nlocal: 300 ave 305 max 292 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Nghost: 100.25 ave 108 max 93 min +Histogram: 1 0 1 0 0 0 1 0 0 1 +Neighs: 784 ave 815 max 739 min +Histogram: 1 0 0 0 0 0 1 1 0 1 + +Total # of neighbors = 3136 +Ave neighs/atom = 2.61333 +Ave special neighs/atom = 0.5 +Neighbor list builds = 92 +Dangerous builds = 0 + +unfix 3 + +# Main run + +pair_style lj/cut 2.5 + +# solvent/head - full-size and long-range + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 2 2 1.0 1.0 2.5 +pair_coeff 1 2 1.0 1.0 2.5 + +# tail/tail - size-averaged and long-range + +pair_coeff 3 3 1.0 0.75 2.5 +pair_coeff 4 4 1.0 0.50 2.5 +pair_coeff 3 4 1.0 0.67 2.5 + +# solvent/tail - full-size and repulsive + +pair_coeff 1 3 1.0 1.0 1.12246 +pair_coeff 1 4 1.0 1.0 1.12246 + +# head/tail - size-averaged and repulsive + +pair_coeff 2 3 1.0 0.88 1.12246 +pair_coeff 2 4 1.0 0.75 1.12246 + +thermo 50 + +#dump 1 all atom 2000 dump.micelle + +#dump 2 all image 2000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +#dump 3 all movie 2000 movie.mpg type type zoom 1.6 +#dump_modify 3 pad 5 adiam 1 0.5 adiam 2 1.5 adiam 3 1.0 adiam 4 0.75 + +reset_timestep 0 +run 1000 +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 26 26 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/2d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.001 | 4.032 | 4.124 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.45 -1.7056163 0.08808163 -1.1679097 3.9431686 + 50 0.59734982 -1.8103783 0.076066922 -1.1374593 3.2770557 + 100 0.45 -1.8347112 0.093132329 -1.2919539 3.024661 + 150 0.51924311 -1.8943977 0.076004124 -1.2995832 2.5570373 + 200 0.45 -1.8918672 0.082422107 -1.3598201 2.5629655 + 250 0.50281134 -1.920406 0.074011331 -1.3440023 2.3518682 + 300 0.45 -1.9351047 0.075337265 -1.4101424 2.3249947 + 350 0.47650026 -1.9313687 0.072115117 -1.3831504 2.1987532 + 400 0.45 -1.9554318 0.081603939 -1.4242028 2.0787066 + 450 0.47220236 -1.9468502 0.065625625 -1.4094157 2.0984288 + 500 0.4684673 -1.9444333 0.076696285 -1.3996601 2.0528682 + 550 0.47683128 -1.958676 0.070589721 -1.4116523 2.0856023 + 600 0.46851245 -1.9338267 0.070605469 -1.3950992 2.26405 + 650 0.46874143 -1.9462493 0.069134686 -1.4087638 2.1070262 + 700 0.4643739 -1.9309953 0.071977511 -1.3950309 2.225692 + 750 0.47326259 -1.9484258 0.075435808 -1.4001218 2.0880235 + 800 0.45 -1.9646003 0.06415956 -1.4508158 2.0612703 + 850 0.46748278 -1.9705588 0.06038513 -1.4430804 1.9472884 + 900 0.46909438 -1.9537221 0.062470305 -1.4225483 2.0223008 + 950 0.45631508 -1.9387742 0.067536066 -1.4153033 2.063854 + 1000 0.45 -1.9727651 0.058608085 -1.464532 1.9982447 +Loop time of 0.0878521 on 4 procs for 1000 steps with 1200 atoms + +Performance: 4917357.613 tau/day, 11382.772 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.043517 | 0.044455 | 0.046903 | 0.7 | 50.60 +Bond | 0.0020199 | 0.0022303 | 0.0024347 | 0.4 | 2.54 +Neigh | 0.012207 | 0.012335 | 0.012512 | 0.1 | 14.04 +Comm | 0.014938 | 0.018265 | 0.020068 | 1.5 | 20.79 +Output | 0.00061369 | 0.00064814 | 0.00073504 | 0.0 | 0.74 +Modify | 0.0052264 | 0.0053691 | 0.0055039 | 0.2 | 6.11 +Other | | 0.00455 | | | 5.18 + +Nlocal: 300 ave 305 max 296 min +Histogram: 1 1 0 0 0 0 1 0 0 1 +Nghost: 219.5 ave 228 max 214 min +Histogram: 1 0 1 1 0 0 0 0 0 1 +Neighs: 2146.5 ave 2201 max 2114 min +Histogram: 1 1 0 1 0 0 0 0 0 1 + +Total # of neighbors = 8586 +Ave neighs/atom = 7.155 +Ave special neighs/atom = 0.5 +Neighbor list builds = 86 +Dangerous builds = 0 +Total wall time: 0:00:00 From b1070f4703d6b0cf70cae82ceea0e13853fde3c1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 23:10:59 -0400 Subject: [PATCH 50/68] must add USER-SCAFACOS to nolib.cmake preset, as it requires GSL --- cmake/presets/nolib.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index 663f87122b..c0968a8d82 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -4,7 +4,7 @@ set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP - USER-SMD USER-VTK) + USER-SCAFACOS USER-SMD USER-VTK) foreach(PKG ${PACKAGES_WITH_LIB}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) From a149fdb4201d958bb8915ff582c195780a3b4851 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 23:19:37 -0400 Subject: [PATCH 51/68] forgot MESSAGE package in all_on/off.cmake preset --- cmake/presets/all_off.cmake | 6 +++--- cmake/presets/all_on.cmake | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index 0e37611da4..9d03be99ec 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -2,9 +2,9 @@ # an existing package selection without losing any other settings set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO - MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD - VORONOI + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MOLECULE + MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN + SRD VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 57f1228abe..2ff107975a 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -4,9 +4,9 @@ # with just a working C++ compiler and an MPI library. set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MOLECULE MPIIO - MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD - VORONOI + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MOLECULE + MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN + SRD VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESO From 6cb120d691b656e32a5619005041768842683d6b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 23:20:53 -0400 Subject: [PATCH 52/68] get rid of "using" in USER-REAXC header --- src/USER-REAXC/reaxc_types.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 2666fcf85c..ff922e012c 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -392,8 +392,6 @@ typedef struct double ghost_cutoff; } boundary_cutoff; -using LAMMPS_NS::Pair; - struct _reax_system { reax_interaction reax_param; @@ -411,7 +409,7 @@ struct _reax_system boundary_cutoff bndry_cuts; reax_atom *my_atoms; - class Pair *pair_ptr; + class LAMMPS_NS::Pair *pair_ptr; int my_bonds; int mincap; double safezone, saferzone; From 40f1662c93e0e4ffa35890830cdfc63e6fb39ef9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Apr 2019 23:44:00 -0400 Subject: [PATCH 53/68] reduce compiler warnings --- src/MESSAGE/fix_client_md.cpp | 6 ++---- src/MESSAGE/message.cpp | 12 +++--------- src/MESSAGE/server_mc.cpp | 4 ++-- src/MESSAGE/server_md.cpp | 2 +- src/special.cpp | 2 +- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/MESSAGE/fix_client_md.cpp b/src/MESSAGE/fix_client_md.cpp index 9c1bfcc796..727481dcc0 100644 --- a/src/MESSAGE/fix_client_md.cpp +++ b/src/MESSAGE/fix_client_md.cpp @@ -89,7 +89,7 @@ FixClientMD::~FixClientMD() int nfield; int *fieldID,*fieldtype,*fieldlen; - int msgID = cs->recv(nfield,fieldID,fieldtype,fieldlen); + cs->recv(nfield,fieldID,fieldtype,fieldlen); // clean-up @@ -173,8 +173,6 @@ void FixClientMD::min_setup(int vflag) void FixClientMD::post_force(int vflag) { - int i,j,m; - // energy and virial setup if (vflag) v_setup(vflag); @@ -286,7 +284,7 @@ void FixClientMD::receive_fev(int vflag) int nfield; int *fieldID,*fieldtype,*fieldlen; - int msgID = cs->recv(nfield,fieldID,fieldtype,fieldlen); + cs->recv(nfield,fieldID,fieldtype,fieldlen); double *forces = (double *) cs->unpack(FORCES); double **f = atom->f; diff --git a/src/MESSAGE/message.cpp b/src/MESSAGE/message.cpp index e9bff7d38a..61221ca26e 100644 --- a/src/MESSAGE/message.cpp +++ b/src/MESSAGE/message.cpp @@ -22,10 +22,6 @@ using namespace LAMMPS_NS; using namespace CSLIB_NS; -// customize by adding a new server protocol enum - -enum{MD,MC}; - /* ---------------------------------------------------------------------- */ void Message::command(int narg, char **arg) @@ -38,12 +34,10 @@ void Message::command(int narg, char **arg) else error->all(FLERR,"Illegal message command"); lmp->clientserver = clientserver; - // customize by adding a new server protocol + // validate supported protocols - int protocol; - if (strcmp(arg[1],"md") == 0) protocol = MD; - else if (strcmp(arg[1],"mc") == 0) protocol = MC; - else error->all(FLERR,"Unknown message protocol"); + if ((strcmp(arg[1],"md") != 0) && (strcmp(arg[1],"mc") != 0)) + error->all(FLERR,"Unknown message protocol"); // instantiate CSlib with chosen communication mode diff --git a/src/MESSAGE/server_mc.cpp b/src/MESSAGE/server_mc.cpp index 8e9a297912..8152b1f772 100644 --- a/src/MESSAGE/server_mc.cpp +++ b/src/MESSAGE/server_mc.cpp @@ -37,8 +37,8 @@ ServerMC::ServerMC(LAMMPS *lmp) : Pointers(lmp) {} void ServerMC::loop() { - int i,j,m; - double xold[3],xnew[3]; + int m; + double xold[3]; tagint atomid; CSlib *cs = (CSlib *) lmp->cslib; diff --git a/src/MESSAGE/server_md.cpp b/src/MESSAGE/server_md.cpp index 8debd3a987..bef327616e 100644 --- a/src/MESSAGE/server_md.cpp +++ b/src/MESSAGE/server_md.cpp @@ -78,7 +78,7 @@ ServerMD::~ServerMD() void ServerMD::loop() { - int i,j,m; + int j,m; // cs = instance of CSlib diff --git a/src/special.cpp b/src/special.cpp index ab3764a156..7f855163e0 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -1225,7 +1225,7 @@ void Special::dihedral_trim() ------------------------------------------------------------------------- */ int Special::rendezvous_ids(int n, char *inbuf, - int &flag, int *&proclist, char *&outbuf, + int &flag, int *& /*proclist*/, char *& /*outbuf*/, void *ptr) { Special *sptr = (Special *) ptr; From f02b364e6efe7770716c9f826a81d2add9237ec7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 00:03:34 -0400 Subject: [PATCH 54/68] remove "using namespace" from header and include required header --- src/USER-SMD/smd_material_models.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/USER-SMD/smd_material_models.h b/src/USER-SMD/smd_material_models.h index acb498c04d..557612bdf5 100644 --- a/src/USER-SMD/smd_material_models.h +++ b/src/USER-SMD/smd_material_models.h @@ -22,10 +22,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef SMD_MATERIAL_MODELS_H_ -#define SMD_MATERIAL_MODELS_H_ +#ifndef SMD_MATERIAL_MODELS_H +#define SMD_MATERIAL_MODELS_H -using namespace Eigen; +#include /* * EOS models @@ -42,22 +42,22 @@ void PerfectGasEOS(const double gamma, const double vol, const double mass, cons /* * Material strength models */ -void LinearStrength(const double mu, const Matrix3d sigmaInitial_dev, const Matrix3d d_dev, const double dt, - Matrix3d &sigmaFinal_dev__, Matrix3d &sigma_dev_rate__); -void LinearPlasticStrength(const double G, const double yieldStress, const Matrix3d sigmaInitial_dev, const Matrix3d d_dev, - const double dt, Matrix3d &sigmaFinal_dev__, Matrix3d &sigma_dev_rate__, double &plastic_strain_increment); +void LinearStrength(const double mu, const Eigen::Matrix3d sigmaInitial_dev, const Eigen::Matrix3d d_dev, const double dt, + Eigen::Matrix3d &sigmaFinal_dev__, Eigen::Matrix3d &sigma_dev_rate__); +void LinearPlasticStrength(const double G, const double yieldStress, const Eigen::Matrix3d sigmaInitial_dev, const Eigen::Matrix3d d_dev, + const double dt, Eigen::Matrix3d &sigmaFinal_dev__, Eigen::Matrix3d &sigma_dev_rate__, double &plastic_strain_increment); void JohnsonCookStrength(const double G, const double cp, const double espec, const double A, const double B, const double a, const double C, const double epdot0, const double T0, const double Tmelt, const double M, const double dt, const double ep, - const double epdot, const Matrix3d sigmaInitial_dev, const Matrix3d d_dev, Matrix3d &sigmaFinal_dev__, - Matrix3d &sigma_dev_rate__, double &plastic_strain_increment); + const double epdot, const Eigen::Matrix3d sigmaInitial_dev, const Eigen::Matrix3d d_dev, Eigen::Matrix3d &sigmaFinal_dev__, + Eigen::Matrix3d &sigma_dev_rate__, double &plastic_strain_increment); /* * Damage models */ -bool IsotropicMaxStrainDamage(const Matrix3d E, const double maxStrain); -bool IsotropicMaxStressDamage(const Matrix3d E, const double maxStrain); -double JohnsonCookFailureStrain(const double p, const Matrix3d Sdev, const double d1, const double d2, const double d3, +bool IsotropicMaxStrainDamage(const Eigen::Matrix3d E, const double maxStrain); +bool IsotropicMaxStressDamage(const Eigen::Matrix3d E, const double maxStrain); +double JohnsonCookFailureStrain(const double p, const Eigen::Matrix3d Sdev, const double d1, const double d2, const double d3, const double d4, const double epdot0, const double epdot); From 52a13f31b3d21a6256faeea5691ec6f2cefd6a5d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 00:04:12 -0400 Subject: [PATCH 55/68] remove "using namespace" from header --- src/USER-SMD/smd_math.h | 97 +++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 62 deletions(-) diff --git a/src/USER-SMD/smd_math.h b/src/USER-SMD/smd_math.h index cea9e9dbc7..52e7c983d5 100644 --- a/src/USER-SMD/smd_math.h +++ b/src/USER-SMD/smd_math.h @@ -9,14 +9,11 @@ * * ----------------------------------------------------------------------- */ -//test -#ifndef SMD_MATH_H_ -#define SMD_MATH_H_ +#ifndef SMD_MATH_H +#define SMD_MATH_H #include #include -using namespace Eigen; -using namespace std; namespace SMD_Math { static inline void LimitDoubleMagnitude(double &x, const double limit) { @@ -31,8 +28,8 @@ static inline void LimitDoubleMagnitude(double &x, const double limit) { /* * deviator of a tensor */ -static inline Matrix3d Deviator(const Matrix3d M) { - Matrix3d eye; +static inline Eigen::Matrix3d Deviator(const Eigen::Matrix3d M) { + Eigen::Matrix3d eye; eye.setIdentity(); eye *= M.trace() / 3.0; return M - eye; @@ -53,14 +50,14 @@ static inline Matrix3d Deviator(const Matrix3d M) { * obtained again from an SVD. The rotation should proper now, i.e., det(R) = +1. */ -static inline bool PolDec(Matrix3d M, Matrix3d &R, Matrix3d &T, bool scaleF) { +static inline bool PolDec(Eigen::Matrix3d M, Eigen::Matrix3d &R, Eigen::Matrix3d &T, bool scaleF) { - JacobiSVD svd(M, ComputeFullU | ComputeFullV); // SVD(A) = U S V* - Vector3d S_eigenvalues = svd.singularValues(); - Matrix3d S = svd.singularValues().asDiagonal(); - Matrix3d U = svd.matrixU(); - Matrix3d V = svd.matrixV(); - Matrix3d eye; + Eigen::JacobiSVD svd(M, Eigen::ComputeFullU | Eigen::ComputeFullV); // SVD(A) = U S V* + Eigen::Vector3d S_eigenvalues = svd.singularValues(); + Eigen::Matrix3d S = svd.singularValues().asDiagonal(); + Eigen::Matrix3d U = svd.matrixU(); + Eigen::Matrix3d V = svd.matrixV(); + Eigen::Matrix3d eye; eye.setIdentity(); // now do polar decomposition into M = R * T, where R is rotation @@ -105,16 +102,12 @@ static inline bool PolDec(Matrix3d M, Matrix3d &R, Matrix3d &T, bool scaleF) { * Pseudo-inverse via SVD */ -static inline void pseudo_inverse_SVD(Matrix3d &M) { +static inline void pseudo_inverse_SVD(Eigen::Matrix3d &M) { - //JacobiSVD < Matrix3d > svd(M, ComputeFullU | ComputeFullV); - JacobiSVD svd(M, ComputeFullU); // one Eigevector base is sufficient because matrix is square and symmetric + Eigen::JacobiSVD svd(M, Eigen::ComputeFullU); // one Eigevector base is sufficient because matrix is square and symmetric - Vector3d singularValuesInv; - Vector3d singularValues = svd.singularValues(); - -//cout << "Here is the matrix V:" << endl << V * singularValues.asDiagonal() * U << endl; -//cout << "Its singular values are:" << endl << singularValues << endl; + Eigen::Vector3d singularValuesInv; + Eigen::Vector3d singularValues = svd.singularValues(); double pinvtoler = 1.0e-16; // 2d machining example goes unstable if this value is increased (1.0e-16). for (int row = 0; row < 3; row++) { @@ -126,39 +119,19 @@ static inline void pseudo_inverse_SVD(Matrix3d &M) { } M = svd.matrixU() * singularValuesInv.asDiagonal() * svd.matrixU().transpose(); - -// JacobiSVD < Matrix3d > svd(M, ComputeFullU | ComputeFullV); -// -// Vector3d singularValuesInv; -// Vector3d singularValues = svd.singularValues(); -// -// //cout << "Here is the matrix V:" << endl << V * singularValues.asDiagonal() * U << endl; -// //cout << "Its singular values are:" << endl << singularValues << endl; -// -// double pinvtoler = 1.0e-16; // 2d machining example goes unstable if this value is increased (1.0e-16). -// for (int row = 0; row < 3; row++) { -// if (singularValues(row) > pinvtoler) { -// singularValuesInv(row) = 1.0 / singularValues(row); -// } else { -// singularValuesInv(row) = 0.0; -// } -// } -// -// M = svd.matrixU() * singularValuesInv.asDiagonal() * svd.matrixV().transpose(); - } /* * test if two matrices are equal */ -static inline double TestMatricesEqual(Matrix3d A, Matrix3d B, double eps) { - Matrix3d diff; +static inline double TestMatricesEqual(Eigen::Matrix3d A, Eigen::Matrix3d B, double eps) { + Eigen::Matrix3d diff; diff = A - B; double norm = diff.norm(); if (norm > eps) { - printf("Matrices A and B are not equal! The L2-norm difference is: %g\n", norm); - cout << "Here is matrix A:" << endl << A << endl; - cout << "Here is matrix B:" << endl << B << endl; + std::cout << "Matrices A and B are not equal! The L2-norm difference is: " << norm << "\n" + << "Here is matrix A:\n" << A << "\n" + << "Here is matrix B:\n" << B << std::endl; } return norm; } @@ -167,12 +140,12 @@ static inline double TestMatricesEqual(Matrix3d A, Matrix3d B, double eps) { Limit eigenvalues of a matrix to upper and lower bounds. ------------------------------------------------------------------------- */ -static inline Matrix3d LimitEigenvalues(Matrix3d S, double limitEigenvalue) { +static inline Eigen::Matrix3d LimitEigenvalues(Eigen::Matrix3d S, double limitEigenvalue) { /* * compute Eigenvalues of matrix S */ - SelfAdjointEigenSolver < Matrix3d > es; + Eigen::SelfAdjointEigenSolver < Eigen::Matrix3d > es; es.compute(S); double max_eigenvalue = es.eigenvalues().maxCoeff(); @@ -183,17 +156,17 @@ static inline Matrix3d LimitEigenvalues(Matrix3d S, double limitEigenvalue) { if ((amax_eigenvalue > limitEigenvalue) || (amin_eigenvalue > limitEigenvalue)) { if (amax_eigenvalue > amin_eigenvalue) { // need to scale with max_eigenvalue double scale = amax_eigenvalue / limitEigenvalue; - Matrix3d V = es.eigenvectors(); - Matrix3d S_diag = V.inverse() * S * V; // diagonalized input matrix + Eigen::Matrix3d V = es.eigenvectors(); + Eigen::Matrix3d S_diag = V.inverse() * S * V; // diagonalized input matrix S_diag /= scale; - Matrix3d S_scaled = V * S_diag * V.inverse(); // undiagonalize matrix + Eigen::Matrix3d S_scaled = V * S_diag * V.inverse(); // undiagonalize matrix return S_scaled; } else { // need to scale using min_eigenvalue double scale = amin_eigenvalue / limitEigenvalue; - Matrix3d V = es.eigenvectors(); - Matrix3d S_diag = V.inverse() * S * V; // diagonalized input matrix + Eigen::Matrix3d V = es.eigenvectors(); + Eigen::Matrix3d S_diag = V.inverse() * S * V; // diagonalized input matrix S_diag /= scale; - Matrix3d S_scaled = V * S_diag * V.inverse(); // undiagonalize matrix + Eigen::Matrix3d S_scaled = V * S_diag * V.inverse(); // undiagonalize matrix return S_scaled; } } else { // limiting does not apply @@ -201,17 +174,17 @@ static inline Matrix3d LimitEigenvalues(Matrix3d S, double limitEigenvalue) { } } -static inline bool LimitMinMaxEigenvalues(Matrix3d &S, double min, double max) { +static inline bool LimitMinMaxEigenvalues(Eigen::Matrix3d &S, double min, double max) { /* * compute Eigenvalues of matrix S */ - SelfAdjointEigenSolver < Matrix3d > es; + Eigen::SelfAdjointEigenSolver < Eigen::Matrix3d > es; es.compute(S); if ((es.eigenvalues().maxCoeff() > max) || (es.eigenvalues().minCoeff() < min)) { - Matrix3d S_diag = es.eigenvalues().asDiagonal(); - Matrix3d V = es.eigenvectors(); + Eigen::Matrix3d S_diag = es.eigenvalues().asDiagonal(); + Eigen::Matrix3d V = es.eigenvectors(); for (int i = 0; i < 3; i++) { if (S_diag(i, i) < min) { //printf("limiting eigenvalue %f --> %f\n", S_diag(i, i), min); @@ -229,10 +202,10 @@ static inline bool LimitMinMaxEigenvalues(Matrix3d &S, double min, double max) { } } -static inline void reconstruct_rank_deficient_shape_matrix(Matrix3d &K) { +static inline void reconstruct_rank_deficient_shape_matrix(Eigen::Matrix3d &K) { - JacobiSVD svd(K, ComputeFullU | ComputeFullV); - Vector3d singularValues = svd.singularValues(); + Eigen::JacobiSVD svd(K, Eigen::ComputeFullU | Eigen::ComputeFullV); + Eigen::Vector3d singularValues = svd.singularValues(); for (int i = 0; i < 3; i++) { if (singularValues(i) < 1.0e-8) { From 537704fdaa7e5e285d1e93edf118f09c857607d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 00:13:52 -0400 Subject: [PATCH 56/68] eliminate the use of the "using" keyword in headers of the KOKKOS package --- src/KOKKOS/domain_kokkos.h | 10 ++++++---- src/KOKKOS/pair_snap_kokkos_impl.h | 3 ++- src/KOKKOS/sna_kokkos_impl.h | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/KOKKOS/domain_kokkos.h b/src/KOKKOS/domain_kokkos.h index 7b8504dba8..eccc36a021 100644 --- a/src/KOKKOS/domain_kokkos.h +++ b/src/KOKKOS/domain_kokkos.h @@ -36,10 +36,12 @@ class DomainKokkos : public Domain { void image_flip(int, int, int); void x2lamda(int); void lamda2x(int); - // these lines bring in the x2lamda signatures from Domain - // that are not overloaded here - using Domain::x2lamda; - using Domain::lamda2x; + // forward remaining x2lamda() and lambda2x() variants to parent class + void x2lamda(double *a, double *b) { Domain::x2lamda(a,b); } + void lamda2x(double *a, double *b) { Domain::lamda2x(a,b); } + void x2lamda(double *a, double *b, double *c, double *d) { + Domain::x2lamda(a,b,c,d); + } int closest_image(const int, int) const; diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 569783f926..bb2a5e9171 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -32,7 +32,7 @@ #define MAXLINE 1024 #define MAXWORD 3 -using namespace LAMMPS_NS; +namespace LAMMPS_NS { // Outstanding issues with quadratic term // 1. there seems to a problem with compute_optimized energy calc @@ -674,3 +674,4 @@ double PairSNAPKokkos::memory_usage() bytes += snaKK.memory_usage(); return bytes; } +} diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index 6a19c57829..0f2a450a3d 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -20,7 +20,7 @@ #include #include -using namespace LAMMPS_NS; +namespace LAMMPS_NS { static const double MY_PI = 3.14159265358979323846; // pi @@ -1300,3 +1300,5 @@ double SNAKokkos::memory_usage() bytes += jdim * jdim * jdim * jdim * jdim * sizeof(std::complex); return bytes; } + +} // namespace LAMMPS_NS From f17aff6331db0bbef287991084f5e1f6c7f0d982 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 00:24:36 -0400 Subject: [PATCH 57/68] add some missing entries to src/USER-MISC/README --- src/USER-MISC/README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/USER-MISC/README b/src/USER-MISC/README index 13e406d42f..8e821c03a9 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -67,14 +67,17 @@ improper_style distance, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 pair_style agni, Axel Kohlmeyer, akohlmey at gmail.com, 9 Nov 16 pair_style buck/mdf, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 pair_style coul/diel, Axel Kohlmeyer, akohlmey at gmail.com, 1 Dec 11 +pair_style coul/shield, Wengen Ouyang (Tel Aviv University), w.g.ouyang at gmail dot com, 30 Mar 18 pair_style dipole/sf, Mario Orsi, orsimario at gmail.com, 8 Aug 11 pair_style edip, Luca Ferraro, luca.ferraro at caspur.it, 15 Sep 11 pair_style extep, Jaap Kroes (Radboud U), jaapkroes at gmail dot com, 28 Nov 17 pair_style gauss/cut, Axel Kohlmeyer, akohlmey at gmail.com, 1 Dec 11 +pair_style ilp/graphene/hbn, Wengen Ouyang (Tel Aviv University), w.g.ouyang at gmail dot com, 30 Mar 18 pair_style lebedeva/z, Zbigniew Koziol (National Center for Nuclear Research), softquake at gmail dot com, 4 Jan 19 pair_style lennard/mdf, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 pair_style list, Axel Kohlmeyer (Temple U), akohlmey at gmail.com, 1 Jun 13 pair_style lj/mdf, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 +pair_style kolmogorov/crespi/full, Wengen Ouyang (Tel Aviv University), w.g.ouyang at gmail dot com, 30 Mar 18 pair_style kolmogorov/crespi/z, Jaap Kroes (Radboud U), jaapkroes at gmail dot com, 28 Feb 17 pair_style meam/spline, Alexander Stukowski (LLNL), alex at stukowski.com, 1 Feb 12 pair_style meam/sw/spline, Robert Rudd (LLNL), robert.rudd at llnl.gov, 1 Oct 12 From 7372e8fde1a02d605873d2591d395517cf789f78 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 00:41:03 -0400 Subject: [PATCH 58/68] must add STUBS_MPI to cslib includes when compiling without MPI --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 59caf8ca9f..fd93814574 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -728,6 +728,7 @@ if(PKG_MESSAGE) set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi") else() target_compile_definitions(cslib PRIVATE -DMPI_NO) + target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI) set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi") endif() From 1696432e8220906c38c2603879a3fb7fba490a76 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Apr 2019 01:00:53 -0400 Subject: [PATCH 59/68] resolve conflict between src/STUBS/mpi.h and lib/message/cslib/src/STUBS_MPI/mpi.h --- lib/message/cslib/src/STUBS_MPI/{mpi.h => mpi_dummy.h} | 0 lib/message/cslib/src/cslib.cpp | 4 ++++ lib/message/cslib/src/cslib_wrap.cpp | 4 ++++ lib/message/cslib/src/msg.cpp | 4 ++++ lib/message/cslib/src/msg.h | 6 +++++- lib/message/cslib/src/msg_file.cpp | 4 ++++ lib/message/cslib/src/msg_mpi_one.cpp | 4 ++++ lib/message/cslib/src/msg_mpi_two.cpp | 4 ++++ lib/message/cslib/src/msg_zmq.cpp | 4 ++++ 9 files changed, 33 insertions(+), 1 deletion(-) rename lib/message/cslib/src/STUBS_MPI/{mpi.h => mpi_dummy.h} (100%) diff --git a/lib/message/cslib/src/STUBS_MPI/mpi.h b/lib/message/cslib/src/STUBS_MPI/mpi_dummy.h similarity index 100% rename from lib/message/cslib/src/STUBS_MPI/mpi.h rename to lib/message/cslib/src/STUBS_MPI/mpi_dummy.h diff --git a/lib/message/cslib/src/cslib.cpp b/lib/message/cslib/src/cslib.cpp index 874333607e..336ba87588 100644 --- a/lib/message/cslib/src/cslib.cpp +++ b/lib/message/cslib/src/cslib.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/cslib_wrap.cpp b/lib/message/cslib/src/cslib_wrap.cpp index c2d69eaf0d..64b4d53b25 100644 --- a/lib/message/cslib/src/cslib_wrap.cpp +++ b/lib/message/cslib/src/cslib_wrap.cpp @@ -14,7 +14,11 @@ // C style library interface to CSlib class +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/msg.cpp b/lib/message/cslib/src/msg.cpp index da22c81850..ff654ecbcf 100644 --- a/lib/message/cslib/src/msg.cpp +++ b/lib/message/cslib/src/msg.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/msg.h b/lib/message/cslib/src/msg.h index f75942b027..81c2d21cb9 100644 --- a/lib/message/cslib/src/msg.h +++ b/lib/message/cslib/src/msg.h @@ -15,7 +15,11 @@ #ifndef MSG_H #define MSG_H +#ifdef MPI_YES #include +#else +#include +#endif namespace CSLIB_NS { @@ -37,7 +41,7 @@ class Msg { int nfield; int *fieldID,*fieldtype,*fieldlen; int lengths[2]; - + void init(int); void allocate(int, int &, int *&, int, int &, char *&); void *smalloc(int); diff --git a/lib/message/cslib/src/msg_file.cpp b/lib/message/cslib/src/msg_file.cpp index d97e249fad..31cdfef544 100644 --- a/lib/message/cslib/src/msg_file.cpp +++ b/lib/message/cslib/src/msg_file.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/msg_mpi_one.cpp b/lib/message/cslib/src/msg_mpi_one.cpp index db11735b27..c6fbd8732f 100644 --- a/lib/message/cslib/src/msg_mpi_one.cpp +++ b/lib/message/cslib/src/msg_mpi_one.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/msg_mpi_two.cpp b/lib/message/cslib/src/msg_mpi_two.cpp index e9a9e87eeb..2a4fa65ff7 100644 --- a/lib/message/cslib/src/msg_mpi_two.cpp +++ b/lib/message/cslib/src/msg_mpi_two.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include diff --git a/lib/message/cslib/src/msg_zmq.cpp b/lib/message/cslib/src/msg_zmq.cpp index c2d408f3a5..8bee3aebde 100644 --- a/lib/message/cslib/src/msg_zmq.cpp +++ b/lib/message/cslib/src/msg_zmq.cpp @@ -12,7 +12,11 @@ See the README file in the top-level CSlib directory. ------------------------------------------------------------------------- */ +#ifdef MPI_YES #include +#else +#include +#endif #include #include #include From f2f49e60bf42dd1ce1391e69c747c478fc03f288 Mon Sep 17 00:00:00 2001 From: mkanski Date: Wed, 3 Apr 2019 18:12:12 +0200 Subject: [PATCH 60/68] Make some errors more elaborate + change some error->all to error->one --- src/USER-REAXC/pair_reaxc.cpp | 1 + src/USER-REAXC/reaxc_ffield.cpp | 17 +++++++++++------ src/USER-REAXC/reaxc_forces.cpp | 2 +- src/USER-REAXC/reaxc_init_md.cpp | 29 +++++++---------------------- src/USER-REAXC/reaxc_list.cpp | 2 +- src/USER-REAXC/reaxc_tool_box.cpp | 6 +++--- src/USER-REAXC/reaxc_traj.cpp | 4 ++-- src/USER-REAXC/reaxc_types.h | 6 ++---- 8 files changed, 28 insertions(+), 39 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 8b36019881..18e7ef2f04 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -431,6 +431,7 @@ void PairReaxC::setup( ) int *num_hbonds = fix_reax->num_hbonds; control->vlist_cut = neighbor->cutneighmax; + control->me = comm->me; // determine the local and total capacity diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 36b7105ce8..13e928ad08 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -61,7 +61,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, n = atoi(tmp[0]); if (n < 1) { if (me == 0) - control->error_ptr->warning( FLERR, "Number of globals in ffield file is 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); @@ -141,6 +141,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, reax->gp.vdw_type = 0; + char errmsg[1024]; for( i = 0; i < reax->num_atom_types; i++ ) { /* line one */ @@ -152,7 +153,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); if (c < 9) { - control->error_ptr->all(FLERR,"Inconsistent ffield file"); + 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 ) @@ -174,7 +176,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->all(FLERR,"Inconsistent ffield file"); + 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; @@ -192,7 +195,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->all(FLERR,"Inconsistent ffield file"); + 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; @@ -210,7 +214,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity check */ if (c < 8) { - control->error_ptr->all(FLERR,"Inconsistent ffield file"); + 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; @@ -287,7 +292,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } } else { char errmsg[256]; - snprintf(errmsg, 256, "Inconsistent vdWaals-parameters " + 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); diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 8c602e9156..186cde681a 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -168,7 +168,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l 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->all(FLERR, errmsg); + system->error_ptr->one(FLERR, errmsg); } } } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index 8ac9f0e53c..c1239e0cbb 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -223,49 +223,34 @@ void Initialize( reax_system *system, control_params *control, if (Init_MPI_Datatypes(system, workspace, mpi_data, comm, msg) == FAILURE) { - - snprintf(errmsg, 128, "Could not create datatypes on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Could not create datatypes"); } if (Init_System(system, control, msg) == FAILURE) { - snprintf(errmsg, 128, "System could not be initialized on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"System could not be initialized"); } if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) { - snprintf(errmsg, 128, "Sim_data could not be initialized on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Sim_data could not be initialized"); } if (Init_Workspace( system, control, workspace, msg ) == FAILURE) { - snprintf(errmsg, 128, "Workspace could not be initialized on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Workspace could not be initialized"); } if (Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { - snprintf(errmsg, 128, "System could not be initialized on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Lists could not be initialized"); } if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) { - snprintf(errmsg, 128, "Could not open output files on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Could not open output files"); } if (control->tabulate) { if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) { - snprintf(errmsg, 128, "Lookup table could not be created on thread %d", - system->my_rank); - control->error_ptr->one(FLERR,errmsg); + control->error_ptr->one(FLERR,"Lookup table could not be created"); } } diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 2e86c3c06b..cd4f815286 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -91,7 +91,7 @@ int Make_List(int n, int num_intrs, int type, reax_list *l ) default: char errmsg[128]; snprintf(errmsg, 128, "No %d list type defined", l->type); - l->error_ptr->all(FLERR,errmsg); + l->error_ptr->one(FLERR,errmsg); } return SUCCESS; diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index df8d7c85bf..b6058b2516 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -66,7 +66,7 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) if (n <= 0) { snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. " "returning NULL.", n, name); - error_ptr->warning(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); return NULL; } @@ -89,14 +89,14 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c if (n <= 0) { snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. " "returning NULL.\n", n, name ); - error_ptr->warning(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); return NULL; } if (size <= 0) { snprintf(errmsg, 256, "Elements size for array %s is %ld. " "returning NULL", name, size ); - error_ptr->warning(FLERR,errmsg); + error_ptr->one(FLERR,errmsg); return NULL; } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index d25221512e..5adc0cfbb9 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -531,7 +531,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q ); break; default: - system->error_ptr->all(FLERR,"Write_traj_atoms: unknown atom trajectory format"); + 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 ); @@ -617,7 +617,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2 ); break; default: - system->error_ptr->all(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option"); + 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 ); diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index d390768ac6..cdc2916a66 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -395,8 +395,6 @@ typedef struct double ghost_cutoff; } boundary_cutoff; -using LAMMPS_NS::Pair; - struct _reax_system { reax_interaction reax_param; @@ -414,8 +412,8 @@ struct _reax_system boundary_cutoff bndry_cuts; reax_atom *my_atoms; - class LAMMPS_NS::Error *error_ptr; - class Pair *pair_ptr; + class LAMMPS_NS::Error *error_ptr; + class LAMMPS_NS::Pair *pair_ptr; int my_bonds; int mincap; double safezone, saferzone; From 1a105253c13937857fd24766b1d24ec8c35f289d Mon Sep 17 00:00:00 2001 From: mkanski Date: Wed, 3 Apr 2019 18:24:38 +0200 Subject: [PATCH 61/68] Check the MPI rank differently --- src/USER-REAXC/pair_reaxc.cpp | 1 - src/USER-REAXC/reaxc_init_md.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 18e7ef2f04..8b36019881 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -431,7 +431,6 @@ void PairReaxC::setup( ) int *num_hbonds = fix_reax->num_hbonds; control->vlist_cut = neighbor->cutneighmax; - control->me = comm->me; // determine the local and total capacity diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index c1239e0cbb..dfd92ec7a3 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -91,13 +91,13 @@ void Init_Taper( control_params *control, storage *workspace ) swa = control->nonb_low; swb = control->nonb_cut; - if (fabs( swa ) > 0.01 && control->me == 0) + if (fabs( swa ) > 0.01 && control->my_rank == 0) control->error_ptr->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); if (swb < 0) { control->error_ptr->all(FLERR,"Negative upper Taper-radius cutoff"); } - else if( swb < 5 && control->me == 0) { + else if( swb < 5 && control->my_rank == 0) { char errmsg[256]; snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb ); control->error_ptr->warning( FLERR, errmsg ); From d7a5bf4e164bd0c7ea9e18812685584e8fcc54c3 Mon Sep 17 00:00:00 2001 From: mkanski Date: Wed, 3 Apr 2019 18:52:14 +0200 Subject: [PATCH 62/68] Repair last commit --- src/USER-REAXC/pair_reaxc.cpp | 1 + src/USER-REAXC/reaxc_init_md.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 8b36019881..1f30cdad43 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -91,6 +91,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) memory->smalloc(sizeof(mpi_datatypes),"reax:mpi"); MPI_Comm_rank(world,&system->my_rank); + control->me = system->my_rank; system->my_coords[0] = 0; system->my_coords[1] = 0; diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index dfd92ec7a3..c1239e0cbb 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -91,13 +91,13 @@ void Init_Taper( control_params *control, storage *workspace ) swa = control->nonb_low; swb = control->nonb_cut; - if (fabs( swa ) > 0.01 && control->my_rank == 0) + if (fabs( swa ) > 0.01 && control->me == 0) control->error_ptr->warning( FLERR, "Non-zero lower Taper-radius cutoff" ); if (swb < 0) { control->error_ptr->all(FLERR,"Negative upper Taper-radius cutoff"); } - else if( swb < 5 && control->my_rank == 0) { + else if( swb < 5 && control->me == 0) { char errmsg[256]; snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb ); control->error_ptr->warning( FLERR, errmsg ); From d4a495151e53744ecafa1c40f1f4dd894447c2e1 Mon Sep 17 00:00:00 2001 From: mkanski Date: Wed, 3 Apr 2019 19:40:40 +0200 Subject: [PATCH 63/68] Simplify access to error in reax/c/omp --- src/USER-OMP/pair_reaxc_omp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 9e198186fd..92ba31048d 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -113,7 +113,7 @@ PairReaxCOMP::~PairReaxCOMP() if (setup_flag) { reax_list * bonds = lists+BONDS; for (int i=0; inum_intrs; ++i) - sfree(LAMMPS_NS::Pointers::lmp->error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); + sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); } memory->destroy(num_nbrs_offset); From 6ff1fee6d656a084c95a70f372a5b46c79c3df0e Mon Sep 17 00:00:00 2001 From: mkanski Date: Thu, 4 Apr 2019 09:54:39 +0200 Subject: [PATCH 64/68] more simplifications --- src/USER-REAXC/pair_reaxc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c87bb410ce..6bb2b9a197 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -109,8 +109,8 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->bndry_cuts.ghost_cutoff = 0; system->my_atoms = NULL; system->pair_ptr = this; - system->error_ptr = this->lmp->error; - control->error_ptr = this->lmp->error; + system->error_ptr = error; + control->error_ptr = error; system->omp_active = 0; @@ -447,7 +447,7 @@ void PairReaxC::setup( ) if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, lists+FAR_NBRS)) error->one(FLERR,"Pair reax/c problem in far neighbor list"); - (lists+FAR_NBRS)->error_ptr=lmp->error; + (lists+FAR_NBRS)->error_ptr=error; write_reax_lists(); Initialize( system, control, data, workspace, &lists, out_control, From 8c03f510203f3aebd9b2e44854b904477711d438 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 09:01:39 -0400 Subject: [PATCH 65/68] fix 32-bit/64-bit overflow issue in expression --- src/irregular.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/irregular.cpp b/src/irregular.cpp index 848d853f2a..1865f9cbf6 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -921,7 +921,7 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf) // post all receives, starting after self copies - bigint offset = num_self*nbytes; + bigint offset = num_self*(bigint)nbytes; for (int irecv = 0; irecv < nrecv_proc; irecv++) { MPI_Irecv(&recvbuf[offset],num_recv[irecv]*nbytes,MPI_CHAR, proc_recv[irecv],0,world,&request[irecv]); @@ -964,13 +964,6 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf) // wait on all incoming messages if (nrecv_proc) MPI_Waitall(nrecv_proc,request,status); - - // approximate memory tally - // DEBUG lines - - //bigint irregular_bytes = 2*nprocs*sizeof(int); - //irregular_bytes += maxindex*sizeof(int); - //irregular_bytes += maxbuf; } /* ---------------------------------------------------------------------- From 88d160f86eba2ae19322a8335fafc1228650f3c4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 09:13:18 -0400 Subject: [PATCH 66/68] avoid segfault in Special::angle_trim() if only angles or only dihedrals are defined --- src/special.cpp | 201 ++++++++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 94 deletions(-) diff --git a/src/special.cpp b/src/special.cpp index 7f855163e0..903794c0f6 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -821,21 +821,26 @@ void Special::angle_trim() int nsend = 0; for (i = 0; i < nlocal; i++) { - for (j = 0; j < num_angle[i]; j++) { - if (tag[i] != angle_atom2[i][j]) continue; - m = atom->map(angle_atom1[i][j]); - if (m < 0 || m >= nlocal) nsend++; - m = atom->map(angle_atom3[i][j]); - if (m < 0 || m >= nlocal) nsend++; + if (num_angle) { + for (j = 0; j < num_angle[i]; j++) { + if (tag[i] != angle_atom2[i][j]) continue; + m = atom->map(angle_atom1[i][j]); + if (m < 0 || m >= nlocal) nsend++; + m = atom->map(angle_atom3[i][j]); + if (m < 0 || m >= nlocal) nsend++; + } } - for (j = 0; j < num_dihedral[i]; j++) { - if (tag[i] != dihedral_atom2[i][j]) continue; - m = atom->map(dihedral_atom1[i][j]); - if (m < 0 || m >= nlocal) nsend++; - m = atom->map(dihedral_atom3[i][j]); - if (m < 0 || m >= nlocal) nsend++; - m = atom->map(dihedral_atom4[i][j]); - if (m < 0 || m >= nlocal) nsend++; + + if (num_dihedral) { + for (j = 0; j < num_dihedral[i]; j++) { + if (tag[i] != dihedral_atom2[i][j]) continue; + m = atom->map(dihedral_atom1[i][j]); + if (m < 0 || m >= nlocal) nsend++; + m = atom->map(dihedral_atom3[i][j]); + if (m < 0 || m >= nlocal) nsend++; + m = atom->map(dihedral_atom4[i][j]); + if (m < 0 || m >= nlocal) nsend++; + } } } @@ -852,51 +857,55 @@ void Special::angle_trim() nsend = 0; for (i = 0; i < nlocal; i++) { - for (j = 0; j < num_angle[i]; j++) { - if (tag[i] != angle_atom2[i][j]) continue; + if (num_angle) { + for (j = 0; j < num_angle[i]; j++) { + if (tag[i] != angle_atom2[i][j]) continue; - m = atom->map(angle_atom1[i][j]); - if (m < 0 || m >= nlocal) { - proclist[nsend] = angle_atom1[i][j] % nprocs; - inbuf[nsend].atomID = angle_atom1[i][j]; - inbuf[nsend].partnerID = angle_atom3[i][j]; - nsend++; - } + m = atom->map(angle_atom1[i][j]); + if (m < 0 || m >= nlocal) { + proclist[nsend] = angle_atom1[i][j] % nprocs; + inbuf[nsend].atomID = angle_atom1[i][j]; + inbuf[nsend].partnerID = angle_atom3[i][j]; + nsend++; + } - m = atom->map(angle_atom3[i][j]); - if (m < 0 || m >= nlocal) { - proclist[nsend] = angle_atom3[i][j] % nprocs; - inbuf[nsend].atomID = angle_atom3[i][j]; - inbuf[nsend].partnerID = angle_atom1[i][j]; - nsend++; + m = atom->map(angle_atom3[i][j]); + if (m < 0 || m >= nlocal) { + proclist[nsend] = angle_atom3[i][j] % nprocs; + inbuf[nsend].atomID = angle_atom3[i][j]; + inbuf[nsend].partnerID = angle_atom1[i][j]; + nsend++; + } } } - for (j = 0; j < num_dihedral[i]; j++) { - if (tag[i] != dihedral_atom2[i][j]) continue; + if (num_dihedral) { + for (j = 0; j < num_dihedral[i]; j++) { + if (tag[i] != dihedral_atom2[i][j]) continue; - m = atom->map(dihedral_atom1[i][j]); - if (m < 0 || m >= nlocal) { - proclist[nsend] = dihedral_atom1[i][j] % nprocs; - inbuf[nsend].atomID = dihedral_atom1[i][j]; - inbuf[nsend].partnerID = dihedral_atom3[i][j]; - nsend++; - } + m = atom->map(dihedral_atom1[i][j]); + if (m < 0 || m >= nlocal) { + proclist[nsend] = dihedral_atom1[i][j] % nprocs; + inbuf[nsend].atomID = dihedral_atom1[i][j]; + inbuf[nsend].partnerID = dihedral_atom3[i][j]; + nsend++; + } - m = atom->map(dihedral_atom3[i][j]); - if (m < 0 || m >= nlocal) { - proclist[nsend] = dihedral_atom3[i][j] % nprocs; - inbuf[nsend].atomID = dihedral_atom3[i][j]; - inbuf[nsend].partnerID = dihedral_atom1[i][j]; - nsend++; - } + m = atom->map(dihedral_atom3[i][j]); + if (m < 0 || m >= nlocal) { + proclist[nsend] = dihedral_atom3[i][j] % nprocs; + inbuf[nsend].atomID = dihedral_atom3[i][j]; + inbuf[nsend].partnerID = dihedral_atom1[i][j]; + nsend++; + } - m = atom->map(dihedral_atom4[i][j]); - if (m < 0 || m >= nlocal) { - proclist[nsend] = dihedral_atom4[i][j] % nprocs; - inbuf[nsend].atomID = dihedral_atom4[i][j]; - inbuf[nsend].partnerID = dihedral_atom2[i][j]; - nsend++; + m = atom->map(dihedral_atom4[i][j]); + if (m < 0 || m >= nlocal) { + proclist[nsend] = dihedral_atom4[i][j] % nprocs; + inbuf[nsend].atomID = dihedral_atom4[i][j]; + inbuf[nsend].partnerID = dihedral_atom2[i][j]; + nsend++; + } } } } @@ -932,56 +941,60 @@ void Special::angle_trim() // output datums = pairs of atoms that are 1-3 neighbors for (i = 0; i < nlocal; i++) { - for (j = 0; j < num_angle[i]; j++) { - if (tag[i] != angle_atom2[i][j]) continue; + if (num_angle) { + for (j = 0; j < num_angle[i]; j++) { + if (tag[i] != angle_atom2[i][j]) continue; - m = atom->map(angle_atom1[i][j]); - if (m >= 0 && m < nlocal) { - for (k = 0; k < nspecial[m][1]; k++) - if (onethree[m][k] == angle_atom3[i][j]) { - flag[m][k] = 1; - break; - } - } + m = atom->map(angle_atom1[i][j]); + if (m >= 0 && m < nlocal) { + for (k = 0; k < nspecial[m][1]; k++) + if (onethree[m][k] == angle_atom3[i][j]) { + flag[m][k] = 1; + break; + } + } - m = atom->map(angle_atom3[i][j]); - if (m >= 0 && m < nlocal) { - for (k = 0; k < nspecial[m][1]; k++) - if (onethree[m][k] == angle_atom1[i][j]) { - flag[m][k] = 1; - break; - } + m = atom->map(angle_atom3[i][j]); + if (m >= 0 && m < nlocal) { + for (k = 0; k < nspecial[m][1]; k++) + if (onethree[m][k] == angle_atom1[i][j]) { + flag[m][k] = 1; + break; + } + } } } - for (j = 0; j < num_dihedral[i]; j++) { - if (tag[i] != dihedral_atom2[i][j]) continue; + if (num_dihedral) { + for (j = 0; j < num_dihedral[i]; j++) { + if (tag[i] != dihedral_atom2[i][j]) continue; - m = atom->map(dihedral_atom1[i][j]); - if (m >= 0 && m < nlocal) { - for (k = 0; k < nspecial[m][1]; k++) - if (onethree[m][k] == dihedral_atom3[i][j]) { - flag[m][k] = 1; - break; - } - } + m = atom->map(dihedral_atom1[i][j]); + if (m >= 0 && m < nlocal) { + for (k = 0; k < nspecial[m][1]; k++) + if (onethree[m][k] == dihedral_atom3[i][j]) { + flag[m][k] = 1; + break; + } + } - m = atom->map(dihedral_atom3[i][j]); - if (m >= 0 && m < nlocal) { - for (k = 0; k < nspecial[m][1]; k++) - if (onethree[m][k] == dihedral_atom1[i][j]) { - flag[m][k] = 1; - break; - } - } + m = atom->map(dihedral_atom3[i][j]); + if (m >= 0 && m < nlocal) { + for (k = 0; k < nspecial[m][1]; k++) + if (onethree[m][k] == dihedral_atom1[i][j]) { + flag[m][k] = 1; + break; + } + } - m = atom->map(dihedral_atom4[i][j]); - if (m >= 0 && m < nlocal) { - for (k = 0; k < nspecial[m][1]; k++) - if (onethree[m][k] == dihedral_atom2[i][j]) { - flag[m][k] = 1; - break; - } + m = atom->map(dihedral_atom4[i][j]); + if (m >= 0 && m < nlocal) { + for (k = 0; k < nspecial[m][1]; k++) + if (onethree[m][k] == dihedral_atom2[i][j]) { + flag[m][k] = 1; + break; + } + } } } } @@ -1012,7 +1025,7 @@ void Special::angle_trim() memory->destroy(flag); - // if no angles or dihedrals are defined, delete all 1-3 neighs + // if no angles or dihedrals are defined, delete all 1-3 neighs } else { for (i = 0; i < nlocal; i++) nspecial[i][1] = 0; From a9c376f20d735cccf3527fe42ea57988ed4e9286 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 09:38:28 -0400 Subject: [PATCH 67/68] use tagint instead of int when communicating atom ids --- src/USER-MISC/fix_pimd.cpp | 8 ++++---- src/USER-MISC/fix_pimd.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index eba8ed5d0c..3929d47d6b 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -637,14 +637,14 @@ void FixPIMD::comm_exec(double **ptr) if(nsend > max_nsend) { max_nsend = nsend+200; - tag_send = (int*) memory->srealloc(tag_send, sizeof(int)*max_nsend, "FixPIMD:tag_send"); + tag_send = (tagint*) memory->srealloc(tag_send, sizeof(tagint)*max_nsend, "FixPIMD:tag_send"); buf_send = (double*) memory->srealloc(buf_send, sizeof(double)*max_nsend*3, "FixPIMD:x_send"); } // send tags - MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0, - tag_send, nsend, MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE); + MPI_Sendrecv( atom->tag, nlocal, MPI_LMP_TAGINT, plan_send[iplan], 0, + tag_send, nsend, MPI_LMP_TAGINT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE); // wrap positions @@ -661,7 +661,7 @@ void FixPIMD::comm_exec(double **ptr) sprintf(error_line, "Atom " TAGINT_FORMAT " is missing at world [%d] " "rank [%d] required by rank [%d] (" TAGINT_FORMAT ", " - TAGINT_FORMAT ", " TAGINT_FORMAT ").\n",tag_send[i], + TAGINT_FORMAT ", " TAGINT_FORMAT ").\n", tag_send[i], universe->iworld, comm->me, plan_recv[iplan], atom->tag[0], atom->tag[1], atom->tag[2]); diff --git a/src/USER-MISC/fix_pimd.h b/src/USER-MISC/fix_pimd.h index 411fa42c81..c298af0b69 100644 --- a/src/USER-MISC/fix_pimd.h +++ b/src/USER-MISC/fix_pimd.h @@ -68,7 +68,7 @@ class FixPIMD : public Fix { /* inter-partition communication */ int max_nsend; - int* tag_send; + tagint* tag_send; double *buf_send; int max_nlocal; From 50427ce05df76592752414c7c22194f245a112bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 09:38:53 -0400 Subject: [PATCH 68/68] flag intended fallthrough cases for GNU compilers --- src/hashlittle.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/hashlittle.cpp b/src/hashlittle.cpp index 0abcd2bcc5..38f192ad76 100644 --- a/src/hashlittle.cpp +++ b/src/hashlittle.cpp @@ -23,6 +23,16 @@ # endif #endif +// declaration to indicate intended fallthrough cases in switch statements +// and thus silence the warnings produced by g++ -Wextra + +#if defined(__GNUC__) +#define _fallthrough __attribute__ ((fallthrough)) +#else +#define _fallthrough +#endif + + #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) /* @@ -291,17 +301,17 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval) /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; + case 12: c+=((uint32_t)k[11])<<24; _fallthrough; + case 11: c+=((uint32_t)k[10])<<16; _fallthrough; + case 10: c+=((uint32_t)k[9])<<8; _fallthrough; + case 9 : c+=k[8]; _fallthrough; + case 8 : b+=((uint32_t)k[7])<<24; _fallthrough; + case 7 : b+=((uint32_t)k[6])<<16; _fallthrough; + case 6 : b+=((uint32_t)k[5])<<8; _fallthrough; + case 5 : b+=k[4]; _fallthrough; + case 4 : a+=((uint32_t)k[3])<<24; _fallthrough; + case 3 : a+=((uint32_t)k[2])<<16; _fallthrough; + case 2 : a+=((uint32_t)k[1])<<8; _fallthrough; case 1 : a+=k[0]; break; case 0 : return c;