Psi4
diisentry.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_DIISENTRY_H_
30 #define _PSI_SRC_LIB_LIBDIIS_DIISENTRY_H_
31 
32 #include <string>
33 #include <map>
34 
35 namespace psi{
36 
37 class PSIO;
38 
44 class DIISEntry{
45  public:
61  DIISEntry(std::string label, int ID, int count, int vectorSize, double *vector,
62  int errorVectorSize, double *errorVector, std::shared_ptr<PSIO> psio);
63  ~DIISEntry();
65  bool dot_is_known_with(int n) {return _knownDotProducts[n];}
67  double dot_with(int n) {return _dotProducts[n];}
69  double rmsError() {return _rmsError;}
71  int orderAdded() {return _orderAdded;}
73  void set_dot_with(int n, double val) {_knownDotProducts[n] = true; _dotProducts[n] = val;}
75  void invalidate_dot(int n) {_knownDotProducts[n] = false;}
77  void set_vector(double *vec) {_vector = vec;}
79  void set_error_vector(double *vec) {_errorVector = vec;}
81  void dump_vector_to_disk();
83  void read_vector_from_disk();
89  void free_vector_memory();
95  const double *vector() {read_vector_from_disk(); return _vector;}
97  void open_psi_file();
99  void close_psi_file();
100  protected:
102  std::map<int, bool> _knownDotProducts;
104  std::map<int, double> _dotProducts;
112  int _ID;
114  double _rmsError;
116  double *_errorVector;
118  double *_vector;
120  std::string _label;
122  std::shared_ptr<PSIO> _psio;
123 };
124 
125 } // End namespace
126 
127 #endif // Header guard
int _orderAdded
The absolute number of this entry.
Definition: diisentry.h:110
double _rmsError
The RMS error for this entry.
Definition: diisentry.h:114
bool dot_is_known_with(int n)
Whether the dot product of this entry&#39;s and the nth entry&#39;s error vector is known.
Definition: diisentry.h:65
double * _errorVector
The error vector.
Definition: diisentry.h:116
std::map< int, double > _dotProducts
The list of known dot products with other DIISEntries.
Definition: diisentry.h:104
void read_error_vector_from_disk()
Allocate error vector memory and read from disk.
Definition: diisentry.cc:115
double rmsError()
The RMS error of this entry.
Definition: diisentry.h:69
void free_error_vector_memory()
Free error vector memory.
Definition: diisentry.cc:135
void set_error_vector(double *vec)
set the error vector
Definition: diisentry.h:79
double * _vector
The error vector.
Definition: diisentry.h:118
#define ID(x)
Definition: adc.h:38
void open_psi_file()
Open the psi file, if needed.
Definition: diisentry.cc:67
void invalidate_dot(int n)
Marks the dot product with vector n as invalid.
Definition: diisentry.h:75
double dot_with(int n)
The dot product of this entry&#39;s and the nth entry&#39;s error vectors.
Definition: diisentry.h:67
int orderAdded()
The absolute number of this entry.
Definition: diisentry.h:71
std::shared_ptr< PSIO > _psio
PSIO object.
Definition: diisentry.h:122
Definition: diisentry.h:60
void read_vector_from_disk()
Allocate vector memory and read from disk.
Definition: diisentry.cc:93
void free_vector_memory()
Free vector memory.
Definition: diisentry.cc:126
The DIISManager class is used to manage DIIS quantities and their corresponding error vectors...
Definition: diisentry.h:44
Definition: diisentry.h:60
void dump_error_vector_to_disk()
Put this error vector entry on disk and free the memory.
Definition: diisentry.cc:105
const double * vector()
Returns the vector.
Definition: diisentry.h:95
std::map< int, bool > _knownDotProducts
The list of which dot products, with other DIISEntries, are known.
Definition: diisentry.h:102
Definition: diisentry.h:60
std::string _label
The label used for disk storage.
Definition: diisentry.h:120
DIISEntry(std::string label, int ID, int count, int vectorSize, double *vector, int errorVectorSize, double *errorVector, std::shared_ptr< PSIO > psio)
Definition: diisentry.cc:45
InputType
The type of quantity to add to either an error vector or vector.
Definition: diisentry.h:60
const double * errorVector()
Returns the error vector.
Definition: diisentry.h:93
Definition: diisentry.h:60
void close_psi_file()
Close the psi file, if needed.
Definition: diisentry.cc:75
int _ID
The number of this entry in the current subspace.
Definition: diisentry.h:112
void set_dot_with(int n, double val)
Sets the dot product with vector n to val.
Definition: diisentry.h:73
~DIISEntry()
Definition: diisentry.cc:143
int _errorVectorSize
The length of the error vector.
Definition: diisentry.h:106
void set_vector(double *vec)
Set the vector.
Definition: diisentry.h:77
int _vectorSize
The length of the vector.
Definition: diisentry.h:108
void dump_vector_to_disk()
Put this vector entry on disk and free the memory.
Definition: diisentry.cc:83
Definition: diisentry.h:60