Psi4
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
psi::DIISManager Class Reference

The DIISManager class handles DIIS extrapolations. More...

#include <diismanager.h>

Public Types

enum  StoragePolicy { InCore, OnDisk }
 How the quantities are to be stored;. More...
 
enum  RemovalPolicy { LargestError, OldestAdded }
 How vectors are removed from the subspace, when required. More...
 

Public Member Functions

 DIISManager (int maxSubspaceSize, const std::string &label, RemovalPolicy=LargestError, StoragePolicy=OnDisk)
 
 DIISManager ()
 
 ~DIISManager ()
 
void set_error_vector_size (int numQuantities,...)
 
void set_vector_size (int numQuantities,...)
 
bool extrapolate (int numQuatities,...)
 
bool add_entry (int numQuatities,...)
 
void set_error_vector_size (SharedMatrix error)
 
void set_vector_size (SharedMatrix state)
 
bool add_entry (SharedMatrix state, SharedMatrix error)
 
bool extrapolate (SharedMatrix extrapolated)
 
int remove_entry ()
 
void reset_subspace ()
 
void delete_diis_file ()
 
int subspace_size ()
 The number of vectors currently in the subspace. More...
 

Protected Member Functions

int get_next_entry_id ()
 

Protected Attributes

StoragePolicy _storagePolicy
 How the vectors are handled in memory. More...
 
RemovalPolicy _removalPolicy
 How vectors are removed from the subspace. More...
 
int _maxSubspaceSize
 The maximum number of vectors allowed in the subspace. More...
 
int _errorVectorSize
 The size of the error vector. More...
 
int _vectorSize
 The size of the vector. More...
 
int _numErrorVectorComponents
 The number of components in the error vector. More...
 
int _numVectorComponents
 The number of components in the vector. More...
 
int _entryCount
 The counter that keeps track of how many entries have been added. More...
 
std::vector< DIISEntry * > _subspace
 The DIIS entries. More...
 
std::vector< DIISEntry::InputType_componentTypes
 The types used in building the vector and the error vector. More...
 
std::vector< size_t > _componentSizes
 The types used in the vector. More...
 
std::string _label
 The label used in disk storage of the DIISEntry objects. More...
 
std::shared_ptr< PSIO_psio
 The PSIO object to use for I/O. More...
 

Detailed Description

The DIISManager class handles DIIS extrapolations.

Member Enumeration Documentation

How vectors are removed from the subspace, when required.

LargestError - The vector corresponding to the largest error is removed OldestFirst - A first-in-first-out policy is used

Enumerator
LargestError 
OldestAdded 

How the quantities are to be stored;.

OnDisk - Stored on disk, and retrieved when required InCore - Stored in memory throughout

Enumerator
InCore 
OnDisk 

Constructor & Destructor Documentation

psi::DIISManager::DIISManager ( int  maxSubspaceSize,
const std::string &  label,
RemovalPolicy  removalPolicy = LargestError,
StoragePolicy  storagePolicy = OnDisk 
)
Parameters
maxSubspaceSizeMaximum number of vectors allowed in the subspace
label,:the base part of the label used to store the vectors to disk
removalPolicy,:How to decide which vectors to remove when the subspace is full
storagePolicy,:How to store the DIIS vectors
psio,:the PSIO object to use for I/O. Do not specify if DPD is being used.
psi::DIISManager::DIISManager ( )
inline
psi::DIISManager::~DIISManager ( )

Member Function Documentation

bool psi::DIISManager::add_entry ( int  numQuantities,
  ... 
)

Adds a new vector and error vector to the DIIS subspace.

Parameters
numQuantities- the number of components used to construct the vector and error vector. Must match the sum of the numbers passed to the set_vector_size() and set_error_vector_size() functions. The remaining parameters are then the components of the vector and then the error vector, in that order, and in the same order they were passed to the set_vector_size() and set_error_vector_size() functions. N.B. Unlike the set_size functions, the types of each component should not be specified here. If the component is an array, the pointer to the start of that array should be passed, in contrast to the set_size functions, which takes only the size of that array.
Returns
Whether the subspace was updated
bool psi::DIISManager::add_entry ( SharedMatrix  state,
SharedMatrix  error 
)
inline
void psi::DIISManager::delete_diis_file ( )

Deletes the DIIS scratch file

bool psi::DIISManager::extrapolate ( int  numQuantities,
  ... 
)

Performs the extapolation, based on the current subspace

Parameters
numQuantitites- the number of quantities that the vector comprises. Then pass these quantities in the order they were passed to the set_vector_size() function. The types of each component should not be specified here, unlike the set_vector_size() function call.
bool psi::DIISManager::extrapolate ( SharedMatrix  extrapolated)
inline
int psi::DIISManager::get_next_entry_id ( )
protected

Figures out the ID of the next entry to be added by determining whether an entry must be removed in order to add a new one.

int psi::DIISManager::remove_entry ( )
void psi::DIISManager::reset_subspace ( )

Removes any vectors existing in the DIIS subspace.

void psi::DIISManager::set_error_vector_size ( int  numQuantities,
  ... 
)

Determines the size of the error vector from a list of input quantities.

void psi::DIISManager::set_error_vector_size ( SharedMatrix  error)
inline
void psi::DIISManager::set_vector_size ( int  numQuantities,
  ... 
)

Determines the size of the error vector from a list of input quantities. This function should not be called until set_error_vector_size() has been called.

void psi::DIISManager::set_vector_size ( SharedMatrix  state)
inline
int psi::DIISManager::subspace_size ( )

The number of vectors currently in the subspace.

Member Data Documentation

std::vector<size_t> psi::DIISManager::_componentSizes
protected

The types used in the vector.

std::vector<DIISEntry::InputType> psi::DIISManager::_componentTypes
protected

The types used in building the vector and the error vector.

int psi::DIISManager::_entryCount
protected

The counter that keeps track of how many entries have been added.

int psi::DIISManager::_errorVectorSize
protected

The size of the error vector.

std::string psi::DIISManager::_label
protected

The label used in disk storage of the DIISEntry objects.

int psi::DIISManager::_maxSubspaceSize
protected

The maximum number of vectors allowed in the subspace.

int psi::DIISManager::_numErrorVectorComponents
protected

The number of components in the error vector.

int psi::DIISManager::_numVectorComponents
protected

The number of components in the vector.

std::shared_ptr<PSIO> psi::DIISManager::_psio
protected

The PSIO object to use for I/O.

RemovalPolicy psi::DIISManager::_removalPolicy
protected

How vectors are removed from the subspace.

StoragePolicy psi::DIISManager::_storagePolicy
protected

How the vectors are handled in memory.

std::vector<DIISEntry*> psi::DIISManager::_subspace
protected

The DIIS entries.

int psi::DIISManager::_vectorSize
protected

The size of the vector.


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