Skip to content

Commit b36b2e3

Browse files
committed
Added an option to consider only a subset of CI states in MOPAC workflow
1 parent c41f2e1 commit b36b2e3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/libra_py/packages/mopac/methods.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def read_mopac_orbital_info(params_):
229229
230230
* **params_["filename"]** ( string ) : the name of the file to read
231231
* **params_["active_space"]** (list of ints): the orbital numbers to be includes, the indexing starts with 1, not 0 [default: None]
232+
* **params_["nstates"]** ( int ): the number of CI states + ground state to use, `nstates = 2` means 1 ground and 1 excited states
232233
233234
Returns:
234235
(Es, MOs, E_CI, CI, configs):
@@ -256,7 +257,7 @@ def read_mopac_orbital_info(params_):
256257
params = dict(params_)
257258

258259
critical_params = []
259-
default_params = {"filename": "output", "active_space": None}
260+
default_params = {"filename": "output", "active_space": None, "nstates":2}
260261
comn.check_input(params, default_params, critical_params)
261262

262263
out_file = params["filename"]
@@ -416,6 +417,12 @@ def read_mopac_orbital_info(params_):
416417
ci_end.append(i)
417418

418419
nci = len(ci_beg)
420+
if nci < params["nstates"]:
421+
print("Not enough CI states requested in the INDO input line\nExiting...\n")
422+
sys.exit(0)
423+
else:
424+
nci = params["nstates"]
425+
419426

420427
if False: # Make True for debugging
421428
print(F"The number of CI states = {nci}")

0 commit comments

Comments
 (0)