MADNESS 0.10.1
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
madness::SCF Class Reference

#include <SCF.h>

Collaboration diagram for madness::SCF:
Collaboration graph
[legend]

Public Member Functions

 SCF (World &world, const CalculationParameters &param, const Molecule &molecule, const PCMParameters &pcm_param=PCMParameters())
 collective constructor for SCF uses contents of file filename and broadcasts to all nodes
 
 SCF (World &world, const commandlineparser &parser)
 forwarding constructor
 
vecfuncT apply_bsh_macrotask (World &world, vecfuncT &Vpsi, const tensorT &eps, const CalculationParameters &param, long batch, bool redistribute)
 
vecfuncT apply_bsh_plain (World &world, vecfuncT &Vpsi, const tensorT &eps, const CalculationParameters &param)
 Single un-tiled apply (small systems / debugging). Consumes Vpsi.
 
vecfuncT apply_bsh_tiled (World &world, vecfuncT &Vpsi, const tensorT &eps, const CalculationParameters &param)
 
void apply_explicit_occupations (World &world)
 overwrite the leading occupation numbers with the explicit aocc/bocc input, if given
 
vecfuncT apply_potential (World &world, const tensorT &occ, const vecfuncT &amo, const functionT &vlocal, double &exc, double &enl, int ispin)
 
bool canonicalize_virtuals (World &world, tensorT &fock, vecfuncT &psi, vecfuncT &Vpsi, const int nocc, const bool force=false) const
 
vecfuncT compute_residual (World &world, tensorT &occ, tensorT &fock, const vecfuncT &psi, vecfuncT &Vpsi, double &err)
 
void copy_data (World &world, const SCF &other)
 
tensorT derivatives (World &world, const functionT &rho) const
 
tensorT diag_fock_matrix (World &world, tensorT &fock, vecfuncT &psi, vecfuncT &Vpsi, tensorT &evals, const tensorT &occ, const double thresh) const
 diagonalize the fock matrix, taking care of degenerate states
 
tensorT dipole (World &world, const functionT &rho) const
 compute the total dipole moment of the molecule
 
void do_plots (World &world)
 
double do_step_restriction (World &world, const vecfuncT &mo, vecfuncT &mo_new, std::string spin) const
 perform step restriction following the KAIN solver
 
const vecfuncT & get_amo () const
 getter for the molecular orbitals, alpha spin
 
const tensorT & get_aocc () const
 getter for the occupation numbers, alpha spin
 
const vecfuncT & get_bmo () const
 getter for the molecular orbitals, beta spin
 
const tensorT & get_bocc () const
 getter for the occupation numbers, alpha spin
 
tensorT get_fock_transformation (World &world, const tensorT &overlap, tensorT &fock, tensorT &evals, const tensorT &occ, const double thresh_degenerate) const
 compute the unitary transformation that diagonalizes the fock matrix
 
void get_initial_orbitals (World &world, RestartPlan &plan)
 carry out a restart plan: read the orbitals it names, or make a guess
 
std::vector< int > group_orbital_sets (World &world, const tensorT &eps, const tensorT &occ, const int nmo) const
 group orbitals into sets of similar orbital energies for localization
 
void initial_guess (World &world)
 
void initial_guess_ao_eigenvectors (World &world, tensorT &c, tensorT &e)
 
void initial_guess_from_nwchem (World &world)
 
void initial_load_bal (World &world)
 
bool is_spin_restricted () const
 
vecfuncT kain_combine (World &world, const subspaceT &subspace, const tensorT &c, const size_t lo, const size_t n) const
 KAIN: the updated orbitals lo..lo+n of the subspace's vectors for coefficients c.
 
tensorT kain_solve (World &world, const vecfuncT &vm, const vecfuncT &rm, subspaceT &subspace, tensorT &Q) const
 
void kain_trim (subspaceT &subspace, tensorT &Q) const
 KAIN: drop the oldest history entry once the subspace holds maxsub of them.
 
distmatT kinetic_energy_matrix (World &world, const vecfuncT &v) const
 
void load_mos (World &world, const bool allow_fewer=true)
 
void loadbal (World &world, functionT &arho, functionT &brho, functionT &arho_old, functionT &brho_old, subspaceT &subspace)
 
functionT make_coulomb_potential (const functionT &rho) const
 make the Coulomb potential given the total density
 
functionT make_density (World &world, const tensorT &occ, const cvecfuncT &v)
 
functionT make_density (World &world, const tensorT &occ, const vecfuncT &v) const
 
double make_dft_energy (World &world, const vecfuncT &vf, int ispin)
 
tensorT make_fock_matrix (World &world, const vecfuncT &psi, const vecfuncT &Vpsi, const tensorT &occ, double &ekinetic) const
 
void make_nuclear_potential (World &world)
 
void orthonormalize (World &world, vecfuncT &amo_new) const
 orthonormalize the vectors
 
void orthonormalize (World &world, vecfuncT &amo_new, int nocc) const
 orthonormalize the vectors (symmetric in occupied spaced, gramm-schmidt for virt to occ)
 
void output_calc_info_schema () const
 
