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.

  • 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.


filename – File name containing atomic coord data.


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.


filename (str) – path the feff input file


the atomic cluster as Molecule object. The absorbing atom

is the one at the origin.

Return type:


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).


lines sorted by the distance from the absorbing atom.

Return type:

list[list[str | int]]


Write Atoms list to file.


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,
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
  • 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

  • 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


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


header_str – pymatgen generated feff.inp header


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


filename – File name containing the Header data.


Reads header string.

property structure_symmetry[source]

Returns space number and space group


Space number and space group list


Writes Header into filename on disk.


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).

  • 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 paths.dat.

class Potential(struct, absorbing_atom)[source]

Bases: MSONable

FEFF atomic potential.

  • 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


pot_data: potential data in string format


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


filename – file name containing potential data.


FEFFPOT string.


Write to file.


filename – filename and path to write potential file to.

class Tags(params=None)[source]

Bases: dict

FEFF control parameters.


params – A set of input parameters as a dictionary.


Dict representation.


Dictionary of parameters from fefftags object


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.


other – The other PARAMETER dictionary to compare to.


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.


d – Dict of feff parameters and values.


Tags object

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

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


filename – Filename for either PARAMETER or feff.inp file


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.

  • 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.


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.

  • key – Feff parameter key

  • val – Actual value of Feff parameter.


Write Tags to a Feff parameter tag file.


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.

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

  • structure (Structure) –


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.

  • structure (Structure) –

  • absorbing_atom (str) – symbol