def test_determinant_to_ops_inorder(self): """If spin case is not necessary to distinguish in the representation return the orbitals based on increasing index. """ test_ops = FermionOperator('0^ 1^ 2^ 3^ 4^', 1.0) self.assertEqual( openfermion_utils.determinant_to_ops(7, 3, inorder=True), test_ops)
def test_determinant_to_ops_beta(self): """A singly occupied determinant should just have a single creation operator in it. """ self.assertEqual(openfermion_utils.determinant_to_ops(0, 1), FermionOperator('1^', 1.0))
def test_determinant_to_ops(self): """Convert a determinant to openfermion ops """ test_ops = FermionOperator('0^ 2^ 4^ 1^ 3^', 1.0) self.assertEqual(openfermion_utils.determinant_to_ops(7, 3), test_ops)
def test_determinant_to_ops_null(self): """A determinant with no occupation should return None type. """ self.assertEqual(openfermion_utils.determinant_to_ops(0, 0), FermionOperator('', 1.0))