namespace ewalena  0.2.15
ewalena is not an acronym
include/ewalena/numerics/basis_gto.h
Go to the documentation of this file.
00001 // -------------------------------------------------------------------
00002 // @author Toby D. Young
00003 // @version $Id: basis_gto.h 702 2012-02-13 02:08:58Z oneliefleft $
00004 //
00005 // Copyright 2012 namespace ewalena authors. All rights reserved.
00006 //
00007 // Redistribution and use in source and binary forms, with or without
00008 // modification, are permitted provided that the following conditions
00009 // are met:
00010 //
00011 // 1. Redistributions of source code must retain the above copyright
00012 //    notice, this list of conditions and the following disclaimer.
00013 //
00014 // 2. Redistributions in binary form must reproduce the above
00015 //    copyright notice, this list of conditions and the following
00016 //    disclaimer in the documentation and/or other materials provided
00017 //    with the distribution.
00018 //
00019 // THIS SOFTWARE IS PROVIDED BY THE NAMEPSACE EWALENA AUTHORS ``AS
00020 // IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00022 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00023 // NAMESPACE EWALENA AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00024 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00025 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00026 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00028 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00029 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00030 // OF THE POSSIBILITY OF SUCH DAMAGE.
00031 //
00032 // The views and conclusions contained in the software and
00033 // documentation are those of the authors and should not be
00034 // interpreted as representing official policies, either expressed or
00035 // implied, of the namespace ewalena authors.
00036 // -------------------------------------------------------------------
00037 
00038 #include <ewalena/numerics/basis_base.h>
00039 
00040 #ifndef __ewalena_basis_gto_h
00041 #define __ewalena_basis_gto_h
00042 
00043 #ifdef EWALENA_HAVE_CONFIG_H
00044 #include <ewalena/base/config.h>
00045 #endif
00046 
00047 #include <ewalena/base/utilities.h>
00048 
00049 namespace ewalena
00050 {
00081   template <int dim, typename ValueType = double>
00082     class GaussianTypeOrbital
00083     : 
00084     public BasisBase<dim, ValueType> 
00085     {
00086     public:
00087     
00093     GaussianTypeOrbital () /* const unsigned int n_contractions */
00094     :
00095     BasisBase<3, ValueType> (BasisData<ValueType> ("Gaussian-type orbital"))
00096     {};
00097     
00101     ~GaussianTypeOrbital ();
00102     
00106     std::string name () const;
00107     
00113     void reinit_alpha (const ValueType &alpha);
00114     
00118     ValueType value (const ewalena::Point<dim, ValueType> &point) const;
00119     
00123     ValueType grad (const ewalena::Point<dim, ValueType> &point) const;
00124     
00128     ValueType laplacian (const ewalena::Point<dim, ValueType> &point) const;
00129     
00133     ValueType laplacian (const GaussianTypeOrbital<dim, ValueType> &gaussian_i, 
00134                          const GaussianTypeOrbital<dim, ValueType> &gaussian_j); 
00135     
00139     ValueType integral (const GaussianTypeOrbital<dim, ValueType> &gaussian_i, 
00140                         const GaussianTypeOrbital<dim, ValueType> &gaussian_j); 
00141     
00145     ValueType integral (const GaussianTypeOrbital<dim, ValueType> &gaussian_i, 
00146                         const GaussianTypeOrbital<dim, ValueType> &gaussian_j,
00147                         const GaussianTypeOrbital<dim, ValueType> &gaussian_k,
00148                         const GaussianTypeOrbital<dim, ValueType> &gaussian_l); 
00149     
00153     ValueType alpha () const;
00154     
00155     private:
00156     
00160     ValueType __alpha;
00161 
00162     
00163     }; /* GaussianTypeOrbital */
00164   
00165   
00166   /*-------------- Inline and Other Functions -----------------------*/
00167   
00168   template <int dim, typename ValueType>
00169     inline 
00170     ValueType
00171     laplacian (const GaussianTypeOrbital<dim, ValueType> &gaussian_i,
00172                const GaussianTypeOrbital<dim, ValueType> &gaussian_j) 
00173   {
00174     const ValueType ap          = gaussian_i.alpha ()*gaussian_j.alpha ();
00175     const ValueType as          = gaussian_i.alpha ()+gaussian_j.alpha ();
00176     const ValueType ratio       = ap/as;
00177     const ValueType displacment = gaussian_i.origin ().l2_norm () - gaussian_j.origin ().l2_norm ();
00178     
00179     ValueType scalar = 0;
00180     
00181     switch (dim) 
00182       { 
00183       case 3: 
00184         scalar = 
00185           ratio * (3-2*ratio*displacment*displacment) * integral (gaussian_i, gaussian_j);
00186         break; 
00187         
00188       default: 
00189         assert (false); 
00190       } 
00191     return scalar;
00192     
00193   }
00194   
00195   template <int dim, typename ValueType>
00196     inline 
00197     ValueType
00198     integral (const GaussianTypeOrbital<dim, ValueType> &gaussian_i,
00199               const GaussianTypeOrbital<dim, ValueType> &gaussian_j) 
00200   {
00201     const ValueType radius = gaussian_i.origin ().l2_norm (gaussian_j.origin ());
00202     const ValueType sum    = gaussian_i.alpha () + gaussian_j.alpha (); 
00203     const ValueType ratio  = (gaussian_i.alpha () * gaussian_j.alpha ()) / sum;
00204     
00205     ValueType scalar = 0.;
00206     
00207     switch (dim) 
00208       { 
00209       case 3: 
00210         scalar = 
00211           std::pow (2, 1.5) * std::pow (ratio/sum, 0.75) * 
00212           std::exp (-ratio*pow (radius, 2)); 
00213         break; 
00214         
00215       default: 
00216         assert (false); 
00217       } 
00218     
00219     return scalar;
00220   }
00221   
00222   
00223   template <int dim, typename ValueType>
00224     inline 
00225     ValueType
00226     integral (const GaussianTypeOrbital<dim, ValueType> &gaussian_i,
00227               const GaussianTypeOrbital<dim, ValueType> &gaussian_j,
00228               const GaussianTypeOrbital<dim, ValueType> &gaussian_k,
00229               const GaussianTypeOrbital<dim, ValueType> &gaussian_l) 
00230   {
00231     /* First some intermediate variables. */
00232     const double as1  = gaussian_i.alpha () + gaussian_k.alpha ();
00233     const double as2  = gaussian_j.alpha () + gaussian_l.alpha ();
00234     
00235     const double as   = 
00236       gaussian_i.alpha () + gaussian_j.alpha () +
00237       gaussian_k.alpha () + gaussian_l.alpha ();
00238     
00239     const double ap   = 
00240       gaussian_i.alpha () * gaussian_j.alpha () *
00241       gaussian_k.alpha () * gaussian_l.alpha ();
00242     
00243     const double ratio_01 = gaussian_i.alpha () * gaussian_k.alpha () / as1;
00244     const double ratio_02 = gaussian_j.alpha () * gaussian_l.alpha () / as2;
00245     
00246     /* Displacements and centers of the primitive Gaussians. */
00247     const double Rp     = ( gaussian_i.alpha ()*gaussian_i.origin ().l2_norm () + 
00248                             gaussian_k.alpha ()*gaussian_k.origin ().l2_norm () )/as1;
00249     
00250     const double Rq     = ( gaussian_j.alpha ()*gaussian_j.origin ().l2_norm () + 
00251                             gaussian_l.alpha ()*gaussian_l.origin ().l2_norm () )/as2;
00252     
00253     const double displacement1 = gaussian_i.origin ().l2_norm ()-gaussian_k.origin ().l2_norm ();
00254     const double displacement2 = gaussian_j.origin ().l2_norm ()-gaussian_l.origin ().l2_norm ();
00255     
00256     /* Helper function F0(t) defined for convenience in computing
00257        nuclear and two-electron integrals. Define F(0) = 1. */
00258     const double t = (as1*as2/as) * (Rp-Rq) * (Rp-Rq);
00259     
00260     ValueType scalar = 0;
00261     
00262     switch (dim) 
00263       { 
00264       case 3: 
00265         scalar = (16/std::sqrt (Value::PI)) 
00266           * std::pow (ap, 0.75) / (as1 * as2 * std::sqrt (as))
00267           * exp (-ratio_01 * displacement1 * displacement1 
00268                  -ratio_02 * displacement2 * displacement2)
00269           * ewalena::Math::incomplete_gamma (t);
00270         break; 
00271         
00272       default: 
00273         assert (false); 
00274       } 
00275     return scalar;
00276   }
00277   
00278 } /* namespace ewalena */
00279 
00280 #endif  /* __ewalena_basis_gto_h */
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines