Change next_dvector(n, buf) to next_dvector(buf, n)

This commit is contained in:
Richard Berger 2020-06-05 16:40:14 -04:00
parent 8b5469590d
commit 2203e1e9e5
No known key found for this signature in database
GPG Key ID: A9E83994E0BA0CAB
20 changed files with 78 additions and 78 deletions

View File

@ -415,13 +415,13 @@ void PairEAMAlloyGPU::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -415,16 +415,16 @@ void PairEAMFSGPU::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
reader.next_dvector(&file->rhor[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -1029,13 +1029,13 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -1029,16 +1029,16 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
reader.next_dvector(&file->rhor[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -589,25 +589,25 @@ void PairADP::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->u2r[i][j][1]);
reader.next_dvector(&file->u2r[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->w2r[i][j][1]);
reader.next_dvector(&file->w2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -3500,14 +3500,14 @@ void PairAIREBO::read_file(char *filename)
// number-1 = # of domains for the spline
int limit = reader.next_int();
reader.next_dvector(limit, gCdom);
reader.next_dvector(gCdom, limit);
for (int i = 0; i < limit-1; i++) {
reader.next_dvector(6, &gC1[i][0]);
reader.next_dvector(&gC1[i][0], 6);
}
for (int i = 0; i < limit-1; i++) {
reader.next_dvector(6, &gC2[i][0]);
reader.next_dvector(&gC2[i][0], 6);
}
/////////////////////////////////////////////////////////////////////////
@ -3515,10 +3515,10 @@ void PairAIREBO::read_file(char *filename)
current_section = "gH spline";
limit = reader.next_int();
reader.next_dvector(limit, gHdom);
reader.next_dvector(gHdom, limit);
for (int i = 0; i < limit-1; i++) {
reader.next_dvector(6, &gH[i][0]);
reader.next_dvector(&gH[i][0], 6);
}
/////////////////////////////////////////////////////////////////////////
@ -3528,12 +3528,12 @@ void PairAIREBO::read_file(char *filename)
limit = reader.next_int();
for (int i = 0; i < limit/2; i++) {
reader.next_dvector(limit/2, &pCCdom[i][0]);
reader.next_dvector(&pCCdom[i][0], limit/2);
}
for (int i = 0; i < (int) pCCdom[0][1]; i++) {
for (int j = 0; j < (int) pCCdom[1][1]; j++) {
reader.next_dvector(16, &pCC[i][j][0]);
reader.next_dvector(&pCC[i][j][0], 16);
}
}
@ -3551,7 +3551,7 @@ void PairAIREBO::read_file(char *filename)
for (int i = 0; i < (int) pCHdom[0][1]; i++) {
for (int j = 0; j < (int) pCHdom[1][1]; j++) {
reader.next_dvector(16, &pCH[i][j][0]);
reader.next_dvector(&pCH[i][j][0], 16);
}
}
@ -3570,7 +3570,7 @@ void PairAIREBO::read_file(char *filename)
for (int i = 0; i < (int) piCCdom[0][1]; i++) {
for (int j = 0; j < (int) piCCdom[1][1]; j++) {
for (int k = 0; k < (int) piCCdom[2][1]; k++) {
reader.next_dvector(64, &piCC[i][j][k][0]);
reader.next_dvector(&piCC[i][j][k][0], 64);
}
}
}
@ -3590,7 +3590,7 @@ void PairAIREBO::read_file(char *filename)
for (int i = 0; i < (int) piCHdom[0][1]; i++) {
for (int j = 0; j < (int) piCHdom[1][1]; j++) {
for (int k = 0; k < (int) piCHdom[2][1]; k++) {
reader.next_dvector(64, &piCH[i][j][k][0]);
reader.next_dvector(&piCH[i][j][k][0], 64);
}
}
}
@ -3610,7 +3610,7 @@ void PairAIREBO::read_file(char *filename)
for (int i = 0; i < (int) piHHdom[0][1]; i++) {
for (int j = 0; j < (int) piHHdom[1][1]; j++) {
for (int k = 0; k < (int) piHHdom[2][1]; k++) {
reader.next_dvector(64, &piHH[i][j][k][0]);
reader.next_dvector(&piHH[i][j][k][0], 64);
}
}
}
@ -3630,7 +3630,7 @@ void PairAIREBO::read_file(char *filename)
for (int i = 0; i < (int) Tijdom[0][1]; i++) {
for (int j = 0; j < (int) Tijdom[1][1]; j++) {
for (int k = 0; k < (int) Tijdom[2][1]; k++) {
reader.next_dvector(64, &Tijc[i][j][k][0]);
reader.next_dvector(&Tijc[i][j][k][0], 64);
}
}
}
@ -3638,13 +3638,13 @@ void PairAIREBO::read_file(char *filename)
std::string msg = fmt::format("ERROR reading {} section in {} file\n"
"REASON: {}\n",
current_section, potential_name, e.what());
error->one(FLERR, msg.c_str());
error->one(FLERR, msg);
} catch (FileReaderException & fre) {
error->one(FLERR, fre.what());
std::string msg = fmt::format("ERROR reading {} section in {} file\n"
"REASON: {}\n",
current_section, potential_name, fre.what());
error->one(FLERR, msg.c_str());
error->one(FLERR, msg);
}
// store read-in values in arrays

View File

@ -5017,34 +5017,34 @@ void _noopt PairBOP::read_table(char *filename)
for(int j = 0; j < bop_types; j++)
for(int k = j; k < bop_types; k++) {
if(npower <= 2) {
reader.next_dvector(ntheta, &gfunc[j][i][k][0]);
reader.next_dvector(&gfunc[j][i][k][0], ntheta);
} else {
reader.next_dvector(npower+1, &gpara[j][i][k][0]);
reader.next_dvector(&gpara[j][i][k][0], npower+1);
}
}
} else {
for(int i = 0; i < bop_types; i++)
for(int j = 0; j < bop_types; j++)
for(int k = 0; k < bop_types; k++) {
reader.next_dvector(3, &gpara[i][j][k][0]);
reader.next_dvector(&gpara[i][j][k][0], 3);
gpara[j][i][k][3] = 0;
}
}
for(int i = 0; i < npairs; i++) {
reader.next_dvector(nr, &pRepul[i][0]);
reader.next_dvector(&pRepul[i][0], nr);
}
for(int i = 0; i < npairs; i++) {
reader.next_dvector(nr, &pBetaS[i][0]);
reader.next_dvector(&pBetaS[i][0], nr);
}
for(int i = 0; i < npairs; i++) {
reader.next_dvector(nr, &pBetaP[i][0]);
reader.next_dvector(&pBetaP[i][0], nr);
}
for(int i = 0; i < npairs; i++) {
reader.next_dvector(nBOt, &FsigBO[i][0]);
reader.next_dvector(&FsigBO[i][0], nBOt);
}
for(int i = 0; i < bop_types; i++) {
@ -5064,7 +5064,7 @@ void _noopt PairBOP::read_table(char *filename)
rcut3[i] = reader.next_double();
}
for(int i = 0; i < npairs; i++) {
reader.next_dvector(nr, &pLong[i][0]);
reader.next_dvector(&pLong[i][0], nr);
}
}

View File

@ -320,8 +320,8 @@ void PairComb3::read_lib()
if (comm->me == 0) {
try {
PotentialFileReader reader(lmp, "lib.comb3", "COMB3");
reader.next_dvector(6, ccutoff);
reader.next_dvector(7, ch_a);
reader.next_dvector(ccutoff, 6);
reader.next_dvector(ch_a, 7);
ValueTokenizer values = reader.next_values(3);
nsplpcn = values.next_int();
@ -385,7 +385,7 @@ void PairComb3::read_lib()
for(iii = 0; iii < 2; iii++) {
mm = iii*32;
reader.next_dvector(32, &pcn_cubs[ll][ii][jj][kk][mm]);
reader.next_dvector(&pcn_cubs[ll][ii][jj][kk][mm], 32);
}
}
@ -418,7 +418,7 @@ void PairComb3::read_lib()
for (iii = 0; iii < 2; iii++) {
mm = iii * 32;
reader.next_dvector(32, &rad_spl[ll][ii][jj][kk][mm]);
reader.next_dvector(&rad_spl[ll][ii][jj][kk][mm], 32);
}
}
@ -450,7 +450,7 @@ void PairComb3::read_lib()
kk = values.next_int() - 1;
for(iii=0; iii<2; iii++) {
mm=iii*32;
reader.next_dvector(32, &tor_spl[ll][ii][jj][kk][mm]);
reader.next_dvector(&tor_spl[ll][ii][jj][kk][mm], 32);
}
}

View File

@ -491,9 +491,9 @@ void PairEAM::read_file(char *filename)
memory->create(file->rhor, (file->nr+1), "pair:rhor");
memory->create(file->zr, (file->nr+1), "pair:zr");
reader.next_dvector(file->nrho, &file->frho[1]);
reader.next_dvector(file->nr, &file->zr[1]);
reader.next_dvector(file->nr, &file->rhor[1]);
reader.next_dvector(&file->frho[1], file->nrho);
reader.next_dvector(&file->zr[1], file->nr);
reader.next_dvector(&file->rhor[1], file->nr);
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -163,13 +163,13 @@ void PairEAMAlloy::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -165,16 +165,16 @@ void PairEAMFS::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
reader.next_dvector(&file->rhor[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -654,7 +654,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < npair; i++) { // U
PairParameters & p = pairParameters[i];
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
p.U = new tabularFunction(nr,0.0,p.cut);
@ -663,7 +663,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < npair; i++) { // V
PairParameters & p = pairParameters[i];
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
p.V = new tabularFunction(nr,0.0,p.cut);
@ -672,7 +672,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < npair; i++) { // W
PairParameters & p = pairParameters[i];
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
p.W = new tabularFunction(nr,0.0,p.cut);
@ -689,7 +689,7 @@ void PairPolymorphic::read_file(char *file)
if (eta != 3) {
for (int j = 0; j < nelements; j++) { // P
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
for (int i = 0; i < nelements; i++) {
@ -701,7 +701,7 @@ void PairPolymorphic::read_file(char *file)
for (int j = 0; j < nelements-1; j++) { // P
for (int k = j+1; k < nelements; k++) {
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
for (int i = 0; i < nelements; i++) {
@ -719,7 +719,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < ntriple; i++) { // P
TripletParameters & p = tripletParameters[i];
if (comm->me == 0) {
reader->next_dvector(nr, singletable);
reader->next_dvector(singletable, nr);
}
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
p.P = new tabularFunction(nr,-cutmax,cutmax);
@ -731,7 +731,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < ntriple; i++) { // G
TripletParameters & p = tripletParameters[i];
if (comm->me == 0) {
reader->next_dvector(ng, singletable);
reader->next_dvector(singletable, ng);
}
MPI_Bcast(singletable,ng,MPI_DOUBLE,0,world);
p.G = new tabularFunction(ng,-1.0,1.0);
@ -742,7 +742,7 @@ void PairPolymorphic::read_file(char *file)
for (int i = 0; i < npair; i++) { // F
PairParameters & p = pairParameters[i];
if (comm->me == 0) {
reader->next_dvector(nx, singletable);
reader->next_dvector(singletable, nx);
}
MPI_Bcast(singletable,nx,MPI_DOUBLE,0,world);
p.F = new tabularFunction(nx,0.0,maxX);

View File

@ -163,13 +163,13 @@ void PairEAMAlloyIntel::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -163,16 +163,16 @@ void PairEAMFSIntel::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
reader.next_dvector(&file->rhor[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -163,13 +163,13 @@ void PairEAMAlloyOMP::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(file->nr, &file->rhor[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -163,16 +163,16 @@ void PairEAMFSOMP::read_file(char *filename)
values.next_int(); // ignore
file->mass[i] = values.next_double();
reader.next_dvector(file->nrho, &file->frho[i][1]);
reader.next_dvector(&file->frho[i][1], file->nrho);
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
reader.next_dvector(&file->rhor[i][j][1], file->nr);
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
reader.next_dvector(&file->z2r[i][j][1], file->nr);
}
}
} catch (TokenizerException & e) {

View File

@ -75,9 +75,9 @@ char *PotentialFileReader::next_line(int nparams) {
return nullptr;
}
void PotentialFileReader::next_dvector(int n, double * list) {
void PotentialFileReader::next_dvector(double * list, int n) {
try {
return reader->next_dvector(n, list);
return reader->next_dvector(list, n);
} catch (FileReaderException & e) {
error->one(FLERR, e.what());
}

View File

@ -42,7 +42,7 @@ namespace LAMMPS_NS
void skip_line();
char * next_line(int nparams = 0);
void next_dvector(int n, double * list);
void next_dvector(double * list, int n);
ValueTokenizer next_values(int nparams, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
// convenience functions

View File

@ -97,7 +97,7 @@ char *TextFileReader::next_line(int nparams) {
return line;
}
void TextFileReader::next_dvector(int n, double * list) {
void TextFileReader::next_dvector(double * list, int n) {
int i = 0;
while (i < n) {
char *ptr = next_line();

View File

@ -41,7 +41,7 @@ namespace LAMMPS_NS
void skip_line();
char * next_line(int nparams = 0);
void next_dvector(int n, double * list);
void next_dvector(double * list, int n);
ValueTokenizer next_values(int nparams, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
};