/// <summary>
        /// Constructs a single-reference wave function. This
        /// is treated as sparse multi-reference wave function with only
        /// one term.
        /// </summary>
        /// <param name="term">
        /// Sequence of indices of creation operators acting
        /// on the vacuum state.
        /// </param>
        /// <example>
        /// Create a list of indices of the creation operators, then
        /// Convert the list of indices to a `FermionWavefunction` instance.
        /// <code>
        /// var indices = new[] { 1, 2, 6 };
        /// var wavefunction = new FermionWavefunction&lt;int&gt;(indices);
        /// </code>
        /// </example>
        public FermionWavefunction(IEnumerable <TIndex> term)
        {
            // This is deliberately set to SparseMultiConfigurational
            // instead of SingleConfigurational as it is equivalent
            // to a sparse multi-reference wavefunciton with only
            // one term.
            Method = StateType.SparseMultiConfigurational;

            var singleReferenceWavefunction = new SingleCFWavefunction <TIndex>(term);

            MCFData.Set(singleReferenceWavefunction, new Complex(1.0, 0.0));
        }
        /// <summary>
        /// This approximates the Hamiltonian ground state by a greedy algorithm
        /// that minimizes only the PP term energies. If there are no PP terms,
        /// states will be occupied in lexicographic order.
        /// </summary>
        /// <returns>
        /// Greedy trial state for minimizing Hamiltonian diagonal one-electron energy.
        /// </returns>
        public static FermionWavefunction <int> CreateHartreeFockState(this FermionHamiltonian hamiltonian, int nElectrons)
        {
            SingleCFWavefunction <int> greedyState = hamiltonian.GreedyStatePreparationSCF(nElectrons);

            var wavefunction = new FermionWavefunction <int>
            {
                Energy  = 0.0,
                Method  = StateType.SparseMultiConfigurational,
                MCFData = new SparseMultiCFWavefunction <int>()
            };

            wavefunction.MCFData.Set(greedyState, new System.Numerics.Complex(1.0, 0.0));

            return(wavefunction);
        }
 /// <summary>
 /// Construct a copy of the input instance.
 /// </summary>
 /// <param name="term">Sequence of ladder operators.</param>
 internal SingleCFWavefunction(SingleCFWavefunction <TIndex> term) : base(term)
 {
 }
Example #4
0
 /// <summary>
 /// Constructor for empty instance.
 /// </summary>
 public SparseMultiCFWavefunction()
 {
     Reference   = new SingleCFWavefunction <TIndex>();
     Excitations = new Dictionary <IndexOrderedSequence <TIndex>, Complex>();
 }