28 #ifndef _chemistry_qc_basis_petite_h
29 #define _chemistry_qc_basis_petite_h
39 #include <util/misc/scint.h>
40 #include <util/ref/ref.h>
41 #include <math/scmat/blocked.h>
42 #include <math/scmat/offset.h>
43 #include <chemistry/molecule/molecule.h>
44 #include <chemistry/qc/basis/gaussbas.h>
45 #include <chemistry/qc/basis/integral.h>
51 inline sc_int_least64_t
52 ij_offset64(sc_int_least64_t i, sc_int_least64_t j)
54 return (i>j) ? (((i*(i+1)) >> 1) + j) : (((j*(j+1)) >> 1) + i);
57 inline sc_int_least64_t
58 i_offset64(sc_int_least64_t i)
60 return ((i*(i+1)) >> 1);
66 int **compute_atom_map(
const Ref<GaussianBasisSet> &);
67 void delete_atom_map(
int **atom_map,
const Ref<GaussianBasisSet> &);
69 int **compute_shell_map(
int **atom_map,
const Ref<GaussianBasisSet> &);
70 void delete_shell_map(
int **shell_map,
const Ref<GaussianBasisSet> &);
92 SO& operator=(
const SO&);
95 void reset_length(
int);
98 int equiv(
const SO& so);
109 void set_length(
int);
110 void reset_length(
int);
112 int add(
SO& s,
int i);
113 void print(
const char *title);
150 int nirrep()
const {
return nirrep_; }
151 int order()
const {
return ng_; }
152 int atom_map(
int n,
int g)
const {
return (c1_) ? n : atom_map_[n][g]; }
153 int shell_map(
int n,
int g)
const {
return (c1_) ? n : shell_map_[n][g]; }
154 int lambda(
int ij)
const {
return (c1_) ? 1 : (int) lamij_[ij]; }
155 int lambda(
int i,
int j)
const
156 {
return (c1_) ? 1 : (int) lamij_[ij_offset(i,j)]; }
158 int in_p1(
int n)
const {
return (c1_) ? 1 : (int) p1_[n]; }
159 int in_p2(
int ij)
const {
return (c1_) ? 1 : (int) lamij_[ij]; }
161 int in_p2(
int i,
int j)
const {
return (c1_) ? 1 : (int) lamij_[ij_offset(i,j)]; }
162 int in_p4(
int ij,
int kl,
int i,
int j,
int k,
int l)
const;
164 int in_p4(
int i,
int j,
int k,
int l)
const;
166 int nfunction(
int i)
const
167 {
return (c1_) ? gbs_->
nbasis() : nbf_in_ir_[i]; }
169 int nblocks()
const {
return nblocks_; }
171 void print(std::ostream& =
ExEnv::out0(),
int verbose=1);
174 RefSCDimension AO_basisdim();
175 RefSCDimension SO_basisdim();
178 RefSCMatrix r(
int g);
181 SO_block * aotoso_info();
182 RefSCMatrix aotoso();
183 RefSCMatrix sotoao();
186 void symmetrize(
const RefSymmSCMatrix& skel,
const RefSymmSCMatrix& sym);
190 RefSymmSCMatrix to_SO_basis(
const RefSymmSCMatrix&);
193 RefSymmSCMatrix to_AO_basis(
const RefSymmSCMatrix&);
197 RefSCMatrix evecs_to_AO_basis(
const RefSCMatrix&);
199 RefSCMatrix evecs_to_SO_basis(
const RefSCMatrix&);
203 PetiteList::in_p4(
int ij,
int kl,
int i,
int j,
int k,
int l)
const
208 sc_int_least64_t ijkl = i_offset64(ij)+kl;
211 for (
int g=1; g < ng_; g++) {
212 int gij = ij_offset(shell_map_[i][g],shell_map_[j][g]);
213 int gkl = ij_offset(shell_map_[k][g],shell_map_[l][g]);
214 sc_int_least64_t gijkl = ij_offset64(gij,gkl);
218 else if (gijkl == ijkl)
226 PetiteList::in_p4(
int i,
int j,
int k,
int l)
const
231 int ij = ij_offset(i,j);
232 int kl = ij_offset(k,l);
233 sc_int_least64_t ijkl = ij_offset64(ij,kl);
236 for (
int g=1; g < ng_; g++) {
237 int gij = ij_offset(shell_map_[i][g],shell_map_[j][g]);
238 int gkl = ij_offset(shell_map_[k][g],shell_map_[l][g]);
239 sc_int_least64_t gijkl = ij_offset64(gij,gkl);
243 else if (gijkl == ijkl)