more thorough checking if the reaxff force field is consistent.
This commit is contained in:
@ -337,6 +337,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
|
||||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
if ((c < 10) || (j < 0) || (k < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types) {
|
||||
|
||||
@ -361,6 +363,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
/* line 2 */
|
||||
fgets(s,MAX_LINE,fp);
|
||||
c=Tokenize(s,&tmp);
|
||||
if (c < 8)
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
val = atof(tmp[0]); reax->tbp[j][k].p_be2 = val;
|
||||
reax->tbp[k][j].p_be2 = val;
|
||||
@ -491,6 +495,9 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
|
||||
if ((c < (lgflag ? 9 : 8)) || (j < 0) || (k < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types) {
|
||||
val = atof(tmp[2]);
|
||||
if (val > 0.0) {
|
||||
@ -528,10 +535,12 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
reax->tbp[k][j].r_pp = val;
|
||||
}
|
||||
|
||||
val = atof(tmp[8]);
|
||||
if (val >= 0.0) {
|
||||
reax->tbp[j][k].lgcij = val;
|
||||
reax->tbp[k][j].lgcij = val;
|
||||
if (lgflag) {
|
||||
val = atof(tmp[8]);
|
||||
if (val >= 0.0) {
|
||||
reax->tbp[j][k].lgcij = val;
|
||||
reax->tbp[k][j].lgcij = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -552,6 +561,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
if ((c < 10) || (j < 0) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types &&
|
||||
m < reax->num_atom_types) {
|
||||
@ -611,6 +622,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
n = atoi(tmp[3]) - 1;
|
||||
if ((c < 9) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j >= 0 && n >= 0) { // this means the entry is not in compact form
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types &&
|
||||
@ -667,8 +680,6 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* next line is number of hydrogen bond params and some comments */
|
||||
fgets( s, MAX_LINE, fp );
|
||||
c = Tokenize( s, &tmp );
|
||||
@ -686,7 +697,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
||||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
|
||||
if ((c < 7) || (j < 0) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && m < reax->num_atom_types) {
|
||||
val = atof(tmp[3]);
|
||||
|
||||
Reference in New Issue
Block a user