pymatgen.io.abinit.pseudos module
This module provides objects describing the basic parameters of the pseudopotentials used in Abinit, and a parser to instantiate pseudopotential objects..
- class AbinitPseudo(path, header)[source]
Bases:
Pseudo
An AbinitPseudo is a pseudopotential whose file contains an abinit header.
- Parameters:
path – Filename.
header –
AbinitHeader
instance.
- class Hint(ecut, pawecutdg=None)[source]
Bases:
object
Suggested value for the cutoff energy [Hartree units] and the cutoff energy for the dense grid (only for PAW pseudos).
- class NcAbinitHeader(summary, **kwargs)[source]
Bases:
AbinitHeader
The abinit header found in the NC pseudopotential files.
- static fhi_header(filename, ppdesc)[source]
Parse the FHI abinit header. Example:
- Troullier-Martins psp for element Sc Thu Oct 27 17:33:22 EDT 1994
- 21.00000 3.00000 940714 zatom, zion, pspdat
1 1 2 0 2001 .00000 pspcod,pspxc,lmax,lloc,mmax,r2well
1.80626423934776 .22824404341771 1.17378968127746 rchrg,fchrg,qchrg
- static gth_header(filename, ppdesc)[source]
Parse the GTH abinit header. Example:
Goedecker-Teter-Hutter Wed May 8 14:27:44 EDT 1996 1 1 960508 zatom,zion,pspdat 2 1 0 0 2001 0. pspcod,pspxc,lmax,lloc,mmax,r2well 0.2000000 -4.0663326 0.6778322 0 0 rloc, c1, c2, c3, c4 0 0 0 rs, h1s, h2s 0 0 rp, h1p
1.36 .2 0.6 rcutoff, rloc
- static hgh_header(filename, ppdesc)[source]
Parse the HGH abinit header. Example:
- Hartwigsen-Goedecker-Hutter psp for Ne, from PRB58, 3641 (1998)
10 8 010605 zatom,zion,pspdat
3 1 1 0 2001 0 pspcod,pspxc,lmax,lloc,mmax,r2well
- static oncvpsp_header(filename, ppdesc)[source]
Parse the ONCVPSP abinit header. Example:
- Li ONCVPSP r_core= 2.01 3.02
3.0000 3.0000 140504 zatom,zion,pspd
8 2 1 4 600 0 pspcod,pspxc,lmax,lloc,mmax,r2well
- 5.99000000 0.00000000 0.00000000 rchrg fchrg qchrg
2 2 0 0 0 nproj 0 extension_switch
- 0 -2.5000025868368D+00 -1.2006906995331D+00
1 0.0000000000000D+00 0.0000000000000D+00 0.0000000000000D+00 2 1.0000000000000D-02 4.4140499497377D-02 1.9909081701712D-02
- static tm_header(filename, ppdesc)[source]
Parse the TM abinit header. Example:
Troullier-Martins psp for element Fm Thu Oct 27 17:28:39 EDT 1994 100.00000 14.00000 940714 zatom, zion, pspdat
1 1 3 0 2001 .00000 pspcod,pspxc,lmax,lloc,mmax,r2well 0 4.085 6.246 0 2.8786493 l,e99.0,e99.9,nproj,rcpsp .00000000 .0000000000 .0000000000 .00000000 rms,ekb1,ekb2,epsatm 1 3.116 4.632 1 3.4291849 l,e99.0,e99.9,nproj,rcpsp .00000000 .0000000000 .0000000000 .00000000 rms,ekb1,ekb2,epsatm 2 4.557 6.308 1 2.1865358 l,e99.0,e99.9,nproj,rcpsp .00000000 .0000000000 .0000000000 .00000000 rms,ekb1,ekb2,epsatm 3 23.251 29.387 1 2.4776730 l,e99.0,e99.9,nproj,rcpsp .00000000 .0000000000 .0000000000 .00000000 rms,ekb1,ekb2,epsatm 3.62474762267880 .07409391739104 3.07937699839200 rchrg,fchrg,qchrg
- class NcAbinitPseudo(path, header)[source]
Bases:
NcPseudo
,AbinitPseudo
Norm-conserving pseudopotential in the Abinit format.
- Parameters:
path – Filename.
header –
AbinitHeader
instance.
- class NcPseudo[source]
Bases:
object
Abstract class defining the methods that must be implemented by the concrete classes representing norm-conserving pseudopotentials.
- class PawAbinitHeader(summary, **kwargs)[source]
Bases:
AbinitHeader
The abinit header found in the PAW pseudopotential files.
- static paw_header(filename, ppdesc)[source]
Parse the PAW abinit header. Examples:
- Paw atomic data for element Ni - Generated by AtomPAW (N. Holzwarth) + AtomPAW2Abinit v3.0.5
28.000 18.000 20061204 : zatom,zion,pspdat 7 7 2 0 350 0. : pspcod,pspxc,lmax,lloc,mmax,r2well
- paw3 1305pspfmt,creatorID
5 13 : basis_size,lmn_size
0 0 1 1 2 : orbitals 3 : number_of_meshes 1 3 350 1.1803778368E-05 3.5000000000E-02 : mesh 1, type,size,rad_step[,log_step] 2 1 921 2.500000000000E-03 : mesh 2, type,size,rad_step[,log_step] 3 3 391 1.1803778368E-05 3.5000000000E-02 : mesh 3, type,size,rad_step[,log_step]
2.3000000000 : r_cut(SPH)
2 0.
Another format:
- C (US d-loc) - PAW data extracted from US-psp (D.Vanderbilt) - generated by USpp2Abinit v2.3.0
6.000 4.000 20090106 : zatom,zion,pspdat
7 11 1 0 560 0. : pspcod,pspxc,lmax,lloc,mmax,r2well
- paw4 2230pspfmt,creatorID
4 8 : basis_size,lmn_size
0 0 1 1 : orbitals 5 : number_of_meshes 1 2 560 1.5198032759E-04 1.6666666667E-02 : mesh 1, type,size,rad_step[,log_step] 2 2 556 1.5198032759E-04 1.6666666667E-02 : mesh 2, type,size,rad_step[,log_step] 3 2 576 1.5198032759E-04 1.6666666667E-02 : mesh 3, type,size,rad_step[,log_step] 4 2 666 1.5198032759E-04 1.6666666667E-02 : mesh 4, type,size,rad_step[,log_step] 5 2 673 1.5198032759E-04 1.6666666667E-02 : mesh 5, type,size,rad_step[,log_step]
1.5550009124 : r_cut(PAW)
3 0. : shape_type,rshape
Yet nnother one:
- Paw atomic data for element Si - Generated by atompaw v3.0.1.3 & AtomPAW2Abinit v3.3.1
14.000 4.000 20120814 : zatom,zion,pspdat 7 11 1 0 663 0. : pspcod,pspxc,lmax,lloc,mmax,r2well
- paw5 1331pspfmt,creatorID
4 8 : basis_size,lmn_size
0 0 1 1 : orbitals 5 : number_of_meshes 1 2 663 8.2129718540404674E-04 1.1498160595656655E-02 : mesh 1, type,size,rad_step[,log_step] 2 2 658 8.2129718540404674E-04 1.1498160595656655E-02 : mesh 2, type,size,rad_step[,log_step] 3 2 740 8.2129718540404674E-04 1.1498160595656655E-02 : mesh 3, type,size,rad_step[,log_step] 4 2 819 8.2129718540404674E-04 1.1498160595656655E-02 : mesh 4, type,size,rad_step[,log_step] 5 2 870 8.2129718540404674E-04 1.1498160595656655E-02 : mesh 5, type,size,rad_step[,log_step]
1.5669671236 : r_cut(PAW)
2 0. : shape_type,rshape
- class PawAbinitPseudo(path, header)[source]
Bases:
PawPseudo
,AbinitPseudo
Paw pseudopotential in the Abinit format.
- Parameters:
path – Filename.
header –
AbinitHeader
instance.
- class PawPseudo[source]
Bases:
object
Abstract class that defines the methods that must be implemented by the concrete classes representing PAW pseudopotentials.
- class PawXmlSetup(filepath)[source]
-
Setup class for PawXml.
- Parameters:
filepath –
- plot_densities(ax=None, **kwargs)[source]
Plot the PAW densities.
- Parameters:
ax – matplotlib
Axes
or None if a new figure should be created.- Returns:
matplotlib figure
Keyword arguments controlling the display of the figure:
kwargs
Meaning
title
Title of the plot (Default: None).
show
True to show the figure (default: True).
savefig
“abc.png” or “abc.eps” to save the figure to a file.
size_kwargs
Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)
tight_layout
True to call fig.tight_layout (default: False)
ax_grid
True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.
ax_annotate
Add labels to subplots e.g. (a), (b). Default: False
fig_close
Close figure. Default: False.
- plot_projectors(ax=None, fontsize=12, **kwargs)[source]
Plot the PAW projectors.
- Parameters:
ax – matplotlib
Axes
or None if a new figure should be created.
Returns: matplotlib figure
Keyword arguments controlling the display of the figure:
kwargs
Meaning
title
Title of the plot (Default: None).
show
True to show the figure (default: True).
savefig
“abc.png” or “abc.eps” to save the figure to a file.
size_kwargs
Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)
tight_layout
True to call fig.tight_layout (default: False)
ax_grid
True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.
ax_annotate
Add labels to subplots e.g. (a), (b). Default: False
fig_close
Close figure. Default: False.
- plot_waves(ax=None, fontsize=12, **kwargs)[source]
Plot the AE and the pseudo partial waves.
- Parameters:
ax – matplotlib
Axes
or None if a new figure should be created.fontsize – fontsize for legends and titles
Returns: matplotlib figure
Keyword arguments controlling the display of the figure:
kwargs
Meaning
title
Title of the plot (Default: None).
show
True to show the figure (default: True).
savefig
“abc.png” or “abc.eps” to save the figure to a file.
size_kwargs
Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)
tight_layout
True to call fig.tight_layout (default: False)
ax_grid
True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.
ax_annotate
Add labels to subplots e.g. (a), (b). Default: False
fig_close
Close figure. Default: False.
- class Pseudo[source]
Bases:
MSONable
Abstract base class defining the methods that must be implemented by the concrete pseudo-potential sub-classes.
- classmethod as_pseudo(obj)[source]
Convert obj into a pseudo. Accepts:
Pseudo object.
string defining a valid path.
- as_tmpfile(tmpdir=None)[source]
Copy the pseudopotential to a temporary a file and returns a new pseudopotential object. Useful for unit tests in which we have to change the content of the file.
- Parameters:
tmpdir – If None, a new temporary directory is created and files are copied here else tmpdir is used.
- static from_file(filename) Pseudo [source]
Build an instance of a concrete Pseudo subclass from filename. Note: the parser knows the concrete class that should be instantiated Client code should rely on the abstract interface provided by Pseudo.
- hint_for_accuracy(accuracy='normal')[source]
Returns a
Hint
object with the suggested value of ecut [Ha] and pawecutdg [Ha] for the given accuracy. ecut and pawecutdg are set to zero if no hint is available.- Parameters:
accuracy – [“low”, “normal”, “high”]
- open_pspsfile(ecut=20, pawecutdg=None)[source]
Calls Abinit to compute the internal tables for the application of the pseudopotential part. Returns
PspsFile
object providing methods to plot and analyze the data or None if file is not found or it’s not readable.- Parameters:
ecut – Cutoff energy in Hartree.
pawecutdg – Cutoff energy for the PAW double grid.
- class PseudoParser[source]
Bases:
object
Responsible for parsing pseudopotential files and returning pseudopotential objects.
Usage:
pseudo = PseudoParser().parse("filename")
- Error[source]
alias of
PseudoParserError
- parse(filename)[source]
Read and parse a pseudopotential file. Main entry point for client code.
- Returns:
pseudopotential object or None if filename is not a valid pseudopotential file.
- read_ppdesc(filename)[source]
Read the pseudopotential descriptor from file filename.
- Returns:
Pseudopotential descriptor. None if filename is not a valid pseudopotential file.
- Raises:
- scan_directory(dirname, exclude_exts=(), exclude_fnames=())[source]
Analyze the files contained in directory dirname.
- Parameters:
dirname – directory path
exclude_exts – list of file extensions that should be skipped.
exclude_fnames – list of file names that should be skipped.
- Returns:
List of pseudopotential objects.
- exception PseudoParserError[source]
Bases:
Exception
Base Error class for the exceptions raised by
PseudoParser
- class PseudoTable(pseudos)[source]
Bases:
Sequence
,MSONable
Define the pseudopotentials from the element table. Individidual elements are accessed by name, symbol or atomic number.
For example, the following all retrieve iron:
print elements[26] Fe print elements.Fe Fe print elements.symbol(‘Fe’) Fe print elements.name(‘iron’) Fe print elements.isotope(‘Fe’) Fe
- Parameters:
pseudos – List of pseudopotentials or filepaths
- all_combinations_for_elements(element_symbols)[source]
Return a list with all the possible combination of pseudos for the given list of element_symbols. Each item is a list of pseudopotential objects.
Example:
table.all_combinations_for_elements(["Li", "F"])
- classmethod as_table(items)[source]
Return an instance of
PseudoTable
from the iterable items.
- classmethod from_dir(top, exts=None, exclude_dirs='_*')[source]
Find all pseudos in the directory tree starting from top.
- Parameters:
top – Top of the directory tree
exts – List of files extensions. if exts == “all_files” we try to open all files in top
exclude_dirs – Wildcard used to exclude directories.
return:
PseudoTable
sorted by atomic number Z.
- get_pseudos_for_structure(structure: Structure)[source]
Return the list of
Pseudo
objects to be used for thisStructure
.- Parameters:
structure – pymatgen
Structure
.- Raises:
ValueError –
multiple occurrences are present in the table. –
- is_complete(zmax=118) bool [source]
True if table is complete i.e. all elements with Z < zmax have at least on pseudopotential
- print_table(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, filter_function=None)[source]
A pretty ASCII printer for the periodic table, based on some filter_function.
- Parameters:
stream – file-like object
filter_function – A filtering function that take a Pseudo as input and returns a boolean. For example, setting filter_function = lambda p: p.Z_val > 2 will print a periodic table containing only pseudos with Z_val > 2.
- pseudo_with_symbol(symbol, allow_multi=False)[source]
Return the pseudo with the given chemical symbol.
- Parameters:
symbols – String with the chemical symbol of the element
allow_multi – By default, the method raises ValueError if multiple occurrences are found. Use allow_multi to prevent this.
- Raises:
ValueError if symbol is not found or multiple occurrences are present and not allow_multi –
- pseudos_with_symbols(symbols)[source]
Return the pseudos with the given chemical symbols.
- Raises:
ValueError if one of the symbols is not found or multiple occurrences are present. –
- select(condition) PseudoTable [source]
Select only those pseudopotentials for which condition is True.
- Parameters:
condition – Function that accepts a
Pseudo
object and returns True or False.- Returns:
New PseudoTable instance with pseudos for which condition is True.
- Return type:
- select_family(family)[source]
Return PseudoTable with element belonging to the specified family, e.g. family=”alkaline”
- select_rows(rows)[source]
Return new class:PseudoTable object with pseudos in the given rows of the periodic table. rows can be either a int or a list of integers.
- select_symbols(symbols, ret_list=False)[source]
Return a
PseudoTable
with the pseudopotentials with the given list of chemical symbols.- Parameters:
symbols – str or list of symbols Prepend the symbol string with “-”, to exclude pseudos.
ret_list – if True a list of pseudos is returned instead of a
PseudoTable
- sort_by_z()[source]
Return a new
PseudoTable
with pseudos sorted by Z
- sorted(attrname, reverse=False)[source]
Sort the table according to the value of attribute attrname.
- Returns:
PseudoTable object
- Return type:
New class
- class RadialFunction(mesh, values)[source]
Bases:
RadialFunction
Radial Function class.
Create new instance of RadialFunction(mesh, values)