From 5d17288e5717abdc41aabebcd631888fd02eda73 Mon Sep 17 00:00:00 2001 From: Matteo Giantomassi Date: Sun, 15 Dec 2024 15:18:10 +0100 Subject: [PATCH] Code cleanup --- abipy/eph/common.py | 10 +- abipy/eph/gpath.py | 46 ++--- abipy/eph/gstore.py | 14 +- abipy/eph/gwan.py | 2 +- abipy/eph/varpeq.py | 38 ++-- abipy/ppcodes/oncv_parser.py | 29 ++- abipy/ppcodes/oncv_plotter.py | 4 +- abipy/wannier90/abiwan.py | 2 +- docs/Makefile | 7 +- docs/conf.py | 11 +- docs/links.rst | 4 +- docs/sg_execution_times.rst | 333 ++++++++++++++++++++++++---------- tasks.py | 157 ++++------------ 13 files changed, 353 insertions(+), 304 deletions(-) diff --git a/abipy/eph/common.py b/abipy/eph/common.py index bbd08ebb6..313692fc0 100644 --- a/abipy/eph/common.py +++ b/abipy/eph/common.py @@ -22,27 +22,27 @@ class BaseEphReader(ElectronsReader): """ @lazy_property - def ddb_ngqpt(self): + def ddb_ngqpt(self) -> np.ndarray: """Q-Mesh for DDB file.""" return self.read_value("ddb_ngqpt") @lazy_property - def ngqpt(self): + def ngqpt(self) -> np.ndarray: """Effective Q-mesh used in to compute integrals (ph_linewidts, e-ph self-energy).""" return self.read_value("ngqpt") @lazy_property - def ph_ngqpt(self): + def ph_ngqpt(self) -> np.ndarray: """Q-mesh for Phonon DOS, interpolated A2F ...""" return self.read_value("ph_ngqpt") @lazy_property - def eph_ngqpt_fine(self): + def eph_ngqpt_fine(self) -> np.ndarray: """Q-mesh for interpolated DFPT potentials""" return self.read_value("eph_ngqpt_fine") @lazy_property - def common_eph_params(self): + def common_eph_params(self) -> dict: """ Read basic parameters (scalars) from the netcdf files produced by the EPH code and cache them """ diff --git a/abipy/eph/gpath.py b/abipy/eph/gpath.py index 8a220aff9..dc04a6edd 100644 --- a/abipy/eph/gpath.py +++ b/abipy/eph/gpath.py @@ -4,9 +4,9 @@ """ from __future__ import annotations -import dataclasses +#import dataclasses import numpy as np -import pandas as pd +#import pandas as pd import abipy.core.abinit_units as abu from monty.string import marquee @@ -27,7 +27,7 @@ from abipy.eph.common import BaseEphReader -def k2s(k_vector, fmt=".3f", threshold = 1e-8) -> str: +def k2s(k_vector, fmt=".3f", threshold=1e-8) -> str: k_vector = np.asarray(k_vector) k_vector[np.abs(k_vector) < threshold] = 0 @@ -99,7 +99,7 @@ def params(self) -> dict: def __str__(self) -> str: return self.to_string() - def to_string(self, verbose: int=0) -> str: + def to_string(self, verbose: int = 0) -> str: """String representation with verbosiy level ``verbose``.""" lines = []; app = lines.append @@ -126,7 +126,7 @@ def _get_which_g_list(which_g: str) -> list[str]: return all_choices if which_g not in all_choices: - raise ValueError(f"Invalid {which=}, should be in {all_choices=}") + raise ValueError(f"Invalid {which_g=}, should be in {all_choices=}") return [which_g] @@ -134,7 +134,7 @@ def _get_band_range(self, band_range): return (self.r.bstart, self.r.bstop) if band_range is None else band_range @add_fig_kwargs - def plot_g_qpath(self, band_range=None, which_g="avg", with_qexp: int=0, scale=1, gmax_mev=250, + def plot_g_qpath(self, band_range=None, which_g="avg", with_qexp: int = 0, scale=1, gmax_mev=250, ph_modes=None, with_phbands=True, with_ebands=False, ax_mat=None, fontsize=8, **kwargs) -> Figure: """ @@ -481,16 +481,16 @@ def get_gnuq_average_spin(self, spin: int, band_range: list|tuple|None, eps_mev: # Average over degenerate k+q electrons taking bstart into account. absg = absg_avg.copy() for iq in range(self.nq_path): - for n_k in range(nb_in_g): - for m_kq in range(nb_in_g): - w_1 = all_eigens_kq[spin, iq, m_kq + bstart] - g2_nu[:], nn = 0.0, 0 - for bsum_kq in range(nb_in_g): - w_2 = all_eigens_kq[spin, iq, bsum_kq + bstart] - if abs(w_2 - w_1) >= eps_ev: continue - nn += 1 - g2_nu += absg[iq,:,bsum_kq,n_k] ** 2 - absg_avg[iq,:,m_kq,n_k] = np.sqrt(g2_nu / nn) + for n_k in range(nb_in_g): + for m_kq in range(nb_in_g): + w_1 = all_eigens_kq[spin, iq, m_kq + bstart] + g2_nu[:], nn = 0.0, 0 + for bsum_kq in range(nb_in_g): + w_2 = all_eigens_kq[spin, iq, bsum_kq + bstart] + if abs(w_2 - w_1) >= eps_ev: continue + nn += 1 + g2_nu += absg[iq,:,bsum_kq,n_k] ** 2 + absg_avg[iq,:,m_kq,n_k] = np.sqrt(g2_nu / nn) # Transpose the data: (nq_path, natom3, nb_in_g, nb_in_g) -> (natom3, nq_path, nb_in_g, nb_in_g) absg_avg, absg_raw = absg_avg.transpose(1, 0, 2, 3).copy(), absg_raw.transpose(1, 0, 2, 3).copy() @@ -553,11 +553,11 @@ def get_gnuk_average_spin(self, spin: int, band_range: list|tuple|None, eps_mev: absg_avg = np.zeros_like(absg) for ik in range(self.nk_path): for nu in range(natom3): - # Sum the squared values of absg over the degenerate phonon mu indices. - mask_nu = np.abs(phfreqs_ha[iq, :] - phfreqs_ha[iq, nu]) < eps_ha - g2_mn = np.sum(absg[ik, mask_nu, :, :]**2, axis=0) - # Compute the symmetrized value and divide by the number of degenerate ph-modes for this iq. - absg_avg[ik, nu, :, :] = np.sqrt(g2_mn / np.sum(mask_nu)) + # Sum the squared values of absg over the degenerate phonon mu indices. + mask_nu = np.abs(phfreqs_ha[iq, :] - phfreqs_ha[iq, nu]) < eps_ha + g2_mn = np.sum(absg[ik, mask_nu, :, :]**2, axis=0) + # Compute the symmetrized value and divide by the number of degenerate ph-modes for this iq. + absg_avg[ik, nu, :, :] = np.sqrt(g2_mn / np.sum(mask_nu)) # MG FIXME: Note the difference with a similar function in gkq here I use absg and not absgk # Average over degenerate k electrons taking bstart into account. @@ -645,7 +645,7 @@ def plot_g_qpath(self, which_g="avg", gmax_mev=250, ph_modes=None, # TODO: Compute common band range. band_range = None - ref_ifile= 0 + ref_ifile = 0 #q_label = r"$|q|^{%d}$" % with_qexp if with_qexp else "" #g_units = "(meV)" if with_qexp == 0 else r"(meV $\AA^-{%s}$)" % with_qexp @@ -703,4 +703,4 @@ def write_notebook(self, nbpath=None) -> str: #nb.cells.extend(self.get_baserobot_code_cells()) #nb.cells.extend(self.get_ebands_code_cells()) - return self._write_nb_nbpath(nb, nbpath) + return self._write_nb_nbpath(nb, nbpath) \ No newline at end of file diff --git a/abipy/eph/gstore.py b/abipy/eph/gstore.py index f44f9aceb..a88f76a57 100644 --- a/abipy/eph/gstore.py +++ b/abipy/eph/gstore.py @@ -476,7 +476,7 @@ def find_iq_glob_qpoint(self, qpoint, spin: int): #print(f"Found {qpoint = } with index {iq_g = }") return iq_g, qpoint - raise ValueError(f"Cannot find {qpoint = } in GSTORE.nc") + raise ValueError(f"Cannot find {qpoint=} in GSTORE.nc") def find_ik_glob_kpoint(self, kpoint, spin: int): """Find the internal indices of the kpoint needed to access the gvals array.""" @@ -486,7 +486,7 @@ def find_ik_glob_kpoint(self, kpoint, spin: int): #print(f"Found {kpoint = } with index {ik_g = }") return ik_g, kpoint - raise ValueError(f"Cannot find {kpoint = } in GSTORE.nc") + raise ValueError(f"Cannot find {kpoint=} in GSTORE.nc") # TODO: This fix to read groups should be imported in pymatgen. @lazy_property @@ -539,7 +539,7 @@ def neq(self, ref_basename: str | None = None, verbose: int = 0) -> int: return ierr @staticmethod - def _neq_two_gstores(gstore1: GstoreFile, gstore2: GstoreFile, verbose: int) -> int: + def _neq_two_gstores(self: GstoreFile, gstore2: GstoreFile, verbose: int) -> int: """ Helper function to compare two GSTORE files. """ @@ -550,12 +550,12 @@ def _neq_two_gstores(gstore1: GstoreFile, gstore2: GstoreFile, verbose: int) -> ] for aname in aname_list: - self._compare_attr_name(aname, gstore1, gstore2) + self._compare_attr_name(aname, self, gstore2) # Now compare the gkq objects for each spin. ierr = 0 - for spin in range(gstore1.nsppol): - gqk1, gqk2 = gstore1.gqk_spin[spin], gstore2.gqk_spin[spin] + for spin in range(self.nsppol): + gqk1, gqk2 = self.gqk_spin[spin], gstore2.gqk_spin[spin] ierr += gqk1.neq(gqk2, verbose) return ierr @@ -585,4 +585,4 @@ def write_notebook(self, nbpath=None) -> str: #nb.cells.extend(self.get_baserobot_code_cells()) #nb.cells.extend(self.get_ebands_code_cells()) - return self._write_nb_nbpath(nb, nbpath) + return self._write_nb_nbpath(nb, nbpath) \ No newline at end of file diff --git a/abipy/eph/gwan.py b/abipy/eph/gwan.py index 0135c7080..f66ab1624 100644 --- a/abipy/eph/gwan.py +++ b/abipy/eph/gwan.py @@ -339,7 +339,7 @@ def neq(self, other: Gqk, verbose: int) -> int: return ierr -class GstoreReader(BaseEphReader): +class GwanReader(BaseEphReader): """ Reads data from file and constructs objects. diff --git a/abipy/eph/varpeq.py b/abipy/eph/varpeq.py index 3ef50990b..372c43d81 100644 --- a/abipy/eph/varpeq.py +++ b/abipy/eph/varpeq.py @@ -11,13 +11,12 @@ import pandas as pd import abipy.core.abinit_units as abu -from collections import defaultdict from monty.string import marquee from monty.functools import lazy_property -from monty.termcolor import cprint +#from monty.termcolor import cprint from abipy.core.func1d import Function1D from abipy.core.structure import Structure -from abipy.core.kpoints import kpoints_indices, kmesh_from_mpdivs, map_grid2ibz, IrredZone +from abipy.core.kpoints import kpoints_indices, kmesh_from_mpdivs, map_grid2ibz #, IrredZone from abipy.core.mixins import AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter from abipy.tools.typing import PathLike from abipy.tools.plotting import (add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt, set_axlims, set_visible, @@ -107,7 +106,6 @@ class Entry: # Convert to dictionary: name --> Entry _ALL_ENTRIES = {e.name: e for e in _ALL_ENTRIES} - class VarpeqFile(AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter): """ This file stores the results of a VARPEQ calculations: SCF cycle, A_nk, B_qnu coefficients @@ -174,7 +172,7 @@ def params(self) -> dict: def __str__(self) -> str: return self.to_string() - def to_string(self, verbose: int=0) -> str: + def to_string(self, verbose: int = 0) -> str: """String representation with verbosiy level ``verbose``.""" lines = []; app = lines.append @@ -197,7 +195,7 @@ def to_string(self, verbose: int=0) -> str: for spin in range(self.nsppol): polaron = self.polaron_spin[spin] df = polaron.get_final_results_df() - app(f"Last SCF iteration. Energies in eV units") + app("Last SCF iteration. Energies in eV units") app(str(df)) app("") @@ -322,7 +320,7 @@ def ufact_k(k): return df_list - def get_final_results_df(self, with_params: bool=False) -> pd.DataFrame: + def get_final_results_df(self, with_params: bool = False) -> pd.DataFrame: """ Return daframe with the last iteration for all polaronic states. NB: Energies are in eV. @@ -342,7 +340,7 @@ def get_final_results_df(self, with_params: bool=False) -> pd.DataFrame: def __str__(self) -> str: return self.to_string() - def to_string(self, verbose: int=0) -> str: + def to_string(self, verbose: int = 0) -> str: """ String representation with verbosiy level verbose. """ @@ -380,7 +378,7 @@ def ngkpt_and_shifts(self) -> tuple: return ngkpt, shifts - def get_title(self, with_gaps: bool=True) -> str: + def get_title(self, with_gaps: bool = True) -> str: """ Return string with title for matplotlib plots. """ @@ -462,7 +460,7 @@ def get_b2_interpolator_state(self, interp_method) -> BzRegularGridInterpolator: return [BzRegularGridInterpolator(self.structure, shifts, np.abs(b_data[pstate])**2, method=interp_method) for pstate in range(self.nstates)] - def write_a2_bxsf(self, filepath: PathLike, fill_value: float=0.0) -> None: + def write_a2_bxsf(self, filepath: PathLike, fill_value: float = 0.0) -> None: r""" Export \sum_n |A_{pnk}|^2 in BXSF format suitable for visualization with xcrysden (use ``xcrysden --bxsf FILE``). Requires gamma-centered k-mesh. @@ -480,7 +478,7 @@ def write_a2_bxsf(self, filepath: PathLike, fill_value: float=0.0) -> None: bxsf_write(filepath, self.structure, 1, self.nstates, ngkpt, a2_data, fermie, unit="Ha") - def write_b2_bxsf(self, filepath: PathLike, fill_value: float=0.0) -> None: + def write_b2_bxsf(self, filepath: PathLike, fill_value: float = 0.0) -> None: r""" Export \sum_{\nu} |B_{q\nu}|^2 in BXSF format suitable for visualization with xcrysden (use ``xcrysden --bxsf FILE``). @@ -554,9 +552,9 @@ def plot_scf_cycle(self, ax_mat=None, fontsize=8, **kwargs) -> Figure: @add_fig_kwargs def plot_ank_with_ebands(self, ebands_kpath, - ebands_kmesh=None, lpratio: int=5, - with_ibz_a2dos=True, method="gaussian", step: float=0.05, width: float=0.1, - nksmall: int=20, normalize: bool=False, with_title=True, interp_method="linear", + ebands_kmesh=None, lpratio: int = 5, + with_ibz_a2dos=True, method="gaussian", step: float = 0.05, width: float = 0.1, + nksmall: int = 20, normalize: bool = False, with_title=True, interp_method="linear", ax_mat=None, ylims=None, scale=10, marker_color="gold", fontsize=12, **kwargs) -> Figure: """ Plot electron bands with markers whose size is proportional to |A_nk|^2. @@ -721,7 +719,7 @@ def plot_bqnu_with_ddb(self, ddb, with_phdos=True, anaddb_kwargs=None, **kwargs) @add_fig_kwargs def plot_bqnu_with_phbands(self, phbands_qpath, - phdos_file=None, ddb=None, width=0.001, normalize: bool=True, + phdos_file=None, ddb=None, width=0.001, normalize: bool = True, verbose=0, anaddb_kwargs=None, with_title=True, interp_method="linear", ax_mat=None, scale=10, marker_color="gold", fontsize=12, **kwargs) -> Figure: """ @@ -773,7 +771,8 @@ def plot_bqnu_with_phbands(self, phbands_qpath, if not with_phdos: # Return immediately. - if with_title: fig.suptitle(self.get_title(with_gaps=True)) + if with_title: + fig.suptitle(self.get_title(with_gaps=True)) return fig #################### @@ -803,7 +802,6 @@ def plot_bqnu_with_phbands(self, phbands_qpath, #with_ibz_b2dos = False for pstate in range(self.nstates): - # Compute B2(E) by looping over the full BZ. bqnu_dos = np.zeros(len(phdos_mesh)) for iq_bz, qpoint in enumerate(phbands_qmesh.qpoints): @@ -815,7 +813,7 @@ def plot_bqnu_with_phbands(self, phbands_qpath, for w, b2 in zip(freqs_nu, b2_interp_state[pstate].eval_kpoint(qpoint), strict=True): bqnu_dos += q_weight * b2 * gaussian(phdos_mesh, width, center=w) - bqnu_dos = Function1D(wmesh, bqnu_dos) + bqnu_dos = Function1D(phdos_mesh, bqnu_dos) ax = ax_mat[pstate, 1] phdos.plot_ax(ax, exchange_xy=True, normalize=normalize, label="phDOS(E)", color="black") @@ -946,7 +944,7 @@ def to_string(self, verbose=0) -> str: return "\n".join(lines) - def get_final_results_df(self, spin=None, sortby=None, with_params: bool=True) -> pd.DataFrame: + def get_final_results_df(self, spin=None, sortby=None, with_params: bool = True) -> pd.DataFrame: """ Return dataframe with the last iteration for all polaronic states. NB: Energies are in eV. @@ -1046,4 +1044,4 @@ def write_notebook(self, nbpath=None) -> str: #nbv.new_code_cell("ebands_plotter = robot.get_ebands_plotter()"), ]) - return self._write_nb_nbpath(nb, nbpath) + return self._write_nb_nbpath(nb, nbpath) \ No newline at end of file diff --git a/abipy/ppcodes/oncv_parser.py b/abipy/ppcodes/oncv_parser.py index 99a3fe394..074472f02 100644 --- a/abipy/ppcodes/oncv_parser.py +++ b/abipy/ppcodes/oncv_parser.py @@ -10,13 +10,13 @@ import numpy as np import pandas as pd -from collections import namedtuple, defaultdict -from typing import Union, Any +from collections import namedtuple # , defaultdict +from typing import Union from dataclasses import dataclass from monty.functools import lazy_property from monty.collections import AttrDict, dict2namedtuple from monty.termcolor import colored -from abipy.core.atom import NlkState, RadialFunction, RadialWaveFunction, l2char +from abipy.core.atom import NlkState, RadialFunction, RadialWaveFunction #, l2char from abipy.ppcodes.base_parser import BaseParser @@ -42,7 +42,6 @@ class AtomicLevel: is_valence: bool - class OncvParser(BaseParser): """ Object to read and extract data from the output file of oncvpsp. @@ -91,11 +90,11 @@ def scan(self, verbose: int = 0) -> OncvParser: return self @property - def is_metapsp(self): + def is_metapsp(self) -> bool: return self.generator_type == "METAPSP" @property - def is_oncvpsp(self): + def is_oncvpsp(self) -> bool: return self.generator_type == "ONCVPSP" def _scan(self, verbose: int = 0) -> OncvParser: @@ -178,12 +177,12 @@ def _scan(self, verbose: int = 0) -> OncvParser: if line.startswith("# atsym"): values = self.lines[i + 1].split() if len(values) != 6: - # Rf104.00 10 8 4 both - l = values.pop(0) - atmsym, z = l[0:2], l[2:] - values.insert(0, z) - values.insert(0, atmsym) - #print(values) + # Rf104.00 10 8 4 both + l = values.pop(0) + atmsym, z = l[0:2], l[2:] + values.insert(0, z) + values.insert(0, atmsym) + #print(values) keys = header[1:].split() # assert len(keys) == len(values) @@ -310,7 +309,7 @@ def lmax(self) -> int: else: raise self.Error(f"Cannot find line with `#lmax` in: {self.filepath}") - def to_string(self, verbose: int = 0 ) -> str: + def to_string(self, verbose: int = 0) -> str: """ String representation. """ @@ -529,7 +528,7 @@ def kin_densities(self) -> dict[str, RadialFunction]: Dictionary with Kinetic energy densities on the radial mesh. """ if not self.is_metapsp: - raise ValueEror("kin_densities are only available in pseudos generated with metapsp") + raise ValueError("kin_densities are only available in pseudos generated with metapsp") # Metagga taups and taumodps #!t 0.0200249 2.9590E+02 6.4665E+02 @@ -546,7 +545,7 @@ def vtaus(self) -> dict[str, RadialFunction]: Dictionary with Vtau ptotentials on the radial mesh. """ if not self.is_metapsp: - raise ValueEror("kin_densities are only available in pseudos generated with metapsp") + raise ValueError("kin_densities are only available in pseudos generated with metapsp") # plot " Figure: + ebands_kmesh=None, method="gaussian", step: float = 0.05, width: float = 0.1, **kwargs) -> Figure: """ Receive an ab-initio electronic strucuture, interpolate the energies on the same list of k-points and compare the two band structures. diff --git a/docs/Makefile b/docs/Makefile index 31dcc56b0..c0c71e80c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -53,7 +53,10 @@ clean: -rm -rf gallery/* -rm -rf flow_gallery/* -html: +check_dot: + @command -v dot > /dev/null || { echo "Error: 'dot' binary is not installed or not in PATH."; exit 1; } + +html: check_dot @echo "Generating RST files..." ./generate_rst_files.py || { echo "Error: Failed to generate RST files"; exit 1; } @echo "Cleaning old flow examples..." @@ -63,7 +66,7 @@ html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html || { echo "Error: Sphinx build failed"; exit 1; } @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - #open $(BUILDDIR)/html/index.html || { echo "Error: Failed to open index.html"; exit 1; } + open $(BUILDDIR)/html/index.html || { echo "Error: Failed to open index.html"; exit 1; } dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml diff --git a/docs/conf.py b/docs/conf.py index cf485111a..0a219415d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -143,9 +143,12 @@ def load_mod(filepath): sphinx_gallery_conf = { 'only_warn_on_example_error': True, - #'abort_on_example_error': True, - #'log_level': {'backreference_missing': 'warning'}, - 'log_level': {'backreference_missing': 'error'}, + 'abort_on_example_error': False, + #'log_level': {'backreference_missing': 'debug'}, + 'log_level': {'backreference_missing': 'warning'}, + #'log_level': {'backreference_missing': 'error'}, + # Sphinx-Gallery can parse all your examples and build the gallery without executing any of the scripts + #'plot_gallery': 'False', # # path to your examples scripts 'examples_dirs': [ @@ -272,7 +275,7 @@ def load_mod(filepath): import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +#html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24). # Path should be relative to the ``_static`` files directory. diff --git a/docs/links.rst b/docs/links.rst index 99d5ae27e..d0af61091 100644 --- a/docs/links.rst +++ b/docs/links.rst @@ -168,9 +168,9 @@ :alt: Coverage status :target: https://coveralls.io/github/abinit/abipy?branch=develop -.. |download-with-anaconda| image:: https://anaconda.org/abinit/abipy/badges/installer/conda.svg +.. |download-with-anaconda| image:: https://anaconda.org/conda-forge/abipy/badges/downloads.svg + :target: https://anaconda.org/conda-forge/abipy :alt: Download with Anaconda - :target: https://anaconda.org/conda-forge/abinit .. |abipy-license| image:: https://img.shields.io/badge/license-GPL-blue.svg :alt: AbiPy license diff --git a/docs/sg_execution_times.rst b/docs/sg_execution_times.rst index 3a9e41ae2..cd0324b08 100644 --- a/docs/sg_execution_times.rst +++ b/docs/sg_execution_times.rst @@ -6,7 +6,7 @@ Computation times ================= -**00:55.409** total execution time for 66 files **from all galleries**: +**01:42.400** total execution time for 111 files **from all galleries**: .. container:: @@ -33,200 +33,335 @@ Computation times - Time - Mem (MB) * - :ref:`sphx_glr_gallery_plot_qha_vs_qmesh.py` (``../abipy/examples/plot/plot_qha_vs_qmesh.py``) - - 00:10.444 + - 00:10.141 - 0.0 * - :ref:`sphx_glr_gallery_plot_ddb_asr.py` (``../abipy/examples/plot/plot_ddb_asr.py``) - - 00:04.728 + - 00:04.746 - 0.0 * - :ref:`sphx_glr_gallery_plot_phonons_msqd.py` (``../abipy/examples/plot/plot_phonons_msqd.py``) - - 00:04.034 + - 00:04.397 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_mgb2_phonons_nkpt_tsmear.py` (``../abipy/examples/flows/run_mgb2_phonons_nkpt_tsmear.py``) + - 00:03.645 - 0.0 * - :ref:`sphx_glr_gallery_plot_qha_v-ZSISA.py` (``../abipy/examples/plot/plot_qha_v-ZSISA.py``) - - 00:03.341 + - 00:03.199 - 0.0 * - :ref:`sphx_glr_gallery_plot_lumi_1D_nv_center.py` (``../abipy/examples/plot/plot_lumi_1D_nv_center.py``) - - 00:02.918 + - 00:02.973 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_qha_2d.py` (``../abipy/examples/plot/plot_qha_2d.py``) + - 00:02.953 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_gkq.py` (``../abipy/examples/flows/run_gkq.py``) + - 00:02.728 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_eph_mob.py` (``../abipy/examples/flows/run_eph_mob.py``) + - 00:02.535 - 0.0 * - :ref:`sphx_glr_gallery_plot_phbands_nkpt_tsmear.py` (``../abipy/examples/plot/plot_phbands_nkpt_tsmear.py``) - - 00:02.459 + - 00:02.465 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_ebands_boxplot.py` (``../abipy/examples/plot/plot_ebands_boxplot.py``) + - 00:02.309 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_eph_pot.py` (``../abipy/examples/flows/run_eph_pot.py``) + - 00:02.250 - 0.0 * - :ref:`sphx_glr_gallery_plot_efatbands_spin.py` (``../abipy/examples/plot/plot_efatbands_spin.py``) - - 00:02.046 + - 00:02.099 - 0.0 - * - :ref:`sphx_glr_gallery_plot_qha_2d.py` (``../abipy/examples/plot/plot_qha_2d.py``) - - 00:02.017 + * - :ref:`sphx_glr_flow_gallery_run_phonons_wkq.py` (``../abipy/examples/flows/run_phonons_wkq.py``) + - 00:01.977 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_becs_and_epsilon_vs_kpts.py` (``../abipy/examples/flows/run_becs_and_epsilon_vs_kpts.py``) + - 00:01.903 - 0.0 * - :ref:`sphx_glr_gallery_plot_mdf.py` (``../abipy/examples/plot/plot_mdf.py``) - - 00:01.759 + - 00:01.747 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_phonons.py` (``../abipy/examples/flows/run_phonons.py``) + - 00:01.545 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_si_ebands.py` (``../abipy/examples/flows/run_si_ebands.py``) + - 00:01.541 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_eph_al.py` (``../abipy/examples/flows/run_eph_al.py``) + - 00:01.510 - 0.0 * - :ref:`sphx_glr_gallery_plot_a2f.py` (``../abipy/examples/plot/plot_a2f.py``) - - 00:01.369 + - 00:01.409 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_lumi_Eu_doped_SLA.py` (``../abipy/examples/flows/run_lumi_Eu_doped_SLA.py``) + - 00:01.360 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_ebands.py` (``../abipy/examples/plot/plot_ebands.py``) + - 00:01.347 - 0.0 * - :ref:`sphx_glr_gallery_plot_efatbands.py` (``../abipy/examples/plot/plot_efatbands.py``) - - 00:01.156 + - 00:01.229 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_conducwork.py` (``../abipy/examples/flows/run_conducwork.py``) + - 00:01.147 - 0.0 * - :ref:`sphx_glr_gallery_plot_phbands_grid.py` (``../abipy/examples/plot/plot_phbands_grid.py``) - - 00:01.110 + - 00:01.107 - 0.0 - * - :ref:`sphx_glr_gallery_plot_ebands_spin.py` (``../abipy/examples/plot/plot_ebands_spin.py``) - - 00:00.825 + * - :ref:`sphx_glr_flow_gallery_run_phonons_with_quad.py` (``../abipy/examples/flows/run_phonons_with_quad.py``) + - 00:01.053 - 0.0 - * - :ref:`sphx_glr_gallery_plot_qpbands_with_interpolation.py` (``../abipy/examples/plot/plot_qpbands_with_interpolation.py``) - - 00:00.817 + * - :ref:`sphx_glr_flow_gallery_run_flexoelectric.py` (``../abipy/examples/flows/run_flexoelectric.py``) + - 00:00.964 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_ebands_edos.py` (``../abipy/examples/plot/plot_ebands_edos.py``) + - 00:00.937 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_raman_optic.py` (``../abipy/examples/flows/run_raman_optic.py``) + - 00:00.864 - 0.0 * - :ref:`sphx_glr_gallery_plot_speed_of_sound.py` (``../abipy/examples/plot/plot_speed_of_sound.py``) - - 00:00.755 + - 00:00.852 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_qpbands_with_interpolation.py` (``../abipy/examples/plot/plot_qpbands_with_interpolation.py``) + - 00:00.818 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_optic.py` (``../abipy/examples/flows/run_optic.py``) + - 00:00.810 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_ebands_spin.py` (``../abipy/examples/plot/plot_ebands_spin.py``) + - 00:00.793 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_elastic.py` (``../abipy/examples/flows/run_elastic.py``) + - 00:00.786 - 0.0 * - :ref:`sphx_glr_gallery_plot_ebands_grid.py` (``../abipy/examples/plot/plot_ebands_grid.py``) - - 00:00.731 + - 00:00.777 - 0.0 - * - :ref:`sphx_glr_gallery_plot_lumi_1D_Eu_doped.py` (``../abipy/examples/plot/plot_lumi_1D_Eu_doped.py``) - - 00:00.702 + * - :ref:`sphx_glr_flow_gallery_run_gwconv_ecuteps.py` (``../abipy/examples/flows/run_gwconv_ecuteps.py``) + - 00:00.773 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_nonlinear.py` (``../abipy/examples/flows/run_nonlinear.py``) + - 00:00.737 - 0.0 * - :ref:`sphx_glr_gallery_plot_qha.py` (``../abipy/examples/plot/plot_qha.py``) - - 00:00.686 + - 00:00.727 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_relax_vs_kpts_tsmear.py` (``../abipy/examples/flows/run_relax_vs_kpts_tsmear.py``) + - 00:00.718 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_screening.py` (``../abipy/examples/flows/run_screening.py``) + - 00:00.716 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_lumi_1D_Eu_doped.py` (``../abipy/examples/plot/plot_lumi_1D_Eu_doped.py``) + - 00:00.713 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_frohlich_zpr.py` (``../abipy/examples/flows/run_frohlich_zpr.py``) + - 00:00.690 - 0.0 * - :ref:`sphx_glr_gallery_plot_phonons_infrared.py` (``../abipy/examples/plot/plot_phonons_infrared.py``) - - 00:00.657 + - 00:00.686 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_lumi_NV_center.py` (``../abipy/examples/flows/run_lumi_NV_center.py``) + - 00:00.678 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_raman_bse.py` (``../abipy/examples/flows/run_raman_bse.py``) + - 00:00.652 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_effmass_dfpt.py` (``../abipy/examples/flows/run_effmass_dfpt.py``) + - 00:00.649 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_phfrozen_ebands.py` (``../abipy/examples/flows/run_phfrozen_ebands.py``) + - 00:00.620 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_eos.py` (``../abipy/examples/flows/run_eos.py``) + - 00:00.599 - 0.0 * - :ref:`sphx_glr_gallery_plot_qpbands_with_scissor.py` (``../abipy/examples/plot/plot_qpbands_with_scissor.py``) - - 00:00.626 + - 00:00.598 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_efatbands_lm.py` (``../abipy/examples/plot/plot_efatbands_lm.py``) + - 00:00.596 - 0.0 * - :ref:`sphx_glr_gallery_plot_gruneisen.py` (``../abipy/examples/plot/plot_gruneisen.py``) - - 00:00.594 + - 00:00.593 - 0.0 - * - :ref:`sphx_glr_gallery_plot_efatbands_lm.py` (``../abipy/examples/plot/plot_efatbands_lm.py``) - - 00:00.567 + * - :ref:`sphx_glr_flow_gallery_run_si_g0w0.py` (``../abipy/examples/flows/run_si_g0w0.py``) + - 00:00.546 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_ldaus.py` (``../abipy/examples/flows/run_ldaus.py``) + - 00:00.536 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_fe_ebands.py` (``../abipy/examples/flows/run_fe_ebands.py``) + - 00:00.532 - 0.0 * - :ref:`sphx_glr_gallery_plot_phonon_fatbands.py` (``../abipy/examples/plot/plot_phonon_fatbands.py``) - - 00:00.546 + - 00:00.510 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_mgb2_edoses.py` (``../abipy/examples/flows/run_mgb2_edoses.py``) + - 00:00.498 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_relax_vs_kpts.py` (``../abipy/examples/flows/run_relax_vs_kpts.py``) + - 00:00.498 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_frohlich_zpr_from_ddb.py` (``../abipy/examples/flows/run_frohlich_zpr_from_ddb.py``) + - 00:00.495 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_gs_vs_kpts.py` (``../abipy/examples/flows/run_gs_vs_kpts.py``) + - 00:00.488 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_ht_si_g0w0ppm.py` (``../abipy/examples/flows/run_ht_si_g0w0ppm.py``) + - 00:00.486 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_relax_and_ebands.py` (``../abipy/examples/flows/run_relax_and_ebands.py``) + - 00:00.482 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_effmass_finitediff.py` (``../abipy/examples/flows/run_effmass_finitediff.py``) + - 00:00.480 - 0.0 * - :ref:`sphx_glr_gallery_plot_qps.py` (``../abipy/examples/plot/plot_qps.py``) - - 00:00.537 + - 00:00.479 - 0.0 - * - :ref:`sphx_glr_gallery_plot_qpconvergence.py` (``../abipy/examples/plot/plot_qpconvergence.py``) + * - :ref:`sphx_glr_flow_gallery_run_ht_si_ebands.py` (``../abipy/examples/flows/run_ht_si_ebands.py``) + - 00:00.475 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_phonopy_si.py` (``../abipy/examples/flows/run_phonopy_si.py``) - 00:00.465 - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_relax.py` (``../abipy/examples/flows/run_relax.py``) + - 00:00.459 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_ht_si_bsemdf.py` (``../abipy/examples/flows/run_ht_si_bsemdf.py``) + - 00:00.453 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_gaas_ebands_soc.py` (``../abipy/examples/flows/run_gaas_ebands_soc.py``) + - 00:00.448 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_qpconvergence.py` (``../abipy/examples/plot/plot_qpconvergence.py``) + - 00:00.445 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_gwr_g0w0.py` (``../abipy/examples/flows/run_gwr_g0w0.py``) + - 00:00.440 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_from_files.py` (``../abipy/examples/flows/run_from_files.py``) + - 00:00.415 + - 0.0 * - :ref:`sphx_glr_gallery_plot_ifcs.py` (``../abipy/examples/plot/plot_ifcs.py``) - - 00:00.431 + - 00:00.409 - 0.0 * - :ref:`sphx_glr_gallery_plot_kpath_from_ibz.py` (``../abipy/examples/plot/plot_kpath_from_ibz.py``) - - 00:00.400 + - 00:00.405 - 0.0 - * - :ref:`sphx_glr_gallery_plot_edos_vs_broad.py` (``../abipy/examples/plot/plot_edos_vs_broad.py``) - - 00:00.387 + * - :ref:`sphx_glr_gallery_plot_wannier90_abiwan.py` (``../abipy/examples/plot/plot_wannier90_abiwan.py``) + - 00:00.401 - 0.0 - * - :ref:`sphx_glr_gallery_plot_ebands.py` (``../abipy/examples/plot/plot_ebands.py``) - - 00:00.381 + * - :ref:`sphx_glr_flow_gallery_run_sic_relax.py` (``../abipy/examples/flows/run_sic_relax.py``) + - 00:00.389 - 0.0 * - :ref:`sphx_glr_gallery_plot_scqpgw.py` (``../abipy/examples/plot/plot_scqpgw.py``) - - 00:00.370 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_multiple_mdf.py` (``../abipy/examples/plot/plot_multiple_mdf.py``) - - 00:00.370 + - 00:00.347 - 0.0 - * - :ref:`sphx_glr_gallery_plot_wannier90_abiwan.py` (``../abipy/examples/plot/plot_wannier90_abiwan.py``) - - 00:00.367 + * - :ref:`sphx_glr_gallery_plot_edos_vs_broad.py` (``../abipy/examples/plot/plot_edos_vs_broad.py``) + - 00:00.347 - 0.0 * - :ref:`sphx_glr_gallery_plot_phbands_and_dos.py` (``../abipy/examples/plot/plot_phbands_and_dos.py``) - - 00:00.358 + - 00:00.342 - 0.0 * - :ref:`sphx_glr_gallery_plot_optic.py` (``../abipy/examples/plot/plot_optic.py``) - - 00:00.336 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_convergence.py` (``../abipy/examples/plot/plot_convergence.py``) - - 00:00.325 + - 00:00.339 - 0.0 * - :ref:`sphx_glr_gallery_plot_ejdos.py` (``../abipy/examples/plot/plot_ejdos.py``) - - 00:00.313 + - 00:00.312 - 0.0 - * - :ref:`sphx_glr_gallery_plot_multiple_hist.py` (``../abipy/examples/plot/plot_multiple_hist.py``) + * - :ref:`sphx_glr_gallery_plot_convergence.py` (``../abipy/examples/plot/plot_convergence.py``) + - 00:00.312 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_phonons.py` (``../abipy/examples/plot/plot_phonons.py``) - 00:00.306 - 0.0 + * - :ref:`sphx_glr_gallery_plot_multiple_mdf.py` (``../abipy/examples/plot/plot_multiple_mdf.py``) + - 00:00.298 + - 0.0 * - :ref:`sphx_glr_gallery_plot_scr_matrix.py` (``../abipy/examples/plot/plot_scr_matrix.py``) - - 00:00.303 + - 00:00.286 - 0.0 - * - :ref:`sphx_glr_gallery_plot_ebands_boxplot.py` (``../abipy/examples/plot/plot_ebands_boxplot.py``) - - 00:00.283 + * - :ref:`sphx_glr_gallery_plot_multiple_hist.py` (``../abipy/examples/plot/plot_multiple_hist.py``) + - 00:00.277 - 0.0 * - :ref:`sphx_glr_gallery_plot_den.py` (``../abipy/examples/plot/plot_den.py``) - - 00:00.271 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_ebands_edos.py` (``../abipy/examples/plot/plot_ebands_edos.py``) - - 00:00.264 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_phonons.py` (``../abipy/examples/plot/plot_phonons.py``) - - 00:00.261 + - 00:00.274 - 0.0 - * - :ref:`sphx_glr_gallery_plot_phonons_lo_to.py` (``../abipy/examples/plot/plot_phonons_lo_to.py``) - - 00:00.257 + * - :ref:`sphx_glr_gallery_plot_dfpt_cycle.py` (``../abipy/examples/plot/plot_dfpt_cycle.py``) + - 00:00.263 - 0.0 * - :ref:`sphx_glr_gallery_plot_wfk.py` (``../abipy/examples/plot/plot_wfk.py``) - - 00:00.254 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_dfpt_cycle.py` (``../abipy/examples/plot/plot_dfpt_cycle.py``) - - 00:00.250 + - 00:00.262 - 0.0 * - :ref:`sphx_glr_gallery_plot_hist.py` (``../abipy/examples/plot/plot_hist.py``) - - 00:00.241 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_lobster_cohp.py` (``../abipy/examples/plot/plot_lobster_cohp.py``) - - 00:00.225 + - 00:00.253 - 0.0 * - :ref:`sphx_glr_gallery_plot_lobster_files.py` (``../abipy/examples/plot/plot_lobster_files.py``) - - 00:00.223 + - 00:00.250 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_phonons_lo_to.py` (``../abipy/examples/plot/plot_phonons_lo_to.py``) + - 00:00.233 - 0.0 * - :ref:`sphx_glr_gallery_plot_potentials.py` (``../abipy/examples/plot/plot_potentials.py``) - - 00:00.209 + - 00:00.224 - 0.0 - * - :ref:`sphx_glr_gallery_plot_phonon_pjdos.py` (``../abipy/examples/plot/plot_phonon_pjdos.py``) - - 00:00.206 + * - :ref:`sphx_glr_gallery_plot_lobster_cohp.py` (``../abipy/examples/plot/plot_lobster_cohp.py``) + - 00:00.223 - 0.0 * - :ref:`sphx_glr_gallery_plot_ebands_scatter3d.py` (``../abipy/examples/plot/plot_ebands_scatter3d.py``) - - 00:00.205 + - 00:00.210 - 0.0 - * - :ref:`sphx_glr_gallery_plotly_phbands_and_dos.py` (``../abipy/examples/plot/plotly_phbands_and_dos.py``) - - 00:00.172 + * - :ref:`sphx_glr_gallery_plot_bz.py` (``../abipy/examples/plot/plot_bz.py``) + - 00:00.203 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_phonon_pjdos.py` (``../abipy/examples/plot/plot_phonon_pjdos.py``) + - 00:00.194 - 0.0 * - :ref:`sphx_glr_gallery_plot_gw_spectral_functions.py` (``../abipy/examples/plot/plot_gw_spectral_functions.py``) - - 00:00.169 + - 00:00.181 - 0.0 - * - :ref:`sphx_glr_gallery_plot_wannier90_wout.py` (``../abipy/examples/plot/plot_wannier90_wout.py``) - - 00:00.145 + * - :ref:`sphx_glr_gallery_plotly_phbands_and_dos.py` (``../abipy/examples/plot/plotly_phbands_and_dos.py``) + - 00:00.165 - 0.0 * - :ref:`sphx_glr_gallery_plot_scr.py` (``../abipy/examples/plot/plot_scr.py``) - - 00:00.140 - - 0.0 - * - :ref:`sphx_glr_gallery_plot_effmass.py` (``../abipy/examples/plot/plot_effmass.py``) - - 00:00.140 + - 00:00.149 - 0.0 * - :ref:`sphx_glr_gallery_plot_fold2bloch.py` (``../abipy/examples/plot/plot_fold2bloch.py``) - - 00:00.135 + - 00:00.149 - 0.0 - * - :ref:`sphx_glr_gallery_plot_lruj.py` (``../abipy/examples/plot/plot_lruj.py``) - - 00:00.130 + * - :ref:`sphx_glr_gallery_plot_effmass.py` (``../abipy/examples/plot/plot_effmass.py``) + - 00:00.149 - 0.0 - * - :ref:`sphx_glr_gallery_plot_bz.py` (``../abipy/examples/plot/plot_bz.py``) - - 00:00.112 + * - :ref:`sphx_glr_gallery_plot_edos_grid.py` (``../abipy/examples/plot/plot_edos_grid.py``) + - 00:00.142 - 0.0 - * - :ref:`sphx_glr_gallery_plot_phdos_grid.py` (``../abipy/examples/plot/plot_phdos_grid.py``) - - 00:00.104 + * - :ref:`sphx_glr_gallery_plot_wannier90_wout.py` (``../abipy/examples/plot/plot_wannier90_wout.py``) + - 00:00.137 - 0.0 - * - :ref:`sphx_glr_gallery_plot_phthermo.py` (``../abipy/examples/plot/plot_phthermo.py``) - - 00:00.102 + * - :ref:`sphx_glr_gallery_plot_lruj.py` (``../abipy/examples/plot/plot_lruj.py``) + - 00:00.136 - 0.0 * - :ref:`sphx_glr_gallery_plot_gscycle.py` (``../abipy/examples/plot/plot_gscycle.py``) - - 00:00.101 + - 00:00.112 - 0.0 * - :ref:`sphx_glr_gallery_plot_edos.py` (``../abipy/examples/plot/plot_edos.py``) - - 00:00.097 + - 00:00.111 - 0.0 - * - :ref:`sphx_glr_gallery_plot_edos_grid.py` (``../abipy/examples/plot/plot_edos_grid.py``) - - 00:00.084 + * - :ref:`sphx_glr_gallery_plot_phthermo.py` (``../abipy/examples/plot/plot_phthermo.py``) + - 00:00.095 + - 0.0 + * - :ref:`sphx_glr_gallery_plot_phdos_grid.py` (``../abipy/examples/plot/plot_phdos_grid.py``) + - 00:00.076 - 0.0 * - :ref:`sphx_glr_gallery_plot_xrd.py` (``../abipy/examples/plot/plot_xrd.py``) - - 00:00.049 + - 00:00.067 - 0.0 * - :ref:`sphx_glr_gallery_plot_funcs.py` (``../abipy/examples/plot/plot_funcs.py``) - - 00:00.046 + - 00:00.045 + - 0.0 + * - :ref:`sphx_glr_flow_gallery_run_gruneisen_abinit.py` (``../abipy/examples/flows/run_gruneisen_abinit.py``) + - 00:00.038 - 0.0 diff --git a/tasks.py b/tasks.py index 412acd988..ba198f3f4 100644 --- a/tasks.py +++ b/tasks.py @@ -2,14 +2,26 @@ Deployment file to facilitate AbiPy releases. Use invoke --list to get list of tasks """ -import os +from __future__ import annotations + import shutil +import json +import os +import re +import subprocess +import webbrowser +from datetime import datetime, timezone +from typing import TYPE_CHECKING +import requests from invoke import task from monty.os import cd + +if TYPE_CHECKING: + from invoke import Context + #from abipy.core.release import __version__ as CURRENT_VER -#NEW_VER = datetime.datetime.today().strftime("%Y.%-m.%-d") ABIPY_ROOTDIR = os.path.dirname(__file__) DOCS_DIR = os.path.join(ABIPY_ROOTDIR, "docs") @@ -34,27 +46,23 @@ def submodules(ctx): @task def make_doc(ctx): + """Build the website""" with cd(DOCS_DIR): ctx.run("make clean") ctx.run("make", env=dict(READTHEDOCS="1"), pty=True) open_doc(ctx) -#@task -#def push_doc(ctx): -# make_doc(ctx) -# with cd(DOCS_DIR): -# ctx.run("./ghp_import.py _build/html/ -n -p") - - @task def open_doc(ctx): + """Open the index.html in docs/_build/html/.""" import webbrowser webbrowser.open_new_tab("file://" + os.path.join(ABIPY_ROOTDIR, "docs/_build/html/index.html")) @task def twine(ctx): + """Upload new release with twine.""" with cd(ABIPY_ROOTDIR): ctx.run("rm dist/*.*", warn=True) ctx.run("python setup.py register sdist bdist_wheel") @@ -63,6 +71,7 @@ def twine(ctx): @task def pytest(ctx): + """Execute pytest.""" pytest_cmd = r"""\ pytest -n 2 --cov-config=.coveragerc --cov=abipy -v --doctest-modules abipy \ --ignore=abipy/integration_tests --ignore=abipy/data/refs --ignore=abipy/scripts/ \ @@ -74,6 +83,7 @@ def pytest(ctx): @task def style(ctx): + """Execute pycodestyle.""" with cd(ABIPY_ROOTDIR): ctx.run("pycodestyle 2>&1 | tee style.log", pty=True) #ctx.run("pydocstyle abipy | tee -a style.log", pty=True) @@ -81,18 +91,21 @@ def style(ctx): @task def flake(ctx): + """Execute flake8.""" with cd(ABIPY_ROOTDIR): ctx.run("flake8 --count --show-source --statistics | tee -a style.log", pty=True) @task def plots(ctx): + """Run the scripts in the examples/plots directory.""" with cd(os.path.join(ABIPY_ROOTDIR, "abipy", "examples")): ctx.run("_runplots.py", pty=True) @task def flows(ctx): + """Run the scripts in the examples/flows directory.""" with cd(os.path.join(ABIPY_ROOTDIR, "abipy", "examples")): ctx.run("_runflows.py", pty=True) @@ -100,7 +113,7 @@ def flows(ctx): @task def pygrep(ctx, pattern): """ - Grep for `pattern` in all py files contained in + Grep for `pattern` in all py files contained in the project. """ # grep -r -i --include \*.h # Syntax notes: @@ -115,23 +128,24 @@ def pygrep(ctx, pattern): @task def update_vars(ctx, abinit_repo_path): + """Update the database of Abinit variables.""" abinit_repo_path = os.path.abspath(abinit_repo_path) - dir_with_pyfiles = os.path.join(ABIPY_ROOTDIR, "abipy", "abio", "abivar_database") - local_files = [f for f in os.listdir(dir_with_pyfiles) if f.startswith("variables_")] - for local_file in local_files: - # "vimdiff $ABINIT_REPOPATH/abimkdocs/variables_abinit.py variables_abinit.py - source = os.path.join(abinit_repo_path, "abimkdocs", local_file) - cmd = f"vimdiff {source} {local_file}" - print(f"Executing: {cmd}") - os.system(cmd) + with cd(ABIPY_ROOTDIR): + local_files = [f for f in os.listdir(dir_with_pyfiles) if f.startswith("variables_")] + for local_file in local_files: + local_file = os.path.join(dir_with_pyfiles, local_file) + # "vimdiff $ABINIT_REPOPATH/abimkdocs/variables_abinit.py variables_abinit.py + source = os.path.join(abinit_repo_path, "abimkdocs", local_file) + cmd = f"vimdiff {source} {local_file}" + print(f"Executing: {cmd}") + os.system(cmd) @task def pyclean(ctx): """remove all pyc files and all __pycache__ directory.""" - def rm_pycaches(top: str) -> None: """remove __pycache__ directory.""" count = 0 @@ -145,7 +159,6 @@ def rm_pycaches(top: str) -> None: print("Removed %d __pycache__ directories" % count) - def rm_pycfiles(top: str) -> int: """remove all pyc files.""" count = 0 @@ -166,112 +179,10 @@ def rm_pycfiles(top: str) -> int: @task -def tuna(ctx): +def tuna(ctx: Context) -> None: """Execute tuna import profiler.""" cmd = 'python -X importtime -c "import abipy" 2> __abipy_import.log' print("Executing:", cmd) ctx.run(cmd, pty=True) cmd = "tuna __abipy_import.log" ctx.run(cmd, pty=True) - - -#@task -#def move_to_master(ctx): -# ctx.run("git tag -a v%s -m \"v%s release\"" % (NEW_VER, NEW_VER)) -# ctx.run("git push --tags") -# ctx.run("git checkout master") -# ctx.run("git pull") -# ctx.run("git merge develop") -# ctx.run("git push") -# ctx.run("git checkout develop") - - -#@task -#def update_changelog(ctx): -# -# output = subprocess.check_output(["git", "log", "--pretty=format:%s", -# "v%s..HEAD" % CURRENT_VER]) -# lines = ["* " + l for l in output.decode("utf-8").strip().split("\n")] -# with open("CHANGES.rst") as f: -# contents = f.read() -# l = "==========" -# toks = contents.split(l) -# head = "\n\nv%s\n" % NEW_VER + "-" * (len(NEW_VER) + 1) + "\n" -# toks.insert(-1, head + "\n".join(lines)) -# with open("CHANGES.rst", "w") as f: -# f.write(toks[0] + l + "".join(toks[1:])) - - -#@task -#def release(ctx, run_tests=True): -# ctx.run("rm -r dist build abipy.egg-info", warn=True) -# set_ver(ctx) -# if run_tests: pytest(ctx) -# publish(ctx) -# log_ver(ctx) -# update_doc(ctx) -# merge_stable(ctx) -# release_github(ctx) - - -#@task -#def watchdog(ctx, jobs="auto", sleep_time=5): -# """ -# Start watchdog service to watch F90 files and execute `make` when changes are detected. -# """ -# from monty.termcolor import cprint -# cprint("Starting watchdog service to watch F90 files and execute `make` when changes are detected", "green") -# cprint("Enter in the terminal to kill the service.", "green") -# -# cprint(f"Start watching py files with sleep_time {sleep_time} s ....", "green") -# top = find_top_build_tree(".", with_abinit=True) -# jobs = max(1, number_of_cpus() // 2) if jobs == "auto" else int(jobs) -# -# # http://thepythoncorner.com/dev/how-to-create-a-watchdog-in-python-to-look-for-filesystem-changes/ -# # https://stackoverflow.com/questions/19991033/generating-multiple-observers-with-python-watchdog -# import time -# from watchdog.observers import Observer -# from watchdog.events import PatternMatchingEventHandler -# event_handler = PatternMatchingEventHandler(patterns="*.py", ignore_patterns="", -# ignore_directories=False, case_sensitive=True) -# -# def on_created(event): -# print(f"hey, {event.src_path} has been created!") -# -# def on_deleted(event): -# print(f"what the f**k! Someone deleted {event.src_path}!") -# -# def on_modified(event): -# print(f"hey buddy, {event.src_path} has been modified") -# cmd = "abicheck.py" -# cprint("Executing: %s" % cmd, "yellow") -# with cd(top): -# try: -# result = ctx.run(cmd, pty=True) -# if result.ok: -# cprint("Command completed successfully", "green") -# cprint("Watching for changes ...", "green") -# except Exception: -# cprint(f"Command returned non-zero exit status", "red") -# cprint(f"Keep on watching for changes hoping you get it right ...", "red") -# -# def on_moved(event): -# print(f"ok ok ok, someone moved {event.src_path} to {event.dest_path}") -# -# event_handler.on_created = on_created -# event_handler.on_deleted = on_deleted -# event_handler.on_modified = on_modified -# event_handler.on_moved = on_moved -# -# path = ABIPY_ROOTDIR -# -# observer = Observer() -# observer.schedule(event_handler, path, recursive=True) -# observer.start() -# -# try: -# while True: -# time.sleep(sleep_time) -# except KeyboardInterrupt: -# observer.stop() -# observer.join()