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

#include <localizer.h>

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

Public Member Functions

 Localizer ()=default
 
 Localizer (World &world, const AtomicBasisSet &aobasis, const Molecule &molecule, const std::vector< Function< double, 3 > > &ao)
 
template<typename T , std::size_t NDIM>
Tensor< T > compute_core_valence_separation_transformation_matrix (World &world, const MolecularOrbitals< T, NDIM > &mo_in, const Tensor< T > &Fock) const
 localize orbitals while enforcing core-valence separation
 
template<typename T , std::size_t NDIM>
Tensor< T > compute_localization_matrix (World &world, const MolecularOrbitals< T, NDIM > &mo_in, bool randomize) const
 
AtomicBasisSet get_aobasis () const
 
std::string get_method ()
 
template<typename T , std::size_t NDIM>
MolecularOrbitals< T, NDIMlocalize (const MolecularOrbitals< T, NDIM > &mo_in, bool randomize) const
 localize the orbitals
 
template<typename T , std::size_t NDIM>
MolecularOrbitals< T, NDIMlocalize (const MolecularOrbitals< T, NDIM > &mo_in, const Tensor< T > &Fock, bool randomize) const
 localize the orbitals, possibly enforce core-valence separation
 
void print_info () const
 
template<typename T , std::size_t NDIM>
MolecularOrbitals< T, NDIMseparate_core_valence (const MolecularOrbitals< T, NDIM > &mo_in, const Tensor< T > &Fock) const
 
Localizerset_enforce_core_valence_separation (const bool value)
 
Localizerset_method (const std::string method1)
 
Localizerset_metric (const Function< double, 3 > &R)
 
Localizerset_pivot_state (std::vector< long > *state)
 

Static Public Member Functions

template<typename T >
static bool check_core_valence_separation (const Tensor< T > &Fock, const std::vector< int > &localized_set, const bool silent=false)
 
static bool check_frozen_consistency (const long nfrozen, const std::vector< int > &localize_sets)
 
template<typename T >
static std::size_t determine_frozen_orbitals (const Tensor< T > fmat)
 
static std::vector< Slicefind_degenerate_blocks (const Tensor< double > &eval, const double thresh_degenerate)
 find sets of degenerate states/orbitals
 
template<typename T >
static void undo_degenerate_rotations (Tensor< T > &U, const Tensor< double > &eval, const double thresh_degenerate)
 given a unitary transformation matrix undo rotations between degenerate columns
 
template<typename T >
static void undo_reordering (Tensor< T > &U, const Tensor< double > &occ)
 given a unitary transformation matrix undo mere reordering
 
template<typename T >
static void undo_reordering (Tensor< T > &U, const Tensor< double > &occ, Tensor< double > &eval)
 given a unitary transformation matrix undo mere reordering
 
template<typename T >
static Tensor< T > undo_rotation (const Tensor< T > &U_in, const std::vector< Slice > &blocks)
 given a unitary transformation matrix undo the rotations within the blocks
 
template<typename T >
static void undo_rotations_within_sets (Tensor< T > &U, const std::vector< int > &localized_set)
 given a unitary transformation matrix undo rotations within blocks of localized orbitals
 

Private Member Functions

template<typename T >
double DIP (const Tensor< T > &dip, int i, int j, int k, int l) const
 
template<typename T , std::size_t NDIM>
DistributedMatrix< T > localize_boys (World &world, const std::vector< Function< T, NDIM > > &mo, const std::vector< int > &set, const double thresh=1e-9, const bool randomize=true, const bool doprint=false) const
 
template<typename T , std::size_t NDIM>
DistributedMatrix< T > localize_cholesky (World &world, const std::vector< Function< T, NDIM > > &mo, const std::vector< int > &set) const
 Cholesky localization: deterministic and non-iterative.
 
template<typename T , std::size_t NDIM>
DistributedMatrix< T > localize_new (World &world, const std::vector< Function< T, NDIM > > &mo, const std::vector< int > &set, const double thresh=1e-9, const bool randomize=true, const bool doprint=false) const
 
template<typename T , std::size_t NDIM>
DistributedMatrix< T > localize_new_systolic (World &world, const std::vector< Function< T, NDIM > > &mo, const std::vector< int > &set, const double thresh=1e-9, const bool randomize=true, const bool doprint=false) const
 the "new" objective optimized with distributed systolic Jacobi sweeps (localize=new_sys)
 
template<typename T , std::size_t NDIM>
DistributedMatrix< T > localize_PM (World &world, const std::vector< Function< T, NDIM > > &mo, const std::vector< int > &set, const double thresh=1e-9, const bool randomize=true, const bool doprint=false) const
 
