def test_bit_to_fermion_creation_order(self):
     """Return the representation of a bitstring as FermionOperators acting
     on the vacuum.
     """
     bit = (1 << 6) + 31
     self.assertEqual(openfermion_utils.bit_to_fermion_creation(bit),
                      FermionOperator('0^ 1^ 2^ 3^ 4^ 6^', 1.0))
 def test_bit_to_fermion_creation_beta(self):
     """Spin index conversetion between the fqe and opernfermion is that
     beta/down fermions are indicated by index*2+1. bit 1 is index 1 for
     down spin.
     """
     self.assertEqual(openfermion_utils.bit_to_fermion_creation(1, 'down'),
                      FermionOperator('1^', 1.0))
 def test_bit_to_fermion_creation_alpha(self):
     """Spin index conversetion between the fqe and opernfermion is that
     alpha/up fermions are indicated by index*2. bit 1 is index 0 for up
     spin.
     """
     self.assertEqual(openfermion_utils.bit_to_fermion_creation(1, 'up'),
                      FermionOperator('0^', 1.0))
 def test_bit_to_fermion_creation_null(self):
     """Empty bitstrings will return None.
     """
     self.assertIsNone(openfermion_utils.bit_to_fermion_creation(0))
 def test_bit_to_fermion_creation_spinless(self):
     """Spinless particles are converted directly into their occupation index.
     """
     self.assertEqual(openfermion_utils.bit_to_fermion_creation(1),
                      FermionOperator('0^', 1.0))