| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1864952 commit edcaf9d
21 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,13 @@ | |||
| 1 | 1 | # Change Log | |
| 2 | 2 | ||
| 3 | + ## [Unreleased] | ||
| 4 | + | ||
| 5 | + ### Changed | ||
| 6 | + | ||
| 7 | + - `Factory` is no longer implemented as a Singleton. | ||
| 8 | + - Revert to use [Robust Cholesky decomposition](https://eigen.tuxfamily.org/dox/classEigen_1_1LDLT.html) | ||
| 9 | + to compute the inverse of the S matrix in `CPCMSolver`. | ||
| 10 | + | ||
| 3 | 11 | ## [Version 1.1.8] - 2017-02-06 | |
| 4 | 12 | ||
| 5 | 13 | ### Added | |
@@ -288,7 +296,8 @@ | |||
| 288 | 296 | ||
| 289 | 297 | ## v1.0.0 - 2014-09-30 [YANKED] | |
| 290 | 298 | ||
| 291 | - [Unreleased]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.7...HEAD | ||
| 299 | + [Unreleased]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.8...HEAD | ||
| 300 | + [Version 1.1.8]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.7...v1.1.8 | ||
| 292 | 301 | [Version 1.1.7]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.6...v1.1.7 | |
| 293 | 302 | [Version 1.1.6]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.5...v1.1.6 | |
| 294 | 303 | [Version 1.1.5]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.4...v1.1.5 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,24 +60,25 @@ inline IBoundaryIntegralOperator * createPurisima(const BIOperatorData & data) { | |||
| 60 | 60 | return new Purisima(data.scaling); | |
| 61 | 61 | } | |
| 62 | 62 | ||
| 63 | - inline void bootstrapFactory() { | ||
| 63 | + inline Factory<IBoundaryIntegralOperator, BIOperatorData> bootstrapFactory() { | ||
| 64 | + Factory<IBoundaryIntegralOperator, BIOperatorData> factory_; | ||
| 65 | + | ||
| 64 | 66 | const bool registeredCollocation = | |
| 65 | - Factory<IBoundaryIntegralOperator, BIOperatorData>::TheFactory() | ||
| 66 | - .registerObject("COLLOCATION", createCollocation); | ||
| 67 | + factory_.registerObject("COLLOCATION", createCollocation); | ||
| 67 | 68 | if (!registeredCollocation) | |
| 68 | 69 | PCMSOLVER_ERROR("Subscription of collocation integrator to factory failed!"); | |
| 69 | 70 | ||
| 70 | 71 | const bool registeredNumerical = | |
| 71 | - Factory<IBoundaryIntegralOperator, BIOperatorData>::TheFactory() | ||
| 72 | - .registerObject("NUMERICAL", createNumerical); | ||
| 72 | + factory_.registerObject("NUMERICAL", createNumerical); | ||
| 73 | 73 | if (!registeredNumerical) | |
| 74 | 74 | PCMSOLVER_ERROR("Subscription of numerical integrator to factory failed!"); | |
| 75 | 75 | ||
| 76 | 76 | const bool registeredPurisima = | |
| 77 | - Factory<IBoundaryIntegralOperator, BIOperatorData>::TheFactory() | ||
| 78 | - .registerObject("PURISIMA", createPurisima); | ||
| 77 | + factory_.registerObject("PURISIMA", createPurisima); | ||
| 79 | 78 | if (!registeredPurisima) | |
| 80 | 79 | PCMSOLVER_ERROR("Subscription of Purisima integrator to factory failed!"); | |
| 80 | + | ||
| 81 | + return factory_; | ||
| 81 | 82 | } | |
| 82 | 83 | } // namespace bi_operators | |
| 83 | 84 | } // namespace pcm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,18 +53,19 @@ inline ICavity * createRestartCavity(const CavityData & data) { | |||
| 53 | 53 | return new RestartCavity(data.filename); | |
| 54 | 54 | } | |
| 55 | 55 | ||
| 56 | - inline void bootstrapFactory() { | ||
| 57 | - const bool registeredGePol = | ||
| 58 | - Factory<ICavity, CavityData>::TheFactory().registerObject("GEPOL", | ||
| 59 | - createGePolCavity); | ||
| 56 | + inline Factory<ICavity, CavityData> bootstrapFactory() { | ||
| 57 | + Factory<ICavity, CavityData> factory_; | ||
| 58 | + | ||
| 59 | + const bool registeredGePol = factory_.registerObject("GEPOL", createGePolCavity); | ||
| 60 | 60 | if (!registeredGePol) | |
| 61 | 61 | PCMSOLVER_ERROR("Subscription of GePol cavity to factory failed!"); | |
| 62 | 62 | ||
| 63 | 63 | const bool registeredRestart = | |
| 64 | - Factory<ICavity, CavityData>::TheFactory().registerObject("RESTART", | ||
| 65 | - createRestartCavity); | ||
| 64 | + factory_.registerObject("RESTART", createRestartCavity); | ||
| 66 | 65 | if (!registeredRestart) | |
| 67 | 66 | PCMSOLVER_ERROR("Subscription of restart cavity to factory failed!"); | |
| 67 | + | ||
| 68 | + return factory_; | ||
| 68 | 69 | } | |
| 69 | 70 | } // namespace cavity | |
| 70 | 71 | } // namespace pcm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,40 +74,38 @@ inline IGreensFunction * createSphericalDiffuse(const GreenData & data) { | |||
| 74 | 74 | build, data, data.howProfile); | |
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | - inline void bootstrapFactory() { | ||
| 78 | - const bool registeredVacuum = | ||
| 79 | - Factory<IGreensFunction, GreenData>::TheFactory().registerObject("VACUUM", | ||
| 80 | - createVacuum); | ||
| 77 | + inline Factory<IGreensFunction, GreenData> bootstrapFactory() { | ||
| 78 | + Factory<IGreensFunction, GreenData> factory_; | ||
| 79 | + | ||
| 80 | + const bool registeredVacuum = factory_.registerObject("VACUUM", createVacuum); | ||
| 81 | 81 | if (!registeredVacuum) | |
| 82 | 82 | PCMSOLVER_ERROR("Subscription of vacuum Green's function to factory failed!"); | |
| 83 | 83 | ||
| 84 | 84 | const bool registeredUniformDielectric = | |
| 85 | - Factory<IGreensFunction, GreenData>::TheFactory().registerObject( | ||
| 86 | - "UNIFORMDIELECTRIC", createUniformDielectric); | ||
| 85 | + factory_.registerObject("UNIFORMDIELECTRIC", createUniformDielectric); | ||
| 87 | 86 | if (!registeredUniformDielectric) | |
| 88 | 87 | PCMSOLVER_ERROR( | |
| 89 | 88 | "Subscription of uniform dielectric Green's function to factory failed!"); | |
| 90 | 89 | ||
| 91 | 90 | const bool registeredSphericalDiffuse = | |
| 92 | - Factory<IGreensFunction, GreenData>::TheFactory().registerObject( | ||
| 93 | - "SPHERICALDIFFUSE", createSphericalDiffuse); | ||
| 91 | + factory_.registerObject("SPHERICALDIFFUSE", createSphericalDiffuse); | ||
| 94 | 92 | if (!registeredSphericalDiffuse) | |
| 95 | 93 | PCMSOLVER_ERROR( | |
| 96 | 94 | "Subscription of spherical diffuse Green's function to factory failed!"); | |
| 97 | 95 | ||
| 98 | 96 | const bool registeredIonicLiquid = | |
| 99 | - Factory<IGreensFunction, GreenData>::TheFactory().registerObject( | ||
| 100 | - "IONICLIQUID", createIonicLiquid); | ||
| 97 | + factory_.registerObject("IONICLIQUID", createIonicLiquid); | ||
| 101 | 98 | if (!registeredIonicLiquid) | |
| 102 | 99 | PCMSOLVER_ERROR( | |
| 103 | 100 | "Subscription of ionic liquid Green's function to factory failed!"); | |
| 104 | 101 | ||
| 105 | 102 | const bool registeredAnisotropicLiquid = | |
| 106 | - Factory<IGreensFunction, GreenData>::TheFactory().registerObject( | ||
| 107 | - "ANISOTROPICLIQUID", createAnisotropicLiquid); | ||
| 103 | + factory_.registerObject("ANISOTROPICLIQUID", createAnisotropicLiquid); | ||
| 108 | 104 | if (!registeredAnisotropicLiquid) | |
| 109 | 105 | PCMSOLVER_ERROR( | |
| 110 | 106 | "Subscription of anisotropic liquid Green's function to factory failed!"); | |
| 107 | + | ||
| 108 | + return factory_; | ||
| 111 | 109 | } | |
| 112 | 110 | } // namespace green | |
| 113 | 111 | } // namespace pcm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -270,16 +270,8 @@ void Input::initMolecule() { | |||
| 270 | 270 | std::vector<Atom> radiiSet; | |
| 271 | 271 | std::vector<Atom> atoms; | |
| 272 | 272 | atoms.reserve(nuclei); | |
| 273 | - // FIXME This was globally bootstrapped... | ||
| 274 | - using utils::Factory; | ||
| 275 | - radiiSet = Factory::TheFactory().create(radiiSet_); | ||
| 276 | - if (radiiSet_ == "UFF") { | ||
| 277 | - radiiSetName_ = "UFF"; | ||
| 278 | - } else if (radiiSet_ == "BONDI") { | ||
| 279 | - radiiSetName_ = "Bondi-Mantina"; | ||
| 280 | - } else { | ||
| 281 | - radiiSetName_ = "Allinger's MM3"; | ||
| 282 | - } | ||
| 273 | + // FIXME Code duplication in function initMolecule in interface/Meddle.cpp | ||
| 274 | + tie(radiiSetName_, radiiSet) = utils::bootstrapRadiiSet().create(radiiSet_); | ||
| 283 | 275 | for (int i = 0; i < charges.size(); ++i) { | |
| 284 | 276 | int index = int(charges(i)) - 1; | |
| 285 | 277 | atoms.push_back(radiiSet[index]); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -191,7 +191,6 @@ Printer hostWriter; | |||
| 191 | 191 | ||
| 192 | 192 | Meddle::Meddle(const std::string & inputFileName, const HostWriter & write) | |
| 193 | 193 | : input_(Input(inputFileName)), hasDynamic_(false) { | |
| 194 | - bootstrap(); | ||
| 195 | 194 | input_.initMolecule(); | |
| 196 | 195 | hostWriter.writer_ = write; | |
| 197 | 196 | infoStream_ << std::endl; | |
@@ -226,7 +225,6 @@ Meddle::Meddle(pcmsolver_reader_t input_reading, | |||
| 226 | 225 | const PCMInput & host_input, | |
| 227 | 226 | const HostWriter & write) | |
| 228 | 227 | : hasDynamic_(false) { | |
| 229 | - bootstrap(); | ||
| 230 | 228 | hostWriter.writer_ = write; | |
| 231 | 229 | TIMER_ON("Meddle::initInput"); | |
| 232 | 230 | initInput( | |
@@ -454,8 +452,8 @@ void Meddle::initInput(pcmsolver_reader_t input_reading, | |||
| 454 | 452 | } | |
| 455 | 453 | ||
| 456 | 454 | void Meddle::initCavity() { | |
| 457 | - cavity_ = Factory<ICavity, CavityData>::TheFactory().create(input_.cavityType(), | ||
| 458 | - input_.cavityParams()); | ||
| 455 | + cavity_ = | ||
| 456 | + cavity::bootstrapFactory().create(input_.cavityType(), input_.cavityParams()); | ||
| 459 | 457 | cavity_->saveCavity(); | |
| 460 | 458 | ||
| 461 | 459 | infoStream_ << "========== Cavity " << std::endl; | |
@@ -464,16 +462,16 @@ void Meddle::initCavity() { | |||
| 464 | 462 | } | |
| 465 | 463 | ||
| 466 | 464 | void Meddle::initStaticSolver() { | |
| 467 | - IGreensFunction * gf_i = Factory<IGreensFunction, GreenData>::TheFactory().create( | ||
| 465 | + IGreensFunction * gf_i = green::bootstrapFactory().create( | ||
| 468 | 466 | input_.greenInsideType(), input_.insideGreenParams()); | |
| 469 | - IGreensFunction * gf_o = Factory<IGreensFunction, GreenData>::TheFactory().create( | ||
| 467 | + IGreensFunction * gf_o = green::bootstrapFactory().create( | ||
| 470 | 468 | input_.greenOutsideType(), input_.outsideStaticGreenParams()); | |
| 471 | - std::string modelType = input_.solverType(); | ||
| 472 | - K_0_ = Factory<ISolver, SolverData>::TheFactory().create(modelType, | ||
| 473 | - input_.solverParams()); | ||
| 474 | - IBoundaryIntegralOperator * biop = | ||
| 475 | - Factory<IBoundaryIntegralOperator, BIOperatorData>::TheFactory().create( | ||
| 476 | - input_.integratorType(), input_.integratorParams()); | ||
| 469 | + | ||
| 470 | + K_0_ = | ||
| 471 | + solver::bootstrapFactory().create(input_.solverType(), input_.solverParams()); | ||
| 472 | + | ||
| 473 | + IBoundaryIntegralOperator * biop = bi_operators::bootstrapFactory().create( | ||
| 474 | + input_.integratorType(), input_.integratorParams()); | ||
| 477 | 475 | K_0_->buildSystemMatrix(*cavity_, *gf_i, *gf_o, *biop); | |
| 478 | 476 | delete biop; | |
| 479 | 477 | ||
@@ -485,17 +483,16 @@ void Meddle::initStaticSolver() { | |||
| 485 | 483 | } | |
| 486 | 484 | ||
| 487 | 485 | void Meddle::initDynamicSolver() { | |
| 488 | - IGreensFunction * gf_i = Factory<IGreensFunction, GreenData>::TheFactory().create( | ||
| 486 | + IGreensFunction * gf_i = green::bootstrapFactory().create( | ||
| 489 | 487 | input_.greenInsideType(), input_.insideGreenParams()); | |
| 490 | - IGreensFunction * gf_o = Factory<IGreensFunction, GreenData>::TheFactory().create( | ||
| 488 | + IGreensFunction * gf_o = green::bootstrapFactory().create( | ||
| 491 | 489 | input_.greenOutsideType(), input_.outsideDynamicGreenParams()); | |
| 492 | - std::string modelType = input_.solverType(); | ||
| 493 | - K_d_ = Factory<ISolver, SolverData>::TheFactory().create(modelType, | ||
| 494 | - input_.solverParams()); | ||
| 495 | 490 | ||
| 496 | - IBoundaryIntegralOperator * biop = | ||
| 497 | - Factory<IBoundaryIntegralOperator, BIOperatorData>::TheFactory().create( | ||
| 498 | - input_.integratorType(), input_.integratorParams()); | ||
| 491 | + K_d_ = | ||
| 492 | + solver::bootstrapFactory().create(input_.solverType(), input_.solverParams()); | ||
| 493 | + | ||
| 494 | + IBoundaryIntegralOperator * biop = bi_operators::bootstrapFactory().create( | ||
| 495 | + input_.integratorType(), input_.integratorParams()); | ||
| 499 | 496 | K_d_->buildSystemMatrix(*cavity_, *gf_i, *gf_o, *biop); | |
| 500 | 497 | hasDynamic_ = true; | |
| 501 | 498 | delete biop; | |
@@ -529,14 +526,6 @@ void Meddle::printInfo() const { | |||
| 529 | 526 | hostWriter(infoStream_); | |
| 530 | 527 | } | |
| 531 | 528 | ||
| 532 | - void bootstrap() { | ||
| 533 | - bi_operators::bootstrapFactory(); | ||
| 534 | - cavity::bootstrapFactory(); | ||
| 535 | - green::bootstrapFactory(); | ||
| 536 | - solver::bootstrapFactory(); | ||
| 537 | - utils::bootstrapRadiiSet(); | ||
| 538 | - } | ||
| 539 | - | ||
| 540 | 529 | void initMolecule(const Input & inp, | |
| 541 | 530 | const Symmetry & pg, | |
| 542 | 531 | int nuclei, | |
@@ -548,9 +537,8 @@ void initMolecule(const Input & inp, | |||
| 548 | 537 | std::vector<Atom> radiiSet; | |
| 549 | 538 | std::vector<Atom> atoms; | |
| 550 | 539 | atoms.reserve(nuclei); | |
| 551 | - // FIXME This is globally initialized... | ||
| 552 | - using utils::Factory; | ||
| 553 | - radiiSet = Factory::TheFactory().create(set); | ||
| 540 | + // FIXME Code duplication in function initMolecule in interface/Input.cpp | ||
| 541 | + tie(ignore, radiiSet) = utils::bootstrapRadiiSet().create(set); | ||
| 554 | 542 | std::vector<Sphere> spheres; | |
| 555 | 543 | spheres.reserve(nuclei); | |
| 556 | 544 | for (int i = 0; i < charges.size(); ++i) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | 30 | #include "Config.hpp" | |
| 31 | 31 | ||
| 32 | + #include <Eigen/Cholesky> | ||
| 32 | 33 | #include <Eigen/Core> | |
| 33 | 34 | ||
| 34 | 35 | #include "bi_operators/IBoundaryIntegralOperator.hpp" | |
@@ -74,18 +75,19 @@ Eigen::VectorXd CPCMSolver::computeCharge_impl(const Eigen::VectorXd & potential | |||
| 74 | 75 | int nrBlocks = blockS_.size(); | |
| 75 | 76 | int irrDim = fullDim / nrBlocks; | |
| 76 | 77 | charge.segment(irrep * irrDim, irrDim) = | |
| 77 | - -blockS_[irrep].llt().solve(potential.segment(irrep * irrDim, irrDim)); | ||
| 78 | + -blockS_[irrep].ldlt().solve(potential.segment(irrep * irrDim, irrDim)); | ||
| 78 | 79 | ||
| 79 | 80 | return charge; | |
| 80 | 81 | } | |
| 81 | 82 | ||
| 82 | 83 | std::ostream & CPCMSolver::printSolver(std::ostream & os) { | |
| 83 | 84 | os << "Solver Type: C-PCM" << std::endl; | |
| 84 | 85 | if (hermitivitize_) { | |
| 85 | - os << "PCM matrix hermitivitized"; | ||
| 86 | + os << "PCM matrix hermitivitized" << std::endl; | ||
| 86 | 87 | } else { | |
| 87 | - os << "PCM matrix NOT hermitivitized (matches old DALTON)"; | ||
| 88 | + os << "PCM matrix NOT hermitivitized (matches old DALTON)" << std::endl; | ||
| 88 | 89 | } | |
| 90 | + os << "Correction = " << correction_; | ||
| 89 | 91 | ||
| 90 | 92 | return os; | |
| 91 | 93 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,18 +52,20 @@ inline ISolver * createIEFSolver(const SolverData & data) { | |||
| 52 | 52 | return new IEFSolver(data.hermitivitize); | |
| 53 | 53 | } | |
| 54 | 54 | ||
| 55 | - inline void bootstrapFactory() { | ||
| 55 | + inline Factory<ISolver, SolverData> bootstrapFactory() { | ||
| 56 | + Factory<ISolver, SolverData> factory_; | ||
| 57 | + | ||
| 56 | 58 | const bool registeredCPCMSolver = | |
| 57 | - Factory<ISolver, SolverData>::TheFactory().registerObject("CPCM", | ||
| 58 | - createCPCMSolver); | ||
| 59 | + factory_.registerObject("CPCM", createCPCMSolver); | ||
| 59 | 60 | if (!registeredCPCMSolver) | |
| 60 | 61 | PCMSOLVER_ERROR("Subscription of solver for CPCM to factory failed!"); | |
| 61 | 62 | ||
| 62 | 63 | const bool registeredIEFSolver = | |
| 63 | - Factory<ISolver, SolverData>::TheFactory().registerObject("IEFPCM", | ||
| 64 | - createIEFSolver); | ||
| 64 | + factory_.registerObject("IEFPCM", createIEFSolver); | ||
| 65 | 65 | if (!registeredIEFSolver) | |
| 66 | 66 | PCMSOLVER_ERROR("Subscription of solver for IEF to factory failed!"); | |
| 67 | + | ||
| 68 | + return factory_; | ||
| 67 | 69 | } | |
| 68 | 70 | } // namespace solver | |
| 69 | 71 | } // namespace pcm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,9 +38,8 @@ bool invalid(const Atom & atom) { | |||
| 38 | 38 | ||
| 39 | 39 | namespace utils { | |
| 40 | 40 | namespace detail { | |
| 41 | - std::vector<Atom> & initBondi() { | ||
| 42 | - | ||
| 43 | - static std::vector<Atom> Bondi(118); | ||
| 41 | + RadiiSet initBondi() { | ||
| 42 | + std::vector<Atom> Bondi(118); | ||
| 44 | 43 | Eigen::Vector3d Origin = Eigen::Vector3d::Zero(); | |
| 45 | 44 | ||
| 46 | 45 | // ------------------------------------------------------------ | |
@@ -167,12 +166,12 @@ std::vector<Atom> & initBondi() { | |||
| 167 | 166 | ||
| 168 | 167 | // ------------------------------------------------------------ | |
| 169 | 168 | ||
| 170 | - return Bondi; | ||
| 169 | + return make_tuple("Bondi-Mantina", Bondi); | ||
| 171 | 170 | } | |
| 172 | 171 | ||
| 173 | - std::vector<Atom> & initUFF() { | ||
| 172 | + RadiiSet initUFF() { | ||
| 174 | 173 | ||
| 175 | - static std::vector<Atom> UFF(118); | ||
| 174 | + std::vector<Atom> UFF(118); | ||
| 176 | 175 | Eigen::Vector3d Origin = Eigen::Vector3d::Zero(); | |
| 177 | 176 | ||
| 178 | 177 | // ------------------------------------------------------------ | |
@@ -298,12 +297,12 @@ std::vector<Atom> & initUFF() { | |||
| 298 | 297 | UFF[117] = Atom("Ununoctium", "Uuo", 118.0, 294.0000000, 0.0000, Origin, 1.0); | |
| 299 | 298 | // ------------------------------------------------------------ | |
| 300 | 299 | ||
| 301 | - return UFF; | ||
| 300 | + return make_tuple("UFF", UFF); | ||
| 302 | 301 | } | |
| 303 | 302 | ||
| 304 | - std::vector<Atom> & initAllinger() { | ||
| 303 | + RadiiSet initAllinger() { | ||
| 305 | 304 | ||
| 306 | - static std::vector<Atom> Allinger(118); | ||
| 305 | + std::vector<Atom> Allinger(118); | ||
| 307 | 306 | Eigen::Vector3d Origin = Eigen::Vector3d::Zero(); | |
| 308 | 307 | ||
| 309 | 308 | // ------------------------------------------------------------ | |
@@ -447,7 +446,7 @@ std::vector<Atom> & initAllinger() { | |||
| 447 | 446 | Atom("Ununoctium", "Uuo", 118.0, 294.0000000, 0.000000, Origin, 1.0); | |
| 448 | 447 | // ------------------------------------------------------------ | |
| 449 | 448 | ||
| 450 | - return Allinger; | ||
| 449 | + return make_tuple("Allinger's MM3", Allinger); | ||
| 451 | 450 | } | |
| 452 | 451 | } // namespace detail | |
| 453 | 452 | } // namespace utils | |
| Back | FazBrowse Home | New Git URL |
0 commit comments