Exemplo n.º 1
0
    def test_readingCIFs(self):
        from analyseClusters import Crystal
        #arbitrarily divide in 2 parts
        myCrystal = Crystal.fromZp1Cif('mfa_tfa_tfa_pcm_f16_translated.cif',
                                       nAtomsPerMol=15)
        self.assertEqual(
            [len(m.aseAtoms) for m in myCrystal.asymmetricMolecules], [15, 15])

        #P-1 structure with z'=1
        myCrystal = Crystal.fromCif('mfa_tfa_tfa_pcm_f16_translated.cif')
        self.assertTrue(len(myCrystal.asymmetricMolecules), 2)
        self.assertEqual(
            [len(x.aseAtoms) for x in myCrystal.asymmetricMolecules], [30, 30])

        #Originally P1 with z'=4 (already expanded the symmetry and reduced to P1)
        myCrystal = Crystal.fromCif('tfa_ffa_tfa_pcm_p21c.cif')
        self.assertTrue(len(myCrystal.asymmetricMolecules), 4)
        self.assertEqual(
            [len(x.aseAtoms) for x in myCrystal.asymmetricMolecules], [30] * 4)
Exemplo n.º 2
0
    def test_changingCellParams(self):
        from analyseClusters import latticeParameters, Crystal

        myCrystal = Crystal.fromZp1Cif('expStructuresTFA.cif')
        np.testing.assert_array_almost_equal(
            np.array(latticeParameters(myCrystal.aseCell)),
            np.array([6.9136, 7.2915, 14.1096, 78.1106, 80.0763, 64.8556]))

        #swap (a,b,c) -> (c,a,b)
        np.testing.assert_array_almost_equal(
            latticeParameters(
                np.dot(np.array([[0., 0., 1.], [1., 0., 0.], [0., 1., 0.]]),
                       myCrystal.aseCell)),
            np.array([14.1096, 6.9136, 7.2915, 64.8556, 78.1106, 80.0763]))

        newCrystal = myCrystal.clone(
            np.array([[0., 0., 1.], [1., 0., 0.], [0., 1., 0.]]))
        np.testing.assert_array_almost_equal(
            latticeParameters(newCrystal.aseCell),
            np.array([14.1096, 6.9136, 7.2915, 64.8556, 78.1106, 80.0763]))
Exemplo n.º 3
0
    def test_indicesAcidicHydrogens(self):
        from analyseClusters import Crystal

        myCrystal = Crystal.fromZp1Cif('mfa_tfa_tfa_pcm_f16_translated.cif')
        self.assertTrue(myCrystal.asymmetricMolecules[0].
                        indicesAcidicHydrogens() == [18, 23])