HTMACat package

Subpackages

Submodules

HTMACat.Base_tools module

HTMACat.Base_tools.get_new_dict(list, dict)[source]
HTMACat.Base_tools.isequal(a, b)[source]
HTMACat.Base_tools.isinclude(a, b)[source]

HTMACat.Extract_info module

HTMACat.Extract_info.Construct_descriptor_info(raw_file, atoms, feature)[source]

Construct descriptor information from raw data file.

Parameters:
raw_filestr

Path to the raw data file.

atomslist

a list of atoms.

featurelist

a list of features.

Returns:
feature_valuelist

a list of feature values for each atom.

HTMACat.Extract_info.Extract_adsE(slab_E, radical_E, tot_E)[source]

Calculates the adsorption energy.

Parameters:
slab_Efloat

The crystal surface energy.

radical_Efloat

The radical energy.

tot_Efloat

The total energy.

Returns:
float

The calculated adsorption energy.

HTMACat.Extract_info.Extract_atomic_info(atoms)[source]

Extracts information related to the provided atoms.

Parameters:
atomslist of int

List of integers representing the atomic numbers of the atoms.

Returns:
tuple[list,list,list,list]

A tuple containing the following information:

  • names_atomslist of str

    List of strings representing the names of the atoms.

  • radii_atomslist of float

    List of floats representing the covalent radii of the atoms.

  • mass_atomslist of float

    List of floats representing the atomic masses of the atoms.

  • vdw_radii_atomslist of float

    List of floats representing the van der Waals radii of the atoms.

HTMACat.Extract_info.Extract_energy(Efile, struc)[source]

Batch extraction of calculated energy for specific species structure.

Parameters:
Efilestr

Energy information file

struclist of str

Specific species that want to extract energy

Returns:
tuple

A tuple containing two lists:

  • Enerlist of float

    The list of extracted energies.

  • orderlist of str

    The sequential list of the extracted energies.

HTMACat.Extract_info.Extract_energy_single(Efile, struc)[source]

Extract energy of radical & slab.

Parameters:
Efilestr

Energy information file.

strucstr

Structure that want to extract energy.

Returns:
tuple

A tuple containing the energy and the structure:

  • Enerfloat

    The extracted energy.

  • strucstr

    The extracted structure.

HTMACat.Extract_info.Extract_reaction(Efile)[source]

Extract the adsorbate and gas species from a given reaction file.

Parameters:
Efilestr

Path of the reaction file.The reaction formula can be NH3(a)+O(a)=N(a)+NO(a)

Returns:
tuple

A tuple of two lists containing adsorbate and gas species, respectively.

HTMACat.Extract_info.Extract_slab_info_1(Flist, facet)[source]

Extracts structural information and energy of specific slab.

Parameters:
Fliststr

File path to the list of slab energies.

facetlist

List of strings representing the surface facets to extract information for.

Returns:
tuple[list,list,list,list,list]
  • E_slablist

    a List of energies for the given facets.

  • surflist

    a List of lists of atomic symbols for the surface atoms of the given facets.

  • E_stablelist

    a List of the most stable energy value among the given facets.

  • surf_stablelist

    a List of atomic symbols for the surface atoms of the most stable facet.

  • layer_infolist

    a List containing the number of layers and the number of atoms in each layer of the most stable facet.

Notes

This function extracts the energy and structural information of a specific slab given a list of energies and the surface facets to extract information for. The energy and surface information are extracted for all slabs that match the given facet. If there is only one matching slab, the energy and surface information are returned directly. If there are multiple matching slabs, the function determines the most stable facet by finding the slab with the lowest energy, and returns the energy and surface information for that slab.

HTMACat.Extract_info.Extract_slab_info_2(Flist, layer=4)[source]

TO Extract the struct info and energy of slabs.

Parameters:
Flist: str

Crystal surface energy information file

layer: int

Number of crystal layers, default value is 4