void output_scf_info_schema (const std::map< std::string, double > &vals, const tensorT &dipole_T) const
 
bool pad_virtuals_from_guess (World &world)
 
void project (World &world)
 
vecfuncT project_ao_basis (World &world, const AtomicBasisSet &aobasis)
 
void reset_aobasis (const std::string &aobasisname)
 
bool restart_aos (World &world)
 
void rotate_subspace (World &world, const distmatT &U, subspaceT &subspace, int lo, int nfunc, double trantol) const
 
void rotate_subspace (World &world, const tensorT &U, subspaceT &subspace, int lo, int nfunc, double trantol) const
 
void save_mos (World &world)
 
void set_print_timings (const bool value)
 
template<std::size_t NDIM>
void set_protocol (World &world, double thresh)
 
void solve (World &world)
 
void solve_virtuals (World &world)
 
Tensor< double > twoint (World &world, const vecfuncT &psi) const
 Compute the two-electron integrals over the provided set of orbitals.
 
void update_subspace (World &world, vecfuncT &Vpsia, vecfuncT &Vpsib, tensorT &focka, tensorT &fockb, subspaceT &subspace, tensorT &Q, double &bsh_residual, double &update_residual)
 
void vector_stats (const std::vector< double > &v, double &rms, double &maxabsval) const
 

Static Public Member Functions

static void analyze_vectors (World &world, const vecfuncT &mo, const vecfuncT &ao, double vtol, const Molecule &molecule, const int print_level, const AtomicBasisSet &aobasis, const tensorT &occ=tensorT(), const tensorT &energy=tensorT(), const std::vector< int > &set=std::vector< int >())
 
static void help ()
 
static std::vector< poperatorT > make_bsh_operators (World &world, const tensorT &evals, const CalculationParameters &param)
 
static functionT make_lda_potential (World &world, const functionT &arho)
 
static void print_parameters ()
 
static vecfuncT project_ao_basis_only (World &world, const AtomicBasisSet &aobasis, const Molecule &molecule)
 

Public Attributes

tensorT aeps
 orbital energies for alpha and beta orbitals
 
vecfuncT amo
 alpha and beta molecular orbitals
 
vecfuncT ao
 MRA projection of the minimal basis set.
 
AtomicBasisSet aobasis
 
tensorT aocc
 occupation numbers for alpha and beta orbitals
 
std::vector< int > aset
 
std::vector< int > at_nbf
 
std::vector< int > at_to_bf
 
tensorT beps
 
vecfuncT bmo
 
tensorT bocc
 
std::vector< int > bset
 
double converged_for_dconv =1.e10
 mos are converged for this density
 
double converged_for_tconv =1.e10
 derivatives of mos are converged for this threshold
 
double converged_for_thresh =1.e10
 mos are converged for this threshold
 
poperatorT coulop
 
double current_energy
 
DispersionCorrection dispersion
 
scf_data e_data
 
std::vector< std::shared_ptr< real_derivative_3d > > gradop
 
std::shared_ptr< GTHPseudopotential< double > > gthpseudopotential
 
std::vector< long > localize_pivot_state_a
 cholesky localization's pivot order from the previous iteration (per spin)
 
std::vector< long > localize_pivot_state_b
 
functionT mask
 
Molecule molecule
 
CalculationParameters param
 
PCM pcm
 
PCMParameters pcm_param
 the pcm data group; inert unless param.pcm_data() is set
 
std::shared_ptr< PotentialManager > potentialmanager
 
std::string restart_ncf
 nuclear correlation factor behind restart_representation, e.g. "slater:2.0"
 
Representation restart_representation =Representation::mo
 
bool suppress_raw_gradient_print =false
 
double vtol
 
std::filesystem::path work_dir
 
XCfunctional xc
 

Constructor & Destructor Documentation

◆ SCF() [1/2]

madness::SCF::SCF ( World &  world,
const commandlineparser &  parser 
)
inline

forwarding constructor

References work_dir.

◆ SCF() [2/2]

madness::SCF::SCF ( World &  world,
const CalculationParameters &  param,
const Molecule &  molecule,
const PCMParameters &  pcm_param = PCMParameters() 
)

Member Function Documentation

◆ analyze_vectors()

void madness::SCF::analyze_vectors ( World &  world,
const vecfuncT &  mo,
const vecfuncT &  ao,
double  vtol,
const Molecule &  molecule,
const int  print_level,
const AtomicBasisSet &  aobasis,
const tensorT &  occ = tensorT(),
const tensorT &  energy = tensorT(),
const std::vector< int > &  set = std::vector<int>() 
)
static

◆ apply_bsh_macrotask()

vecfuncT madness::SCF::apply_bsh_macrotask ( World &  world,
vecfuncT &  Vpsi,
const tensorT &  eps,
const CalculationParameters &  param,
long  batch,
bool  redistribute 
)

◆ apply_bsh_plain()

vecfuncT madness::SCF::apply_bsh_plain ( World &  world,
vecfuncT &  Vpsi,
const tensorT &  eps,
const CalculationParameters &  param 
)

◆ apply_bsh_tiled()

