28#ifndef _chemistry_qc_nbody_ref_h
29#define _chemistry_qc_nbody_ref_h
31#include <chemistry/qc/wfn/wfn.h>
32#include <chemistry/qc/scf/scf.h>
33#include <chemistry/qc/lcao/wfnworld.h>
34#include <chemistry/qc/wfn/orbitalspace.h>
35#include <chemistry/qc/wfn/spin.h>
68 const std::vector<double>& occs,
69 const std::vector<ParticleHoleOrbitalAttributes>& active,
71 bool eorder_increasing =
true,
209 bool use_world_df =
false);
224 const Ref<Integral>& integral()
const {
return integral_; }
250 virtual int dk()
const =0;
318 bool use_world_dfinfo_;
323 virtual void _set_desired_value_accuracy(
double eps) =0;
385 bool spin_restricted =
true,
386 unsigned int nfzc = 0,
387 unsigned int nfzv = 0,
389 std::string occ_orbs = std::string(
"canonical"));
400 const Ref<OrbitalSpace>& vir_space()
const {
return vir_space_; }
402 if (vir_space_)
return vir_space_->basis();
403 else return this->basis();
406 double energy() {
return obwfn()->energy(); }
412 bool spin_restricted()
const {
return spin_restricted_; }
413 int dk()
const {
return obwfn()->dk(); }
417 unsigned int nfzc()
const {
return nfzc_; }
418 unsigned int nfzv()
const {
return nfzv_; }
421 const std::string& occ_orbitals()
const {
return occ_orbitals_; }
425 bool spin_restricted_;
426 std::string occ_orbitals_;
430 void init_spaces_restricted();
431 void init_spaces_unrestricted();
432 void _set_desired_value_accuracy(
double eps) { obwfn_->set_desired_value_accuracy(eps); }
457 const std::vector<unsigned int>& orbsymm,
461 unsigned int nfzc = 0,
462 unsigned int nfzv = 0,
463 bool omit_uocc =
false);
486 const std::vector<unsigned int>& orbsymm,
489 std::vector<unsigned int> occpi,
490 std::vector<unsigned int> fzcpi,
491 std::vector<unsigned int> fzvpi,
492 std::vector<unsigned int> holepi = std::vector<unsigned int>(),
493 std::vector<unsigned int> partpi = std::vector<unsigned int>(),
494 bool omit_uocc =
false);
509 bool spin_polarized()
const {
return rdm_[Alpha] != rdm_[Beta]; }
511 bool spin_restricted()
const {
return true; }
513 int dk()
const {
return 0; }
517 unsigned int nfzc()
const {
return nfzc_; }
518 unsigned int nfzv()
const {
return nfzv_; }
519 bool omit_uocc()
const {
return omit_uocc_; }
520 bool ordm_idempotent()
const {
return ordm_idempotent_; }
522 RefSymmSCMatrix rdm_[NSpinCases1];
525 unsigned int nelectron_;
526 unsigned int magmom_;
528 mutable bool ordm_idempotent_;
531 const std::vector<unsigned int>& orbsym,
532 std::vector<unsigned int> occpi,
533 std::vector<unsigned int> fzcpi,
534 std::vector<unsigned int> fzvpi,
535 std::vector<unsigned int> holepi,
536 std::vector<unsigned int> partpi);
538 void init_spaces() {
throw sc::ProgrammingError(
"For Extern_RefWavefunction, spaces must be init-ed in constructor");}
541 void init_spaces(
const RefSCMatrix&
orbs,
542 const std::vector<unsigned int>& orbsym,
543 std::vector<unsigned int> occpi,
544 std::vector<unsigned int> fzcpi,
545 std::vector<unsigned int> fzvpi,
546 std::vector<unsigned int> holepi,
547 std::vector<unsigned int> partpi);
548 void _set_desired_value_accuracy(
double eps) {
552 Ref<DensityFittingInfo> dfinfo()
const;
560 bool spin_restricted =
true,
561 unsigned int nfzc = 0,
562 unsigned int nfzv = 0,
static std::ostream & out0()
Return an ostream that writes from node 0.
RefWavefunction specialization that is not an adaptor to a Wavefunction object.
Definition ref.h:437
void print(std::ostream &os=ExEnv::out0()) const
Print the object.
Extern_RefWavefunction(const Ref< WavefunctionWorld > &world, const Ref< GaussianBasisSet > &basis, const Ref< Integral > &integral, const RefSCMatrix &orbs, const std::vector< unsigned int > &orbsymm, const RefSymmSCMatrix &alpha_1rdm, const RefSymmSCMatrix &beta_1rdm, unsigned int nocc, unsigned int nfzc=0, unsigned int nfzv=0, bool omit_uocc=false)
Constructs Extern_RefWavefunction using the MO-basis 1-RDMs + MO coefficients (same for alpha and bet...
RefSymmSCMatrix ordm(SpinCase1 spin) const
return the AO basis density
Definition ref.h:498
double desired_value_accuracy() const
Definition ref.h:507
bool sdref() const
is this a single-determinantal reference?
double energy()
Definition ref.h:505
double magnetic_moment() const
int nelectron() const
Definition ref.h:508
RefSymmSCMatrix core_hamiltonian_for_basis(const Ref< GaussianBasisSet > &basis, const Ref< GaussianBasisSet > &p_basis)
Returns the SO core Hamiltonian in the given basis and momentum basis.
void obsolete()
obsoletes this object
int dk() const
reimplements RefWavefunction::dk(). Currently only nonrelativistic references are supported.
Definition ref.h:513
Ref< GaussianBasisSet > momentum_basis() const
Definition ref.h:514
double actual_value_accuracy() const
Return the accuracy with which the value has been computed.
Definition ref.h:506
Extern_RefWavefunction(const Ref< WavefunctionWorld > &world, const Ref< GaussianBasisSet > &basis, const Ref< Integral > &integral, const RefSCMatrix &orbs, const std::vector< unsigned int > &orbsymm, const RefSymmSCMatrix &alpha_1rdm, const RefSymmSCMatrix &beta_1rdm, std::vector< unsigned int > occpi, std::vector< unsigned int > fzcpi, std::vector< unsigned int > fzvpi, std::vector< unsigned int > holepi=std::vector< unsigned int >(), std::vector< unsigned int > partpi=std::vector< unsigned int >(), bool omit_uocc=false)
Constructs Extern_RefWavefunction using the orbital coefficients and 1-RDM matrices(same for alpha an...
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
PopulatedOrbitalSpace is an OrbitalSpace populated with a density.
Definition ref.h:48
const Ref< OrbitalSpace > & uocc_act_sb() const
Definition ref.h:116
const Ref< OrbitalSpace > & occ_act() const
Definition ref.h:106
static double zero_occupancy()
an orbital is occupied if its occupancy is greater than this
Definition ref.h:80
PopulatedOrbitalSpace(const Ref< OrbitalSpaceRegistry > &oreg, SpinCase1 spin, const Ref< GaussianBasisSet > &bs, const Ref< Integral > &integral, const RefSCMatrix &coefs, const std::vector< double > &occs, const std::vector< ParticleHoleOrbitalAttributes > &active, const RefDiagSCMatrix &energies, bool eorder_increasing=true, Ref< OrbitalSpace > vbs=0, Ref< FockBuildRuntime > fbrun=0)
const Ref< OrbitalSpace > & occ() const
Definition ref.h:102
const Ref< OrbitalSpace > & uocc_sb() const
Definition ref.h:112
const Ref< OrbitalSpace > & uocc() const
Definition ref.h:114
const Ref< OrbitalSpaceRegistry > & orbital_registry() const
Definition ref.h:87
const Ref< OrbitalSpace > & occ_frz() const
Definition ref.h:110
const Ref< OrbitalSpace > & occ_act_sb() const
Definition ref.h:104
const Ref< OrbitalSpace > & orbs_sb() const
Definition ref.h:96
const Ref< OrbitalSpace > & occ_frz_sb() const
Definition ref.h:108
const Ref< OrbitalSpace > & occ_sb() const
Definition ref.h:100
void save_data_state(StateOut &so)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
const Ref< OrbitalSpace > & orbs() const
Definition ref.h:98
const Ref< OrbitalSpace > & uocc_act() const
Definition ref.h:118
This is thrown when a situations arises that should be impossible.
Definition scexception.h:92
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition matrix.h:389
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:265
RefWavefunction represents the reference wave function (or, more generally, a state) used as a starti...
Definition ref.h:159
bool spin_polarized() const
Definition ref.h:246
virtual const Ref< GaussianBasisSet > & uocc_basis() const
returns the basis supporting unoccupied orbitals. The defauls is same as returned by basis().
Definition ref.h:226
const Ref< OrbitalSpace > & occ_frz_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmery-blocked frozen occupied MOs of the given spin.
virtual int dk() const =0
virtual void print(std::ostream &os=ExEnv::out0()) const =0
Print the object.
virtual Ref< DensityFittingInfo > dfinfo() const =0
which DensityFittingRuntime used to compute this reference wave function
const Ref< OrbitalSpace > & valence_orbs() const
This OrbitalSpace defines valence orbitals.
virtual double actual_value_accuracy() const =0
Return the accuracy with which the value has been computed.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
virtual int nelectron() const =0
const Ref< OrbitalSpace > & uocc_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmetry-blocked unoccupied (virtual) MOs of the given spin.
void init() const
initializes the object
const Ref< OrbitalSpace > & occ_act_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmery-blocked active occupied MOs of the given spin.
const Ref< OrbitalSpace > & uocc_act_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmetry-blocked active unoccupied (virtual) MOs of the given spin.
virtual RefSymmSCMatrix ordm_orbs_sb(SpinCase1 spin) const
return the density in the orbs_sb() space
virtual void purge()
purges the data from this object
RefWavefunction(const Ref< WavefunctionWorld > &world, const Ref< GaussianBasisSet > &basis, const Ref< Integral > &integral, bool use_world_df=false)
const Ref< OrbitalSpace > & occ_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmery-blocked occupied MOs of the given spin.
virtual bool desired_value_accuracy_set_to_default() const
virtual Ref< GaussianBasisSet > momentum_basis() const =0
virtual double magnetic_moment() const =0
virtual RefSymmSCMatrix core_hamiltonian_for_basis(const Ref< GaussianBasisSet > &basis, const Ref< GaussianBasisSet > &p_basis)=0
Returns the SO core Hamiltonian in the given basis and momentum basis.
void set_desired_value_accuracy(double)
Set the accuracy to which the value is to be computed.
virtual void init_spaces()=0
initialize OrbitalSpace objects
const Ref< OrbitalSpace > & occ_act(SpinCase1 spin=AnySpinCase1) const
Return the space of active occupied MOs of the given spin.
const Ref< OrbitalSpace > & uocc_act(SpinCase1 spin=AnySpinCase1) const
Return the space of active unoccupied (virtual) MOs of the given spin.
const Ref< OrbitalSpace > & orbs(SpinCase1 spin=AnySpinCase1) const
Return the space of energy-sorted MOs of the given spin.
const Ref< OrbitalSpace > & orbs_sb(SpinCase1 spin=AnySpinCase1) const
Return the space of symmetry-blocked MOs of the given spin.
virtual void reset()
calling this will cause the object to be re-initialized next time it is used
const Ref< OrbitalSpace > & oso_space() const
Returns the space of symmetry-blocked orthogonal SOs (spans the entire space of the basis)
const Ref< OrbitalSpace > & occ_frz(SpinCase1 spin=AnySpinCase1) const
Return the space of frozen occupied MOs of the given spin.
virtual RefSymmSCMatrix ordm(SpinCase1 spin) const =0
return the AO basis density
virtual RefSymmSCMatrix ordm_occ_sb(SpinCase1 spin) const
return the density in the occ_sb() space
virtual double energy()=0
const Ref< OrbitalSpace > & uocc(SpinCase1 spin=AnySpinCase1) const
Return the space of unoccupied (virtual) MOs of the given spin.
virtual double desired_value_accuracy() const =0
virtual bool sdref() const =0
is this a single-determinantal reference?
bool force_average_AB_rdm1_
For spin-free algorithms, if this is true, we would set both alpha/beta 1-rdm to the average of them;...
Definition ref.h:305
const Ref< OrbitalSpace > & occ(SpinCase1 spin=AnySpinCase1) const
Return the space of occupied MOs of the given spin.
bool use_world_dfinfo() const
if true, override density fitting settings of RefWavefunction objects with those of WavefunctionWorld...
Definition ref.h:165
virtual void obsolete()
obsoletes this object
RefWavefunction(const Ref< KeyVal > &kv)
A KeyVal constructor is used to generate a RefWavefunction object from a KeyVal object.
A template class that maintains references counts.
Definition ref.h:361
RefWavefunction specialization for a single-determinant wave function.
Definition ref.h:328
int dk() const
Definition ref.h:413
void print(std::ostream &os=ExEnv::out0()) const
Print the object.
const Ref< GaussianBasisSet > & uocc_basis() const
returns the basis supporting unoccupied orbitals. The defauls is same as returned by basis().
Definition ref.h:401
bool desired_value_accuracy_set_to_default() const
Definition ref.h:409
double desired_value_accuracy() const
Definition ref.h:408
Ref< GaussianBasisSet > momentum_basis() const
Definition ref.h:414
double magnetic_moment() const
Definition ref.h:411
RefSymmSCMatrix ordm(SpinCase1 spin) const
return the AO basis density
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Ref< DensityFittingInfo > dfinfo() const
which DensityFittingRuntime used to compute this reference wave function
double actual_value_accuracy() const
Return the accuracy with which the value has been computed.
Definition ref.h:407
int nelectron() const
Definition ref.h:410
double energy()
Definition ref.h:406
bool sdref() const
is this a single-determinantal reference?
Definition ref.h:398
SD_RefWavefunction(const Ref< KeyVal > &kv)
A KeyVal constructor is used to generate a SD_RefWavefunction object from a KeyVal object.
RefSymmSCMatrix core_hamiltonian_for_basis(const Ref< GaussianBasisSet > &basis, const Ref< GaussianBasisSet > &p_basis)
Returns the SO core Hamiltonian in the given basis and momentum basis.
void purge()
purges the data from this object
SD_RefWavefunction(const Ref< WavefunctionWorld > &world, const Ref< OneBodyWavefunction > &obwfn, bool spin_restricted=true, unsigned int nfzc=0, unsigned int nfzv=0, Ref< OrbitalSpace > vir_space=0, std::string occ_orbs=std::string("canonical"))
construct from a OneBodyWavefunction object
Base class for objects that can save/restore state.
Definition state.h:45
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Ref< OrbitalSpace > compute_canonvir_space(const Ref< FockBuildRuntime > &fb_rtime, const Ref< OrbitalSpace > &A, SpinCase1 spin)
canonicalize A
void remove_ao_space(const Ref< GaussianBasisSet > &bs, const Ref< AOSpaceRegistry > &aoreg, const Ref< OrbitalSpaceRegistry > oreg)
undo the effect of add_ao_space()
void add_ao_space(const Ref< GaussianBasisSet > &bs, const Ref< Integral > &ints, const Ref< AOSpaceRegistry > &aoreg, const Ref< OrbitalSpaceRegistry > oreg)
construct and add an AO space to aoreg and oreg
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
This factory produces the RefWavefunction that corresponds to the type of ref object.
Definition ref.h:556