public void IsInCanonicalOrderTest(bool pass, Int64 uniqueTerms, Int64[] type) { var tmp = new FermionTermType(uniqueTerms, type); if (pass) { Assert.True(tmp.IsInCanonicalOrder()); } else { Assert.False(tmp.IsInCanonicalOrder()); } }
public void IsInCanonicalOrderCommonTypesTest() { var tmp = new FermionTermType[] { IdentityTermType, PPTermType, PQTermType, PQQPTermType, PQQRTermType, PQRSTermType }; foreach (var item in tmp) { Assert.True(item.IsInCanonicalOrder()); } }
public void GetFermionTermTypeTests(Int64 norbitals, Int64[] idx, Int64 type) { var tmp = new FermionTermType[] { IdentityTermType, PPTermType, PQTermType, PQQPTermType, PQQRTermType, PQRSTermType }; var spinOrbitals = idx.Select(o => new SpinOrbital(norbitals, o)).ToArray(); var coefficient = 1.0; var fermionTerm = new FermionTerm(spinOrbitals, coefficient); var fermionTermType = fermionTerm.GetFermionTermType(); Assert.True(fermionTermType == tmp[type]); }
public void LoadFromLiquidTest(string line, FermionTermType termType, FermionTerm[] terms) { //var test = terms.Item1; //string[] lines, FermionTermType termType, FermionTerm[] terms var hamiltonian = LoadData.LoadFromLiquid(line); Assert.True(hamiltonian.FermionTerms.ContainsKey(termType)); // Check that expected terms are found foreach (var term in terms) { Assert.Contains(term, hamiltonian.FermionTerms[termType], new Comparers.FermionTermComparer()); } // Check only expected terms are found foreach (var term in hamiltonian.FermionTerms[termType]) { Assert.Contains(term, terms, new Comparers.FermionTermComparer()); } // Verify that each term is in the canonical order. Assert.True(hamiltonian.VerifyFermionTerms()); }