Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ladinesa committed Aug 23, 2024
1 parent 9c00305 commit 2b5e70c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions workflowparsers/aflow/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def init_quantities(self):
def parse(self, key=None):
super().parse(key)

if self.get('poscar') is not None and self._results.get('geometry') is None:
if self._results.get('poscar') is not None and self._results.get('geometry') is None:
try:
atoms = vasp.read_vasp(StringIO(self._results['poscar'][-1]))
self._results['cell'] = atoms.get_cell()
Expand Down Expand Up @@ -511,9 +511,10 @@ def parse(self, filepath, archive, logger):
for n, specie in enumerate(species):
atom_labels += [specie] * self.aflow_data['composition'][n]
sec_system.atoms.labels = atom_labels
sec_system.atoms.positions = (
self.aflow_data.get('positions_cartesian', []) * ureg.angstrom
)
if self.aflow_data.get('positions_cartesian') is not None:
sec_system.atoms.positions = (
self.aflow_data.get('positions_cartesian') * ureg.angstrom
)

# parse system metadata from aflow_data
system_quantities = [
Expand Down
6 changes: 5 additions & 1 deletion workflowparsers/elastic/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ def get_strain_energy(self):
# the peculiarity of the x_elastic_strain_diagram_values metainfo that it does
# not have the energy unit
energies.append((data[1] * ureg.hartree).to('J').magnitude)
if len(np.shape(energies)) != 2:
try:
energies = np.array(energies)
if len(np.shape(energies)) != 2:
strains, energies = [], []
except Exception:
strains, energies = [], []
return strains, energies

Expand Down

0 comments on commit 2b5e70c

Please sign in to comment.