pymatgen.io.feff package
This package provides the modules to perform FEFF IO.
FEFF: http://feffproject.org/feffproject-feff.html
Submodules
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.
- 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:
- exception FeffParseError[source]
Bases:
ParseError
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
Create 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).
- classmethod from_cif_file(cif_file: str, source: str = '', comment: str = '') Self [source]
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
- classmethod from_str(header_str: str) Self [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: str = '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.
- 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.
- 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_str(pot_data)[source]
Creates atomic symbol/potential number dictionary forward and reverse.
- Parameters:
pot_data – potential data in string format
- Returns:
forward and reverse atom symbol and potential number dictionaries.
- class Tags(params=None)[source]
Bases:
dict
FEFF control parameters.
- Parameters:
params – A set of input parameters as a dictionary.
- 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:
- has format {“Same”parameters_that_are_the_same,
”Different”: parameters_that_are_different} Note that the parameters are return as full dictionaries of values.
- Return type:
dict[str, dict]
- classmethod from_dict(dct: dict) Self [source]
Creates Tags object from a dictionary.
- Parameters:
dct (dict) – Dict of feff parameters and values.
- Returns:
Tags object
- classmethod from_file(filename: str = 'feff.inp') Self [source]
Creates a Tags dictionary from a PARAMETER or feff.inp file.
- Parameters:
filename – Filename for either PARAMETER or feff.inp file
- Returns:
Tags
- get_str(sort_keys: bool = False, pretty: bool = False) str [source]
Get 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 the Tags.
- Return type:
str
pymatgen.io.feff.outputs module
This module defines classes for parsing the FEFF output files.
Currently supports the xmu.dat, ldos.dat output files are for non-spin case.
- class Eels(data)[source]
Bases:
MSONable
Parse eels.dat file.
- Parameters:
data (numpy.ndarray) – data from eels.dat file
- class LDos(complete_dos, charge_transfer)[source]
Bases:
MSONable
Parser for ldos files ldos01, ldos02, …
- Parameters:
complete_dos (CompleteDos) – complete dos object
charge_transfer (dict) – computed charge transfer between atoms dictionary.
- static charge_transfer_from_file(feff_inp_file, ldos_file)[source]
Get charge transfer from file.
- Parameters:
feff_inp_file (str) – name of feff.inp file for run
ldos_file (str) – ldos filename for run, assume consecutive order, i.e., ldos01.dat, ldos02.dat….
- Returns:
dictionary of dictionaries in order of potential sites ({“p”: 0.154, “s”: 0.078, “d”: 0.0, “tot”: 0.232}, …)
- classmethod from_file(feff_inp_file: str = 'feff.inp', ldos_file: str = 'ldos') Self [source]
Creates LDos object from raw Feff ldos files by by assuming they are numbered consecutively, i.e. ldos01.dat ldos02.dat…
- Parameters:
feff_inp_file (str) – input file of run to obtain structure
ldos_file (str) – output ldos file of run to obtain dos info, etc.
- class Xmu(header, parameters, absorbing_atom, data)[source]
Bases:
MSONable
Parser for data in ‘xmu.dat’ file. The file ‘xmu.dat’ contains XANES, EXAFS or NRIXS data depending on the situation; mu, mu_0, and chi = chi * mu_0 / mu_0 / (edge+50eV) as functions of absolute energy E, relative energy E - E_f and wave number k.
- Default attributes:
xmu: Photon absorption cross section of absorbing atom in material Energies: Energies of data point relative_energies: E - E_fermi wavenumber: k=sqrt(E -E_fermi) mu: The total absorption cross-section. mu0: The embedded atomic background absorption. chi: fine structure. Edge: Absorption Edge Absorbing atom: Species of absorbing atom Material: Formula of material Source: Source of structure Calculation: Type of Feff calculation performed
- Parameters:
header – Header object
parameters – Tags object
absorbing_atom (str | int) – absorbing atom symbol or index
data (numpy.ndarray, Nx6) – cross_sections.
pymatgen.io.feff.sets module
This module defines the FeffInputSet abstract base class and a concrete implementation for the Materials Project. The basic concept behind an input set is to specify a scheme to generate a consistent set of Feff inputs from a structure without further user intervention. This ensures comparability across runs.
- class AbstractFeffInputSet[source]
Bases:
MSONable
,ABC
Abstract base class representing a set of Feff input parameters. The idea is that using a FeffInputSet, a complete set of input files (feffPOT, feffXANES, feffEXAFS, ATOMS, feff.inp)set_ can be generated in an automated fashion for any structure.
- class FEFFDictSet(absorbing_atom: str | int, structure: Structure | Molecule, radius: float, config_dict: dict, edge: str = 'K', spectrum: str = 'EXAFS', nkpts=1000, user_tag_settings: dict | None = None, spacegroup_analyzer_settings: dict | None = None)[source]
Bases:
AbstractFeffInputSet
Standard implementation of FeffInputSet, which can be extended by specific implementations.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure – Structure or Molecule object. If a Structure, SpaceGroupAnalyzer is used to determine symmetrically-equivalent sites. If a Molecule, there is no symmetry checking.
radius (float) – cluster radius
config_dict (dict) – control tag settings dict
edge (str) – absorption edge
spectrum (str) – type of spectrum to calculate, available options : EXAFS, XANES, DANES, XMCD, ELNES, EXELFS, FPRIME, NRIXS, XES. The default is EXAFS.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) –
override default tag settings. To delete tags, set the key ‘_del’ in the user_tag_settings. eg: user_tag_settings={“_del”: [“COREHOLE”, “EXCHANGE”]} To specify a net charge on the structure, pass an “IONS” tag containing a list
of tuples where the first element is the unique potential value (ipot value) and the second element is the charge to be applied to atoms associated with that potential, e.g. {“IONS”: [(0, 0.1), (1, 0.1), (2, 0.1)]} will result in.
ION 0 0.1 ION 1 0.1 ION 2 0.1
being written to the input file.
spacegroup_analyzer_settings (dict) – parameters passed to SpacegroupAnalyzer. e.g. {“symprec”: 0.01, “angle_tolerance”: 4}
- classmethod from_directory(input_dir: str) Self [source]
Read in a set of FEFF input files from a directory, which is useful when existing FEFF input needs some adjustment.
- header(source: str = '', comment: str = '')[source]
Creates header string from structure object.
- Parameters:
source – Source identifier used to create structure, can be defined however user wants to organize structures, calculations, etc. example would be Materials Project material ID number.
comment – comment to include in header
- Returns:
Header
- class MPEELSDictSet(absorbing_atom, structure, edge, spectrum, radius, beam_energy, beam_direction, collection_angle, convergence_angle, config_dict, user_eels_settings=None, nkpts: int = 1000, user_tag_settings: dict | None = None, **kwargs)[source]
Bases:
FEFFDictSet
FeffDictSet for ELNES spectroscopy.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure (Structure) – input structure
edge (str) – absorption edge
spectrum (str) – ELNES or EXELFS
radius (float) – cluster radius in Angstroms.
beam_energy (float) – Incident beam energy in keV
beam_direction (list) – Incident beam direction. If None, the cross section will be averaged.
collection_angle (float) – Detector collection angle in mrad.
convergence_angle (float) – Beam convergence angle in mrad.
user_eels_settings (dict) – override default EELS config. See MPELNESSet.yaml for supported keys.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) – override default tag settings
**kwargs – Passthrough to FEFFDictSet.
- class MPELNESSet(absorbing_atom, structure, edge: str = 'K', radius: float = 10.0, beam_energy: float = 100, beam_direction=None, collection_angle: float = 1, convergence_angle: float = 1, user_eels_settings=None, nkpts: int = 1000, user_tag_settings: dict | None = None, **kwargs)[source]
Bases:
MPEELSDictSet
FeffDictSet for ELNES spectroscopy.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure (Structure) – input structure
edge (str) – absorption edge
radius (float) – cluster radius in Angstroms.
beam_energy (float) – Incident beam energy in keV
beam_direction (list) – Incident beam direction. If None, the cross section will be averaged.
collection_angle (float) – Detector collection angle in mrad.
convergence_angle (float) – Beam convergence angle in mrad.
user_eels_settings (dict) – override default EELS config. See MPELNESSet.yaml for supported keys.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) – override default tag settings
**kwargs – Passthrough to FEFFDictSet.
- CONFIG = {'CONTROL': '1 1 1 1 1 1', 'COREHOLE': 'FSR', 'EDGE': 'K', 'ELNES': {'ANGLES': '1 1', 'BEAM_DIRECTION': '0 1 0', 'BEAM_ENERGY': '100 0 1 1', 'ENERGY': '4 0.04 0.1', 'MESH': '50 1', 'POSITION': '0.0 0.0'}, 'EXCHANGE': '0 0.0 0.0 2', 'FMS': '7.5 0', 'LDOS': '-20.0 20.0 0.1', 'PRINT': '1 0 0 0 0 0', 'S02': 0.0, 'SCF': '6.0 0 30 0.2 1'}[source]
- class MPEXAFSSet(absorbing_atom, structure, edge: str = 'K', radius: float = 10.0, nkpts: int = 1000, user_tag_settings: dict | None = None, **kwargs)[source]
Bases:
FEFFDictSet
FeffDictSet for EXAFS spectroscopy.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure (Structure) – input structure
edge (str) – absorption edge
radius (float) – cluster radius in Angstroms.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) – override default tag settings
**kwargs – Passthrough to FEFFDictSet.
- class MPEXELFSSet(absorbing_atom, structure, edge='K', radius: float = 10.0, beam_energy: float = 100, beam_direction=None, collection_angle: float = 1, convergence_angle: float = 1, user_eels_settings=None, nkpts: int = 1000, user_tag_settings: dict | None = None, **kwargs)[source]
Bases:
MPEELSDictSet
FeffDictSet for EXELFS spectroscopy.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure (Structure) – input structure
edge (str) – absorption edge
radius (float) – cluster radius in Angstroms.
beam_energy (float) – Incident beam energy in keV
beam_direction (list) – Incident beam direction. If None, the cross section will be averaged.
collection_angle (float) – Detector collection angle in mrad.
convergence_angle (float) – Beam convergence angle in mrad.
user_eels_settings (dict) – override default EELS config. See MPEXELFSSet.yaml for supported keys.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) – override default tag settings
**kwargs – Passthrough to FEFFDictSet.
- CONFIG = {'CONTROL': '1 1 1 1 1 1', 'COREHOLE': 'FSR', 'EDGE': 'K', 'EXCHANGE': '0 0.0 0.0 2', 'EXELFS': {'ANGLES': '1 1', 'BEAM_DIRECTION': '0 1 0', 'BEAM_ENERGY': '100 0 1 1', 'ENERGY': 20, 'MESH': '50 1', 'POSITION': '0.0 0.0'}, 'PRINT': '1 0 0 0 0 0', 'RPATH': 10, 'S02': 0.0, 'SCF': '5.0 0 30 0.2 1'}[source]
- class MPXANESSet(absorbing_atom, structure, edge: str = 'K', radius: float = 10.0, nkpts: int = 1000, user_tag_settings: dict | None = None, **kwargs)[source]
Bases:
FEFFDictSet
FeffDictSet for XANES spectroscopy.
- Parameters:
absorbing_atom (str | int) – absorbing atom symbol or site index
structure (Structure) – input
edge (str) – absorption edge
radius (float) – cluster radius in Angstroms.
nkpts (int) – Total number of kpoints in the brillouin zone. Used only when feff is run in the reciprocal space mode.
user_tag_settings (dict) – override default tag settings
**kwargs – Passthrough to FEFFDictSet.