Psi4
occ/dpd.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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_bin_occ_dpd_h_
29 #define _psi_src_bin_occ_dpd_h_
30 
31 
32 using namespace psi;
33 using namespace std;
34 
35 namespace psi{ namespace occwave{
36 
37 class SymBlockVector;
38 
40 {
41 
42  private:
43  double ***matrix_; // Object
44  int *rowspi_; // Rows per irrep
45  int *colspi_; // Columns per irrep
46  std::string name_; // Name of the matrix
47  int nirreps_; // Number of irreps
48 
49 
50  public:
51  SymBlockMatrix(); //default constructer
52  SymBlockMatrix(std::string name);
53  SymBlockMatrix(int nirreps, int *ins_rowspi, int *ins_colspi);
54  SymBlockMatrix(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
55  ~SymBlockMatrix(); //destructer
56 
57  SymBlockMatrix* generate(int nirreps, int *ins_rowspi, int *ins_colspi);
58  SymBlockMatrix* generate(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
59  SymBlockMatrix* transpose();
60  void init(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
61  void memalloc();
62  void release();
63  void zero();
64  void zero_diagonal();
65  double trace();
66  SymBlockMatrix* transpose(int *ins_rowspi, int *ins_colspi);
67  void copy(const SymBlockMatrix* Adum);
68  void add(const SymBlockMatrix* Adum);
69  void add(int h, int i, int j, double value);
70  void subtract(const SymBlockMatrix* Adum);
71  void subtract(int h, int i, int j, double value);
72  void scale(double a);
73  void scale_row(int h, int m, double a);
74  void scale_column(int h, int n, double a);
75  double sum_of_squares();
76  double rms();
77  double rms(SymBlockMatrix* Atemp);
78  void set(double value);
79  void set(int h, int i, int j, double value);
80  void set(double **Asq);
81  void set(dpdbuf4 G);
82  double get(int h, int m, int n);
83  double *to_lower_triangle();
84  double **to_block_matrix();
85  void print(std::string OutFileRMR);
86  void print();
87  void set_to_identity();
88  void gemm(bool transa, bool transb, double alpha, const SymBlockMatrix* a, const SymBlockMatrix* b, double beta);
89  int *rowspi();
90  int *colspi();
91  bool load(PSIO* psio, int itap, const char *label, int dim);
92  bool load(std::shared_ptr<psi::PSIO> psio, int itap, const char *label, int dim);
93  void write(PSIO* psio, int itap, bool saveSubBlocks);
94  void write(std::shared_ptr<psi::PSIO> psio, int itap, bool saveSubBlocks);
95  void read(std::shared_ptr<psi::PSIO> psio, int itap, bool readSubBlocks);
96  void read(std::shared_ptr<psi::PSIO> psio, int itap, const char *label, bool readSubBlocks);
97  void mgs();// Modified Gram-Schmidt
98  void gs();// Gram-Schmidt
99  void diagonalize(SymBlockMatrix* eigvectors, SymBlockVector* eigvalues);
100  void cdsyev(char jobz, char uplo, SymBlockMatrix* eigvectors, SymBlockVector* eigvalues); // diagonalize via acml
101  void davidson(int n_eigval, SymBlockMatrix* eigvectors, SymBlockVector* eigvalues, double cutoff, int print); // diagonalize via davidson alg.
102  void cdgesv(SymBlockVector* Xvec); // solve lineq via acml
103  void lineq_flin(SymBlockVector* Xvec, double *det); // solve lineq via flin
104  void lineq_pople(SymBlockVector* Xvec, int num_vecs, double cutoff); // solve lineq via pople
105  void read_oooo(std::shared_ptr<psi::PSIO> psio, int itap, int *mosym, int *qt2pitzer, int *occ_off, int *occpi, Array3i *oo_pairidx);
106  void read_oovv(std::shared_ptr<psi::PSIO> psio, int itap, int nocc, int *mosym, int *qt2pitzer, int *occ_off, int *vir_off, int *occpi,
107  int *virpi, Array3i *oo_pairidx, Array3i *vv_pairidx);
108 
109 
110  friend class SymBlockVector;
111 };
112 
113 
115 {
116 
117  private:
118  double **vector_; // Object
119  int *dimvec_; // dimensions per irrep
120  string name_; // Name of the vector
121  int nirreps_; // Number of irreps
122 
123 
124  public:
125  SymBlockVector(); //default constructer
126  SymBlockVector(string name);
127  SymBlockVector(int nirreps, int *ins_dimvec);
128  SymBlockVector(string name, int nirreps, int *ins_dimvec);
129  ~SymBlockVector(); //destructer
130 
131  int *dimvec();
132  void memalloc();
133  void release();
134  void zero();
135  double trace();
136  void copy(const SymBlockVector* Adum);
137  void add(const SymBlockVector* Adum);
138  void add(int h, int i, double value);
139  void subtract(const SymBlockVector* Adum);
140  void subtract(int h, int i, double value);
141  void scale(double a);
142  double sum_of_squares();
143  double rms();
144  double rms(SymBlockVector* Atemp);
145  double norm();
146  void set(double value);
147  void set(int h, int i, double value);
148  void set(double *Avec);
149  double get(int h, int m);
150  double *to_vector();
151  void print(std::string OutFileRMR);
152  void print();
153  void set_to_unit();
154  void gemv(bool transa, double alpha, SymBlockMatrix* A, SymBlockVector* X, double beta);
155  double dot(SymBlockVector* X);
156 
157  friend class SymBlockMatrix;
158 };
159 
160 }} // End Namespaces
161 #endif // _psi_src_bin_occ_dpd_h_
double dot(BlockMatrix *A, BlockMatrix *B)
Definition: mcscf/block_matrix.cc:223
int nirreps_
Definition: occ/dpd.h:47
std::string name_
Definition: occ/dpd.h:46
int * rowspi_
Definition: occ/dpd.h:44
Definition: matrixtmp.h:41
int * colspi_
Definition: occ/dpd.h:45
Definition: pointgrp.h:105
Definition: occ/dpd.h:114
SharedWavefunction occwave(SharedWavefunction, Options &)
Definition: occ/main.cc:34
double *** matrix_
Definition: occ/dpd.h:43
Definition: occ/arrays.h:269
Definition: occ/dpd.h:39
Definition: libdpd/dpd.h:104
double ** vector_
Definition: occ/dpd.h:118
int * dimvec_
Definition: occ/dpd.h:119
Definition: PsiFileImpl.h:38
int nirreps_
Definition: occ/dpd.h:121
string name_
Definition: occ/dpd.h:120
Definition: psio.hpp:196