Commit 55425092 authored by Alberto's avatar Alberto
Browse files

su(3) model is real now

parent 4a23fc2a
......@@ -129,8 +129,8 @@ public:
PsimagLite::IsComplexNumber<ComplexOrRealType>::True> Su3RepresentationP1Type;
Su3Model(const SolverParamsType& solverParams,
InputValidatorType& io,
const SuperGeometryType& geometry)
InputValidatorType& io,
const SuperGeometryType& geometry)
: ModelBaseType(solverParams,
geometry,
io),
......@@ -170,12 +170,14 @@ public:
assert(block.size() == 1);
MatrixType m3;
su3Rep_->getMatrix(m3, 2);
// su3Rep_->getMatrix(m3, 2);
su3Rep_->getRealMatrix(m3, 3);
MatrixType m8;
su3Rep_->getMatrix(m8, 7);
// su3Rep_->getMatrix(m8, 7);
su3Rep_->getRealMatrix(m8, 4);
MatrixType m = m3*m3;
MatrixType mtemp = m8*m8;
m += mtemp;
m *= modelParameters_.mass;
SparseMatrixType mSparse(m);
......@@ -185,6 +187,7 @@ public:
protected:
/*
void fillLabeledOperators(VectorQnType& qns)
{
SizeType site = 0;
......@@ -214,7 +217,63 @@ protected:
this->makeTrackable("T" + ttos(a + 1));
}
}
*/
void fillLabeledOperators(VectorQnType& qns)
{
SizeType site = 0;
BlockType block(1, site);
SizeType total = su3Rep_->size();
HilbertBasisType natBasis(total);
for (SizeType i = 0; i < total; ++i) natBasis[i] = i;
setSymmetryRelated(qns, natBasis, block.size());
for (SizeType a = 0; a < 3; ++a) {
MatrixType m;
su3Rep_->getRealMatrix(m, a);
SparseMatrixType sparseMatrix(m);
typename OperatorType::Su2RelatedType su2related;
OperatorType myOp(sparseMatrix,
ProgramGlobals::FermionOrBosonEnum::BOSON,
PairType(0, 0),
1,
su2related);
this->createOpsLabel("Tplus" + ttos(a + 1)).push(myOp);
this->makeTrackable("Tplus" + ttos(a + 1));
myOp.dagger();
this->createOpsLabel("Tminus" + ttos(a + 1)).push(myOp);
}
for (SizeType a = 3; a < 5; ++a) {
MatrixType m;
su3Rep_->getRealMatrix(m, a);
SparseMatrixType sparseMatrix(m);
typename OperatorType::Su2RelatedType su2related;
OperatorType myOp(sparseMatrix,
ProgramGlobals::FermionOrBosonEnum::BOSON,
PairType(0, 0),
1,
su2related);
if (a==4) {
this->createOpsLabel("T8").push(myOp);
this->makeTrackable("T8");
} else {
this->createOpsLabel("T" + ttos(a)).push(myOp);
this->makeTrackable("T" + ttos(a));
}
}
}
/*
void fillModelLinks()
{
ModelTermType& jOne = ModelBaseType::createTerm("jOne");
......@@ -233,10 +292,27 @@ protected:
jTwo.push(aOpForLink, 'N', aOpForLink, 'C');
}
}
*/
void fillModelLinks()
{
ModelTermType& jOnepm = ModelBaseType::createTerm("jOne_pm");
for (SizeType a = 0; a < 3; ++a) {
OpForLinkType aOpForLink("Tplus" + ttos(a + 1));
jOnepm.push(aOpForLink, 'N', aOpForLink, 'C', 0.5);
}
ModelTermType& jOne33 = ModelBaseType::createTerm("jOne_33");
OpForLinkType aOpForLink3("T3");
jOne33.push(aOpForLink3, 'N', aOpForLink3, 'C');
ModelTermType& jOne88 = ModelBaseType::createTerm("jOne_88");
OpForLinkType aOpForLink8("T8");
jOne88.push(aOpForLink8, 'N', aOpForLink8, 'C');
}
private:
// \sum_i T3(i) and \sum_i T4(i) are conserved separately
// \sum_i T3(i) and \sum_i T8(i) are conserved separately
// We delegate to the representation the actual values and computation
void setSymmetryRelated(VectorQnType& qns,
const HilbertBasisType& basis,
......
......@@ -15,6 +15,8 @@ public:
virtual void getMatrix(MatrixType&, SizeType) const = 0;
virtual void getRealMatrix(MatrixType&, SizeType) const = 0;
virtual SizeType t3OfState(SizeType) const = 0;
virtual SizeType t8OfState(SizeType) const = 0;
......
......@@ -16,6 +16,11 @@ public:
err("Su3RepresentationP1: Please useComplex\n");
}
void getRealMatrix(MatrixType& m, SizeType n) const
{
err("Su3RepresentationP1: Please don't useComplex\n");
}
SizeType t3OfState(SizeType ind) const
{
throw PsimagLite::RuntimeError("Su3RepresentationP1: Please useComplex\n");
......@@ -90,6 +95,38 @@ public:
m(2, 2) = -oneOverSqrt3;
}
void getRealMatrix(MatrixType& m, SizeType n) const
{
m.resize(3, 3);
// Tplus1
if (n == 0) {
m(0, 1) = 0.5;
return;
}
// Tplus2
if (n == 1) {
m(0, 2) = 0.5;
return;
}
// Tplus3
if (n == 2) {
m(1, 2) = 0.5;
return;
}
// T3
if (n == 3) {
m(0, 0) = 0.5;
m(1, 1) = -0.5;
return;
}
// T8
assert(n == 4);
static const RealType oneOverSqrt3 = 1.0/sqrt(3.0);
m(0, 0) = m(1, 1) = 0.5*oneOverSqrt3;
m(2, 2) = -oneOverSqrt3;
}
// diagonal 1 -1 0 ==> 2 0 1
SizeType t3OfState(SizeType ind) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment