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))); }
/// <summary> /// Adds "count" points from the start to the end vectors. /// The start point is not added, and the end point is. /// </summary> /// <param name="start"> /// A <see cref="Vector3"/> /// </param> /// <param name="end"> /// A <see cref="Vector3"/> /// </param> /// <param name="count"> /// A <see cref="System.Int32"/> /// </param> public void AddPts(Vector3 start, Vector3 end, int count) { if (count <= 0) { throw new ArgumentException("Count must be positive."); } Vector3 step = (end - start) / count; for (int i = 1; i < count; i++) { Kpts.Add(new KPoint(start + step * i)); } Kpts.Add(new KPoint(end)); }
protected void SortKpoints() { Comparison <KPoint> sorter = (x, y) => { double s_x, s_y, t_x, t_y; GetPlaneST(x, out s_x, out t_x); GetPlaneST(y, out s_y, out t_y); if (Math.Abs(t_x - t_y) > 1e-6) { return(t_x.CompareTo(t_y)); } else { return(s_x.CompareTo(s_y)); } }; Kpts.Sort(sorter); }