Skip to content

Commit

Permalink
Density matrix digestion
Browse files Browse the repository at this point in the history
  • Loading branch information
susilehtola committed Jan 15, 2024
1 parent a8058d3 commit 40bb0b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/density_fitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ arma::mat DensityFit::calcJ(const arma::mat & P) const {

// Get the expansion coefficients
arma::vec c=compute_expansion(P);
return digestJ(c);
}

arma::mat DensityFit::calcJ(const arma::vec & c) const {
if(c.n_elem != Naux) {
std::ostringstream oss;
oss << "Error in DensityFit: Naux = " << Naux << ", c.n_elem = " << c.n_elem << "!\n";
throw std::logic_error(oss.str());
}

arma::mat J(Nbf,Nbf);
J.zeros();
Expand Down
2 changes: 2 additions & 0 deletions src/density_fitting.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class DensityFit {
arma::mat calcJ(const arma::mat & P) const;
/// Get Coulomb matrix from P
std::vector<arma::mat> calcJ(const std::vector<arma::mat> & P) const;
/// Digest J matrix from computed expansion
arma::mat digest(const arma::vec & gamma) const;

/// Calculate force from P
arma::vec forceJ(const arma::mat & P);
Expand Down

0 comments on commit 40bb0b4

Please sign in to comment.