make use of utils::sfgets() in a few more places
This commit is contained in:
@ -45,6 +45,7 @@
|
|||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -4982,13 +4983,13 @@ void PairBOP::read_table(char *filename)
|
|||||||
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
||||||
error->one(FLERR,str);
|
error->one(FLERR,str);
|
||||||
}
|
}
|
||||||
fgets(s,MAXLINE,fp); // skip first comment line
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); // skip first comment line
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%d",&bop_types);
|
sscanf(s,"%d",&bop_types);
|
||||||
elements = new char*[bop_types];
|
elements = new char*[bop_types];
|
||||||
for(i=0;i<bop_types;i++) elements[i]=NULL;
|
for(i=0;i<bop_types;i++) elements[i]=NULL;
|
||||||
for(i=0;i<bop_types;i++) {
|
for(i=0;i<bop_types;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
nws=0;
|
nws=0;
|
||||||
ws=1;
|
ws=1;
|
||||||
for(j=0;j<(int)strlen(s);j++) {
|
for(j=0;j<(int)strlen(s);j++) {
|
||||||
@ -5017,7 +5018,7 @@ void PairBOP::read_table(char *filename)
|
|||||||
}
|
}
|
||||||
nws=0;
|
nws=0;
|
||||||
ws=1;
|
ws=1;
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
for(j=0;j<(int)strlen(s);j++) {
|
for(j=0;j<(int)strlen(s);j++) {
|
||||||
if(ws==1) {
|
if(ws==1) {
|
||||||
if(isspace(s[j])) {
|
if(isspace(s[j])) {
|
||||||
@ -5085,28 +5086,28 @@ void PairBOP::read_table(char *filename)
|
|||||||
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
||||||
error->one(FLERR,str);
|
error->one(FLERR,str);
|
||||||
}
|
}
|
||||||
fgets(s,MAXLINE,fp); // skip first comment line
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); // skip first comment line
|
||||||
for(i=0;i<bop_types+2;i++) {
|
for(i=0;i<bop_types+2;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
}
|
}
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf%lf%lf",&small1,&small2,&small3g
|
sscanf(s,"%lf%lf%lf%lf%lf%lf%lf",&small1,&small2,&small3g
|
||||||
,&small4,&small5,&small6,&small7);
|
,&small4,&small5,&small6,&small7);
|
||||||
for(i=0;i<bop_types;i++) {
|
for(i=0;i<bop_types;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&pi_p[i]);
|
sscanf(s,"%lf",&pi_p[i]);
|
||||||
}
|
}
|
||||||
cutmax=0;
|
cutmax=0;
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&rcut[i]);
|
sscanf(s,"%lf",&rcut[i]);
|
||||||
if(rcut[i]>cutmax)
|
if(rcut[i]>cutmax)
|
||||||
cutmax=rcut[i];
|
cutmax=rcut[i];
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf",&sigma_c[i],&sigma_a[i],&pi_c[i],&pi_a[i]);
|
sscanf(s,"%lf%lf%lf%lf",&sigma_c[i],&sigma_a[i],&pi_c[i],&pi_a[i]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf",&sigma_delta[i],&pi_delta[i]);
|
sscanf(s,"%lf%lf",&sigma_delta[i],&pi_delta[i]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf",&sigma_f[i],&sigma_k[i],&small3[i]);
|
sscanf(s,"%lf%lf%lf",&sigma_f[i],&sigma_k[i],&small3[i]);
|
||||||
}
|
}
|
||||||
if(nws==3) {
|
if(nws==3) {
|
||||||
@ -5115,56 +5116,56 @@ void PairBOP::read_table(char *filename)
|
|||||||
for(k=j;k<bop_types;k++) {
|
for(k=j;k<bop_types;k++) {
|
||||||
if(npower<=2) {
|
if(npower<=2) {
|
||||||
for(m=0;m<ntheta;m++) {
|
for(m=0;m<ntheta;m++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gfunc[j][i][k][n],&gfunc[j][i][k][n+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&gfunc[j][i][k][n],&gfunc[j][i][k][n+1]
|
||||||
,&gfunc[j][i][k][n+2],&gfunc[j][i][k][n+3],&gfunc[j][i][k][n+4]);
|
,&gfunc[j][i][k][n+2],&gfunc[j][i][k][n+3],&gfunc[j][i][k][n+4]);
|
||||||
n+=4;
|
n+=4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(npower==3) {
|
if(npower==3) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3]);
|
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3]);
|
||||||
}
|
}
|
||||||
else if(npower==4) {
|
else if(npower==4) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
}
|
}
|
||||||
else if(npower==5) {
|
else if(npower==5) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&gpara[j][i][k][5]);
|
sscanf(s,"%lf",&gpara[j][i][k][5]);
|
||||||
}
|
}
|
||||||
else if(npower==6) {
|
else if(npower==6) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6]);
|
sscanf(s,"%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6]);
|
||||||
}
|
}
|
||||||
else if(npower==7) {
|
else if(npower==7) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7]);
|
sscanf(s,"%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7]);
|
||||||
}
|
}
|
||||||
else if(npower==8) {
|
else if(npower==8) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8]);
|
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8]);
|
||||||
}
|
}
|
||||||
else if(npower==9) {
|
else if(npower==9) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
||||||
}
|
}
|
||||||
else if(npower==10) {
|
else if(npower==10) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&gpara[j][i][k][10]);
|
sscanf(s,"%lf",&gpara[j][i][k][10]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5173,14 +5174,14 @@ void PairBOP::read_table(char *filename)
|
|||||||
for(i=0;i<bop_types;i++)
|
for(i=0;i<bop_types;i++)
|
||||||
for(j=0;j<bop_types;j++)
|
for(j=0;j<bop_types;j++)
|
||||||
for(k=0;k<bop_types;k++) {
|
for(k=0;k<bop_types;k++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf",&gpara[i][j][k][0],&gpara[i][j][k][1],&gpara[i][j][k][2]);
|
sscanf(s,"%lf%lf%lf",&gpara[i][j][k][0],&gpara[i][j][k][1],&gpara[i][j][k][2]);
|
||||||
gpara[j][i][k][3]=0;
|
gpara[j][i][k][3]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
for(j=0;j<nr;j++) {
|
for(j=0;j<nr;j++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&pRepul[i][j],&pRepul[i][j+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&pRepul[i][j],&pRepul[i][j+1]
|
||||||
,&pRepul[i][j+2],&pRepul[i][j+3],&pRepul[i][j+4]);
|
,&pRepul[i][j+2],&pRepul[i][j+3],&pRepul[i][j+4]);
|
||||||
j+=4;
|
j+=4;
|
||||||
@ -5188,7 +5189,7 @@ void PairBOP::read_table(char *filename)
|
|||||||
}
|
}
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
for(j=0;j<nr;j++) {
|
for(j=0;j<nr;j++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaS[i][j],&pBetaS[i][j+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaS[i][j],&pBetaS[i][j+1]
|
||||||
,&pBetaS[i][j+2],&pBetaS[i][j+3],&pBetaS[i][j+4]);
|
,&pBetaS[i][j+2],&pBetaS[i][j+3],&pBetaS[i][j+4]);
|
||||||
j+=4;
|
j+=4;
|
||||||
@ -5196,7 +5197,7 @@ void PairBOP::read_table(char *filename)
|
|||||||
}
|
}
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
for(j=0;j<nr;j++) {
|
for(j=0;j<nr;j++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaP[i][j],&pBetaP[i][j+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaP[i][j],&pBetaP[i][j+1]
|
||||||
,&pBetaP[i][j+2],&pBetaP[i][j+3],&pBetaP[i][j+4]);
|
,&pBetaP[i][j+2],&pBetaP[i][j+3],&pBetaP[i][j+4]);
|
||||||
j+=4;
|
j+=4;
|
||||||
@ -5204,18 +5205,18 @@ void PairBOP::read_table(char *filename)
|
|||||||
}
|
}
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
for(j=0;j<nBOt;j++) {
|
for(j=0;j<nBOt;j++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&FsigBO[i][j],&FsigBO[i][j+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&FsigBO[i][j],&FsigBO[i][j+1]
|
||||||
,&FsigBO[i][j+2],&FsigBO[i][j+3],&FsigBO[i][j+4]);
|
,&FsigBO[i][j+2],&FsigBO[i][j+3],&FsigBO[i][j+4]);
|
||||||
j+=4;
|
j+=4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<bop_types;i++) {
|
for(i=0;i<bop_types;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&pro_delta[i]);
|
sscanf(s,"%lf",&pro_delta[i]);
|
||||||
}
|
}
|
||||||
for(i=0;i<bop_types;i++) {
|
for(i=0;i<bop_types;i++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf",&pro[i]);
|
sscanf(s,"%lf",&pro[i]);
|
||||||
}
|
}
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
@ -5232,7 +5233,7 @@ void PairBOP::read_table(char *filename)
|
|||||||
if(pass==1) {
|
if(pass==1) {
|
||||||
for(i=0;i<npairs;i++) {
|
for(i=0;i<npairs;i++) {
|
||||||
for(j=0;j<nr;j++) {
|
for(j=0;j<nr;j++) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lf%lf%lf%lf%lf",&pLong[i][j],&pLong[i][j+1]
|
sscanf(s,"%lf%lf%lf%lf%lf",&pLong[i][j],&pLong[i][j+1]
|
||||||
,&pLong[i][j+2],&pLong[i][j+3],&pLong[i][j+4]);
|
,&pLong[i][j+2],&pLong[i][j+3],&pLong[i][j+4]);
|
||||||
j+=4;
|
j+=4;
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include "math_const.h"
|
#include "math_const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace MathConst;
|
using namespace MathConst;
|
||||||
@ -319,12 +320,13 @@ void PairComb3::read_lib()
|
|||||||
// open libraray file on proc 0
|
// open libraray file on proc 0
|
||||||
|
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
FILE *fp = force->open_potential("lib.comb3");
|
const char filename[] = "lib.comb3";
|
||||||
|
FILE *fp = force->open_potential(filename);
|
||||||
if (fp == NULL) error->one(FLERR,"Cannot open COMB3 lib.comb3 file");
|
if (fp == NULL) error->one(FLERR,"Cannot open COMB3 lib.comb3 file");
|
||||||
|
|
||||||
// read and store at the same time
|
// read and store at the same time
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -335,7 +337,7 @@ void PairComb3::read_lib()
|
|||||||
ccutoff[4] = atof(words[4]);
|
ccutoff[4] = atof(words[4]);
|
||||||
ccutoff[5] = atof(words[5]);
|
ccutoff[5] = atof(words[5]);
|
||||||
|
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -347,7 +349,7 @@ void PairComb3::read_lib()
|
|||||||
ch_a[5] = atof(words[5]);
|
ch_a[5] = atof(words[5]);
|
||||||
ch_a[6] = atof(words[6]);
|
ch_a[6] = atof(words[6]);
|
||||||
|
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -355,7 +357,7 @@ void PairComb3::read_lib()
|
|||||||
nsplrad = atoi(words[1]);
|
nsplrad = atoi(words[1]);
|
||||||
nspltor = atoi(words[2]);
|
nspltor = atoi(words[2]);
|
||||||
|
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -363,7 +365,7 @@ void PairComb3::read_lib()
|
|||||||
maxy = atoi(words[1]);
|
maxy = atoi(words[1]);
|
||||||
maxz = atoi(words[2]);
|
maxz = atoi(words[2]);
|
||||||
|
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -372,7 +374,7 @@ void PairComb3::read_lib()
|
|||||||
maxconj = atoi(words[2]);
|
maxconj = atoi(words[2]);
|
||||||
|
|
||||||
for (l=0; l<nsplpcn; l++) {
|
for (l=0; l<nsplpcn; l++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -381,14 +383,14 @@ void PairComb3::read_lib()
|
|||||||
dvmaxxcn[l] = atof(words[3]);
|
dvmaxxcn[l] = atof(words[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
ntab = atoi(words[0]);
|
ntab = atoi(words[0]);
|
||||||
|
|
||||||
for (i=0; i<ntab+1; i++){
|
for (i=0; i<ntab+1; i++){
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -401,7 +403,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxx+1; i++)
|
for (i=0; i<maxx+1; i++)
|
||||||
for (j=0; j<maxy+1; j++)
|
for (j=0; j<maxy+1; j++)
|
||||||
for (k=0; k<maxz+1; k++) {
|
for (k=0; k<maxz+1; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -419,7 +421,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxx; i++)
|
for (i=0; i<maxx; i++)
|
||||||
for (j=0; j<maxy; j++)
|
for (j=0; j<maxy; j++)
|
||||||
for (k=0; k<maxz; k++) {
|
for (k=0; k<maxz; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -428,7 +430,7 @@ void PairComb3::read_lib()
|
|||||||
jj = atoi(words[2]);
|
jj = atoi(words[2]);
|
||||||
kk = atoi(words[3]);
|
kk = atoi(words[3]);
|
||||||
for(iii=0; iii<2; iii++) {
|
for(iii=0; iii<2; iii++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -443,7 +445,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxxc+1; i++)
|
for (i=0; i<maxxc+1; i++)
|
||||||
for (j=0; j<maxyc+1; j++)
|
for (j=0; j<maxyc+1; j++)
|
||||||
for (k=0; k<maxconj; k++) {
|
for (k=0; k<maxconj; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -461,7 +463,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxxc; i++)
|
for (i=0; i<maxxc; i++)
|
||||||
for (j=0; j<maxyc; j++)
|
for (j=0; j<maxyc; j++)
|
||||||
for (k=0; k<maxconj-1; k++) {
|
for (k=0; k<maxconj-1; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -470,7 +472,7 @@ void PairComb3::read_lib()
|
|||||||
jj = atoi(words[2]);
|
jj = atoi(words[2]);
|
||||||
kk = atoi(words[3])-1;
|
kk = atoi(words[3])-1;
|
||||||
for (iii=0; iii<2; iii++) {
|
for (iii=0; iii<2; iii++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -485,7 +487,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxxc+1; i++)
|
for (i=0; i<maxxc+1; i++)
|
||||||
for (j=0; j<maxyc+1; j++)
|
for (j=0; j<maxyc+1; j++)
|
||||||
for (k=0; k<maxconj; k++) {
|
for (k=0; k<maxconj; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -503,7 +505,7 @@ void PairComb3::read_lib()
|
|||||||
for (i=0; i<maxxc; i++)
|
for (i=0; i<maxxc; i++)
|
||||||
for (j=0; j<maxyc; j++)
|
for (j=0; j<maxyc; j++)
|
||||||
for (k=0; k<maxconj-1; k++) {
|
for (k=0; k<maxconj-1; k++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
@ -512,7 +514,7 @@ void PairComb3::read_lib()
|
|||||||
jj = atoi(words[2]);
|
jj = atoi(words[2]);
|
||||||
kk = atoi(words[3])-1;
|
kk = atoi(words[3])-1;
|
||||||
for(iii=0; iii<2; iii++) {
|
for(iii=0; iii<2; iii++) {
|
||||||
fgets(s,MAXLIB,fp);
|
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||||
nwords = 0;
|
nwords = 0;
|
||||||
words[nwords++] = strtok(s," \t\n\r\f");
|
words[nwords++] = strtok(s," \t\n\r\f");
|
||||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue;
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -466,10 +467,10 @@ void PairEAM::read_file(char *filename)
|
|||||||
|
|
||||||
int tmp,nwords;
|
int tmp,nwords;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg",&tmp,&file->mass);
|
sscanf(line,"%d %lg",&tmp,&file->mass);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
||||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||||
}
|
}
|
||||||
@ -784,7 +785,7 @@ void PairEAM::grab(FILE *fptr, int n, double *list)
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,NULL,error);
|
||||||
ptr = strtok(line," \t\n\r\f");
|
ptr = strtok(line," \t\n\r\f");
|
||||||
list[i++] = atof(ptr);
|
list[i++] = atof(ptr);
|
||||||
while ((ptr = strtok(NULL," \t\n\r\f"))) list[i++] = atof(ptr);
|
while ((ptr = strtok(NULL," \t\n\r\f"))) list[i++] = atof(ptr);
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -136,10 +137,10 @@ void PairEAMAlloy::read_file(char *filename)
|
|||||||
|
|
||||||
int n;
|
int n;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -164,7 +165,7 @@ void PairEAMAlloy::read_file(char *filename)
|
|||||||
delete [] words;
|
delete [] words;
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
||||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||||
}
|
}
|
||||||
@ -188,7 +189,7 @@ void PairEAMAlloy::read_file(char *filename)
|
|||||||
int i,j,tmp;
|
int i,j,tmp;
|
||||||
for (i = 0; i < file->nelements; i++) {
|
for (i = 0; i < file->nelements; i++) {
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
||||||
}
|
}
|
||||||
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -136,10 +137,10 @@ void PairEAMFS::read_file(char *filename)
|
|||||||
|
|
||||||
int n;
|
int n;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -164,7 +165,7 @@ void PairEAMFS::read_file(char *filename)
|
|||||||
delete [] words;
|
delete [] words;
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
nwords = sscanf(line,"%d %lg %d %lg %lg",
|
||||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||||
}
|
}
|
||||||
@ -190,7 +191,7 @@ void PairEAMFS::read_file(char *filename)
|
|||||||
int i,j,tmp;
|
int i,j,tmp;
|
||||||
for (i = 0; i < file->nelements; i++) {
|
for (i = 0; i < file->nelements; i++) {
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
||||||
}
|
}
|
||||||
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -966,11 +967,11 @@ int PairEIM::grabpair(FILE *fptr, int i, int j)
|
|||||||
sscanf(data,"%lg %lg %lg %lg %lg",
|
sscanf(data,"%lg %lg %lg %lg %lg",
|
||||||
&setfl->rcutphiA[ij],&setfl->rcutphiR[ij],
|
&setfl->rcutphiA[ij],&setfl->rcutphiR[ij],
|
||||||
&setfl->Eb[ij],&setfl->r0[ij],&setfl->alpha[ij]);
|
&setfl->Eb[ij],&setfl->r0[ij],&setfl->alpha[ij]);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,NULL,error);
|
||||||
sscanf(line,"%lg %lg %lg %lg %lg",
|
sscanf(line,"%lg %lg %lg %lg %lg",
|
||||||
&setfl->beta[ij],&setfl->rcutq[ij],&setfl->Asigma[ij],
|
&setfl->beta[ij],&setfl->rcutq[ij],&setfl->Asigma[ij],
|
||||||
&setfl->rq[ij],&setfl->rcutsigma[ij]);
|
&setfl->rq[ij],&setfl->rcutsigma[ij]);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,NULL,error);
|
||||||
sscanf(line,"%lg %lg %lg %d",
|
sscanf(line,"%lg %lg %lg %d",
|
||||||
&setfl->Ac[ij],&setfl->zeta[ij],&setfl->rs[ij],
|
&setfl->Ac[ij],&setfl->zeta[ij],&setfl->rs[ij],
|
||||||
&setfl->tp[ij]);
|
&setfl->tp[ij]);
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#include "my_page.h"
|
#include "my_page.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -978,43 +979,43 @@ void PairLCBOP::read_file(char *filename)
|
|||||||
// skip initial comment lines
|
// skip initial comment lines
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
if (s[0] != '#') break;
|
if (s[0] != '#') break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read parameters
|
// read parameters
|
||||||
|
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&r_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&r_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&r_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&r_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&gamma_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&gamma_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&A);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&A);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&B_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&B_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&B_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&B_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&alpha);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&alpha);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&beta_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&beta_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&beta_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&beta_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&d);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&d);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&C_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&C_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&C_4);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&C_4);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&C_6);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&C_6);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&L);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&L);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&kappa);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&kappa);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&R_0);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&R_0);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&R_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&R_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&r_0);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&r_0);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&r_1_LR);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&r_1_LR);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&r_2_LR);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&r_2_LR);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&v_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&v_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&v_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&v_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&eps_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&eps_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&eps_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&eps_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&lambda_1);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&lambda_1);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&lambda_2);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&lambda_2);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&eps);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&eps);
|
||||||
fgets(s,MAXLINE,fp); sscanf(s,"%lg",&delta);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&delta);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
if (s[0] != '#') break;
|
if (s[0] != '#') break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,27 +1024,27 @@ void PairLCBOP::read_file(char *filename)
|
|||||||
for (k = 0; k < 2; k++) { // 2 values of N_ij_conj
|
for (k = 0; k < 2; k++) { // 2 values of N_ij_conj
|
||||||
for (l = 0; l < 3; l++) { // 3 types of data: f, dfdx, dfdy
|
for (l = 0; l < 3; l++) { // 3 types of data: f, dfdx, dfdy
|
||||||
for (i = 0; i < 4; i++) { // 4x4 matrix
|
for (i = 0; i < 4; i++) { // 4x4 matrix
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf(s,"%lg %lg %lg %lg",
|
sscanf(s,"%lg %lg %lg %lg",
|
||||||
&F_conj_data[i][0][k][l],
|
&F_conj_data[i][0][k][l],
|
||||||
&F_conj_data[i][1][k][l],
|
&F_conj_data[i][1][k][l],
|
||||||
&F_conj_data[i][2][k][l],
|
&F_conj_data[i][2][k][l],
|
||||||
&F_conj_data[i][3][k][l]);
|
&F_conj_data[i][3][k][l]);
|
||||||
}
|
}
|
||||||
while (1) { fgets(s,MAXLINE,fp); if (s[0] != '#') break; }
|
while (1) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// G spline
|
// G spline
|
||||||
|
|
||||||
// x coordinates of mesh points
|
// x coordinates of mesh points
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf( s,"%lg %lg %lg %lg %lg %lg",
|
sscanf( s,"%lg %lg %lg %lg %lg %lg",
|
||||||
&gX[0], &gX[1], &gX[2],
|
&gX[0], &gX[1], &gX[2],
|
||||||
&gX[3], &gX[4], &gX[5] );
|
&gX[3], &gX[4], &gX[5] );
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) { // for each power in polynomial
|
for (i = 0; i < 6; i++) { // for each power in polynomial
|
||||||
fgets(s,MAXLINE,fp);
|
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||||
sscanf( s,"%lg %lg %lg %lg %lg",
|
sscanf( s,"%lg %lg %lg %lg %lg",
|
||||||
&gC[i][0], &gC[i][1], &gC[i][2],
|
&gC[i][0], &gC[i][1], &gC[i][2],
|
||||||
&gC[i][3], &gC[i][4] );
|
&gC[i][3], &gC[i][4] );
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -573,8 +574,8 @@ void PairPolymorphic::read_file(char *file)
|
|||||||
error->one(FLERR,str);
|
error->one(FLERR,str);
|
||||||
}
|
}
|
||||||
// move past comments to first data line
|
// move past comments to first data line
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
while (line == strchr(line,'#')) fgets(line,MAXLINE,fp);
|
while (line == strchr(line,'#')) utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -590,7 +591,7 @@ void PairPolymorphic::read_file(char *file)
|
|||||||
// map the elements in the potential file to LAMMPS atom types
|
// map the elements in the potential file to LAMMPS atom types
|
||||||
for (int i = 0; i < nelements; i++) {
|
for (int i = 0; i < nelements; i++) {
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -608,7 +609,7 @@ void PairPolymorphic::read_file(char *file)
|
|||||||
}
|
}
|
||||||
// sizes
|
// sizes
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,7 +645,7 @@ void PairPolymorphic::read_file(char *file)
|
|||||||
for (int i = 0; i < npair; i++) {
|
for (int i = 0; i < npair; i++) {
|
||||||
PairParameters & p = pairParameters[i];
|
PairParameters & p = pairParameters[i];
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -875,7 +876,7 @@ void PairPolymorphic::grab(FILE *fp, int n, double *list)
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
ptr = strtok(line," \t\n\r\f");
|
ptr = strtok(line," \t\n\r\f");
|
||||||
list[i++] = atof(ptr);
|
list[i++] = atof(ptr);
|
||||||
while ((ptr = strtok(NULL," \t\n\r\f")))
|
while ((ptr = strtok(NULL," \t\n\r\f")))
|
||||||
|
|||||||
@ -28,7 +28,7 @@ void Message::command(int narg, char **arg)
|
|||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Illegal message command");
|
if (narg < 3) error->all(FLERR,"Illegal message command");
|
||||||
|
|
||||||
int clientserver;
|
int clientserver=0;
|
||||||
if (strcmp(arg[0],"client") == 0) clientserver = 1;
|
if (strcmp(arg[0],"client") == 0) clientserver = 1;
|
||||||
else if (strcmp(arg[0],"server") == 0) clientserver = 2;
|
else if (strcmp(arg[0],"server") == 0) clientserver = 2;
|
||||||
else error->all(FLERR,"Illegal message command");
|
else error->all(FLERR,"Illegal message command");
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#define MAXLINE 1024
|
#define MAXLINE 1024
|
||||||
|
|
||||||
@ -214,16 +215,16 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword)
|
|||||||
if (line[0] == '#') continue; // comment
|
if (line[0] == '#') continue; // comment
|
||||||
char *word = strtok(line," \t\n\r");
|
char *word = strtok(line," \t\n\r");
|
||||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||||
fgets(line,MAXLINE,fp); // no match, skip section
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||||
param_extract(tb,tb2,line);
|
param_extract(tb,tb2,line);
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) fgets(line,MAXLINE,fp);
|
for (int i = 0; i < tb->ninput; i++) utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read args on 2nd line of section
|
// read args on 2nd line of section
|
||||||
// allocate table arrays for file values
|
// allocate table arrays for file values
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
param_extract(tb,tb2,line);
|
param_extract(tb,tb2,line);
|
||||||
memory->create(tb->rfile,tb->ninput,"eos:rfile");
|
memory->create(tb->rfile,tb->ninput,"eos:rfile");
|
||||||
memory->create(tb->efile,tb->ninput,"eos:efile");
|
memory->create(tb->efile,tb->ninput,"eos:efile");
|
||||||
@ -233,9 +234,9 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword)
|
|||||||
// read r,e table values from file
|
// read r,e table values from file
|
||||||
|
|
||||||
int itmp;
|
int itmp;
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) {
|
for (int i = 0; i < tb->ninput; i++) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
sscanf(line,"%d %lg %lg",&itmp,&tb->rfile[i],&tb->efile[i]);
|
sscanf(line,"%d %lg %lg",&itmp,&tb->rfile[i],&tb->efile[i]);
|
||||||
sscanf(line,"%d %lg %lg",&itmp,&tb2->efile[i],&tb2->rfile[i]);
|
sscanf(line,"%d %lg %lg",&itmp,&tb2->efile[i],&tb2->rfile[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#define MAXLINE 1024
|
#define MAXLINE 1024
|
||||||
|
|
||||||
@ -433,16 +434,16 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword)
|
|||||||
if (line[0] == '#') continue; // comment
|
if (line[0] == '#') continue; // comment
|
||||||
char *word = strtok(line," \t\n\r");
|
char *word = strtok(line," \t\n\r");
|
||||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||||
fgets(line,MAXLINE,fp); // no match, skip section
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) fgets(line,MAXLINE,fp);
|
for (int i = 0; i < tb->ninput; i++) utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read args on 2nd line of section
|
// read args on 2nd line of section
|
||||||
// allocate table arrays for file values
|
// allocate table arrays for file values
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
tb2->ninput = tb->ninput;
|
tb2->ninput = tb->ninput;
|
||||||
memory->create(tb->rfile,tb->ninput,"eos:rfile");
|
memory->create(tb->rfile,tb->ninput,"eos:rfile");
|
||||||
@ -470,9 +471,9 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword)
|
|||||||
int ispecies;
|
int ispecies;
|
||||||
int ninputs = tb->ninput;
|
int ninputs = tb->ninput;
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < ninputs; i++) {
|
for (int i = 0; i < ninputs; i++) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
|
|
||||||
nwords = atom->count_words(line);
|
nwords = atom->count_words(line);
|
||||||
if(nwords != nspecies+2){
|
if(nwords != nspecies+2){
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "citeme.h"
|
#include "citeme.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -362,16 +363,16 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword)
|
|||||||
if (line[0] == '#') continue; // comment
|
if (line[0] == '#') continue; // comment
|
||||||
char *word = strtok(line," \t\n\r");
|
char *word = strtok(line," \t\n\r");
|
||||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||||
fgets(line,MAXLINE,fp); // no match, skip section
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) fgets(line,MAXLINE,fp);
|
for (int i = 0; i < tb->ninput; i++) fgets(line,MAXLINE,fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read args on 2nd line of section
|
// read args on 2nd line of section
|
||||||
// allocate table arrays for file values
|
// allocate table arrays for file valuesutils::s
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
memory->create(tb->rfile,tb->ninput,"pair:rfile");
|
memory->create(tb->rfile,tb->ninput,"pair:rfile");
|
||||||
memory->create(tb->efile,tb->ninput,"pair:efile");
|
memory->create(tb->efile,tb->ninput,"pair:efile");
|
||||||
@ -384,9 +385,9 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword)
|
|||||||
int itmp;
|
int itmp;
|
||||||
double rtmp;
|
double rtmp;
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) {
|
for (int i = 0; i < tb->ninput; i++) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
sscanf(line,"%d %lg %lg %lg",&itmp,&rtmp,&tb->efile[i],&tb->ffile[i]);
|
sscanf(line,"%d %lg %lg %lg",&itmp,&rtmp,&tb->efile[i],&tb->ffile[i]);
|
||||||
|
|
||||||
if (tb->rflag == RLINEAR)
|
if (tb->rflag == RLINEAR)
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
#include "citeme.h"
|
#include "citeme.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "fix.h"
|
#include "fix.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -507,16 +508,16 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword)
|
|||||||
if (line[0] == '#') continue; // comment
|
if (line[0] == '#') continue; // comment
|
||||||
char *word = strtok(line," \t\n\r");
|
char *word = strtok(line," \t\n\r");
|
||||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||||
fgets(line,MAXLINE,fp); // no match, skip section
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) fgets(line,MAXLINE,fp);
|
for (int i = 0; i < tb->ninput; i++) utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read args on 2nd line of section
|
// read args on 2nd line of section
|
||||||
// allocate table arrays for file values
|
// allocate table arrays for file values
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
param_extract(tb,line);
|
param_extract(tb,line);
|
||||||
memory->create(tb->rfile,tb->ninput,"pair:rfile");
|
memory->create(tb->rfile,tb->ninput,"pair:rfile");
|
||||||
memory->create(tb->efile,tb->ninput,"pair:efile");
|
memory->create(tb->efile,tb->ninput,"pair:efile");
|
||||||
@ -529,9 +530,9 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword)
|
|||||||
int itmp;
|
int itmp;
|
||||||
double rtmp;
|
double rtmp;
|
||||||
|
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
for (int i = 0; i < tb->ninput; i++) {
|
for (int i = 0; i < tb->ninput; i++) {
|
||||||
fgets(line,MAXLINE,fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||||
sscanf(line,"%d %lg %lg %lg",&itmp,&rtmp,&tb->efile[i],&tb->ffile[i]);
|
sscanf(line,"%d %lg %lg %lg",&itmp,&rtmp,&tb->efile[i],&tb->ffile[i]);
|
||||||
|
|
||||||
if (tb->rflag == RLINEAR)
|
if (tb->rflag == RLINEAR)
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "citeme.h"
|
#include "citeme.h"
|
||||||
#include "math_const.h"
|
#include "math_const.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
@ -93,10 +94,11 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (nxnodes <= 0 || nynodes <= 0 || nznodes <= 0)
|
if (nxnodes <= 0 || nynodes <= 0 || nznodes <= 0)
|
||||||
error->all(FLERR,"Fix ttm/mod number of nodes must be > 0");
|
error->all(FLERR,"Fix ttm/mod number of nodes must be > 0");
|
||||||
|
|
||||||
FILE *fpr = force->open_potential(arg[8]);
|
const char *filename = arg[8];
|
||||||
|
FILE *fpr = force->open_potential(filename);
|
||||||
if (fpr == NULL) {
|
if (fpr == NULL) {
|
||||||
char str[128];
|
char str[128];
|
||||||
snprintf(str,128,"Cannot open file %s",arg[8]);
|
snprintf(str,128,"Cannot open file %s",filename);
|
||||||
error->all(FLERR,str);
|
error->all(FLERR,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,113 +119,113 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
double tresh_d;
|
double tresh_d;
|
||||||
int tresh_i;
|
int tresh_i;
|
||||||
// C0 (metal)
|
// C0 (metal)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
esheat_0 = tresh_d;
|
esheat_0 = tresh_d;
|
||||||
// C1 (metal*10^3)
|
// C1 (metal*10^3)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
esheat_1 = tresh_d;
|
esheat_1 = tresh_d;
|
||||||
// C2 (metal*10^6)
|
// C2 (metal*10^6)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
esheat_2 = tresh_d;
|
esheat_2 = tresh_d;
|
||||||
// C3 (metal*10^9)
|
// C3 (metal*10^9)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
esheat_3 = tresh_d;
|
esheat_3 = tresh_d;
|
||||||
// C4 (metal*10^12)
|
// C4 (metal*10^12)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
esheat_4 = tresh_d;
|
esheat_4 = tresh_d;
|
||||||
// C_limit
|
// C_limit
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
C_limit = tresh_d;
|
C_limit = tresh_d;
|
||||||
//Temperature damping factor
|
//Temperature damping factor
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
T_damp = tresh_d;
|
T_damp = tresh_d;
|
||||||
// rho_e
|
// rho_e
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
electronic_density = tresh_d;
|
electronic_density = tresh_d;
|
||||||
//thermal_diffusion
|
//thermal_diffusion
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
el_th_diff = tresh_d;
|
el_th_diff = tresh_d;
|
||||||
// gamma_p
|
// gamma_p
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
gamma_p = tresh_d;
|
gamma_p = tresh_d;
|
||||||
// gamma_s
|
// gamma_s
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
gamma_s = tresh_d;
|
gamma_s = tresh_d;
|
||||||
// v0
|
// v0
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
v_0 = tresh_d;
|
v_0 = tresh_d;
|
||||||
// average intensity of pulse (source of energy) (metal units)
|
// average intensity of pulse (source of energy) (metal units)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
intensity = tresh_d;
|
intensity = tresh_d;
|
||||||
// coordinate of 1st surface in x-direction (in box units) - constant
|
// coordinate of 1st surface in x-direction (in box units) - constant
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%d",&tresh_i);
|
sscanf(linee,"%d",&tresh_i);
|
||||||
surface_l = tresh_i;
|
surface_l = tresh_i;
|
||||||
// coordinate of 2nd surface in x-direction (in box units) - constant
|
// coordinate of 2nd surface in x-direction (in box units) - constant
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%d",&tresh_i);
|
sscanf(linee,"%d",&tresh_i);
|
||||||
surface_r = tresh_i;
|
surface_r = tresh_i;
|
||||||
// skin_layer = intensity is reduced (I=I0*exp[-x/skin_layer])
|
// skin_layer = intensity is reduced (I=I0*exp[-x/skin_layer])
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%d",&tresh_i);
|
sscanf(linee,"%d",&tresh_i);
|
||||||
skin_layer = tresh_i;
|
skin_layer = tresh_i;
|
||||||
// width of pulse (picoseconds)
|
// width of pulse (picoseconds)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
width = tresh_d;
|
width = tresh_d;
|
||||||
// factor of electronic pressure (PF) Pe = PF*Ce*Te
|
// factor of electronic pressure (PF) Pe = PF*Ce*Te
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
pres_factor = tresh_d;
|
pres_factor = tresh_d;
|
||||||
// effective free path of electrons (angstrom)
|
// effective free path of electrons (angstrom)
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
free_path = tresh_d;
|
free_path = tresh_d;
|
||||||
// ionic density (ions*angstrom^{-3})
|
// ionic density (ions*angstrom^{-3})
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
ionic_density = tresh_d;
|
ionic_density = tresh_d;
|
||||||
// if movsur = 0: surface is freezed
|
// if movsur = 0: surface is freezed
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%d",&tresh_i);
|
sscanf(linee,"%d",&tresh_i);
|
||||||
movsur = tresh_i;
|
movsur = tresh_i;
|
||||||
// electron_temperature_min
|
// electron_temperature_min
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
fgets(linee,MAXLINE,fpr_2);
|
utils::sfgets(FLERR,linee,MAXLINE,fpr_2,filename,error);
|
||||||
sscanf(linee,"%lg",&tresh_d);
|
sscanf(linee,"%lg",&tresh_d);
|
||||||
electron_temperature_min = tresh_d;
|
electron_temperature_min = tresh_d;
|
||||||
fclose(fpr_2);
|
fclose(fpr_2);
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "citeme.h"
|
#include "citeme.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -683,14 +684,14 @@ void PairLocalDensity::parse_file(char *filename) {
|
|||||||
// broadcast number of LD potentials and number of (rho,frho) pairs
|
// broadcast number of LD potentials and number of (rho,frho) pairs
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
|
|
||||||
// first 2 comment lines ignored
|
// first 2 comment lines ignored
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
|
|
||||||
// extract number of potentials and number of (frho, rho) points
|
// extract number of potentials and number of (frho, rho) points
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line, "%d %d", &nLD, &nrho);
|
sscanf(line, "%d %d", &nLD, &nrho);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Bcast(&nLD,1,MPI_INT,0,world);
|
MPI_Bcast(&nLD,1,MPI_INT,0,world);
|
||||||
@ -732,7 +733,7 @@ void PairLocalDensity::parse_file(char *filename) {
|
|||||||
sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]);
|
sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]);
|
||||||
|
|
||||||
// parse and broadcast central atom filter
|
// parse and broadcast central atom filter
|
||||||
fgets(line, MAXLINE, fptr);
|
utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error);
|
||||||
char *tmp = strtok(line, " /t/n/r/f");
|
char *tmp = strtok(line, " /t/n/r/f");
|
||||||
while (tmp != NULL) {
|
while (tmp != NULL) {
|
||||||
a[k][atoi(tmp)] = 1;
|
a[k][atoi(tmp)] = 1;
|
||||||
@ -740,7 +741,7 @@ void PairLocalDensity::parse_file(char *filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse neighbor atom filter
|
// parse neighbor atom filter
|
||||||
fgets(line, MAXLINE, fptr);
|
utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error);
|
||||||
tmp = strtok(line, " /t/n/r/f");
|
tmp = strtok(line, " /t/n/r/f");
|
||||||
while (tmp != NULL) {
|
while (tmp != NULL) {
|
||||||
b[k][atoi(tmp)] = 1;
|
b[k][atoi(tmp)] = 1;
|
||||||
@ -748,19 +749,19 @@ void PairLocalDensity::parse_file(char *filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse min, max and delta rho values
|
// parse min, max and delta rho values
|
||||||
fgets(line, MAXLINE, fptr);
|
utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error);
|
||||||
sscanf(line, "%lf %lf %lf", &rho_min[k], &rho_max[k], &delta_rho[k]);
|
sscanf(line, "%lf %lf %lf", &rho_min[k], &rho_max[k], &delta_rho[k]);
|
||||||
// recompute delta_rho from scratch for precision
|
// recompute delta_rho from scratch for precision
|
||||||
delta_rho[k] = (rho_max[k] - rho_min[k]) / (nrho - 1);
|
delta_rho[k] = (rho_max[k] - rho_min[k]) / (nrho - 1);
|
||||||
|
|
||||||
// parse tabulated frho values from each line into temporary array
|
// parse tabulated frho values from each line into temporary array
|
||||||
for (n = 0; n < nrho; n++) {
|
for (n = 0; n < nrho; n++) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line, "%lf", &ftmp[k*nrho + n]);
|
sscanf(line, "%lf", &ftmp[k*nrho + n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore blank line at the end of every block
|
// ignore blank line at the end of every block
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
|
|
||||||
// set coefficients for local density indicator function
|
// set coefficients for local density indicator function
|
||||||
uc2 = uppercut[k] * uppercut[k];
|
uc2 = uppercut[k] * uppercut[k];
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -439,13 +440,13 @@ void PairMEAMSpline::read_file(const char* filename)
|
|||||||
// Skip first line of file. It's a comment.
|
// Skip first line of file. It's a comment.
|
||||||
char line[MAXLINE];
|
char line[MAXLINE];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,filename,error);
|
||||||
|
|
||||||
// Second line holds potential type ("meam/spline")
|
// Second line holds potential type ("meam/spline")
|
||||||
// in new potential format.
|
// in new potential format.
|
||||||
|
|
||||||
bool isNewFormat = false;
|
bool isNewFormat = false;
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,filename,error);
|
||||||
ptr = strtok(line, " \t\n\r\f");
|
ptr = strtok(line, " \t\n\r\f");
|
||||||
|
|
||||||
if (strcmp(ptr, "meam/spline") == 0) {
|
if (strcmp(ptr, "meam/spline") == 0) {
|
||||||
@ -475,7 +476,7 @@ void PairMEAMSpline::read_file(const char* filename)
|
|||||||
elements[0] = new char[1];
|
elements[0] = new char[1];
|
||||||
strcpy(elements[0], "");
|
strcpy(elements[0], "");
|
||||||
rewind(fp);
|
rewind(fp);
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,filename,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
nmultichoose2 = ((nelements+1)*nelements)/2;
|
nmultichoose2 = ((nelements+1)*nelements)/2;
|
||||||
@ -639,27 +640,27 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error,
|
|||||||
|
|
||||||
// If new format, read the spline format. Should always be "spline3eq" for now.
|
// If new format, read the spline format. Should always be "spline3eq" for now.
|
||||||
if (isNewFormat)
|
if (isNewFormat)
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
|
|
||||||
// Parse number of spline knots.
|
// Parse number of spline knots.
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
int n = atoi(line);
|
int n = atoi(line);
|
||||||
if(n < 2)
|
if(n < 2)
|
||||||
error->one(FLERR,"Invalid number of spline knots in MEAM potential file");
|
error->one(FLERR,"Invalid number of spline knots in MEAM potential file");
|
||||||
|
|
||||||
// Parse first derivatives at beginning and end of spline.
|
// Parse first derivatives at beginning and end of spline.
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
double d0 = atof(strtok(line, " \t\n\r\f"));
|
double d0 = atof(strtok(line, " \t\n\r\f"));
|
||||||
double dN = atof(strtok(NULL, " \t\n\r\f"));
|
double dN = atof(strtok(NULL, " \t\n\r\f"));
|
||||||
init(n, d0, dN);
|
init(n, d0, dN);
|
||||||
|
|
||||||
// Skip line in old format
|
// Skip line in old format
|
||||||
if (!isNewFormat)
|
if (!isNewFormat)
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
|
|
||||||
// Parse knot coordinates.
|
// Parse knot coordinates.
|
||||||
for(int i=0; i<n; i++) {
|
for(int i=0; i<n; i++) {
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
double x, y, y2;
|
double x, y, y2;
|
||||||
if(sscanf(line, "%lg %lg %lg", &x, &y, &y2) != 3) {
|
if(sscanf(line, "%lg %lg %lg", &x, &y, &y2) != 3) {
|
||||||
error->one(FLERR,"Invalid knot line in MEAM potential file");
|
error->one(FLERR,"Invalid knot line in MEAM potential file");
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -468,7 +469,7 @@ void PairMEAMSWSpline::read_file(const char* filename)
|
|||||||
|
|
||||||
// Skip first line of file.
|
// Skip first line of file.
|
||||||
char line[MAXLINE];
|
char line[MAXLINE];
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,filename,error);
|
||||||
|
|
||||||
// Parse spline functions.
|
// Parse spline functions.
|
||||||
phi.parse(fp, error);
|
phi.parse(fp, error);
|
||||||
@ -600,23 +601,23 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error)
|
|||||||
char line[MAXLINE];
|
char line[MAXLINE];
|
||||||
|
|
||||||
// Parse number of spline knots.
|
// Parse number of spline knots.
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
int n = atoi(line);
|
int n = atoi(line);
|
||||||
if(n < 2)
|
if(n < 2)
|
||||||
error->one(FLERR,"Invalid number of spline knots in MEAM potential file");
|
error->one(FLERR,"Invalid number of spline knots in MEAM potential file");
|
||||||
|
|
||||||
// Parse first derivatives at beginning and end of spline.
|
// Parse first derivatives at beginning and end of spline.
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
double d0 = atof(strtok(line, " \t\n\r\f"));
|
double d0 = atof(strtok(line, " \t\n\r\f"));
|
||||||
double dN = atof(strtok(NULL, " \t\n\r\f"));
|
double dN = atof(strtok(NULL, " \t\n\r\f"));
|
||||||
init(n, d0, dN);
|
init(n, d0, dN);
|
||||||
|
|
||||||
// Skip line.
|
// Skip line.
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
|
|
||||||
// Parse knot coordinates.
|
// Parse knot coordinates.
|
||||||
for(int i=0; i<n; i++) {
|
for(int i=0; i<n; i++) {
|
||||||
fgets(line, MAXLINE, fp);
|
utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error);
|
||||||
double x, y, y2;
|
double x, y, y2;
|
||||||
if(sscanf(line, "%lg %lg %lg", &x, &y, &y2) != 3) {
|
if(sscanf(line, "%lg %lg %lg", &x, &y, &y2) != 3) {
|
||||||
error->one(FLERR,"Invalid knot line in MEAM potential file");
|
error->one(FLERR,"Invalid knot line in MEAM potential file");
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -136,10 +137,10 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||||||
|
|
||||||
int n;
|
int n;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -164,7 +165,7 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||||||
delete [] words;
|
delete [] words;
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg %d %lg %lg",
|
sscanf(line,"%d %lg %d %lg %lg",
|
||||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||||
}
|
}
|
||||||
@ -184,7 +185,7 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||||||
int i,j,tmp;
|
int i,j,tmp;
|
||||||
for (i = 0; i < file->nelements; i++) {
|
for (i = 0; i < file->nelements; i++) {
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
||||||
}
|
}
|
||||||
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -136,10 +137,10 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||||||
|
|
||||||
int n;
|
int n;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
n = strlen(line) + 1;
|
n = strlen(line) + 1;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||||
@ -164,7 +165,7 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||||||
delete [] words;
|
delete [] words;
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg %d %lg %lg",
|
sscanf(line,"%d %lg %d %lg %lg",
|
||||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||||||
int i,j,tmp;
|
int i,j,tmp;
|
||||||
for (i = 0; i < file->nelements; i++) {
|
for (i = 0; i < file->nelements; i++) {
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fgets(line,MAXLINE,fptr);
|
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
|
||||||
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
sscanf(line,"%d %lg",&tmp,&file->mass[i]);
|
||||||
}
|
}
|
||||||
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
MPI_Bcast(&file->mass[i],1,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -368,7 +368,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
|
|||||||
#if defined(_OPENMP)
|
#if defined(_OPENMP)
|
||||||
#pragma omp parallel default(shared) \
|
#pragma omp parallel default(shared) \
|
||||||
private(atom_i, type_i, start_i, end_i, sbp_i, btop_i, ihb, ihb_top, \
|
private(atom_i, type_i, start_i, end_i, sbp_i, btop_i, ihb, ihb_top, \
|
||||||
j, atom_j, type_j, pj, sbp_j, nbr_pj, jhb, twbp)
|
atom_j, type_j, pj, sbp_j, nbr_pj, jhb, twbp)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
|
|||||||
for( pj = start_i; pj < end_i; ++pj ) {
|
for( pj = start_i; pj < end_i; ++pj ) {
|
||||||
nbr_pj = &( far_nbrs->select.far_nbr_list[pj] );
|
nbr_pj = &( far_nbrs->select.far_nbr_list[pj] );
|
||||||
if (nbr_pj->d <= cutoff) {
|
if (nbr_pj->d <= cutoff) {
|
||||||
j = nbr_pj->nbr;
|
int j = nbr_pj->nbr;
|
||||||
atom_j = &(system->my_atoms[j]);
|
atom_j = &(system->my_atoms[j]);
|
||||||
type_j = atom_j->type;
|
type_j = atom_j->type;
|
||||||
sbp_j = &(system->reax_param.sbp[type_j]);
|
sbp_j = &(system->reax_param.sbp[type_j]);
|
||||||
|
|||||||
@ -23,6 +23,7 @@ under
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
#include "citeme.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
@ -82,6 +83,9 @@ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg)
|
|||||||
PTM_CHECK_ALL,
|
PTM_CHECK_ALL,
|
||||||
PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_BCC | PTM_CHECK_ICO};
|
PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_BCC | PTM_CHECK_ICO};
|
||||||
|
|
||||||
|
if (lmp->citeme)
|
||||||
|
lmp->citeme->add(cite_user_ptm_package);
|
||||||
|
|
||||||
input_flags = 0;
|
input_flags = 0;
|
||||||
while (*ptr != '\0') {
|
while (*ptr != '\0') {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user