Logfile

The Logfile class is the base class you want to be using all the time. It is mainly meant to manipulate the output of a BigDFT calculation (written using the YAML format).

However, it might happen that the output actually contains many documents (for instance, one document per geometry optimization procedure). In such cases, the initialization of a Logfile actually gives another type of object, deriving from the MultipleLogfile class. Be careful: these objects behave as a list of Logfile instances, not as a Logfile instance (even though they are initialized via the Logfile class). To keep the same example as above, the output file of a geometry optimization calculation can be read via the Logfile.from_file() method of the Logfile class, returning a GeoptLogfile instance.

class mybigdft.iofiles.logfiles.Logfile(log=None)[source]

Bases: collections.abc.Mapping

Class allowing to initialize, read, write and interact with an output file of a BigDFT calculation.

Parameters

log (dict) – Output of the BigDFT code as a yaml dictionary.

classmethod from_file(filename)[source]

Initialize the Logfile from a file on disk.

Parameters

filename (str) – Name of the logfile.

Returns

Logfile initialized from a file on disk.

Return type

Logfile or GeoptLogfile or MultipleLogfile

>>> log = Logfile.from_file("tests/log.yaml")
>>> print(log.posinp)
2   angstroem
free
N   2.97630782434901e-23   6.87220595204354e-23   0.0107161998748779
N  -1.10434491945017e-23  -4.87342174483075e-23   1.10427379608154
<BLANKLINE>
>>> log.energy
-19.884659235401838
classmethod from_stream(stream)[source]

Initialize the Logfile from a stream.

Parameters

stream – Logfile as a stream.

Returns

Logfile initialized from a stream.

Return type

Logfile or GeoptLogfile or MultipleLogfile

property log
Returns

Yaml dictionary of the output of the BigDFT code.

Return type

Logfile

__dir__()[source]

The base attributes are not found when doing dir() on a Logfile instance, but their counterpart with a preceding underscore is. What is done here is a removal of the underscored names, replaced by the bare names (in order to avoid name repetition).

The bare attributes still behave as properties, while their value might be updated via the underscored attribute.

write(filename)[source]

Write the logfile on disk.

Parameters

filename (str) – Name of the logfile.

property posinp
Returns

Posinp used during the calculation.

Return type

Posinp

property inputparams
Returns

Input parameters used during the calculation.

Return type

InputParams

mybigdft.iofiles.logfiles.ATTRIBUTES Definition of the base attributes of a Logfile instance (and where to look for them in the logfile).

These attributes allow to get most of the relevant data contained in a Logfile. They provide simple shortcuts instead of having to know exactly where to look for them in the yaml output file, represented by the Logfile class. If some attributes do not appear in the BigDFT output, they default to None.

evals
Returns

Orbital energies and occupations.

forcemax_cv
Returns

Convergence criterion on forces.

kpts
Returns

Grid of k-points.

magnetization
Returns

Total magnetization of the system.

symmetry
Returns

Symmetry group.

energy
Returns

Energy (Hartree).

astruct
Returns

Atomic structure.

support_functions
Returns

Support functions.

electrostatic_multipoles
Returns

Electrostatic multipoles.

force_fluct
Returns

Threshold fluctuation of Forces.

n_at
Returns

Number of Atoms.

dipole
Returns

Electric Dipole Moment (AU).

cell
Returns

Cell size.

forces
Returns

Atomic Forces (Ha/Bohr).

WARNINGS
Returns

Warnings raised during the BigDFT run.

kpt_mesh
Returns

No. of Monkhorst-Pack grid points.

pressure
Returns

Pressure (GPa).

fermi_level
Returns

Fermi level.

atom_types
Returns

List of the atomic types present in the posinp.

walltime
Returns

Walltime since initialization.

boundary_conditions
Returns

Boundary Conditions.

forcemax
Returns

Maximum value of forces.

sdos
Returns

SDos files.

gnrm_cv
Returns

Convergence criterion on wavefunction residue.

class mybigdft.iofiles.logfiles.MultipleLogfile(logs)[source]

Bases: collections.abc.Sequence

Class allowing to initialize, read, write and interact with an output file of a BigDFT calculation containing multiple documents.

Parameters

logs (list) – List of the various documents contained in the logfile of a BigDFT calculation.

property logs
Returns

List of the documents read from a single output of a BigDFT calculation.

Return type

list

write(filename)[source]

Write the logfile on disk.

Parameters

filename (str) – Name of the logfile.

class mybigdft.iofiles.logfiles.GeoptLogfile(logs)[source]

Bases: mybigdft.iofiles.logfiles.MultipleLogfile

Class allowing to initialize, read, write and interact with an output file of a geometry optimization calculation.

Parameters

logs (list) – List of the various documents contained in the logfile of a geometry optimization calculation.

property inputparams
Returns

Input parameters used for each step of the geometry optimization procedure.

Return type

InputParams

property posinps
Returns

List of the input positions for each step of the geometry optimization procedure.

Return type

list