source: ThirdParty/mpqc_open/src/lib/chemistry/qc/basis/transform.h@ aae63a

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since aae63a was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 6.2 KB
Line 
1//
2// transform.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#if defined(__GNUC__)
29#pragma interface
30#endif
31
32#ifndef _chemistry_qc_basis_transform_h
33#define _chemistry_qc_basis_transform_h
34
35namespace sc {
36
37// ///////////////////////////////////////////////////////////////////////////
38
39/** This is a base class for a container for a component of a sparse
40 Cartesian to solid harmonic basis function transformation. */
41class SphericalTransformComponent {
42 protected:
43 double coef_;
44 int a_, b_, c_, cartindex_, pureindex_;
45
46 public:
47 /// Returns the exponent of x.
48 int a() const { return a_; }
49 /// Returns the exponent of y.
50 int b() const { return b_; }
51 /// Returns the exponent of z.
52 int c() const { return c_; }
53 /// Returns the index of the Cartesian basis function.
54 int cartindex() const { return cartindex_; }
55 /// Returns the index solid harmonic basis function.
56 int pureindex() const { return pureindex_; }
57 /// Returns the coefficient of this component of the transformation.
58 double coef() const { return coef_; }
59
60 /** Initialize this object. This must be provided in all
61 specializations of this class to establish the ordering between a,
62 b and c and the index of the Cartesian basis function. Other
63 things such as adjustment of the coefficient to account for
64 normalization differences can be done as well. The default
65 SphericalTransform::init() implementation requires that only the
66 x<sup>l</sup>, y<sup>l</sup> and z<sup>l</sup> basis functions are
67 normalized to unity. */
68 virtual void init(int a, int b, int c, double coef, int pureindex) =0;
69};
70
71// ///////////////////////////////////////////////////////////////////////////
72
73/** This is a base class for a container for a sparse Cartesian to solid
74 harmonic basis function transformation. */
75class SphericalTransform {
76 protected:
77 int n_;
78 int l_;
79 int subl_;
80 SphericalTransformComponent *components_;
81
82 SphericalTransform();
83
84 /** This constructs the SphericalTransform for the given Cartesian
85 angular momentum l and solid harmonic angular momentum subl.
86 Usually, l and subl will be the same. They would differ when the S
87 component of a D Cartesian shell or the P component of an F
88 Cartesian shell is desired, for example (see the natural atomic
89 orbital code for an example of such use). The init member must be
90 called to complete initialization. */
91 SphericalTransform(int l, int subl = -1);
92
93 /** This determines all of the components of the transformation. It
94 should be possible to implement the
95 SphericalTransformComponent::init specialization in such a way that
96 the default SphericalTransform::init can be used. */
97 virtual void init();
98
99 public:
100 virtual ~SphericalTransform();
101
102 /** Adds another SphericalTransformComponent */
103 void add(int a, int b, int c, double coef, int pureindex);
104
105 /// Returns the Cartesian basis function index of component i.
106 int cartindex(int i) const { return components_[i].cartindex(); }
107 /// Returns the solid harmonic basis function index of component i.
108 int pureindex(int i) const { return components_[i].pureindex(); }
109 /// Returns the transform coefficient of component i.
110 double coef(int i) const { return components_[i].coef(); }
111 /// Returns the Cartesian basis function's x exponent of component i.
112 int a(int i) const { return components_[i].a(); }
113 /// Returns the Cartesian basis function's y exponent of component i.
114 int b(int i) const { return components_[i].b(); }
115 /// Returns the Cartesian basis function's z exponent of component i.
116 int c(int i) const { return components_[i].c(); }
117 /// Returns the angular momentum.
118 int l() const { return l_; }
119 /// Returns the number of components in the transformation.
120 int n() const { return n_; }
121
122 /** This must create SphericalTransformComponent's of the
123 appropriate specialization. */
124 virtual SphericalTransformComponent * new_components() = 0;
125};
126
127/// This describes a solid harmonic to Cartesian transform.
128class ISphericalTransform: public SphericalTransform {
129 protected:
130 ISphericalTransform();
131 ISphericalTransform(int l,int subl=-1);
132 void init();
133};
134
135// ///////////////////////////////////////////////////////////////////////////
136
137/// This iterates through the components of a SphericalTransform.
138class SphericalTransformIter {
139 private:
140 int i_;
141
142 protected:
143 const SphericalTransform *transform_;
144
145 public:
146 SphericalTransformIter();
147 SphericalTransformIter(const SphericalTransform*);
148
149 void begin() { i_ = 0; }
150 void start() { begin(); }
151 void next() { i_++; }
152 int ready() { return i_ < transform_->n(); }
153 operator int() { return ready(); }
154 int l() { return transform_->l(); }
155 int cartindex() { return transform_->cartindex(i_); }
156 int pureindex() { return transform_->pureindex(i_); }
157 int bfn() { return pureindex(); }
158 double coef() { return transform_->coef(i_); }
159 int a() { return transform_->a(i_); }
160 int b() { return transform_->b(i_); }
161 int c() { return transform_->c(i_); }
162 int l(int i) { return i?(i==1?b():c()):a(); }
163 int n() { return 2*l() + 1; }
164};
165
166}
167
168#endif
169
170// Local Variables:
171// mode: c++
172// c-file-style: "ETS"
173// End:
Note: See TracBrowser for help on using the repository browser.