template<typename T >
Tensor< T > matrix_exponential (const Tensor< T > &A) const
 
template<typename T , std::size_t NDIM>
void prepare_new_basis (World &world, const std::vector< Function< T, NDIM > > &mo, Tensor< T > &C, std::vector< int > &at_to_bf, std::vector< int > &at_nbf) const
 build the "new" method's orthonormal atomic-eigenfunction basis and localization blocks
 

Private Attributes

std::vector< Function< double, 3 > > ao
 
AtomicBasisSet aobasis
 map atoms to basis functions in the "new" algorithm
 
std::vector< intat_nbf
 
std::vector< intat_to_bf
 
bool enforce_core_valence_separation =false
 when are orbitals degenerate
 
std::string method ="new"
 no rotations between core and valence orbitals (distinguished by 'set')
 
Function< double, 3 > metric
 
Molecule molecule
 
std::vector< long > * pivot_state = nullptr
 localization method
 
double thetamax =0.1
 =R for computing matrix elements of operators
 
double thresh_degenerate
 
const double tolloc = 1e-6
 maximum rotation(?)
 

Constructor & Destructor Documentation

◆ Localizer() [1/2]

madness::Localizer::Localizer ( )
default

◆ Localizer() [2/2]

madness::Localizer::Localizer ( World world,
const AtomicBasisSet aobasis,
const Molecule molecule,
const std::vector< Function< double, 3 > > &  ao 
)

Member Function Documentation

◆ check_core_valence_separation()

template<typename T >
template bool madness::Localizer::check_core_valence_separation ( const Tensor< T > &  Fock,
const std::vector< int > &  localized_set,
const bool  silent = false 
)
static

◆ check_frozen_consistency()

bool madness::Localizer::check_frozen_consistency ( const long  nfrozen,
const std::vector< int > &  localize_sets 
)
static

◆ compute_core_valence_separation_transformation_matrix()

template<typename T , std::size_t NDIM>
Tensor< T > madness::Localizer::compute_core_valence_separation_transformation_matrix ( World world,
const MolecularOrbitals< T, NDIM > &  mo_in,
const Tensor< T > &  Fock 
) const

localize orbitals while enforcing core-valence separation

Parameters
[in]Worldthe world
[in]mo_inthe input orbitals
[in]Fockthe Fock matrix for canonicalizing the orbitals first
[in]methodthe localization method
[in]tolloclocalization tolerance
[in]randomizeinitially randomize the localization procedure

References madness::WorldGopInterface::broadcast(), check_core_valence_separation(), madness::copy(), madness::f, madness::WorldGopInterface::fence(), madness::World::gop, madness::inner(), madness::jacobi(), MADNESS_CHECK, madness::nonlinear_vector_solver(), madness::print(), madness::Tensor< T >::ptr(), madness::World::rank(), madness::BaseTensor::size(), madness::World::size(), and madness::transpose().

Referenced by localize(), and separate_core_valence().

◆ compute_localization_matrix()

template<typename T , std::size_t NDIM>
Tensor< T > madness::Localizer::compute_localization_matrix ( World world,
const MolecularOrbitals< T, NDIM > &  mo_in,
bool  randomize 
) const

◆ determine_frozen_orbitals()

template<typename T >
template std::size_t madness::Localizer::determine_frozen_orbitals ( const Tensor< T >  fmat)
static

◆ DIP()

template<typename T >
double madness::Localizer::DIP ( const Tensor< T > &  dip,
int  i,
int  j,
int  k,
int  l 
) const
inlineprivate

References k, and madness::nonlinear_vector_solver().

Referenced by localize_boys().

◆ find_degenerate_blocks()

std::vector< Slice > madness::Localizer::find_degenerate_blocks ( const Tensor< double > &  eval,
const double  thresh_degenerate 
)
static

find sets of degenerate states/orbitals

References madness::nonlinear_vector_solver(), madness::BaseTensor::size(), and thresh_degenerate.

Referenced by undo_degenerate_rotations().

◆ get_aobasis()

AtomicBasisSet madness::Localizer::get_aobasis ( ) const
inline

References aobasis.

◆ get_method()

std::string madness::Localizer::get_method ( )
inline

References method.

◆ localize() [1/2]

template<typename T , std::size_t NDIM>
MolecularOrbitals< T, NDIM > madness::Localizer::localize ( const MolecularOrbitals< T, NDIM > &  mo_in,
bool  randomize 
) const

localize the orbitals

References localize(), and madness::nonlinear_vector_solver().

Referenced by localize().

◆ localize() [2/2]

template<typename T , std::size_t NDIM>
MolecularOrbitals< T, NDIM > madness::Localizer::localize ( const MolecularOrbitals< T, NDIM > &  mo_in,
const Tensor< T > &  Fock,
bool  randomize 
) const

