22#ifndef VOTCA_XTP_ORBITALS_H
23#define VOTCA_XTP_ORBITALS_H
54 return (
dftbasis_.AOBasisSize() > 0) ? true :
false;
185 bool hasMOs()
const {
return (
mos_.eigenvalues().size() > 0) ? true :
false; }
188 return (
mos_beta_.eigenvalues().size() > 0) ? true :
false;
210 double energy_difference)
const;
214 switch (type.
Type()) {
269 this->
QMAtoms()[atom_index].setPos(new_position);
300 return (!
dftbasis_.Name().empty()) ? true :
false;
316 throw std::runtime_error(
317 "Requested the DFT basis, but no basis is present. Make sure "
318 "SetupDftBasis is called.");
327 throw std::runtime_error(
328 "Requested the Aux basis, but no basis is present. Make sure "
329 "SetupAuxBasis is called.");
343 return (!
auxbasis_.Name().empty()) ? true :
false;
451 return (
QPdiag_.eigenvalues().size() > 0) ? true :
false;
460 return (
BSE_triplet_.eigenvectors().cols() > 0) ? true :
false;
473 return (
BSE_singlet_.eigenvectors().cols() > 0) ? true :
false;
578 void WriteToCpt(
const std::string &filename)
const;
688 return (
BSE_uks_.eigenvectors().cols() > 0) ? true :
false;
715 Eigen::MatrixXd
CalcAuxMat_cc(
const Eigen::VectorXd &coeffs)
const;
716 Eigen::MatrixXd
CalcAuxMat_vv(
const Eigen::VectorXd &coeffs)
const;
Container to hold Basisfunctions for all atoms.
Container for molecular orbitals and derived one-particle data.
tools::EigenSystem QPdiag_alpha_
Index getBSEvmax() const
Return the highest valence orbital included in BSE.
const Eigen::MatrixXd getTruncMOsFullBasis() const
Return truncated active-region orbitals represented in the full AO basis.
void setScaHFX(double ScaHFX)
Store the fraction of exact exchange associated with the functional.
const Eigen::VectorXd & BSEUKS_dynamic() const
void setCalculationType(std::string CalcType)
Store the calculation-type tag used by downstream workflows.
Eigen::VectorXd & RPAInputEnergiesBeta()
const tools::EigenSystem & BSETriplets() const
Return read-only access to triplet BSE eigenpairs.
bool GetFlagUseHqpOffdiag() const
Index getNumOfActiveElectrons()
Return the number of electrons assigned to the active region.
Index number_beta_electrons_
void CalcCoupledTransition_Dipoles()
Index getCharge() const
Return the stored total charge.
Eigen::MatrixXd occupations_
bool hasQPpertAlpha() const
Index getBSEcmin() const
Return the lowest conduction orbital included in BSE.
bool hasRPAindices() const
Report whether the RPA window has been defined.
Eigen::VectorXd rpa_inputenergies_
const tools::EigenSystem & QPdiag() const
Return read-only access to the diagonalized quasiparticle representation.
Index getHomo() const
Return the default HOMO index used by spin-agnostic callers.
Eigen::MatrixXd & QPpertEnergiesBeta()
Eigen::VectorXd BSE_uks_energies_dynamic_
Eigen::MatrixXd TransitionDensityMatrix(const QMState &state) const
double getDFTTotalEnergy() const
Return the stored total DFT energy.
bool hasBSESinglets_dynamic() const
Report whether dynamically screened singlet BSE energies are available.
void setInactiveDensity(Eigen::MatrixXd inactivedensity)
Store the inactive-region density matrix used in embedding workflows.
Eigen::VectorXd & BSEUKS_dynamic()
bool hasBSEindices() const
Report whether the BSE valence/conduction window has been defined.
bool hasAuxbasisName() const
Report whether an auxiliary basis-set name has been stored.
Index getSpin() const
Return the stored spin multiplicity.
Eigen::MatrixXd CalculateQParticleAORepresentation() const
Transform quasiparticle amplitudes into the AO representation.
Eigen::MatrixXd & QPpertEnergiesAlpha()
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.
void setNumofActiveElectrons(const Index active_electrons)
Store the number of electrons assigned to the active region.
bool hasUnrestrictedOrbitals() const
Report whether separate beta-spin orbitals are present.
Eigen::VectorXd lmos_energies_
const tools::EigenSystem & BSESinglets() const
Return read-only access to singlet BSE eigenpairs.
Index getBSEcmax() const
Return the highest conduction orbital included in BSE.
Eigen::VectorXd & BSESinglets_dynamic()
Return writable access to dynamically screened singlet BSE energies.
const Eigen::VectorXd & QPpertEnergies() const
Return read-only access to perturbative quasiparticle energies.
bool getTDAApprox() const
Return whether the Tamm-Dancoff approximation is enabled.
tools::EigenSystem BSE_singlet_
tools::EigenSystem QPdiag_beta_
void PrepareDimerGuess(const Orbitals &orbitalsA, const Orbitals &orbitalsB)
Guess for a dimer based on monomer orbitals.
bool hasNumberOfLevelsBeta() const
tools::EigenSystem mos_beta_
tools::EigenSystem & QPdiagAlpha()
std::string grid_quality_
bool hasMOs() const
Report whether alpha/restricted molecular orbitals are available.
void setTruncMOsFullBasis(const Eigen::MatrixXd &expandedMOs)
Store truncated active-region orbitals expanded back to the full AO basis.
bool hasBSESinglets() const
Report whether singlet BSE eigenpairs 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 hasQPpertBeta() const
const Eigen::MatrixXd & Occupations() const
Return the stored fractional occupation matrix.
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
tools::EigenSystem & QPdiagBeta()
bool hasRPAInputEnergies() const
Report whether RPA input energies are available.
bool isRestrictedOpenShell() const
Report whether the orbitals represent a restricted open-shell reference.
std::vector< Index > CheckDegeneracy(Index level, double energy_difference) const
tools::EigenSystem & BSETriplets()
Return writable access to triplet BSE eigenpairs.
const AOBasis & getAuxBasis() const
Return the auxiliary AO basis, throwing if it has not been initialized.
Eigen::MatrixXd inactivedensity_
Index getNumberOfAlphaElectrons() const
Return the stored number of alpha electrons.
void setLMOs_energies(const Eigen::VectorXd &energies)
Store the energies associated with localized molecular orbitals.
std::string getCalculationType() const
Return the stored calculation-type tag.
bool hasQMAtoms() const
Report whether a molecular geometry has been stored.
std::array< Eigen::MatrixXd, 3 > CalcFreeTransition_Dipoles() const
void setLMOs(const Eigen::MatrixXd &matrix)
Store localized molecular orbitals.
bool hasNumberOfBetaElectrons() const
Report whether the beta-electron count has been set explicitly.
const std::string & getQMpackage() const
Return the stored QM package name.
QMMolecule & QMAtoms()
Return writable access to the molecular geometry.
const Eigen::MatrixXd & QPpertEnergiesBeta() const
Eigen::MatrixXd CalcAuxMat_cc(const Eigen::VectorXd &coeffs) const
void setRPAindices(Index rpamin, Index rpamax)
Store the orbital window used in RPA calculations.
bool hasNumberOfLevels() const
Report whether the number of occupied spatial orbitals has been set.
Eigen::MatrixXd expandedMOs_
void setNumberOfAlphaElectrons(Index electrons)
Store the total number of alpha electrons.
Index getBSEvmin() const
Return the lowest valence orbital included in BSE.
void updateAtomPostion(Index atom_index, Eigen::Vector3d new_position)
Update one atomic position and keep attached AO basis shells synchronized.
const tools::EigenSystem & BSEUKS() const
Eigen::VectorXd & RPAInputEnergies()
Return writable access to the RPA input energies.
Eigen::VectorXd Oscillatorstrengths() const
std::vector< Eigen::Vector3d > transition_dipoles_
const tools::EigenSystem & QPdiagAlpha() const
static constexpr int orbitals_version()
std::string functionalname_
Eigen::MatrixXd & Occupations()
Return writable access to the fractional occupation matrix.
Eigen::MatrixXd DensityMatrixWithoutGS(const QMState &state) const
bool hasGWAindices() const
Report whether the GW quasiparticle window has been defined.
tools::EigenSystem & MOs()
Return writable access to alpha/restricted molecular orbitals.
bool hasQMEnergy() const
Report whether a total electronic energy has been stored.
Eigen::MatrixXd DensityMatrixFull(const QMState &state) const
bool hasTransitionDipoles() const
Report whether transition dipole moments have been computed.
const Eigen::MatrixXd & getLMOs() const
Return localized molecular orbitals, if available.
Eigen::MatrixXd CalcAuxMat_vv(const Eigen::VectorXd &coeffs) const
tools::EigenSystem & MOs_beta()
Return writable access to beta-spin molecular orbitals.
tools::EigenSystem & QPdiag()
Return writable access to the diagonalized quasiparticle representation.
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_
Index getRPAmax() const
Return the upper RPA orbital index.
void setBSEindices(Index vmin, Index cmax)
bool hasBasisSetSize() const
Report whether a DFT AO basis has already been attached.
const Eigen::MatrixXd & getInactiveDensity() const
Return the inactive-region density matrix used in embedding workflows.
void setGWindices(Index qpmin, Index qpmax)
Store the orbital window used in GW calculations.
std::vector< Index > SortEnergies()
Index getHomoBeta() const
Return the beta-spin HOMO index.
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState_AR(const QMState &state) const
bool hasQMpackage() const
Report whether the originating QM package name has been stored.
double getExcitedStateEnergy(const QMState &state) const
Return the excitation energy of the requested state in Hartree.
bool isUnrestrictedOpenShell() const
tools::EigenSystem & BSESinglets()
Return writable access to singlet BSE eigenpairs.
bool hasRPAInputEnergiesBeta() const
void setECPName(const std::string &ECP)
Store the effective core potential label.
void setXCGrid(std::string grid)
Store the numerical XC grid quality label.
void setNumberOfOccupiedLevels(Index occupied_levels)
const std::vector< Eigen::Vector3d > & TransitionDipoles() const
Return the stored transition dipole moments.
Index occupied_levels_beta_
Orbitals()
Construct an empty orbital container with default metadata.
tools::EigenSystem QPdiag_
Eigen::VectorXd rpa_inputenergies_beta_
const Eigen::MatrixXd & QPpertEnergiesAlpha() const
bool hasBSETriplets() const
Report whether triplet BSE eigenpairs are available.
Eigen::MatrixXd DensityMatrixKSstate(const QMState &state) const
Build the AO density matrix for a single KS orbital state.
bool hasBSETriplets_dynamic() const
Report whether dynamically screened triplet BSE energies are available.
const std::string getAuxbasisName() const
Return the auxiliary basis-set name.
Eigen::MatrixXd DensityMatrixQuasiParticle(const QMState &state) const
Build the AO density matrix for a quasiparticle state.
bool hasQPpert() const
Report whether perturbative quasiparticle energies are available.
double getScaHFX() const
Return the fraction of exact exchange associated with the functional.
Index getBasisSetSize() const
Return the number of AO basis functions in the DFT basis.
void setQMEnergy(double qmenergy)
Store the total DFT energy.
const Eigen::VectorXd & RPAInputEnergies() const
Return read-only access to the RPA input energies.
Eigen::VectorXd & RPAInputEnergiesAlpha()
Eigen::MatrixXd QPpert_energies_alpha_
const std::string & getXCGrid() const
Return the numerical XC grid quality label.
Eigen::VectorXd BSE_singlet_energies_dynamic_
Index getGWAmin() const
Return the lower GW orbital index.
bool hasRPAInputEnergiesAlpha() const
Eigen::VectorXd & QPpertEnergies()
Return writable access to perturbative quasiparticle energies.
bool hasECPName() const
Report whether an effective core potential label has been stored.
const Eigen::VectorXd & BSETriplets_dynamic() const
Return dynamically screened triplet BSE energies.
const tools::EigenSystem & MOs() const
Return read-only access to alpha/restricted molecular orbitals.
void setQMpackage(const std::string &qmpackage)
Store the name of the QM package that produced these orbitals.
Eigen::VectorXd & BSETriplets_dynamic()
Return writable access to dynamically screened triplet BSE energies.
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_
const std::string & getXCFunctionalName() const
Return the exchange-correlation functional label.
Eigen::VectorXd rpa_inputenergies_alpha_
bool hasQPdiagBeta() const
Index getGWAmax() const
Return the upper GW orbital index.
void SetFlagUseHqpOffdiag(bool flag)
void ReadFromCpt(const std::string &filename)
Read the orbital container from a checkpoint file on disk.
void setEmbeddedMOs(tools::EigenSystem &system)
Store molecular orbitals obtained from an embedding calculation.
tools::EigenSystem BSE_uks_
void setNumberOfOccupiedLevelsBeta(Index occupied_levels_beta)
Store the number of occupied beta-spin orbitals.
const tools::EigenSystem & QPdiagBeta() const
void setChargeAndSpin(Index charge, Index spin)
const Eigen::VectorXd & RPAInputEnergiesBeta() const
Eigen::VectorXd QPpert_energies_
void WriteToCpt(const std::string &filename) const
Write the orbital container to a checkpoint file on disk.
bool hasDFTbasisName() const
Report whether a DFT basis-set name has been stored.
const std::string & getECPName() const
Return the effective core potential label.
const std::string & getDFTbasisName() const
Return the DFT basis-set name.
bool hasBetaMOs() const
Report whether beta-spin molecular orbitals are available.
void SetupDftBasis(std::string basis_name)
Build and attach the DFT AO basis from the stored molecular geometry.
void setTDAApprox(bool usedTDA)
Enable or disable the Tamm-Dancoff approximation flag.
const Eigen::VectorXd & RPAInputEnergiesAlpha() const
tools::EigenSystem & BSEUKS()
std::array< Eigen::MatrixXd, 2 > DensityMatrixExcitedState(const QMState &state) const
Build separate hole and electron AO densities for an excited state.
bool isOpenShell() const
Report whether the stored state corresponds to an open-shell system.
const Eigen::VectorXd & BSESinglets_dynamic() const
Return dynamically screened singlet BSE energies.
Index number_alpha_electrons_
const tools::EigenSystem & getEmbeddedMOs() const
Return molecular orbitals obtained from an embedding calculation.
Index NumberofStates(QMStateType type) const
Return the number of states available for the requested state family.
Index getRPAmin() const
Return the lower RPA orbital index.
Eigen::Vector3d CalcElDipole(const QMState &state) const
Compute the electronic dipole moment associated with a state density.
Index getNumberOfBetaElectrons() const
Return the stored number of beta electrons.
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.
const Eigen::VectorXd & getLMOs_energies() const
Return the energies associated with localized molecular orbitals.
bool hasQPdiagAlpha() const
bool hasNumberOfAlphaElectrons() const
Report whether the alpha-electron count has been set explicitly.
Index getLumo() const
Return the default LUMO index used by spin-agnostic callers.
bool hasBSEUKS_dynamic() const
void setXCFunctionalName(std::string functionalname)
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Provides a means for comparing floating point numbers.