vecfuncT madness::SCF::apply_bsh_tiled ( World &  world,
vecfuncT &  Vpsi,
const tensorT &  eps,
const CalculationParameters &  param 
)

◆ apply_explicit_occupations()

void madness::SCF::apply_explicit_occupations ( World &  world)

◆ apply_potential()

vecfuncT madness::SCF::apply_potential ( World &  world,
const tensorT &  occ,
const vecfuncT &  amo,
const functionT &  vlocal,
double &  exc,
double &  enl,
int  ispin 
)

◆ canonicalize_virtuals()

bool madness::SCF::canonicalize_virtuals ( World &  world,
tensorT &  fock,
vecfuncT &  psi,
vecfuncT &  Vpsi,
const int  nocc,
const bool  force = false 
) const

canonicalize the virtual orbitals: diagonalize the virtual-virtual Fock block and rotate psi, Vpsi and the occupied-virtual coupling in phase. Occupied orbitals are untouched. No-op when there are no virtuals or, unless forced, when the rotation is near-identity.

Parameters
[in]noccnumber of occupied orbitals; the block [nocc, nmo) is canonicalized
[in]forcerotate even when the rotation is near-identity (final publication)
Returns
true if a rotation was applied

References std::abs(), madness::WorldGopInterface::broadcast(), madness::copy(), madness::World::gop, madness::inner(), k, madness::matrix_inner(), madness::normalize(), param, madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, psi(), madness::Tensor< T >::ptr(), madness::World::rank(), madness::scale(), madness::BaseTensor::size(), madness::sygvp(), madness::transform(), madness::transpose(), madness::truncate(), v, and vtol.

Referenced by solve(), solve_virtuals(), and update_subspace().

◆ compute_residual()

vecfuncT madness::SCF::compute_residual ( World &  world,
tensorT &  occ,
tensorT &  fock,
const vecfuncT &  psi,
vecfuncT &  Vpsi,
double &  err 
)

◆ copy_data()

void madness::SCF::copy_data ( World &  world,
const SCF &  other 
)

◆ derivatives()

tensorT madness::SCF::derivatives ( World &  world,
const functionT &  rho 
) const

◆ diag_fock_matrix()

tensorT madness::SCF::diag_fock_matrix ( World &  world,
tensorT &  fock,
vecfuncT &  psi,
vecfuncT &  Vpsi,
tensorT &  evals,
const tensorT &  occ,
const double  thresh 
) const

diagonalize the fock matrix, taking care of degenerate states

Vpsi is passed in to make sure orbitals and Vpsi are in phase

Parameters
[in]worldthe world
[in,out]fockthe fock matrix (diagonal upon exit)
[in,out]psithe orbitals
[in,out]Vpsithe orbital times the potential
[out]evalsthe orbital energies
[in]occoccupation numbers
[in]threshthreshold for rotation and truncation
Returns
the unitary matrix U: U^T F U = evals

Vpsi is passed in to make sure orbitals and Vpsi are in phase

Parameters
[in]worldthe world
[in,out]fockthe fock matrix (diagonal upon exit)
[in,out]psithe orbitals
[in,out]Vpsithe orbital times the potential
[out]evalsthe orbital energies
[in]occoccupation numbers
[in]threshthreshold for rotation and truncation
Returns
the unitary matrix U: U^T F U = evals

References madness::BaseTensor::dim(), END_TIMER, get_fock_transformation(), madness::matrix_inner(), madness::CalculationParameters::nalpha(), madness::normalize(), param, PROFILE_MEMBER_FUNC, psi(), START_TIMER, thresh, madness::transform(), madness::truncate(), and vtol.

Referenced by solve().

◆ dipole()

tensorT madness::SCF::dipole ( World &  world,
const functionT &  rho 
) const

compute the total dipole moment of the molecule

Parameters
[in]rhothe total (alpha + beta) density
Returns
the x,y,z components of the el. + nucl. dipole moment

References axis, END_TIMER, molecule, mu, madness::Molecule::nuclear_dipole(), param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, madness::World::rank(), and START_TIMER.

Referenced by main(), and solve().

◆ do_plots()

void madness::SCF::do_plots ( World &  world)

◆ do_step_restriction()

double madness::SCF::do_step_restriction ( World &  world,
const vecfuncT &  mo,
vecfuncT &  mo_new,
std::string  spin 
) const

perform step restriction following the KAIN solver

undo the rotation from the KAIN solver if the rotation exceeds the maxrotn parameter

Parameters
[in]worldthe world
[in]movector of orbitals from previous iteration
[in,out]mo_newvector of orbitals from the KAIN solver
[in]spin"alpha" or "beta" for user information
Returns
max residual

Limit maximum step size to make convergence more robust

Parameters
[in]worldthe world
[in]movector of orbitals from previous iteration
[in,out]new_movector of orbitals from the KAIN solver
[in]spin"alpha" or "beta" for user information
Returns
max residual

References madness::WorldGopInterface::fence(), madness::World::gop, madness::CalculationParameters::maxrotn(), madness::mo, madness::norm2s(), param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, madness::World::rank(), madness::sub(), and vector_stats().