Returns:
None
HTMACat.Extract_info.cal_Eads(Flist, FErad, FEslab, radicals, Erad_property='radical', Facet_property='all')[source]

Calculate the adsorption energy based on atom energy.

Parameters:
Fliststr

The filename of the file that contains the list of adsorption energy configurations.

FEradstr

The filename of the file that contains the atom energies of the radicals.

FEslabstr

The filename of the file that contains the energies of the slabs.

radicalslist

The list of radicals to consider.

Erad_propertystr, optional

The property of the radical energy calculation. Default is ‘radical’.

Facet_propertystr, optional

The property of the facet energy calculation. Default is ‘all’.

Returns:
None
HTMACat.Extract_info.cal_Erad(FErad, Radical)[source]

Calculates the energy of a given radical.

Parameters:
FEradstr

The name of the file containing the radical energies.

Radicalstr

The name of the radical to calculate the energy for.

Returns:
float

The energy of the given radical.

Notes

The file containing the radical energies should be a comma-separated file,Just like this:Pt_100_CO2_0,-226.43504734

HTMACat.Extract_info.cal_Erad_atom(FErad, Radical)[source]

Calculates the energy of each atom in a given radical.

Parameters:
FEradstr

The name of the file containing the atom energies.

Radicalstr

The name of the radical to calculate the atom energies for.

Returns:
float

The total energy of all atoms in the given radical.

HTMACat.Extract_info.cal_Eslab(FEslab, facet)[source]

Calculate the energy of a given slab facet.

Parameters:
FEslabstr

File path to the file containing the slab energies.

facetlist

a List containing the Miller indices of the facet.

Returns:
float

Energy of the given slab facet.

Examples

>>> cal_Eslab('path/to/file.csv', [1, 0, 0])
-123.45
HTMACat.Extract_info.cal_adE_coad(Flist, FErad, FEslab, Erad_property='radical')[source]

Calculate the adsorption energy of CO on a surface with multiple radicals.

Parameters:
Flist: str

File path of a text file that contains the adsorption energy information of the system in each line. Each line should be in the following format: facet_radical1_radical2, adsorption_energy, where facet_radical1_radical2 is the identifier of the system, and adsorption_energy is the corresponding adsorption energy.

FErad: str

File path of a text file that contains the energy of each radical. Each line should be in the following format: radical, energy, where radical is the identifier of the radical, and energy is the corresponding energy.

FEslab: str

File path of a text file that contains the energy of each slab..

Erad_property: str, optional

The property used to calculate the radical energy. It can be either ‘atom’ or ‘radical’. Default is ‘radical’.

Returns:
None
The function writes the calculated adsorption energy for each system to a file named ‘adsE_coad_<Erad_property>’.
HTMACat.Extract_info.distinguish_atom_binding(poscar, tol_layer=0.01, tol=0.05, base_layer=4, atoms_layer=9)[source]

Distinguishes different types of atoms in a surface structure and classifies them as adatoms, surface atoms, and subsurface atoms based on their Z coordinates.

Parameters:
poscarstr

The input structure in POSCAR format

tol_layerfloat, optional

Tolerance for distinguishing the Z coordinate of atoms belonging to different layers. Default is 0.01.

tolfloat, optional

Tolerance for distinguishing the Z coordinate of adatoms and surface atoms. Default is 0.05.

base_layerint, optional

The layer number where the surface atoms are located. Default is 4.

atoms_layerint, optional

The minimum number of surface atoms required for the structure to be analyzed. Default is 9.

Returns:
tuple
-adatomslist

A list of the indices of adatoms in the structure.

-adatoms_symblist

A list of the chemical symbols of adatoms in the structure.

-surfatomslist

A list of the indices of surface atoms in the structure.

-surfatoms_symblist

A list of the chemical symbols of surface atoms in the structure.

-subsurfatomslist

A list of the indices of subsurface atoms in the structure.

