Skip to content

Commit

Permalink
ntypesp --> n_elements + fetch PAW pseudos from abinit.github.io
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Jul 19, 2024
1 parent 9e3b24a commit 8be31cb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion abipy/abio/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion abipy/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 5 additions & 5 deletions abipy/dfpt/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions abipy/flowtk/psrepos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions abipy/flowtk/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8be31cb

Please sign in to comment.