Skip to content

Commit

Permalink
fix for [issue 71](tilde-lab#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
akvatol committed Jul 30, 2024
1 parent 86a8b85 commit b19ec40
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions aiida_crystal_dft/parsers/cry_pycrystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,22 @@ def parse_out_wavefunction(self, f):
return None
return DataFactory('singlefile')(file=f)

def parse_out_trajectory(self, _):
try:
ase_structs = self.stdout_parser.get_trajectory()
if not ase_structs:
return None
structs = [DataFactory('structure')(ase=struct) for struct in ase_structs]
traj = DataFactory('array.trajectory')()
traj.set_structurelist(structs)
return traj
except ValueError as e:
# Fix for calculation with SCELPHO keyword;
# Scince supercell have more atoms than regular cell;
# traj.set_structurelist(structs) will throw an error https://github.com/aiidateam/aiida-core/blob/71422eb872040a9ba23047d2ec031f6deaa6a7cc/src/aiida/orm/nodes/data/array/trajectory.py#L202
# There are no reason for tracking trajectory in phonon calculation, so it will return None
if "Phonon" in self._node.label:
self._logger.warning(f"Caught ValueError for node with label '{self._node.label}': {e}")
return None
else:
raise e
def parse_out_trajectory(self, _):
try:
ase_structs = self.stdout_parser.get_trajectory()
if not ase_structs:
return None
structs = [DataFactory('structure')(ase=struct) for struct in ase_structs]
traj = DataFactory('array.trajectory')()
traj.set_structurelist(structs)
return traj
except ValueError as e:
# Fix for calculation with SCELPHO keyword;
# Scince supercell have more atoms than regular cell;
# traj.set_structurelist(structs) will throw an error https://github.com/aiidateam/aiida-core/blob/71422eb872040a9ba23047d2ec031f6deaa6a7cc/src/aiida/orm/nodes/data/array/trajectory.py#L202
# There are no reason for tracking trajectory in phonon calculation, so it will return None
if "Phonon" in self._node.label:
self._logger.warning(f"Caught ValueError for node with label '{self._node.label}': {e}")
return None
else:
raise e

0 comments on commit b19ec40

Please sign in to comment.