git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8226 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -600,4 +600,3 @@ void PairSW::threebody(Param *paramij, Param *paramik, Param *paramijk,
|
||||
|
||||
if (eflag) eng = facrad;
|
||||
}
|
||||
|
||||
|
||||
@ -435,4 +435,3 @@ double PairHbondDreidingMorse::single(int i, int j, int itype, int jtype,
|
||||
|
||||
return eng;
|
||||
}
|
||||
|
||||
|
||||
@ -337,4 +337,3 @@ void PairLJCharmmCoulLongOpt::eval()
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
|
||||
@ -744,5 +744,3 @@ void PairPeriLPS::unpack_comm(int n, int first, double *buf)
|
||||
theta[i] = buf[m++];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -208,4 +208,3 @@ extern "C" void FORTRAN(mdsav,MDSAV)(int*);
|
||||
extern "C" void FORTRAN(getnsbmax,GETNSBMAX)(int*);
|
||||
extern "C" void FORTRAN(getnsbma2,GETNSBMA2)(int*);
|
||||
extern "C" void FORTRAN(getcutof3,GETCUTOF3)(double*);
|
||||
|
||||
|
||||
@ -97,5 +97,3 @@ void FixEventPRD::restart(char *buf)
|
||||
correlated_event = static_cast<int> (list[n++]);
|
||||
ncoincident = static_cast<int> (list[n++]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -91,5 +91,3 @@ void FixEventTAD::restart(char *buf)
|
||||
tlo = list[n++];
|
||||
ebarrier = list[n++];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1018,4 +1018,3 @@ void TAD::grow_event_list(int nmax) {
|
||||
memory->srealloc(fix_event_list,nmax*sizeof(FixEventTAD *),"tad:eventlist");
|
||||
nmax_event_list = nmax;
|
||||
}
|
||||
|
||||
|
||||
@ -958,4 +958,3 @@ double FixMSST::compute_vsum()
|
||||
MPI_Allreduce(&t,&vsum,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
return vsum;
|
||||
}
|
||||
|
||||
|
||||
@ -150,4 +150,3 @@ void FixNVEAwpmd::reset_dt()
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
||||
|
||||
|
||||
@ -41,4 +41,3 @@ namespace LJSDKParms {
|
||||
static const double lj_pow2[] = {0.0, 6.00, 4.0, 6.0};
|
||||
}}
|
||||
#endif
|
||||
|
||||
|
||||
@ -422,4 +422,3 @@ void cvm::atom::apply_force(cvm::rvector const &new_force)
|
||||
cp->applied_forces[this->index].y = new_force.y;
|
||||
cp->applied_forces[this->index].z = new_force.z;
|
||||
}
|
||||
|
||||
|
||||
@ -475,6 +475,3 @@ int AtomVecAngleCuda::unpack_exchange(double *buf)
|
||||
}
|
||||
return mfirst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -403,6 +403,3 @@ int AtomVecAtomicCuda::unpack_exchange(double *buf)
|
||||
}
|
||||
return mfirst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -402,6 +402,3 @@ int AtomVecChargeCuda::unpack_exchange(double *buf)
|
||||
}
|
||||
return mfirst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -515,6 +515,3 @@ int AtomVecFullCuda::unpack_exchange(double *buf)
|
||||
}
|
||||
return mfirst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1431,4 +1431,3 @@ void CommCuda::free_multi()
|
||||
delete cu_multilo; cu_multilo = NULL;
|
||||
delete cu_multihi; cu_multihi = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -182,4 +182,3 @@ void CudaNeighList::nl_download(bool will_be_changed)
|
||||
cu_numneigh->download();
|
||||
MYDBG(printf("# CUDA: CudaNeighList::nl_download() ... end\n");)
|
||||
}
|
||||
|
||||
|
||||
@ -177,5 +177,3 @@ void FixGravityCuda::post_force(int vflag)
|
||||
MYDBG( printf("# CUDA: FixGravityCuda::postforce start\n"); )
|
||||
Cuda_FixGravityCuda_PostForce(&cuda->shared_data, groupbit, xacc,yacc,zacc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2074,4 +2074,3 @@ void FixNHCuda::nh_omega_dot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -217,6 +217,3 @@ void FixTempBerendsenCuda::reset_target(double t_new)
|
||||
{
|
||||
t_start = t_stop = t_new;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -313,4 +313,3 @@ return;
|
||||
MYDBG(printf(" # CUDA::NeighFullNSQCuda ... end\n");)
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -197,5 +197,3 @@ void PairCGCMMCoulCutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -197,5 +197,3 @@ void PairCGCMMCoulDebyeCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -199,5 +199,3 @@ void PairCGCMMCoulLongCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -194,5 +194,3 @@ void PairCGCMMCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -240,5 +240,3 @@ void PairGranHookeCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.eatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,5 +177,3 @@ void PairLJ96CutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -187,5 +187,3 @@ void PairLJCharmmCoulCharmmCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -182,5 +182,3 @@ void PairLJCharmmCoulCharmmImplicitCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -195,5 +195,3 @@ void PairLJCharmmCoulLongCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -160,5 +160,3 @@ void PairLJClass2CoulCutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -173,5 +173,3 @@ void PairLJClass2CoulLongCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -165,5 +165,3 @@ void PairLJClass2Cuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -160,5 +160,3 @@ void PairLJCutCoulCutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -161,5 +161,3 @@ void PairLJCutCoulDebyeCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -214,5 +214,3 @@ void PairLJCutCoulLongCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,5 +177,3 @@ void PairLJCutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -176,5 +176,3 @@ void PairLJCutExperimentalCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -178,5 +178,3 @@ void PairLJExpandCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -193,5 +193,3 @@ void PairLJGromacsCoulGromacsCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -176,5 +176,3 @@ void PairLJGromacsCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -197,5 +197,3 @@ void PairLJSDKCoulCutCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -197,5 +197,3 @@ void PairLJSDKCoulDebyeCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -191,5 +191,3 @@ void PairLJSDKCoulLongCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -182,5 +182,3 @@ void PairLJSDKCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -176,5 +176,3 @@ void PairLJSmoothCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -175,5 +175,3 @@ void PairMorseCuda::ev_setup(int eflag, int vflag)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -205,5 +205,3 @@ void PairSWCuda::ev_setup(int eflag, int vflag)
|
||||
if (vflag_atom && atom->nmax > maxeatomold)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -202,5 +202,3 @@ void PairTersoffCuda::ev_setup(int eflag, int vflag)
|
||||
if (vflag_atom && atom->nmax > maxeatomold)
|
||||
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -316,4 +316,3 @@ double ComputeTempDeformEff::memory_usage()
|
||||
double bytes = maxbias * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -274,4 +274,3 @@ double ComputeTempRegionEff::memory_usage()
|
||||
double bytes = maxbias * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -433,4 +433,3 @@ double FixLangevinEff::compute_scalar()
|
||||
MPI_Allreduce(&energy_me,&energy_all,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
return -energy_all;
|
||||
}
|
||||
|
||||
|
||||
@ -172,4 +172,3 @@ void FixNVEEff::reset_dt()
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
||||
|
||||
|
||||
@ -204,4 +204,3 @@ double FixTempRescaleEff::compute_scalar()
|
||||
{
|
||||
return energy;
|
||||
}
|
||||
|
||||
|
||||
@ -1219,4 +1219,3 @@ double EwaldN::derivf(double x, double Rc, bigint natoms, double vol, double b2)
|
||||
double h = 0.000001; //Derivative step-size
|
||||
return (f(x + h,Rc,natoms,vol,b2) - f(x,Rc,natoms,vol,b2)) / h;
|
||||
}
|
||||
|
||||
|
||||
@ -70,4 +70,3 @@ typedef struct complex {
|
||||
memcpy(&d, &x, sizeof(complex)); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1474,4 +1474,3 @@ int imd_recv_fcoords(void *s, int32 n, float *coords) {
|
||||
// fill-column: 76
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
|
||||
|
||||
@ -368,4 +368,3 @@ double PairGaussCut::memory_usage()
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -729,4 +729,3 @@ void PairMEAMSpline::SplineFunction::writeGnuplot(const char* filename, const ch
|
||||
fprintf(fp, "e\n");
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
@ -325,4 +325,3 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -533,4 +533,3 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,thr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -264,4 +264,3 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,thr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -287,4 +287,3 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,thr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -110,4 +110,3 @@ void FixGravityOMP::post_force_respa(int vflag, int ilevel, int iloop)
|
||||
{
|
||||
if (ilevel == nlevels_respa-1) post_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -48,4 +48,3 @@ void FixPeriNeighOMP::init()
|
||||
neighbor->requests[irequest]->omp = use_omp;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -158,4 +158,3 @@ void FixQEQCombOMP::post_force(int vflag)
|
||||
iloop,enegchk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -150,4 +150,3 @@ void FixWallGranOMP::post_force_respa(int vflag, int ilevel, int iloop)
|
||||
{
|
||||
if (ilevel == nlevels_respa-1) post_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -268,4 +268,3 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -181,4 +181,3 @@ void Neighbor::half_from_full_newton_omp(NeighList *list)
|
||||
NEIGH_OMP_CLOSE;
|
||||
list->inum = inum_full;
|
||||
}
|
||||
|
||||
|
||||
@ -451,4 +451,3 @@ double PairPeriLPSOMP::memory_usage()
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -293,4 +293,3 @@ void PairTersoffZBLOMP::repulsive(Param *param, double rsq, double &fforce,
|
||||
eng = (1.0 - F_fermi(r,param->ZBLexpscale,param->ZBLcut))*eng_ZBL +
|
||||
F_fermi(r,param->ZBLexpscale,param->ZBLcut)*eng_ters;
|
||||
}
|
||||
|
||||
|
||||
@ -608,4 +608,3 @@ void PPPMCGOMP::compute_rho1d_thr(FFT_SCALAR * const * const r1d, const FFT_SCAL
|
||||
r1d[2][k] = r3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,4 +62,3 @@ void PPPMProxy::compute_proxy(int eflag, int vflag)
|
||||
setup_proxy();
|
||||
PPPM::compute(eflag,vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -62,4 +62,3 @@ void PPPMTIP4PProxy::compute_proxy(int eflag, int vflag)
|
||||
setup_proxy();
|
||||
PPPMTIP4P::compute(eflag,vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -229,4 +229,3 @@ void LAMMPS_NS::data_reduce_thr(double *dall, int nall, int nthreads, int ndim,
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -455,4 +455,3 @@ double FixReaxCBonds::memory_usage()
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -33,4 +33,3 @@ void Atom_Energy( reax_system*, control_params*, simulation_data*,
|
||||
storage*, reax_list**, output_controls* );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -256,4 +256,3 @@ void Reset( reax_system *system, control_params *control, simulation_data *data,
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -469,4 +469,3 @@ void sfree( void *ptr, char *name )
|
||||
free( ptr );
|
||||
ptr = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -520,4 +520,3 @@ void ivec_Max3( ivec res, ivec v1, ivec v2, ivec v3 )
|
||||
res[1] = MAX3( v1[1], v2[1], v3[1] );
|
||||
res[2] = MAX3( v1[2], v2[2], v3[2] );
|
||||
}
|
||||
|
||||
|
||||
@ -165,4 +165,3 @@ void FixMeso::reset_dt() {
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
||||
|
||||
|
||||
@ -120,4 +120,3 @@ void FixMesoStationary::reset_dt() {
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
||||
|
||||
|
||||
@ -311,4 +311,3 @@ void PairSPHRhoSum::unpack_comm(int n, int first, double *buf) {
|
||||
for (i = first; i < last; i++)
|
||||
rho[i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -223,4 +223,3 @@ extern void xdr_free (xdrproc_t __proc, char *__objp);
|
||||
|
||||
|
||||
#endif /* XDR_COMPAT_H */
|
||||
|
||||
|
||||
@ -134,4 +134,3 @@ void FixViscous::min_post_force(int vflag)
|
||||
{
|
||||
post_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
@ -1754,4 +1754,3 @@ double Image::element2diam(char *element)
|
||||
if (strcmp(element,name[i]) == 0) return diameter[i];
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
@ -234,4 +234,3 @@ void PairDPDTstat::read_restart_settings(FILE *fp)
|
||||
if (random) delete random;
|
||||
random = new RanMars(lmp,seed + comm->me);
|
||||
}
|
||||
|
||||
|
||||
@ -894,4 +894,3 @@ void ProcMap::grid_shift(int myloc, int nprocs, int &minus, int &plus)
|
||||
plus = myloc + 1;
|
||||
if (plus == nprocs) plus = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: Timothy Sirk (U Vermont)
|
||||
Contributing author: Timothy Sirk (ARL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "lmptype.h"
|
||||
@ -45,6 +45,38 @@ ReadDump::ReadDump(LAMMPS *lmp) : Pointers(lmp)
|
||||
{
|
||||
MPI_Comm_rank(world,&me);
|
||||
MPI_Comm_size(world,&nprocs);
|
||||
|
||||
dimension = domain->dimension;
|
||||
triclinic = domain->triclinic;
|
||||
|
||||
nfiles = 0;
|
||||
files = NULL;
|
||||
|
||||
nfield = 0;
|
||||
fieldtype = NULL;
|
||||
fieldlabel = NULL;
|
||||
fields = NULL;
|
||||
uflag = ucflag = ucflag_all = NULL;
|
||||
|
||||
reader = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ReadDump::~ReadDump()
|
||||
{
|
||||
for (int i = 0; i < nfiles; i++) delete [] files[i];
|
||||
delete [] files;
|
||||
for (int i = 0; i < nfield; i++) delete [] fieldlabel[i];
|
||||
delete [] fieldlabel;
|
||||
delete [] fieldtype;
|
||||
|
||||
memory->destroy(fields);
|
||||
memory->destroy(uflag);
|
||||
memory->destroy(ucflag);
|
||||
memory->destroy(ucflag_all);
|
||||
|
||||
delete reader;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -53,20 +85,416 @@ void ReadDump::command(int narg, char **arg)
|
||||
{
|
||||
if (narg < 2) error->all(FLERR,"Illegal read_dump command");
|
||||
|
||||
nstep = ATOBIGINT(arg[1]);
|
||||
store_files(1,&arg[0]);
|
||||
bigint nstep = ATOBIGINT(arg[1]);
|
||||
fields_and_keywords(narg-2,&arg[2]);
|
||||
setup_reader();
|
||||
|
||||
// per-field vectors
|
||||
// find the snapshot and read/bcast/process header info
|
||||
|
||||
int firstfield = 2;
|
||||
fieldtype = new int[narg];
|
||||
fieldlabel = new char*[narg];
|
||||
if (me == 0 && screen) fprintf(screen,"Scanning dump file ...\n");
|
||||
|
||||
bigint ntimestep = seek(nstep,1);
|
||||
if (ntimestep < 0)
|
||||
error->all(FLERR,"Dump file does not contain requested snapshot");
|
||||
header(1);
|
||||
|
||||
// reset timestep to nstep
|
||||
|
||||
update->reset_timestep(nstep);
|
||||
|
||||
// counters
|
||||
|
||||
// read in the snapshot and reset system
|
||||
|
||||
if (me == 0 && screen)
|
||||
fprintf(screen,"Reading snapshot from dump file ...\n");
|
||||
|
||||
bigint natoms_prev = atom->natoms;
|
||||
atoms();
|
||||
|
||||
// NOTE: this logic is not yet right
|
||||
if (me == 0) close();
|
||||
|
||||
// print out stats
|
||||
|
||||
bigint npurge_all,nreplace_all,ntrim_all,nadd_all;
|
||||
|
||||
bigint tmp;
|
||||
tmp = npurge;
|
||||
MPI_Allreduce(&tmp,&npurge_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = nreplace;
|
||||
MPI_Allreduce(&tmp,&nreplace_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = ntrim;
|
||||
MPI_Allreduce(&tmp,&ntrim_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = nadd;
|
||||
MPI_Allreduce(&tmp,&nadd_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
|
||||
domain->print_box(" ");
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) {
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms before read\n",natoms_prev);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms in snapshot\n",nsnapatoms);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms purged\n",npurge_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms replaced\n",nreplace_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms trimmed\n",ntrim_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms added\n",nadd_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms after read\n",atom->natoms);
|
||||
}
|
||||
if (logfile) {
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms before read\n",natoms_prev);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms in snapshot\n",nsnapatoms);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms purged\n",npurge_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms replaced\n",nreplace_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms trimmed\n",ntrim_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms added\n",nadd_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms after read\n",atom->natoms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::store_files(int nstr, char **str)
|
||||
{
|
||||
nfiles = nstr;
|
||||
files = new char*[nfiles];
|
||||
|
||||
for (int i = 0; i < nfiles; i++) {
|
||||
int n = strlen(str[i]) + 1;
|
||||
files[i] = new char[n];
|
||||
strcpy(files[i],str[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::setup_reader()
|
||||
{
|
||||
// create reader class
|
||||
// could make this a parent class and customize with other readers
|
||||
|
||||
if (format == NATIVE) reader = new ReadDumpNative(lmp);
|
||||
|
||||
// allocate snapshot field buffer
|
||||
|
||||
memory->create(fields,CHUNK,nfield,"read_dump:fields");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
seek Nrequest timestep in one or more dump files
|
||||
Nrequest can be a timestamp or -1 to match first step with exact = 0
|
||||
if exact = 1, must find exactly Nrequest
|
||||
if exact = 0, find first step >= Nrequest
|
||||
return matching ntimestep or -1 if did not find a match
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
bigint ReadDump::seek(bigint nrequest, int exact)
|
||||
{
|
||||
int ifile,eofflag;
|
||||
bigint ntimestep;
|
||||
|
||||
if (me == 0) {
|
||||
for (ifile = 0; ifile < nfiles; ifile++) {
|
||||
ntimestep = -1;
|
||||
open(files[ifile]);
|
||||
reader->file(fp);
|
||||
while (1) {
|
||||
eofflag = reader->read_time(ntimestep);
|
||||
if (eofflag) break;
|
||||
if (ntimestep >= nrequest) break;
|
||||
reader->skip();
|
||||
}
|
||||
if (ntimestep >= nrequest) break;
|
||||
close();
|
||||
}
|
||||
|
||||
currentfile = ifile;
|
||||
if (ntimestep < nrequest) close();
|
||||
if (ntimestep < nrequest) ntimestep = -1;
|
||||
if (exact && ntimestep != nrequest) ntimestep = -1;
|
||||
}
|
||||
|
||||
MPI_Bcast(&ntimestep,1,MPI_LMP_BIGINT,0,world);
|
||||
return ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
find next matching snapshot in one or more dump files
|
||||
Ncurrent = current timestep from last snapshot
|
||||
Nstop = match no timestep bigger than Nstop
|
||||
Nevery = only match timesteps that are a multiple of Nevery
|
||||
Nskip = skip every this many timesteps
|
||||
return matching ntimestep or -1 if did not find a match
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
bigint ReadDump::next(bigint ncurrent, bigint nstop, int nevery, int nskip)
|
||||
{
|
||||
int ifile,eofflag;
|
||||
bigint ntimestep;
|
||||
|
||||
// NOTE: this logic is not yet right
|
||||
|
||||
if (me == 0) {
|
||||
for (ifile = currentfile; ifile < nfiles; ifile++) {
|
||||
ntimestep = -1;
|
||||
if (ifile != currentfile) open(files[ifile]);
|
||||
reader->file(fp);
|
||||
while (1) {
|
||||
eofflag = reader->read_time(ntimestep);
|
||||
if (eofflag) ntimestep = -1;
|
||||
break;
|
||||
}
|
||||
if (ntimestep > ncurrent) break;
|
||||
close();
|
||||
}
|
||||
|
||||
currentfile = ifile;
|
||||
}
|
||||
|
||||
MPI_Bcast(&ntimestep,1,MPI_LMP_BIGINT,0,world);
|
||||
return ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
read and broadcast and store snapshot header info
|
||||
set nsnapatoms = # of atoms in snapshot
|
||||
set yindex,zindex
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::header(int fieldinfo)
|
||||
{
|
||||
int triclinic_snap;
|
||||
int fieldflag,xflag,yflag,zflag;
|
||||
|
||||
if (me == 0)
|
||||
nsnapatoms = reader->read_header(box,triclinic_snap,
|
||||
fieldinfo,nfield,fieldtype,fieldlabel,
|
||||
scaledflag,fieldflag,xflag,yflag,zflag);
|
||||
|
||||
MPI_Bcast(&nsnapatoms,1,MPI_LMP_BIGINT,0,world);
|
||||
MPI_Bcast(&triclinic_snap,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&box[0][0],9,MPI_DOUBLE,0,world);
|
||||
|
||||
// local copy of snapshot box parameters
|
||||
// used in xfield,yfield,zfield when converting dump atom to absolute coords
|
||||
|
||||
xlo = box[0][0];
|
||||
xhi = box[0][1];
|
||||
ylo = box[1][0];
|
||||
yhi = box[1][1];
|
||||
zlo = box[2][0];
|
||||
zhi = box[2][1];
|
||||
xprd = xhi - xlo;
|
||||
yprd = yhi - ylo;
|
||||
zprd = zhi - zlo;
|
||||
if (triclinic_snap) {
|
||||
xy = box[0][2];
|
||||
xz = box[1][2];
|
||||
yz = box[2][2];
|
||||
}
|
||||
|
||||
// done if not checking fields
|
||||
|
||||
if (!fieldinfo) return;
|
||||
|
||||
MPI_Bcast(&fieldflag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&xflag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&yflag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&zflag,1,MPI_INT,0,world);
|
||||
|
||||
// error check on current vs new box and fields
|
||||
|
||||
if ((triclinic_snap && !triclinic) ||
|
||||
(!triclinic_snap && triclinic))
|
||||
error->one(FLERR,"Read_dump triclinic status does not match simulation");
|
||||
|
||||
// error check field and scaling info
|
||||
|
||||
if (fieldflag < 0)
|
||||
error->one(FLERR,"Read_dump field not found in dump file");
|
||||
|
||||
// set overall scaling of coordinates
|
||||
// error if x,y,z scaling are not the same
|
||||
|
||||
scaled = MAX(xflag,yflag);
|
||||
scaled = MAX(zflag,scaled);
|
||||
if ((xflag != UNSET && xflag != scaled) ||
|
||||
(yflag != UNSET && yflag != scaled) ||
|
||||
(zflag != UNSET && zflag != scaled))
|
||||
error->one(FLERR,"Read_dump x,y,z fields do not have consistent scaling");
|
||||
|
||||
// scaled, triclinic coords require all 3 x,y,z fields, to perform unscaling
|
||||
// set yindex,zindex = column index of Y and Z fields in fields array
|
||||
// needed for unscaling to absolute coords in xfield(), yfield(), zfield()
|
||||
|
||||
if (scaled == SCALED && triclinic) {
|
||||
int flag = 0;
|
||||
if (xflag != scaled) flag = 1;
|
||||
if (yflag != scaled) flag = 1;
|
||||
if (dimension == 3 && zflag != scaled) flag = 1;
|
||||
if (flag)
|
||||
error->one(FLERR,"All read_dump x,y,z fields must be specified for "
|
||||
"scaled, triclinic coords");
|
||||
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (fieldtype[i] == Y) yindex = i;
|
||||
if (fieldtype[i] == Z) zindex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::atoms()
|
||||
{
|
||||
// initialize counters
|
||||
|
||||
npurge = nreplace = ntrim = nadd = 0;
|
||||
|
||||
// if purgeflag set, delete all current atoms
|
||||
|
||||
if (purgeflag) {
|
||||
if (atom->map_style) atom->map_clear();
|
||||
npurge = atom->nlocal;
|
||||
atom->nlocal = atom->nghost = 0;
|
||||
atom->natoms = 0;
|
||||
}
|
||||
|
||||
// to match existing atoms to dump atoms:
|
||||
// must build map if not a molecular system
|
||||
|
||||
int mapflag = 0;
|
||||
if (atom->map_style == 0) {
|
||||
mapflag = 1;
|
||||
atom->map_style = 1;
|
||||
atom->map_init();
|
||||
atom->map_set();
|
||||
}
|
||||
|
||||
// uflag[i] = 1 for each owned atom appearing in dump
|
||||
// ucflag = similar flag for each chunk atom, used in process_atoms()
|
||||
|
||||
// NOTE: this logic is sloppy
|
||||
|
||||
memory->destroy(uflag);
|
||||
memory->destroy(ucflag);
|
||||
memory->destroy(ucflag_all);
|
||||
uflag = ucflag = ucflag_all = NULL;
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
memory->create(uflag,nlocal,"read_dump:uflag");
|
||||
for (int i = 0; i < nlocal; i++) uflag[i] = 0;
|
||||
memory->create(ucflag,CHUNK,"read_dump:ucflag");
|
||||
memory->create(ucflag_all,CHUNK,"read_dump:ucflag");
|
||||
|
||||
// read, broadcast, and process atoms from snapshot in chunks
|
||||
|
||||
addproc = -1;
|
||||
|
||||
int nchunk;
|
||||
bigint nread = 0;
|
||||
while (nread < nsnapatoms) {
|
||||
nchunk = MIN(nsnapatoms-nread,CHUNK);
|
||||
if (me == 0) reader->read_atoms(nchunk,nfield,fields);
|
||||
MPI_Bcast(&fields[0][0],nchunk*nfield,MPI_DOUBLE,0,world);
|
||||
process_atoms(nchunk);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
// if addflag set, add tags to new atoms if possible
|
||||
|
||||
if (addflag) {
|
||||
bigint nblocal = atom->nlocal;
|
||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (atom->natoms < 0 || atom->natoms > MAXBIGINT)
|
||||
error->all(FLERR,"Too many total atoms");
|
||||
if (atom->natoms > MAXTAGINT) atom->tag_enable = 0;
|
||||
if (atom->natoms <= MAXTAGINT) atom->tag_extend();
|
||||
}
|
||||
|
||||
// if trimflag set, delete atoms not replaced by snapshot atoms
|
||||
|
||||
if (trimflag) {
|
||||
delete_atoms();
|
||||
bigint nblocal = atom->nlocal;
|
||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
}
|
||||
|
||||
// delete atom map if created it above
|
||||
// else reinitialize map for current atoms
|
||||
// do this before migrating atoms to new procs via Irregular
|
||||
|
||||
if (mapflag) {
|
||||
atom->map_delete();
|
||||
atom->map_style = 0;
|
||||
} else {
|
||||
atom->nghost = 0;
|
||||
atom->map_init();
|
||||
atom->map_set();
|
||||
}
|
||||
|
||||
// overwrite simulation box with dump snapshot box if requested
|
||||
|
||||
if (boxflag) {
|
||||
domain->boxlo[0] = xlo;
|
||||
domain->boxhi[0] = xhi;
|
||||
domain->boxlo[1] = ylo;
|
||||
domain->boxhi[1] = yhi;
|
||||
if (dimension == 3) {
|
||||
domain->boxlo[2] = zlo;
|
||||
domain->boxhi[2] = zhi;
|
||||
}
|
||||
if (triclinic) {
|
||||
domain->xy = xy;
|
||||
if (dimension == 3) {
|
||||
domain->xz = xz;
|
||||
domain->yz = yz;
|
||||
}
|
||||
}
|
||||
|
||||
domain->set_initial_box();
|
||||
domain->set_global_box();
|
||||
comm->set_proc_grid();
|
||||
domain->set_local_box();
|
||||
}
|
||||
|
||||
// move atoms back inside simulation box and to new processors
|
||||
// use remap() instead of pbc() in case atoms moved a long distance
|
||||
// adjust image flags of all atoms (old and new) based on current box
|
||||
// use irregular() in case atoms moved a long distance
|
||||
|
||||
double **x = atom->x;
|
||||
int *image = atom->image;
|
||||
nlocal = atom->nlocal;
|
||||
for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);
|
||||
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->reset_box();
|
||||
Irregular *irregular = new Irregular(lmp);
|
||||
irregular->migrate_atoms();
|
||||
delete irregular;
|
||||
if (triclinic) domain->lamda2x(atom->nlocal);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
process arg list for dump file fields and optional keywords
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::fields_and_keywords(int narg, char **arg)
|
||||
{
|
||||
// per-field vectors, leave space for ID + TYPE
|
||||
|
||||
fieldtype = new int[narg+2];
|
||||
fieldlabel = new char*[narg+2];
|
||||
|
||||
// add id and type fields as needed
|
||||
// scan ahead to see if "add yes" keyword/value is used
|
||||
// requires extra "type" field from from dump file
|
||||
// add id and type fields as needed
|
||||
|
||||
int iarg;
|
||||
for (iarg = firstfield; iarg < narg; iarg++)
|
||||
for (iarg = 0; iarg < narg; iarg++)
|
||||
if (strcmp(arg[iarg],"add") == 0)
|
||||
if (iarg < narg-1 && strcmp(arg[iarg+1],"yes") == 0) break;
|
||||
|
||||
@ -76,7 +504,7 @@ void ReadDump::command(int narg, char **arg)
|
||||
|
||||
// parse fields
|
||||
|
||||
iarg = firstfield;
|
||||
iarg = 0;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"x") == 0) fieldtype[nfield++] = X;
|
||||
else if (strcmp(arg[iarg],"y") == 0) fieldtype[nfield++] = Y;
|
||||
@ -91,8 +519,7 @@ void ReadDump::command(int narg, char **arg)
|
||||
iarg++;
|
||||
}
|
||||
|
||||
dimension = domain->dimension;
|
||||
triclinic = domain->triclinic;
|
||||
// check for no fields
|
||||
|
||||
if (fieldtype[nfield-1] == ID || fieldtype[nfield-1] == TYPE)
|
||||
error->all(FLERR,"Illegal read_dump command");
|
||||
@ -154,9 +581,11 @@ void ReadDump::command(int narg, char **arg)
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||
int i;
|
||||
for (i = 0; i < nfield; i++)
|
||||
if (strcmp(arg[firstfield+i],arg[iarg+1]) == 0) break;
|
||||
if (fieldlabel[i] && strcmp(arg[iarg+1],fieldlabel[i]) == 0) break;
|
||||
if (i == nfield) error->all(FLERR,"Illegal read_dump command");
|
||||
fieldlabel[i] = arg[iarg+2];
|
||||
int n = strlen(arg[iarg+2]) + 1;
|
||||
fieldlabel[i] = new char[n];
|
||||
strcpy(fieldlabel[i],arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"scaled") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||
@ -174,257 +603,8 @@ void ReadDump::command(int narg, char **arg)
|
||||
|
||||
if (purgeflag && (replaceflag || trimflag))
|
||||
error->all(FLERR,"If read_dump purges it cannot replace or trim");
|
||||
|
||||
// allocate snapshot field buffer
|
||||
|
||||
memory->create(fields,CHUNK,nfield,"read_dump:fields");
|
||||
|
||||
// create reader class
|
||||
// could make this a parent class and customize with other readers
|
||||
|
||||
if (format == NATIVE) reader = new ReadDumpNative(lmp);
|
||||
|
||||
// proc 0 opens dump file and scans to correct snapshot
|
||||
// after scan these values are set, so Bcast them:
|
||||
// nsnapatoms, box[3][3], scaled
|
||||
// NOTE: fieldlabel is just ptrs to input args in read_dump command
|
||||
// will not persist if want to use labels in rerun() command
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) fprintf(screen,"Scanning dump file ...\n");
|
||||
open(arg[0]);
|
||||
reader->init(fp);
|
||||
reader->scan(nstep,nfield,fieldtype,fieldlabel,scaledflag,
|
||||
nsnapatoms,box,scaled);
|
||||
}
|
||||
|
||||
MPI_Bcast(&nsnapatoms,1,MPI_LMP_BIGINT,0,world);
|
||||
MPI_Bcast(&box[0][0],9,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&scaled,1,MPI_INT,0,world);
|
||||
|
||||
// for scaled coords and triclinic box:
|
||||
// yindex,zindex = index of Y and Z fields
|
||||
// already known to exist because checked in scan()
|
||||
// needed for unscaling to absolute coords in xfield(), yfield(), zfield()
|
||||
|
||||
if (scaled == SCALED && triclinic) {
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (fieldtype[i] == Y) yindex = i;
|
||||
if (fieldtype[i] == Z) zindex = i;
|
||||
}
|
||||
}
|
||||
|
||||
// make local copy of snapshot box params
|
||||
|
||||
xlo = box[0][0];
|
||||
xhi = box[0][1];
|
||||
ylo = box[1][0];
|
||||
yhi = box[1][1];
|
||||
zlo = box[2][0];
|
||||
zhi = box[2][1];
|
||||
xprd = xhi - xlo;
|
||||
yprd = yhi - ylo;
|
||||
zprd = zhi - zlo;
|
||||
if (triclinic) {
|
||||
xy = box[0][2];
|
||||
xz = box[1][2];
|
||||
yz = box[2][2];
|
||||
}
|
||||
|
||||
// reset timestep to nstep
|
||||
|
||||
char *tstr[1];
|
||||
char str[32];
|
||||
sprintf(str,BIGINT_FORMAT,nstep);
|
||||
tstr[0] = str;
|
||||
update->reset_timestep(1,tstr);
|
||||
|
||||
// reset simulation box from snapshot box parameters if requested
|
||||
// do it now, so if adding atoms, procs will have correct sub-domains
|
||||
// call domain->reset_box() later,
|
||||
// since can't shrink wrap until atom coords change and atoms are added
|
||||
|
||||
if (boxflag) {
|
||||
domain->boxlo[0] = xlo;
|
||||
domain->boxhi[0] = xhi;
|
||||
domain->boxlo[1] = ylo;
|
||||
domain->boxhi[1] = yhi;
|
||||
if (dimension == 3) {
|
||||
domain->boxlo[2] = zlo;
|
||||
domain->boxhi[2] = zhi;
|
||||
}
|
||||
if (triclinic) {
|
||||
domain->xy = xy;
|
||||
if (dimension == 3) {
|
||||
domain->xz = xz;
|
||||
domain->yz = yz;
|
||||
}
|
||||
}
|
||||
|
||||
domain->set_initial_box();
|
||||
domain->set_global_box();
|
||||
comm->set_proc_grid();
|
||||
domain->set_local_box();
|
||||
}
|
||||
|
||||
// read in the snapshot
|
||||
|
||||
if (me == 0)
|
||||
if (screen) fprintf(screen,"Reading snapshot from dump file ...\n");
|
||||
|
||||
// counters
|
||||
|
||||
bigint natoms_prev = atom->natoms;
|
||||
npurge = nreplace = ntrim = nadd = 0;
|
||||
|
||||
// if purgeflag set, delete all current atoms
|
||||
|
||||
if (purgeflag) {
|
||||
if (atom->map_style) atom->map_clear();
|
||||
npurge = atom->nlocal;
|
||||
atom->nlocal = atom->nghost = 0;
|
||||
atom->natoms = 0;
|
||||
}
|
||||
|
||||
// to match existing atoms to dump atoms:
|
||||
// must build map if not a molecular system
|
||||
|
||||
int mapflag = 0;
|
||||
if (atom->map_style == 0) {
|
||||
mapflag = 1;
|
||||
atom->map_style = 1;
|
||||
atom->map_init();
|
||||
atom->map_set();
|
||||
}
|
||||
|
||||
// uflag[i] = 1 for each owned atom appearing in dump
|
||||
// ucflag = similar flag for each chunk atom, used in process_atoms()
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
memory->create(uflag,nlocal,"read_dump:uflag");
|
||||
for (int i = 0; i < nlocal; i++) uflag[i] = 0;
|
||||
memory->create(ucflag,CHUNK,"read_dump:ucflag");
|
||||
memory->create(ucflag_all,CHUNK,"read_dump:ucflag");
|
||||
|
||||
// read, broadcast, and process atoms from snapshot in chunks
|
||||
|
||||
addproc = -1;
|
||||
|
||||
int nchunk;
|
||||
bigint nread = 0;
|
||||
while (nread < nsnapatoms) {
|
||||
nchunk = MIN(nsnapatoms-nread,CHUNK);
|
||||
if (me == 0) reader->read(nchunk,fields);
|
||||
MPI_Bcast(&fields[0][0],nchunk*nfield,MPI_DOUBLE,0,world);
|
||||
process_atoms(nchunk);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
// if addflag set, add tags to new atoms if possible
|
||||
|
||||
if (addflag) {
|
||||
bigint nblocal = atom->nlocal;
|
||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (atom->natoms < 0 || atom->natoms > MAXBIGINT)
|
||||
error->all(FLERR,"Too many total atoms");
|
||||
if (atom->natoms > MAXTAGINT) atom->tag_enable = 0;
|
||||
if (atom->natoms <= MAXTAGINT) atom->tag_extend();
|
||||
}
|
||||
|
||||
// if trimflag set, delete atoms not replaced by snapshot atoms
|
||||
|
||||
if (trimflag) {
|
||||
delete_atoms(uflag);
|
||||
bigint nblocal = atom->nlocal;
|
||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
}
|
||||
|
||||
// delete atom map if created it above
|
||||
// else reinitialize map for current atoms
|
||||
// do this before migrating atoms to new procs via Irregular
|
||||
|
||||
if (mapflag) {
|
||||
atom->map_delete();
|
||||
atom->map_style = 0;
|
||||
} else {
|
||||
atom->nghost = 0;
|
||||
atom->map_init();
|
||||
atom->map_set();
|
||||
}
|
||||
|
||||
// close dump file
|
||||
|
||||
if (me == 0) {
|
||||
if (compressed) pclose(fp);
|
||||
else fclose(fp);
|
||||
}
|
||||
|
||||
// move atoms back inside simulation box and to new processors
|
||||
// use remap() instead of pbc() in case atoms moved a long distance
|
||||
// adjust image flags of all atoms (old and new) based on current box
|
||||
// use irregular() in case atoms moved a long distance
|
||||
|
||||
double **x = atom->x;
|
||||
int *image = atom->image;
|
||||
nlocal = atom->nlocal;
|
||||
for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);
|
||||
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->reset_box();
|
||||
Irregular *irregular = new Irregular(lmp);
|
||||
irregular->migrate_atoms();
|
||||
delete irregular;
|
||||
if (triclinic) domain->lamda2x(atom->nlocal);
|
||||
|
||||
domain->print_box(" ");
|
||||
|
||||
// clean up
|
||||
|
||||
delete reader;
|
||||
delete [] fieldtype;
|
||||
delete [] fieldlabel;
|
||||
memory->destroy(fields);
|
||||
memory->destroy(uflag);
|
||||
memory->destroy(ucflag);
|
||||
memory->destroy(ucflag_all);
|
||||
|
||||
// print out stats
|
||||
|
||||
bigint npurge_all,nreplace_all,ntrim_all,nadd_all;
|
||||
|
||||
bigint tmp;
|
||||
tmp = npurge;
|
||||
MPI_Allreduce(&tmp,&npurge_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = nreplace;
|
||||
MPI_Allreduce(&tmp,&nreplace_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = ntrim;
|
||||
MPI_Allreduce(&tmp,&ntrim_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
tmp = nadd;
|
||||
MPI_Allreduce(&tmp,&nadd_all,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) {
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms before read\n",natoms_prev);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms in snapshot\n",nsnapatoms);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms purged\n",npurge_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms replaced\n",nreplace_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms trimmed\n",ntrim_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms added\n",nadd_all);
|
||||
fprintf(screen," " BIGINT_FORMAT " atoms after read\n",atom->natoms);
|
||||
}
|
||||
if (logfile) {
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms before read\n",natoms_prev);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms in snapshot\n",nsnapatoms);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms purged\n",npurge_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms replaced\n",nreplace_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms trimmed\n",ntrim_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms added\n",nadd_all);
|
||||
fprintf(logfile," " BIGINT_FORMAT " atoms after read\n",atom->natoms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
process each of N atoms in chunk read from dump file
|
||||
if in replace mode and atom ID matches current atom,
|
||||
@ -597,7 +777,7 @@ void ReadDump::process_atoms(int n)
|
||||
delete atoms not flagged as replaced by dump atoms
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::delete_atoms(int *uflag)
|
||||
void ReadDump::delete_atoms()
|
||||
{
|
||||
AtomVec *avec = atom->avec;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -671,3 +851,14 @@ void ReadDump::open(char *file)
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
close current dump file
|
||||
only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDump::close()
|
||||
{
|
||||
if (compressed) pclose(fp);
|
||||
else fclose(fp);
|
||||
}
|
||||
|
||||
@ -30,17 +30,29 @@ namespace LAMMPS_NS {
|
||||
class ReadDump : protected Pointers {
|
||||
public:
|
||||
ReadDump(class LAMMPS *);
|
||||
~ReadDump() {}
|
||||
~ReadDump();
|
||||
void command(int, char **);
|
||||
|
||||
void store_files(int, char **);
|
||||
void setup_reader();
|
||||
bigint seek(bigint, int);
|
||||
void header(int);
|
||||
bigint next(bigint, bigint, int, int);
|
||||
void atoms();
|
||||
void fields_and_keywords(int, char **);
|
||||
|
||||
private:
|
||||
int me,nprocs;
|
||||
FILE *fp;
|
||||
|
||||
int dimension;
|
||||
int triclinic;
|
||||
|
||||
bigint nstep; // timestep to find in dump file
|
||||
int boxflag; // use dump file box params
|
||||
int nfiles; // # of dump files to process
|
||||
char **files; // list of file names
|
||||
int currentfile; // currently open file
|
||||
|
||||
int boxflag; // overwrite simulation with dump file box params
|
||||
int replaceflag,addflag; // flags for processing dump snapshot atoms
|
||||
int trimflag,purgeflag;
|
||||
int scaledflag; // user setting for coordinate scaling
|
||||
@ -54,7 +66,7 @@ private:
|
||||
double **fields; // per-atom field values
|
||||
|
||||
double box[3][3]; // dump file box parameters
|
||||
double xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz;
|
||||
double xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz; // dump snapshot box params
|
||||
double xprd,yprd,zprd;
|
||||
|
||||
bigint nsnapatoms; // # of atoms in dump file shapshot
|
||||
@ -69,13 +81,14 @@ private:
|
||||
class ReadDumpNative *reader; // class that reads native dump file
|
||||
|
||||
void process_atoms(int);
|
||||
void delete_atoms(int *);
|
||||
void delete_atoms();
|
||||
|
||||
double xfield(int, int);
|
||||
double yfield(int, int);
|
||||
double zfield(int, int);
|
||||
|
||||
void open(char *);
|
||||
void close();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include "stdlib.h"
|
||||
#include "read_dump_native.h"
|
||||
#include "atom.h"
|
||||
#include "domain.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
@ -29,9 +29,6 @@ enum{UNSET,UNSCALED,SCALED};
|
||||
|
||||
ReadDumpNative::ReadDumpNative(LAMMPS *lmp) : Pointers(lmp)
|
||||
{
|
||||
dimension = domain->dimension;
|
||||
triclinic = domain->triclinic;
|
||||
|
||||
line = new char[MAXLINE];
|
||||
words = NULL;
|
||||
fieldindex = NULL;
|
||||
@ -43,116 +40,131 @@ ReadDumpNative::~ReadDumpNative()
|
||||
{
|
||||
delete [] line;
|
||||
delete [] words;
|
||||
delete [] fieldindex;
|
||||
memory->destroy(fieldindex);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------
|
||||
set file ptr
|
||||
caller opens/closes dump files
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDumpNative::init(FILE *fpcaller)
|
||||
void ReadDumpNative::file(FILE *fpcaller)
|
||||
{
|
||||
fp = fpcaller;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 scans dump file until reaching snapshot with timestamp = Nstep
|
||||
extract natoms and box bounds from snapshot
|
||||
set fieldindex for specified fields and overall scaled setting
|
||||
error check on current vs new box and fields
|
||||
NOTE: error checking should maybe be moved to parent
|
||||
read and return time stamp from dump file
|
||||
if first read reaches end-of-file, return 1 so caller can open next file
|
||||
only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDumpNative::scan(bigint nstep,
|
||||
int nfield_caller, int *fieldtype,
|
||||
char **fieldlabel, int scaledflag,
|
||||
bigint &natoms, double box[3][3], int &scaled)
|
||||
int ReadDumpNative::read_time(bigint &ntimestep)
|
||||
{
|
||||
int nchunk,triclinic_snap,s_index,u_index,su_index;
|
||||
bigint ntimestep,nremain;
|
||||
char *bc,*names;
|
||||
char *eof = fgets(line,MAXLINE,fp);
|
||||
if (eof == NULL) return 1;
|
||||
|
||||
nfield = nfield_caller;
|
||||
|
||||
read_lines(1);
|
||||
|
||||
while (1) {
|
||||
if (strstr(line,"ITEM: TIMESTEP") != line)
|
||||
error->one(FLERR,"Incorrectly formatted dump file");
|
||||
error->one(FLERR,"Dump file is incorrectly formatted");
|
||||
read_lines(1);
|
||||
sscanf(line,BIGINT_FORMAT,&ntimestep);
|
||||
|
||||
if (ntimestep > nstep)
|
||||
error->one(FLERR,"Dump file does not contain requested snapshot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
skip snapshot from timestamp onward
|
||||
only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDumpNative::skip()
|
||||
{
|
||||
read_lines(2);
|
||||
bigint natoms;
|
||||
sscanf(line,BIGINT_FORMAT,&natoms);
|
||||
|
||||
// skip snapshot
|
||||
// invoke read_lines() in chunks no larger than MAXSMALLINT
|
||||
|
||||
if (ntimestep < nstep) {
|
||||
read_lines(5);
|
||||
|
||||
nremain = natoms;
|
||||
// invoke read_lines() in chunks no larger than MAXSMALLINT
|
||||
|
||||
int nchunk;
|
||||
bigint nremain = natoms;
|
||||
while (nremain) {
|
||||
nchunk = MIN(nremain,MAXSMALLINT);
|
||||
read_lines(nchunk);
|
||||
nremain -= nchunk;
|
||||
}
|
||||
|
||||
read_lines(1);
|
||||
} else break;
|
||||
}
|
||||
|
||||
// found correct snapshot
|
||||
// read box size and boundary conditions
|
||||
/* ----------------------------------------------------------------------
|
||||
read remaining header info:
|
||||
return natoms
|
||||
box bounds, triclinic (inferred), fieldflag (1 if any fields not found),
|
||||
xyz flag = UNSET (not a requested field), SCALED, UNSCALED
|
||||
if fieldflag set:
|
||||
match Nfield fields to per-atom column labels
|
||||
allocate and set fieldindex = which column each field maps to
|
||||
fieldtype = X,VX,IZ etc
|
||||
fieldlabel = user-specified label or NULL if use fieldtype default
|
||||
xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu
|
||||
only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
triclinic_snap = 0;
|
||||
bigint ReadDumpNative::read_header(double box[3][3], int &triclinic,
|
||||
int fieldinfo, int nfield,
|
||||
int *fieldtype, char **fieldlabel,
|
||||
int scaledflag, int &fieldflag,
|
||||
int &xflag, int &yflag, int &zflag)
|
||||
{
|
||||
bigint natoms;
|
||||
read_lines(2);
|
||||
sscanf(line,BIGINT_FORMAT,&natoms);
|
||||
|
||||
triclinic = 0;
|
||||
box[0][2] = box[1][2] = box[2][2] = 0.0;
|
||||
read_lines(1);
|
||||
bc = &line[strlen("ITEM: BOX BOUNDS ")];
|
||||
if (bc[0] == 'x') {
|
||||
triclinic_snap = 1;
|
||||
bc = &bc[9];
|
||||
}
|
||||
|
||||
char boundstr[9];
|
||||
domain->boundary_string(boundstr);
|
||||
if (strstr(bc,boundstr) != bc)
|
||||
error->warning(FLERR,"Read_dump boundary flags do not match simulation");
|
||||
if (line[strlen("ITEM: BOX BOUNDS ")] == 'x') triclinic = 1;
|
||||
|
||||
read_lines(1);
|
||||
if (!triclinic_snap) sscanf(line,"%lg %lg",&box[0][0],&box[0][1]);
|
||||
if (!triclinic) sscanf(line,"%lg %lg",&box[0][0],&box[0][1]);
|
||||
else sscanf(line,"%lg %lg %lg",&box[0][0],&box[0][1],&box[0][2]);
|
||||
read_lines(1);
|
||||
if (!triclinic_snap) sscanf(line,"%lg %lg",&box[1][0],&box[1][1]);
|
||||
if (!triclinic) sscanf(line,"%lg %lg",&box[1][0],&box[1][1]);
|
||||
else sscanf(line,"%lg %lg %lg",&box[1][0],&box[1][1],&box[1][2]);
|
||||
read_lines(1);
|
||||
if (!triclinic_snap) sscanf(line,"%lg %lg",&box[2][0],&box[2][1]);
|
||||
if (!triclinic) sscanf(line,"%lg %lg",&box[2][0],&box[2][1]);
|
||||
else sscanf(line,"%lg %lg %lg",&box[2][0],&box[2][1],&box[2][2]);
|
||||
|
||||
// read ITEM: ATOMS line
|
||||
// labels = column labels
|
||||
|
||||
read_lines(1);
|
||||
names = &line[strlen("ITEM: ATOMS ")];
|
||||
|
||||
nwords = atom->count_words(names);
|
||||
// if no field info requested, just return
|
||||
|
||||
if (!fieldinfo) return natoms;
|
||||
|
||||
// exatract column labels and match to requested fields
|
||||
|
||||
char *labelline = &line[strlen("ITEM: ATOMS ")];
|
||||
|
||||
nwords = atom->count_words(labelline);
|
||||
char **labels = new char*[nwords];
|
||||
labels[0] = strtok(names," \t\n\r\f");
|
||||
if (labels[0] == NULL)
|
||||
error->one(FLERR,"Incorrect atom format in dump file");
|
||||
labels[0] = strtok(labelline," \t\n\r\f");
|
||||
if (labels[0] == NULL) return 1;
|
||||
for (int m = 1; m < nwords; m++) {
|
||||
labels[m] = strtok(NULL," \t\n\r\f");
|
||||
if (labels[m] == NULL)
|
||||
error->one(FLERR,"Incorrect atom format in dump file");
|
||||
if (labels[m] == NULL) return 1;
|
||||
}
|
||||
|
||||
// match each field with column
|
||||
// match each field with a column of per-atom data
|
||||
// if fieldlabel set, match with explicit column
|
||||
// else infer one or more column matches from fieldtype
|
||||
// xyz flag set by scaledflag (if fieldlabel set) or column label
|
||||
|
||||
fieldindex = new int[nfield];
|
||||
int xflag = UNSET;
|
||||
int yflag = UNSET;
|
||||
int zflag = UNSET;
|
||||
memory->create(fieldindex,nfield,"read_dump:fieldindex");
|
||||
|
||||
int s_index,u_index,su_index;
|
||||
xflag = UNSET;
|
||||
yflag = UNSET;
|
||||
zflag = UNSET;
|
||||
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (fieldlabel[i]) {
|
||||
@ -250,51 +262,29 @@ void ReadDumpNative::scan(bigint nstep,
|
||||
fieldindex[i] = find_label("iz",nwords,labels);
|
||||
}
|
||||
|
||||
// error checks
|
||||
|
||||
if ((triclinic_snap && !triclinic) ||
|
||||
(!triclinic_snap && triclinic))
|
||||
error->one(FLERR,"Read_dump triclinic setting does not match simulation");
|
||||
|
||||
for (int i = 0; i < nfield; i++)
|
||||
if (fieldindex[i] < 0)
|
||||
error->one(FLERR,"Read_dump field not found in dump file");
|
||||
|
||||
// set overall scaling of coordinates
|
||||
// error if x,y,z scaling is not the same
|
||||
|
||||
scaled = MAX(xflag,yflag);
|
||||
scaled = MAX(zflag,scaled);
|
||||
if ((xflag != UNSET && xflag != scaled) ||
|
||||
(yflag != UNSET && yflag != scaled) ||
|
||||
(zflag != UNSET && zflag != scaled))
|
||||
error->one(FLERR,"Read_dump x,y,z fields do not have consistent scaling");
|
||||
|
||||
// scaled, triclinic coords require all 3 x,y,z fields to perform unscaling
|
||||
|
||||
if (scaled == SCALED && triclinic) {
|
||||
int flag = 0;
|
||||
if (xflag != scaled) flag = 1;
|
||||
if (yflag != scaled) flag = 1;
|
||||
if (dimension == 3 && zflag != scaled) flag = 1;
|
||||
if (flag)
|
||||
error->one(FLERR,"All read_dump x,y,z fields must be specified for "
|
||||
"scaled, triclinic coords");
|
||||
}
|
||||
|
||||
delete [] labels;
|
||||
|
||||
// create vector of word ptrs for future parsing of per-atom lines
|
||||
// set fieldflag = 1 if any unfound fields
|
||||
|
||||
fieldflag = 0;
|
||||
for (int i = 0; i < nfield; i++)
|
||||
if (fieldindex[i] < 0) fieldflag = 1;
|
||||
|
||||
// create internal vector of word ptrs for future parsing of per-atom lines
|
||||
|
||||
words = new char*[nwords];
|
||||
|
||||
return natoms;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads N atom lines from dump file
|
||||
read N atom lines from dump file
|
||||
stores appropriate values in fields array
|
||||
return 0 if success, 1 if error
|
||||
only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadDumpNative::read(int n, double **fields)
|
||||
void ReadDumpNative::read_atoms(int n, int nfield, double **fields)
|
||||
{
|
||||
int i,m;
|
||||
char *eof;
|
||||
@ -329,13 +319,15 @@ int ReadDumpNative::find_label(const char *label, int n, char **labels)
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads N lines from file
|
||||
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 ReadDumpNative::read_lines(int n)
|
||||
{
|
||||
char *eof;
|
||||
for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of dump file");
|
||||
if (eof == NULL) error->all(FLERR,"Unexpected end of dump file");
|
||||
}
|
||||
|
||||
@ -26,21 +26,20 @@ class ReadDumpNative : protected Pointers {
|
||||
ReadDumpNative(class LAMMPS *);
|
||||
~ReadDumpNative();
|
||||
|
||||
void init(FILE *);
|
||||
void scan(bigint, int, int *, char **, int, bigint &, double [3][3], int &);
|
||||
void read(int, double **);
|
||||
void file(FILE *);
|
||||
int read_time(bigint &);
|
||||
void skip();
|
||||
bigint read_header(double [3][3], int &, int, int, int *, char **,
|
||||
int, int &, int &, int &, int &);
|
||||
void read_atoms(int, int, double **);
|
||||
|
||||
private:
|
||||
FILE *fp; // pointer to file opened by caller
|
||||
char *line; // line read from dump file
|
||||
int dimension;
|
||||
int triclinic;
|
||||
|
||||
int nwords; // # of per-atom columns in dump file
|
||||
char **words; // ptrs to words in parsed per-atom line
|
||||
|
||||
int nfield; // # of fields to extract for each atom
|
||||
int *fieldindex; // index into words for each field
|
||||
char **words; // ptrs to values in parsed per-atom line
|
||||
int *fieldindex; //
|
||||
|
||||
int find_label(const char *, int, char **);
|
||||
void read_lines(int);
|
||||
|
||||
@ -213,9 +213,11 @@ void Velocity::create(double t_desired, int seed)
|
||||
if (atom->natoms > MAXSMALLINT)
|
||||
error->all(FLERR,"Too big a problem to use velocity create loop all");
|
||||
if (atom->tag_enable == 0)
|
||||
error->all(FLERR,"Cannot use velocity create loop all unless atoms have IDs");
|
||||
error->all(FLERR,
|
||||
"Cannot use velocity create loop all unless atoms have IDs");
|
||||
if (atom->tag_consecutive() == 0)
|
||||
error->all(FLERR,"Atom IDs must be consecutive for velocity create loop all");
|
||||
error->all(FLERR,
|
||||
"Atom IDs must be consecutive for velocity create loop all");
|
||||
|
||||
// loop over all atoms in system
|
||||
// generate RNGs for all atoms, only assign to ones I own
|
||||
@ -397,21 +399,24 @@ void Velocity::set(int narg, char **arg)
|
||||
|
||||
if (xstr) {
|
||||
xvar = input->variable->find(xstr);
|
||||
if (xvar < 0) error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (xvar < 0)
|
||||
error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (input->variable->equalstyle(xvar)) xstyle = EQUAL;
|
||||
else if (input->variable->atomstyle(xvar)) xstyle = ATOM;
|
||||
else error->all(FLERR,"Variable for velocity set is invalid style");
|
||||
}
|
||||
if (ystr) {
|
||||
yvar = input->variable->find(ystr);
|
||||
if (yvar < 0) error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (yvar < 0)
|
||||
error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (input->variable->equalstyle(yvar)) ystyle = EQUAL;
|
||||
else if (input->variable->atomstyle(yvar)) ystyle = ATOM;
|
||||
else error->all(FLERR,"Variable for velocity set is invalid style");
|
||||
}
|
||||
if (zstr) {
|
||||
zvar = input->variable->find(zstr);
|
||||
if (zvar < 0) error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (zvar < 0)
|
||||
error->all(FLERR,"Variable name for velocity set does not exist");
|
||||
if (input->variable->equalstyle(zvar)) zstyle = EQUAL;
|
||||
else if (input->variable->atomstyle(zvar)) zstyle = ATOM;
|
||||
else error->all(FLERR,"Variable for velocity set is invalid style");
|
||||
@ -776,7 +781,8 @@ void Velocity::options(int narg, char **arg)
|
||||
error->all(FLERR,"Could not find velocity temperature ID");
|
||||
temperature = modify->compute[icompute];
|
||||
if (temperature->tempflag == 0)
|
||||
error->all(FLERR,"Velocity temperature ID does not compute temperature");
|
||||
error->all(FLERR,
|
||||
"Velocity temperature ID does not compute temperature");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"loop") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||
|
||||
Reference in New Issue
Block a user