votca 2026-dev
Loading...
Searching...
No Matches
votca::xtp::ChargeResponseSolver Class Reference

Induced charges and dipoles of a polar region with charge-response segments (Thole segments may be mixed in). More...

#include <chargeresponsesolver.h>

Collaboration diagram for votca::xtp::ChargeResponseSolver:

Classes

struct  Info
struct  SiteRef
struct  Coupling
struct  SegmentBlock

Public Member Functions

 ChargeResponseSolver (std::vector< PolarSegment > &segments, const eeInteractor &interactor)
Info Solve (double tolerance, Index max_iter, bool use_previous)
double InternalChargeEnergy () const
Index size () const
Eigen::VectorXd Apply (const Eigen::VectorXd &y) const
Eigen::MatrixXd DenseOperator () const
Eigen::MatrixXd ApplyMhalf (const Eigen::MatrixXd &X) const
 M^1/2 X for a matrix of unknown-space columns.
Index ChargeIndex (Index k) const
Index NumCharges () const

Private Member Functions

Coupling PairCoupling (Index a, Index b) const
Eigen::VectorXd ApplyT (const Eigen::VectorXd &x) const
Eigen::VectorXd ApplyMhalf (const Eigen::VectorXd &x, bool inverse) const
Eigen::VectorXd Sources () const
Eigen::VectorXd ReadFromSites () const
void WriteToSites (const Eigen::VectorXd &x)

Private Attributes

std::vector< PolarSegment > & segments_
const eeInteractor & interactor_
std::vector< SiteRef > sites_
Index nq_ = 0
Index dim_ = 0
std::vector< SegmentBlock > blocks_
std::vector< Eigen::Matrix3d > alpha_sqrt_
std::vector< Eigen::Matrix3d > alpha_inv_sqrt_

Detailed Description

Induced charges and dipoles of a polar region with charge-response segments (Thole segments may be mixed in).

Unknowns x = (dq of the charge-response sites, mu of all sites), sources c = (-phi, E) from the potentials and fields accumulated in the sites (Phi + Phi_noE, -(V + V_noE)), M = blockdiag(Pi of each charge-response segment, alpha of each site). With T the couplings of the induced charges and dipoles ((T x)_q = induced potential, (T x)_mu = minus the induced field; nothing inside a charge-response segment, the Thole couplings inside a Thole segment):

x = M (c - T x) <=> (1 + M^1/2 T M^1/2) y = M^1/2 c, x = M^1/2 y,

solved by conjugate gradients on the symmetric operator. The null space of Pi (charge conservation) is handled by M^1/2. The kernels are those of eeInteractor (FillDipoleInteraction, GaussianKernel).

Definition at line 53 of file chargeresponsesolver.h.

Constructor & Destructor Documentation

◆ ChargeResponseSolver()

votca::xtp::ChargeResponseSolver::ChargeResponseSolver ( std::vector< PolarSegment > & segments,
const eeInteractor & interactor )

Definition at line 51 of file chargeresponsesolver.cc.

Member Function Documentation

◆ Apply()

Eigen::VectorXd votca::xtp::ChargeResponseSolver::Apply ( const Eigen::VectorXd & y) const

Definition at line 220 of file chargeresponsesolver.cc.

◆ ApplyMhalf() [1/2]

Eigen::MatrixXd votca::xtp::ChargeResponseSolver::ApplyMhalf ( const Eigen::MatrixXd & X) const

M^1/2 X for a matrix of unknown-space columns.

Definition at line 190 of file chargeresponsesolver.cc.

◆ ApplyMhalf() [2/2]

Eigen::VectorXd votca::xtp::ChargeResponseSolver::ApplyMhalf ( const Eigen::VectorXd & x,
bool inverse ) const
private

Definition at line 204 of file chargeresponsesolver.cc.

◆ ApplyT()

Eigen::VectorXd votca::xtp::ChargeResponseSolver::ApplyT ( const Eigen::VectorXd & x) const
private

