#include "TBTK/PropertyExtractor/Diagonalizer.h"
#include <complex>
using namespace std;
using namespace TBTK;
using namespace Visualization::MatPlotLib;
complex<double> i(0, 1);
public:
complex<double> getHoppingAmplitude(
) const{
return J*(1 - 2*spin);
}
void setJ(double J){
this->J = J;
}
private:
double J;
};
int main(){
const unsigned int SIZE_X = 21;
const unsigned int SIZE_Y = 21;
const double t = -1;
const double mu = 0;
JCallback jCallback;
for(unsigned int x = 0; x < SIZE_X; x++){
for(unsigned int y = 0; y < SIZE_Y; y++){
for(unsigned int spin = 0; spin < 2; spin++){
jCallback,
{x, y, spin},
{x, y, spin}
);
if(x+1 < SIZE_X){
t,
{x+1, y, spin},
{x, y, spin}
) + HC;
}
if(y+1 < SIZE_Y){
t,
{x, y+1, spin},
{x, y, spin}
) + HC;
}
}
}
}
const unsigned int NUM_ITERATIONS = 10;
Range j(0, 5, NUM_ITERATIONS);
for(unsigned int n = 0; n < NUM_ITERATIONS; n++){
jCallback.setJ(j[n]);
const double LOWER_BOUND = -8;
const double UPPER_BOUND = 8;
const unsigned int RESOLUTION = 1000;
propertyExtractor.setEnergyWindow(
LOWER_BOUND,
UPPER_BOUND,
RESOLUTION
);
= propertyExtractor.calculateMagnetization(
{{SIZE_X/2, SIZE_Y/2, IDX_SPIN}}
);
magnetizationZ[{n}] = Vector3d::dotProduct(
magnetization({
SIZE_X/2,
SIZE_Y/2,
IDX_SPIN
}).getSpinVector(),
{0, 0, 1}
);
if(n == NUM_ITERATIONS/2){
{{IDX_SUM_ALL, IDX_SUM_ALL, _a_}}
);
const double SMOOTHING_SIGMA = 0.2;
const unsigned int SMOOTHING_WINDOW = 101;
dos = Smooth::gaussian(
dos,
SMOOTHING_SIGMA,
SMOOTHING_WINDOW
);
ldos = Smooth::gaussian(
ldos,
SMOOTHING_SIGMA,
SMOOTHING_WINDOW
);
Plotter plotter;
plotter.setTitle("DOS");
plotter.setLabelX("Energy");
plotter.setLabelY("DOS");
plotter.plot(dos, {{"label", "Total"}});
plotter.plot(
{IDX_SUM_ALL, IDX_SUM_ALL, 0},
ldos,
{
{"color", "red"},
{"linestyle", "--"},
{"label", "Spin up"}
}
);
plotter.plot(
{IDX_SUM_ALL, IDX_SUM_ALL, 1},
ldos,
{
{"color", "blue"},
{"linestyle", "--"},
{"label", "Spin down"}
}
);
plotter.save("figures/DOS.png");
}
}
Plotter plotter;
plotter.setTitle("Magnetization along the z-axis");
plotter.setLabelX("J");
plotter.setLabelY("Magnetization");
plotter.setAxes({
{0, {0, 5}}
});
plotter.plot(magnetizationZ);
plotter.save("figures/Magnetization.png");
}