Psi4
diismanager.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _PSI_SRC_LIB_LIBDIIS_DIISMANAGER_H_
30 #define _PSI_SRC_LIB_LIBDIIS_DIISMANAGER_H_
31 
32 #include "psi4/libdiis/diisentry.h"
33 #include "psi4/libmints/matrix.h"
34 #include <vector>
35 #include <map>
36 
37 namespace psi{
38 
39 class PSIO;
40 
46  public:
61 
62  DIISManager(int maxSubspaceSize, const std::string& label,
66  ~DIISManager();
67 
68  // C-style variadic? Why?
69  void set_error_vector_size(int numQuantities, ...);
70  void set_vector_size(int numQuantities, ...);
71  bool extrapolate(int numQuatities, ...);
72  bool add_entry(int numQuatities, ...);
73 
74  // Wrappers for those who dislike variadic
76  DIISManager::set_error_vector_size(1, error.get());
77  }
78 
80  DIISManager::set_vector_size(1, state.get());
81  }
82 
83  bool add_entry(SharedMatrix state, SharedMatrix error){
84  return DIISManager::add_entry(2, state.get(), error.get());
85  }
86 
87  bool extrapolate(SharedMatrix extrapolated){
88  return DIISManager::extrapolate(1, extrapolated.get());
89  }
90 
91  int remove_entry();
92  void reset_subspace();
93  void delete_diis_file();
95  int subspace_size();
96  protected:
97  int get_next_entry_id();
98 
116  std::vector<DIISEntry*> _subspace;
118  std::vector<DIISEntry::InputType> _componentTypes;
120  std::vector<size_t> _componentSizes;
122  std::string _label;
124  std::shared_ptr<PSIO> _psio;
125 };
126 
127 } // End namespace
128 
129 #endif // Header guard
std::vector< size_t > _componentSizes
The types used in the vector.
Definition: diismanager.h:120
StoragePolicy
How the quantities are to be stored;.
Definition: diismanager.h:53
void reset_subspace()
Definition: diismanager.cc:548
int _numVectorComponents
The number of components in the vector.
Definition: diismanager.h:112
void set_vector_size(int numQuantities,...)
Definition: diismanager.cc:80
int _errorVectorSize
The size of the error vector.
Definition: diismanager.h:106
void delete_diis_file()
Definition: diismanager.cc:558
DIISManager()
Definition: diismanager.h:65
void set_vector_size(SharedMatrix state)
Definition: diismanager.h:79
bool extrapolate(int numQuatities,...)
Definition: diismanager.cc:356
std::string _label
The label used in disk storage of the DIISEntry objects.
Definition: diismanager.h:122
int _entryCount
The counter that keeps track of how many entries have been added.
Definition: diismanager.h:114
Definition: diismanager.h:60
int _vectorSize
The size of the vector.
Definition: diismanager.h:108
int _numErrorVectorComponents
The number of components in the error vector.
Definition: diismanager.h:110
Definition: diismanager.h:53
~DIISManager()
Definition: diismanager.cc:566
bool extrapolate(SharedMatrix extrapolated)
Definition: diismanager.h:87
int subspace_size()
The number of vectors currently in the subspace.
Definition: diismanager.cc:70
std::vector< DIISEntry::InputType > _componentTypes
The types used in building the vector and the error vector.
Definition: diismanager.h:118
Definition: diismanager.h:60
std::vector< DIISEntry * > _subspace
The DIIS entries.
Definition: diismanager.h:116
std::shared_ptr< PSIO > _psio
The PSIO object to use for I/O.
Definition: diismanager.h:124
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
int get_next_entry_id()
Definition: diismanager.cc:318
void set_error_vector_size(SharedMatrix error)
Definition: diismanager.h:75
RemovalPolicy _removalPolicy
How vectors are removed from the subspace.
Definition: diismanager.h:102
RemovalPolicy
How vectors are removed from the subspace, when required.
Definition: diismanager.h:60
Definition: diismanager.h:53
bool add_entry(SharedMatrix state, SharedMatrix error)
Definition: diismanager.h:83
bool add_entry(int numQuatities,...)
Definition: diismanager.cc:209
void set_error_vector_size(int numQuantities,...)
Definition: diismanager.cc:141
int _maxSubspaceSize
The maximum number of vectors allowed in the subspace.
Definition: diismanager.h:104
StoragePolicy _storagePolicy
How the vectors are handled in memory.
Definition: diismanager.h:100
The DIISManager class handles DIIS extrapolations.
Definition: diismanager.h:45