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) – \(n_{\uparrow}-n_{\downarrow}\) .

Returns:

WaveFunction.

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

Construct a zero state, \(|0000....\rangle\) .

num_elec(shots=0)

Calculate the total number of electrons in the wave function.

\[\langle\Psi|\sum_{i\sigma}\hat{a}_{i\sigma}^{\dagger}\hat{a}_{i\sigma}|\Psi\rangle.\]
total_SpinZ(shots=0)

Calculate the total spin Z component of the wave function.

\[\begin{split}\langle\Psi|\sum_{i}\hat{S}_z|\Psi\rangle \\ \hat{S}_z = 0.5*\sum_{p}(\hat{n}_{p\alpha}-\hat{n}_{p\beta}) \\ \alpha\equiv\uparrow, \beta\equiv\downarrow, \hat{n}_{p\sigma}=\hat{a}^{\dagger}_{p\sigma}\hat{a}_{p\sigma}\end{split}\]
total_Spin2(shots=0)

Calculate the expectation value of \(\hat{S}^2\) operator on the wave function.

\[\begin{split}\langle\Psi|\hat{S}_+\hat{S}_- +\hat{S}_z(\hat{S}_z-1)|\Psi\rangle \\ \hat{S}_+ = \sum_{p}\hat{a}_{p\alpha}^{\dagger}\hat{a}_{p\beta} \\ \hat{S}_- = \sum_{p}\hat{a}_{p\beta}^{\dagger}\hat{a}_{p\alpha} \\ \hat{S}_z = 0.5*\sum_{p}(\hat{n}_{p\alpha}-\hat{n}_{p\beta}) \\ \alpha\equiv\uparrow, \beta\equiv\downarrow, \hat{n}_{p\sigma}=\hat{a}^{\dagger}_{p\sigma}\hat{a}_{p\sigma}\end{split}\]