-
Notifications
You must be signed in to change notification settings - Fork 107
Failproof infinity handling #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0424882
4d9a35e
11e32b4
ef560b4
9fac5df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -801,7 +801,7 @@ namespace libint2 { | |||||||
| /// @param[in] atoms the atoms | ||||||||
| inline GaussianPotentialCentersData make_q_gau_data( | ||||||||
| NuclearModel model, const std::vector<Atom>& atoms) { | ||||||||
| constexpr double inf = std::numeric_limits<double>::infinity(); | ||||||||
| constexpr double inf = libint2::infinite_exponent; | ||||||||
| std::map<int, std::shared_ptr<const GaussianPotentialData>> cache; | ||||||||
| GaussianPotentialCentersData result; | ||||||||
| result.reserve(atoms.size()); | ||||||||
|
|
@@ -837,7 +837,7 @@ namespace libint2 { | |||||||
| inline GaussianPotentialCentersData make_q_gau_data( | ||||||||
| NuclearModel model, const std::vector<Atom>& atoms, | ||||||||
| const std::string& sap_basis_name) { | ||||||||
| constexpr double inf = std::numeric_limits<double>::infinity(); | ||||||||
| constexpr double inf = libint2::infinite_exponent; | ||||||||
| std::string basis_lib_path = basis_data_path(); | ||||||||
| std::string canonical_name = sap_basis_name; | ||||||||
| std::transform(sap_basis_name.begin(), sap_basis_name.end(), | ||||||||
|
|
@@ -849,6 +849,17 @@ namespace libint2 { | |||||||
| auto file = basis_lib_path + PATH_SEPARATOR + canonical_name + ".g94"; | ||||||||
| auto sap_by_Z = read_sap_basis_library(file); | ||||||||
|
|
||||||||
| for (size_t z = 0; z < sap_by_Z.size(); ++z) { | ||||||||
| for (const auto& p : sap_by_Z[z]) { | ||||||||
| if (!std::isfinite(p.exponent) || p.exponent <= 0.0) | ||||||||
| throw std::invalid_argument( | ||||||||
| "make_q_gau_data: SAP basis contains invalid exponent"); | ||||||||
| if (!std::isfinite(p.coefficient)) | ||||||||
| throw std::invalid_argument( | ||||||||
| "make_q_gau_data: SAP basis contains non-finite coefficient"); | ||||||||
| } | ||||||||
| } | ||||||||
|
Comment on lines
+852
to
+861
|
||||||||
|
|
||||||||
| std::map<int, std::shared_ptr<const GaussianPotentialData>> cache; | ||||||||
| GaussianPotentialCentersData result; | ||||||||
| result.reserve(atoms.size()); | ||||||||
|
|
@@ -888,6 +899,9 @@ namespace libint2 { | |||||||
| /// Build GaussianPotentialCentersData for erf(ω)/r model. | ||||||||
| inline GaussianPotentialCentersData make_q_gau_data_erf( | ||||||||
| double omega, const std::vector<Atom>& atoms) { | ||||||||
| if (!std::isfinite(omega) || omega <= 0.0) | ||||||||
| throw std::invalid_argument( | ||||||||
| "make_q_gau_data_erf: omega must be positive and finite"); | ||||||||
| auto data = std::make_shared<const GaussianPotentialData>( | ||||||||
| GaussianPotentialData{{omega * omega, 1.0}}); | ||||||||
| GaussianPotentialCentersData result; | ||||||||
|
|
@@ -900,7 +914,10 @@ namespace libint2 { | |||||||
| /// Build GaussianPotentialCentersData for erfc(ω)/r model. | ||||||||
| inline GaussianPotentialCentersData make_q_gau_data_erfc( | ||||||||
| double omega, const std::vector<Atom>& atoms) { | ||||||||
| constexpr double inf = std::numeric_limits<double>::infinity(); | ||||||||
| if (!std::isfinite(omega) || omega <= 0.0) | ||||||||
| throw std::invalid_argument( | ||||||||
| "make_q_gau_data_erfc: omega must be positive and finite"); | ||||||||
| constexpr double inf = libint2::infinite_exponent; | ||||||||
| auto data = std::make_shared<const GaussianPotentialData>( | ||||||||
| GaussianPotentialData{{inf, 1.0}, {omega * omega, -1.0}}); | ||||||||
| GaussianPotentialCentersData result; | ||||||||
|
|
@@ -911,11 +928,21 @@ namespace libint2 { | |||||||
| } | ||||||||
|
|
||||||||
| /// Build GaussianPotentialCentersData for erfx(ω,λ,σ)/r model. | ||||||||
| /// Computes (λ·erf(ωr) + σ·erfc(ωr))/r = σ/r - (σ-λ)·erf(ωr)/r | ||||||||
| /// Computes (λ·erf(ωr) + σ·erfc(ωr))/r = σ/r - (σ-λ)·erf(ωr)/r. | ||||||||
| /// Zero is valid for lambda (pure erfc) and sigma (pure -erf). | ||||||||
|
||||||||
| /// Zero is valid for lambda (pure erfc) and sigma (pure -erf). | |
| /// Zero is valid for lambda and sigma: λ = 0 gives pure erfc (if σ ≠ 0), | |
| /// while σ = 0 gives an erf-only term scaled by λ. |
Uh oh!
There was an error while loading. Please reload this page.