34 Eigen::VectorXd charges = -CalcElecChargeperAtom(dmat, overlap, basis);
36 charges += CalcNucChargeperAtom(orbitals.
QMAtoms());
52 throw std::runtime_error(
53 "CalcChargeperFragment: QmStateType must be an exciton");
58 Eigen::VectorXd nuccharges = CalcNucChargeperAtom(orbitals.
QMAtoms());
63 Eigen::VectorXd gscharges =
64 nuccharges - CalcElecChargeperAtom(dmatgs, overlap, basis);
66 for (
auto& frag : frags) {
67 frag.value().Initialize(numofstates);
68 frag.value().Gs = frag.ExtractFromVector(gscharges);
70 for (
Index i_state = 0; i_state < numofstates; i_state++) {
71 QMState state(type, i_state,
false);
72 std::array<Eigen::MatrixXd, 2> dmat_ex =
74 Eigen::VectorXd atom_h = CalcElecChargeperAtom(dmat_ex[0], overlap, basis);
75 Eigen::VectorXd atom_e = -CalcElecChargeperAtom(dmat_ex[1], overlap, basis);
76 for (
auto& frag : frags) {
77 frag.value().E(i_state) = frag.ExtractFromVector(atom_e);
78 frag.value().H(i_state) = frag.ExtractFromVector(atom_h);
86 const Eigen::MatrixXd& dmat)
const {
93 Eigen::VectorXd charges = CalcElecChargeperAtom(dmat, overlap, basis);
96 for (
auto& frag : frags) {
97 frag.value().Initialize(1);
98 frag.value().Gs = frag.ExtractFromVector(charges);
116 Eigen::VectorXd result = Eigen::VectorXd::Zero(mol.
size());
118 result(i) = double(mol[i].getNuccharge());
125 const Eigen::MatrixXd& dmat,
AOOverlap& overlap,
127 Eigen::MatrixXd prodmat;
129 Eigen::MatrixXd Smsqrt = overlap.
Sqrt();
130 prodmat = Smsqrt * dmat * Smsqrt;
132 prodmat = dmat * overlap.
Matrix();
136 Eigen::VectorXd charges = Eigen::VectorXd::Zero(noofatoms);
138 for (
Index i = 0; i < charges.size(); ++i) {
139 Index nofunc = funcperatom[i];
140 charges(i) = prodmat.diagonal().segment(start, nofunc).sum();
Container to hold Basisfunctions for all atoms.
const std::vector< Index > & getFuncPerAtom() const
void Fill(const AOBasis &aobasis) final
const Eigen::MatrixXd & Matrix() const
const std::string & getType() const
void push_back(const T &atom)
container for molecular orbitals
std::string getCalculationType() const
Eigen::MatrixXd DensityMatrixFull(const QMState &state) const
const Eigen::MatrixXd & getInactiveDensity() const
Eigen::MatrixXd DensityMatrixGroundState() const
const QMMolecule & QMAtoms() const
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState(const QMState &state) const
Index NumberofStates(QMStateType type) const
const AOBasis & getDftBasis() const
void CalcChargeperFragment(std::vector< QMFragment< BSE_Population > > &frags, const Orbitals &orbitals, QMStateType type) const
StaticSegment CalcChargeperAtom(const Orbitals &orbitals, const QMState &state) const
void CalcChargeperFragmentTransition(std::vector< QMFragment< BSE_Population > > &frags, const Orbitals &orbitals, const Eigen::MatrixXd &dmat) const
Eigen::VectorXd CalcElecChargeperAtom(const Eigen::MatrixXd &dmat, AOOverlap &overlap, const AOBasis &basis) const
Eigen::VectorXd CalcNucChargeperAtom(const QMMolecule &mol) const
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
bool isTransition() const
Class to represent Atom/Site in electrostatic.
ClassicalSegment< StaticSite > StaticSegment
base class for all analysis tools