Exemplo n.º 1
0
    def test_hkl_checksum(self) -> bool:
        """
        A method to check whether the checksums in the cif file fit to the content.
        """
        cif_hkl_ckecksum = 0
        hkl_checksum_calcd = self.hkl_checksum_calcd
        if hkl_checksum_calcd > 0:
            cif_hkl_ckecksum = self['_shelx_hkl_checksum'] or -1
            try:
                cif_hkl_ckecksum = int(cif_hkl_ckecksum)
            except ValueError:
                cif_hkl_ckecksum = -1
        if cif_hkl_ckecksum > 0 and cif_hkl_ckecksum != hkl_checksum_calcd:
            return False
        else:
            return True


if __name__ == '__main__':
    c = CifContainer('test-data/p21c.cif')
    # print(c.hkl_file)
    # print(c.hkl_as_cif)
    # print(c.test_hkl_checksum())
    s = Shelxfile()
    # print(c.res_file_data)
    s.read_string(c.res_file_data)
    print(s.hklf.n)

# print(CifContainer('tests/examples/1979688.cif').hkl_as_cif[-250:])
Exemplo n.º 2
0
 def hklf_number_from_shelxl_file(self) -> int:
     shx = Shelxfile()
     shx.read_string(self.res_file_data)
     return shx.hklf.n if shx.hklf.n != 0 else 4
Exemplo n.º 3
0
 def test_vector_length(self):
     shx = Shelxfile()
     shx.read_string(self.head + self.tail)
     sdm = SDM(shx)
     self.assertEqual(7.343581289102655, sdm.vector_length(-0.3665069999999999, 0.293439, -0.06597900000000001))