57 double energy_difference)
const {
59 throw std::runtime_error(
60 "Checking degeneracy not implemented for open-shell systems.");
62 std::vector<Index> result;
63 if (level >
mos_.eigenvalues().size()) {
64 throw std::runtime_error(
65 "Level for degeneracy is higher than maximum level");
67 double MOEnergyLevel =
mos_.eigenvalues()(level);
69 for (
Index i = 0; i <
mos_.eigenvalues().size(); ++i) {
70 if (std::abs(
mos_.eigenvalues()(i) - MOEnergyLevel) < energy_difference) {
76 result.push_back(level);
83 throw std::runtime_error(
84 "MO sorting not implemented for open-shell systems.");
86 std::vector<Index> index = std::vector<Index>(
mos_.eigenvalues().size());
87 std::iota(index.begin(), index.end(), 0);
88 std::stable_sort(index.begin(), index.end(), [
this](
Index i1,
Index i2) {
89 return this->MOs().eigenvalues()[i1] < this->MOs().eigenvalues()[i2];
100 if (this->
QMAtoms().size() == 0) {
101 throw std::runtime_error(
"Can't setup AOBasis without atoms");
109 if (this->
QMAtoms().size() == 0) {
110 throw std::runtime_error(
"Can't setup Aux AOBasis without atoms");
113 bs.
Load(aux_basis_name);
124 throw std::runtime_error(
125 "DensityMatrixWithoutGS not implemented for open-shell systems "
126 "except ExcitonUKS.");
130 return DMAT[1] - DMAT[0];
141 throw std::runtime_error(
142 "DensityMatrixWithoutGS does not yet implement QMStateType:" +
165 result = result - DMAT[0] + DMAT[1];
186 " requires an openshell calculation");
189 throw std::runtime_error(
190 "DensityMatrixFull does not yet implement QMStateType:" +
226 return spin[0] + spin[1];
238 throw std::runtime_error(
239 "DensityMatrixKSstate not implemented for open-shell systems.");
242 throw std::runtime_error(
"Orbitals file does not contain MO coefficients");
246 throw std::runtime_error(
"State:" + state.
ToString() +
247 " is not a Kohn Sham state");
249 Eigen::VectorXd KSstate =
mos_.eigenvectors().col(state.
StateIdx());
250 Eigen::MatrixXd dmatKS = KSstate * KSstate.transpose();
255 Eigen::MatrixXd C =
mos_.eigenvectors();
258 throw std::runtime_error(
259 "Orbitals: QSGW flag set, but no QSGW orbitals (QPdiag) stored");
262 C.middleCols(
qpmin_, qptotal) =
263 mos_.eigenvectors().middleCols(
qpmin_, qptotal) *
271 throw std::runtime_error(
"Orbitals file does not contain QP coefficients");
287 throw std::runtime_error(
288 "DensityMatrixQuasiParticle not implemented for open-shell systems.");
291 throw std::runtime_error(
"State:" + state.
ToString() +
292 " is not a quasiparticle state");
308 Eigen::Vector3d nuclei_dip = Eigen::Vector3d::Zero();
311 nuclei_dip += (atom.getPos() -
atoms_.getPos()) * atom.getNuccharge();
320 Eigen::Vector3d electronic_dip;
321 for (
Index i = 0; i < 3; ++i) {
322 electronic_dip(i) = dmat.cwiseProduct(dipole.
Matrix()[i]).sum();
324 return nuclei_dip - electronic_dip;
339 throw std::runtime_error(
340 "ExcitonUKS transition density requested, but no unrestricted "
341 "orbitals are present.");
344 const Eigen::MatrixXd& BSECoefs =
BSE_uks_.eigenvectors();
345 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
346 throw std::runtime_error(
347 "Orbitals object has no information about state:" + state.
ToString());
350 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
360 const Index alpha_size = alpha_vtotal * alpha_ctotal;
361 const Index beta_size = beta_vtotal * beta_ctotal;
363 if (coeffs.size() != alpha_size + beta_size) {
364 throw std::runtime_error(
365 "ExcitonUKS coefficient vector size does not match expected "
366 "alpha+beta BSE space dimensions.");
369 Eigen::MatrixXd tdm = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
370 mos_.eigenvectors().rows());
372 if (alpha_size > 0) {
373 const Eigen::VectorXd coeffs_alpha = coeffs.head(alpha_size);
374 const auto occ_alpha =
376 const auto virt_alpha =
378 const Eigen::Map<const Eigen::MatrixXd> mat_alpha(
379 coeffs_alpha.data(), alpha_ctotal, alpha_vtotal);
381 tdm += occ_alpha * mat_alpha.transpose() * virt_alpha.transpose();
385 const Eigen::VectorXd coeffs_beta = coeffs.tail(beta_size);
386 const auto occ_beta =
388 const auto virt_beta =
390 const Eigen::Map<const Eigen::MatrixXd> mat_beta(
391 coeffs_beta.data(), beta_ctotal, beta_vtotal);
393 tdm += occ_beta * mat_beta.transpose() * virt_beta.transpose();
400 throw std::runtime_error(
401 "TransitionDensityMatrix not implemented for open-shell systems "
402 "except ExcitonUKS.");
405 throw std::runtime_error(
406 "Spin type not known for transition density matrix. Available only for "
409 const Eigen::MatrixXd& BSECoefs =
BSE_singlet_.eigenvectors();
410 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
411 throw std::runtime_error(
"Orbitals object has no information about state:" +
415 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
420 coeffs *= std::sqrt(2.0);
424 Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
427 return occlevels * mat.transpose() * virtlevels.transpose();
438 throw std::runtime_error(
439 "ExcitonUKS excited-state density requested, but no unrestricted "
440 "orbitals are present.");
443 const Eigen::MatrixXd& X =
BSE_uks_.eigenvectors();
444 if (X.cols() < state.
StateIdx() + 1 || X.rows() < 2) {
445 throw std::runtime_error(
446 "Orbitals object has no information about state:" + state.
ToString());
454 const Index alpha_size = alpha_vtotal * alpha_ctotal;
455 const Index beta_size = beta_vtotal * beta_ctotal;
457 if (X.rows() != alpha_size + beta_size) {
458 throw std::runtime_error(
459 "ExcitonUKS coefficient vector size does not match expected "
460 "alpha+beta BSE space dimensions.");
463 const Index nao =
mos_.eigenvectors().rows();
464 std::array<Eigen::MatrixXd, 2> dmat;
465 dmat[0] = Eigen::MatrixXd::Zero(nao, nao);
466 dmat[1] = Eigen::MatrixXd::Zero(nao, nao);
468 auto add_resonant = [&](
const Eigen::VectorXd& coeffs,
bool alpha_spin) {
469 if (coeffs.size() == 0) {
473 const Index vtotal = alpha_spin ? alpha_vtotal : beta_vtotal;
474 const Index ctotal = alpha_spin ? alpha_ctotal : beta_ctotal;
476 const auto& mos_spin =
480 const auto occlevels = mos_spin.middleCols(
bse_vmin_, vtotal);
481 const auto virtlevels = mos_spin.middleCols(lumo, ctotal);
483 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(), ctotal,
486 dmat[0] += occlevels * (mat.transpose() * mat) * occlevels.transpose();
487 dmat[1] += virtlevels * (mat * mat.transpose()) * virtlevels.transpose();
490 auto subtract_antiresonant = [&](
const Eigen::VectorXd& coeffs,
492 if (coeffs.size() == 0) {
496 const Index vtotal = alpha_spin ? alpha_vtotal : beta_vtotal;
497 const Index ctotal = alpha_spin ? alpha_ctotal : beta_ctotal;
499 const auto& mos_spin =
503 const auto occlevels = mos_spin.middleCols(
bse_vmin_, vtotal);
504 const auto virtlevels = mos_spin.middleCols(lumo, ctotal);
506 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(), ctotal,
512 dmat[0] -= virtlevels * (mat * mat.transpose()) * virtlevels.transpose();
513 dmat[1] -= occlevels * (mat.transpose() * mat) * occlevels.transpose();
516 const Eigen::VectorXd Xstate = X.col(state.
StateIdx());
517 add_resonant(Xstate.head(alpha_size),
true);
518 add_resonant(Xstate.tail(beta_size),
false);
521 const Eigen::MatrixXd& Y =
BSE_uks_.eigenvectors2();
522 if (Y.cols() < state.
StateIdx() + 1 || Y.rows() != X.rows()) {
523 throw std::runtime_error(
524 "Orbitals object has inconsistent anti-resonant ExcitonUKS "
525 "coefficients for state:" +
529 const Eigen::VectorXd Ystate = Y.col(state.
StateIdx());
530 subtract_antiresonant(Ystate.head(alpha_size),
true);
531 subtract_antiresonant(Ystate.tail(beta_size),
false);
538 throw std::runtime_error(
539 "DensityMatrixExcitedState not implemented for open-shell systems "
540 "except ExcitonUKS.");
545 std::array<Eigen::MatrixXd, 2> dmat_AR =
547 dmat[0] -= dmat_AR[0];
548 dmat[1] -= dmat_AR[1];
558 throw std::runtime_error(
559 "Spin type not known for density matrix. Available are singlet and "
566 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
567 throw std::runtime_error(
"Orbitals object has no information about state:" +
582 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
584 std::array<Eigen::MatrixXd, 2> dmatEX;
588 dmatEX[0] = occlevels *
CalcAuxMat_vv(coeffs) * occlevels.transpose();
592 dmatEX[1] = virtlevels *
CalcAuxMat_cc(coeffs) * virtlevels.transpose();
598 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
600 return mat.transpose() * mat;
604 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
606 return mat * mat.transpose();
613 throw std::runtime_error(
614 "Spin type not known for density matrix. Available are singlet and "
621 if (BSECoefs_AR.cols() < state.
StateIdx() + 1 || BSECoefs_AR.rows() < 2) {
622 throw std::runtime_error(
"Orbitals object has no information about state:" +
648 Eigen::VectorXd coeffs = BSECoefs_AR.col(state.
StateIdx());
650 std::array<Eigen::MatrixXd, 2> dmatAR;
653 dmatAR[0] = virtlevels *
CalcAuxMat_cc(coeffs) * virtlevels.transpose();
656 dmatAR[1] = occlevels *
CalcAuxMat_vv(coeffs) * occlevels.transpose();
674 throw std::runtime_error(
675 "Orbitals::Oscillatorstrengths only implemented for "
676 "restricted singlets and combined UKS excitons.");
684 Eigen::VectorXd oscs = Eigen::VectorXd::Zero(size);
685 for (
Index i = 0; i < size; ++i) {
707 throw std::runtime_error(
708 "Total Energy does not exist for transition state");
713 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
715 " which has not been calculated");
720 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
722 " which has not been calculated");
727 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
729 " which has not been calculated");
734 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
736 " which has not been calculated");
741 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
743 " which has not been calculated");
748 throw std::runtime_error(
749 "Orbitals::getTotalEnergy You want " + state.
ToString() +
750 " which is a LMO for virtual orbitals. Not implemented.");
754 throw std::runtime_error(
755 "GetTotalEnergy only knows states:singlet,triplet,KS,DQP,PQP,LMOs");
765 dft_dipole.
Fill(basis);
768 std::array<Eigen::MatrixXd, 3> interlevel_dipoles;
772 for (
Index i = 0; i < 3; i++) {
773 interlevel_dipoles[i] = empty.transpose() * dft_dipole.
Matrix()[i] * occ;
775 return interlevel_dipoles;
787 std::array<Eigen::MatrixXd, 3> interlevel_dipoles =
793 const double sqrt2 = std::sqrt(2.0);
795 for (
Index i_exc = 0; i_exc < numofstates; ++i_exc) {
796 Eigen::VectorXd coeffs =
BSE_singlet_.eigenvectors().col(i_exc);
803 Eigen::Vector3d tdipole = Eigen::Vector3d::Zero();
804 for (
Index i = 0; i < 3; ++i) {
805 tdipole[i] = mat.cwiseProduct(interlevel_dipoles[i]).sum();
818 throw std::runtime_error(
819 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS) requires "
820 "unrestricted alpha/beta orbitals.");
828 const Index alpha_size = alpha_vtotal * alpha_ctotal;
832 const Index beta_size = beta_vtotal * beta_ctotal;
834 if (alpha_vtotal < 0 || alpha_ctotal < 0 || beta_vtotal < 0 ||
836 throw std::runtime_error(
837 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS): "
838 "invalid UKS BSE window.");
843 dft_dipole.
Fill(basis);
845 std::array<Eigen::MatrixXd, 3> interlevel_dipoles_alpha;
846 std::array<Eigen::MatrixXd, 3> interlevel_dipoles_beta;
848 const Eigen::MatrixXd virt_alpha =
849 mos_.eigenvectors().middleCols(alpha_homo + 1, alpha_ctotal);
850 const Eigen::MatrixXd occ_alpha =
853 const Eigen::MatrixXd virt_beta =
854 mos_beta_.eigenvectors().middleCols(beta_homo + 1, beta_ctotal);
855 const Eigen::MatrixXd occ_beta =
858 for (
Index i = 0; i < 3; ++i) {
859 interlevel_dipoles_alpha[i] =
860 virt_alpha.transpose() * dft_dipole.
Matrix()[i] * occ_alpha;
861 interlevel_dipoles_beta[i] =
862 virt_beta.transpose() * dft_dipole.
Matrix()[i] * occ_beta;
868 for (
Index i_exc = 0; i_exc < numofstates; ++i_exc) {
869 Eigen::VectorXd coeffs_x =
BSE_uks_.eigenvectors().col(i_exc);
870 Eigen::VectorXd coeffs = coeffs_x;
872 coeffs +=
BSE_uks_.eigenvectors2().col(i_exc);
875 if (coeffs.size() != alpha_size + beta_size) {
876 throw std::runtime_error(
877 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS): "
878 "exciton vector size does not match alpha+beta sector sizes.");
881 Eigen::Map<const Eigen::MatrixXd> mat_alpha(coeffs.data(), alpha_ctotal,
883 Eigen::Map<const Eigen::MatrixXd> mat_beta(coeffs.data() + alpha_size,
884 beta_ctotal, beta_vtotal);
886 Eigen::Vector3d tdipole = Eigen::Vector3d::Zero();
887 for (
Index i = 0; i < 3; ++i) {
888 tdipole[i] = mat_alpha.cwiseProduct(interlevel_dipoles_alpha[i]).sum() +
889 mat_beta.cwiseProduct(interlevel_dipoles_beta[i]).sum();
900 throw std::runtime_error(
901 "Orbitals::CalcCoupledTransition_Dipoles only implemented for "
902 "restricted singlets and combined UKS excitons.");
909 for (
Index i = 0; i < size; ++i) {
912 for (
Index i = 0; i < size; ++i) {
921 std::vector<Index> index = std::vector<Index>(
mos_.eigenvalues().size());
922 std::iota(index.begin(), index.end(), 0);
923 std::stable_sort(index.begin(), index.end(), [
this](
Index i1,
Index i2) {
924 return this->MOs().eigenvalues()[i1] < this->MOs().eigenvalues()[i2];
930 std::vector<Index> index = std::vector<Index>(
mos_beta_.eigenvalues().size());
931 std::iota(index.begin(), index.end(), 0);
932 std::stable_sort(index.begin(), index.end(), [
this](
Index i1,
Index i2) {
933 return this->MOs_beta().eigenvalues()[i1] <
934 this->MOs_beta().eigenvalues()[i2];
943 for (
Index i = 0; i < size; ++i) {
946 for (
Index i = 0; i < size; ++i) {
955 for (
Index i = 0; i < size; ++i) {
958 for (
Index i = 0; i < size; ++i) {
978 throw std::runtime_error(
979 "PrepareDimerGuess currently supports only restricted orbitals.");
983 throw std::runtime_error(
984 "PrepareDimerGuess currently supports only closed-shell singlets.");
996 mos_.eigenvectors() = Eigen::MatrixXd::Zero(basisA + basisB, basisA + basisB);
1001 throw std::runtime_error(
"Basissets of Orbitals A and B differ " +
1008 throw std::runtime_error(
"ECPs of Orbitals A and B differ " +
1026 this->
MOs().
eigenvalues() = Eigen::VectorXd::Zero(basisA + basisB);
1052 throw std::runtime_error(
"Basissets of Orbitals A and B differ " +
1059 throw std::runtime_error(
"ECPs of Orbitals A and B differ " +
1077 const Eigen::VectorXd& A_alpha_energies = orbitalsA.
MOs().
eigenvalues();
1078 const Eigen::VectorXd& A_beta_energies =
1081 const Eigen::VectorXd& B_alpha_energies = orbitalsB.
MOs().
eigenvalues();
1082 const Eigen::VectorXd& B_beta_energies =
1086 mos_.eigenvectors() = Eigen::MatrixXd::Zero(basisA + basisB, basisA + basisB);
1087 mos_.eigenvectors().block(0, 0, basisA, basisA) = A_alpha;
1088 mos_.eigenvectors().block(basisA, basisA, basisB, basisB) = B_alpha;
1089 mos_.eigenvalues() = Eigen::VectorXd::Zero(basisA + basisB);
1090 mos_.eigenvalues().segment(0, basisA) = A_alpha_energies;
1091 mos_.eigenvalues().segment(basisA, basisB) = B_alpha_energies;
1094 Eigen::MatrixXd::Zero(basisA + basisB, basisA + basisB);
1095 mos_beta_.eigenvectors().block(0, 0, basisA, basisA) = A_beta;
1096 mos_beta_.eigenvectors().block(basisA, basisA, basisB, basisB) = B_beta;
1097 mos_beta_.eigenvalues() = Eigen::VectorXd::Zero(basisA + basisB);
1098 mos_beta_.eigenvalues().segment(0, basisA) = A_beta_energies;
1099 mos_beta_.eigenvalues().segment(basisA, basisB) = B_beta_energies;
1112 Index spin = (alpha_electrons - beta_electrons) + 1;
1120 std::lock_guard<std::recursive_mutex> lock(
1164 atoms_.WriteToCpt(molgroup);
1210 w(tmp,
"use_Hqp_offdiag");
1211 std::uint8_t tmp_qsgw =
is_qsgw_ ? 1u : 0u;
1212 w(tmp_qsgw,
"is_qsgw");
1243 std::lock_guard<std::recursive_mutex> lock(
1267 r(version,
"version");
1269 auto r_optional = [&r](
auto& obj,
const std::string& key) {
1272 }
catch (std::runtime_error&) {
1279 atoms_.ReadFromCpt(molgroup);
1284 }
catch (std::runtime_error&
e) {
1303 }
catch (std::runtime_error&
e) {
1307 r(version,
"version");
1327 std::array<Index, 49> votcaOrder_old = {
1331 0, -1, 1, -2, 2, -3, 3,
1332 0, -1, 1, -2, 2, -3, 3, -4, 4,
1333 0, -1, 1, -2, 2, -3, 3, -4, 4,-5,5,
1334 0, -1, 1, -2, 2, -3, 3, -4, 4,-5,5,-6,6
1338 std::array<Index, 49> multiplier;
1346 std::string dft_basis_name;
1347 std::string aux_basis_name;
1348 r(dft_basis_name,
"dftbasis");
1349 r(aux_basis_name,
"auxbasis");
1364 }
catch (std::runtime_error&
e) {
1393 std::uint8_t tmp = 0;
1394 r(tmp,
"use_Hqp_offdiag");
1396 std::uint8_t tmp_qsgw = 0;
1398 r(tmp_qsgw,
"is_qsgw");
1438 throw std::runtime_error(
"Orbitals file does not contain MO coefficients");
1441 std::array<Eigen::MatrixXd, 2> result;
1442 result[0] = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
1443 mos_.eigenvectors().rows());
1444 result[1] = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
1445 mos_.eigenvectors().rows());
1449 const Eigen::MatrixXd occ_a =
1451 result[0] = occ_a * occ_a.transpose();
1454 const Eigen::MatrixXd occ_b =
1456 result[1] = occ_b * occ_b.transpose();
1472 const Index n_docc = std::min(n_alpha, n_beta);
1473 const Index n_socc_alpha = n_alpha - n_docc;
1474 const Index n_socc_beta = n_beta - n_docc;
1477 const Eigen::MatrixXd docc =
mos_.eigenvectors().leftCols(n_docc);
1478 const Eigen::MatrixXd d_docc = docc * docc.transpose();
1479 result[0] += d_docc;
1480 result[1] += d_docc;
1483 if (n_socc_alpha > 0) {
1484 const Eigen::MatrixXd socc_a =
1485 mos_.eigenvectors().middleCols(n_docc, n_socc_alpha);
1486 result[0] += socc_a * socc_a.transpose();
1489 if (n_socc_beta > 0) {
1490 const Eigen::MatrixXd socc_b =
1491 mos_.eigenvectors().middleCols(n_docc + n_socc_alpha, n_socc_beta);
1492 result[1] += socc_b * socc_b.transpose();
Container to hold Basisfunctions for all atoms.
void setCenter(const Eigen::Vector3d &r)
const std::array< Eigen::MatrixXd, 3 > & Matrix() const
void Fill(const AOBasis &aobasis) final
void Load(const std::string &name)
CheckpointReader getReader()
CheckpointWriter getWriter()
CheckpointReader openChild(const std::string &childName) const
CheckpointWriter openChild(const std::string &childName) const
void reorderOrbitals(Eigen::MatrixXd &moCoefficients, const AOBasis &basis)
tools::EigenSystem QPdiag_alpha_
Eigen::MatrixXd excited_forces_
Index number_beta_electrons_
void CalcCoupledTransition_Dipoles()
Index getCharge() const
Return the stored total charge.
bool hasPolarizability() const
Eigen::MatrixXd occupations_
Eigen::VectorXd rpa_inputenergies_
Index getHomo() const
Return the default HOMO index used by spin-agnostic callers.
bool hasQPGradients() const
Eigen::VectorXd BSE_uks_energies_dynamic_
Eigen::MatrixXd TransitionDensityMatrix(const QMState &state) const
Eigen::MatrixXd qp_gradients_
double getDFTTotalEnergy() const
Return the stored total DFT energy.
Index getSpin() const
Return the stored spin multiplicity.
Eigen::MatrixXd CalculateQParticleAORepresentation() const
Transform quasiparticle amplitudes into the AO representation.
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState_R(const QMState &state) const
const tools::EigenSystem & MOs_beta() const
Return read-only access to beta-spin molecular orbitals.
bool hasUnrestrictedOrbitals() const
Report whether separate beta-spin orbitals are present.
Eigen::VectorXd lmos_energies_
tools::EigenSystem BSE_singlet_
std::string relaxed_density_state_
tools::EigenSystem QPdiag_beta_
void OrderMOsbyEnergyBeta()
Same as OrderMOsbyEnergyAlpha, but for the BETA channel (mos_beta_).
void PrepareDimerGuess(const Orbitals &orbitalsA, const Orbitals &orbitalsB)
Guess for a dimer based on monomer orbitals.
tools::EigenSystem mos_beta_
std::string grid_quality_
bool hasMOs() const
Report whether alpha/restricted molecular orbitals are available.
double getTotalStateEnergy(const QMState &state) const
Return the absolute total energy of the requested state in Hartree.
Eigen::VectorXd BSE_triplet_energies_dynamic_
bool hasRelaxedDensity() const
void ReadBasisSetsFromCpt(CheckpointReader &r)
Deserialize attached AO basis sets from an already-open checkpoint reader.
std::array< Eigen::MatrixXd, 2 > DensityMatrixGroundStateSpinResolved() const
Eigen::MatrixXd QPpert_energies_beta_
void WriteBasisSetsToCpt(CheckpointWriter &w) const
std::vector< Index > CheckDegeneracy(Index level, double energy_difference) const
Eigen::VectorXd BSE_singlet_dynamic_iterations_
Eigen::MatrixXd inactivedensity_
std::string getCalculationType() const
Return the stored calculation-type tag.
std::array< Eigen::MatrixXd, 3 > CalcFreeTransition_Dipoles() const
Eigen::MatrixXd CalcAuxMat_cc(const Eigen::VectorXd &coeffs) const
Eigen::VectorXd BSE_triplet_dynamic_change_
std::vector< Index > qp_gradient_levels_
Eigen::MatrixXd polarizability_
Eigen::MatrixXd expandedMOs_
void setNumberOfAlphaElectrons(Index electrons)
Store the total number of alpha electrons.
Eigen::VectorXd Oscillatorstrengths() const
std::vector< Eigen::Vector3d > transition_dipoles_
static constexpr int orbitals_version()
std::string functionalname_
Eigen::MatrixXd DensityMatrixWithoutGS(const QMState &state) const
Eigen::MatrixXd DensityMatrixFull(const QMState &state) const
Eigen::MatrixXd CalcAuxMat_vv(const Eigen::VectorXd &coeffs) const
Eigen::MatrixXd relaxed_density_
void PrepareDimerGuessMixedSpin(const Orbitals &orbitalsA, const Orbitals &orbitalsB)
Dimer guess from two converged monomers of arbitrary charge and spin.
void SetupAuxBasis(std::string aux_basis_name)
std::string excited_forces_state_
Index getLumoAlpha() const
Return the alpha-spin LUMO index inferred from the stored electron counts.
void setNumberOfBetaElectrons(Index electrons)
Store the total number of beta electrons.
tools::EigenSystem BSE_triplet_
void setBSEindices(Index vmin, Index cmax)
const Eigen::MatrixXd & getInactiveDensity() const
Return the inactive-region density matrix used in embedding workflows.
std::vector< Index > SortEnergies()
Index getHomoBeta() const
Return the beta-spin HOMO index.
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState_AR(const QMState &state) const
double getExcitedStateEnergy(const QMState &state) const
Return the excitation energy of the requested state in Hartree.
void setECPName(const std::string &ECP)
Store the effective core potential label.
void setNumberOfOccupiedLevels(Index occupied_levels)
Index occupied_levels_beta_
Orbitals()
Construct an empty orbital container with default metadata.
void OrderMOsbyEnergyAlpha()
tools::EigenSystem QPdiag_
Eigen::VectorXd rpa_inputenergies_beta_
Eigen::MatrixXd DensityMatrixKSstate(const QMState &state) const
Build the AO density matrix for a single KS orbital state.
Index active_core_levels_
Eigen::MatrixXd DensityMatrixQuasiParticle(const QMState &state) const
Build the AO density matrix for a quasiparticle state.
bool hasExcitedStateForces() const
Index getBasisSetSize() const
Return the number of AO basis functions in the DFT basis.
std::vector< Index > SortEnergiesBeta()
Eigen::VectorXd BSE_singlet_dynamic_change_
Eigen::MatrixXd QPpert_energies_alpha_
Eigen::MatrixXd BSEOrbitals() const
Eigen::VectorXd BSE_singlet_energies_dynamic_
Index getGWAmin() const
Return the lower GW orbital index.
const tools::EigenSystem & MOs() const
Return read-only access to alpha/restricted molecular orbitals.
Eigen::MatrixXd DensityMatrixGroundState() const
Build the ground-state AO density matrix from the stored orbitals.
Index getLumoBeta() const
const QMMolecule & QMAtoms() const
Return read-only access to the molecular geometry.
tools::EigenSystem mos_embedding_
Eigen::VectorXd rpa_inputenergies_alpha_
std::vector< Index > SortEnergiesAlpha()
void ReadFromCpt(const std::string &filename)
Read the orbital container from a checkpoint file on disk.
tools::EigenSystem BSE_uks_
void setNumberOfOccupiedLevelsBeta(Index occupied_levels_beta)
Store the number of occupied beta-spin orbitals.
void setChargeAndSpin(Index charge, Index spin)
Eigen::VectorXd QPpert_energies_
void WriteToCpt(const std::string &filename) const
Write the orbital container to a checkpoint file on disk.
const std::string & getECPName() const
Return the effective core potential label.
const std::string & getDFTbasisName() const
Return the DFT basis-set name.
void SetupDftBasis(std::string basis_name)
Build and attach the DFT AO basis from the stored molecular geometry.
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState(const QMState &state) const
Build separate hole and electron AO densities for an excited state.
Index number_alpha_electrons_
Eigen::Vector3d CalcElDipole(const QMState &state) const
Compute the electronic dipole moment associated with a state density.
Eigen::VectorXd BSE_triplet_dynamic_iterations_
Index getHomoAlpha() const
Return the alpha-spin HOMO index.
const AOBasis & getDftBasis() const
Return the DFT AO basis, throwing if it has not been initialized.
Index getLumo() const
Return the default LUMO index used by spin-agnostic callers.
std::string ToLongString() const
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
std::string ToString() const
bool isTransition() const
const QMStateType & Type() const
std::recursive_mutex & Hdf5Mutex()
Charge transport classes.
Provides a means for comparing floating point numbers.