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