@@ -2217,6 +2217,13 @@ def run_dftb(coords, params):
22172217 Name of the GEN-format geometry file (relative to the working
22182218 directory).
22192219 Default: "x1.gen"
2220+
2221+ what_calculation : either "gs", "ex", "both"
2222+ What kind of calculations to conduct:
2223+ "gs" - ground state
2224+ "ex" - excited state
2225+ "both" - ex after gs
2226+ Default: "both"
22202227
22212228 Returns
22222229 -------
@@ -2276,6 +2283,7 @@ def run_dftb(coords, params):
22762283 dftb_run_params = params .get ("dftb_run_params" , {})
22772284 wd = params .get ("working_directory" , "wd" )
22782285 gen_file = params .get ("gen_file" , "x1.gen" )
2286+ what_calculation = params .get ("what_calculation" , "both" )
22792287
22802288 # Ensure directory exists
22812289 os .makedirs (wd , exist_ok = True )
@@ -2288,31 +2296,34 @@ def run_dftb(coords, params):
22882296 # -------- Write GEN file --------
22892297 write_dftb_gen (gen_path , labels , coords / units .Angst , periodic = False )
22902298
2299+
22912300 # -------- Ground state --------
2292- make_dftb_input (dftb_run_params , ground_state = True , working_directory = wd )
2293-
2294- subprocess .run (
2295- [exe ],
2296- cwd = wd ,
2297- check = True ,
2298- stdout = subprocess .PIPE ,
2299- stderr = subprocess .PIPE ,
2300- )
2301+ if what_calculation in ["gs" , "both" ]:
2302+ make_dftb_input (dftb_run_params , ground_state = True , working_directory = wd )
2303+
2304+ subprocess .run (
2305+ [exe ],
2306+ cwd = wd ,
2307+ check = True ,
2308+ stdout = subprocess .PIPE ,
2309+ stderr = subprocess .PIPE ,
2310+ )
23012311
2302- # Rename file safely
2303- if os .path .exists (tag ):
2304- os .replace (tag , gs_tag )
2312+ # Rename file safely
2313+ if os .path .exists (tag ):
2314+ os .replace (tag , gs_tag )
23052315
23062316 # -------- Excited state --------
2307- make_dftb_input (dftb_run_params , ground_state = False , working_directory = wd )
2308-
2309- subprocess .run (
2310- [exe ],
2311- cwd = wd ,
2312- check = True ,
2313- stdout = subprocess .PIPE ,
2314- stderr = subprocess .PIPE ,
2315- )
2317+ if what_calculation in ["ex" , "both" ]:
2318+ make_dftb_input (dftb_run_params , ground_state = False , working_directory = wd )
2319+
2320+ subprocess .run (
2321+ [exe ],
2322+ cwd = wd ,
2323+ check = True ,
2324+ stdout = subprocess .PIPE ,
2325+ stderr = subprocess .PIPE ,
2326+ )
23162327
23172328def read_dftb_orbital_info (params_ ):
23182329 """
0 commit comments