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