@@ -211,6 +211,32 @@ def __init__(self,
211211 elif self .species [0 ].checkfile is not None and os .path .isfile (self .species [0 ].checkfile ):
212212 self .checkfile = self .species [0 ].checkfile
213213
214+ def _user_requested_verytight (self ) -> bool :
215+ """
216+ Return True if the user passed ``verytight`` through ``self.args``.
217+
218+ When True, the fine-mode opt-keyword builder will skip auto-adding
219+ ``tight`` so the user's ``verytight`` wins unambiguously in the final
220+ ``opt=(...)`` clause assembled by ``combine_parameters``.
221+
222+ Scope: only the ``keyword`` channel is meaningful here — ``block`` is for
223+ Gaussian input blocks and ``trsh`` is for ARC's troubleshooting layer,
224+ neither of which is the right place for a user opt-cutoff override.
225+
226+ Notes for the implementer:
227+ - ``self.args['keyword']`` is a ``dict[str, str]`` (see
228+ ``Level._check_args`` at arc/level.py:281). Values may be in any
229+ case and may contain other keywords too (e.g. ``"opt=(verytight)
230+ freq=hpmodes"``).
231+ - Match must be word-bounded: a stray ``verytightscf`` should not
232+ count, and ``tight`` alone must NOT match.
233+ - Be defensive: ``self.args`` or ``self.args['keyword']`` may be
234+ missing or empty depending on how the Level was constructed.
235+ """
236+ keyword_args = (self .args or {}).get ('keyword' ) or {}
237+ joined = ' ' .join (str (v ) for v in keyword_args .values ())
238+ return re .search (r'\bverytight\b' , joined , re .IGNORECASE ) is not None
239+
214240 def write_input_file (self ) -> None :
215241 """
216242 Write the input file to execute the job on the server.
@@ -299,10 +325,11 @@ def write_input_file(self) -> None:
299325 if input_dict ['trsh' ]:
300326 input_dict ['trsh' ] += ' '
301327 input_dict ['trsh' ] += 'scf=(tight,direct)'
328+ tight_kw = [] if self ._user_requested_verytight () else ['tight' ]
302329 if self .is_ts :
303- keywords .extend (['tight' , 'maxstep=5' ])
330+ keywords .extend ([* tight_kw , 'maxstep=5' ])
304331 else :
305- keywords .extend (['tight' , 'maxstep=5' , f'maxcycle={ max_c } ' ])
332+ keywords .extend ([* tight_kw , 'maxstep=5' , f'maxcycle={ max_c } ' ])
306333 input_dict ['job_type_1' ] = "opt" if self .level .method_type not in ['dft' , 'composite' , 'wavefunction' ]\
307334 else f"opt=({ ', ' .join (key for key in keywords )} )"
308335
0 commit comments