-subsurfatoms_symblist

A list of the chemical symbols of subsurface atoms in the structure

Raises:
ValueError

If tol is too large and not able to distinguish the layers, or if the structure cannot be analyzed.

HTMACat.Extract_info.get_adsorption_energy_stable(Efile, specie, dop_typ)[source]

Get the energy of most stable configurationi for single radical.

Parameters:
Efilestr

The name of the file storing energy information.

speciestr

The name of the adsorbed species.

dop_typstr

The type of doping.

Returns:
tuple[list,list]

A tuple containing the name of the most stable radical and its energy.

HTMACat.Extract_info.get_atom_neigh(poscar, atom)[source]

Get the neighboring atoms of specific adsorbed atoms.

Parameters:
poscarstr or pymatgen.Structure

The VASP file or pymatgen.Structure object containing the lattice structure information.

atomstr

The chemical symbol of the specific adsorbed atom.

Returns:
tuple[list,list]

A tuple of two lists:

  • The indices of the nearest neighbor atoms of the specified atom in the lattice structure.

  • The chemical element symbols of the nearest neighbor atoms.

HTMACat.Extract_info.get_binding_adatom(poscar)[source]

Determine the adsorbed atoms and the surface atoms to which they bind.

Parameters:
poscarstr

The VASP file path or pymatgen.Structure object.

Returns:
tuple[list,list,list,list,list,list]

A tuple containing the following elements:

  • bind_adatoms :list

    The list of indices of adsorbed atoms that are bound to surface atoms.

  • bind_adatoms_symb :list

    The list of chemical symbols of adsorbed atoms that are bound to surface atoms.

  • adspecie :list

    The list of chemical representations of adsorbates.

  • bind_type_symb :list

    The list of adsorption types.

  • bind_surfatoms :list

    The list of indices of surface atoms that are bound to adsorbed atoms.

  • bind_surfatoms_symb :list

    The list of chemical symbols of surface atoms that are bound to adsorbed atoms.

Notes

This function extracts adsorbed and surface atoms from the structure, calculates the neighbor list, and determines which adsorbed atoms are bound to which surface atoms. It then extracts the adsorbate species, the adsorption type, and the surface atoms that are bound to each adsorbed atom.

HTMACat.Extract_info.get_distance_adatoms(poscar, tol=0.1)[source]

Calculate the distance between adsorbed atoms in a VASP file.

Parameters:
poscarstr

The VASP file or structure object.

tolfloat, optional

A parameter that determines whether atoms are bonded. The default value is 0.1.

Returns:
tuple[list,list]

A tuple containing two lists:

  • dis_symb_matrixlist of str

    A list of strings indicating the atomic symbols of the adsorbed atoms and their corresponding distance.

  • dis_matrixlist of float

    A list of distances between adsorbed atoms.

Raises:
ValueError

If there is only one atom in the VASP file.

HTMACat.Extract_info.get_file_name(reaction)[source]

Given a chemical reaction as a string in the form of ‘reactants = products’, constructs the file name for the corresponding reaction file.

Parameters:
reactionstr

A chemical reaction in the form of ‘reactants = products’.

Returns:
str

The file name for the corresponding reaction file.

Examples

>>> get_file_name('H2(g) + Cl2(g) = 2HCl(g)')
'H2+Cl2=2HCl'
HTMACat.Extract_info.get_min_distance_group(struct, group1, group2)[source]

Compute the minimum distance between two sets of atoms in a crystal structure.

Parameters:
structase.Atoms

The crystal structure.

group1list of int

Indices of the atoms in the first group.

group2list of int

Indices of the atoms in the second group.

Returns:
numpy.ndarray

A 2D array containing the distances between each pair of atoms in group1 and group2.

HTMACat.Extract_info.get_potcar(poscar, path='/data/jqyang/src/mypps/potpaw_PBE/')[source]

Get the POTCAR file for VASP calculation.

Parameters:
poscarstr

