paddle_quantum.qchem.fermionic_state

Wave function module.

class paddle_quantum.qchem.fermionic_state.WaveFunction(data, convention='mixed', backend=None, dtype=None, override=False)

Bases: State

clone()

Return a copy of the wavefunction.

Returns:

A new state which is identical to this state.

swap(p, q)

Switching p-th qubit and q-th qubit.

Note

Since qubit represents fermion state, exchanging them will results in a minus sign.

Parameters:
  • p (int) – index of the qubit being exchanged.

  • q (int) – index of another qubit being exchanged.

to_spin_mixed()

If the wavefunction is in convention “separated”, convert it to a “mixed” convention state.

to_spin_separated()

If the wavefunction is in convention “mixed”, convert it to a “separated” convention state.

classmethod slater_determinant_state(num_qubits, num_elec, mz, backend=None, dtype=None)

Construct a single Slater determinant state whose length is num_qubits . The number of “1” in the Slater determinant state equals num_elec, the difference between number of spin up electrons and the number of spin down electrons is mz . The prepared Slater determinant is in mixed spin orbital mode, which is “updownupdown…”.

Parameters:
  • num_qubits (int) – number of qubits used in preparing Slater determinant state.

  • num_elec (int) – number of electrons in Slater determinant state.

  • mz (int) – nn .

Returns:

WaveFunction.

classmethod zero_state(num_qubits, backend=None, dtype=None)

Construct a zero state, |0000.... .

num_elec(shots=0)

Calculate the total number of electrons in the wave function.

Ψ|iσa^iσa^iσ|Ψ.
total_SpinZ(shots=0)

Calculate the total spin Z component of the wave function.

Ψ|iS^z|ΨS^z=0.5p(n^pαn^pβ)α≡↑,β≡↓,n^pσ=a^pσa^pσ
total_Spin2(shots=0)

Calculate the expectation value of S^2 operator on the wave function.

Ψ|S^+S^+S^z(S^z1)|ΨS^+=pa^pαa^pβS^=pa^pβa^pαS^z=0.5p(n^pαn^pβ)α≡↑,β≡↓,n^pσ=a^pσa^pσ