forked from lijiext/lammps
Merge pull request #1494 from mkanski/extep_hybrid
Fix for extep when NULL or only some elements from potential file are used.
This commit is contained in:
commit
8d985e53f4
|
@ -19,6 +19,7 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#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; iel<atom->ntypes; iel++) {
|
||||
for ( int jel=0; jel<atom->ntypes; jel++) {
|
||||
for ( int iel=0; iel<nelements; iel++) {
|
||||
for ( int jel=0; jel<nelements; jel++) {
|
||||
for ( int N_ij=0; N_ij<4; N_ij++ ) {
|
||||
for ( int N_ji=0; N_ji<4; N_ji++ ) {
|
||||
TF_corr_param &f = F_corr_param[iel][jel][N_ij][N_ji];
|
||||
|
|
Loading…
Reference in New Issue