Commit 075a5586 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

SU(3) model: representation classes added

parent 383612e5
......@@ -79,6 +79,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "../Models/GaugeSpin/GaugeSpin.h"
#include "../Models/Heisenberg/HeisenbergMix.h"
#include "../Models/SpinOrbital/SpinOrbitalModel.h"
#include "../Models/Su3/Su3Model.h"
#endif
......@@ -121,7 +122,8 @@ class ModelSelector {
typedef HolsteinThin<ModelBaseType> HolsteinThinType;
typedef GaugeSpin<ModelBaseType> GaugeSpinType;
typedef HeisenbergMix<ModelBaseType> HeisenbergMixType;
typedef SpinOrbitalModel <ModelBaseType> SpinOrbitalModelType;
typedef SpinOrbitalModel<ModelBaseType> SpinOrbitalModelType;
typedef Su3Model<ModelBaseType> Su3ModelType;
#endif
// end models
......@@ -218,6 +220,8 @@ public:
PsimagLite::String tmp = (name_.length() == 11) ? ""
: name_.substr(11, name_.length() - 11);
model_ = new SpinOrbitalModelType(solverParams, io, geometry, tmp);
} else if (name_ == "Su3Model") {
model_ = new Su3ModelType(solverParams, io, geometry);
}
#endif
else {
......
......@@ -97,6 +97,7 @@ struct ParametersSu3 : public ParametersModelBase<RealType, QnType> {
: BaseType(io, false)
{
io.readline(mass, "Mass=");
io.readline(p, "Su3RepresentationP=");
}
void write(PsimagLite::String label1,
......@@ -106,9 +107,12 @@ struct ParametersSu3 : public ParametersModelBase<RealType, QnType> {
io.createGroup(label);
BaseType::write(label, io);
io.write(label + "/mass", mass);
io.write(label + "/Su3RepresentationP", p);
}
RealType mass;
SizeType p;
};
} // namespace Dmrg
......
......@@ -81,11 +81,12 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define DMRG_SU3_MODEL_H
#include <algorithm>
#include "ParametersSu3Model.h"
#include "ParametersSu3.h"
#include "CrsMatrix.h"
#include "../../Engine/VerySparseMatrix.h"
#include "../../Engine/ProgramGlobals.h"
#include "../../Engine/Utils.h"
#include "Su3RepresentationP1.h"
namespace Dmrg {
......@@ -122,6 +123,9 @@ public:
typedef typename ModelBaseType::BasisWithOperatorsType MyBasisWithOperators;
typedef typename ModelBaseType::OpsLabelType OpsLabelType;
typedef typename ModelBaseType::OpForLinkType OpForLinkType;
typedef ParametersSu3<RealType, QnType> ParametersSu3Type;
typedef Su3RepresentationBase<ComplexOrRealType> Su3RepresentationBaseType;
typedef Su3RepresentationP1<ComplexOrRealType> Su3RepresentationP1Type;
Su3Model(const SolverParamsType& solverParams,
InputValidatorType& io,
......@@ -129,9 +133,23 @@ public:
: ModelBaseType(solverParams,
geometry,
io),
superGeometry_(geometry),
modelParameters_(io),
superGeometry_(geometry)
{}
su3Rep_(nullptr)
{
if (modelParameters_.p == 1) {
su3Rep_ = new Su3RepresentationP1Type();
} else {
err("Implementation for p = " + ttos(modelParameters_.p) +
" has not been implemented\n");
}
}
~Su3Model()
{
delete su3Rep_;
su3Rep_ = nullptr;
}
void write(PsimagLite::String label1, PsimagLite::IoNg::Out::Serializer& io) const
{
......@@ -150,8 +168,11 @@ public:
{
assert(block.size() == 1);
su3Rep_.getMatrix(m3, 2);
su3Rep_.getMatrix(m8, 7);
MatrixType m3;
su3Rep_->getMatrix(m3, 2);
MatrixType m8;
su3Rep_->getMatrix(m8, 7);
MatrixType m = m3*m3;
m *= modelParameters_.mass;
......@@ -167,7 +188,7 @@ protected:
{
SizeType site = 0;
BlockType block(1, site);
SizeType total = su2Rep_.size();
SizeType total = su3Rep_->size();
HilbertBasisType natBasis(total);
for (SizeType i = 0; i < total; ++i) natBasis[i] = i;
......@@ -177,7 +198,7 @@ protected:
MatrixType m;
su2Rep_.getMatrix(m, a);
su3Rep_->getMatrix(m, a);
SparseMatrixType sparseMatrix(m);
......@@ -208,7 +229,7 @@ protected:
OpForLinkType aOpForLink("T" + ttos(a + 1));
jOne.push(aOpForLink, 'N', aOpForLink, 'C');
jTwo.push(aOpForLink, 'N', aOpForLink, 'C');
}
}
......@@ -235,6 +256,8 @@ private:
}
const SuperGeometryType& superGeometry_;
ParametersSu3Type modelParameters_;
Su3RepresentationBaseType* su3Rep_;
}; // class Su3Model
} // namespace Dmrg
......
#ifndef Su3REPRESENTATION_BASE_H
#define Su3REPRESENTATION_BASE_H
#include "PsimagLite.h"
#include "Matrix.h"
template<typename ComplexOrRealType>
class Su3RepresentationBase {
public:
//typedef typename PsimagLite::Real<ComplexOrRealType>::Type RealType;
typedef PsimagLite::Matrix<ComplexOrRealType> MatrixType;
virtual ~Su3RepresentationBase() {}
virtual void getMatrix(MatrixType& m, SizeType n) const = 0;
virtual SizeType size() const = 0;
};
#endif // Su3REPRESENTATION_BASE_H
#ifndef SU3REPRESENTATIONP1_H
#define SU3REPRESENTATIONP1_H
#include "PsimagLite.h"
#include "Matrix.h"
#include "Su3RepresentationBase.h"
template<typename ComplexOrRealType>
class Su3RepresentationP1 : public Su3RepresentationBase<ComplexOrRealType> {
public:
//typedef typename PsimagLite::Real<ComplexOrRealType>::Type RealType;
typedef PsimagLite::Matrix<ComplexOrRealType> MatrixType;
void getMatrix(MatrixType& m, SizeType n) const
{
throw PsimagLite::RuntimeError("getMatrix: not implemented yet\n");
}
SizeType size() const { return 3; }
};
#endif // SU3REPRESENTATIONP1_H
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