Skip to content

Commit

Permalink
Fix a few bugs in the localization code introduced by changes elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
susilehtola committed Jun 27, 2024
1 parent 560aaa1 commit 5afd003
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dftgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3007,6 +3007,8 @@ void AngularGrid::form_hirshfeld_grid(const Hirshfeld & hirsh) {
void AngularGrid::update_shell_list() {
// Form list of important basis functions. Shell ranges
std::vector<double> shran=basp->get_shell_ranges();
if(shran.size() != basp->get_Nshells())
throw std::logic_error("Shell ranges not initialized\n");
// Distances to other nuclei
std::vector<double> nucdist=basp->get_nuclear_distances(info.atind);

Expand Down Expand Up @@ -3052,6 +3054,8 @@ void AngularGrid::update_shell_list() {
void AngularGrid::compute_bf() {
// Create list of shells that actually contribute. Shell ranges
std::vector<double> shran=basp->get_shell_ranges();
if(shran.size() != basp->get_Nshells())
throw std::logic_error("Shell ranges not initialized\n");

shells.clear();
size_t Nbf=0;
Expand Down
2 changes: 2 additions & 0 deletions src/localize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ int main_guarded(int argc, char **argv) {
settings.add_string("SizeDistribution","File to save orbital size distribution in","");
settings.add_double("GThreshold","Threshold for convergence: norm of Riemannian gradient",1e-7);
settings.add_double("FThreshold","Threshold for convergence: absolute change in function",DBL_MAX);
settings.add_double("LinDepThresh","Linear dependence threshold",1e-5);
settings.add_double("DFTBasisThr","Basis function screening threshold",1e-10);
settings.add_int("Maxiter","Maximum number of iterations",50000);
settings.add_int("Seed","Random number seed",0);
settings.add_bool("Debug","Print out line search every iteration",false);
Expand Down
4 changes: 4 additions & 0 deletions src/stockholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ void StockholderAtom::fill_adaptive(const BasisSet & basis, const arma::mat & P,
std::vector<double> nucdist=basis.get_nuclear_distances(atind);
// Shell ranges
std::vector<double> shran=basis.get_shell_ranges();
if(shran.size() != basis.get_Nshells())
throw std::logic_error("Shell ranges not initialized\n");

// Add points
for(int irad=0;irad<nrad;irad++) {
Expand Down Expand Up @@ -214,6 +216,8 @@ void StockholderAtom::fill_static(const BasisSet & basis, const arma::mat & P, s
std::vector<double> nucdist=basis.get_nuclear_distances(atind);
// Shell ranges
std::vector<double> shran=basis.get_shell_ranges();
if(shran.size() != basis.get_Nshells())
throw std::logic_error("Shell ranges not initialized\n");

// Add points
for(int irad=0;irad<nrad;irad++) {
Expand Down

0 comments on commit 5afd003

Please sign in to comment.