Skip to content

Commit 70c391f

Browse files
committed
Stop duplicating scf_convergence / dlpno_threshold keywords
The old 'read user value OR default, then add_to_args' pattern always appended to args['keyword']['general'], even when the user already had the value under its named key. For a user who set dlpno_threshold: TightPNO, 'tightpno' was emitted twice — once from their key and once from 'general' — and ORCA rejected the input with UNRECOGNIZED OR DUPLICATED KEYWORD. Use setdefault() instead, so the default only lands when the user didn't supply the key. The value rides through update_input_dict_with_ args on its canonical key, not under 'general', so each keyword is emitted exactly once.
1 parent 3701888 commit 70c391f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

arc/job/adapters/orca.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@ def write_input_file(self) -> None:
280280
input_dict['multiplicity'] = self.multiplicity
281281
input_dict['xyz'] = xyz_to_str(self.xyz)
282282

283-
scf_convergence = self.args['keyword'].get('scf_convergence', '').lower() or \
284-
orca_default_options_dict['global']['keyword'].get('scf_convergence', '').lower()
285-
if not scf_convergence:
283+
self.args['keyword'].setdefault(
284+
'scf_convergence',
285+
orca_default_options_dict['global']['keyword'].get('scf_convergence', '').lower())
286+
if not self.args['keyword']['scf_convergence']:
286287
raise ValueError('Orca SCF convergence is not specified. Please specify this variable either in '
287288
'settings.py as default or in the input file as additional options.')
288-
self.add_to_args(val=scf_convergence, key1='keyword')
289289

290290
# Orca requires different blocks for wavefunction methods and DFT methods
291291
if self.level.method_type == 'dft':
@@ -298,12 +298,12 @@ def write_input_file(self) -> None:
298298
elif self.level.method_type == 'wavefunction':
299299
input_dict['method_class'] = 'HF'
300300
if 'dlpno' in self.level.method:
301-
dlpno_threshold = self.args['keyword'].get('dlpno_threshold', '').lower() or \
302-
orca_default_options_dict['global']['keyword'].get('dlpno_threshold', '').lower()
303-
if not dlpno_threshold:
301+
self.args['keyword'].setdefault(
302+
'dlpno_threshold',
303+
orca_default_options_dict['global']['keyword'].get('dlpno_threshold', '').lower())
304+
if not self.args['keyword']['dlpno_threshold']:
304305
raise ValueError('Orca DLPNO threshold is not specified. Please specify this variable either in '
305306
'settings.py as default or in the input file as additional options.')
306-
self.add_to_args(val=dlpno_threshold, key1='keyword')
307307
else:
308308
logger.debug(f'Running {self.level.method_type} {self.level.method} method in Orca.')
309309

0 commit comments

Comments
 (0)