BandStruct.h? (沿着高对称线计算能带数据)
namespace TightBinding
{
class BandStructure
{
public:
BandStructure();
Materials materials;
SymmetryPoints symmetryPoints;
std::vector<std::vector<double>> results;
std::vector<unsigned int> symmetryPointsPositions;
void Initialize(std::vector<std::string> path, unsigned int nrPoints = 600);
std::vector<std::vector<double>> Compute(const Material& material, unsigned int startPoint, unsigned int endPoint, std::atomic_bool& terminate);
unsigned int GetPointsNumber() const { return static_cast<unsigned int>(kpoints.size()); }
const std::vector<std::string>& GetPath() const { return m_path; }
private:
std::vector<std::string> m_path;
std::vector<Vector3D<double>> kpoints;
};
}
BandStruct.h?
namespace TightBinding
{
BandStructure::BandStructure()
{
}
void BandStructure::Initialize(std::vector<std::string> path, unsigned int nrPoints)
{
kpoints.clear();
results.clear();
kpoints.reserve(nrPoints);
results.reserve(nrPoints);
m_path.swap(path);
kpoints = symmetryPoints.GeneratePoints(m_path, nrPoints, symmetryPointsPositions);
}
std::vector<std::vector<double>> BandStructure::Compute(const Material& material, unsigned int startPoint, unsigned int endPoint, std::atomic_bool& terminate)
{
std::vector<std::vector<double>> res;
Hamiltonian hamiltonian(material);
for (unsigned int i = startPoint; i < endPoint && !terminate; ++i)
{
hamiltonian.SetMatrix(kpoints[i]);
hamiltonian.Diagonalize();
const Eigen::VectorXd& eigenvals = hamiltonian.eigenvalues();
res.emplace_back();
res.back().reserve(eigenvals.rows());
for (unsigned int level = 0; level < eigenvals.rows(); ++level)
res.back().push_back(eigenvals(level));
}
return std::move(res);
}
}
Hamiltonian.h??
namespace TightBinding
{
class Hamiltonian
{
public:
Hamiltonian(const Material& material);
void SetMatrix(const Vector3D<double>& k);
void Diagonalize();
const Eigen::VectorXd& eigenvalues() const { return solver.eigenvalues(); }
protected:
inline static std::complex<double> g0(const Vector3D<double>& k);
inline static std::complex<double> g1(const Vector3D<double>& k);
inline static std::complex<double> g2(const Vector3D<double>& k);
inline static std::complex<double> g3(const Vector3D<double>& k);
const Material& m_material;
Eigen::Matrix<std::complex<double>, 10, 10> matrix;
Eigen::SelfAdjointEigenSolver<Eigen::MatrixXcd> solver;
};
}
这里Hamiltonian的参数通过material这个对象传进去。这个对象定义了包含常见s,p轨道的hopping参数。
namespace TightBinding
{
class Material
{
public:
Material() : m_Esa(0), m_Epa(0), m_Esc(0), m_Epc(0), m_Esstara(0), m_Esstarc(0), m_Vss(0), m_Vxx(0), m_Vxy(0), m_Vsapc(0), m_Vscpa(0), m_Vsstarapc(0), m_Vpasstarc(0) {}
Material(const std::string& Name, double Esa, double Epa, double Esc, double Epc, double Esstara, double Esstarc, double Vss, double Vxx, double Vxy, double Vsapc, double Vscpa, double Vsstarapc, double Vpasstarc);
std::string name;
// initialized with values from table 1 in P. Vogl et al.
// a - anion, c - cation, s, p, sstar - the s, p and excited s orbitals, respectively
double m_Esa;
double m_Epa;
double m_Esc;
double m_Epc;
double m_Esstara;
double m_Esstarc;
double m_Vss;
double m_Vxx;
double m_Vxy;
double m_Vsapc;
double m_Vscpa;
double m_Vsstarapc;
double m_Vpasstarc;
};
class Materials
{
public:
Materials();
std::map<std::string, Material> materials;
};
}
SymmetryPoint.h 记录了一系列高对称点。
namespace TightBinding
{
class SymmetryPoint
{
public:
SymmetryPoint() {}
SymmetryPoint(const std::string& Name, const Vector3D<double> pos) : name(Name), position(pos) {}
SymmetryPoint(const SymmetryPoint& sym)
: name(sym.name), position(sym.position)
{
}
SymmetryPoint& operator=(const SymmetryPoint& sym)
{
name = sym.name;
position = sym.position;
return *this;
}
std::string name;
Vector3D<double> position;
};
class SymmetryPoints
{
public:
SymmetryPoints();
std::map<std::string, SymmetryPoint> symmetryPoints;
std::vector<Vector3D<double>> GeneratePoints(const std::vector<std::string>& path, unsigned int nrPoints, std::vector<unsigned int>& symmetryPointsPositions);
};
}
|