def test_spatial2spin_eomsf(self): eomsf = eom_uccsd.EOMEESpinFlip(ucc0) size = eomsf.vector_size() v = numpy.random.random(size) r1, r2 = eomsf.vector_to_amplitudes(v) v1 = eom_uccsd.spin2spatial_eomsf(eom_uccsd.spatial2spin_eomsf(r1, orbspin), orbspin) v2 = eom_uccsd.spin2spatial_eomsf(eom_uccsd.spatial2spin_eomsf(r2, orbspin), orbspin) self.assertAlmostEqual(abs(r1[0]-v1[0]).max(), 0, 12) self.assertAlmostEqual(abs(r1[1]-v1[1]).max(), 0, 12) self.assertAlmostEqual(abs(r2[0]-v2[0]).max(), 0, 12) self.assertAlmostEqual(abs(r2[1]-v2[1]).max(), 0, 12) self.assertAlmostEqual(abs(r2[2]-v2[2]).max(), 0, 12) self.assertAlmostEqual(abs(r2[3]-v2[3]).max(), 0, 12)