Referenced by solve_virtuals(), and update_subspace().

◆ get_amo()

const vecfuncT & madness::SCF::get_amo ( ) const
inline

getter for the molecular orbitals, alpha spin

References amo.

Referenced by madness::Coulomb< T, NDIM >::compute_density().

◆ get_aocc()

const tensorT & madness::SCF::get_aocc ( ) const
inline

getter for the occupation numbers, alpha spin

References aocc.

Referenced by madness::Coulomb< T, NDIM >::compute_density().

◆ get_bmo()

const vecfuncT & madness::SCF::get_bmo ( ) const
inline

getter for the molecular orbitals, beta spin

References bmo.

Referenced by madness::Coulomb< T, NDIM >::compute_density().

◆ get_bocc()

const tensorT & madness::SCF::get_bocc ( ) const
inline

getter for the occupation numbers, alpha spin

References bocc.

Referenced by madness::Coulomb< T, NDIM >::compute_density().

◆ get_fock_transformation()

tensorT madness::SCF::get_fock_transformation ( World &  world,
const tensorT &  overlap,
tensorT &  fock,
tensorT &  evals,
const tensorT &  occ,
const double  thresh_degenerate 
) const

compute the unitary transformation that diagonalizes the fock matrix

Parameters
[in]worldthe world
[in]overlapthe overlap matrix of the orbitals
[in,out]fockthe fock matrix; diagonal upon exit
[out]evalsthe orbital energies
[in]occthe occupation numbers
[in]thresh_degeneratethreshold for orbitals being degenerate
Returns
the unitary matrix U: U^T F U = evals
Parameters
[in]worldthe world
[in]overlapthe overlap matrix of the orbitals
[in,out]fockthe fock matrix; diagonal upon exit
[out]evalsthe orbital energies
[in]occthe occupation numbers
[in]thresh_degeneratethreshold for orbitals being degenerate
Returns
the unitary matrix U: U^T F U = evals

References madness::WorldGopInterface::broadcast(), madness::World::gop, PROFILE_MEMBER_FUNC, madness::Tensor< T >::ptr(), madness::BaseTensor::size(), madness::sygvp(), madness::Localizer::undo_degenerate_rotations(), and madness::Localizer::undo_reordering().

Referenced by diag_fock_matrix().

◆ get_initial_orbitals()

void madness::SCF::get_initial_orbitals ( World &  world,
RestartPlan &  plan 
)

carry out a restart plan: read the orbitals it names, or make a guess

get the initial orbitals for a calculation, from the source the plan names

Parameters
[in,out]plandowngraded to the initial guess if the named source turns out not to load

The precedence ladder that used to live here is gone: which source to use is decided once, up front, by plan_restart() (RestartPlan.h), from the archive's header rather than from file existence plus a handful of booleans. All this does is carry the decision out.

The one thing that cannot be decided from a header is whether the orbitals themselves load. If they do not, an automatic plan falls back to the initial guess – loudly, since a header that parsed and a body that did not is a damaged archive – while an explicitly requested source throws, because a silent fresh start is exactly what someone asking to resume a long run does not want.

References amo, ao, madness::CalculationParameters::aobasis(), aobasis, madness::automatic, converged_for_dconv, converged_for_thresh, current_energy, e(), errmsg(), madness::World::gop, madness::initial_guess, initial_guess_from_nwchem(), madness::RestartPlan::iterate, load_mos(), madness::loaded, MADNESS_CHECK_THROW, MADNESS_EXCEPTION, make_nuclear_potential(), madness::WorldGopInterface::min(), madness::RestartPlan::mode, madness::RestartPlan::needs_load(), madness::CalculationParameters::nmo_alpha(), madness::nwchem, param, madness::print(), project_ao_basis(), madness::CalculationParameters::protocol(), madness::RestartPlan::protocol_start, madness::World::rank(), reset_aobasis(), restart_aos(), madness::restartao, madness::restartdata, madness::RestartPlan::source, source(), and madness::to_string().

Referenced by madness::MolecularEnergy::value().

◆ group_orbital_sets()

std::vector< int > madness::SCF::group_orbital_sets ( World &  world,
const tensorT &  eps,
const tensorT &  occ,
const int  nmo 
) const

group orbitals into sets of similar orbital energies for localization

Parameters
[in]epsorbital energies
[in]occoccupation numbers
[in]nmonumber of MOs for the given spin
Returns
vector of length nmo with the set index for each MO

References lo, madness::CalculationParameters::localize_pm(), param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, and madness::World::rank().

Referenced by initial_guess(), initial_guess_from_nwchem(), and pad_virtuals_from_guess().

◆ help()

static void madness::SCF::help ( )
inlinestatic

References madness::print(), and madness::print_header2().

Referenced by main().

◆ initial_guess()

void madness::SCF::initial_guess ( World &  world)

◆ initial_guess_ao_eigenvectors()

void madness::SCF::initial_guess_ao_eigenvectors ( World &  world,
tensorT &  c,
tensorT &  e 
)

diagonalize the atomic-guess Fock matrix in the AO basis

