MPQC  3.0.0-alpha
wfn.h
1 //
2 // wfn.h
3 //
4 // Copyright (C) 1996 Limit Point Systems, Inc.
5 //
6 // Author: Curtis Janssen <cljanss@limitpt.com>
7 // Maintainer: LPS
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_wfn_wfn_h
29 #define _chemistry_qc_wfn_wfn_h
30 
31 #include <iostream>
32 
33 #include <util/misc/compute.h>
34 #include <math/scmat/matrix.h>
35 #include <math/scmat/vector3.h>
36 #include <chemistry/molecule/energy.h>
37 #include <chemistry/qc/basis/basis.h>
38 #include <chemistry/qc/basis/integral.h>
39 #include <chemistry/qc/basis/orthog.h>
40 #include <chemistry/qc/wfn/orbitalspace.h>
41 #ifdef MPQC_NEW_FEATURES
42 #include <util/misc/xml.h>
43 #endif // MPQC_NEW_FEATURES
44 
45 
46 namespace sc {
47 
50 
53 
54  RefSCDimension aodim_;
55  RefSCDimension sodim_;
56  Ref<SCMatrixKit> basiskit_;
57 
58  ResultRefSymmSCMatrix overlap_;
59  ResultRefSymmSCMatrix hcore_;
60 
61  protected:
62  ResultRefSCMatrix natural_orbitals_;
63  ResultRefDiagSCMatrix natural_density_;
65 
66  private:
67  double * bs_values;
68  double * bsg_values;
69 
70  Ref<Integral> integral_;
71 
72  Ref<GaussianBasisSet> atom_basis_;
73  double * atom_basis_coef_;
74 
75  double lindep_tol_;
76  OverlapOrthog::OrthogMethod orthog_method_;
77  Ref<OverlapOrthog> orthog_;
78 
79  int print_nao_;
80  int print_npa_;
81 
82  int dk_; // 0, 1, 2, or 3
83  Ref<GaussianBasisSet> momentum_basis_;
84 
85  mutable double magnetic_moment_;
86 
87  void init_orthog();
88 
89  void set_up_charge_types(std::vector<int> &q_pc,
90  std::vector<int> &q_cd,
91  std::vector<int> &n_pc,
92  std::vector<int> &n_cd);
93 
94  double nuc_rep_pc_pc(const std::vector<int>&,const std::vector<int>&,bool);
95  double nuc_rep_pc_cd(const std::vector<int>&,const std::vector<int>&);
96  double nuc_rep_cd_cd(const std::vector<int>&,const std::vector<int>&,bool);
97  void scale_atom_basis_coef();
98 
99  void nuc_rep_grad_pc_pc(double **grad,
100  const std::vector<int>&c1,
101  const std::vector<int>&c2,
102  bool uniq);
103  void nuc_rep_grad_pc_cd(double **grad,
104  const std::vector<int>&c1,
105  const std::vector<int>&c2);
106  void nuc_rep_grad_cd_cd(double **grad,
107  const std::vector<int>&c1,
108  const std::vector<int>&c2,
109  bool uniq);
110 
111  // Compute the dk relativistic core hamiltonian.
112  RefSymmSCMatrix core_hamiltonian_dk(
113  int dk,
114  const Ref<GaussianBasisSet> &bas,
115  const Ref<GaussianBasisSet> &pbas = 0);
116  void core_hamiltonian_dk2_contrib(const RefSymmSCMatrix &h_pbas,
117  const RefDiagSCMatrix &E,
118  const RefDiagSCMatrix &K,
119  const RefDiagSCMatrix &p2,
120  const RefDiagSCMatrix &p2K2,
121  const RefDiagSCMatrix &p2K2_inv,
122  const RefSymmSCMatrix &AVA_pbas,
123  const RefSymmSCMatrix &BpVpB_pbas);
124  void core_hamiltonian_dk3_contrib(const RefSymmSCMatrix &h_pbas,
125  const RefDiagSCMatrix &E,
126  const RefDiagSCMatrix &B,
127  const RefDiagSCMatrix &p2K2_inv,
128  const RefSCMatrix &so_to_p,
129  const RefSymmSCMatrix &pxVp);
130 
133  bool nonzero_efield_supported() const;
134 
135  protected:
136 
137  int debug_;
138 
139  double min_orthog_res();
140  double max_orthog_res();
141 
142  void copy_orthog_info(const Ref<Wavefunction> &);
143 
144  public:
178  Wavefunction(const Ref<KeyVal>&);
179  virtual ~Wavefunction();
180 
181  void save_data_state(StateOut&);
182 #ifdef MPQC_NEW_FEATURES
183  virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
184 #endif
185 
186  double density(const SCVector3&);
187  double density_gradient(const SCVector3&,double*);
188  double natural_orbital(const SCVector3& r, int iorb);
189  double natural_orbital_density(const SCVector3& r,
190  int orb, double* orbval = 0);
191  double orbital(const SCVector3& r, int iorb, const RefSCMatrix& orbs);
192  // same as above, except computes all orbital AND orbs must be transposed (i.e. mo rows, ao columns)
193  void orbitals(const SCVector3& r, const RefSCMatrix& orbs, RefSCVector& values);
194  // same as above except it evaluates on a set of values, and is static
195  static void orbitals(const Ref<OrbitalSpace>& orbs,
196  const std::vector<SCVector3>& r,
197  std::vector<double>& values);
198 
199  double orbital_density(const SCVector3& r,
200  int iorb,
201  const RefSCMatrix& orbs,
202  double* orbval = 0);
203 
205  double total_charge() const;
207  virtual int nelectron() = 0;
217  virtual double magnetic_moment() const;
218 
220  virtual RefSymmSCMatrix density() = 0;
222  virtual RefSymmSCMatrix ao_density();
224  virtual RefSCMatrix natural_orbitals();
227 
229  int spin_polarized() { return magnetic_moment() != 0.0; }
230 
232  int dk() const { return dk_; }
233 
235  virtual RefSymmSCMatrix alpha_density();
237  virtual RefSymmSCMatrix beta_density();
242 
244  virtual RefSCMatrix nao(double *atom_charges=0);
245 
247  virtual RefSymmSCMatrix overlap();
252  const Ref<GaussianBasisSet> &bas,
253  const Ref<GaussianBasisSet> &pbas = 0);
256  // Compute the non-relativistic core hamiltonian.
257  RefSymmSCMatrix core_hamiltonian_nr(
258  const Ref<GaussianBasisSet> &bas);
259 
260 
264  virtual double nuclear_repulsion_energy();
269  void nuclear_repulsion_energy_gradient(double *g);
274  virtual void nuclear_repulsion_energy_gradient(double **g);
275 
285  Ref<Molecule> molecule() const;
294  const double *atom_basis_coef() const;
297 
298  // override symmetry_changed from MolecularEnergy
299  void symmetry_changed();
300 
308 
312 
318  virtual void set_orthog_method(const OverlapOrthog::OrthogMethod&);
319 
321  double lindep_tol() const;
323  void set_lindep_tol(double);
324 
325  void obsolete();
326 
327  void print(std::ostream& = ExEnv::out0()) const;
328 
329 
332  void writeorbitals();
333 };
334 
336 // end of addtogroup ChemistryElectronicStructure
337 
338 }
339 
340 #endif
341 
342 // Local Variables:
343 // mode: c++
344 // c-file-style: "ETS"
345 // End:
sc::Wavefunction::atom_basis_coef
const double * atom_basis_coef() const
Returns the coefficients of the nuclear charge distribution basis functions.
sc::Wavefunction::natural_orbitals
virtual RefSCMatrix natural_orbitals()
Returns the natural orbitals, in SO basis.
sc::Wavefunction::nao
virtual RefSCMatrix nao(double *atom_charges=0)
returns the ao to nao transformation matrix
sc::Wavefunction::atom_basis
Ref< GaussianBasisSet > atom_basis() const
Returns the basis set describing the nuclear charge distributions.
sc::Wavefunction::magnetic_moment
virtual double magnetic_moment() const
Computes the S (or J) magnetic moment of the target state(s), in units of .
sc::RefSymmSCMatrix
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition: matrix.h:265
sc::Wavefunction::lindep_tol
double lindep_tol() const
Returns the tolerance for linear dependencies.
sc::OverlapOrthog::OrthogMethod
OrthogMethod
An enum for the types of orthogonalization.
Definition: orthog.h:42
sc::RefSCMatrix
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition: matrix.h:135
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::Wavefunction::integral
Ref< Integral > integral()
Returns the integral evaluator.
sc::Wavefunction::beta_ao_density
virtual RefSymmSCMatrix beta_ao_density()
Return beta electron densities in the AO basis.
sc::Wavefunction::beta_density
virtual RefSymmSCMatrix beta_density()
Return beta electron densities in the SO basis.
sc::Wavefunction
A Wavefunction is a MolecularEnergy that utilizies a GaussianBasisSet.
Definition: wfn.h:52
sc::Wavefunction::so_to_orthog_so
RefSCMatrix so_to_orthog_so()
Returns a matrix which does the default transform from SO's to orthogonal SO's.
sc::Wavefunction::core_hamiltonian
virtual RefSymmSCMatrix core_hamiltonian()
Returns the SO core Hamiltonian.
sc::RefDiagSCMatrix
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition: matrix.h:389
sc::Wavefunction::nuclear_repulsion_energy
virtual double nuclear_repulsion_energy()
Returns the nuclear repulsion energy.
sc::Wavefunction::so_dimension
RefSCDimension so_dimension()
Symmetry adapted orbital dimension.
sc::AccResult< RefSymmSCMatrix >
sc::Wavefunction::basis_matrixkit
Ref< SCMatrixKit > basis_matrixkit()
Matrix kit for AO, SO, orthogonalized SO, and MO dimensioned matrices.
sc::Wavefunction::symmetry_changed
void symmetry_changed()
Call this if you have changed the molecular symmetry of the molecule contained by this MolecularEnerg...
sc::Wavefunction::ao_density
virtual RefSymmSCMatrix ao_density()
Returns the AO density.
sc::Wavefunction::natural_density
virtual RefDiagSCMatrix natural_density()
Returns the natural density (a diagonal matrix).
sc::Wavefunction::alpha_ao_density
virtual RefSymmSCMatrix alpha_ao_density()
Return alpha electron densities in the AO basis.
sc::Wavefunction::dk
int dk() const
Returns the level the of the Douglas-Kroll approximation.
Definition: wfn.h:232
sc::StateIn
Definition: statein.h:79
sc::RefSCDimension
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:152
sc::Wavefunction::spin_polarized
int spin_polarized()
Return 1 if the magnetic moment != 0.
Definition: wfn.h:229
sc::Wavefunction::obsolete
void obsolete()
Marks all results as being out of date.
sc::MolecularEnergy
The MolecularEnergy abstract class inherits from the Function class.
Definition: energy.h:50
sc::Wavefunction::writeorbitals
void writeorbitals()
output orbitals to some files to facilitate plotting, with the help of the WriteOrbital class.
sc::Wavefunction::nuclear_repulsion_energy_gradient
void nuclear_repulsion_energy_gradient(double *g)
Computes the nuclear repulsion gradient.
sc::Wavefunction::basis
Ref< GaussianBasisSet > basis() const
Returns the basis set.
sc::Wavefunction::core_hamiltonian_for_basis
virtual RefSymmSCMatrix core_hamiltonian_for_basis(const Ref< GaussianBasisSet > &bas, const Ref< GaussianBasisSet > &pbas=0)
Returns the SO core Hamiltonian in the given basis and momentum basis.
sc::Wavefunction::alpha_density
virtual RefSymmSCMatrix alpha_density()
Return alpha electron densities in the SO basis.
sc::Wavefunction::set_lindep_tol
void set_lindep_tol(double)
Re(Sets) the tolerance for linear dependencies.
sc::Wavefunction::ao_dimension
RefSCDimension ao_dimension()
Atomic orbital dimension.
sc::Wavefunction::set_orthog_method
virtual void set_orthog_method(const OverlapOrthog::OrthogMethod &)
(Re)Sets the orthogonalization method and makes this obsolete.
sc::Wavefunction::orthog_method
OverlapOrthog::OrthogMethod orthog_method() const
Returns the orthogonalization method.
sc::RefSCVector
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition: matrix.h:55
sc::Wavefunction::molecule
Ref< Molecule > molecule() const
Returns the Molecule.
sc::StateOut
Definition: stateout.h:71
sc::XMLWriter
Definition: xmlwriter.h:215
sc::Wavefunction::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::Wavefunction::overlap
virtual RefSymmSCMatrix overlap()
Returns the SO overlap matrix.
sc::Wavefunction::total_charge
double total_charge() const
Returns the total charge of the system.
sc::SCVector3
a 3-element version of SCVector
Definition: vector3.h:43
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::Wavefunction::nelectron
virtual int nelectron()=0
Returns the number of electrons.
sc::Wavefunction::oso_dimension
RefSCDimension oso_dimension()
Orthogonalized symmetry adapted orbital dimension.
sc::Wavefunction::so_to_orthog_so_inverse
RefSCMatrix so_to_orthog_so_inverse()
Returns the inverse of the transformation returned by so_to_orthog_so.
sc::Wavefunction::momentum_basis
Ref< GaussianBasisSet > momentum_basis() const
Returns the basis used for p^2 in the DK correction.
sc::Wavefunction::density
virtual RefSymmSCMatrix density()=0
Returns the SO density.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::Wavefunction::print
void print(std::ostream &=ExEnv::out0()) const
Print information about the object.

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