Skip to content

Commit fb141c2

Browse files
author
Roberto Di Remigio
committed
Revert to storing T and R explicitly instead of computing T^-1R
1 parent bc936be commit fb141c2

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

src/solver/IEFSolver.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,34 @@ void IEFSolver::buildSystemMatrix_impl(const Cavity & cavity, const IGreensFunct
5050

5151
void IEFSolver::buildAnisotropicMatrix(const Cavity & cav, const IGreensFunction & gf_i, const IGreensFunction & gf_o)
5252
{
53-
TinvR_ = anisotropicIEFMatrix(cav, gf_i, gf_o);
53+
Tepsilon_ = anisotropicTEpsilon(cav, gf_i, gf_o);
5454
// Pack into a block diagonal matrix
5555
// The number of irreps in the group
5656
int nrBlocks = cav.pointGroup().nrIrrep();
5757
// The size of the irreducible portion of the cavity
5858
int dimBlock = cav.irreducible_size();
5959
// For the moment just packs into a std::vector<Eigen::MatrixXd>
60-
symmetryPacking(blockTinvR_, TinvR_, dimBlock, nrBlocks);
60+
symmetryPacking(blockTepsilon_, Tepsilon_, dimBlock, nrBlocks);
61+
62+
Rinfinity_ = anisotropicRinfinity(cav, gf_i, gf_o);
63+
symmetryPacking(blockRinfinity_, Rinfinity_, dimBlock, nrBlocks);
6164

6265
built_ = true;
6366
}
6467

6568
void IEFSolver::buildIsotropicMatrix(const Cavity & cav, const IGreensFunction & gf_i, const IGreensFunction & gf_o)
6669
{
67-
TinvR_ = isotropicIEFMatrix(cav, gf_i, profiles::epsilon(gf_o.permittivity()));
70+
Tepsilon_ = isotropicTEpsilon(cav, gf_i, profiles::epsilon(gf_o.permittivity()));
6871
// Pack into a block diagonal matrix
6972
// The number of irreps in the group
7073
int nrBlocks = cav.pointGroup().nrIrrep();
7174
// The size of the irreducible portion of the cavity
7275
int dimBlock = cav.irreducible_size();
7376
// For the moment just packs into a std::vector<Eigen::MatrixXd>
74-
symmetryPacking(blockTinvR_, TinvR_, dimBlock, nrBlocks);
77+
symmetryPacking(blockTepsilon_, Tepsilon_, dimBlock, nrBlocks);
78+
79+
Rinfinity_ = isotropicRinfinity(cav, gf_i);
80+
symmetryPacking(blockRinfinity_, Rinfinity_, dimBlock, nrBlocks);
7581

7682
built_ = true;
7783
}
@@ -81,12 +87,12 @@ Eigen::VectorXd IEFSolver::computeCharge_impl(const Eigen::VectorXd & potential,
8187
// The potential and charge vector are of dimension equal to the
8288
// full dimension of the cavity. We have to select just the part
8389
// relative to the irrep needed.
84-
int fullDim = TinvR_.rows();
90+
int fullDim = Rinfinity_.rows();
8591
Eigen::VectorXd charge = Eigen::VectorXd::Zero(fullDim);
86-
int nrBlocks = blockTinvR_.size();
92+
int nrBlocks = blockRinfinity_.size();
8793
int irrDim = fullDim/nrBlocks;
8894
charge.segment(irrep*irrDim, irrDim) =
89-
- blockTinvR_[irrep] * potential.segment(irrep*irrDim, irrDim);
95+
- blockTepsilon_[irrep].partialPivLu().solve(blockRinfinity_[irrep] * potential.segment(irrep*irrDim, irrDim));
9096
// Symmetrize ASC charge := (charge + charge*)/2
9197
if (hermitivitize_) hermitivitize(charge);
9298

src/solver/IEFSolver.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ class IGreensFunction;
4545
* \author Luca Frediani, Roberto Di Remigio
4646
* \date 2011, 2015, 2016
4747
*
48-
* \note We store the unsymmetrized T^-1R matrix.
48+
* \note We store the non-Hermitian, symmetry-blocked T(epsilon) and Rinfinity matrices.
49+
* The ASC is obtained by multiplying the MEP by Rinfinity and then using a partially
50+
* pivoted LU decomposition of T(epsilon) on the resulting vector.
51+
* This avoids computing and storing the inverse explicitly.
4952
*/
5053

5154
class IEFSolver : public PCMSolver
@@ -75,10 +78,14 @@ class IEFSolver : public PCMSolver
7578
private:
7679
/*! Whether the system matrix has to be symmetrized */
7780
bool hermitivitize_;
78-
/*! T^-1R matrix, not symmetry blocked */
79-
Eigen::MatrixXd TinvR_;
80-
/*! T^-1R matrix, symmetry blocked form */
81-
std::vector<Eigen::MatrixXd> blockTinvR_;
81+
/*! T(epsilon) matrix, not symmetry blocked */
82+
Eigen::MatrixXd Tepsilon_;
83+
/*! T(epsilon) matrix, symmetry blocked form */
84+
std::vector<Eigen::MatrixXd> blockTepsilon_;
85+
/*! R_infinity matrix, not symmetry blocked */
86+
Eigen::MatrixXd Rinfinity_;
87+
/*! R_infinity matrix, symmetry blocked form */
88+
std::vector<Eigen::MatrixXd> blockRinfinity_;
8289

8390
/*! \brief Calculation of the PCM matrix
8491
* \param[in] cavity the cavity to be used

0 commit comments

Comments
 (0)