/// <summary>
 /// Method for adding a <see cref="FermionTerm"/> of type <see cref="FermionTermType"/>
 /// to a <see cref="FermionHamiltonian"/>.
 /// </summary>
 /// <param name="termType">Type of fermion term to be added.</param>
 /// <param name="term">Fermion term to be added.</param>
 public void AddFermionTerm(FermionTermType termType, FermionTerm term)
 {
     if (!FermionTerms.ContainsKey(termType))
     {
         FermionTerms.Add(termType, new List <FermionTerm>());
     }
     FermionTerms[termType].Add(term);
 }
        /// <summary>
        /// Method for adding a <see cref="FermionTerm"/> of type <see cref="FermionTermType"/>
        /// to a <see cref="FermionHamiltonian"/>.
        /// </summary>
        /// <param name="termType">Type of fermion term to be added.</param>
        /// <param name="fermionIdxArray">indices of Fermion term to be added.</param>
        public void AddFermionTerm(FermionTermType termType, Int64[] fermionIdxArray, Double coefficient)
        {
            if (!FermionTerms.ContainsKey(termType))
            {
                FermionTerms.Add(termType, new List <FermionTerm>());
            }
            var conjugateArray = termType.GetConjugateSequence();
            var fermionTerm    = new FermionTerm(
                nOrbitals: NOrbitals,
                caArray: conjugateArray,
                fermionIdxArray: fermionIdxArray,
                coeffIn: coefficient
                );

            AddFermionTerm(termType, fermionTerm);
        }
예제 #3
0
 public bool Equals(FermionTermType x)
 {
     if (ReferenceEquals(null, x))
     {
         return(false);
     }
     else if (ReferenceEquals(this, x))
     {
         return(true);
     }
     else if (GetType() != x.GetType())
     {
         return(false);
     }
     else
     {
         return(this == x);
     }
 }