The file path of POSCAR.

pathstr, optional

The path of the pseudopotential files, by default ‘/data/jqyang/src/mypps/potpaw_PBE/’.

Returns:
None

The function writes the combined POTCAR file.

Raises:
ValueError

If the elements in the structure files are different.

HTMACat.Extract_info.get_site(poscar, mole)[source]

Determine the type of adsorption site.

Parameters:
poscarstr

The name of the POSCAR file.

molelist

A list consisting of the chemical formula of the adsorbed molecule and the atoms adsorbed on the point.

Returns:
tuple

A tuple of two lists: binding site types and the chemical symbols for other atoms bound to the binding site.

HTMACat.Extract_info.get_site_stable(Efile, Ecut=-0.1)[source]

Extracts the stable adsorption type for single molecule or radical adsorption based on adsorption energy.

Parameters:
Efilestr

Path to the file containing adsorption energies.

Ecutfloat, optional

The maximum energy cut-off for stable adsorption (default is -0.1).

Returns:
tuple[dict,dict,list,dict]
  • spec_ads: a dictionary with species as keys and a list of possible adsorption types as values.

  • spec_ads_stable: a dictionary with species as keys and the stable adsorption type as values.

  • dir_list_final: a list of directories containing the stable adsorption configurations.

  • spec_ads_stable_surfa: a dictionary with species as keys and the symbol of the surface atom bound to the adsorbate in the stable adsorption configuration as values.

HTMACat.Extract_info.get_site_stable_energy(Efile, Ecut=0.0)[source]

Extract the stable adsorption type for single molecule or radical adsorption based on the calculated energy.

Parameters:
Efilestr

The path to the file containing the adsorption energy information.

Ecutfloat, optional

The cutoff energy for considering stable adsorption types. Default is 0.0.

Returns:
tuple[dict,dict,list]

The first dictionary contains all the possible adsorption types for each species. The second dictionary contains the stable adsorption type for each species. The third list contains the corresponding directories for each species’ stable adsorption type.

HTMACat.Extract_info.get_symmetry_surfatoms(poscar, tol=0.3)[source]

Determine whether surface atoms are reconstructed.

Parameters:
poscarstr or Structure

Vasp format structure file

tolfloat, optional

Tolerance for determining whether surface atoms are reconstructed. The default is 0.3.

Returns:
str

A sign of whether surface atoms are reconstructed. “When surface atoms are reconstructed, ‘NO’ is returned, otherwise ‘YES’ is returned.”.

HTMACat.IO module

Created on Sun Mar 19 11:47:30 2023.

@author: YuxiaoLan

HTMACat.IO.dict2object(substrate_dict, species_dict, ads_dict)[source]
HTMACat.IO.generate_unique_filename(filename)[source]
HTMACat.IO.get_ads_dict(result)[source]
HTMACat.IO.get_species_dict(result)[source]
HTMACat.IO.get_substrate_dict(result)[source]
HTMACat.IO.get_templator()[source]
HTMACat.IO.out_templator_file()[source]
HTMACat.IO.print_templator()[source]
HTMACat.IO.read(filename)[source]
HTMACat.IO.write(struct_class: Structure)[source]
HTMACat.IO.yaml2dict(filename)[source]

HTMACat.command module

HTMACat.command.ads(in_dir: str = <typer.models.OptionInfo object>, out_dir: str = <typer.models.OptionInfo object>)[source]

Construct adsorption configuration.

HTMACat.command.complete(in_dir: str = <typer.models.OptionInfo object>)[source]

Complete config

HTMACat.command.crn()[source]

Generate the Chemical Reaction Network.

HTMACat.command.crngen()[source]

Generate structured directories and input files based on CRNGenerator_log.txt

HTMACat.command.main()[source]
HTMACat.command.main_command()[source]
HTMACat.command.templator()[source]

Print out input templator.

HTMACat.configuration module

Module contents