Psi4
basisset.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 _psi_src_lib_libmints_basisset_h_
29 #define _psi_src_lib_libmints_basisset_h_
30 
31 #include <cstdio>
32 #include <string>
33 #include <vector>
34 
35 #include "gshell.h"
36 #include "molecule.h"
37 
38  #include "psi4/pragma.h"
39  PRAGMA_WARNING_PUSH
40  PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS
41  #include <memory>
43 #include "psi4/psi4-dec.h"
44 namespace psi {
45 
46 
47 
48 class Molecule;
49 class GaussianShell;
50 
51 class Chkpt;
52 class BasisSetParser;
53 class DealiasBasisSet;
54 class SOTransformShell;
55 class SphericalTransform;
56 class SOTransform;
57 class Matrix;
58 class Vector3;
59 class SOBasisSet;
60 class IntegralFactory;
61 
64 
69 class BasisSet
70 {
71  friend class BasisSetParser;
72 
74  std::string name_;
75 
76  // Key and target information from constructing
77  std::string key_;
78  std::string target_;
79 
82 
84  std::vector<int> sorted_ao_shell_list_;
85 
87  std::shared_ptr<Molecule> molecule_;
88 
89  // Has static information been initialized?
90  static bool initialized_shared_;
91 
92  /*
93  * Scalars
94  */
96  int nao_;
98  int nbf_;
106  int max_am_;
110  bool puream_;
111 
112  /*
113  * Arrays
114  */
133 
135  double *uexponents_;
137  double *ucoefficients_;
143  double *xyz_;
144 
145 
146 
147 
148 public:
149  BasisSet();
150 
151  BasisSet(const std::string &basistype, SharedMolecule mol,
152  std::map<std::string, std::map<std::string, std::vector<ShellInfo> > > &shell_map);
153 
159  static std::shared_ptr<BasisSet> build(std::shared_ptr<Molecule> molecule,
160  const std::vector<ShellInfo> &shells);
161 
163  static void initialize_singletons();
164 
168  int nprimitive() const { return nprimitive_; }
174  int max_nprimitive() const { return max_nprimitive_; }
178  int nshell() const { return n_shells_; }
182  int nao() const { return nao_; }
186  int nbf() const { return nbf_; }
190  int max_am() const { return max_am_; }
194  bool has_puream() const { return puream_; }
198  int max_function_per_shell() const { return (puream_) ? 2*max_am_+1 : (max_am_+1)*(max_am_+2)/2; }
202  std::shared_ptr<Molecule> molecule() const;
207  int shell_to_ao_function(int i) const { return shell_first_ao_[i]; }
212  int shell_to_center(int i) const { return shell_center_[i]; }
218 
220  int function_to_shell(int i) const { return function_to_shell_[i]; }
225  int function_to_center(int i) const { return function_center_[i]; }
226 
228  int ao_to_shell(int i) const { return ao_to_shell_[i]; }
229 
234  const GaussianShell& shell(int si) const;
235 
241  const GaussianShell& shell(int center, int si) const;
242 
247  void print(std::string out) const;
248  void print() const { print("outfile"); }
250 
252  const std::string & name() const { return name_; }
253  void set_name(const std::string str) {name_ = str;}
254 
256  const std::string & key() const { return key_; }
257  const std::string & target() const { return target_; }
258 
267  void print_by_level(std::string out = "outfile", int print_level = 2) const;
271  void print_summary(std::string out = "outfile") const;
272 
276  void print_detail(std::string out) const;
277  void print_detail() const { print_detail("outfile"); }
278 
282  std::string print_detail_cfour() const;
283 
288  void refresh();
289 
291  int nshell_on_center(int i) const { return center_to_nshell_[i]; }
293  int shell_on_center(int center, int shell) const { return center_to_shell_[center] + shell; }
294 
295 
302  static std::shared_ptr<BasisSet> zero_ao_basis_set();
303 
310  static std::shared_ptr<SOBasisSet> zero_so_basis_set(const std::shared_ptr<IntegralFactory>& factory);
311 
319  static std::pair<std::vector<std::string>, std::shared_ptr<BasisSet> > test_basis_set(int max_am);
320 
321 
329  static std::shared_ptr<BasisSet> construct_from_pydict(const std::shared_ptr <Molecule> &mol, py::dict pybs, const int forced_puream);
330 
335  static std::string make_filename(const std::string& basisname);
336 
338  static std::vector<Vector3> exp_ao[];
339 
341  int get_ao_sorted_shell(const int &i) { return sorted_ao_shell_list_[i]; }
343  std::vector<int> get_ao_sorted_list() { return sorted_ao_shell_list_; }
344 
345  // Returns the values of the basis functions at a point
346  void compute_phi(double *phi_ao, double x, double y, double z);
347 
348  // BasisSet friends
350 };
351 
352 }
353 
354 #endif
int * center_to_nshell_
How many shells are there on each center?
Definition: basisset.h:130
int n_uprimitive_
The number of unique primitives.
Definition: basisset.h:100
int nprimitive_
The number of primitives.
Definition: basisset.h:104
Class for reading in basis sets formatted for Gaussian.
Definition: basisset_parser.h:124
double * ucoefficients_
The flattened lists of unique contraction coefficients (normalized)
Definition: basisset.h:137
static std::vector< Vector3 > exp_ao[]
Global arrays of x, y, z exponents.
Definition: basisset.h:338
int ao_to_shell(int i) const
Definition: basisset.h:228
int * function_center_
Which center is a given function on?
Definition: basisset.h:128
int n_shells_
The number of shells.
Definition: basisset.h:102
double * uoriginal_coefficients_
The flattened lists of unique contraction coefficients (as provided by the user)
Definition: basisset.h:139
std::vector< int > sorted_ao_shell_list_
vector of shells numbers sorted in acending AM order.
Definition: basisset.h:84
const std::string & target() const
Definition: basisset.h:257
double * xyz_
The flattened list of Cartesian coordinates for each atom.
Definition: basisset.h:143
double * uerd_coefficients_
The flattened lists of ERD normalized contraction coefficients.
Definition: basisset.h:141
int nbf() const
Definition: basisset.h:186
void set_name(const std::string str)
Definition: basisset.h:253
static bool initialized_shared_
Definition: basisset.h:90
int max_nprimitive_
The maximum number of primitives in a shell.
Definition: basisset.h:108
void print_by_level(std::string out="outfile", int print_level=2) const
Definition: basisset.cc:195
Definition: pointgrp.h:105
std::vector< int > get_ao_sorted_list()
Returns the vector of sorted shell list.
Definition: basisset.h:343
int * function_to_shell_
Which shell does a given (Cartesian / spherical) function belong to?
Definition: basisset.h:124
int nbf_
Number of basis functions (either cartesian or spherical)
Definition: basisset.h:98
static std::shared_ptr< BasisSet > construct_from_pydict(const std::shared_ptr< Molecule > &mol, py::dict pybs, const int forced_puream)
Definition: basisset.cc:463
int * shell_first_ao_
The first (Cartesian) atomic orbital in each shell.
Definition: basisset.h:118
void print_summary(std::string out="outfile") const
Definition: basisset.cc:207
int max_am() const
Definition: basisset.h:190
std::string target_
Definition: basisset.h:78
int shell_to_ao_function(int i) const
Definition: basisset.h:207
int nao() const
Definition: basisset.h:182
int nprimitive() const
Definition: basisset.h:168
Abstract class for parsing basis sets from a text file.
Definition: basisset_parser.h:81
void print() const
Definition: basisset.h:248
int * shell_first_basis_function_
The first (Cartesian / spherical) basis function in each shell.
Definition: basisset.h:120
const std::string & name() const
Returns the name of this basis set.
Definition: basisset.h:252
int * shell_center_
Shell number to atomic center.
Definition: basisset.h:122
std::shared_ptr< Molecule > molecule_
Molecule object.
Definition: basisset.h:87
int get_ao_sorted_shell(const int &i)
Returns the value of the sorted shell list.
Definition: basisset.h:341
PRAGMA_WARNING_PUSH PRAGMA_WARNING_IGNORE_DEPRECATED_DECLARATIONS PRAGMA_WARNING_POP
Definition: integraliter.cc:42
int shell_to_center(int i) const
Definition: basisset.h:212
static std::shared_ptr< BasisSet > build(std::shared_ptr< Molecule > molecule, const std::vector< ShellInfo > &shells)
Definition: basisset.cc:142
std::shared_ptr< Molecule > molecule() const
Definition: basisset.cc:177
int function_to_shell(int i) const
Definition: basisset.h:220
int max_function_per_shell() const
Definition: basisset.h:198
double * uexponents_
The flattened lists of unique exponents.
Definition: basisset.h:135
static std::shared_ptr< SOBasisSet > zero_so_basis_set(const std::shared_ptr< IntegralFactory > &factory)
bool has_puream() const
Definition: basisset.h:194
void print_detail() const
Definition: basisset.h:277
std::string key_
Definition: basisset.h:77
Gaussian orbital shell.
Definition: gshell.h:191
int function_to_center(int i) const
Definition: basisset.h:225
BasisSet()
Definition: basisset.cc:88
void refresh()
Definition: basisset.cc:707
Basis set container class.
Definition: basisset.h:69
int shell_to_basis_function(int i) const
Definition: basisset.h:217
std::string print_detail_cfour() const
Definition: basisset.cc:315
int nao_
Number of atomic orbitals (Cartesian)
Definition: basisset.h:96
int * ao_to_shell_
Which shell does a given Cartesian function belong to?
Definition: basisset.h:126
int * n_prim_per_shell_
The number of primitives (and exponents) in each shell.
Definition: basisset.h:116
int shell_on_center(int center, int shell) const
Return the overall shell number.
Definition: basisset.h:293
static std::pair< std::vector< std::string >, std::shared_ptr< BasisSet > > test_basis_set(int max_am)
Definition: basisset.cc:796
static std::shared_ptr< BasisSet > zero_ao_basis_set()
Definition: basisset.cc:449
const std::string & key() const
Return the construction key and target information.
Definition: basisset.h:256
std::string name_
The name of this basis set (e.g. &quot;BASIS&quot;, &quot;RI BASIS&quot;)
Definition: basisset.h:74
const GaussianShell & shell(int si) const
Definition: basisset.cc:433
std::shared_ptr< Molecule > SharedMolecule
Definition: libmints/molecule.h:673
void compute_phi(double *phi_ao, double x, double y, double z)
Definition: basisset.cc:974
int max_nprimitive() const
Definition: basisset.h:174
static std::string make_filename(const std::string &basisname)
Definition: basisset.cc:664
int nshell_on_center(int i) const
Return the number of shells on a given center.
Definition: basisset.h:291
int nshell() const
Definition: basisset.h:178
bool puream_
Whether the basis set is uses spherical basis functions or not.
Definition: basisset.h:110
int * center_to_shell_
What&#39;s the first shell on each center?
Definition: basisset.h:132
static void initialize_singletons()
Definition: basisset.cc:155
int max_am_
The maximum angular momentum.
Definition: basisset.h:106
GaussianShell * shells_
Array of gaussian shells.
Definition: basisset.h:81