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-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 CDSALCLIST_H
29 #define CDSALCLIST_H
30 
31 #include <cstdio>
32 #include <vector>
33  #include "psi4/pragma.h"
34  PRAGMA_WARNING_PUSH
35  PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS
36  #include <memory>
38 #include "psi4/libmints/typedefs.h"
40 
41 namespace psi {
42 
43 class Molecule;
44 class Matrix;
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 {
126  std::shared_ptr<Molecule> molecule_;
127  std::shared_ptr<MatrixFactory> factory_;
128 
132 
133  int ncd_;
134  int cdsalcpi_[8];
135  int nirrep_;
136 
138  std::vector<CdSalc> salcs_;
139  std::vector<CdSalcWRTAtom> atom_salcs_;
140 
141 public:
142  CdSalcList() { throw PSIEXCEPTION("CdSalcList(): U R STOOOPID!!!"); }
143 
157  CdSalcList(std::shared_ptr<Molecule> mol,
158  std::shared_ptr<MatrixFactory> fact,
159  int needed_irreps=0xFF,
160  bool project_out_translations=true,
161  bool project_out_rotations=true);
162  virtual ~CdSalcList();
163 
168  size_t ncd() const { return salcs_.size(); }
169 
170  std::vector<SharedMatrix > create_matrices(const std::string& basename);
171  std::string name_of_component(int component);
172 
173  char needed_irreps() const { return needed_irreps_; }
174  int nirrep(void) const { return nirrep_; }
175  int cdsalcpi(int h) const {return cdsalcpi_[h]; }
178 
179  const CdSalc& operator[](int i) const { return salcs_[i]; }
180 
181  const CdSalcWRTAtom& atom_salc(int i) const { return atom_salcs_[i]; }
182 
184  SharedMatrix matrix_irrep(int h); // return only salcs of a given irrep
185  //SharedMatrix matrix_projected_out() const;
186 
187  void print() const;
188 };
189 
190 } // namespace psi
191 
192 #endif // CDSALCLIST_H
bool project_out_translations_
Definition: cdsalclist.h:130
virtual ~CdSalcList()
Definition: cdsalclist.cc:318
char irrep_
Symmetry of this SALC compatible for ^ (A1 = 0)
Definition: cdsalclist.h:64
uint64_t fact(int n)
Definition: solidharmonics.cc:53
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:175
int xyz
Definition: cdsalclist.h:53
SharedMatrix matrix_irrep(int h)
Definition: cdsalclist.cc:375
bool project_out_translations() const
Definition: cdsalclist.h:176
bool project_out_rotations_
Definition: cdsalclist.h:131
Definition: cdsalclist.h:124
int nz() const
Definition: cdsalclist.h:115
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:105
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:404
char irrep() const
Definition: cdsalclist.h:78
int nx() const
Definition: cdsalclist.h:113
int irrep
Definition: cdsalclist.h:87
SharedMatrix matrix()
Definition: cdsalclist.cc:358
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:133
int cdsalcpi_[8]
Definition: cdsalclist.h:134
std::shared_ptr< Molecule > molecule_
Definition: cdsalclist.h:126
const CdSalcWRTAtom & atom_salc(int i) const
Definition: cdsalclist.h:181
const Component & component(int com) const
Definition: cdsalclist.h:76
const CdSalc & operator[](int i) const
Definition: cdsalclist.h:179
PRAGMA_WARNING_PUSH PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS PRAGMA_WARNING_POP
Definition: integraliter.cc:42
void print() const
Definition: cdsalclist.cc:62
std::string name_of_component(int component)
Definition: cdsalclist.cc:335
int nirrep(void) const
Definition: cdsalclist.h:174
Definition: cdsalclist.h:82
bool project_out_rotations() const
Definition: cdsalclist.h:177
Definition: cdsalclist.h:47
std::vector< CdSalcWRTAtom > atom_salcs_
Definition: cdsalclist.h:139
char needed_irreps() const
Definition: cdsalclist.h:173
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
std::vector< CdSalc > salcs_
Vector of all requested SALCs.
Definition: cdsalclist.h:138
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:168
CdSalcList()
Definition: cdsalclist.h:142
std::vector< SharedMatrix > create_matrices(const std::string &basename)
Definition: cdsalclist.cc:322
char needed_irreps_
Definition: cdsalclist.h:129
void print() const
Definition: cdsalclist.cc:74
int salc
Definition: cdsalclist.h:88
const Component & z(int n) const
Definition: cdsalclist.h:119
CdSalc(char irrep)
Definition: cdsalclist.h:67
std::shared_ptr< MatrixFactory > factory_
Definition: cdsalclist.h:127
#define PSIEXCEPTION(message)
Definition: exception.h:47
double coef
Definition: cdsalclist.h:86
int nirrep_
Definition: cdsalclist.h:135
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