pymatgen.io.abinit.abiinspect module¶
This module provides objects to inspect the status of the Abinit tasks at run-time. by extracting information from the main output file (text format).
-
class
CyclesPlotter
[source]¶ Bases:
object
Relies on the plot method of cycle objects to build multiple subfigures.
Initialize object.
-
combiplot
(fontsize=8, **kwargs)[source]¶ Compare multiple cycels on a grid: one subplot per quantity, all cycles on the same subplot.
- Parameters
fontsize – Legend fontsize.
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
D2DEScfCycle
(fields)[source]¶ Bases:
pymatgen.io.abinit.abiinspect.ScfCycle
Result of the Phonon self-consistent cycle.
- Parameters
fields – Dictionary with label –> list of numerical values.
-
MAGIC
= 'iter 2DEtotal(Ha)'¶
-
property
last_etotal
¶ The 2-nd order derivative of the energy at the last iteration.
-
class
GroundStateScfCycle
(fields)[source]¶ Bases:
pymatgen.io.abinit.abiinspect.ScfCycle
Result of the Ground State self-consistent cycle.
- Parameters
fields – Dictionary with label –> list of numerical values.
-
MAGIC
= 'iter Etot(hartree)'¶
-
property
last_etotal
¶ The total energy at the last iteration.
-
class
PhononScfCycle
(fields)[source]¶ Bases:
pymatgen.io.abinit.abiinspect.D2DEScfCycle
Iterations of the DFPT SCF cycle for phonons.
- Parameters
fields – Dictionary with label –> list of numerical values.
-
class
Relaxation
(cycles)[source]¶ Bases:
collections.abc.Iterable
A list of
GroundStateScfCycle
objects.Note
Forces, stresses and crystal structures are missing. This object is mainly used to analyze the behavior of the Scf cycles during the structural relaxation. A more powerful and detailed analysis can be obtained by using the HIST.nc file.
- Args
cycles: list of GroundStateScfCycle objects.
-
classmethod
from_stream
(stream)[source]¶ Extract data from stream. Returns None if some error occurred.
-
history
()[source]¶ Ordered Dictionary of lists with the evolution of the data as function of the relaxation step.
-
plot
(ax_list=None, fontsize=12, **kwargs)[source]¶ Plot relaxation history i.e. the results of the last iteration of each SCF cycle.
- Parameters
ax_list – List of axes. If None a new figure is produced.
fontsize – legend fontsize.
kwargs – keyword arguments are passed to ax.plot
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
ScfCycle
(fields)[source]¶ Bases:
collections.abc.Mapping
It essentially consists of a dictionary mapping string to list of floats containing the data at the different iterations.
- Parameters
fields – Dictionary with label –> list of numerical values.
-
MAGIC
= 'Must be defined by the subclass.'¶
-
classmethod
from_stream
(stream)[source]¶ Read the first occurrence of ScfCycle from stream.
- Returns
None if no ScfCycle entry is found.
-
property
last_iteration
¶ Returns a dictionary with the values of the last iteration.
-
plot
(ax_list=None, fontsize=12, **kwargs)[source]¶ Uses matplotlib to plot the evolution of the SCF cycle.
- Parameters
ax_list – List of axes. If None a new figure is produced.
fontsize – legend fontsize.
kwargs – keyword arguments are passed to ax.plot
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
YamlDoc
(text, lineno, tag=None)[source]¶ Bases:
object
Handy object that stores that YAML document, its main tag and the position inside the file.
- Parameters
text – String with the YAML document.
lineno – The line number where the document is located.
tag – The YAML tag associate to the document.
-
lineno
¶
-
tag
¶
-
text
¶
-
property
text_notag
¶ Returns the YAML text without the tag. Useful if we don’t have any constructor registered for the tag (we used the tag just to locate the document).
-
class
YamlTokenizer
(filename)[source]¶ Bases:
collections.abc.Iterator
Provides context-manager support so you can use it in a with statement.
- Parameters
filename – Filename
-
Error
¶
-
all_yaml_docs
()[source]¶ Returns a list with all the YAML docs found in stream. Seek the stream before returning.
Warning
Assume that all the YAML docs (with the exception of the last one) are closed explicitely with the sentinel ‘…’
-
next
()[source]¶ Returns the first YAML document in stream.
Warning
Assume that the YAML document are closed explicitely with the sentinel ‘…’
-
next_doc_with_tag
(doc_tag)[source]¶ Returns the next document with the specified tag. Empty string is no doc is found.
-
seek
(offset[, whence]) → None. Move to new file position.[source]¶ Argument offset is a byte count. Optional argument whence defaults to 0 (offset from start of file, offset should be >= 0); other values are 1 (move relative to current position, positive or negative), and 2 (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). If the file is opened in text mode, only offsets returned by tell() are legal. Use of other offsets causes undefined behavior. Note that not all file objects are seekable.
-
exception
YamlTokenizerError
[source]¶ Bases:
Exception
Exceptions raised by
YamlTokenizer
.
-
plottable_from_outfile
(filepath)[source]¶ Factory function that returns a plottable object by inspecting the main output file of abinit Returns None if it is not able to detect the class to instantiate.