Skip to content

Commit a151500

Browse files
committed
Nonspin option is working now. The pdms are still not working for non spin adapted.
1 parent a043fee commit a151500

38 files changed

+1289
-479
lines changed

BaseOperator.C

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ namespace SpinAdapted{
1818

1919
double getCommuteParity(SpinQuantum a, SpinQuantum b, SpinQuantum c)
2020
{
21-
int aspin = a.get_s(), airrep = a.get_symm().getirrep();
22-
int bspin = b.get_s(), birrep = b.get_symm().getirrep();
23-
int cspin = c.get_s(), cirrep = c.get_symm().getirrep();
21+
int aspin = a.get_s().getirrep(), airrep = a.get_symm().getirrep();
22+
int bspin = b.get_s().getirrep(), birrep = b.get_symm().getirrep();
23+
int cspin = c.get_s().getirrep(), cirrep = c.get_symm().getirrep();
2424

2525
int an = a.get_n(), bn = b.get_n();
2626
int parity = IsFermion(a) && IsFermion(b) ? -1 : 1;
27+
28+
if (!dmrginp.spinAdapted()) return parity;
29+
2730
for (int asz = -aspin; asz<aspin+1; asz+=2)
2831
for (int bsz = -bspin; bsz<bspin+1; bsz+=2)
2932
for (int al = 0; al<Symmetry::sizeofIrrep(airrep); al++)
@@ -50,11 +53,12 @@ double getCommuteParity(SpinQuantum a, SpinQuantum b, SpinQuantum c)
5053

5154
double Transposeview::get_scaling(SpinQuantum leftq, SpinQuantum rightq) const
5255
{
56+
if(!dmrginp.spinAdapted()) return 1.0;
5357
if (conjugacy() == 'n') {return 1.0;}
5458

55-
int lspin = leftq.get_s(), lirrep = leftq.get_symm().getirrep();
56-
int rspin = rightq.get_s(), rirrep = rightq.get_symm().getirrep();
57-
int cspin = opdata->get_deltaQuantum().get_s(), cirrep = opdata->get_deltaQuantum().get_symm().getirrep();
59+
int lspin = leftq.get_s().getirrep(), lirrep = leftq.get_symm().getirrep();
60+
int rspin = rightq.get_s().getirrep(), rirrep = rightq.get_symm().getirrep();
61+
int cspin = opdata->get_deltaQuantum().get_s().getirrep(), cirrep = opdata->get_deltaQuantum().get_symm().getirrep();
5862

5963
for (int lsz = -lspin; lsz<lspin+1; lsz+=2)
6064
for (int rsz = -rspin; rsz<rspin+1; rsz+=2)
@@ -124,7 +128,7 @@ void SparseMatrix::CleanUp ()
124128
built = false;
125129
initialised = false;
126130
fermion = 0;
127-
deltaQuantum = SpinQuantum (0, 0, IrrepSpace(0));
131+
deltaQuantum = SpinQuantum (0, SpinSpace(0), IrrepSpace(0));
128132
orbs.resize(0);
129133
allowedQuantaMatrix.ReSize (0,0);
130134
operatorMatrix.ReSize (0,0);
@@ -135,6 +139,11 @@ const Transposeview Transpose(SparseMatrix& op) { return Transposeview(op); };
135139
ostream& operator<< (ostream& os, const SparseMatrix& a)
136140
{
137141
assert (a.initialised);
142+
os<<"indices : ";
143+
for(int i=0; i<a.orbs.size(); i++)
144+
os<<a.orbs[i]<<" ";
145+
os <<endl;
146+
os<<a.get_deltaQuantum()<<endl;
138147
for (int i = 0; i < a.allowedQuantaMatrix.Nrows (); ++i)
139148
for (int j = 0; j < a.allowedQuantaMatrix.Ncols (); ++j)
140149
{

BaseOperator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ template<class T> class Baseoperator
4949
virtual SpinQuantum get_deltaQuantum() const = 0;
5050
virtual char conjugacy() const = 0;
5151
virtual ~Baseoperator() {};
52-
virtual int get_spin() const = 0;
52+
virtual SpinSpace get_spin() const = 0;
5353
virtual IrrepSpace get_symm() const = 0;
5454
virtual double get_scaling(SpinQuantum leftq, SpinQuantum rightq) const = 0;
5555
Baseoperator() {};
@@ -97,7 +97,7 @@ class SparseMatrix : public Baseoperator<Matrix>
9797
const char& allowed(int i, int j) const { return allowedQuantaMatrix(i, j); }
9898
char& allowed(int i, int j) { return allowedQuantaMatrix(i, j); }
9999
SpinQuantum &set_deltaQuantum() { return deltaQuantum; }
100-
int get_spin()const { return deltaQuantum.get_s();}
100+
SpinSpace get_spin()const { return deltaQuantum.get_s();}
101101
IrrepSpace get_symm()const { return deltaQuantum.get_symm();}
102102
SpinQuantum get_deltaQuantum() const { return deltaQuantum; }
103103
int get_orbs(int i) const
@@ -170,7 +170,7 @@ class Transposeview : public SparseMatrix
170170
char &allowed(int i, int j) { return opdata->allowed(j, i); }
171171
const Matrix& operator_element(int i, int j) const { return opdata->operator_element(j, i); }
172172
Matrix& operator_element(int i, int j) { return opdata->operator_element(j, i); }
173-
int get_spin()const { return opdata->get_deltaQuantum().get_s();}
173+
SpinSpace get_spin()const { return opdata->get_deltaQuantum().get_s();}
174174
IrrepSpace get_symm()const { return -opdata->get_deltaQuantum().get_symm();}
175175
int get_orbs(int i) const {return opdata->get_orbs(i);}
176176
const std::vector<int>& get_orbs() const { return opdata->get_orbs(); }

0 commit comments

Comments
 (0)