diff --git a/abipy/abio/inputs.py b/abipy/abio/inputs.py index 8bc7dee0f..a4ded6dc7 100644 --- a/abipy/abio/inputs.py +++ b/abipy/abio/inputs.py @@ -472,7 +472,7 @@ def enforce_znucl_and_typat(self, znucl, typat): if len(typat) != len(self.structure): raise ValueError("typat contains %d entries while it should be natom: %d" % (len(typat), len(self.structure))) - ntypat = self.structure.ntypesp + ntypat = self.structure.n_elems if len(znucl) != ntypat: raise ValueError("znucl contains %d entries while it should be ntypat: %d" % (len(znucl), ntypat)) diff --git a/abipy/core/structure.py b/abipy/core/structure.py index 7e823e4fd..328280f5e 100644 --- a/abipy/core/structure.py +++ b/abipy/core/structure.py @@ -2738,7 +2738,7 @@ def structure2siesta(structure: Structure, verbose=0) -> str: lines = [] app = lines.append app("NumberOfAtoms %d" % len(structure)) - app("NumberOfSpecies %d" % structure.ntypesp) + app("NumberOfSpecies %d" % structure.n_elems) if verbose: app("# The species number followed by the atomic number, and then by the desired label") diff --git a/abipy/dfpt/phonons.py b/abipy/dfpt/phonons.py index f106937f6..64205b8f0 100644 --- a/abipy/dfpt/phonons.py +++ b/abipy/dfpt/phonons.py @@ -1627,7 +1627,7 @@ def plot_fatbands(self, use_eigvec=True, units="eV", colormap="jet", phdos_file= """ lw = kwargs.pop("lw", 2) factor = abu.phfactor_ev2units(units) - ntypat = self.structure.ntypesp + ntypat = self.structure.n_elems # Prepare PJDOS. close_phdos_file = False @@ -1768,7 +1768,7 @@ def plotly_fatbands(self, use_eigvec=True, units="eV", colormap="G10", phdos_fil """ lw = kwargs.pop("lw", 2) factor = abu.phfactor_ev2units(units) - ntypat = self.structure.ntypesp + ntypat = self.structure.n_elems # Prepare PJDOS. close_phdos_file = False @@ -2059,7 +2059,7 @@ def plot_phdispl(self, qpoint, cart_dir=None, use_reduced_coords=False, ax=None, ax, fig, plt = get_ax_fig_plt(ax=ax) cmap = plt.get_cmap(colormap) - ntypat = self.structure.ntypesp + ntypat = self.structure.n_elems if is_non_analytical_direction: ax.set_title("q-direction = %s" % repr(qpoint), fontsize=fontsize) @@ -3844,7 +3844,7 @@ def plot_pjdos_cartdirs_type(self, units="eV", stacked=True, colormap="jet", alp Returns: |matplotlib-Figure|. """ lw = kwargs.pop("lw", 2) - ntypat = self.structure.ntypesp + ntypat = self.structure.n_elems factor = abu.phfactor_ev2units(units) # Three rows for each direction. @@ -3913,7 +3913,7 @@ def plot_pjdos_cartdirs_site(self, view="inequivalent", units="eV", stacked=True """ # Define num_plots and ax2atom depending on view. factor = abu.phfactor_ev2units(units) - #natom, ntypat = len(self.structure), self.structure.ntypesp + #natom, ntypat = len(self.structure), self.structure.n_elems lw = kwargs.pop("lw", 2) # Select atoms. diff --git a/abipy/flowtk/psrepos.py b/abipy/flowtk/psrepos.py index 4de9710a4..268a6d614 100644 --- a/abipy/flowtk/psrepos.py +++ b/abipy/flowtk/psrepos.py @@ -431,8 +431,8 @@ class JthRepo(PseudosRepo): def from_abinit_website(cls, xc_name: str, relativity_type: str, version: str) -> JthRepo: # https://www.abinit.org/ATOMICDATA/JTH-LDA-atomicdata.tar.gz # ATOMPAW-LDA-JTHv0.4 - url = f"https://www.abinit.org/ATOMICDATA/JTH-{xc_name}-atomicdata.tar.gz" - #url = f"https://abinit.github.io/abinit_web/ATOMICDATA/JTH-{xc_name}-atomicdata.tar.gz" # TODO New url + #url = f"https://www.abinit.org/ATOMICDATA/JTH-{xc_name}-atomicdata.tar.gz" + url = f"https://abinit.github.io/abinit_web/ATOMICDATA/JTH-{xc_name}-atomicdata.tar.gz" # TODO New url return cls(cls.ps_generator, xc_name, relativity_type, cls.project_name, version, url) @property diff --git a/abipy/flowtk/tasks.py b/abipy/flowtk/tasks.py index 040fde63a..5ee1c170e 100644 --- a/abipy/flowtk/tasks.py +++ b/abipy/flowtk/tasks.py @@ -631,8 +631,17 @@ def from_user_config(cls) -> TaskManager: # return _USER_CONFIG_TASKMANAGER # Try in the current directory then in user configuration directory. - path = os.path.join(os.getcwd(), cls.YAML_FILE) - if not os.path.exists(path): + try: + cwd = os.getcwd() + except FileNotFoundError: + # This error is triggered when running pytes with workers. + cwd = None + + if cwd is not None: + path = os.path.join(cwd, cls.YAML_FILE) + if not os.path.exists(path): + path = os.path.join(cls.USER_CONFIG_DIR, cls.YAML_FILE) + else: path = os.path.join(cls.USER_CONFIG_DIR, cls.YAML_FILE) if not os.path.exists(path):