public Matrix CalcHamiltonian(Vector3 kpt) { Matrix m = new Matrix(Orbitals.Count, Orbitals.Count); kpt *= 2 * Math.PI; for (int i = 0; i < Orbitals.Count; i++) { for (int j = 0; j < Orbitals.Count; j++) { HoppingPair p = Hoppings.FindOrThrow(i, j); Complex val = new Complex(); for (int k = 0; k < p.Hoppings.Count; k++) { HoppingValue hop = p.Hoppings[k]; Vector3 R = hop.R; Complex newval = hop.Value * Complex.Exp(new Complex(0, kpt.DotProduct(R))); val += newval; } m[i,j] = val; } } if (m.IsHermitian == false) throw new Exception("Hamiltonian at k = " + kpt.ToString() + " is not Hermitian."); return m; }
public bool GetPlaneST(Vector3 kpt, out double s, out double t) { Vector3 v = new Vector3(); // expand to cartesian coordinates for (int i = 0; i < 3; i++) { v += (kpt[i] - origin[i]) * G[i]; } s = v.DotProduct(sdir); t = v.DotProduct(tdir); double norm = (kpt - origin).DotProduct(sdir.CrossProduct(tdir)); if (Math.Abs(norm) > 1e-7) return false; else return true; }