aiidateam / aiida-quantumespresso

The official AiiDA plugin for Quantum ESPRESSO
https://aiida-quantumespresso.readthedocs.io
Other
55 stars 82 forks source link

Protocols: *VOLUME `RelaxType`s specify incorrect `ibrav` #659

Open mbercx opened 3 years ago

mbercx commented 3 years ago

Currently, trying to run the PwRelaxWorkChain with the get_builder_from_protocol builder and RelaxType.VOLUME or RelaxType.POSITIONS_VOLUME doesn't work, since the default ibrav is set to 0, which results in the following error:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     Error in routine cell_dofree (1):
     Isotropic expansion is only allowed for ibrav=1; i.e. for simple cubic
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If it's true that you can only run with ibrav == 1, I suppose we can just set this in the get_builder_from_protocol method. However, in case a non-BBC structure is run, the work chain will except:

...
 | Traceback (most recent call last):
 |   File "/home/mbercx/envs/aiida-dev/code/aiida-core/aiida/engine/processes/calcjobs/tasks.py", line 83, in do_upload
 |     calc_info = process.presubmit(folder)
 |   File "/home/mbercx/envs/aiida-dev/code/aiida-core/aiida/engine/processes/calcjobs/calcjob.py", line 487, in presubmit
 |     calc_info = self.prepare_for_submission(folder)
 |   File "/home/mbercx/envs/aiida-dev/code/aiida-quantumespresso/aiida_quantumespresso/calculations/__init__.py", line 206, in prepare_for_submission
 |     input_filecontent, local_copy_pseudo_list = self._generate_PWCPinputdata(*arguments)
 |   File "/home/mbercx/envs/aiida-dev/code/aiida-quantumespresso/aiida_quantumespresso/calculations/__init__.py", line 586, in _generate_PWCPinputdata
 |     raise QEInputValidationError(f'Cannot get structure parameters from cell: {exc}') from exc
 | aiida_quantumespresso.calculations.helpers.QEInputValidationError: Cannot get structure parameters from cell: The cell [[3.86697465 0.         0.        ]
 |  [0.         3.86697465 0.        ]
 |  [0.         0.         3.86697465]] constructed with 'ibrav=1', parameters={'a': 3.86697465} does not match the input cell[[3.86697465, 0.0, 0.0], [1.933487325, 3.3488982826904, 0.0], [1.933487325, 1.1162994275635, 3.1573715802592]].
...

So perhaps we should include a validator for the PwRelaxWorkChain instead.

As a side note, I'm not sure why you can't run e.g. FCC structures with cell_dofree == 'volume'. Is this error message correct?

mbercx commented 3 years ago

Pinging @sphuber for comments, since this should probably still be added to v3.3.2.

sphuber commented 3 years ago

I don't understand. Didn't we run the GeTe test case with RelaxType.VOLUME? That worked just fine. Is this a limitation of a particular version of QE? Which version were you running?

Edit: in fact, the GeTe example is run with RelaxType.POSITIONS_SHAPE not the volume. The volume is actually kept constant in this example. It is confirmed that optimizing the volume is currently only supported for ibrav=1 i.e. simple cubic systems.

mbercx commented 3 years ago

Which version were you running?

I'm running QE v6.6. I was also surprised to run into this issue, as I thought I had field tested all the different RelaxTypes (also with QE v6.6, if I remember correctly). I must have not been thorough enough in my testing after all, maybe I didn't actually run all the different possibilities, but just test the get_builder_from_protocol() method?

I bumped into this issue now when I was trying to test all the RelaxTypes for the aiida-common-workflows project. E.g. try running:

aiida-common-workflows launch relax -r volume -S Al -- quantum_espresso

And you'll get a PwCalculation that fails with exit code 305, with the above error message in the stdout. I then tested this in aiida-quantumespresso itself using the develop branch, and was able to reproduce the same error.

mbercx commented 3 years ago

Support for the VOLUME and POSITIONS_VOLUME RelaxTypes was temporarily removed in #660, until we sort out how to deal with this properly.