MPQC  3.0.0-alpha
intparams.h
1 //
2 // intparams.h
3 //
4 // Copyright (C) 2005 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.edu>
7 // Maintainer: EV
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit 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 Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _chemistry_qc_basis_intparams_h
29 #define _chemistry_qc_basis_intparams_h
30 
31 #include <vector>
32 #include <utility>
33 #include <util/state/state.h>
34 #include <util/state/statein.h>
35 #include <util/state/stateout.h>
36 
37 namespace sc {
38 
40  {
41  public:
44 
45  double position[3];
46  double vector[3];
47 
48  void set_position(double*);
49  void set_vector(double*);
50  };
51 
52 
53  class PointChargeData: public RefCount
54  {
55  private:
56  int ncharges_;
57  const double *charges_;
58  const double *const*positions_;
59  double *alloced_charges_;
60  double **alloced_positions_;
61 
62  public:
63  // If copy_data is 0, the passed positions and charges will
64  // be stored (but not freed).
65  PointChargeData(int ncharge,
66  const double *const*positions, const double *charges,
67  int copy_data = 0);
68  ~PointChargeData();
69 
70  int ncharges() const { return ncharges_; }
71  const double *charges() const { return charges_; }
72  const double *const*positions() const { return positions_; }
73  };
74 
80  class IntParams : virtual public SavableState {
81  public:
82  IntParams(unsigned int nparams=0);
84  virtual ~IntParams();
86 
88  unsigned int nparams() const;
89 
90  protected:
91  template <typename T> const T* downcast(const IntParams& p) const {
92  const T* castptr = dynamic_cast<const T*>(&p);
93  return castptr;
94  }
95 
96  private:
97  unsigned int nparams_;
98 
99  friend bool operator==(const IntParams& p1, const IntParams& p2);
100  virtual bool equiv(const IntParams& other) const =0;
101  };
102  inline bool operator==(const IntParams& p1, const IntParams& p2) {
103  return p1.equiv(p2);
104  }
105 
107  class IntParamsVoid : public IntParams {
108  public:
109  IntParamsVoid();
111  ~IntParamsVoid();
112  void save_data_state(StateOut&);
113  private:
114  bool equiv(const IntParams& other) const;
115  };
116 
118  class IntParamsOrigin : public IntParams {
119  public:
120  IntParamsOrigin();
121  IntParamsOrigin(const double (&O)[3]);
122  template <typename Real> explicit IntParamsOrigin(const Real* O) : O_(3) {
123  std::copy(O, O+3, O_.begin());
124  }
126  ~IntParamsOrigin();
127  void save_data_state(StateOut&);
128 
129  const double* r() const;
130  double r(unsigned int xyz) const;
131 
132  private:
133  std::vector<double> O_;
134  bool equiv(const IntParams& other) const;
135  };
136 
144  class IntParamsG12 : public IntParams {
145  public:
147  typedef std::pair<double,double> PrimitiveGeminal;
148  typedef std::vector<PrimitiveGeminal> ContractedGeminal;
150  static ContractedGeminal zero_exponent_geminal;
152  static ContractedGeminal null_geminal;
153 
155  IntParamsG12(const ContractedGeminal& bra);
157  IntParamsG12(const ContractedGeminal& bra,
158  const ContractedGeminal& ket);
160  ~IntParamsG12();
161 
162  void save_data_state(StateOut&);
163 
164  const ContractedGeminal& bra() const;
165  const ContractedGeminal& ket() const;
166 
167  static PrimitiveGeminal product(const PrimitiveGeminal& A,
168  const PrimitiveGeminal& B);
169  static ContractedGeminal product(const ContractedGeminal& A,
170  const ContractedGeminal& B);
171 
172  private:
173  bool equiv(const IntParams& other) const;
174 
176  static double null_exponent;
177 
178  ContractedGeminal bra_;
179  ContractedGeminal ket_;
180  };
181 
182 }
183 
184 #endif
185 
186 // Local Variables:
187 // mode: c++
188 // c-file-style: "ETS"
189 // End:
sc::IntParamsG12::zero_exponent_geminal
static ContractedGeminal zero_exponent_geminal
1 = e^(-0.0 * r_{12}^2)
Definition: intparams.h:150
sc::IntParamsVoid::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::IntParamsVoid
Passes params to Integral::electron_repulsion() and other factory methods which do not need parameter...
Definition: intparams.h:107
sc::PointChargeData
Definition: intparams.h:53
sc::IntParams::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::IntParamsOrigin
Passes params to Integral::dipole() and other factory methods which need r information.
Definition: intparams.h:118
sc::IntParams::nparams
unsigned int nparams() const
Some IntParams implementations can have a variable number of params; otherwise this will return 0.
sc::StateIn
Definition: statein.h:79
sc::IntParamsOrigin::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::other
SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
sc::StateOut
Definition: stateout.h:71
sc::IntParams
This class passes optional operator parameters.
Definition: intparams.h:80
sc::IntParamsG12::PrimitiveGeminal
std::pair< double, double > PrimitiveGeminal
std::pair< g, c > as in c * exp( - g*r12^2)
Definition: intparams.h:147
sc::IntParamsG12::null_geminal
static ContractedGeminal null_geminal
null (i.e., invalid) geminal
Definition: intparams.h:152
sc::IntParamsG12
Used to pass params to Integral::g12().
Definition: intparams.h:144
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:45
sc::RefCount
The base class for all reference counted objects.
Definition: ref.h:192
mpqc::vector
Vector class derived from Eigen::Matrix with additional MPQC integration.
Definition: matrix.hpp:133
sc::IntParamsG12::IntParamsG12
IntParamsG12(const ContractedGeminal &bra)
Request integrals with only 1 geminal (g12, g12/r12, [Ti,g12])
sc::operator==
bool operator==(const Atom &a, const Atom &b)
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::EfieldDotVectorData
Definition: intparams.h:39
sc::IntParamsG12::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...

Generated at Sun Jan 26 2020 23:23:57 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.