Skip to content

Commit 3b487d4

Browse files
committed
Avoid adding classical portion to RHS when doing response
1 parent a786df7 commit 3b487d4

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/interface/Meddle.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ void pcm::Meddle::computeResponseASC(const std::string & mep_name,
402402
SurfaceFunctionMapConstIter iter_pot = functions_.find(mep_name);
403403
Eigen::VectorXd asc = Eigen::VectorXd::Zero(iter_pot->second.size());
404404
if (hasFQ_) { /* MMFQ calculation */
405-
asc = FQ_->computeCharge(iter_pot->second);
405+
// Do NOT add classical (electronegativities) contributions to RHS
406+
asc = FQ_->computeCharge(iter_pot->second, false);
406407
} else { /* Pure PCM calculation */
407408
if (hasDynamic_) {
408409
asc = K_d_->computeCharge(iter_pot->second, irrep);

src/mmfq/FQOhno.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ void FQOhno::buildSystemMatrix_impl() {
6868
built_ = true;
6969
}
7070

71-
Eigen::VectorXd FQOhno::computeCharge_impl(const Eigen::VectorXd & potential) const {
72-
// We have to add electronegativities on top of the potential
71+
Eigen::VectorXd FQOhno::computeCharge_impl(const Eigen::VectorXd & potential,
72+
bool scf) const {
7373
Eigen::VectorXd RHS = Eigen::VectorXd::Zero(Dlambda_.rows());
74-
RHS.head(potential.size()) = potential + mmfq_.chi;
74+
RHS.head(potential.size()) = potential;
75+
// If doing SCF, we have to add electronegativities on top of the potential
76+
if (scf)
77+
RHS.head(potential.size()) += mmfq_.chi;
7578
return -Dlambda_.ldlt().solve(RHS).head(potential.size());
7679
}
7780

src/mmfq/FQOhno.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ class FQOhno __final {
5757
friend std::ostream & operator<<(std::ostream & os, FQOhno & solver) {
5858
return solver.printSolver(os);
5959
}
60-
Eigen::VectorXd computeCharge(const Eigen::VectorXd & potential) const {
60+
Eigen::VectorXd computeCharge(const Eigen::VectorXd & potential,
61+
bool scf = true) const {
6162
if (!built_)
6263
PCMSOLVER_ERROR("MMFQ matrix not calculated yet");
63-
return computeCharge_impl(potential);
64+
return computeCharge_impl(potential, scf);
6465
}
6566

6667
private:
@@ -70,7 +71,8 @@ class FQOhno __final {
7071
Eigen::MatrixXd Dlambda_;
7172

7273
void buildSystemMatrix_impl();
73-
Eigen::VectorXd computeCharge_impl(const Eigen::VectorXd & potential) const;
74+
Eigen::VectorXd computeCharge_impl(const Eigen::VectorXd & potential,
75+
bool scf = true) const;
7476
std::ostream & printSolver(std::ostream & os);
7577
};
7678
} // namespace mmfq

0 commit comments

Comments
 (0)