Parameters
[out]ceigenvectors, one column per orbital
[out]eeigenvalues

References madness::LoadBalanceDeux< NDIM >::add_tree(), ao, aobasis, madness::apply(), c, madness::Function< T, NDIM >::clear(), madness::compress(), madness::DistributedMatrix< T >::copy_to_replicated(), coulop, e(), END_TIMER, madness::QCCalculationParametersBase::get(), madness::Molecule::get_atom_charge(), madness::Molecule::get_atomic_number(), madness::Molecule::get_pseudo_atom(), gthpseudopotential, kinetic_energy_matrix(), madness::LoadBalanceDeux< NDIM >::load_balance(), MADNESS_CHECK_THROW, make_lda_potential(), madness::matrix_inner(), madness::AtomicBasisSet::modify_dmat_psp(), molecule, madness::mul_sparse(), madness::CalculationParameters::nalpha(), madness::Molecule::natom(), madness::CalculationParameters::nbeta(), madness::CalculationParameters::nwfile(), param, madness::Molecule::parameters, potential(), potentialmanager, madness::print(), madness::CalculationParameters::print_level(), madness::print_meminfo(), PROFILE_MEMBER_FUNC, madness::Molecule::GeometryParameters::psp_calc(), madness::Molecule::GeometryParameters::pure_ae(), madness::World::rank(), madness::Function< T, NDIM >::reconstruct(), madness::reconstruct(), madness::FunctionDefaults< NDIM >::redistribute(), madness::Function< T, NDIM >::scale(), madness::World::size(), START_TIMER, madness::sygvp(), madness::Function< T, NDIM >::trace(), madness::transpose(), madness::Function< T, NDIM >::truncate(), madness::truncate(), vnuc(), madness::CalculationParameters::vnucextra(), and vtol.

Referenced by initial_guess(), and pad_virtuals_from_guess().

◆ initial_guess_from_nwchem()

void madness::SCF::initial_guess_from_nwchem ( World &  world)

◆ initial_load_bal()

void madness::SCF::initial_load_bal ( World &  world)

◆ is_spin_restricted()

bool madness::SCF::is_spin_restricted ( ) const
inline

◆ kain_combine()

vecfuncT madness::SCF::kain_combine ( World &  world,
const subspaceT &  subspace,
const tensorT &  c,
const size_t  lo,
const size_t  n 
) const

KAIN: the updated orbitals lo..lo+n of the subspace's vectors for coefficients c.

References c, madness::WorldGopInterface::fence(), madness::gaxpy(), madness::World::gop, lo, m, PROFILE_MEMBER_FUNC, and subspace.

Referenced by solve_virtuals(), and update_subspace().

◆ kain_solve()

tensorT madness::SCF::kain_solve ( World &  world,
const vecfuncT &  vm,
const vecfuncT &  rm,
subspaceT &  subspace,
tensorT &  Q 
) const

KAIN: append (vm, rm) to the subspace and return the mixing coefficients

Rebuilds the subspace matrix Q incrementally; on a singular subspace the history is dropped and the step is a plain update.

References madness::_(), madness::WorldGopInterface::broadcast_serializable(), c, e(), END_TIMER, madness::World::gop, madness::KAIN(), m, param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, madness::Tensor< T >::ptr(), Q(), madness::World::rank(), START_TIMER, subspace, and madness::WorldGopInterface::sum().

Referenced by solve_virtuals(), and update_subspace().

◆ kain_trim()

void madness::SCF::kain_trim ( subspaceT &  subspace,
tensorT &  Q 
) const

KAIN: drop the oldest history entry once the subspace holds maxsub of them.

References madness::CalculationParameters::maxsub(), param, Q(), and subspace.

Referenced by solve_virtuals(), and update_subspace().

◆ kinetic_energy_matrix()

distmatT madness::SCF::kinetic_energy_matrix ( World &  world,
const vecfuncT &  v 
) const

◆ load_mos()

void madness::SCF::load_mos ( World &  world,
const bool  allow_fewer = true 
)
Parameters
[in]allow_fewerpad the virtuals from the atomic guess when the archive holds fewer orbitals than requested; otherwise that throws

