source: ThirdParty/mpqc_open/src/lib/chemistry/qc/mbptr12/moindexspace.h@ 482400e

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open 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 482400e 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: 7.4 KB
Line 
1//
2// moindexspace.h
3//
4// Copyright (C) 2004 Edward Valeev
5//
6// Author: Edward Valeev <edward.valeev@chemistry.gatech.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#ifdef __GNUG__
29#pragma interface
30#endif
31
32#ifndef _chemistry_qc_mbptr12_moindexspace_h
33#define _chemistry_qc_mbptr12_moindexspace_h
34
35#include <vector>
36#include <util/ref/ref.h>
37#include <util/state/statein.h>
38#include <util/state/stateout.h>
39#include <math/scmat/abstract.h>
40#include <util/state/statein.h>
41#include <chemistry/qc/basis/basis.h>
42
43using namespace std;
44
45namespace sc {
46
47 /** Class MOIndexSpace describes a range of molecular orbitals or
48 similar objects that are linear combinations of basis functions
49 (e.g. atomic orbitals). In general, such sets are subspaces of
50 a full space of orbitals supported by the given basis. Orbitals
51 can be symmetry-blocked, ordered by energy, etc.
52 Examples of sets that can be described
53 using MOIndexSpace are occupied MOs and virtual MOs. */
54
55class MOIndexSpace : virtual public SavableState {
56
57public:
58
59 /// Describes the ordering of indices
60 enum IndexOrder { symmetry = 0, energy = 1, undefined = 2 };
61
62 MOIndexSpace(StateIn&);
63 /** This function constructs an MOIndexSpace from (blocked) space full_coefs.
64 Block i will contain vectors [ offsets[i], offsets[i]+nmopi[i]-1 ] . By default,
65 the space maintains the same blocked structure and the same order within blocks
66 as the original space (moorder=symmetry). If moorder=energy and eigenvalues
67 evals are provided, then all vectors will be put in one block and
68 sorted according to ascending evals.
69
70 \param name -- the name of this MOIndexSpace
71 \param full_coefs -- symmetry-blocked transformation coefficient matrix
72 (AO by MO) for the full space
73 \param basis -- basis set
74 \param integral -- integral factory
75 \param offsets -- block offsets
76 \param nmopi -- new block sizes
77 \param moorder -- specifies new ordering of vectors
78 \param evals -- used to sort the vectors
79 */
80 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
81 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
82 const vector<int>& offsets, const vector<int>& nmopi,
83 IndexOrder moorder = symmetry,
84 const RefDiagSCMatrix& evals = 0);
85 /** This constructor should be used when the MOIndexSpace object is a subspace of a full orbital space.
86 Similarly to the previous constructor, it constructs an MOIndexSpace object using a symmetry-blocked
87 transformation coefficient matrix (AO by MO) for the full space,
88 basis set, "eigenvalues" and the number of orbitals with lowest (nfzc) and highest (nfzv) eigenvalues
89 to be dropped. The orbitals in the constructed space are ordered by energy. */
90 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
91 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
92 const RefDiagSCMatrix& evals, int nfzc, int nfzv, IndexOrder moorder = energy);
93 /** This constructor should be used when the MOIndexSpace object is the full orbital space.
94 The orbitals will be symmetry-blocked. */
95 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
96 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral);
97
98 /** This constructor is a true hack introduced because I have no idea how to construct what I need.
99 It will copy orig_space but replace it's coefs with new_coefs, and its basis with new_basis. */
100 MOIndexSpace(std::string name, const Ref<MOIndexSpace>& orig_space,
101 const RefSCMatrix& new_coefs,
102 const Ref<GaussianBasisSet>& new_basis);
103 ~MOIndexSpace();
104
105 void save_data_state(StateOut&);
106
107 /// Returns the name of this MOIndexSpace.
108 const std::string name() const;
109 /// Returns the AO basis set
110 const Ref<GaussianBasisSet> basis() const;
111 /// Returns the integral factory used to instantiate the coefficient matrix
112 Ref<Integral> integral() const;
113 /// Returns the coefficient matrix
114 const RefSCMatrix coefs() const;
115 /// Returns the "eigenvalues" matrix
116 const RefDiagSCMatrix evals() const;
117 /// Returns the orbital symmetry array
118 vector<int> mosym() const;
119 /// Returns the order of the orbitals
120 IndexOrder moorder() const;
121 /// Returns the rank of the space
122 int rank() const;
123 /// Returns the rank of the full space
124 int full_rank() const;
125 /// Returns the number of blocks
126 int nblocks() const;
127 /// Returns the number of orbitals in each block
128 vector<int> nmo() const;
129 /// Returns the full-space index of the first orbital in each block
130 vector<int> offsets() const;
131 /// Returns the full-space index
132 int to_full_space(const int i) const;
133
134 /// Returns how much "significant" (i.e. O^2) memory this object uses
135 size_t memory_in_use() const;
136
137 /// Prints out this
138 void print(std::ostream&o=ExEnv::out0()) const;
139 /// Produces a short summary
140 void print_summary(std::ostream& os) const;
141
142private:
143 std::string name_; // String identifier for the orbital space
144
145 Ref<GaussianBasisSet> basis_; // The AO basis
146 Ref<Integral> integral_; // The integral factory
147 RefSCMatrix coefs_; // AO->MO transformation coefficients (nao by nmo matrix)
148 RefDiagSCMatrix evals_; // "eigenvalues" associated with the MOs
149 RefSCDimension modim_; // The MO dimension
150 vector<int> mosym_; // irrep of each orbital
151
152 int rank_; // The rank of this space
153 int full_rank_; // Rank of the full space, i.e. number of MOs
154 int nblocks_; // Number of blocks
155 vector<int> nmo_; // Number of MOs in each block
156 vector<int> offsets_; // Index of the first MO in each block relative to the first MO of that block in full space
157 vector<int> map_to_full_space_; // Full-space index
158
159 IndexOrder moorder_;
160
161 // checks mosym_ for irrep indices outside of the allowed range
162 void check_mosym() const;
163
164 // determines offsets_ and nmo_ from nfzc, nfzv, and evals
165 void frozen_to_blockinfo(const int nfzc, const int nfzv, const RefDiagSCMatrix& evals);
166
167 // computes coefficient matrix from the full coefficient matrix. If moorder_ == energy
168 // then the MO vectors will be sorted by their eigenvalues
169 void full_coefs_to_coefs(const RefSCMatrix& full_coefs, const RefDiagSCMatrix& evals);
170
171 // initialize the object
172 void init();
173
174 // sorting functions borrowed from mbpt.cc
175 static void dquicksort(double *item,int *index,int n);
176 static void dqs(double *item,int *index,int left,int right);
177
178};
179
180}
181
182#endif
183
184// Local Variables:
185// mode: c++
186// c-file-style: "CLJ"
187// End:
188
189
Note: See TracBrowser for help on using the repository browser.