git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13931 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2015-08-21 22:55:12 +00:00
parent 63534501c2
commit 3841dd58ca
35 changed files with 140 additions and 81 deletions

View File

@ -15,7 +15,7 @@
#include "atom_masks.h"
#include "domain_kokkos.h"
using namespace LAMMPS_NS;
namespace LAMMPS_NS {
/* ---------------------------------------------------------------------- */
@ -845,3 +845,5 @@ void NeighborKokkosExecute<Device>::
}
neigh_list.d_ilist(i) = i;
}
}

View File

@ -1,4 +1,4 @@
# serial = g++ compiler, no MPI
# serial = g++ compiler, no MPI, internal FFT
SHELL = /bin/sh

View File

@ -77,17 +77,30 @@ int MPI_Finalized(int *flag)
/* return "localhost" as name of the processor */
void MPI_Get_processor_name(char *name, int *resultlen)
int MPI_Get_processor_name(char *name, int *resultlen)
{
const char host[] = "localhost";
int len;
if (!name || !resultlen) return;
if (!name || !resultlen) return MPI_ERR_ARG;
len = strlen(host);
memcpy(name,host,len+1);
*resultlen = len;
return;
return MPI_SUCCESS;
}
/* ---------------------------------------------------------------------- */
/* return MPI version level. v1.2 is not 100% correct, but close enough */
int MPI_Get_version(int *major, int *minor)
{
if (!major || !minor) return MPI_ERR_ARG;
*major = 1;
*minor = 2;
return MPI_SUCCESS;
}
/* ---------------------------------------------------------------------- */

View File

@ -79,7 +79,8 @@ typedef struct _MPI_Status MPI_Status;
int MPI_Init(int *argc, char ***argv);
int MPI_Initialized(int *flag);
int MPI_Finalized(int *flag);
void MPI_Get_processor_name(char *name, int *resultlen);
int MPI_Get_processor_name(char *name, int *resultlen);
int MPI_Get_version(int *major, int *minor);
int MPI_Comm_rank(MPI_Comm comm, int *me);
int MPI_Comm_size(MPI_Comm comm, int *nprocs);

View File

@ -522,7 +522,6 @@ void FixQBMSST::initial_integrate(int vflag)
int *type = atom->type;
double **x = atom->x;
double boltz = force->boltz;
double hplanck = force->hplanck;
// check to see if old_velocity is correctly allocated
check_alloc(nlocal);

View File

@ -245,7 +245,6 @@ void FixQTB::post_force(int vflag)
double **v = atom->v;
double **f = atom->f;
double *rmass = atom->rmass;
int *type = atom->type;
int *mask = atom->mask;
bigint nlocal = atom->nlocal;

View File

@ -337,7 +337,7 @@ void Comm::set_processors(int narg, char **arg)
strcmp(arg[iarg+1],"zxy") == 0 ||
strcmp(arg[iarg+1],"zyx") == 0) {
mapflag = XYZ;
strcpy(xyz,arg[iarg+1]);
strncpy(xyz,arg[iarg+1],3);
} else error->all(FLERR,"Illegal processors command");
iarg += 2;

View File

@ -182,7 +182,7 @@ void CommTiled::setup()
if (cut == 0.0) {
cutzero = 1;
cut = MIN(prd[0],prd[1]);
if (dimension == 3) cut = MIN(cut,prd[3]);
if (dimension == 3) cut = MIN(cut,prd[2]);
cut *= EPSILON*EPSILON;
}
@ -920,9 +920,9 @@ void CommTiled::borders()
}
}
if (sendself[iswap]) {
n = avec->pack_border_vel(sendnum[iswap][nsend],sendlist[iswap][nsend],
buf_send,pbc_flag[iswap][nsend],
pbc[iswap][nsend]);
avec->pack_border_vel(sendnum[iswap][nsend],sendlist[iswap][nsend],
buf_send,pbc_flag[iswap][nsend],
pbc[iswap][nsend]);
avec->unpack_border_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],
buf_send);
}
@ -949,9 +949,8 @@ void CommTiled::borders()
}
}
if (sendself[iswap]) {
n = avec->pack_border(sendnum[iswap][nsend],sendlist[iswap][nsend],
buf_send,pbc_flag[iswap][nsend],
pbc[iswap][nsend]);
avec->pack_border(sendnum[iswap][nsend],sendlist[iswap][nsend],
buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]);
avec->unpack_border(recvnum[iswap][nsend],firstrecv[iswap][nsend],
buf_send);
}

