@@ -93,15 +93,31 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
9393 recommended_ecut_wfc , recommended_ecut_rho = pseudo_family .get_recommended_cutoffs (
9494 structure = structure , stringency = cutoff_stringency , unit = 'Eh'
9595 )
96+
97+ # In both cases, if the protocol "hardcodes" the cutoff(s),
98+ # I use that instead of the one from the pseudopotential family
99+ # since it probably means the user really wanted that cutoff.
100+ # I use try/except since I need to go deep into a dictionary and
101+ # it is easier than using dict.get() a lot of times.
102+ try :
103+ protocol_ecut = protocol ['base' ]['abinit' ]['parameters' ]['ecut' ]
104+ except KeyError :
105+ protocol_ecut = None
106+
107+ try :
108+ protocol_pawecutdg = protocol ['base' ]['abinit' ]['parameters' ]['pawecutdg' ]
109+ except KeyError :
110+ protocol_pawecutdg = None
111+
96112 if pseudo_type == 'pseudo.jthxml' :
97113 # JTH XML are PAW; we need `pawecutdg`
98114 cutoff_parameters = {
99- 'ecut' : np .ceil (recommended_ecut_wfc ),
100- 'pawecutdg' : np .ceil (recommended_ecut_rho ),
115+ 'ecut' : protocol_ecut if protocol_ecut is not None else np .ceil (recommended_ecut_wfc ),
116+ 'pawecutdg' : protocol_pawecutdg if protocol_pawecutdg is not None else np .ceil (recommended_ecut_rho ),
101117 }
102118 else :
103119 # All others are NC; no need for `pawecutdg`
104- cutoff_parameters = {'ecut' : recommended_ecut_wfc }
120+ cutoff_parameters = {'ecut' : protocol_ecut if protocol_ecut is not None else np . ceil ( recommended_ecut_wfc ) }
105121
106122 override = {
107123 'abinit' : {
0 commit comments