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:" +
161 result = result - DMAT[0] + DMAT[1];
182 " requires an openshell calculation");
185 throw std::runtime_error(
186 "DensityMatrixFull does not yet implement QMStateType:" +
222 return spin[0] + spin[1];
234 throw std::runtime_error(
235 "DensityMatrixKSstate not implemented for open-shell systems.");
238 throw std::runtime_error(
"Orbitals file does not contain MO coefficients");
242 throw std::runtime_error(
"State:" + state.
ToString() +
243 " is not a Kohn Sham state");
245 Eigen::VectorXd KSstate =
mos_.eigenvectors().col(state.
StateIdx());
246 Eigen::MatrixXd dmatKS = KSstate * KSstate.transpose();
251 Eigen::MatrixXd C =
mos_.eigenvectors();
254 throw std::runtime_error(
255 "Orbitals: QSGW flag set, but no QSGW orbitals (QPdiag) stored");
258 C.middleCols(
qpmin_, qptotal) =
259 mos_.eigenvectors().middleCols(
qpmin_, qptotal) *
267 throw std::runtime_error(
"Orbitals file does not contain QP coefficients");
283 throw std::runtime_error(
284 "DensityMatrixQuasiParticle not implemented for open-shell systems.");
287 throw std::runtime_error(
"State:" + state.
ToString() +
288 " is not a quasiparticle state");
304 Eigen::Vector3d nuclei_dip = Eigen::Vector3d::Zero();
307 nuclei_dip += (atom.getPos() -
atoms_.getPos()) * atom.getNuccharge();
316 Eigen::Vector3d electronic_dip;
317 for (
Index i = 0; i < 3; ++i) {
318 electronic_dip(i) = dmat.cwiseProduct(dipole.
Matrix()[i]).sum();
320 return nuclei_dip - electronic_dip;
335 throw std::runtime_error(
336 "ExcitonUKS transition density requested, but no unrestricted "
337 "orbitals are present.");
340 const Eigen::MatrixXd& BSECoefs =
BSE_uks_.eigenvectors();
341 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
342 throw std::runtime_error(
343 "Orbitals object has no information about state:" + state.
ToString());
346 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
356 const Index alpha_size = alpha_vtotal * alpha_ctotal;
357 const Index beta_size = beta_vtotal * beta_ctotal;
359 if (coeffs.size() != alpha_size + beta_size) {
360 throw std::runtime_error(
361 "ExcitonUKS coefficient vector size does not match expected "
362 "alpha+beta BSE space dimensions.");
365 Eigen::MatrixXd tdm = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
366 mos_.eigenvectors().rows());
368 if (alpha_size > 0) {
369 const Eigen::VectorXd coeffs_alpha = coeffs.head(alpha_size);
370 const auto occ_alpha =
372 const auto virt_alpha =
374 const Eigen::Map<const Eigen::MatrixXd> mat_alpha(
375 coeffs_alpha.data(), alpha_ctotal, alpha_vtotal);
377 tdm += occ_alpha * mat_alpha.transpose() * virt_alpha.transpose();
381 const Eigen::VectorXd coeffs_beta = coeffs.tail(beta_size);
382 const auto occ_beta =
384 const auto virt_beta =
386 const Eigen::Map<const Eigen::MatrixXd> mat_beta(
387 coeffs_beta.data(), beta_ctotal, beta_vtotal);
389 tdm += occ_beta * mat_beta.transpose() * virt_beta.transpose();
396 throw std::runtime_error(
397 "TransitionDensityMatrix not implemented for open-shell systems "
398 "except ExcitonUKS.");
401 throw std::runtime_error(
402 "Spin type not known for transition density matrix. Available only for "
405 const Eigen::MatrixXd& BSECoefs =
BSE_singlet_.eigenvectors();
406 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
407 throw std::runtime_error(
"Orbitals object has no information about state:" +
411 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
416 coeffs *= std::sqrt(2.0);
420 Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
423 return occlevels * mat.transpose() * virtlevels.transpose();
434 throw std::runtime_error(
435 "ExcitonUKS excited-state density requested, but no unrestricted "
436 "orbitals are present.");
439 const Eigen::MatrixXd& X =
BSE_uks_.eigenvectors();
440 if (X.cols() < state.
StateIdx() + 1 || X.rows() < 2) {
441 throw std::runtime_error(
442 "Orbitals object has no information about state:" + state.
ToString());
450 const Index alpha_size = alpha_vtotal * alpha_ctotal;
451 const Index beta_size = beta_vtotal * beta_ctotal;
453 if (X.rows() != alpha_size + beta_size) {
454 throw std::runtime_error(
455 "ExcitonUKS coefficient vector size does not match expected "
456 "alpha+beta BSE space dimensions.");
459 const Index nao =
mos_.eigenvectors().rows();
460 std::array<Eigen::MatrixXd, 2> dmat;
461 dmat[0] = Eigen::MatrixXd::Zero(nao, nao);
462 dmat[1] = Eigen::MatrixXd::Zero(nao, nao);
464 auto add_resonant = [&](
const Eigen::VectorXd& coeffs,
bool alpha_spin) {
465 if (coeffs.size() == 0) {
469 const Index vtotal = alpha_spin ? alpha_vtotal : beta_vtotal;
470 const Index ctotal = alpha_spin ? alpha_ctotal : beta_ctotal;
472 const auto& mos_spin =
476 const auto occlevels = mos_spin.middleCols(
bse_vmin_, vtotal);
477 const auto virtlevels = mos_spin.middleCols(lumo, ctotal);
479 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(), ctotal,
482 dmat[0] += occlevels * (mat.transpose() * mat) * occlevels.transpose();
483 dmat[1] += virtlevels * (mat * mat.transpose()) * virtlevels.transpose();
486 auto subtract_antiresonant = [&](
const Eigen::VectorXd& coeffs,
488 if (coeffs.size() == 0) {
492 const Index vtotal = alpha_spin ? alpha_vtotal : beta_vtotal;
493 const Index ctotal = alpha_spin ? alpha_ctotal : beta_ctotal;
495 const auto& mos_spin =
499 const auto occlevels = mos_spin.middleCols(
bse_vmin_, vtotal);
500 const auto virtlevels = mos_spin.middleCols(lumo, ctotal);
502 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(), ctotal,
508 dmat[0] -= virtlevels * (mat * mat.transpose()) * virtlevels.transpose();
509 dmat[1] -= occlevels * (mat.transpose() * mat) * occlevels.transpose();
512 const Eigen::VectorXd Xstate = X.col(state.
StateIdx());
513 add_resonant(Xstate.head(alpha_size),
true);
514 add_resonant(Xstate.tail(beta_size),
false);
517 const Eigen::MatrixXd& Y =
BSE_uks_.eigenvectors2();
518 if (Y.cols() < state.
StateIdx() + 1 || Y.rows() != X.rows()) {
519 throw std::runtime_error(
520 "Orbitals object has inconsistent anti-resonant ExcitonUKS "
521 "coefficients for state:" +
525 const Eigen::VectorXd Ystate = Y.col(state.
StateIdx());
526 subtract_antiresonant(Ystate.head(alpha_size),
true);
527 subtract_antiresonant(Ystate.tail(beta_size),
false);
534 throw std::runtime_error(
535 "DensityMatrixExcitedState not implemented for open-shell systems "
536 "except ExcitonUKS.");
541 std::array<Eigen::MatrixXd, 2> dmat_AR =
543 dmat[0] -= dmat_AR[0];
544 dmat[1] -= dmat_AR[1];
554 throw std::runtime_error(
555 "Spin type not known for density matrix. Available are singlet and "
562 if (BSECoefs.cols() < state.
StateIdx() + 1 || BSECoefs.rows() < 2) {
563 throw std::runtime_error(
"Orbitals object has no information about state:" +
578 Eigen::VectorXd coeffs = BSECoefs.col(state.
StateIdx());
580 std::array<Eigen::MatrixXd, 2> dmatEX;
584 dmatEX[0] = occlevels *
CalcAuxMat_vv(coeffs) * occlevels.transpose();
588 dmatEX[1] = virtlevels *
CalcAuxMat_cc(coeffs) * virtlevels.transpose();
594 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
596 return mat.transpose() * mat;
600 const Eigen::Map<const Eigen::MatrixXd> mat(coeffs.data(),
bse_ctotal_,
602 return mat * mat.transpose();
609 throw std::runtime_error(
610 "Spin type not known for density matrix. Available are singlet and "
617 if (BSECoefs_AR.cols() < state.
StateIdx() + 1 || BSECoefs_AR.rows() < 2) {
618 throw std::runtime_error(
"Orbitals object has no information about state:" +
644 Eigen::VectorXd coeffs = BSECoefs_AR.col(state.
StateIdx());
646 std::array<Eigen::MatrixXd, 2> dmatAR;
649 dmatAR[0] = virtlevels *
CalcAuxMat_cc(coeffs) * virtlevels.transpose();
652 dmatAR[1] = occlevels *
CalcAuxMat_vv(coeffs) * occlevels.transpose();
670 throw std::runtime_error(
671 "Orbitals::Oscillatorstrengths only implemented for "
672 "restricted singlets and combined UKS excitons.");
680 Eigen::VectorXd oscs = Eigen::VectorXd::Zero(size);
681 for (
Index i = 0; i < size; ++i) {
703 throw std::runtime_error(
704 "Total Energy does not exist for transition state");
709 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
711 " which has not been calculated");
716 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
718 " which has not been calculated");
723 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
725 " which has not been calculated");
730 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
732 " which has not been calculated");
737 throw std::runtime_error(
"Orbitals::getTotalEnergy You want " +
739 " which has not been calculated");
744 throw std::runtime_error(
745 "Orbitals::getTotalEnergy You want " + state.
ToString() +
746 " which is a LMO for virtual orbitals. Not implemented.");
750 throw std::runtime_error(
751 "GetTotalEnergy only knows states:singlet,triplet,KS,DQP,PQP,LMOs");
761 dft_dipole.
Fill(basis);
764 std::array<Eigen::MatrixXd, 3> interlevel_dipoles;
768 for (
Index i = 0; i < 3; i++) {
769 interlevel_dipoles[i] = empty.transpose() * dft_dipole.
Matrix()[i] * occ;
771 return interlevel_dipoles;
783 std::array<Eigen::MatrixXd, 3> interlevel_dipoles =
789 const double sqrt2 = std::sqrt(2.0);
791 for (
Index i_exc = 0; i_exc < numofstates; ++i_exc) {
792 Eigen::VectorXd coeffs =
BSE_singlet_.eigenvectors().col(i_exc);
799 Eigen::Vector3d tdipole = Eigen::Vector3d::Zero();
800 for (
Index i = 0; i < 3; ++i) {
801 tdipole[i] = mat.cwiseProduct(interlevel_dipoles[i]).sum();
814 throw std::runtime_error(
815 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS) requires "
816 "unrestricted alpha/beta orbitals.");
824 const Index alpha_size = alpha_vtotal * alpha_ctotal;
828 const Index beta_size = beta_vtotal * beta_ctotal;
830 if (alpha_vtotal < 0 || alpha_ctotal < 0 || beta_vtotal < 0 ||
832 throw std::runtime_error(
833 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS): "
834 "invalid UKS BSE window.");
839 dft_dipole.
Fill(basis);
841 std::array<Eigen::MatrixXd, 3> interlevel_dipoles_alpha;
842 std::array<Eigen::MatrixXd, 3> interlevel_dipoles_beta;
844 const Eigen::MatrixXd virt_alpha =
845 mos_.eigenvectors().middleCols(alpha_homo + 1, alpha_ctotal);
846 const Eigen::MatrixXd occ_alpha =
849 const Eigen::MatrixXd virt_beta =
850 mos_beta_.eigenvectors().middleCols(beta_homo + 1, beta_ctotal);
851 const Eigen::MatrixXd occ_beta =
854 for (
Index i = 0; i < 3; ++i) {
855 interlevel_dipoles_alpha[i] =
856 virt_alpha.transpose() * dft_dipole.
Matrix()[i] * occ_alpha;
857 interlevel_dipoles_beta[i] =
858 virt_beta.transpose() * dft_dipole.
Matrix()[i] * occ_beta;
864 for (
Index i_exc = 0; i_exc < numofstates; ++i_exc) {
865 Eigen::VectorXd coeffs_x =
BSE_uks_.eigenvectors().col(i_exc);
866 Eigen::VectorXd coeffs = coeffs_x;
868 coeffs +=
BSE_uks_.eigenvectors2().col(i_exc);
871 if (coeffs.size() != alpha_size + beta_size) {
872 throw std::runtime_error(
873 "Orbitals::CalcCoupledTransition_Dipoles(ExcitonUKS): "
874 "exciton vector size does not match alpha+beta sector sizes.");
877 Eigen::Map<const Eigen::MatrixXd> mat_alpha(coeffs.data(), alpha_ctotal,
879 Eigen::Map<const Eigen::MatrixXd> mat_beta(coeffs.data() + alpha_size,
880 beta_ctotal, beta_vtotal);
882 Eigen::Vector3d tdipole = Eigen::Vector3d::Zero();
883 for (
Index i = 0; i < 3; ++i) {
884 tdipole[i] = mat_alpha.cwiseProduct(interlevel_dipoles_alpha[i]).sum() +
885 mat_beta.cwiseProduct(interlevel_dipoles_beta[i]).sum();
896 throw std::runtime_error(
897 "Orbitals::CalcCoupledTransition_Dipoles only implemented for "
898 "restricted singlets and combined UKS excitons.");
905 for (
Index i = 0; i < size; ++i) {
908 for (
Index i = 0; i < size; ++i) {
917 std::vector<Index> index = std::vector<Index>(
mos_.eigenvalues().size());
918 std::iota(index.begin(), index.end(), 0);
919 std::stable_sort(index.begin(), index.end(), [
this](
Index i1,
Index i2) {
920 return this->MOs().eigenvalues()[i1] < this->MOs().eigenvalues()[i2];
926 std::vector<Index> index = std::vector<Index>(
mos_beta_.eigenvalues().size());
927 std::iota(index.begin(), index.end(), 0);
928 std::stable_sort(index.begin(), index.end(), [
this](
Index i1,
Index i2) {
929 return this->MOs_beta().eigenvalues()[i1] <
930 this->MOs_beta().eigenvalues()[i2];
939 for (
Index i = 0; i < size; ++i) {
942 for (
Index i = 0; i < size; ++i) {
951 for (
Index i = 0; i < size; ++i) {
954 for (
Index i = 0; i < size; ++i) {
974 throw std::runtime_error(
975 "PrepareDimerGuess currently supports only restricted orbitals.");
979 throw std::runtime_error(
980 "PrepareDimerGuess currently supports only closed-shell singlets.");
992 mos_.eigenvectors() = Eigen::MatrixXd::Zero(basisA + basisB, basisA + basisB);
997 throw std::runtime_error(
"Basissets of Orbitals A and B differ " +
1004 throw std::runtime_error(
"ECPs of Orbitals A and B differ " +
1022 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(
1160 atoms_.WriteToCpt(molgroup);
1191 w(tmp,
"use_Hqp_offdiag");
1192 std::uint8_t tmp_qsgw =
is_qsgw_ ? 1u : 0u;
1193 w(tmp_qsgw,
"is_qsgw");
1216 std::lock_guard<std::recursive_mutex> lock(
1240 r(version,
"version");
1242 auto r_optional = [&r](
auto& obj,
const std::string& key) {
1245 }
catch (std::runtime_error&) {
1252 atoms_.ReadFromCpt(molgroup);
1257 }
catch (std::runtime_error&
e) {
1265 }
catch (std::runtime_error&
e) {
1269 r(version,
"version");
1289 std::array<Index, 49> votcaOrder_old = {
1293 0, -1, 1, -2, 2, -3, 3,
1294 0, -1, 1, -2, 2, -3, 3, -4, 4,
1295 0, -1, 1, -2, 2, -3, 3, -4, 4,-5,5,
1296 0, -1, 1, -2, 2, -3, 3, -4, 4,-5,5,-6,6
1300 std::array<Index, 49> multiplier;
1308 std::string dft_basis_name;
1309 std::string aux_basis_name;
1310 r(dft_basis_name,
"dftbasis");
1311 r(aux_basis_name,
"auxbasis");
1326 }
catch (std::runtime_error&
e) {
1355 std::uint8_t tmp = 0;
1356 r(tmp,
"use_Hqp_offdiag");
1358 std::uint8_t tmp_qsgw = 0;
1360 r(tmp_qsgw,
"is_qsgw");
1397 throw std::runtime_error(
"Orbitals file does not contain MO coefficients");
1400 std::array<Eigen::MatrixXd, 2> result;
1401 result[0] = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
1402 mos_.eigenvectors().rows());
1403 result[1] = Eigen::MatrixXd::Zero(
mos_.eigenvectors().rows(),
1404 mos_.eigenvectors().rows());
1408 const Eigen::MatrixXd occ_a =
1410 result[0] = occ_a * occ_a.transpose();
1413 const Eigen::MatrixXd occ_b =
1415 result[1] = occ_b * occ_b.transpose();
1431 const Index n_docc = std::min(n_alpha, n_beta);
1432 const Index n_socc_alpha = n_alpha - n_docc;
1433 const Index n_socc_beta = n_beta - n_docc;
1436 const Eigen::MatrixXd docc =
mos_.eigenvectors().leftCols(n_docc);
1437 const Eigen::MatrixXd d_docc = docc * docc.transpose();
1438 result[0] += d_docc;
1439 result[1] += d_docc;
1442 if (n_socc_alpha > 0) {
1443 const Eigen::MatrixXd socc_a =
1444 mos_.eigenvectors().middleCols(n_docc, n_socc_alpha);
1445 result[0] += socc_a * socc_a.transpose();
1448 if (n_socc_beta > 0) {
1449 const Eigen::MatrixXd socc_b =
1450 mos_.eigenvectors().middleCols(n_docc + n_socc_alpha, n_socc_beta);
1451 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_
Index number_beta_electrons_
void CalcCoupledTransition_Dipoles()
Index getCharge() const
Return the stored total charge.
Eigen::MatrixXd occupations_
Eigen::VectorXd rpa_inputenergies_
Index getHomo() const
Return the default HOMO index used by spin-agnostic callers.
Eigen::VectorXd BSE_uks_energies_dynamic_
Eigen::MatrixXd TransitionDensityMatrix(const QMState &state) const
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_
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_
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::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::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
void PrepareDimerGuessMixedSpin(const Orbitals &orbitalsA, const Orbitals &orbitalsB)
Guess for a dimer of two monomers with independently ARBITRARY charge and spin, built by combining ea...
void SetupAuxBasis(std::string aux_basis_name)
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.
Eigen::MatrixXd DensityMatrixQuasiParticle(const QMState &state) const
Build the AO density matrix for a quasiparticle state.
Index getBasisSetSize() const
Return the number of AO basis functions in the DFT basis.
std::vector< Index > SortEnergiesBeta()
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.
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.