Skip to content

Commit d60a518

Browse files
committed
MRCI treatment in Scheduler
1 parent 1621f5d commit d60a518

File tree

1 file changed

+13
-39
lines changed

1 file changed

+13
-39
lines changed

arc/scheduler.py

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,16 +1255,14 @@ def run_sp_job(self,
12551255
level: Optional[Level] = None,
12561256
):
12571257
"""
1258-
Spawn a single point job using 'final_xyz' for species ot TS 'label'.
1259-
If the method is MRCI, first spawn a simple CCSD job, and use orbital determination to run the MRCI job.
1258+
Spawn a single point job using 'final_xyz' for species or a TS represented by 'label'.
1259+
If the method is MRCI, first spawn a simple CCSD(T) job, and use orbital determination to run the MRCI job.
12601260
12611261
Args:
12621262
label (str): The species label.
12631263
level (Level): An alternative level of theory to run at. If ``None``, self.sp_level will be used.
12641264
"""
12651265
level = level or self.sp_level
1266-
1267-
# determine_occ(xyz=self.xyz, charge=self.charge)
12681266
if level == self.opt_level and not self.composite_method \
12691267
and not (level.software == 'xtb' and self.species_dict[label].is_ts) \
12701268
and 'paths' in self.output[label] and 'geo' in self.output[label]['paths'] \
@@ -1282,57 +1280,33 @@ def run_sp_job(self,
12821280
sp_path=os.path.join(recent_opt_job.local_path_to_output_file),
12831281
level=level,
12841282
)
1285-
12861283
# If opt is not in the job dictionary, the likely explanation is this job has been restarted
12871284
elif 'geo' in self.output[label]['paths']: # Then just use this path directly
12881285
self.post_sp_actions(label=label,
12891286
sp_path=self.output[label]['paths']['geo'],
12901287
level=level,
12911288
)
1292-
12931289
else:
12941290
raise RuntimeError(f'Unable to set the path for the sp job for species {label}')
1295-
12961291
return
1297-
if 'sp' not in self.job_dict[label].keys(): # Check whether single-point energy jobs have been spawned yet.
1298-
# We're spawning the first sp job for this species.
1292+
1293+
if 'sp' not in self.job_dict[label].keys():
12991294
self.job_dict[label]['sp'] = dict()
13001295
if self.composite_method:
13011296
raise SchedulerError(f'run_sp_job() was called for {label} which has a composite method level of theory')
13021297
if 'mrci' in level.method:
13031298
if self.job_dict[label]['sp']:
1304-
# Parse orbital information from the CCSD job, then run MRCI
1305-
job0 = None
1306-
job_name_0 = 0
1307-
for job_name, job in self.job_dict[label]['sp'].items():
1308-
if int(job_name.split('_a')[-1]) > job_name_0:
1309-
job_name_0 = int(job_name.split('_a')[-1])
1310-
job0 = job
1311-
with open(job0.local_path_to_output_file, 'r') as f:
1312-
lines = f.readlines()
1313-
core = val = 0
1314-
for line in lines:
1315-
if 'NUMBER OF CORE ORBITALS' in line:
1316-
core = int(line.split()[4])
1317-
elif 'NUMBER OF VALENCE ORBITALS' in line:
1318-
val = int(line.split()[4])
1319-
if val * core:
1320-
break
1321-
else:
1322-
raise SchedulerError(f'Could not determine number of core and valence orbitals from CCSD '
1323-
f'sp calculation for {label}')
1324-
self.species_dict[label].occ = val + core # the occupied orbitals are the core and valence orbitals
1325-
self.run_job(label=label,
1326-
xyz=self.species_dict[label].get_xyz(generate=False),
1327-
level_of_theory='ccsd/vdz',
1328-
job_type='sp')
1299+
if self.species_dict[label].active is None:
1300+
self.species_dict[label].active = parser.parse_active_space(
1301+
sp_path=self.output[label]['paths']['sp'],
1302+
species=self.species_dict[label])
13291303
else:
1330-
# MRCI was requested but no sp job ran for this species, run CCSD first
1331-
logger.info(f'running a CCSD job for {label} before MRCI')
1304+
logger.info(f'Running a CCSD/cc-pVDZ job for {label} before the MRCI job')
13321305
self.run_job(label=label,
13331306
xyz=self.species_dict[label].get_xyz(generate=False),
1334-
level_of_theory='ccsd/vdz',
1307+
level_of_theory='ccsd/cc-pvdz',
13351308
job_type='sp')
1309+
return
13361310
if self.job_types['sp']:
13371311
if self.species_dict[label].multi_species:
13381312
if self.output_multi_spc[self.species_dict[label].multi_species].get('sp', False):
@@ -2650,7 +2624,6 @@ def check_sp_job(self,
26502624
job (JobAdapter): The single point job object.
26512625
"""
26522626
if 'mrci' in self.sp_level.method and job.level is not None and 'mrci' not in job.level.method:
2653-
# This is a CCSD job ran before MRCI. Spawn MRCI
26542627
self.run_sp_job(label)
26552628
elif job.job_status[1]['status'] == 'done':
26562629
self.post_sp_actions(label,
@@ -2685,6 +2658,8 @@ def post_sp_actions(self,
26852658
self.output[label]['paths']['sp'] = sp_path
26862659
if self.sp_level is not None and 'ccsd' in self.sp_level.method:
26872660
self.species_dict[label].t1 = parser.parse_t1(self.output[label]['paths']['sp'])
2661+
self.species_dict[label].active = parser.parse_active_space(sp_path=self.output[label]['paths']['sp'],
2662+
species=self.species_dict[label])
26882663
zpe_scale_factor = 0.99 if (self.composite_method is not None and 'cbs-qb3' in self.composite_method.method) \
26892664
else 1.0
26902665
self.species_dict[label].e_elect = parser.parse_e_elect(self.output[label]['paths']['sp'],
@@ -2709,7 +2684,6 @@ def post_sp_actions(self,
27092684
self.run_sp_job(label=label, level=solvation_sp_level)
27102685
self.run_sp_job(label=label, level=self.sp_level.solvation_scheme_level)
27112686
else:
2712-
# this is one of the additional sp jobs spawned by the above previously
27132687
if level is not None and level.solvation_method is not None:
27142688
self.output[label]['paths']['sp_sol'] = sp_path
27152689
else:

0 commit comments

Comments
 (0)