From 862c60c406ab8edcd65d5d0e54cc01d3327323ff Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Mon, 2 Oct 2023 09:36:25 -0400 Subject: [PATCH] Rename 'rs' to 'rmapping' in pyEXP and EXP --- coefs/BasisFactory.H | 2 +- coefs/BasisFactory.cc | 12 ++-- exputil/SLGridMP2.cc | 136 +++++++++++++++++++++--------------------- include/SLGridMP2.H | 14 ++--- src/Sphere.H | 6 +- src/Sphere.cc | 9 +-- 6 files changed, 90 insertions(+), 89 deletions(-) diff --git a/coefs/BasisFactory.H b/coefs/BasisFactory.H index 8ff10bd86..17a88c1be 100644 --- a/coefs/BasisFactory.H +++ b/coefs/BasisFactory.H @@ -204,7 +204,7 @@ namespace BasisClasses std::string model_file; int lmax, nmax, cmap, numr; - double rmin, rmax; + double rmin, rmax, rmap; bool NO_L0, NO_L1, EVEN_L, EVEN_M, M0_only; diff --git a/coefs/BasisFactory.cc b/coefs/BasisFactory.cc index 120223711..48bb5817f 100644 --- a/coefs/BasisFactory.cc +++ b/coefs/BasisFactory.cc @@ -93,7 +93,7 @@ namespace BasisClasses const std::set SphericalSL::valid_keys = { - "rs", + "rmapping", "cmap", "Lmax", "dof", @@ -173,7 +173,7 @@ namespace BasisClasses // Assign values from YAML // - double rs = 1.0; + double rmap = 1.0; try { if (conf["cmap"]) cmap = conf["cmap"].as(); @@ -181,10 +181,10 @@ namespace BasisClasses if (conf["nmax"]) nmax = conf["nmax"].as(); if (conf["modelname"]) model_file = conf["modelname"].as(); - if (conf["rs"]) - rs = conf["rs"].as(); + if (conf["rmapping"]) + rmap = conf["rmapping"].as(); else - rs = 1.0; + rmap = 1.0; if (conf["scale"]) scale = conf["scale"].as(); @@ -258,7 +258,7 @@ namespace BasisClasses // Finally, make the Sturm-Lioville basis... sl = std::make_shared - (model_file, lmax, nmax, numr, rmin, rmax, true, cmap, rs, + (model_file, lmax, nmax, numr, rmin, rmax, true, cmap, rmap, 0, 1, cachename); // Test basis for consistency diff --git a/exputil/SLGridMP2.cc b/exputil/SLGridMP2.cc index 41adae9d3..37ed197f9 100644 --- a/exputil/SLGridMP2.cc +++ b/exputil/SLGridMP2.cc @@ -201,7 +201,7 @@ void SLGridCyl::bomb(std::string oops) SLGridCyl::SLGridCyl(int MMAX, int NMAX, int NUMR, int NUMK, double RMIN, double RMAX, double L, - bool CACHE, int CMAP, double RS, + bool CACHE, int CMAP, double RMAP, const std::string type, bool VERBOSE) { int m, k; @@ -217,7 +217,7 @@ SLGridCyl::SLGridCyl(int MMAX, int NMAX, int NUMR, int NUMK, cache = CACHE; cmap = CMAP; - rs = RS; + rmap = RMAP; tbdbg = VERBOSE; @@ -458,7 +458,7 @@ int SLGridCyl::read_cached_table(void) if (!in) return 0; int MMAX, NMAX, NUMR, NUMK, i, j, CMAP; - double RMIN, RMAX, L, AA, RS; + double RMIN, RMAX, L, AA, RMAP; std::string MODEL; if (myid==0) @@ -498,17 +498,17 @@ int SLGridCyl::read_cached_table(void) // Get parameters // - MMAX = node["mmax" ].as(); - NMAX = node["nmax" ].as(); - NUMK = node["numk" ].as(); - NUMR = node["numr" ].as(); - CMAP = node["cmap" ].as(); - RMIN = node["rmin" ].as(); - RMAX = node["rmax" ].as(); - RS = node["rs" ].as(); - L = node["L" ].as(); - AA = node["A" ].as(); - MODEL = node["model" ].as(); + MMAX = node["mmax" ].as(); + NMAX = node["nmax" ].as(); + NUMK = node["numk" ].as(); + NUMR = node["numr" ].as(); + CMAP = node["cmap" ].as(); + RMIN = node["rmin" ].as(); + RMAX = node["rmax" ].as(); + RMAP = node["rmapping"].as(); + L = node["L" ].as(); + AA = node["A" ].as(); + MODEL = node["model" ].as(); } else { std::cout << "---- SLGridCyl: bad magic number in cache file" << std::endl; return 0; @@ -564,10 +564,10 @@ int SLGridCyl::read_cached_table(void) return 0; } - if (RS!=rs) { + if (RMAP!=rmap) { if (myid==0) - std::cout << "---- SLGridCyl::read_cached_table: found rs=" << RS - << " wanted " << rs << std::endl; + std::cout << "---- SLGridCyl::read_cached_table: found rmapping=" << RMAP + << " wanted " << rmap << std::endl; return 0; } @@ -640,17 +640,17 @@ void SLGridCyl::write_cached_table(void) // content can be added as needed. YAML::Node node; - node["mmax" ] = mmax; - node["nmax" ] = nmax; - node["numk" ] = numk; - node["numr" ] = numr; - node["cmap" ] = cmap; - node["rmin" ] = rmin; - node["rmax" ] = rmax; - node["rs" ] = rs; - node["L" ] = l; - node["A" ] = A; - node["model" ] = cyl->ID(); + node["mmax" ] = mmax; + node["nmax" ] = nmax; + node["numk" ] = numk; + node["numr" ] = numr; + node["cmap" ] = cmap; + node["rmin" ] = rmin; + node["rmax" ] = rmax; + node["rmapping"] = rmap; + node["L" ] = l; + node["A" ] = A; + node["model" ] = cyl->ID(); // Serialize the node // @@ -714,7 +714,7 @@ double SLGridCyl::r_to_xi(double r) } if (cmap) { - return (r/rs-1.0)/(r/rs+1.0); + return (r/rmap-1.0)/(r/rmap+1.0); } else { return r; } @@ -735,7 +735,7 @@ double SLGridCyl::xi_to_r(double xi) bomb(ostr.str()); } - return (1.0+xi)/(1.0 - xi) * rs; + return (1.0+xi)/(1.0 - xi) * rmap; } else { return xi; } @@ -757,7 +757,7 @@ double SLGridCyl::d_xi_to_r(double xi) bomb(ostr.str()); } - return 0.5*(1.0-xi)*(1.0-xi)/rs; + return 0.5*(1.0-xi)*(1.0-xi)/rmap; } else { return 1.0; } @@ -1267,9 +1267,9 @@ void SLGridCyl::compute_table(struct TableCyl* table, int m, int k) { double cons[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double tol[6] = {1.0e-4*rs,1.0e-5, - 1.0e-4*rs,1.0e-5, - 1.0e-4*rs,1.0e-5}; + double tol[6] = {1.0e-4*rmap,1.0e-5, + 1.0e-4*rmap,1.0e-5, + 1.0e-4*rmap,1.0e-5}; int VERBOSE=0; integer NUM, N, M; logical type[8]; @@ -1472,8 +1472,8 @@ void SLGridCyl::init_table(void) d0.resize(numr); if (cmap) { - xmin = (rmin/rs - 1.0)/(rmin/rs + 1.0); - xmax = (rmax/rs - 1.0)/(rmax/rs + 1.0); + xmin = (rmin/rmap - 1.0)/(rmin/rmap + 1.0); + xmax = (rmax/rmap - 1.0)/(rmax/rmap + 1.0); dxi = (xmax-xmin)/(numr-1); } else { xmin = rmin; @@ -1495,9 +1495,9 @@ void SLGridCyl::compute_table_worker(void) { double cons[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double tol[6] = {1.0e-4*rs,1.0e-5, - 1.0e-4*rs,1.0e-5, - 1.0e-4*rs,1.0e-5}; + double tol[6] = {1.0e-4*rmap,1.0e-5, + 1.0e-4*rmap,1.0e-5, + 1.0e-4*rmap,1.0e-5}; int i, j, VERBOSE=0; integer NUM; logical type[8]; @@ -1876,7 +1876,7 @@ void SLGridSph::bomb(string oops) SLGridSph::SLGridSph(std::string modelname, int LMAX, int NMAX, int NUMR, double RMIN, double RMAX, - bool CACHE, int CMAP, double RS, + bool CACHE, int CMAP, double RMAP, int DIVERGE, double DFAC, std::string cachename, bool VERBOSE) { @@ -1892,12 +1892,12 @@ SLGridSph::SLGridSph(std::string modelname, diverge = DIVERGE; dfac = DFAC; - initialize(LMAX, NMAX, NUMR, RMIN, RMAX, CACHE, CMAP, RS); + initialize(LMAX, NMAX, NUMR, RMIN, RMAX, CACHE, CMAP, RMAP); } SLGridSph::SLGridSph(std::shared_ptr mod, int LMAX, int NMAX, int NUMR, double RMIN, double RMAX, - bool CACHE, int CMAP, double RS, + bool CACHE, int CMAP, double RMAP, std::string cachename, bool VERBOSE) { mpi_buf = 0; @@ -1909,7 +1909,7 @@ SLGridSph::SLGridSph(std::shared_ptr mod, if (cachename.size()) sph_cache_name = cachename; else sph_cache_name = default_cache; - initialize(LMAX, NMAX, NUMR, RMIN, RMAX, CACHE, CMAP, RS); + initialize(LMAX, NMAX, NUMR, RMIN, RMAX, CACHE, CMAP, RMAP); } @@ -1939,7 +1939,7 @@ SLGridSph::cacheInfo(const std::string& cachefile, bool verbose) void SLGridSph::initialize(int LMAX, int NMAX, int NUMR, double RMIN, double RMAX, - bool CACHE, int CMAP, double RS) + bool CACHE, int CMAP, double RMAP) { int l; @@ -1952,7 +1952,7 @@ void SLGridSph::initialize(int LMAX, int NMAX, int NUMR, cache = CACHE; cmap = CMAP; - rs = RS; + rmap = RMAP; init_table(); @@ -2258,7 +2258,7 @@ bool SLGridSph::ReadH5Cache(void) if (not checkInt(cmap, "cmap")) return false; if (not checkDbl(rmin, "rmin")) return false; if (not checkDbl(rmax, "rmax")) return false; - if (not checkDbl(rs, "rs")) return false; + if (not checkDbl(rmap, "rmapping")) return false; if (not checkInt(diverge, "diverge")) return false; if (not checkDbl(dfac, "dfac")) return false; @@ -2349,7 +2349,7 @@ void SLGridSph::WriteH5Cache(void) file.createAttribute ("cmap", HighFive::DataSpace::From(cmap)).write(cmap); file.createAttribute ("rmin", HighFive::DataSpace::From(rmin)).write(rmin); file.createAttribute ("rmax", HighFive::DataSpace::From(rmax)).write(rmax); - file.createAttribute ("rs", HighFive::DataSpace::From(rs)).write(rs); + file.createAttribute ("rmapping", HighFive::DataSpace::From(rmap)).write(rmap); file.createAttribute ("diverge", HighFive::DataSpace::From(diverge)).write(diverge); file.createAttribute ("dfac", HighFive::DataSpace::From(dfac)).write(dfac); @@ -2391,7 +2391,7 @@ double SLGridSph::r_to_xi(double r) if (cmap==1) { if (r<0.0) bomb("radius < 0!"); - ret = (r/rs-1.0)/(r/rs+1.0); + ret = (r/rmap-1.0)/(r/rmap+1.0); } else if (cmap==2) { if (r<=0.0) bomb("radius <= 0!"); ret = log(r); @@ -2410,7 +2410,7 @@ double SLGridSph::xi_to_r(double xi) if (xi<-1.0) bomb("xi < -1!"); if (xi>=1.0) bomb("xi >= 1!"); - ret =(1.0+xi)/(1.0 - xi) * rs; + ret =(1.0+xi)/(1.0 - xi) * rmap; } else if (cmap==2) { ret = exp(xi); } else { @@ -2430,7 +2430,7 @@ double SLGridSph::d_xi_to_r(double xi) if (xi<-1.0) bomb("xi < -1!"); if (xi>=1.0) bomb("xi >= 1!"); - ret = 0.5*(1.0-xi)*(1.0-xi)/rs; + ret = 0.5*(1.0-xi)*(1.0-xi)/rmap; } else if (cmap==2) { ret = exp(-xi); } else { @@ -2781,9 +2781,9 @@ void SLGridSph::compute_table(struct TableSph* table, int l) { double cons[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double tol [6] = {1.0e-4*rs, 1.0e-6, - 1.0e-4*rs, 1.0e-6, - 1.0e-4*rs, 1.0e-6}; + double tol [6] = {1.0e-4*rmap, 1.0e-6, + 1.0e-4*rmap, 1.0e-6, + 1.0e-4*rmap, 1.0e-6}; int VERBOSE=0; integer NUM, N; logical type[8] = {0, 0, 1, 0, 0, 0, 1, 0}; @@ -2992,8 +2992,8 @@ void SLGridSph::init_table(void) d0.resize(numr); if (cmap==1) { - xmin = (rmin/rs - 1.0)/(rmin/rs + 1.0); - xmax = (rmax/rs - 1.0)/(rmax/rs + 1.0); + xmin = (rmin/rmap - 1.0)/(rmin/rmap + 1.0); + xmax = (rmax/rmap - 1.0)/(rmax/rmap + 1.0); } else if (cmap==2) { xmin = log(rmin); @@ -3018,9 +3018,9 @@ void SLGridSph::compute_table_worker(void) { double cons[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double tol [6] = {1.0e-1*rs, 1.0e-6, - 1.0e-1*rs, 1.0e-6, - 1.0e-1*rs, 1.0e-6}; + double tol [6] = {1.0e-1*rmap, 1.0e-6, + 1.0e-1*rmap, 1.0e-6, + 1.0e-1*rmap, 1.0e-6}; int VERBOSE=0; integer NUM; @@ -3360,16 +3360,16 @@ YAML::Node SLGridSph::getHeader(const std::string& cachefile) return v; }; - node["model"] = getStr("model"); - node["lmax"] = getInt("lmax"); - node["nmax"] = getInt("nmax"); - node["numr"] = getInt("numr"); - node["cmap"] = getInt("cmap"); - node["rmin"] = getDbl("rmin"); - node["rmax"] = getDbl("rmax"); - node["rs" ] = getDbl("rs"); - node["diverge"] = getInt("diverge"); - node["dfac"] = getDbl("dfac"); + node["model"] = getStr("model"); + node["lmax"] = getInt("lmax"); + node["nmax"] = getInt("nmax"); + node["numr"] = getInt("numr"); + node["cmap"] = getInt("cmap"); + node["rmin"] = getDbl("rmin"); + node["rmax"] = getDbl("rmax"); + node["rmapping"] = getDbl("rmapping"); + node["diverge"] = getInt("diverge"); + node["dfac"] = getDbl("dfac"); } catch (YAML::Exception& error) { std::ostringstream sout; diff --git a/include/SLGridMP2.H b/include/SLGridMP2.H index 1967fc415..2a04a4c44 100644 --- a/include/SLGridMP2.H +++ b/include/SLGridMP2.H @@ -58,7 +58,7 @@ private: double rmin, rmax, l; int cmap; - double rs; + double rmap; double dk; @@ -108,7 +108,7 @@ public: //! Constructor SLGridCyl(int mmax, int nmax, int numr, int numk, double rmin, double rmax, - double l, bool cache, int Cmap, double RS, + double l, bool cache, int Cmap, double RMAP, const std::string type, bool Verbose=false); //! Destructor @@ -180,7 +180,7 @@ private: double rmin, rmax; int cmap, diverge; - double rs, dfac; + double rmap, dfac; double xmin, xmax, dxi; @@ -193,7 +193,7 @@ private: void initialize(int LMAX, int NMAX, int NUMR, double RMIN, double RMAX, - bool CACHE, int CMAP, double RS); + bool CACHE, int CMAP, double RMAP); void init_table(void); void compute_table(TableSph* table, int L); @@ -248,14 +248,14 @@ public: //! Constructor with model table SLGridSph(std::shared_ptr mod, int lmax, int nmax, int numr, double rmin, double rmax, - bool cache, int Cmap, double RS, + bool cache, int Cmap, double RMAP, std::string cachename="", bool Verbose=false); //! Constructor (uses file *model_file_name* for file) SLGridSph(std::string modelname, int lmax, int nmax, int numr, double rmin, double rmax, - bool cache, int Cmap, double RS, + bool cache, int Cmap, double RMAP, int DIVERGE, double DFAC, std::string cachename="", bool Verbose=false); @@ -315,7 +315,7 @@ public: { cudaMappingConstants ret; - ret.rscale = rs; + ret.rscale = rmap; ret.hscale = 0.0; ret.xmin = xmin; ret.xmax = xmax; diff --git a/src/Sphere.H b/src/Sphere.H index e6ade7f32..1178b996b 100644 --- a/src/Sphere.H +++ b/src/Sphere.H @@ -19,7 +19,7 @@ typedef std::shared_ptr SLGridSphPtr; \param rmin is the minimum value in the table for the radial basis functions (default is 0.001) - \param rs is the halo scale length (default is 0.067*rmax). This + \param rmapping is the halo scale length (default is 0.067*rmax). This is used to for the coordinate mapping (see below). \param cmap should be 1 for algebraic coordinate scaling, 2 for log @@ -88,7 +88,7 @@ private: // Parameters double rsphSL; - double rs; + double rmap; double tnext, dtime; int numr; int nums; @@ -120,7 +120,7 @@ public: @param m allows the spherical basis to be used for multiple center expansions Input line parameters include: - @param rs is the radius for coordinate scaling + @param rmapping is the radius for coordinate scaling @param numr is the number of radial grid points @param cmap set to true for scaling coordinates from the semi-infinite to finite segment @param diverge set to true means assume a cuspy profile diff --git a/src/Sphere.cc b/src/Sphere.cc index e672f9b69..51ffe5fa1 100644 --- a/src/Sphere.cc +++ b/src/Sphere.cc @@ -11,7 +11,7 @@ const std::set Sphere::valid_keys = { - "rs", + "rmapping", "numr", "nums", "cmap", @@ -29,7 +29,7 @@ Sphere::Sphere(Component* c0, const YAML::Node& conf, MixtureBasis* m) : { id = "Sphere SL"; // Defaults - rs = 0.067*rmax; + rmap = 0.067*rmax; numr = 2000; nums = 2000; cmap = 1; @@ -61,7 +61,7 @@ Sphere::Sphere(Component* c0, const YAML::Node& conf, MixtureBasis* m) : // Generate Sturm-Liouville grid ortho = std::make_shared(modelname, Lmax, nmax, numr, rmin, rmax, true, - cmap, rs, diverge, dfac, cachename); + cmap, rmap, diverge, dfac, cachename); // Get the min and max expansion radii rmin = ortho->getRmin(); @@ -72,6 +72,7 @@ Sphere::Sphere(Component* c0, const YAML::Node& conf, MixtureBasis* m) : std::cout << "---- Sphere parameters: " << std::endl << sep << "lmax=" << Lmax << std::endl << sep << "nmax=" << nmax + << std::endl << sep << "rmapping=" << rmap << std::endl << sep << "cmap=" << cmap << std::endl << sep << "rmin=" << rmin << std::endl << sep << "rmax=" << rmax @@ -105,7 +106,7 @@ void Sphere::initialize() // Assign values from YAML // try { - if (conf["rs"]) rs = conf["rs"].as(); + if (conf["rmapping"]) rmap = conf["rmapping"].as(); if (conf["numr"]) numr = conf["numr"].as(); if (conf["nums"]) nums = conf["nums"].as(); if (conf["cmap"]) cmap = conf["cmap"].as();