Psi4
cdsalclist.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 CDSALCLIST_H
30 #define CDSALCLIST_H
31 
32 #include <cstdio>
33 #include <vector>
34  #include "psi4/pragma.h"
35  PRAGMA_WARNING_PUSH
36  PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS
37  #include <memory>
39 #include "psi4/libmints/typedefs.h"
41 #include "typedefs.h"
42 
43 namespace psi {
44 
45 class MatrixFactory;
46 
47 class CdSalc {
48 public:
49  class Component {
50  public:
51  double coef;
52  int atom;
53  int xyz;
54 
55  Component(double coef_, int atom_, int xyz_) :
56  coef(coef_), atom(atom_), xyz(xyz_) {}
57  };
58 
59 private:
61  std::vector<Component> components_;
62 
64  char irrep_;
65 public:
66 
67  CdSalc(char irrep) : irrep_(irrep) {}
68 
69  void add(double coef, int atom, int xyz) {
70  components_.push_back(Component(coef,atom, xyz));
71  }
72 
73  size_t ncomponent() const { return components_.size(); }
74 
75  // made const function to access coef,atom,xyz through CdSalc[i]
76  const Component& component(int com) const { return components_[com]; }
77 
78  char irrep() const { return irrep_; }
79  void print() const;
80 };
81 
83 public:
84  class Component {
85  public:
86  double coef;
87  int irrep;
88  int salc;
89 
90  Component(double coef_, int irrep_, int salc_) :
91  coef(coef_), irrep(irrep_), salc(salc_) {}
92  };
93 
94 private:
95 
97  std::vector<Component> x_;
98  std::vector<Component> y_;
99  std::vector<Component> z_;
100 
101 public:
103 
104  void add(int xyz, double coef, int irrep, int salc) {
105  if (xyz == 0)
106  x_.push_back(Component(coef, irrep, salc));
107  else if (xyz == 1)
108  y_.push_back(Component(coef, irrep, salc));
109  else if (xyz == 2)
110  z_.push_back(Component(coef, irrep, salc));
111  }
112 
113  int nx() const { return x_.size(); }
114  int ny() const { return y_.size(); }
115  int nz() const { return z_.size(); }
116 
117  const Component& x(int n) const { return x_[n]; }
118  const Component& y(int n) const { return y_[n]; }
119  const Component& z(int n) const { return z_[n]; }
120 
121  void print() const;
122 };
123 
125 {
127 
131 
132  int ncd_;
133  int cdsalcpi_[8];
134  int nirrep_;
135 
137  std::vector<CdSalc> salcs_;
138  std::vector<CdSalcWRTAtom> atom_salcs_;
139 
140 public:
141  CdSalcList() { throw PSIEXCEPTION("CdSalcList(): U R STOOOPID!!!"); }
142 
157  int needed_irreps=0xFF,
158  bool project_out_translations=true,
159  bool project_out_rotations=true);
160  ~CdSalcList();
161 
165  size_t ncd() const { return salcs_.size(); }
166 
167  std::vector<SharedMatrix > create_matrices(const std::string &basename, const MatrixFactory &factory) const;
168  std::string salc_name(int index) const;
169 
170  char needed_irreps() const { return needed_irreps_; }
171  int nirrep(void) const { return nirrep_; }
172  int cdsalcpi(int h) const {return cdsalcpi_[h]; }
175 
176  const CdSalc& operator[](int i) const { return salcs_[i]; }
177 
178  const CdSalcWRTAtom& atom_salc(int i) const { return atom_salcs_[i]; }
179 
180  SharedMatrix matrix() const;
181  SharedMatrix matrix_irrep(int h) const; // return only salcs of a given irrep
182  //SharedMatrix matrix_projected_out() const;
183 
184  void print() const;
185 };
186 
187 } // namespace psi
188 
189 #endif // CDSALCLIST_H
std::vector< SharedMatrix > create_matrices(const std::string &basename, const MatrixFactory &factory) const
Definition: cdsalclist.cc:292
bool project_out_translations_
Definition: cdsalclist.h:129
~CdSalcList()
Definition: cdsalclist.cc:290
SharedMolecule molecule_
Definition: cdsalclist.h:126
char irrep_
Symmetry of this SALC compatible for ^ (A1 = 0)
Definition: cdsalclist.h:64
A class for creating Matrix and Vector objects.
Definition: factory.h:48
int atom
Definition: cdsalclist.h:52
size_t ncomponent() const
Definition: cdsalclist.h:73
Definition: cdsalclist.h:49
int cdsalcpi(int h) const
Definition: cdsalclist.h:172
int xyz
Definition: cdsalclist.h:53
bool project_out_translations() const
Definition: cdsalclist.h:173
bool project_out_rotations_
Definition: cdsalclist.h:130
Definition: cdsalclist.h:124
int nz() const
Definition: cdsalclist.h:115
SharedMatrix matrix_irrep(int h) const
Definition: cdsalclist.cc:342
std::vector< Component > z_
Definition: cdsalclist.h:99
std::vector< Component > x_
We split the components up for simplicity.
Definition: cdsalclist.h:97
Definition: pointgrp.h:106
std::vector< Component > components_
All the components needed for this transformation.
Definition: cdsalclist.h:61
CdSalcWRTAtom()
Definition: cdsalclist.h:102
void print() const
Definition: cdsalclist.cc:362
std::string salc_name(int index) const
Definition: cdsalclist.cc:304
char irrep() const
Definition: cdsalclist.h:78
int nx() const
Definition: cdsalclist.h:113
int irrep
Definition: cdsalclist.h:87
Definition: cdsalclist.h:84
const Component & x(int n) const
Definition: cdsalclist.h:117
std::vector< Component > y_
Definition: cdsalclist.h:98
int ncd_
Definition: cdsalclist.h:132
int cdsalcpi_[8]
Definition: cdsalclist.h:133
const CdSalcWRTAtom & atom_salc(int i) const
Definition: cdsalclist.h:178
const Component & component(int com) const
Definition: cdsalclist.h:76
const CdSalc & operator[](int i) const
Definition: cdsalclist.h:176
PRAGMA_WARNING_PUSH PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS PRAGMA_WARNING_POP
Definition: integraliter.cc:43
void print() const
Definition: cdsalclist.cc:62
int nirrep(void) const
Definition: cdsalclist.h:171
Definition: cdsalclist.h:82
std::shared_ptr< Molecule > SharedMolecule
Definition: typedefs.h:55
bool project_out_rotations() const
Definition: cdsalclist.h:174
Definition: cdsalclist.h:47
std::vector< CdSalcWRTAtom > atom_salcs_
Definition: cdsalclist.h:138
char needed_irreps() const
Definition: cdsalclist.h:170
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
std::vector< CdSalc > salcs_
Vector of all requested SALCs.
Definition: cdsalclist.h:137
Component(double coef_, int irrep_, int salc_)
Definition: cdsalclist.h:90
const Component & y(int n) const
Definition: cdsalclist.h:118
double coef
Definition: cdsalclist.h:51
void add(double coef, int atom, int xyz)
Definition: cdsalclist.h:69
int ny() const
Definition: cdsalclist.h:114
size_t ncd() const
Definition: cdsalclist.h:165
CdSalcList()
Definition: cdsalclist.h:141
char needed_irreps_
Definition: cdsalclist.h:128
void print() const
Definition: cdsalclist.cc:70
int salc
Definition: cdsalclist.h:88
const Component & z(int n) const
Definition: cdsalclist.h:119
CdSalc(char irrep)
Definition: cdsalclist.h:67
#define PSIEXCEPTION(message)
Definition: exception.h:50
SharedMatrix matrix() const
Definition: cdsalclist.cc:326
double coef
Definition: cdsalclist.h:86
int nirrep_
Definition: cdsalclist.h:134
Component(double coef_, int atom_, int xyz_)
Definition: cdsalclist.h:55
void add(int xyz, double coef, int irrep, int salc)
Definition: cdsalclist.h:104