Skip to content

Commit 423fafa

Browse files
committed
TST: symmetry-derived site isotropy from CIF data
When loading from CIF file verify site isotropy is set from space group symmetry or from specific `_atom_site_adp_type` value.
1 parent 6235c2a commit 423fafa

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

src/diffpy/structure/tests/testp_cif.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,62 @@ def test_custom_spacegroup_cif(self):
289289
return
290290

291291

292+
def test_spacegroup_isotropy(self):
293+
"verify site isotropy due to site symmetry."
294+
# remove the _atom_site_thermal_displace_type field
295+
with open(self.pbteciffile) as fp:
296+
lines = [line.replace(' Uiso ', ' ') for line in fp
297+
if '_atom_site_thermal_displace_type' not in line]
298+
ciftxt = ''.join(lines)
299+
ptest = self.ptest
300+
stru = ptest.parse(ciftxt)
301+
self.assertFalse(any(stru.anisotropy))
302+
self.assertTrue(all(not a.anisotropy for a in ptest.asymmetric_unit))
303+
return
304+
305+
306+
@unittest.expectedFailure
307+
def test_spacegroup_anisotropy(self):
308+
"verify site anisotropy due to site symmetry."
309+
stru = self.ptest.parseFile(self.graphiteciffile)
310+
self.assertTrue(all(stru.anisotropy))
311+
return
312+
313+
314+
def test_adp_type_ani(self):
315+
"verify adp type override to anisotropic"
316+
with open(self.pbteciffile) as fp:
317+
ciftxt = fp.read()
318+
ciftxt = ciftxt.replace(' Uiso ', ' Uani ')
319+
stru = self.ptest.parse(ciftxt)
320+
self.assertTrue(all(stru.anisotropy))
321+
return
322+
323+
324+
def test_adp_type_iso(self):
325+
"verify adp type override to isotropic"
326+
with open(self.graphiteciffile) as fp:
327+
lines = fp.readlines()
328+
lines.insert(-2, '_atom_site_adp_type\n')
329+
lines[-2] = lines[-2].rstrip() + ' Uiso\n'
330+
lines[-1] = lines[-1].rstrip() + ' Uiso\n'
331+
ciftxt = ''.join(lines)
332+
stru = self.ptest.parse(ciftxt)
333+
self.assertFalse(any(a.anisotropy for a in stru))
334+
return
335+
336+
337+
def test_adp_aniso_label(self):
338+
"verify ADP type setting from _atom_site_aniso_label loop"
339+
with open(self.teiciffile) as fp:
340+
lines = [line.replace(' Uani ', ' ') for line in fp
341+
if not '_atom_site_adp_type' in line]
342+
ciftxt = ''.join(lines)
343+
stru = self.ptest.parse(ciftxt)
344+
self.assertTrue(all(stru.anisotropy))
345+
return
346+
347+
292348
def test_getParser(self):
293349
"""Test passing of eps keyword argument by getParser function.
294350
"""

0 commit comments

Comments
 (0)