diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 132b857dde..bd5da71f4a 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "pair_extep.h" #include "atom.h" #include "neighbor.h" @@ -705,7 +706,7 @@ void PairExTeP::read_file(char *file) error->all(FLERR,"Illegal ExTeP parameter"); nparams++; - if (nparams >= pow(atom->ntypes,3)) break; + if (nparams >= pow(nelements,3)) break; } // deallocate words array @@ -746,14 +747,24 @@ void PairExTeP::read_file(char *file) nwords = atom->count_words(line); if (nwords == 0) continue; - if (nwords != params_per_line) - error->all(FLERR,"Incorrect format in ExTeP potential file"); - // words = ptrs to all words in line nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((nwords < params_per_line) + && (words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + + // skip line if it is a leftover from the previous section, + // which can be identified by having 3 elements (instead of 2) + // as first words. + + if (isupper(words[0][0]) && isupper(words[1][0]) && isupper(words[2][0])) + continue; + + // need to have two elements followed by a number in each line + if (!(isupper(words[0][0]) && isupper(words[1][0]) + && !isupper(words[2][0]))) + error->all(FLERR,"Incorrect format in ExTeP potential file"); // ielement,jelement = 1st args // if all 3 args are in element list, then parse this line @@ -1074,8 +1085,8 @@ void PairExTeP::costheta_d(double *rij_hat, double rij, // initialize spline for F_corr (based on PairLCBOP::F_conj) void PairExTeP::spline_init() { - for ( int iel=0; ielntypes; iel++) { - for ( int jel=0; jelntypes; jel++) { + for ( int iel=0; iel