◆ localize_boys()

template<typename T , std::size_t NDIM>
DistributedMatrix< T > madness::Localizer::localize_boys ( World world,
const std::vector< Function< T, NDIM > > &  mo,
const std::vector< int > &  set,
const double  thresh = 1e-9,
const bool  randomize = true,
const bool  doprint = false 
) const
private

◆ localize_cholesky()

template<typename T , std::size_t NDIM>
DistributedMatrix< T > madness::Localizer::localize_cholesky ( World world,
const std::vector< Function< T, NDIM > > &  mo,
const std::vector< int > &  set 
) const
private

Cholesky localization: deterministic and non-iterative.

A pivoted Cholesky factorization of the density in the orthonormal atomic-eigenfunction basis: repeatedly pick the basis function carrying the largest remaining diagonal density, take its coefficient column as the next orbital, and orthonormalize (Aquilante, Pedersen, Koch, J. Chem. Phys. 125, 174101 (2006)). No objective is optimized, so successive SCF iterations cannot hop between the near-degenerate maxima an iterative localizer wanders over. The pivot diagonal is divided over ranks; slices evolve by identical per-function arithmetic on replicated data, so the pivot sequence – and U – are independent of the rank count. Each pivot step costs two scalar allreduces.

References madness::_(), at_nbf, at_to_bf, madness::copy(), d, e(), madness::World::gop, k, MADNESS_CHECK_THROW, madness::WorldGopInterface::max(), me, madness::WorldGopInterface::min(), madness::mo, mu, madness::nonlinear_vector_solver(), pivot_state, prepare_new_basis(), madness::World::rank(), madness::Tensor< T >::scale(), madness::scale(), madness::BaseTensor::size(), madness::World::size(), madness::transpose(), u(), and w().

Referenced by compute_localization_matrix().

◆ localize_new()

template<typename T , std::size_t NDIM>
DistributedMatrix< T > madness::Localizer::localize_new ( World world,
const std::vector< Function< T, NDIM > > &  mo,
const std::vector< int > &  set,
const double  thresh = 1e-9,
const bool  randomize = true,
const bool  doprint = false 
) const
private

◆ localize_new_systolic()

template<typename T , std::size_t NDIM>
DistributedMatrix< T > madness::Localizer::localize_new_systolic ( World world,
const std::vector< Function< T, NDIM > > &  mo,
const std::vector< int > &  set,
const double  thresh = 1e-9,
const bool  randomize = true,
const bool  doprint = false 
) const
private

the "new" objective optimized with distributed systolic Jacobi sweeps (localize=new_sys)

The "new" objective optimized with distributed systolic Jacobi sweeps.

In the orthonormal atomic-eigenfunction basis the "new" objective is Pipek-Mezey (q_ij(a) with identity overlap), so it can reuse localize_PM's systolic machinery: every rank works every call, where localize_new's rank-0 optimizer leaves all other ranks idle – beyond ~1500 orbitals a single call then exceeds the runtime idle watchdog (MAD_WAIT_TIMEOUT). A different optimizer on the same objective: it reaches a different, equally valid local maximum.

References at_nbf, at_to_bf, madness::distributed_localize_new(), madness::mo, prepare_new_basis(), thetamax, and thresh.

Referenced by compute_localization_matrix().

◆ localize_PM()

template<typename T , std::size_t NDIM>
DistributedMatrix< T > madness::Localizer::localize_PM ( World world,
const std::vector< Function< T, NDIM > > &  mo,
const std::vector< int > &  set,
const double  thresh = 1e-9,
const bool  randomize = true,
const bool  doprint = false 
) const
private

◆ matrix_exponential()

template<typename T >
Tensor< T > madness::Localizer::matrix_exponential ( const Tensor< T > &  A) const
private

◆ prepare_new_basis()

template<typename T , std::size_t NDIM>
void madness::Localizer::prepare_new_basis ( World world,
const std::vector< Function< T, NDIM > > &  mo,
Tensor< T > &  C,
std::vector< int > &  at_to_bf,
std::vector< int > &  at_nbf 
) const
private

build the "new" method's orthonormal atomic-eigenfunction basis and localization blocks

Build the "new" method's working basis: transform the AO-projection matrix C into the orthonormal atomic-eigenfunction basis and construct the per-atom localization blocks (1s / 2s2p / rest). Shared by localize_new (rank-0 CG) and localize_new_systolic.

