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 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_bin_occ_dpd_h_
30 #define _psi_src_bin_occ_dpd_h_
31 
32 
33 using namespace psi;
34 using namespace std;
35 
36 namespace psi{ namespace occwave{
37 
38 class SymBlockVector;
39 
41 {
42 
43  private:
44  double ***matrix_; // Object
45  int *rowspi_; // Rows per irrep
46  int *colspi_; // Columns per irrep
47  std::string name_; // Name of the matrix
48  int nirreps_; // Number of irreps
49 
50 
51  public:
52  SymBlockMatrix(); //default constructer
53  SymBlockMatrix(std::string name);
54  SymBlockMatrix(int nirreps, int *ins_rowspi, int *ins_colspi);
55  SymBlockMatrix(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
56  ~SymBlockMatrix(); //destructer
57 
58  SymBlockMatrix* generate(int nirreps, int *ins_rowspi, int *ins_colspi);
59  SymBlockMatrix* generate(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
60  SymBlockMatrix* transpose();
61  void init(std::string name, int nirreps, int *ins_rowspi, int *ins_colspi);
62  void memalloc();
63  void release();
64  void zero();
65  void zero_diagonal();
66  double trace();
67  SymBlockMatrix* transpose(int *ins_rowspi, int *ins_colspi);
68  void copy(const SymBlockMatrix* Adum);
69  void add(const SymBlockMatrix* Adum);
70  void add(int h, int i, int j, double value);
71  void subtract(const SymBlockMatrix* Adum);
72  void subtract(int h, int i, int j, double value);
73  void scale(double a);
74  void scale_row(int h, int m, double a);
75  void scale_column(int h, int n, double a);
76  double sum_of_squares();
77  double rms();
78  double rms(SymBlockMatrix* Atemp);
79  void set(double value);
80  void set(int h, int i, int j, double value);
81  void set(double **Asq);
82  void set(dpdbuf4 G);
83  double get(int h, int m, int n);
84  double *to_lower_triangle();
85  double **to_block_matrix();
86  void print(std::string OutFileRMR);
87  void print();
88  void set_to_identity();
89  void gemm(bool transa, bool transb, double alpha, const SymBlockMatrix* a, const SymBlockMatrix* b, double beta);
90  int *rowspi();
91  int *colspi();
92  bool load(PSIO* psio, int itap, const char *label, int dim);
93  bool load(std::shared_ptr<psi::PSIO> psio, int itap, const char *label, int dim);
94  void write(PSIO* psio, int itap, bool saveSubBlocks);
95  void write(std::shared_ptr<psi::PSIO> psio, int itap, bool saveSubBlocks);
96  void read(std::shared_ptr<psi::PSIO> psio, int itap, bool readSubBlocks);
97  void read(std::shared_ptr<psi::PSIO> psio, int itap, const char *label, bool readSubBlocks);
98  void mgs();// Modified Gram-Schmidt
99  void gs();// Gram-Schmidt
100  void diagonalize(SymBlockMatrix* eigvectors, SymBlockVector* eigvalues);
101  void cdsyev(char jobz, char uplo, SymBlockMatrix* eigvectors, SymBlockVector* eigvalues); // diagonalize via acml
102  void davidson(int n_eigval, SymBlockMatrix* eigvectors, SymBlockVector* eigvalues, double cutoff, int print); // diagonalize via davidson alg.
103  void cdgesv(SymBlockVector* Xvec); // solve lineq via acml
104  void lineq_flin(SymBlockVector* Xvec, double *det); // solve lineq via flin
105  void lineq_pople(SymBlockVector* Xvec, int num_vecs, double cutoff); // solve lineq via pople
106  void read_oooo(std::shared_ptr<psi::PSIO> psio, int itap, int *mosym, int *qt2pitzer, int *occ_off, int *occpi, Array3i *oo_pairidx);
107  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,
108  int *virpi, Array3i *oo_pairidx, Array3i *vv_pairidx);
109 
110 
111  friend class SymBlockVector;
112 };
113 
114 
116 {
117 
118  private:
119  double **vector_; // Object
120  int *dimvec_; // dimensions per irrep
121  string name_; // Name of the vector
122  int nirreps_; // Number of irreps
123 
124 
125  public:
126  SymBlockVector(); //default constructer
127  SymBlockVector(string name);
128  SymBlockVector(int nirreps, int *ins_dimvec);
129  SymBlockVector(string name, int nirreps, int *ins_dimvec);
130  ~SymBlockVector(); //destructer
131 
132  int *dimvec();
133  void memalloc();
134  void release();
135  void zero();
136  double trace();
137  void copy(const SymBlockVector* Adum);
138  void add(const SymBlockVector* Adum);
139  void add(int h, int i, double value);
140  void subtract(const SymBlockVector* Adum);
141  void subtract(int h, int i, double value);
142  void scale(double a);
143  double sum_of_squares();
144  double rms();
145  double rms(SymBlockVector* Atemp);
146  double norm();
147  void set(double value);
148  void set(int h, int i, double value);
149  void set(double *Avec);
150  double get(int h, int m);
151  double *to_vector();
152  void print(std::string OutFileRMR);
153  void print();
154  void set_to_unit();
155  void gemv(bool transa, double alpha, SymBlockMatrix* A, SymBlockVector* X, double beta);
156  double dot(SymBlockVector* X);
157 
158  friend class SymBlockMatrix;
159 };
160 
161 }} // End Namespaces
162 #endif // _psi_src_bin_occ_dpd_h_
double dot(BlockMatrix *A, BlockMatrix *B)
Definition: mcscf/block_matrix.cc:224
int nirreps_
Definition: occ/dpd.h:48
std::string name_
Definition: occ/dpd.h:47
int * rowspi_
Definition: occ/dpd.h:45
Definition: matrixtmp.h:42
int * colspi_
Definition: occ/dpd.h:46
Definition: pointgrp.h:106
Definition: occ/dpd.h:115
SharedWavefunction occwave(SharedWavefunction, Options &)
Definition: occ/main.cc:35
double *** matrix_
Definition: occ/dpd.h:44
Definition: occ/arrays.h:270
Definition: occ/dpd.h:40
Definition: libdpd/dpd.h:105
double ** vector_
Definition: occ/dpd.h:119
int * dimvec_
Definition: occ/dpd.h:120
Definition: PsiFileImpl.h:39
int nirreps_
Definition: occ/dpd.h:122
string name_
Definition: occ/dpd.h:121
Definition: psio.hpp:197