private void AddLeftBoundary(Vector3 closestGamma, KPoint kpt, KptPlane plane, Lattice lattice) { double s, t; plane.GetPlaneST(kpt, out s, out t); double gs, gt; plane.GetPlaneST(closestGamma, out gs, out gt); if (gs == 0) { return; } double ratio = gt / gs; // this is the solution to // |S| = |S-P| where S is the target point, P is the nearby Gamma point // and the y component of S is constrained to be the same as for the input. double news = 0.5 * (gs + gt * ratio - 2 * t * ratio); if (Math.Abs(news - s) < 1e-6) { return; } Kpts.Add(new BZoneKPoint(plane.ReduceST(news, t))); }
private BZonePlane(KptPlane plane, Lattice lattice) { SetLattice(lattice); Origin = plane.Origin; Sdir = plane.Sdir; Tdir = plane.Tdir; List<Vector3> nearbyGammas = NearbyGammas(); double lastT = double.MinValue; for (int i = 0; i < plane.Kpts.Count; i++) { var kpt = plane.Kpts[i]; this.Kpts.Add(new BZoneKPoint(kpt, i)); double s, t; plane.GetPlaneST(kpt, out s, out t); if (t != lastT) { lastT = t; Vector3 closestGamma = ClosestGamma(nearbyGammas, kpt, lattice); AddLeftBoundary(closestGamma, kpt, plane, lattice); } } SortKpoints(); }
private BZonePlane(KptPlane plane, Lattice lattice) { SetLattice(lattice); Origin = plane.Origin; Sdir = plane.Sdir; Tdir = plane.Tdir; List <Vector3> nearbyGammas = NearbyGammas(); double lastT = double.MinValue; for (int i = 0; i < plane.Kpts.Count; i++) { var kpt = plane.Kpts[i]; this.Kpts.Add(new BZoneKPoint(kpt, i)); double s, t; plane.GetPlaneST(kpt, out s, out t); if (t != lastT) { lastT = t; Vector3 closestGamma = ClosestGamma(nearbyGammas, kpt, lattice); AddLeftBoundary(closestGamma, kpt, plane, lattice); } } SortKpoints(); }
public static KptPlane GeneratePlane(Lattice lattice, Vector3[] points, KptList qmesh) { Vector3 diff_1 = points[1] - points[0]; Vector3 diff_2 = points[2] - points[0]; Vector3 norm = Vector3.CrossProduct(diff_1, diff_2); KptPlane retval = new KptPlane(); retval.SetLattice(lattice); retval.mesh = (int[])qmesh.Mesh.Clone(); retval.shift = new int[3]; retval.origin = points[0]; retval.sdir = diff_1; retval.tdir = diff_2; NormalizeST(lattice, retval); int zmax = qmesh.Mesh[2] * 2; int ymax = qmesh.Mesh[1] * 2; int xmax = qmesh.Mesh[0] * 2; List <KPoint> planePoints = new List <KPoint>(); for (int i = 0; i < qmesh.Kpts.Count; i++) { var qpt = qmesh.Kpts[i]; Vector3 diff = lattice.ReciprocalExpand(qpt.Value) - points[0]; double dot = Math.Abs(diff.DotProduct(norm)); if (dot < 1e-8) { double s, t; retval.GetPlaneST(qpt, out s, out t); retval.AddKpt(qpt); } } // now sort q-points to lay them in the s,t plane. retval.SortKpoints(); Vector3 sd = retval.sdir / SmallestNonzero(retval.sdir); Vector3 td = retval.tdir / SmallestNonzero(retval.tdir); Output.WriteLine("Plane horizontal direction: {0}", sd); Output.WriteLine("Plane vertical direction: {0}", td); Output.WriteLine("Plane horizontal vector: {0}", retval.sdir); Output.WriteLine("Plane vertical vector: {0}", retval.tdir); return(retval); }
public Matrix GetValue(int index, KptPlane plane, MatrixValueGetter getter, params object[] args) { BZoneKPoint kpt = (BZoneKPoint)base.Kpts[index]; if (kpt.TargetIndex != -1) { return getter(kpt.TargetIndex, args); } else return Matrix.Zero(4); }
public static KptPlane GeneratePlane(Lattice lattice, Vector3[] points, KptList qmesh) { Vector3 diff_1 = points[1] - points[0]; Vector3 diff_2 = points[2] - points[0]; Vector3 norm = Vector3.CrossProduct(diff_1, diff_2); KptPlane retval = new KptPlane(); retval.SetLattice(lattice); retval.mesh = (int[])qmesh.Mesh.Clone(); retval.shift = new int[3]; retval.origin = points[0]; retval.sdir = diff_1; retval.tdir = diff_2; NormalizeST(lattice, retval); int zmax = qmesh.Mesh[2] * 2; int ymax = qmesh.Mesh[1] * 2; int xmax = qmesh.Mesh[0] * 2; List<KPoint> planePoints = new List<KPoint>(); for (int i = 0; i < qmesh.Kpts.Count; i++) { var qpt = qmesh.Kpts[i]; Vector3 diff = lattice.ReciprocalExpand(qpt.Value) - points[0]; double dot = Math.Abs(diff.DotProduct(norm)); if (dot < 1e-8) { double s, t; retval.GetPlaneST(qpt, out s, out t); retval.AddKpt(qpt); } } // now sort q-points to lay them in the s,t plane. retval.SortKpoints(); Vector3 sd = retval.sdir / SmallestNonzero(retval.sdir); Vector3 td = retval.tdir / SmallestNonzero(retval.tdir); Output.WriteLine("Plane horizontal direction: {0}", sd); Output.WriteLine("Plane vertical direction: {0}", td); Output.WriteLine("Plane horizontal vector: {0}", retval.sdir); Output.WriteLine("Plane vertical vector: {0}", retval.tdir); return retval; }
public KptPlane CreateIrreduciblePlane(SymmetryList symmetries) { KptPlane p = new KptPlane(); p.origin = origin; p.tdir = tdir; p.sdir = sdir; FillIrreducibleMesh(symmetries, p); return(p); }
protected override KptList CloneImpl() { KptPlane retval = new KptPlane(); base.CloneBaseImpl(retval); retval.sdir = sdir; retval.tdir = tdir; retval.origin = origin; return(retval); }
private static void NormalizeST(Lattice lattice, KptPlane retval) { retval.sdir /= retval.sdir.Magnitude; retval.tdir /= retval.tdir.Magnitude; retval.sdir /= GammaInDirection(lattice, retval.sdir).DotProduct(retval.sdir); retval.tdir /= GammaInDirection(lattice, retval.tdir).DotProduct(retval.tdir); // double them to make s and t 1 at the zone boundary, instead of 0.5. retval.sdir *= 2; retval.tdir *= 2; }
public Matrix GetValue(int index, KptPlane plane, MatrixValueGetter getter, params object[] args) { BZoneKPoint kpt = (BZoneKPoint)base.Kpts[index]; if (kpt.TargetIndex != -1) { return(getter(kpt.TargetIndex, args)); } else { return(Matrix.Zero(4)); } }
public static BZonePlane CreateBZonePlane(KptPlane plane, Lattice lattice) { return(new BZonePlane(plane, lattice)); }
private void AddLeftBoundary(Vector3 closestGamma, KPoint kpt, KptPlane plane, Lattice lattice) { double s, t; plane.GetPlaneST(kpt, out s, out t); double gs, gt; plane.GetPlaneST(closestGamma, out gs, out gt); if (gs == 0) return; double ratio = gt / gs; // this is the solution to // |S| = |S-P| where S is the target point, P is the nearby Gamma point // and the y component of S is constrained to be the same as for the input. double news = 0.5 * (gs + gt * ratio - 2 * t * ratio); if (Math.Abs(news - s) < 1e-6) return; Kpts.Add(new BZoneKPoint(plane.ReduceST(news, t))); }
public static BZonePlane CreateBZonePlane(KptPlane plane, Lattice lattice) { return new BZonePlane(plane, lattice); }
protected override KptList CloneImpl() { KptPlane retval = new KptPlane(); base.CloneBaseImpl(retval); retval.sdir = sdir; retval.tdir = tdir; retval.origin = origin; return retval; }
public KptPlane CreateIrreduciblePlane(SymmetryList symmetries) { KptPlane p = new KptPlane(); p.origin = origin; p.tdir = tdir; p.sdir = sdir; FillIrreducibleMesh(symmetries, p); return p; }