References aeps, amo, aocc, aset, beps, bmo, bocc, bset, madness::compare_geometry(), madness::RestartMetadata::converged_for_dconv, converged_for_dconv, madness::RestartMetadata::converged_for_thresh, converged_for_thresh, madness::RestartMetadata::current_energy, current_energy, madness::MolecularOrbitals< T, NDIM >::get_eps(), madness::FunctionDefaults< NDIM >::get_k(), madness::MolecularOrbitals< T, NDIM >::get_localize_sets(), madness::MolecularOrbitals< T, NDIM >::get_mos(), madness::MolecularOrbitals< T, NDIM >::get_occ(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::CalculationParameters::have_beta(), k, madness::CalculationParameters::L(), madness::RestartMetadata::L, madness::MolecularOrbitals< T, NDIM >::load_mos(), MADNESS_EXCEPTION, madness::mo, madness::RestartMetadata::molecule, molecule, madness::CalculationParameters::nmo_alpha(), madness::CalculationParameters::nmo_beta(), pad_virtuals_from_guess(), param, madness::CalculationParameters::prefix(), madness::print(), madness::Molecule::print(), PROFILE_MEMBER_FUNC, madness::project(), madness::World::rank(), madness::RestartMetadata::read(), madness::RestartMetadata::representation, madness::RestartMetadata::representation_matches(), restart_representation, madness::same, madness::set_thresh(), thresh, and madness::to_string().

Referenced by get_initial_orbitals().

◆ loadbal()

void madness::SCF::loadbal ( World &  world,
functionT &  arho,
functionT &  brho,
functionT &  arho_old,
functionT &  brho_old,
subspaceT &  subspace 
)

◆ make_bsh_operators()

std::vector< poperatorT > madness::SCF::make_bsh_operators ( World &  world,
const tensorT &  evals,
const CalculationParameters &  param 
)
static

◆ make_coulomb_potential()

functionT madness::SCF::make_coulomb_potential ( const functionT &  rho) const
inline

make the Coulomb potential given the total density

References madness::apply(), and coulop.

◆ make_density() [1/2]

functionT madness::SCF::make_density ( World &  world,
const tensorT &  occ,
const cvecfuncT &  v 
)

◆ make_density() [2/2]

functionT madness::SCF::make_density ( World &  world,
const tensorT &  occ,
const vecfuncT &  v 
) const

◆ make_dft_energy()

double madness::SCF::make_dft_energy ( World &  world,
const vecfuncT &  vf,
int  ispin 
)
inline

◆ make_fock_matrix()

tensorT madness::SCF::make_fock_matrix ( World &  world,
const vecfuncT &  psi,
const vecfuncT &  Vpsi,
const tensorT &  occ,
double &  ekinetic 
) const

◆ make_lda_potential()

functionT madness::SCF::make_lda_potential ( World &  world,
const functionT &  arho 
)
static

◆ make_nuclear_potential()

void madness::SCF::make_nuclear_potential ( World &  world)

◆ orthonormalize() [1/2]

void madness::SCF::orthonormalize ( World &  world,
vecfuncT &  amo_new 
) const

orthonormalize the vectors

orthonormalize the vectors ignoring occupied/virtual distinctions

Parameters
[in]worldthe world
[in,out]amo_newthe vectors to be orthonormalized
[in]worldthe world
[in,out]amo_newthe vectors to be orthonormalized

References std::abs(), amo, END_TIMER, madness::matrix_inner(), madness::normalize(), param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, Q(), madness::Q2(), madness::World::rank(), START_TIMER, madness::transform(), madness::truncate(), and vtol.

Referenced by pad_virtuals_from_guess(), restart_aos(), solve_virtuals(), and update_subspace().

◆ orthonormalize() [2/2]

void madness::SCF::orthonormalize ( World &  world,
vecfuncT &  amo_new,
int  nocc 
) const

orthonormalize the vectors (symmetric in occupied spaced, gramm-schmidt for virt to occ)

Parameters
[in]worldthe world
[in,out]amo_newthe vectors to be orthonormalized

References std::abs(), END_TIMER, madness::matrix_inner(), madness::normalize(), param, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, Q(), madness::Q2(), madness::World::rank(), START_TIMER, madness::transform(), madness::truncate(), and vtol.

◆ output_calc_info_schema()

void madness::SCF::output_calc_info_schema ( ) const

◆ output_scf_info_schema()

void madness::SCF::output_scf_info_schema ( const std::map< std::string, double > &  vals,
const tensorT &  dipole_T 
) const

◆ pad_virtuals_from_guess()

bool madness::SCF::pad_virtuals_from_guess ( World &  world)

◆ print_parameters()

static void madness::SCF::print_parameters ( )
inlinestatic

◆ project()

void madness::SCF::project ( World &  world)

◆ project_ao_basis()

vecfuncT madness::SCF::project_ao_basis ( World &  world,
const AtomicBasisSet &  aobasis 
)

◆ project_ao_basis_only()

vecfuncT madness::SCF::project_ao_basis_only ( World &  world,
const AtomicBasisSet &  aobasis,
const Molecule &  molecule 
)
static

◆ reset_aobasis()

void madness::SCF::reset_aobasis ( const std::string &  aobasisname)
inline

◆ restart_aos()

bool madness::SCF::restart_aos ( World &  world)

◆ rotate_subspace() [1/2]

void madness::SCF::rotate_subspace ( World &  world,
const distmatT &  U,
subspaceT &  subspace,
int  lo,
int  nfunc,
double  trantol 
) const

◆ rotate_subspace() [2/2]

void madness::SCF::rotate_subspace ( World &  world,
const tensorT &  U,
subspaceT &  subspace,
int  lo,
int  nfunc,
double  trantol 
) const

◆ save_mos()

void madness::SCF::save_mos ( World &  world)

◆ set_print_timings()

void madness::SCF::set_print_timings ( const bool  value)

◆ set_protocol()

template<std::size_t NDIM>
void madness::SCF::set_protocol ( World &  world,
double  thresh 
)
inline

◆ solve()

void madness::SCF::solve ( World &  world)

References madness::_(), std::abs(), madness::DispersionCorrection::active(), madness::scf_data::add_data(), aeps, amo, analyze_vectors(), ao, aobasis, aocc, madness::apply(), apply_explicit_occupations(), apply_potential(), aset, beps, bmo, bocc, bset, madness::bsh_residual, canonicalize_virtuals(), madness::Function< T, NDIM >::clear(), madness::Localizer::compute_localization_matrix(), madness::PCM::compute_pcm_energy(), madness::PCM::compute_pcm_potential(), converged_for_dconv, converged_for_thresh, madness::copy(), coulop, current_energy, madness::CalculationParameters::dconv(), diag_fock_matrix(), dipole(), dispersion, madness::CalculationParameters::do_localize(), e_data, END_TIMER, madness::DispersionCorrection::energy(), madness::f, madness::QCCalculationParametersBase::get(), madness::FunctionDefaults< NDIM >::get_thresh(), gthpseudopotential, madness::inner(), loadbal(), madness::CalculationParameters::localize_method(), localize_pivot_state_a, localize_pivot_state_b, m, make_density(), make_fock_matrix(), madness::matrix_inner(), madness::CalculationParameters::maxiter(), madness::mo, molecule, madness::CalculationParameters::nalpha(), madness::name(), madness::Molecule::natom(), madness::CalculationParameters::nbeta(), madness::CalculationParameters::nmo_alpha(), madness::CalculationParameters::nmo_beta(), madness::norm2(), madness::normalize(), madness::Molecule::nuclear_repulsion_energy(), madness::CalculationParameters::nwfile(), param, madness::Molecule::parameters, pcm, madness::CalculationParameters::pcm_data(), potentialmanager, madness::CalculationParameters::prefix(), madness::print(), madness::CalculationParameters::print_level(), madness::print_meminfo(), PROFILE_MEMBER_FUNC, madness::Molecule::GeometryParameters::psp_calc(), madness::Molecule::GeometryParameters::pure_ae(), Q(), madness::World::rank(), madness::Function< T, NDIM >::scale(), madness::Tensor< T >::screen(), madness::Localizer::set_method(), madness::Localizer::set_pivot_state(), madness::CalculationParameters::spin_restricted(), START_TIMER, subspace, madness::sygvp(), madness::transform(), madness::transpose(), madness::Function< T, NDIM >::truncate(), madness::truncate(), update_subspace(), v, vnuc(), vtol, and madness::wall_time().

Referenced by madness::MolecularEnergy::value().

◆ solve_virtuals()

void madness::SCF::solve_virtuals ( World &  world)

iterate the virtuals in the fixed mean field of the occupied orbitals

The occupied orbitals are not updated: nuclear and Coulomb potentials are built once, the exchange and XC operators take the occupied orbitals from this object at every call. Each spin's virtual block is canonicalized, BSH-updated with KAIN, and re-orthogonalized against its occupieds.

References aeps, amo, aocc, madness::apply(), apply_explicit_occupations(), apply_potential(), beps, bmo, bocc, madness::WorldGopInterface::broadcast(), c, canonicalize_virtuals(), madness::Function< T, NDIM >::clear(), madness::compress(), madness::PCM::compute_pcm_potential(), compute_residual(), converged_for_dconv, converged_for_thresh, coulop, current_energy, madness::CalculationParameters::dconv(), do_step_restriction(), END_TIMER, madness::WorldGopInterface::fence(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::World::gop, gthpseudopotential, madness::CalculationParameters::have_beta(), kain_combine(), kain_solve(), kain_trim(), MADNESS_CHECK_THROW, make_density(), make_fock_matrix(), madness::CalculationParameters::maxiter(), madness::mo, molecule, madness::CalculationParameters::nalpha(), madness::CalculationParameters::nbeta(), orthonormalize(), param, madness::Molecule::parameters, pcm, madness::CalculationParameters::pcm_data(), potentialmanager, madness::print(), madness::CalculationParameters::print_level(), PROFILE_MEMBER_FUNC, madness::Molecule::GeometryParameters::psp_calc(), madness::Molecule::GeometryParameters::pure_ae(), Q(), madness::World::rank(), madness::CalculationParameters::spin_restricted(), START_TIMER, subspace, madness::Function< T, NDIM >::truncate(), and vnuc().

Referenced by madness::MolecularEnergy::value().

◆ twoint()

Tensor< double > madness::SCF::twoint ( World &  world,
const vecfuncT &  psi 
) const

Compute the two-electron integrals over the provided set of orbitals.

Returned is a replicated tensor of $(ij|kl)$ with $i>=j$ and $k>=l$. The symmetry $(ij|kl)=(kl|ij)$ is enforced.

Important this is consistent with Coulomb

References madness::apply(), coulop, madness::WorldGopInterface::fence(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::World::gop, madness::matrix_inner(), madness::mul_sparse(), madness::norm_tree(), PROFILE_MEMBER_FUNC, psi(), madness::reconstruct(), and madness::truncate().

◆ update_subspace()

void madness::SCF::update_subspace ( World &  world,
vecfuncT &  Vpsia,
vecfuncT &  Vpsib,
tensorT &  focka,
tensorT &  fockb,
subspaceT &  subspace,
tensorT &  Q,
double &  bsh_residual,
double &  update_residual 
)

◆ vector_stats()

void madness::SCF::vector_stats ( const std::vector< double > &  v,
double &  rms,
double &  maxabsval 
) const

Member Data Documentation

◆ aeps

tensorT madness::SCF::aeps

◆ amo

vecfuncT madness::SCF::amo

◆ ao

vecfuncT madness::SCF::ao

◆ aobasis

AtomicBasisSet madness::SCF::aobasis

◆ aocc

tensorT madness::SCF::aocc

◆ aset

std::vector<int> madness::SCF::aset

sets of orbitals grouped by their orbital energies (for localization?) only orbitals within the same set will be mixed to localize

Referenced by compare_calc_and_mos(), copy_data(), initial_guess(), initial_guess_from_nwchem(), load_mos(), pad_virtuals_from_guess(), restart_aos(), save_mos(), solve(), and madness::MolecularEnergy::value().

◆ at_nbf

std::vector<int> madness::SCF::at_nbf

Referenced by copy_data(), and project_ao_basis().

◆ at_to_bf

std::vector<int> madness::SCF::at_to_bf

Referenced by copy_data(), and project_ao_basis().

◆ beps

tensorT madness::SCF::beps

◆ bmo

vecfuncT madness::SCF::bmo

◆ bocc

tensorT madness::SCF::bocc

◆ bset

std::vector<int> madness::SCF::bset

◆ converged_for_dconv

double madness::SCF::converged_for_dconv =1.e10

mos are converged for this density

Referenced by get_initial_orbitals(), load_mos(), save_mos(), solve(), solve_virtuals(), and madness::MolecularEnergy::value().

◆ converged_for_tconv

double madness::SCF::converged_for_tconv =1.e10

derivatives of mos are converged for this threshold

◆ converged_for_thresh

double madness::SCF::converged_for_thresh =1.e10

mos are converged for this threshold

Referenced by get_initial_orbitals(), load_mos(), save_mos(), solve(), solve_virtuals(), and madness::MolecularEnergy::value().

◆ coulop

poperatorT madness::SCF::coulop

◆ current_energy

double madness::SCF::current_energy

◆ dispersion

DispersionCorrection madness::SCF::dispersion

empirical DFT-D3 dispersion correction; inactive unless dispersion is set

Owned by SCF so that nemo and oep, which hold a shared_ptr<SCF>, reach the same object through calc->dispersion. (Znemo carries a bare CalculationParameters instead and uses the static DispersionCorrection::reject to refuse a correction it cannot apply.)

Referenced by SCF(), derivatives(), main(), and solve().

◆ e_data

scf_data madness::SCF::e_data

◆ gradop

std::vector<std::shared_ptr<real_derivative_3d> > madness::SCF::gradop

◆ gthpseudopotential

std::shared_ptr<GTHPseudopotential<double> > madness::SCF::gthpseudopotential

◆ localize_pivot_state_a

std::vector<long> madness::SCF::localize_pivot_state_a

cholesky localization's pivot order from the previous iteration (per spin)

Referenced by solve().

◆ localize_pivot_state_b

std::vector<long> madness::SCF::localize_pivot_state_b

Referenced by solve().

◆ mask

functionT madness::SCF::mask

Referenced by set_protocol().

◆ molecule

Molecule madness::SCF::molecule

◆ param

CalculationParameters madness::SCF::param

◆ pcm

PCM madness::SCF::pcm

◆ pcm_param

PCMParameters madness::SCF::pcm_param

the pcm data group; inert unless param.pcm_data() is set

Referenced by SCF(), and madness::MolecularEnergy::value().

◆ potentialmanager

std::shared_ptr<PotentialManager> madness::SCF::potentialmanager

◆ restart_ncf

std::string madness::SCF::restart_ncf

nuclear correlation factor behind restart_representation, e.g. "slater:2.0"

Referenced by save_mos(), and madness::MolecularEnergy::value().

◆ restart_representation

Representation madness::SCF::restart_representation =Representation::mo

what amo/bmo actually hold, recorded in the restartdata header

Representation::mo for moldft's orbitals. Nemo drives an SCF rather than deriving from one and stores the regularized F = psi/R in amo, so it sets this to Representation::nemo (and restart_ncf) on the SCF it owns. Without it both engines write the same filename, with the same version tag, holding different functions – and loading one as the other is silently wrong.

Referenced by load_mos(), save_mos(), and madness::MolecularEnergy::value().

◆ suppress_raw_gradient_print

bool madness::SCF::suppress_raw_gradient_print =false
mutable

set while an optimizer drives this SCF, to keep the raw derivative table out of the log next to MolOpt's projected one – see SCF::derivatives

Referenced by derivatives().

◆ vtol

double madness::SCF::vtol

◆ work_dir

std::filesystem::path madness::SCF::work_dir

Referenced by SCF().

◆ xc

XCfunctional madness::SCF::xc

The documentation for this class was generated from the following files: