Package diffpy :: Package Structure :: Package Parsers :: Module P_cif :: Class P_cif
[hide private]
[frames] | no frames]

Class P_cif

source code

structureparser.StructureParser --+
                                  |
                                 P_cif

Simple parser for CIF structure format.
Reads Structure from the first block containing _atom_site_label key.
Following blocks, if any are ignored.

Data members:

format      -- structure format name
ciffile     -- instance of CifFile from PyCifRW
stru        -- Structure instance used for cif input or output

Data members used for input only:

spacegroup  -- instance of SpaceGroup used for symmetry expansion
eau         -- instance of ExpandAsymmetricUnit from SymmetryUtilities
asymmetric_unit -- list of atom instances for the original asymmetric
               unit in the CIF file
labelindex  -- dictionary mapping unique atom label to index of atom
               in self.asymmetric_unit
cif_sgname  -- space group name obtained by looking up the value of
               _space_group_name_Hall, _symmetry_space_group_name_Hall,
               _space_group_name_H-M_alt, _symmetry_space_group_name_H-M
               items.  None when neither is defined.



Instance Methods [hide private]
 
__init__(self) source code
 
parse(self, s)
Create Structure instance from a string in CIF format.
source code
 
parseLines(self, lines)
Parse list of lines in CIF format.
source code
 
parseFile(self, filename)
Create Structure from an existing CIF file.
source code
 
_parseCifBlock(self, blockname)
Translate CIF file block, skip blocks without _atom_site_label.
source code
 
_parse_lattice(self, block)
Obtain lattice parameters from a CifBlock.
source code
 
_parse_atom_site_label(self, block)
Obtain atoms in asymmetric unit from a CifBlock.
source code
 
_parse_atom_site_aniso_label(self, block)
Obtain value of anisotropic thermal displacements from a CifBlock.
source code
 
_parse_space_group_symop_operation_xyz(self, block)
Process symmetry operations from a CifBlock.
source code
 
_expandAsymmetricUnit(self)
Perform symmetry expansion of self.stru using self.spacegroup.
source code
 
toLines(self, stru)
Convert Structure stru to a list of lines in basic CIF format.
source code

Inherited from structureparser.StructureParser: tostring

Static Methods [hide private]
 
_tr_atom_site_label(a, value) source code
 
_tr_atom_site_type_symbol(a, value) source code
 
_tr_atom_site_fract_x(a, value) source code
 
_tr_atom_site_fract_y(a, value) source code
 
_tr_atom_site_fract_z(a, value) source code
 
_tr_atom_site_cartn_x(a, value) source code
 
_tr_atom_site_cartn_y(a, value) source code
 
_tr_atom_site_cartn_z(a, value) source code
 
_tr_atom_site_U_iso_or_equiv(a, value) source code
 
_tr_atom_site_B_iso_or_equiv(a, value) source code
 
_tr_atom_site_adp_type(a, value) source code
 
_tr_atom_site_thermal_displace_type(a, value) source code
 
_tr_atom_site_occupancy(a, value) source code
 
_tr_atom_site_aniso_U_11(a, value) source code
 
_tr_atom_site_aniso_U_22(a, value) source code
 
_tr_atom_site_aniso_U_33(a, value) source code
 
_tr_atom_site_aniso_U_12(a, value) source code
 
_tr_atom_site_aniso_U_13(a, value) source code
 
_tr_atom_site_aniso_U_23(a, value) source code
 
_tr_atom_site_aniso_B_11(a, value) source code
 
_tr_atom_site_aniso_B_22(a, value) source code
 
_tr_atom_site_aniso_B_33(a, value) source code
 
_tr_atom_site_aniso_B_12(a, value) source code
 
_tr_atom_site_aniso_B_13(a, value) source code
 
_tr_atom_site_aniso_B_23(a, value) source code
 
_get_atom_setters(cifloop)
Find translators of CifLoop items to data in Atom instance.
source code
Class Variables [hide private]
  _atom_setters = {'_tr_atom_site_B_iso_or_equiv': None, '_tr_at...
  BtoU = 0.0126651479553
  _psymb = re.compile(r'(\d+-)?([a-zA-Z]+)(\d[\+-])?')
Method Details [hide private]

_get_atom_setters(cifloop)
Static Method

source code 
Find translators of CifLoop items to data in Atom instance.
Static method.

cifloop -- instance of CifLoop

Return a tuple of (prop_fset, prop_ignored) where
prop_fset    -- dictionary of property with translating function
prop_ignored -- list of properties that cannot be translated

__init__(self)
(Constructor)

source code 
Overrides: structureparser.StructureParser.__init__

parse(self, s)

source code 
Create Structure instance from a string in CIF format.

Return Structure instance or raise StructureFormatError.

Overrides: structureparser.StructureParser.parse

parseLines(self, lines)

source code 
Parse list of lines in CIF format.

lines -- list of strings stripped of line terminator

Return Structure instance or raise StructureFormatError.

Overrides: structureparser.StructureParser.parseLines

parseFile(self, filename)

source code 
Create Structure from an existing CIF file.

filename  -- path to structure file

Return Structure object.
Raise StructureFormatError or IOError.

Overrides: structureparser.StructureParser.parseFile

_parseCifBlock(self, blockname)

source code 
Translate CIF file block, skip blocks without _atom_site_label.
Updates data members stru, eau.

blockname  -- name of top level block in self.ciffile

No return value.

_parse_lattice(self, block)

source code 
Obtain lattice parameters from a CifBlock.
This method updates self.stru.lattice.

block -- instance of CifBlock

No return value.

_parse_atom_site_label(self, block)

source code 
Obtain atoms in asymmetric unit from a CifBlock.
This method inserts Atom instances to self.stru and
updates labelindex dictionary.

block -- instance of CifBlock

No return value.

_parse_atom_site_aniso_label(self, block)

source code 
Obtain value of anisotropic thermal displacements from a CifBlock.
This method updates U members of Atom instances in self.stru.
The labelindex dictionary has to be defined beforehand.

block -- instance of CifBlock

No return value.

_parse_space_group_symop_operation_xyz(self, block)

source code 
Process symmetry operations from a CifBlock.  The method
updates spacegroup and eau data according to symmetry
operations defined in _space_group_symop_operation_xyz or
_symmetry_equiv_pos_as_xyz items in CifBlock.

block -- instance of CifBlock

No return value.

_expandAsymmetricUnit(self)

source code 
Perform symmetry expansion of self.stru using self.spacegroup.
This method updates data in stru and eau.

No return value.

toLines(self, stru)

source code 
Convert Structure stru to a list of lines in basic CIF format.

Return list of strings.

Overrides: structureparser.StructureParser.toLines

Class Variable Details [hide private]

_atom_setters

Value:
{'_tr_atom_site_B_iso_or_equiv': None,
 '_tr_atom_site_U_iso_or_equiv': None,
 '_tr_atom_site_adp_type': None,
 '_tr_atom_site_aniso_B_11': None,
 '_tr_atom_site_aniso_B_12': None,
 '_tr_atom_site_aniso_B_13': None,
 '_tr_atom_site_aniso_B_22': None,
 '_tr_atom_site_aniso_B_23': None,
...