void UnplacedTorus::Print() const { printf("UnplacedTorus {%.2f, %.2f, %.2f, %.2f, %.2f}", rmin(), rmax(), rtor(), sphi(), dphi() ); }
void UnplacedTorus::Print(std::ostream &os) const { os << "UnplacedTorus {" << rmin() << ", " << rmax() << ", " << rtor() << ", " << sphi() << ", " << dphi(); }
/** reimplement simple table format used by NonLocalPPotential */ void ECPotentialBuilder::useSimpleTableFormat() { SpeciesSet& Species(IonConfig.getSpeciesSet()); int ng(Species.getTotalNum()); int icharge(Species.addAttribute("charge")); for(int ig=0; ig<ng;ig++) { vector<RealType> grid_temp, pp_temp; string species(Species.speciesName[ig]); string fname = species+".psf"; ifstream fin(fname.c_str(),ios_base::in); if(!fin){ ERRORMSG("Could not open file " << fname) exit(-1); } // Read Number of potentials (local and non) for this atom int npotentials; fin >> npotentials; RealType r, f1; int lmax=-1; int numnonloc=0; RealType rmax(0.0); app_log() << " ECPotential for " << species << endl; NonLocalECPComponent* mynnloc=0; typedef OneDimCubicSpline<RealType> CubicSplineFuncType; for (int ij=0; ij<npotentials; ij++){ int angmom,npoints; fin >> angmom >> npoints; OneDimNumGridFunctor<RealType> inFunc; inFunc.put(npoints,fin); if(angmom < 0) {//local potential, input is rescale by -r/z RealType zinv=-1.0/Species(icharge,ig); int ng=npoints-1; RealType rf=5.0; ng=static_cast<int>(rf*100)+1;//use 1e-2 resolution GridType * agrid= new LinearGrid<RealType>; agrid->set(0,rf,ng); vector<RealType> pp_temp(ng); pp_temp[0]=0.0; for (int j=1; j<ng; j++){ RealType r((*agrid)[j]); pp_temp[j]=r*zinv*inFunc.splint(r); } pp_temp[ng-1]=1.0; RadialPotentialType *app = new RadialPotentialType(agrid,pp_temp); app->spline(); localPot[ig]=app; app_log() << " LocalECP l=" << angmom << endl; app_log() << " Linear grid=[0," << rf << "] npts=" << ng << endl; hasLocalPot=true; //will create LocalECPotential } else { hasNonLocalPot=true; //will create NonLocalECPotential if(mynnloc == 0) mynnloc = new NonLocalECPComponent; RealType rf=inFunc.rmax(); GridType * agrid= new LinearGrid<RealType>; int ng=static_cast<int>(rf*100)+1; agrid->set(0.0,rf,ng); app_log() << " NonLocalECP l=" << angmom << " rmax = " << rf << endl; app_log() << " Linear grid=[0," << rf << "] npts=" << ng << endl; vector<RealType> pp_temp(ng); //get the value pp_temp[0]=inFunc(0); for (int j=1; j<ng; j++){ pp_temp[j]=inFunc.splint((*agrid)[j]); } RadialPotentialType *app = new RadialPotentialType(agrid,pp_temp); app->spline(); mynnloc->add(angmom,app); lmax=std::max(lmax,angmom); rmax=std::max(rmax,rf); numnonloc++; } if(mynnloc) { mynnloc->lmax=lmax; mynnloc->Rmax=rmax; app_log() << " Maximum cutoff of NonLocalECP " << rmax << endl; } } fin.close(); if(mynnloc) { nonLocalPot[ig]=mynnloc; int numsgridpts=0; string fname = species+".sgr"; ifstream fin(fname.c_str(),ios_base::in); if(!fin){ app_error() << "Could not open file " << fname << endl; exit(-1); } PosType xyz; RealType weight; while(fin >> xyz >> weight){ mynnloc->addknot(xyz,weight); numsgridpts++; } //cout << "Spherical grid : " << numsgridpts << " points" <<endl; mynnloc->resize_warrays(numsgridpts,numnonloc,lmax); } }//species }