View File

@ -164,7 +164,7 @@ int ComputeAngleLocal::compute_angles(int flag)
atom3 = atom->map(angle_atom3[atom2][i]);
} else {
if (tag[atom2] != onemols[imol]->angle_atom2[atom2][i]) continue;
tagprev = tag[atom1] - iatom - 1;
tagprev = tag[atom2] - iatom - 1;
atype = atom->map(onemols[imol]->angle_type[atom2][i]);
atom1 = atom->map(onemols[imol]->angle_atom1[atom2][i]+tagprev);
atom3 = atom->map(onemols[imol]->angle_atom3[atom2][i]+tagprev);

View File

@ -1351,7 +1351,7 @@ void ComputeChunkAtom::atom2bin2d()
continue;
}
if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
else if (i2bin > nlayer1m1) {
else if (i2bin > nlayer2m1) {
exclude[i] = 1;
continue;
}
@ -1456,7 +1456,7 @@ void ComputeChunkAtom::atom2bin3d()
continue;
}
if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
else if (i2bin > nlayer1m1) {
else if (i2bin > nlayer2m1) {
exclude[i] = 1;
continue;
}

View File

@ -158,7 +158,7 @@ int ComputeDihedralLocal::compute_dihedrals(int flag)
atom4 = atom->map(dihedral_atom4[atom2][i]);
} else {
if (tag[atom2] != onemols[imol]->dihedral_atom2[atom2][i]) continue;
tagprev = tag[atom1] - iatom - 1;
tagprev = tag[atom2] - iatom - 1;
atom1 = atom->map(onemols[imol]->dihedral_atom1[atom2][i]+tagprev);
atom3 = atom->map(onemols[imol]->dihedral_atom3[atom2][i]+tagprev);
atom4 = atom->map(onemols[imol]->dihedral_atom4[atom2][i]+tagprev);

View File

@ -159,7 +159,7 @@ int ComputeImproperLocal::compute_impropers(int flag)
atom4 = atom->map(improper_atom4[atom2][i]);
} else {
if (tag[atom2] != onemols[imol]->improper_atom2[atom2][i]) continue;
tagprev = tag[atom1] - iatom - 1;
tagprev = tag[atom2] - iatom - 1;
atom1 = atom->map(onemols[imol]->improper_atom1[atom2][i]+tagprev);
atom3 = atom->map(onemols[imol]->improper_atom3[atom2][i]+tagprev);
atom4 = atom->map(onemols[imol]->improper_atom4[atom2][i]+tagprev);

View File

@ -850,8 +850,8 @@ void ComputeTempChunk::allocate()
double ComputeTempChunk::memory_usage()
{
double bytes = (bigint) maxchunk * 2 * sizeof(double);
bytes = (bigint) maxchunk * 2 * sizeof(int);
bytes = (bigint) maxchunk * nvalues * sizeof(double);
bytes += (bigint) maxchunk * 2 * sizeof(int);
bytes += (bigint) maxchunk * nvalues * sizeof(double);
if (comflag || nvalues) {
bytes += (bigint) maxchunk * 2 * sizeof(double);
bytes += (bigint) maxchunk * 2*3 * sizeof(double);

View File

@ -594,17 +594,15 @@ void Domain::pbc()
int Domain::inside(double* x)
{
double *lo,*hi,*period;
double *lo,*hi;
double delta[3];
if (triclinic == 0) {
lo = boxlo;
hi = boxhi;
period = prd;
} else {
lo = boxlo_lamda;
hi = boxhi_lamda;
period = prd_lamda;
delta[0] = x[0] - boxlo[0];
delta[1] = x[1] - boxlo[1];
@ -628,7 +626,7 @@ int Domain::inside(double* x)
int Domain::inside_nonperiodic(double* x)
{
double *lo,*hi,*period;
double *lo,*hi;
double delta[3];
if (xperiodic && yperiodic && zperiodic) return 1;
@ -636,11 +634,9 @@ int Domain::inside_nonperiodic(double* x)
if (triclinic == 0) {
lo = boxlo;
hi = boxhi;
period = prd;
} else {
lo = boxlo_lamda;
hi = boxhi_lamda;
period = prd_lamda;
delta[0] = x[0] - boxlo[0];
delta[1] = x[1] - boxlo[1];

View File

@ -380,7 +380,7 @@ void Dump::write()
write_data(nlines,buf);
}
if (flush_flag) fflush(fp);
if (flush_flag && fp) fflush(fp);
} else {
MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE);
@ -401,7 +401,7 @@ void Dump::write()
write_data(nchars,(double *) sbuf);
}
if (flush_flag) fflush(fp);
if (flush_flag && fp) fflush(fp);
} else {
MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE);
@ -413,9 +413,9 @@ void Dump::write()
if (multifile) {
if (compressed) {
if (filewriter) pclose(fp);
if (filewriter && fp) pclose(fp);
} else {
if (filewriter) fclose(fp);
if (filewriter && fp) fclose(fp);
}
}
}

View File

@ -36,9 +36,9 @@ class DumpCFG : public DumpCustom {
int unwrapflag; // 1 if unwrapped coordinates are requested
void init_style();
void write_header(bigint);
virtual void write_header(bigint);
int convert_string(int, double *);
void write_data(int, double *);
virtual void write_data(int, double *);
typedef void (DumpCFG::*FnPtrWrite)(int, double *);
FnPtrWrite write_choice; // ptr to write data functions

View File

@ -296,11 +296,14 @@ void FixAdapt::init()
Pair *pair = NULL;
if (lmp->suffix_enable) {
char psuffix[128];
int len = 2 + strlen(ad->pstyle) + strlen(lmp->suffix);
char *psuffix = new char[len];
strcpy(psuffix,ad->pstyle);
strcat(psuffix,"/");
strcat(psuffix,lmp->suffix);
pair = force->pair_match(psuffix,1);
delete[] psuffix;
}
if (pair == NULL) pair = force->pair_match(ad->pstyle,1);
if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist");

View File

@ -62,6 +62,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
int iarg = 5;
if (lbstyle == SHIFT) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix balance command");
if (strlen(arg[iarg+1]) > 3) error->all(FLERR,"Illegal fix balance command");
strcpy(bstr,arg[iarg+1]);
nitermax = force->inumeric(FLERR,arg[iarg+2]);
if (nitermax <= 0) error->all(FLERR,"Illegal fix balance command");

View File

@ -42,7 +42,7 @@ class FixBalance : public Fix {
private:
int nevery,lbstyle,nitermax,outflag;
double thresh,stopthresh;
char bstr[3];
char bstr[4];
FILE *fp;
double imbnow; // current imbalance factor

View File

@ -195,13 +195,9 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
if ((mstyle == LINEAR || mstyle == WIGGLE || mstyle == ROTATE) &&
scaleflag) {
double xscale,yscale,zscale;
if (scaleflag) {
xscale = domain->lattice->xlattice;
yscale = domain->lattice->ylattice;
zscale = domain->lattice->zlattice;
}
else xscale = yscale = zscale = 1.0;
double xscale = domain->lattice->xlattice;
double yscale = domain->lattice->ylattice;
double zscale = domain->lattice->zlattice;
if (mstyle == LINEAR) {
if (vxflag) vx *= xscale;

View File

@ -92,7 +92,6 @@ double FixTempCSVR::sumnoises(int nn) {
const double rr = random->gaussian();
return 2.0 * gamdev((nn-1) / 2) + rr*rr;
}
return 0.0;
}
/* -------------------------------------------------------------------

View File

@ -415,7 +415,7 @@ Dihedral *Force::new_dihedral(const char *style, int trysuffix, int &sflag)
#undef DIHEDRAL_CLASS
}
if (lmp->suffix) {
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);

View File

@ -65,6 +65,7 @@ enum {COMPUTES=1<<0,
TIME=1<<6,
VARIABLES=1<<7,
SYSTEM=1<<8,
COMM=1<<9,
ALL=~0};
}
@ -74,6 +75,9 @@ static const char *varstyles[] = {
static const char *mapstyles[] = { "none", "array", "hash" };
static const char *commstyles[] = { "brick", "tiled" };
static const char *commlayout[] = { "uniform", "nonuniform", "irregular" };
static const char bstyles[] = "pfsm";
using namespace LAMMPS_NS;
@ -104,13 +108,18 @@ void Info::command(int narg, char **arg)
idx += 2;
} else if ((idx+2 < narg) && (strncmp(arg[idx],"out",3) == 0)
&& (strncmp(arg[idx+1],"append",3) == 0)) {
if ((out != screen) && (out != logfile)) fclose(out);
out = fopen(arg[idx+2],"a");
idx += 3;
} else if ((idx+2 < narg) && (strncmp(arg[idx],"out",3) == 0)
&& (strncmp(arg[idx+1],"overwrite",3) == 0)) {
if ((out != screen) && (out != logfile)) fclose(out);
out = fopen(arg[idx+2],"w");
idx += 3;
} else if (strncmp(arg[idx],"computes",3) == 0) {
} else if (strncmp(arg[idx],"communication",4) == 0) {
flags |= COMM;
++idx;
} else if (strncmp(arg[idx],"computes",4) == 0) {
flags |= COMPUTES;
++idx;
} else if (strncmp(arg[idx],"dumps",3) == 0) {
@ -220,6 +229,20 @@ void Info::command(int narg, char **arg)
#endif
}
if (flags & COMM) {
int major,minor;
MPI_Get_version(&major,&minor);
fprintf(out,"\nCommunication information:\n");
fprintf(out,"MPI library level: MPI v%d.%d\n",major,minor);
fprintf(out,"Comm style = %s, Comm layout = %s\n",
commstyles[comm->style], commlayout[comm->layout]);
fprintf(out,"Nprocs = %d Nthreads = %d\n",
comm->nprocs, comm->nthreads);
fprintf(out,"Processor grid = %d x %d x %d\n",comm->procgrid[0],
comm->procgrid[1], comm->procgrid[2]);
}
if (flags & SYSTEM) {
fprintf(out,"\nSystem information:\n");
fprintf(out,"Units = %s\n",update->unit_style);
@ -230,32 +253,32 @@ void Info::command(int narg, char **arg)
msg = (atom->molecular == 2) ? "template" : "standard";
fprintf(out,"Molecule type = %s\n",msg);
}
fprintf(out,"Atoms: " BIGINT_FORMAT ", types: %d, style: %s\n",
fprintf(out,"Atoms = " BIGINT_FORMAT ", types = %d, style = %s\n",
atom->natoms, atom->ntypes, force->pair_style);
if (atom->molecular > 0) {
const char *msg;
msg = force->bond_style ? force->bond_style : "none";
fprintf(out,"Bonds: " BIGINT_FORMAT ", types: %d, style: %s\n",
fprintf(out,"Bonds = " BIGINT_FORMAT ", types = %d, style = %s\n",
atom->nbonds, atom->nbondtypes, msg);
msg = force->angle_style ? force->angle_style : "none";
fprintf(out,"Angles: " BIGINT_FORMAT ", types: %d, style: %s\n",
fprintf(out,"Angles = " BIGINT_FORMAT ", types = %d, style = %s\n",
atom->nangles, atom->nangletypes, msg);
msg = force->dihedral_style ? force->dihedral_style : "none";
fprintf(out,"Dihedrals: " BIGINT_FORMAT ", types: %d, style: %s\n",
fprintf(out,"Dihedrals = " BIGINT_FORMAT ", types = %d, style = %s\n",
atom->ndihedrals, atom->ndihedraltypes, msg);
msg = force->improper_style ? force->improper_style : "none";
fprintf(out,"Impropers: " BIGINT_FORMAT ", types: %d, style: %s\n",
fprintf(out,"Impropers = " BIGINT_FORMAT ", types = %d, style = %s\n",
atom->nimpropers, atom->nimpropertypes, msg);
const double * const special_lj = force->special_lj;
const double * const special_coul = force->special_coul;
fprintf(out,"Special bond factors lj: %-10g %-10g %-10g\n"
"Special bond factors coul: %-10g %-10g %-10g\n",
fprintf(out,"Special bond factors lj = %-10g %-10g %-10g\n"
"Special bond factors coul = %-10g %-10g %-10g\n",
special_lj[1],special_lj[2],special_lj[3],
special_coul[1],special_coul[2],special_coul[3]);
}
@ -264,7 +287,8 @@ void Info::command(int narg, char **arg)
force->kspace ? force->kspace_style : "none");
if (domain->box_exist) {
fprintf(out,"\n%s box: (%g x %g %g)\n",
fprintf(out,"\nDimensions = %d\n",domain->dimension);
fprintf(out,"%s box = %g x %g x %g\n",
domain->triclinic ? "Triclinic" : "Orthogonal",
domain->xprd, domain->yprd, domain->zprd);
fprintf(out,"Boundaries = %c,%c %c,%c %c,%c\n",
@ -298,7 +322,7 @@ void Info::command(int narg, char **arg)
Region **regs = domain->regions;
fprintf(out,"\nRegion information:\n");
for (int i=0; i < nreg; ++i) {
fprintf(out,"Region[%3d]: %s, style: %s, side: %s\n",
fprintf(out,"Region[%3d]: %s, style = %s, side = %s\n",
i, regs[i]->id, regs[i]->style,
regs[i]->interior ? "in" : "out");
}
@ -310,7 +334,7 @@ void Info::command(int narg, char **arg)
char **names = group->names;
fprintf(out,"\nCompute information:\n");
for (int i=0; i < ncompute; ++i) {
fprintf(out,"Compute[%3d]: %s, style: %s, group: %s\n",
fprintf(out,"Compute[%3d]: %s, style = %s, group = %s\n",
i, compute[i]->id, compute[i]->style,
names[compute[i]->igroup]);
}
@ -324,13 +348,13 @@ void Info::command(int narg, char **arg)
char **names = group->names;
fprintf(out,"\nDump information:\n");
for (int i=0; i < ndump; ++i) {
fprintf(out,"Dump[%3d]: %s, file: %s, style: %s, group: %s, ",
fprintf(out,"Dump[%3d]: %s, file = %s, style = %s, group = %s, ",
i, dump[i]->id, dump[i]->filename,
dump[i]->style, names[dump[i]->igroup]);
if (nevery[i]) {
fprintf(out,"every: %d\n", nevery[i]);
fprintf(out,"every = %d\n", nevery[i]);
} else {
fprintf(out,"every: %s\n", vnames[i]);
fprintf(out,"every = %s\n", vnames[i]);
}
}
}
@ -341,7 +365,7 @@ void Info::command(int narg, char **arg)
char **names = group->names;
fprintf(out,"\nFix information:\n");
for (int i=0; i < nfix; ++i) {
fprintf(out,"Fix[%3d]: %s, style: %s, group: %s\n",
fprintf(out,"Fix[%3d]: %s, style = %s, group = %s\n",
i, fix[i]->id, fix[i]->style, names[fix[i]->igroup]);
}
}

View File

@ -14,7 +14,7 @@
#include "mpi.h"
#include "lammps.h"
#include "input.h"
#include "string.h"
#include "stdio.h"
using namespace LAMMPS_NS;
@ -26,10 +26,18 @@ int main(int argc, char **argv)
{
MPI_Init(&argc,&argv);
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
try {
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
lammps->input->file();
delete lammps;
lammps->input->file();
delete lammps;
}
catch(...) {
int me;
MPI_Comm_rank(MPI_COMM_WORLD,&me);
fprintf(stderr,"Unknown exception caught on rank %d\n",me);
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();

View File

@ -1051,6 +1051,7 @@ void Molecule::special_generate()
for (int i = 0; i < natoms; i++) {
nspecial[i][0] = num_bond[i];
for (int j = 0; j < num_bond[i]; j++) {
atom1 = i;
atom2 = bond_atom[i][j];
if (count[atom1] >= maxspecial)
error->one(FLERR,"");

View File

@ -796,6 +796,15 @@ void Neighbor::init()
if (me == 0) {
const double cutghost = MAX(cutneighmax,comm->cutghostuser);
double binsize, bbox[3];
bbox[0] = bboxhi[0]-bboxlo[0];
bbox[1] = bboxhi[1]-bboxlo[1];
bbox[2] = bboxhi[2]-bboxlo[2];
if (binsizeflag) binsize = binsize_user;
else if (style == BIN) binsize = 0.5*cutneighmax;
else binsize = 0.5*cutneighmin;
if (binsize == 0.0) binsize = bbox[0];
if (logfile) {
fprintf(logfile,"Neighbor list info ...\n");
fprintf(logfile," %d neighbor list requests\n",nrequest);
@ -803,6 +812,9 @@ void Neighbor::init()
every,delay,dist_check ? "yes" : "no");
fprintf(logfile," master list distance cutoff = %g\n",cutneighmax);
fprintf(logfile," ghost atom cutoff = %g\n",cutghost);
if (style != NSQ)
fprintf(logfile," binsize = %g -> bins = %g %g %g\n",binsize,
ceil(bbox[0]/binsize), ceil(bbox[1]/binsize), ceil(bbox[2]/binsize));
}
if (screen) {
fprintf(screen,"Neighbor list info ...\n");
@ -811,6 +823,9 @@ void Neighbor::init()
every,delay,dist_check ? "yes" : "no");
fprintf(screen," master list distance cutoff = %g\n",cutneighmax);
fprintf(screen," ghost atom cutoff = %g\n",cutghost);
if (style != NSQ)
fprintf(screen," binsize = %g, bins = %g %g %g\n",binsize,
ceil(bbox[0]/binsize), ceil(bbox[1]/binsize), ceil(bbox[2]/binsize));
}
}
}

View File

@ -711,7 +711,7 @@ void Pair::add_tally_callback(Compute *ptr)
found = num_tally_compute;
++num_tally_compute;
void *p = memory->srealloc((void *)list_tally_compute,
sizeof(Compute **) * num_tally_compute,
sizeof(Compute *) * num_tally_compute,
"pair:list_tally_compute");
list_tally_compute = (Compute **) p;
list_tally_compute[num_tally_compute-1] = ptr;

View File

@ -114,6 +114,7 @@ void PairHybrid::compute(int eflag, int vflag)
// check if we are running with r-RESPA using the hybrid keyword
Respa *respa = NULL;
respaflag = 0;
if (strstr(update->integrate_style,"respa")) {
respa = (Respa *) update->integrate;
if (respa->nhybrid_styles > 0) respaflag = 1;
@ -565,8 +566,6 @@ double PairHybrid::init_one(int i, int j)
// perform mixing only if I,I sub-style = J,J sub-style
// also require I,I and J,J are both assigned to single sub-style
printf("IJ %d %d\n",i,j);
if (setflag[i][j] == 0) {
if (nmap[i][i] != 1 || nmap[j][j] != 1 || map[i][i][0] != map[j][j][0])
error->one(FLERR,"All pair coeffs are not set");

View File

@ -145,7 +145,6 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag)
forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd +
r*f_shift) * r;
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
fpair = forcecoul * r2inv;
} else forcecoul = 0.0;
fpair = (forcecoul + factor_lj*forcelj) * r2inv;

View File

@ -886,7 +886,7 @@ void ReadData::header()
} else if (strstr(line,"dihedrals")) {
sscanf(line,BIGINT_FORMAT,&ndihedrals);
if (addflag == NONE) atom->ndihedrals = ndihedrals;
else atom->ndihedrals += natoms;
else atom->ndihedrals += ndihedrals;
} else if (strstr(line,"impropers")) {
sscanf(line,BIGINT_FORMAT,&nimpropers);
if (addflag == NONE) atom->nimpropers = nimpropers;
@ -1812,7 +1812,8 @@ void ReadData::parse_keyword(int first)
void ReadData::skip_lines(bigint n)
{
if (me) return;
char *eof;
if (n <= 0) return;
char *eof = NULL;
for (bigint i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp);
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
}

View File

@ -318,13 +318,13 @@ int ReaderNative::find_label(const char *label, int n, char **labels)
/* ----------------------------------------------------------------------
read N lines from dump file
only last one is saved in line
return NULL if end-of-file error, else non-NULL
only called by proc 0
------------------------------------------------------------------------- */
void ReaderNative::read_lines(int n)
{
char *eof;
char *eof = NULL;
if (n <= 0) return;
for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp);
if (eof == NULL) error->all(FLERR,"Unexpected end of dump file");
if (eof == NULL) error->one(FLERR,"Unexpected end of dump file");
}

View File

@ -204,13 +204,13 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields)
/* ----------------------------------------------------------------------
read N lines from dump file
only last one is saved in line
return NULL if end-of-file error, else non-NULL
only called by proc 0
------------------------------------------------------------------------- */
void ReaderXYZ::read_lines(int n)
{
char *eof;
char *eof = NULL;
if (n <= 0) return;
for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp);
if (eof == NULL) error->all(FLERR,"Unexpected end of dump file");
if (eof == NULL) error->one(FLERR,"Unexpected end of dump file");
}

View File

@ -61,7 +61,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
shape_update();
} else {
radius = force->numeric(FLERR,arg[5]);
if (axis == 'x') radius *= xscale;
if (axis == 'x') radius *= yscale;
else radius *= xscale;
rstyle = CONSTANT;
}
@ -439,7 +439,7 @@ void RegCylinder::shape_update()
radius = input->variable->compute_equal(rvar);
if (radius < 0.0)
error->one(FLERR,"Variable evaluation in region gave bad value");
if (axis == 'x') radius *= xscale;
if (axis == 'x') radius *= yscale;
else radius *= xscale;
}

