private void CalcOffSiteInteraction(TightBinding tb, Matrix _S, Matrix _C, InteractionPair interaction, double structureFactor) { foreach (int l1 in interaction.OrbitalsLeft) { foreach (int l2 in interaction.OrbitalsLeft) { foreach (int l3 in interaction.OrbitalsRight) { foreach (int l4 in interaction.OrbitalsRight) { int i = GetIndex(tb, l1, l2); int j = GetIndex(tb, l3, l4); double Sval = 0, Cval = 0; if (l1 == l2 && l2 == l3 && l3 == l4) { Sval = -0.5 * interaction.Exchange * structureFactor; Cval = (2 * interaction.InterorbitalU - 0.5 * interaction.Exchange) * structureFactor; } else if (l1 == l2 && l2 != l3 && l3 == l4) { Sval = -0.25 * interaction.Exchange * structureFactor; Cval = (2 * interaction.InterorbitalU - 0.5 * interaction.Exchange) * structureFactor; } _S[i, j] += Sval; _S[j, i] += Sval; _C[i, j] += Cval; _C[j, i] += Cval; } } } } }
internal InteractionPair Clone() { InteractionPair p = new InteractionPair(); p.mOrbitalsLeft.AddRange(mOrbitalsLeft); p.mOrbitalsRight.AddRange(mOrbitalsRight); p.mVectors.AddRange(mVectors); p.mLeftGroup = mLeftGroup; p.mRightGroup = mRightGroup; p.HubbardU = HubbardU; p.InterorbitalU = InterorbitalU; p.Exchange = Exchange; p.PairHopping = PairHopping; return(p); }
private void CalcOnSiteInteraction(TightBinding tb, Matrix _S, Matrix _C, InteractionPair interaction) { foreach (int l1 in interaction.OrbitalsLeft) { foreach (int l2 in interaction.OrbitalsLeft) { foreach (int l3 in interaction.OrbitalsRight) { foreach (int l4 in interaction.OrbitalsRight) { int i = GetIndex(tb, l1, l2); int j = GetIndex(tb, l3, l4); if (l1 == l2 && l2 == l3 && l3 == l4) { _S[i, j] += interaction.HubbardU; _C[i, j] += interaction.HubbardU; } else if (l1 == l4 && l4 != l2 && l2 == l3) { _S[i, j] += interaction.InterorbitalU; _C[i, j] += (-interaction.InterorbitalU + interaction.Exchange); } else if (l1 == l2 && l2 != l3 && l3 == l4) { _S[i, j] += interaction.Exchange; _C[i, j] += 2 * interaction.InterorbitalU - interaction.Exchange; } else if (l1 == l3 && l3 != l2 && l2 == l4) { _S[i, j] += interaction.PairHopping; _C[i, j] += interaction.PairHopping; } } } } } }
private void ReadInteractionSection() { if (tb.Interactions != null) { ThrowEx("Multiple Interaction sections found."); } tb.Interactions = new InteractionList(); if (LineType != LineType.NewSubSection && LineType != LineType.NewSection) { if (Line.ToLowerInvariant().StartsWith("adjust")) { tb.Interactions.AdjustInteractions = true; string ltext = Line.ToLowerInvariant().Substring(6); double val; if (double.TryParse(ltext, out val) == false) { val = 0.001; } if (val <= 0 || val >= 1) { ThrowEx("Interaction adjustment should be between 0 and 1."); } tb.Interactions.MaxEigenvalue = 1 - val; } ReadNextLine(); } while (!EOF && LineType != LineType.NewSection) { if (LineType != LineType.NewSubSection) { ThrowEx("Could not understand contents of interaction section."); } string[] values = ReadSubSectionParameters(); InteractionPair inter = new InteractionPair(tb.sites, values[0], values[1]); if (inter.OrbitalsLeft.Count == 0) { ThrowEx("Could not identify interaction group \"" + values[0] + "\"."); } if (inter.OrbitalsRight.Count == 0) { ThrowEx("Could not identify interaction group \"" + values[1] + "\"."); } ReadNextLine(); string[] interactionVals = Line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); double[] vals = interactionVals.Select(x => double.Parse(x)).ToArray(); ReadNextLine(); while (!EOF && LineType != LineType.NewSection && LineType != LineType.NewSubSection) { Vector3 vec = Vector3.Parse(Line); inter.Vectors.Add(vec); ReadNextLine(); } Orbital left = tb.Orbitals[inter.OrbitalsLeft[0]]; Orbital right = tb.Orbitals[inter.OrbitalsRight[0]]; Vector3 delta = left.Location - right.Location; if (delta.Magnitude > 1e-8 && inter.Vectors.Count == 0) { ThrowEx(string.Format( "Interaction is specified between groups {0} and {1}, but they are at different locations and no vectors were given!", values[0], values[1])); } if (inter.OnSite) { if (interactionVals.Length > 4) { ThrowEx("Found too many parameters in the interaction."); } inter.HubbardU = double.Parse(interactionVals[0]); if (interactionVals.Length > 1) { inter.InterorbitalU = double.Parse(interactionVals[1]); } if (interactionVals.Length > 2) { inter.Exchange = double.Parse(interactionVals[2]); } if (interactionVals.Length > 3) { inter.PairHopping = double.Parse(interactionVals[3]); } } else { if (interactionVals.Length > 2) { ThrowEx("Found too many parameters in the interaction. Only two (Hubbard and exchange) allowed for intersite interaction"); } inter.InterorbitalU = double.Parse(interactionVals[0]); inter.Exchange = double.Parse(interactionVals[1]); } tb.Interactions.Add(inter); } }