tilde-lab / aiida-crystal-dft

AiiDA plugin for the ab initio modeling suite CRYSTAL, developed in Turin University
MIT License
3 stars 4 forks source link

Successful CRYSTAL output is treated as erroneous in a workflow #71

Open blokhin opened 3 months ago

blokhin commented 3 months ago
# verdi process list -a -p7
  PK  Created    Process label               Process State    Process status
----  ---------  --------------------------  ---------------  ---------------------------------------
<...>
2952  21h ago    CrystalParallelCalculation  ⨯ Excepted

# verdi process report 2952

*** 2952 [SrTiO3/221: Phonon frequencies [1]]: None
*** Scheduler output: N/A
*** Scheduler errors:
CRYSTAL by AiiDA
EXTERNAL
SCELPHONO
<...>
NODE    3 CPU TIME =     34871.178
    TOTAL CPU TIME =    139483.440

*** 2 LOG MESSAGES:
+-> WARNING at 2024-07-20 02:11:56.370200+02:00
 | could not parse scheduler output: the `_scheduler-stdout.txt` file is missing
+-> REPORT at 2024-07-20 02:11:56.508106+02:00
 | [2952|CrystalParallelCalculation|on_except]: Traceback (most recent call last):
 |   File "/usr/local/lib/python3.11/dist-packages/plumpy/process_states.py", line 228, in execute
 |     result = self.run_fn(*self.args, **self.kwargs)
 |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 |   File "/usr/local/lib/python3.11/dist-packages/aiida/engine/processes/calcjobs/calcjob.py", line 473, in parse
 |     exit_code_retrieved = self.parse_retrieved_output(retrieved_temporary_folder)
 |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 |   File "/usr/local/lib/python3.11/dist-packages/aiida/engine/processes/calcjobs/calcjob.py", line 564, in parse_retrieved_output
 |     exit_code = parser.parse(**parse_kwargs)
 |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 |   File "/usr/local/lib/python3.11/dist-packages/aiida_crystal_dft/parsers/cry_pycrystal.py", line 125, in parse
 |     self.add_node(self._linkname_trajectory, f, self.parse_out_trajectory)
 |   File "/usr/local/lib/python3.11/dist-packages/aiida_crystal_dft/parsers/cry_pycrystal.py", line 137, in add_node
 |     parse_result = callback(f)
 |                    ^^^^^^^^^^^
 |   File "/usr/local/lib/python3.11/dist-packages/aiida_crystal_dft/parsers/cry_pycrystal.py", line 166, in parse_out_trajectory
 |     traj.set_structurelist(structs)
 |   File "/usr/local/lib/python3.11/dist-packages/aiida/orm/nodes/data/array/trajectory.py", line 190, in set_structurelist
 |     raise ValueError('Symbol lists have to be the same for all of the supplied structures')
 | ValueError: Symbol lists have to be the same for all of the supplied structures
akvatol commented 3 months ago

This exception is caused by the presence of the SCELPHONO keyword in the calculation, because the phonon calculation creates a supercell that has more atoms than the original cell, here is an example of a trajectory for which the exception is thrown:

In[14]: pars.stdout_parser.get_trajectory()
Out[14]: 
[Atoms(symbols='Li2Pt', pbc=True, cell=[[2.923816996254444, 2.923816996254444, 0.0], [-3.994008292900281, 1.0701912966458385, 0.0], [0.0, 0.0, 2.67463495]]),
 Atoms(symbols='Li2PtLi5Pt2LiPt', pbc=True, cell=[[2.923816996254444, 2.923816996254444, 0.0], [-5.064199595131991, 5.064199595131991, 0.0], [0.0, 0.0, 5.3492699]])

To get rid of it, we need to add a fallback that is triggered when phonon calculation is specified in the node parameters.

akvatol commented 3 months ago

@blokhin Would it be ok if the parser just threw a warning like this in the logger, or should it completly ignore trajectories in phonon calculations? That seems like a lot of unnecessary information.

Warning: Caught ValueError for node with label 'Li2Pt/191: Phonon frequencies [1]': Symbol lists have to be the same for all of the supplied structures
WARNING:aiida.parser.CrystalParser:Caught ValueError for node with label 'Li2Pt/191: Phonon frequencies [1]': Symbol lists have to be the same for all of the supplied structures