All errors and warning are now printed through LAMMPS
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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<int>
|
||||
(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;
|
||||
}
|
||||
|
||||
@ -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* );
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 )
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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* );
|
||||
|
||||
@ -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" );
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -39,6 +39,9 @@
|
||||
#include <sys/time.h>
|
||||
#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*,
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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* );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user