Definition at line 107 of file chargeresponsesolver.cc.

◆ ChargeIndex()

Index votca::xtp::ChargeResponseSolver::ChargeIndex ( Index k) const
inline

Index of the induced charge of site k (the sites of all segments in order) among the unknowns, -1 for a Thole site; dipole of site k at NumCharges() + 3 k.

Definition at line 87 of file chargeresponsesolver.h.

◆ DenseOperator()

Eigen::MatrixXd votca::xtp::ChargeResponseSolver::DenseOperator ( ) const

The operator 1 + M^1/2 T M^1/2 as a dense matrix (for many right-hand sides at once, EnvironmentScreening).

Definition at line 148 of file chargeresponsesolver.cc.

◆ InternalChargeEnergy()

double votca::xtp::ChargeResponseSolver::InternalChargeEnergy ( ) const

1/2 dq^T Pi^+ dq summed over the charge-response segments, the internal energy of the induced charges (that of the dipoles is in PolarSite::InternalEnergy).

Definition at line 304 of file chargeresponsesolver.cc.

◆ NumCharges()

Index votca::xtp::ChargeResponseSolver::NumCharges ( ) const
inline

Definition at line 88 of file chargeresponsesolver.h.

◆ PairCoupling()

ChargeResponseSolver::Coupling votca::xtp::ChargeResponseSolver::PairCoupling ( Index a,
Index b ) const
private

Definition at line 80 of file chargeresponsesolver.cc.

◆ ReadFromSites()

Eigen::VectorXd votca::xtp::ChargeResponseSolver::ReadFromSites ( ) const
private

Definition at line 236 of file chargeresponsesolver.cc.

◆ size()

Index votca::xtp::ChargeResponseSolver::size ( ) const
inline

Definition at line 74 of file chargeresponsesolver.h.

◆ Solve()

ChargeResponseSolver::Info votca::xtp::ChargeResponseSolver::Solve ( double tolerance,
Index max_iter,
bool use_previous )

Solves and writes dq and mu to the sites. With use_previous the induced values in the sites are the initial guess, else the response without couplings.

Definition at line 258 of file chargeresponsesolver.cc.

◆ Sources()

Eigen::VectorXd votca::xtp::ChargeResponseSolver::Sources ( ) const
private

Definition at line 224 of file chargeresponsesolver.cc.

◆ WriteToSites()

void votca::xtp::ChargeResponseSolver::WriteToSites ( const Eigen::VectorXd & x)
private

Definition at line 248 of file chargeresponsesolver.cc.

Member Data Documentation

◆ alpha_inv_sqrt_

std::vector<Eigen::Matrix3d> votca::xtp::ChargeResponseSolver::alpha_inv_sqrt_
private

Definition at line 130 of file chargeresponsesolver.h.

◆ alpha_sqrt_

std::vector<Eigen::Matrix3d> votca::xtp::ChargeResponseSolver::alpha_sqrt_
private

Definition at line 129 of file chargeresponsesolver.h.

◆ blocks_

std::vector<SegmentBlock> votca::xtp::ChargeResponseSolver::blocks_
private

Definition at line 127 of file chargeresponsesolver.h.

◆ dim_

Index votca::xtp::ChargeResponseSolver::dim_ = 0
private

Definition at line 118 of file chargeresponsesolver.h.

◆ interactor_

const eeInteractor& votca::xtp::ChargeResponseSolver::interactor_
private

Definition at line 115 of file chargeresponsesolver.h.

◆ nq_

Index votca::xtp::ChargeResponseSolver::nq_ = 0
private

Definition at line 117 of file chargeresponsesolver.h.

◆ segments_

std::vector<PolarSegment>& votca::xtp::ChargeResponseSolver::segments_
private

Definition at line 114 of file chargeresponsesolver.h.

◆ sites_

std::vector<SiteRef> votca::xtp::ChargeResponseSolver::sites_
private

Definition at line 116 of file chargeresponsesolver.h.


The documentation for this class was generated from the following files: