MPQC  3.0.0-alpha
transform_factory.timpl.h
1 //
2 // transform_factory.timpl.h
3 //
4 // Copyright (C) 2008 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 _mpqc_src_lib_chemistry_qc_lcao_transformfactorytimpl_h
29 #define _mpqc_src_lib_chemistry_qc_lcao_transformfactorytimpl_h
30 
31 #include <chemistry/qc/lcao/transform_factory.h>
32 #include <chemistry/qc/lcao/transform_tbint.h>
33 
34 namespace sc {
35 
36  namespace detail {
37 
38  // these classes are needed for type-indirection
39  template <bool DF> struct MakeTwoBodyTransform;
40  template <> struct MakeTwoBodyTransform<false> {
41  static const int i = 1;
42  template <typename TransformType> static
45  const std::string& name,
46  const Ref<TwoBodyIntDescr>& descrarg) {
48  const Ref<TwoBodyIntDescr> descr = (descrarg.null() ? factory->tbintdescr() : descrarg);
49  result = new TransformType(name,factory,descr,
50  factory->space1_,
51  factory->space2_,
52  factory->space3_,
53  factory->space4_);
54 
55  if (factory->top_mole_)
56  result->set_top_mole(factory->top_mole_);
57  result->set_debug(factory->debug());
58 
59  return result;
60  }
61  };
62  template <> struct MakeTwoBodyTransform<true> {
63  static const int i = 1;
64  template <typename TransformType> static
67  const std::string& name,
68  const Ref<TwoBodyIntDescr>& descrarg) {
70  const Ref<TwoBodyIntDescr> descr = (descrarg.null() ? factory->tbintdescr() : descrarg);
71  result = new TransformType(name,factory->df_info(),descr,
72  factory->space1_,
73  factory->space2_,
74  factory->space3_,
75  factory->space4_);
76 
77  if (factory->top_mole_)
78  result->set_top_mole(factory->top_mole_);
79  result->set_debug(factory->debug());
80 
81  return result;
82  }
83  };
84 
85  template <typename TransformType> struct NeedDF {
86  static const bool value = false;
87  };
88  template <> struct NeedDF<TwoBodyMOIntsTransform_ixjy_df> {
89  static const bool value = true;
90  };
91 
92  // convert a transform type to the DF-based transform. Default is to not use a DF-based transform
93  template <typename TransformType> struct ToDensityFittingType {
94  typedef TransformType value;
95  };
98  };
99 #if 1
102  };
105  };
106 #endif
107 
108  // compare types
109  template <typename A, typename B> struct EqualTypes {
110  static const bool value = false;
111  };
112  template <typename A> struct EqualTypes<A,A> {
113  static const bool value = true;
114  };
115  }
116 
117  template <typename TransformType> Ref<TwoBodyMOIntsTransform>
118  MOIntsTransformFactory::twobody_transform(const std::string& name,
119  const Ref<TwoBodyIntDescr>& descrarg)
120  {
121  // is density fitting is possible, try calling for a DF-based transform (unless already asked for a DF-based transform)
122  if (df_info() != 0 &&
124  ! detail::EqualTypes<TransformType, typename detail::ToDensityFittingType<TransformType>::value>::value) {
125  return this->twobody_transform< typename detail::ToDensityFittingType<TransformType>::value >(name, descrarg);
126  }
127 
128  typedef detail::MakeTwoBodyTransform< detail::NeedDF<TransformType>::value > TformMaker;
129  Ref<TwoBodyMOIntsTransform> result = TformMaker::template evaluate<TransformType>(this,name,descrarg);
130  return result;
131  }
132 
133  template <typename TransformType> Ref<TwoBodyThreeCenterMOIntsTransform>
134  MOIntsTransformFactory::twobody_transform(const std::string& name,
135  const Ref<TwoBodyThreeCenterIntDescr>& descrarg) {
136  Ref<TwoBodyThreeCenterMOIntsTransform> result = new TransformType(name,this,descrarg,space1_,space2_,space3_);
137 #if 0
138  if (top_mole_)
139  result->set_top_mole(top_mole_);
140 #endif
141  return result;
142  }
143 
144 } // end of namespace sc
145 
146 #endif // end of header guard
147 
148 
149 // Local Variables:
150 // mode: c++
151 // c-file-style: "CLJ-CONDENSED"
152 // End:
sc::MOIntsTransformFactory
MOIntsTransformFactory is a factory that produces MOIntsTransform objects.
Definition: transform_factory.h:76
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::detail::NeedDF
Definition: transform_factory.timpl.h:85
sc::TwoBodyMOIntsTransform_ixjy
TwoBodyMOIntsTransform_ixjy computes (ix|jy) integrals using parallel integrals-direct AO->MO transfo...
Definition: transform_ixjy.h:41
sc::Ref::null
bool null() const
Return true if this is a reference to a null object.
Definition: ref.h:423
mpqc::lcao::evaluate
void evaluate(sc::Ref< sc::OneBodyInt > &engine, const std::vector< int > &P, const std::vector< int > &Q, TensorRef< double, 2, TensorRowMajor > &ints)
Evaluate set of shell blocks of integrals (p|O|q)
Definition: integrals.hpp:206
sc::MOIntsTransformFactory::df_info
const DensityFittingInfo * df_info() const
provides the DensityFittingInfo object
Definition: transform_factory.h:136
sc::TwoBodyMOIntsTransform_ixjy_df
TwoBodyMOIntsTransform_ixjy_df computes (ix|jy) integrals using parallel integral-direct density-fitt...
Definition: transform_ixjy_df.h:44
sc::MOIntsTransformFactory::tbintdescr
void tbintdescr(const Ref< TwoBodyIntDescr > &descr)
Changes the default TwoBodyIntDescr used to produce integrals.
Definition: transform_factory.h:142
sc::TwoBodyMOIntsTransform_iRjS
TwoBodyMOIntsTransform_iRjS computes (iR|jS), or <ij|RS> integrals, where R and S are atomic orbitals...
Definition: transform_iRjS.h:39
sc::detail::ToDensityFittingType
Definition: transform_factory.timpl.h:93
sc::detail::MakeTwoBodyTransform
Definition: transform_factory.h:71
sc::TwoBodyMOIntsTransform_ikjy
TwoBodyMOIntsTransform_ikjy computes (ik|jy) integrals using parallel integrals-direct AO->MO transfo...
Definition: transform_ikjy.h:41
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::detail::EqualTypes
Definition: transform_factory.timpl.h:109

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