Introduction to atomman: CIF conversions

Lucas M. Hale, lucas.hale@nist.gov, Materials Science and Engineering Division, NIST.

Disclaimers

1. Introduction

The Crystallographic Information File (CIF) format is a standard for representing crystallographic information and is used by different crystal databases. Atomman supports loading atomic structures from CIF files but not writing CIF files based on the structures.

NOTE: Requires that the diffpy.structure package be installed.

Library Imports

[1]:
# Standard Python libraries
import datetime

# http://www.numpy.org/
import numpy as np

import atomman as am
import atomman.unitconvert as uc

# Show atomman version
print('atomman version =', am.__version__)

# Show date of Notebook execution
print('Notebook executed on', datetime.date.today())
atomman version = 1.4.11
Notebook executed on 2024-04-29

CIF file taken from Crystallography Open Database (COD): http://www.crystallography.net/

[2]:
cif = """#------------------------------------------------------------------------------
#$Date: 2016-02-13 21:28:24 +0200 (Sat, 13 Feb 2016) $
#$Revision: 176429 $
#$URL: svn://www.crystallography.net/cod/cif/1/54/12/1541266.cif $
#------------------------------------------------------------------------------
#
# This file is available in the Crystallography Open Database (COD),
# http://www.crystallography.net/
#
# All data on this site have been placed in the public domain by the
# contributors.
#
data_1541266
loop_
_publ_author_name
'Mueller, M. H.'
_publ_section_title
;
 The lattice parameter of tantalum
;
_journal_issue                   8
_journal_name_full               'Scripta Metallurgica'
_journal_page_first              693
_journal_page_last               693
_journal_paper_doi               10.1016/0036-9748(77)90141-7
_journal_volume                  11
_journal_year                    1977
_chemical_formula_sum            Ta
_chemical_name_systematic        Ta
_space_group_IT_number           229
_symmetry_space_group_name_Hall  '-I 4 2 3'
_symmetry_space_group_name_H-M   'I m -3 m'
_cell_angle_alpha                90
_cell_angle_beta                 90
_cell_angle_gamma                90
_cell_formula_units_Z            2
_cell_length_a                   3.30256
_cell_length_b                   3.30256
_cell_length_c                   3.30256
_cell_volume                     36.021
_citation_journal_id_ASTM        SCRMBU
_cod_data_source_file            Mueller_SCRMBU_1977_100.cif
_cod_data_source_block           Ta1
_cod_original_cell_volume        36.0207
_cod_original_formula_sum        Ta1
_cod_database_code               1541266
loop_
_symmetry_equiv_pos_as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y+1/2
z+1/2,x+1/2,-y+1/2
-x+1/2,z+1/2,-y+1/2
-z+1/2,x+1/2,y+1/2
-x+1/2,-z+1/2,y+1/2
z+1/2,-x+1/2,y+1/2
x+1/2,z+1/2,y+1/2
-y+1/2,-z+1/2,-x+1/2
-y+1/2,z+1/2,x+1/2
-z+1/2,-y+1/2,x+1/2
y+1/2,-z+1/2,x+1/2
z+1/2,y+1/2,x+1/2
y+1/2,z+1/2,-x+1/2
-z+1/2,y+1/2,-x+1/2
z+1/2,-y+1/2,-x+1/2
loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
_atom_site_U_iso_or_equiv
Ta1 Ta 0 0 0 1 0.0
"""

2. atomman.load(‘cif’)

Parameters

  • cif (str or file-like object) The cif content to read.

Returns

  • system (atomman.System) An atomman representation of a system.

[3]:
try:
    cif_system = am.load('cif', cif)
except AssertionError as e:
    print('AssertionError:', e)
else:
    print(cif_system)
    print(cif_system.atoms_df())
avect =  [ 3.303,  0.000,  0.000]
bvect =  [ 0.000,  3.303,  0.000]
cvect =  [ 0.000,  0.000,  3.303]
origin = [ 0.000,  0.000,  0.000]
natoms = 2
natypes = 1
symbols = ('Ta',)
pbc = [ True  True  True]
per-atom properties = ['atype', 'pos']
     id   atype  pos[0]  pos[1]  pos[2]
      0       1   0.000   0.000   0.000
      1       1   1.651   1.651   1.651
   atype   pos[0]   pos[1]   pos[2]
0      1  0.00000  0.00000  0.00000
1      1  1.65128  1.65128  1.65128