pymatgen.io.feff.inputs module

This module defines classes for reading/manipulating/writing the main sections of FEFF input file(feff.inp), namely HEADER, ATOMS, POTENTIAL and the program control tags.

XANES and EXAFS input files, are available, for non-spin case at this time.

class Atoms(struct, absorbing_atom, radius)[source]

Bases: MSONable

Atomic cluster centered around the absorbing atom.

Parameters:
  • struct (Structure) – input structure

  • absorbing_atom (str/int) – Symbol for absorbing atom or site index

  • radius (float) – radius of the atom cluster in Angstroms.

static atoms_string_from_file(filename)[source]

Reads atomic shells from file such as feff.inp or ATOMS file The lines are arranged as follows:

x y z ipot Atom Symbol Distance Number

with distance being the shell radius and ipot an integer identifying the potential used.

Parameters:

filename – File name containing atomic coord data.

Returns:

Atoms string.

property cluster[source]

Returns the atomic cluster as a Molecule object.

static cluster_from_file(filename)[source]

Parse the feff input file and return the atomic cluster as a Molecule object.

Parameters:

filename (str) – path the feff input file

Returns:

the atomic cluster as Molecule object. The absorbing atom

is the one at the origin.

Return type:

Molecule

get_lines() list[list[str | int]][source]

Returns a list of string representations of the atomic configuration information(x, y, z, ipot, atom_symbol, distance, id).

Returns:

lines sorted by the distance from the absorbing atom.

Return type:

list[list[str | int]]

write_file(filename='ATOMS')[source]

Write Atoms list to file.

Parameters:

filename – path for file to be written

exception FeffParserError[source]

Bases: Exception

Exception class for Structure. Raised when the structure has problems, e.g., atoms that are too close.

class Header(struct: Structure | Molecule, source: str = '', comment: str = '', spacegroup_analyzer_settings=None)[source]

Bases: MSONable

Creates Header for the FEFF input file.

Has the following format:

* This feff.inp file generated by pymatgen, materialsproject.org
TITLE comment:
TITLE Source: CoO19128.cif
TITLE Structure Summary: (Co2 O2)
TITLE Reduced formula: CoO
TITLE space group: P1,   space number: 1
TITLE abc: 3.297078 3.297078 5.254213
TITLE angles: 90.0 90.0 120.0
TITLE sites: 4
* 1 Co     0.666666     0.333332     0.496324
* 2 Co     0.333333     0.666667     0.996324
* 3 O     0.666666     0.333332     0.878676
* 4 O     0.333333     0.666667     0.378675
Parameters:
  • struct – Structure or Molecule object. If a Structure, SpaceGroupAnalyzer is used to determine symmetrically-equivalent sites. If a Molecule, there is no symmetry checking.

  • source – User supplied identifier, i.e. for Materials Project this would be the material ID number

  • comment – Comment for first header line

  • spacegroup_analyzer_settings – keyword arguments passed to SpacegroupAnalyzer (only used for Structure inputs)

property formula[source]

Formula of structure

static from_cif_file(cif_file, source='', comment='')[source]

Static method to create Header object from cif_file

Parameters:
  • cif_file – cif_file path and name

  • source – User supplied identifier, i.e. for Materials Project this would be the material ID number

  • comment – User comment that goes in header

Returns:

Header Object

static from_file(filename)[source]

Returns Header object from file

static from_string(header_str)[source]

Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen, if not it is impossible

to generate structure object so it is not possible to generate header object and routine ends

Parameters:

header_str – pymatgen generated feff.inp header

Returns:

Structure object.

static header_string_from_file(filename='feff.inp')[source]

Reads Header string from either a HEADER file or feff.inp file Will also read a header from a non-pymatgen generated feff.inp file

Parameters:

filename – File name containing the Header data.

Returns:

Reads header string.

property structure_symmetry[source]

Returns space number and space group

Returns:

Space number and space group list

write_file(filename='HEADER')[source]

Writes Header into filename on disk.

Parameters:

filename – Filename and path for file to be written to disk

class Paths(atoms, paths, degeneracies=None)[source]

Bases: MSONable

Set FEFF scattering paths(‘paths.dat’ file used by the ‘genfmt’ module).

Parameters:
  • atoms (Atoms) – Atoms object

  • paths (list(list)) – list of paths. Each path is a list of atom indices in the atomic cluster(the molecular cluster created by Atoms class). e.g. [[0, 1, 2], [5, 9, 4, 1]] -> 2 paths: one with 3 legs and the other with 4 legs.

  • degeneracies (list) – list of degeneracies, one for each path. Set to 1 if not specified.

write_file(filename='paths.dat')[source]

Write paths.dat.

class Potential(struct, absorbing_atom)[source]

Bases: MSONable

FEFF atomic potential.

Parameters:
  • struct (Structure) – Structure object.

  • absorbing_atom (str/int) – Absorbing atom symbol or site index

static pot_dict_from_string(pot_data)[source]

Creates atomic symbol/potential number dictionary forward and reverse

Arg:

pot_data: potential data in string format

Returns:

forward and reverse atom symbol and potential number dictionaries.

static pot_string_from_file(filename='feff.inp')[source]

Reads Potential parameters from a feff.inp or FEFFPOT file. The lines are arranged as follows:

ipot Z element lmax1 lmax2 stoichometry spinph

Parameters:

filename – file name containing potential data.

Returns:

FEFFPOT string.

write_file(filename='POTENTIALS')[source]

Write to file.

Parameters:

filename – filename and path to write potential file to.

class Tags(params=None)[source]

Bases: dict

FEFF control parameters.

Parameters:

params – A set of input parameters as a dictionary.

as_dict()[source]

Dict representation.

Returns:

Dictionary of parameters from fefftags object

diff(other)[source]

Diff function. Compares two PARAMETER files and indicates which parameters are the same and which are not. Useful for checking whether two runs were done using the same parameters.

Parameters:

other – The other PARAMETER dictionary to compare to.

Returns:

parameters_that_are_the_same, “Different”: parameters_that_are_different} Note that the parameters are return as full dictionaries of values.

Return type:

Dict of the format {“Same”

static from_dict(d)[source]

Creates Tags object from a dictionary.

Parameters:

d – Dict of feff parameters and values.

Returns:

Tags object

static from_file(filename='feff.inp')[source]

Creates a Feff_tag dictionary from a PARAMETER or feff.inp file.

Parameters:

filename – Filename for either PARAMETER or feff.inp file

Returns:

Feff_tag object

get_string(sort_keys=False, pretty=False)[source]

Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing.

Parameters:
  • sort_keys – Set to True to sort the Feff parameters alphabetically. Defaults to False.

  • pretty – Set to True for pretty aligned output. Defaults to False.

Returns:

String representation of Tags.

static proc_val(key, val)[source]

Static helper method to convert Feff parameters to proper types, e.g. integers, floats, lists, etc.

Parameters:
  • key – Feff parameter key

  • val – Actual value of Feff parameter.

write_file(filename='PARAMETERS')[source]

Write Tags to a Feff parameter tag file.

Parameters:

filename – filename and path to write to.

get_absorbing_atom_symbol_index(absorbing_atom, structure)[source]

Return the absorbing atom symbol and site index in the given structure.

Parameters:
  • absorbing_atom (str/int) – symbol or site index

  • structure (Structure) –

Returns:

symbol and site index

Return type:

str, int

get_atom_map(structure, absorbing_atom=None)[source]

Returns a dict that maps each atomic symbol to a unique integer starting from 1.

Parameters:
  • structure (Structure) –

  • absorbing_atom (str) – symbol

Returns:

dict