Psi4
slaterd.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 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 
34 /* Slater Determinant Class
35 **
36 ** Based on a previous implementation by David Sherrill using bitsrings
37 ** from the g++ library and on a symbolic Slater's rules program written
38 ** in C by Matt Leininger
39 **
40 ** February 7, 1996
41 **
42 ** C. David Sherrill and Matthew L. Leininger
43 ** Center for Computational Quantum Chemistry
44 ** University of Georgia
45 ** Athens, GA 30606
46 **
47 ** Need to #include <cstdio> before this file
48 **
49 ** Assume number of alpha electrons is greater than or equal to the number
50 ** of beta electrons
51 **
52 ** Currently matrix_element() uses static temp arrays which are never free'd.
53 ** The arrays should always be small, so this shouldn't be a problem. The
54 ** malloc'ing is only done once, no matter how many times matrix_element is
55 ** called.
56 */
57 
58 
59 #ifndef _psi_src_bin_detci_slaterd_h
60 #define _psi_src_bin_detci_slaterd_h
61 
62 #include <stdlib.h>
63 #include <string>
64 
65 namespace psi { namespace detci {
66 
67 class CIWavefunction;
68 
70  friend class CIWavefunction;
71 
72  protected:
73  unsigned nalp_;
74  unsigned nbet_;
75  unsigned char *Occs_[2];
76 
77  public:
78  SlaterDeterminant() { nalp_=0; nbet_=0; Occs_[0]=nullptr; Occs_[1]=nullptr; }
80  if (Occs_[0] != nullptr) free(Occs_[0]);
81  if (Occs_[1] != nullptr) free(Occs_[1]);
82  }
83  void set(size_t nalp, unsigned char *alpoccs,
84  size_t nbet, unsigned char *betoccs);
85  void print(void);
86  void print_config(void);
88  friend int operator==(SlaterDeterminant& s1, SlaterDeterminant& s2) ;
90 };
91 
92 }} // namespace psi::detci
93 
94 #endif // header guard
Definition: ciwave.h:71
SlaterDeterminant & operator=(const SlaterDeterminant &s)
Definition: slaterd.cc:136
unsigned nbet_
Definition: slaterd.h:74
SlaterDeterminant()
Definition: slaterd.h:78
void set(size_t nalp, unsigned char *alpoccs, size_t nbet, unsigned char *betoccs)
Definition: slaterd.cc:55
friend double matrix_element(SlaterDeterminant *I, SlaterDeterminant *J)
SharedWavefunction detci(SharedWavefunction, Options &)
Definition: detci.cc:65
void print(void)
Definition: slaterd.cc:81
unsigned char * Occs_[2]
Definition: slaterd.h:75
unsigned nalp_
Definition: slaterd.h:73
friend int operator==(SlaterDeterminant &s1, SlaterDeterminant &s2)
Definition: slaterd.cc:151
~SlaterDeterminant()
Definition: slaterd.h:79
Definition: slaterd.h:69
void print_config(void)
Definition: slaterd.cc:99