Make some errors more elaborate + change some error->all to error->one

This commit is contained in:
mkanski 2019-04-03 18:12:12 +02:00
parent 799c16a8b2
commit f2f49e60bf
8 changed files with 28 additions and 39 deletions

View File

@ -431,6 +431,7 @@ void PairReaxC::setup( )
int *num_hbonds = fix_reax->num_hbonds;
control->vlist_cut = neighbor->cutneighmax;
control->me = comm->me;
// determine the local and total capacity

View File

@ -61,7 +61,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
n = atoi(tmp[0]);
if (n < 1) {
if (me == 0)
control->error_ptr->warning( FLERR, "Number of globals in ffield file is 0" );
control->error_ptr->warning( FLERR, "Number of globals in ffield file is 0. The file will not be read." );
fclose(fp);
free(s);
free(tmp);
@ -141,6 +141,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
reax->gp.vdw_type = 0;
char errmsg[1024];
for( i = 0; i < reax->num_atom_types; i++ ) {
/* line one */
@ -152,7 +153,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'");
if (c < 9) {
control->error_ptr->all(FLERR,"Inconsistent ffield file");
snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s);
control->error_ptr->all(FLERR, errmsg);
}
for( j = 0; j < (int)(strlen(tmp[0])); ++j )
@ -174,7 +176,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
/* Sanity check */
if (c < 8) {
control->error_ptr->all(FLERR,"Inconsistent ffield file");
snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s);
control->error_ptr->all(FLERR, errmsg);
}
val = atof(tmp[0]); reax->sbp[i].alpha = val;
@ -192,7 +195,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
/* Sanity check */
if (c < 8) {
control->error_ptr->all(FLERR,"Inconsistent ffield file");
snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s);
control->error_ptr->all(FLERR, errmsg);
}
val = atof(tmp[0]); reax->sbp[i].r_pi_pi = val;
@ -210,7 +214,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
/* Sanity check */
if (c < 8) {
control->error_ptr->all(FLERR,"Inconsistent ffield file");
snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s);
control->error_ptr->all(FLERR, errmsg);
}
val = atof(tmp[0]); reax->sbp[i].p_ovun2 = val;
@ -287,7 +292,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
}
} else {
char errmsg[256];
snprintf(errmsg, 256, "Inconsistent vdWaals-parameters "
snprintf(errmsg, 256, "Inconsistent vdWaals-parameters: "
"No shielding or inner-wall set for element %s",
reax->sbp[i].name);
control->error_ptr->all(FLERR, errmsg);

View File

@ -168,7 +168,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l
char errmsg[256];
snprintf(errmsg, 256, "step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n",
step, Hindex, End_Index(Hindex,hbonds), comp );
system->error_ptr->all(FLERR, errmsg);
system->error_ptr->one(FLERR, errmsg);
}
}
}

View File

@ -223,49 +223,34 @@ void Initialize( reax_system *system, control_params *control,
if (Init_MPI_Datatypes(system, workspace, mpi_data, comm, msg) == FAILURE) {
snprintf(errmsg, 128, "Could not create datatypes on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Could not create datatypes");
}
if (Init_System(system, control, msg) == FAILURE) {
snprintf(errmsg, 128, "System could not be initialized on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"System could not be initialized");
}
if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) {
snprintf(errmsg, 128, "Sim_data could not be initialized on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Sim_data could not be initialized");
}
if (Init_Workspace( system, control, workspace, msg ) ==
FAILURE) {
snprintf(errmsg, 128, "Workspace could not be initialized on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Workspace could not be initialized");
}
if (Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) ==
FAILURE) {
snprintf(errmsg, 128, "System could not be initialized on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Lists could not be initialized");
}
if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) {
snprintf(errmsg, 128, "Could not open output files on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Could not open output files");
}
if (control->tabulate) {
if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) {
snprintf(errmsg, 128, "Lookup table could not be created on thread %d",
system->my_rank);
control->error_ptr->one(FLERR,errmsg);
control->error_ptr->one(FLERR,"Lookup table could not be created");
}
}

View File

@ -91,7 +91,7 @@ int Make_List(int n, int num_intrs, int type, reax_list *l )
default:
char errmsg[128];
snprintf(errmsg, 128, "No %d list type defined", l->type);
l->error_ptr->all(FLERR,errmsg);
l->error_ptr->one(FLERR,errmsg);
}
return SUCCESS;

View File

@ -66,7 +66,7 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name )
if (n <= 0) {
snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. "
"returning NULL.", n, name);
error_ptr->warning(FLERR,errmsg);
error_ptr->one(FLERR,errmsg);
return NULL;
}
@ -89,14 +89,14 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c
if (n <= 0) {
snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. "
"returning NULL.\n", n, name );
error_ptr->warning(FLERR,errmsg);
error_ptr->one(FLERR,errmsg);
return NULL;
}
if (size <= 0) {
snprintf(errmsg, 256, "Elements size for array %s is %ld. "
"returning NULL", name, size );
error_ptr->warning(FLERR,errmsg);
error_ptr->one(FLERR,errmsg);
return NULL;
}

View File

@ -531,7 +531,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/,
p_atom->f[0], p_atom->f[1], p_atom->f[2], p_atom->q );
break;
default:
system->error_ptr->all(FLERR,"Write_traj_atoms: unknown atom trajectory format");
system->error_ptr->one(FLERR,"Write_traj_atoms: unknown atom trajectory format");
}
strncpy( out_control->buffer + i*line_len, out_control->line, line_len+1 );
@ -617,7 +617,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds,
bo_ij->bo_data.BO_pi, bo_ij->bo_data.BO_pi2 );
break;
default:
system->error_ptr->all(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option");
system->error_ptr->one(FLERR, "Write_traj_bonds: FATAL! invalid bond_info option");
}
strncpy( out_control->buffer + my_bonds*line_len,
out_control->line, line_len+1 );

View File

@ -395,8 +395,6 @@ typedef struct
double ghost_cutoff;
} boundary_cutoff;
using LAMMPS_NS::Pair;
struct _reax_system
{
reax_interaction reax_param;
@ -414,8 +412,8 @@ struct _reax_system
boundary_cutoff bndry_cuts;
reax_atom *my_atoms;
class LAMMPS_NS::Error *error_ptr;
class Pair *pair_ptr;
class LAMMPS_NS::Error *error_ptr;
class LAMMPS_NS::Pair *pair_ptr;
int my_bonds;
int mincap;
double safezone, saferzone;