CheMPS2
Problem.h
1 /*
2  CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
3  Copyright (C) 2013-2016 Sebastian Wouters
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #ifndef PROBLEM_CHEMPS2_H
21 #define PROBLEM_CHEMPS2_H
22 
23 #include "Hamiltonian.h"
24 
25 namespace CheMPS2{
35  class Problem{
36 
37  public:
38 
40 
44  Problem(const Hamiltonian * Hamin, const int TwoSin, const int Nin, const int Irrepin);
45 
47  virtual ~Problem();
48 
50 
51  int gL() const{ return L; }
52 
54 
55  int gSy() const{ return Ham->getNGroup(); }
56 
58 
60  int gIrrep(const int nOrb) const;
61 
63 
64  int gTwoS() const{ return TwoS; }
65 
67 
68  int gN() const{ return N; }
69 
71 
72  int gIrrep() const{ return Irrep; }
73 
75 
76  double gEconst() const{ return Ham->getEconst(); }
77 
79 
84  double gMxElement(const int alpha, const int beta, const int gamma, const int delta) const;
85 
87 
92  void setMxElement(const int alpha, const int beta, const int gamma, const int delta, const double value);
93 
95  void construct_mxelem();
96 
98 
99  bool checkConsistency() const;
100 
102 
103  bool gReorder() const;
104 
106 
108  int gf1(const int HamOrb) const;
109 
111 
113  int gf2(const int DMRGOrb) const;
114 
116  void SetupReorderD2h();
117 
119  void SetupReorderC2v();
120 
122 
123  void setup_reorder_custom(int * dmrg2ham);
124 
126 
128  void setup_reorder_dinfh(int * docc, const double sp_threshold=1e-5);
129 
130  private:
131 
132  //Pointer to the Hamiltonian --> constructed and destructed outside of this class
133  const Hamiltonian * Ham;
134 
135  //The number of orbitals
136  int L;
137 
138  //Twice the targeted spin
139  int TwoS;
140 
141  //The targeted particle number
142  int N;
143 
144  //The targeted irrep
145  int Irrep;
146 
147  //Whether or not to reorder
148  bool bReorder;
149 
150  //f1[HamiltonianIndex] = DMRGindex
151  int * f1;
152 
153  //f2[DMRGIndex] = HamiltonianIndex
154  int * f2;
155 
156  //Matrix element table
157  double * mx_elem;
158 
159  };
160 }
161 
162 #endif
void setMxElement(const int alpha, const int beta, const int gamma, const int delta, const double value)
Set the matrix elements: Note that each time you create a DMRG object, they will be overwritten with ...
Definition: Problem.cpp:356
void setup_reorder_dinfh(int *docc, const double sp_threshold=1e-5)
Reorder the orbitals for d(infinity)h. Previous reorderings are cleared.
Definition: Problem.cpp:177
bool gReorder() const
Get whether the Hamiltonian orbitals are reordered for the DMRG calculation.
Definition: Problem.cpp:346
Definition: CASPT2.h:42
bool checkConsistency() const
Check whether the given parameters L, N, and TwoS are not inconsistent and whether 0<=Irrep<nIrreps...
Definition: Problem.cpp:385
void setup_reorder_custom(int *dmrg2ham)
Reorder the orbitals to a custom ordering. Previous reorderings are cleared.
Definition: Problem.cpp:150
int gN() const
Get the targeted particle number.
Definition: Problem.h:68
int gTwoS() const
Get twice the targeted spin.
Definition: Problem.h:64
double gMxElement(const int alpha, const int beta, const int gamma, const int delta) const
Get a specific interaction matrix element.
Definition: Problem.cpp:350
int gf1(const int HamOrb) const
Get the DMRG index corresponding to a Ham index.
Definition: Problem.cpp:347
void SetupReorderC2v()
Reorder the orbitals, so that they form irrep blocks, with order of irreps A1 B1 B2 A2...
Definition: Problem.cpp:96
int gL() const
Get the number of orbitals.
Definition: Problem.h:51
void SetupReorderD2h()
Reorder the orbitals, so that they form irrep blocks, with order of irreps Ag B1u B3u B2g B2u B3g B1g...
Definition: Problem.cpp:56
virtual ~Problem()
Destructor.
Definition: Problem.cpp:45
void construct_mxelem()
Construct a table with the h-matrix elements (two-body augmented with one-body). Remember to recall t...
Definition: Problem.cpp:362
int getNGroup() const
Get the group number.
Definition: Hamiltonian.cpp:95
double getEconst() const
Get the constant energy.
double gEconst() const
Get the constant part of the Hamiltonian.
Definition: Problem.h:76
Problem(const Hamiltonian *Hamin, const int TwoSin, const int Nin, const int Irrepin)
Constructor.
Definition: Problem.cpp:31
int gIrrep() const
Get the targeted irrep.
Definition: Problem.h:72
int gSy() const
Get the point group symmetry.
Definition: Problem.h:55
int gf2(const int DMRGOrb) const
Get the Ham index corresponding to a DMRG index.
Definition: Problem.cpp:348