References madness::_(), ao, aobasis, at_nbf, at_to_bf, madness::BaseTensor::dim(), madness::Molecule::get_atomic_number(), madness::AtomicBasisSet::get_avec(), madness::inner(), MADNESS_ASSERT, madness::matrix_inner(), madness::mo, molecule, madness::Molecule::natom(), madness::nonlinear_vector_solver(), madness::AtomicBasisSet::shells_to_bfn(), and madness::BaseTensor::size().

Referenced by localize_cholesky(), localize_new(), and localize_new_systolic().

◆ print_info()

void madness::Localizer::print_info ( ) const
inline

◆ separate_core_valence()

template<typename T , std::size_t NDIM>
template MolecularOrbitals< double, 3 > madness::Localizer::separate_core_valence ( const MolecularOrbitals< T, NDIM > &  mo_in,
const Tensor< T > &  Fock 
) const

◆ set_enforce_core_valence_separation()

Localizer & madness::Localizer::set_enforce_core_valence_separation ( const bool  value)
inline

◆ set_method()

Localizer & madness::Localizer::set_method ( const std::string  method1)
inline

◆ set_metric()

Localizer & madness::Localizer::set_metric ( const Function< double, 3 > &  R)
inline

References madness::copy(), metric, and R.

◆ set_pivot_state()

Localizer & madness::Localizer::set_pivot_state ( std::vector< long > *  state)
inline

hand the cholesky method last iteration's pivot order; it reads the order and overwrites it with the one it used (see localize_cholesky)

References pivot_state.

◆ undo_degenerate_rotations()

template<typename T >
template void madness::Localizer::undo_degenerate_rotations ( Tensor< T > &  U,
const Tensor< double > &  eval,
const double  thresh_degenerate 
)
static

◆ undo_reordering() [1/2]

template<typename T >
static void madness::Localizer::undo_reordering ( Tensor< T > &  U,
const Tensor< double > &  occ 
)
inlinestatic

given a unitary transformation matrix undo mere reordering

References madness::BaseTensor::dim(), and undo_reordering().

Referenced by get_fock_transformation(), madness::SCF::get_fock_transformation(), and undo_reordering().

◆ undo_reordering() [2/2]

template<typename T >
void madness::Localizer::undo_reordering ( Tensor< T > &  U,
const Tensor< double > &  occ,
Tensor< double > &  eval 
)
static

◆ undo_rotation()

template<typename T >
Tensor< T > madness::Localizer::undo_rotation ( const Tensor< T > &  U_in,
const std::vector< Slice > &  blocks 
)
static

given a unitary transformation matrix undo the rotations within the blocks

References madness::_(), madness::copy(), madness::inner(), madness::nonlinear_vector_solver(), q(), sigma, madness::svd(), and madness::transpose().

Referenced by undo_degenerate_rotations(), and undo_rotations_within_sets().

◆ undo_rotations_within_sets()

template<typename T >
void madness::Localizer::undo_rotations_within_sets ( Tensor< T > &  U,
const std::vector< int > &  localized_set 
)
static

given a unitary transformation matrix undo rotations within blocks of localized orbitals

References madness::MolecularOrbitals< T, NDIM >::convert_set_to_slice(), madness::nonlinear_vector_solver(), and undo_rotation().

Member Data Documentation

◆ ao

std::vector<Function<double, 3> > madness::Localizer::ao
private

◆ aobasis

AtomicBasisSet madness::Localizer::aobasis
private

map atoms to basis functions in the "new" algorithm

Referenced by Localizer(), get_aobasis(), prepare_new_basis(), and print_info().

◆ at_nbf

std::vector<int> madness::Localizer::at_nbf
private

◆ at_to_bf

std::vector<int> madness::Localizer::at_to_bf
private

◆ enforce_core_valence_separation

bool madness::Localizer::enforce_core_valence_separation =false
private

when are orbitals degenerate

Referenced by localize(), print_info(), and set_enforce_core_valence_separation().

◆ method

std::string madness::Localizer::method ="new"
private

no rotations between core and valence orbitals (distinguished by 'set')

Referenced by compute_localization_matrix(), get_method(), print_info(), and set_method().

◆ metric

Function<double,3> madness::Localizer::metric
private

◆ molecule

Molecule madness::Localizer::molecule
private

Referenced by Localizer(), and prepare_new_basis().

◆ pivot_state

std::vector<long>* madness::Localizer::pivot_state = nullptr
private

localization method

Referenced by localize_cholesky(), and set_pivot_state().

◆ thetamax

double madness::Localizer::thetamax =0.1
private

=R for computing matrix elements of operators

Referenced by localize_new_systolic(), and localize_PM().

◆ thresh_degenerate

double madness::Localizer::thresh_degenerate
private

◆ tolloc

const double madness::Localizer::tolloc = 1e-6
private

maximum rotation(?)

Referenced by compute_localization_matrix().


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