View File

@ -316,6 +316,7 @@ void Variable::set(int narg, char **arg)
data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]);
data[nvar][1] = new char[VALUELENGTH];
strcpy(data[nvar][1],"(undefined)");
// SCALARFILE for strings or numbers
// which = 1st value
@ -370,6 +371,7 @@ void Variable::set(int narg, char **arg)
data[nvar] = new char*[num[nvar]];
copy(2,&arg[2],data[nvar]);
data[nvar][2] = new char[VALUELENGTH];
strcpy(data[nvar][2],"(undefined)");
// EQUAL
// replace pre-existing var if also style EQUAL (allows it to be reset)
@ -394,6 +396,7 @@ void Variable::set(int narg, char **arg)
data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]);
data[nvar][1] = new char[VALUELENGTH];
strcpy(data[nvar][1],"(undefined)");
}
// ATOM
@ -445,6 +448,7 @@ void Variable::set(int narg, char **arg)
data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]);
data[nvar][1] = new char[VALUELENGTH];
strcpy(data[nvar][1],"(undefined)");
}
} else error->all(FLERR,"Illegal variable command");
@ -742,7 +746,7 @@ char *Variable::retrieve(char *name)
error->all(FLERR,"Variable has circular dependency");
eval_in_progress[ivar] = 1;
char *str;
char *str = NULL;
if (style[ivar] == INDEX || style[ivar] == WORLD ||
style[ivar] == UNIVERSE || style[ivar] == STRING ||
style[ivar] == SCALARFILE) {

View File

@ -241,7 +241,7 @@ void Velocity::create(double t_desired, int seed)
int m;
double vx,vy,vz,factor;
RanPark *random;
RanPark *random = NULL;
if (loop_flag == ALL) {