forked from lijiext/lammps
Update pair eam cd
This commit is contained in:
parent
0dc05698f3
commit
e8ee1df993
|
@ -28,6 +28,7 @@
|
|||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "tokenizer.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
|
@ -512,16 +513,20 @@ void PairEAMCD::read_h_coeff(char *filename)
|
|||
while(fgets(nextline, MAXLINE, fptr) != NULL) {
|
||||
strcpy(line, nextline);
|
||||
}
|
||||
char* ptr = strtok(line, " \t\n\r\f");
|
||||
int degree = atoi(ptr);
|
||||
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
int degree = values.next_int();
|
||||
nhcoeff = degree+1;
|
||||
|
||||
if (values.count() != nhcoeff + 1 || nhcoeff < 1)
|
||||
error->one(FLERR, "Failed to read h(x) function coefficients in EAM file.");
|
||||
|
||||
hcoeff = new double[nhcoeff];
|
||||
|
||||
int i = 0;
|
||||
while((ptr = strtok(NULL," \t\n\r\f")) != NULL && i < nhcoeff) {
|
||||
hcoeff[i++] = atof(ptr);
|
||||
while(values.has_next()) {
|
||||
hcoeff[i++] = values.next_double();
|
||||
}
|
||||
if (i != nhcoeff || nhcoeff < 1)
|
||||
error->one(FLERR,"Failed to read h(x) function coefficients from EAM file.");
|
||||
|
||||
// Close the potential file.
|
||||
|
||||
|
|
Loading…
Reference in New Issue