From a0fe0128aa61181c9c8291331c102e1040e4aef8 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 00:45:59 +0300 Subject: [PATCH 1/8] Don't save default values in ARC dict repr --- arc/main.py | 58 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/arc/main.py b/arc/main.py index 9078efe99e..c675933bc3 100644 --- a/arc/main.py +++ b/arc/main.py @@ -469,7 +469,8 @@ def as_dict(self) -> dict: if self.adaptive_levels is not None: restart_dict['adaptive_levels'] = {atom_range: {job_type: level.as_dict() for job_type, level in levels_dict} for atom_range, levels_dict in self.adaptive_levels.items()} - restart_dict['allow_nonisomorphic_2d'] = self.allow_nonisomorphic_2d + if self.allow_nonisomorphic_2d: + restart_dict['allow_nonisomorphic_2d'] = self.allow_nonisomorphic_2d if self.arkane_level_of_theory is not None: restart_dict['arkane_level_of_theory'] = self.arkane_level_of_theory.as_dict() \ if isinstance(self.arkane_level_of_theory, Level) else self.arkane_level_of_theory @@ -477,7 +478,7 @@ def as_dict(self) -> dict: restart_dict['bac_type'] = self.bac_type if self.bath_gas is not None: restart_dict['bath_gas'] = self.bath_gas - if self.calc_freq_factor: + if not self.calc_freq_factor: restart_dict['calc_freq_factor'] = self.calc_freq_factor if not self.compare_to_rmg: restart_dict['compare_to_rmg'] = self.compare_to_rmg @@ -487,62 +488,73 @@ def as_dict(self) -> dict: restart_dict['compute_rates'] = self.compute_rates if not self.compute_thermo: restart_dict['compute_thermo'] = self.compute_thermo - if not self.compute_transport: + if self.compute_transport: restart_dict['compute_transport'] = self.compute_transport - if self.conformer_level is not None: + if self.conformer_level is not None and str(self.conformer_level).split()[0] != default_levels_of_theory['conformer']: restart_dict['conformer_level'] = self.conformer_level.as_dict() if self.dont_gen_confs: restart_dict['dont_gen_confs'] = self.dont_gen_confs - if self.ts_adapters: + if self.ts_adapters is not None: restart_dict['ts_adapters'] = self.ts_adapters - restart_dict['e_confs'] = self.e_confs + if self.e_confs != 5.0: + restart_dict['e_confs'] = self.e_confs restart_dict['ess_settings'] = self.ess_settings - if self.freq_level is not None: + if self.freq_level is not None and str(self.freq_level).split()[0] != default_levels_of_theory['freq']: restart_dict['freq_level'] = self.freq_level.as_dict() \ if not isinstance(self.freq_level, (dict, str)) else self.freq_level if self.freq_scale_factor is not None: restart_dict['freq_scale_factor'] = self.freq_scale_factor - if self.irc_level is not None: + if self.irc_level is not None and str(self.irc_level).split()[0] != default_levels_of_theory['irc']: restart_dict['irc_level'] = self.irc_level.as_dict() \ if not isinstance(self.irc_level, (dict, str)) else self.irc_level if self.keep_checks: restart_dict['keep_checks'] = self.keep_checks - restart_dict['kinetics_adapter'] = self.kinetics_adapter + if self.kinetics_adapter != 'arkane': + restart_dict['kinetics_adapter'] = self.kinetics_adapter restart_dict['job_memory'] = self.memory restart_dict['job_types'] = self.job_types if self.level_of_theory: restart_dict['level_of_theory'] = self.level_of_theory restart_dict['max_job_time'] = self.max_job_time - restart_dict['n_confs'] = self.n_confs - if self.opt_level is not None: + if self.n_confs != 10: + restart_dict['n_confs'] = self.n_confs + if self.opt_level is not None and str(self.opt_level).split()[0] != default_levels_of_theory['opt']: restart_dict['opt_level'] = self.opt_level.as_dict() \ if not isinstance(self.opt_level, (dict, str)) else self.opt_level - if self.orbitals_level is not None: + if self.orbitals_level is not None and str(self.orbitals_level).split()[0] != default_levels_of_theory['orbitals']: restart_dict['orbitals_level'] = self.orbitals_level.as_dict() \ if not isinstance(self.orbitals_level, (dict, str)) else self.orbitals_level - restart_dict['output'] = self.output - restart_dict['output_multi_spc'] = self.output_multi_spc if self.output_multi_spc else dict() + if self.output: + restart_dict['output'] = self.output + if self.output_multi_spc: + restart_dict['output_multi_spc'] = self.output_multi_spc if self.output_multi_spc else dict() restart_dict['project'] = self.project - restart_dict['reactions'] = [rxn.as_dict() for rxn in self.reactions] - restart_dict['running_jobs'] = self.running_jobs - if self.scan_level is not None: + if len(self.reactions): + restart_dict['reactions'] = [rxn.as_dict() for rxn in self.reactions] + if self.running_jobs: + restart_dict['running_jobs'] = self.running_jobs + if self.scan_level is not None and str(self.scan_level).split()[0] != default_levels_of_theory['scan']: restart_dict['scan_level'] = self.scan_level.as_dict() \ if not isinstance(self.scan_level, (dict, str)) else self.scan_level - if self.sp_level is not None: + if self.sp_level is not None and str(self.sp_level).split()[0] != default_levels_of_theory['sp']: restart_dict['sp_level'] = self.sp_level.as_dict() \ if not isinstance(self.sp_level, (dict, str)) else self.sp_level restart_dict['species'] = [spc.as_dict() for spc in self.species] if self.specific_job_type: restart_dict['specific_job_type'] = self.specific_job_type - restart_dict['T_min'] = self.T_min - restart_dict['T_max'] = self.T_max - restart_dict['T_count'] = self.T_count - restart_dict['thermo_adapter'] = self.thermo_adapter + if self.T_min is not None: + restart_dict['T_min'] = self.T_min + if self.T_max is not None: + restart_dict['T_max'] = self.T_max + if self.T_count != 50: + restart_dict['T_count'] = self.T_count + if self.thermo_adapter != 'arkane': + restart_dict['thermo_adapter'] = self.thermo_adapter if not self.three_params: restart_dict['three_params'] = self.three_params if not self.trsh_ess_jobs: restart_dict['trsh_ess_jobs'] = self.trsh_ess_jobs - if self.ts_guess_level is not None: + if self.ts_guess_level is not None and str(self.ts_guess_level).split()[0] != default_levels_of_theory['ts_guesses']: restart_dict['ts_guess_level'] = self.ts_guess_level.as_dict() \ if not isinstance(self.ts_guess_level, (dict, str)) else self.ts_guess_level if self.verbose != logging.INFO: From db800b47c9b04873039fde288005fa171537301b Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 00:46:13 +0300 Subject: [PATCH 2/8] Tests: Modifications to main test --- arc/main_test.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/arc/main_test.py b/arc/main_test.py index dcfe10525f..c25357de97 100644 --- a/arc/main_test.py +++ b/arc/main_test.py @@ -80,22 +80,15 @@ def test_as_dict(self): self.assertIn("'C-C': 1", long_thermo_description) self.assertIn("'C-H': 6", long_thermo_description) # mol.atoms are not tested since all id's (including connectivity) changes depending on how the test is run. - expected_dict = {'T_count': 50, - 'T_max': None, - 'T_min': None, - 'allow_nonisomorphic_2d': False, - 'arkane_level_of_theory': {'basis': 'cc-pvdz-f12', + expected_dict = {'arkane_level_of_theory': {'basis': 'cc-pvdz-f12', 'method': 'ccsd(t)-f12', 'method_type': 'wavefunction', 'software': 'molpro'}, - 'calc_freq_factor': True, - 'compute_transport': False, 'conformer_level': {'basis': 'def2svp', 'compatible_ess': ['gaussian', 'terachem'], 'method': 'wb97xd', 'method_type': 'dft', 'software': 'gaussian'}, - 'e_confs': 5.0, 'ess_settings': {'cfour': ['local'], 'gaussian': ['local', 'server2'], 'gcn': ['local'], @@ -129,29 +122,18 @@ def test_as_dict(self): 'orbitals': False, 'rotors': False, 'sp': True}, - 'kinetics_adapter': 'arkane', 'max_job_time': 120, - 'n_confs': 10, 'opt_level': {'basis': '6-311+g(3df,2p)', 'method': 'b3lyp', 'method_type': 'dft', 'software': 'gaussian'}, - 'output': {}, - 'output_multi_spc': {}, 'project': 'arc_test', - 'reactions': [], - 'running_jobs': {}, 'sp_level': {'basis': 'cc-pvdz-f12', 'method': 'ccsd(t)-f12', 'method_type': 'wavefunction', 'software': 'molpro'}, - 'species': [{'arkane_file': None, - 'bond_corrections': {'C-C': 1, 'C-H': 6}, - 'charge': 0, + 'species': [{'bond_corrections': {'C-C': 1, 'C-H': 6}, 'compute_thermo': False, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'spc1', 'long_thermo_description': long_thermo_description, 'mol': {'atom_order': restart_dict['species'][0]['mol']['atom_order'], @@ -160,7 +142,6 @@ def test_as_dict(self): 'props': {}}, 'multiplicity': 1, 'number_of_rotors': 0}], - 'thermo_adapter': 'arkane', 'three_params': False, 'ts_adapters': ['heuristics', 'AutoTST', 'GCN', 'xtb_gsm']} # import pprint # left intentionally for debugging @@ -174,7 +155,6 @@ def test_from_dict(self): 'freq_level': 'wb97x-d3/6-311+g(d,p)', 'freq_scale_factor': 0.96, 'opt_level': 'wb97x-d3/6-311+g(d,p)', - 'output': {}, 'project': 'testing_from_dict', 'reactions': [], 'scan_level': '', From d66c47245fa9dbab0471915167c4c77f0ff2013b Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 00:23:01 +0300 Subject: [PATCH 3/8] Don't save default values in Species nor TSGuess dict reprs --- arc/species/species.py | 83 ++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/arc/species/species.py b/arc/species/species.py index 2ae0968a10..8ab01766eb 100644 --- a/arc/species/species.py +++ b/arc/species/species.py @@ -635,17 +635,22 @@ def as_dict(self, dict: The dictionary representation of the object instance. """ species_dict = dict() - species_dict['force_field'] = self.force_field - species_dict['is_ts'] = self.is_ts + if self.force_field != 'MMFF94s': + species_dict['force_field'] = self.force_field + if self.is_ts: + species_dict['is_ts'] = self.is_ts if self.t1 is not None: species_dict['t1'] = self.t1 species_dict['label'] = self.label - species_dict['long_thermo_description'] = self.long_thermo_description + if self.long_thermo_description: + species_dict['long_thermo_description'] = self.long_thermo_description species_dict['multiplicity'] = self.multiplicity if self.multi_species is not None: species_dict['multi_species'] = self.multi_species - species_dict['charge'] = self.charge - species_dict['compute_thermo'] = self.compute_thermo + if self.charge != 0: + species_dict['charge'] = self.charge + if not self.compute_thermo and not self.is_ts: + species_dict['compute_thermo'] = self.compute_thermo if not self.include_in_thermo_lib: species_dict['include_in_thermo_lib'] = self.include_in_thermo_lib species_dict['number_of_rotors'] = self.number_of_rotors @@ -660,23 +665,39 @@ def as_dict(self, if self.neg_freqs_trshed: species_dict['neg_freqs_trshed'] = self.neg_freqs_trshed.tolist() \ if isinstance(self.neg_freqs_trshed, np.ndarray) else self.neg_freqs_trshed - species_dict['arkane_file'] = self.arkane_file - species_dict['consider_all_diastereomers'] = self.consider_all_diastereomers + if self.arkane_file is not None: + species_dict['arkane_file'] = self.arkane_file + if not self.consider_all_diastereomers: + species_dict['consider_all_diastereomers'] = self.consider_all_diastereomers if self.is_ts: - species_dict['ts_guesses'] = [tsg.as_dict() for tsg in self.ts_guesses] - species_dict['ts_conf_spawned'] = self.ts_conf_spawned - species_dict['ts_guesses_exhausted'] = self.ts_guesses_exhausted - species_dict['ts_number'] = self.ts_number - species_dict['ts_report'] = self.ts_report - species_dict['rxn_label'] = self.rxn_label - species_dict['rxn_index'] = self.rxn_index - species_dict['successful_methods'] = self.successful_methods - species_dict['unsuccessful_methods'] = self.unsuccessful_methods - species_dict['chosen_ts_method'] = self.chosen_ts_method - species_dict['chosen_ts'] = self.chosen_ts - species_dict['rxn_zone_atom_indices'] = self.rxn_zone_atom_indices - species_dict['chosen_ts_list'] = self.chosen_ts_list - species_dict['ts_checks'] = self.ts_checks + if len(self.ts_guesses): + species_dict['ts_guesses'] = [tsg.as_dict() for tsg in self.ts_guesses] + if self.ts_conf_spawned: + species_dict['ts_conf_spawned'] = self.ts_conf_spawned + if self.ts_guesses_exhausted: + species_dict['ts_guesses_exhausted'] = self.ts_guesses_exhausted + if self.ts_number is not None: + species_dict['ts_number'] = self.ts_number + if self.ts_report: + species_dict['ts_report'] = self.ts_report + if self.rxn_label is not None: + species_dict['rxn_label'] = self.rxn_label + if self.rxn_index is not None: + species_dict['rxn_index'] = self.rxn_index + if len(self.successful_methods): + species_dict['successful_methods'] = self.successful_methods + if len(self.unsuccessful_methods): + species_dict['unsuccessful_methods'] = self.unsuccessful_methods + if self.chosen_ts_method is not None: + species_dict['chosen_ts_method'] = self.chosen_ts_method + if self.chosen_ts is not None: + species_dict['chosen_ts'] = self.chosen_ts + if self.rxn_zone_atom_indices is not None: + species_dict['rxn_zone_atom_indices'] = self.rxn_zone_atom_indices + if len(self.chosen_ts_list): + species_dict['chosen_ts_list'] = self.chosen_ts_list + if self.ts_checks: + species_dict['ts_checks'] = self.ts_checks if self.original_label is not None: species_dict['original_label'] = self.original_label if self.e_elect is not None: @@ -2143,16 +2164,22 @@ def as_dict(self, for_report: bool = False) -> dict: ts_dict = dict() ts_dict['method'] = self.method ts_dict['method_index'] = self.method_index - ts_dict['method_direction'] = self.method_direction - ts_dict['execution_time'] = str(self.execution_time) if isinstance(self.execution_time, datetime.timedelta) \ - else self.execution_time + if self.method_direction is not None: + ts_dict['method_direction'] = self.method_direction + if self.execution_time is not None: + ts_dict['execution_time'] = str(self.execution_time) if isinstance(self.execution_time, datetime.timedelta) \ + else self.execution_time ts_dict['success'] = self.success - ts_dict['energy'] = self.energy + if self.energy is not None: + ts_dict['energy'] = self.energy ts_dict['index'] = self.index - ts_dict['imaginary_freqs'] = [float(f) for f in self.imaginary_freqs] if self.imaginary_freqs is not None else None + if self.imaginary_freqs is not None: + ts_dict['imaginary_freqs'] = [float(f) for f in self.imaginary_freqs] ts_dict['conformer_index'] = self.conformer_index - ts_dict['successful_irc'] = self.successful_irc - ts_dict['successful_normal_mode'] = self.successful_normal_mode + if self.successful_irc is not None: + ts_dict['successful_irc'] = self.successful_irc + if self.successful_normal_mode is not None: + ts_dict['successful_normal_mode'] = self.successful_normal_mode if self.initial_xyz or for_report: ts_dict['initial_xyz'] = xyz_to_str(self.initial_xyz) if self.opt_xyz or for_report: From 17ae4afdd8842f83be05780592e7025b056cc6b3 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 11:28:21 +0300 Subject: [PATCH 4/8] Tests: Modifications to species tests --- arc/species/species_test.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/arc/species/species_test.py b/arc/species/species_test.py index 508cc3f094..63a00e63bf 100644 --- a/arc/species/species_test.py +++ b/arc/species/species_test.py @@ -625,17 +625,11 @@ def test_as_dict(self): spc_dict = self.spc3.as_dict() expected_dict = {'number_of_rotors': 0, 'multiplicity': 1, - 'arkane_file': None, 'mol': {'atom_order': spc_dict['mol']['atom_order'], 'atoms': spc_dict['mol']['atoms'], 'multiplicity': 1, 'props': {}}, - 'compute_thermo': True, 'label': 'methylamine', 'long_thermo_description': spc_dict['long_thermo_description'], - 'charge': 0, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'bond_corrections': {'C-H': 3, 'C-N': 1, 'H-N': 2}} self.assertEqual(spc_dict, expected_dict) self.assertEqual(len(set([spc_dict['mol']['atoms'][i]['id'] for i in range(len(spc_dict['mol']['atoms']))])), @@ -667,9 +661,7 @@ def test_from_dict(self): self.assertFalse(spc.is_ts) species_dict = { - 'arkane_file': None, 'bond_corrections': {'C-C': 2, 'C-H': 7}, - 'charge': 0, 'cheap_conformer': """C -1.28873024 0.06292844 0.10889819 C 0.01096161 -0.45756396 -0.39342150 C 1.28410310 0.11324608 0.12206177 @@ -680,7 +672,6 @@ def test_from_dict(self): H 2.12255117 -0.53409831 -0.15158596 H 1.26342625 0.19628892 1.21256167 H 1.45962973 1.10366979 -0.30725541""", - 'compute_thermo': True, 'conf_is_isomorphic': True, 'conformer_energies': {-310736.67239208287, -310736.6722398039}, 'conformers': ["""C 1.29970500 0.14644400 0.33188600 @@ -746,7 +737,6 @@ def test_from_dict(self): H -1.52797900 0.06385600 -0.64425600 H -2.14561400 0.28815000 1.00583400 H -1.15029500 1.55122700 0.23360600""", - 'is_ts': False, 'label': 'C3_2', 'long_thermo_description': "Bond corrections: {'C-H': 7, 'C-C': 2}", 'mol': { @@ -2701,18 +2691,13 @@ def test_as_dict(self): tsg_dict = self.tsg1.as_dict() expected_dict = {'method': 'autotst', 'conformer_index': None, - 'imaginary_freqs': None, - 'successful_irc': None, - 'successful_normal_mode': None, - 'energy': None, 'family': 'H_Abstraction', 'index': None, 'rmg_reaction': 'CON=O <=> [O-][N+](=O)C', 'success': None, - 'method_direction': None, 'method_index': None, 't0': None, - 'execution_time': None} + } self.assertEqual(tsg_dict, expected_dict) def test_from_dict(self): @@ -2726,10 +2711,8 @@ def test_from_dict(self): self.assertEqual(tsg.method, 'autotst') self.assertTrue(isinstance(tsg.rmg_reaction, Reaction)) ts_dict_for_report = self.tsg1.as_dict(for_report=True) - self.assertEqual(list(ts_dict_for_report.keys()), - ['method', 'method_index', 'method_direction', 'execution_time', 'success', 'energy', 'index', - 'imaginary_freqs', 'conformer_index', 'successful_irc', 'successful_normal_mode', - 'initial_xyz', 'opt_xyz']) + self.assertEqual(list(ts_dict_for_report.keys()), ['method', 'method_index', 'success', 'index', + 'conformer_index', 'initial_xyz', 'opt_xyz']) def test_process_xyz(self): """Test the process_xyz() method""" From 1289ce148043e927ee7dd15770d10c70151b0cd2 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 00:23:42 +0300 Subject: [PATCH 5/8] Don't save default values in Reaction dict repr --- arc/reaction.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arc/reaction.py b/arc/reaction.py index 9ad7a019d5..84fffc6b6c 100644 --- a/arc/reaction.py +++ b/arc/reaction.py @@ -230,9 +230,11 @@ def as_dict(self, """ reaction_dict = dict() reaction_dict['label'] = self.label - reaction_dict['index'] = self.index + if self.index is not None: + reaction_dict['index'] = self.index reaction_dict['multiplicity'] = self.multiplicity - reaction_dict['charge'] = self.charge + if self.charge != 0: + reaction_dict['charge'] = self.charge reaction_dict['reactants'] = self.reactants reaction_dict['products'] = self.products reaction_dict['r_species'] = [spc.as_dict(reset_atom_ids=reset_atom_ids) for spc in self.r_species] @@ -256,7 +258,8 @@ def as_dict(self, if len(self.ts_xyz_guess): reaction_dict['ts_xyz_guess'] = self.ts_xyz_guess reaction_dict['label'] = self.label - reaction_dict['ts_label'] = self.ts_label + if self.ts_label is not None: + reaction_dict['ts_label'] = self.ts_label return reaction_dict def from_dict(self, From fe5bc3914ae9c91e3f1e285da66ba32d9de5e57b Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 11:28:01 +0300 Subject: [PATCH 6/8] Tests: Modifications to reaction tests --- arc/reaction_test.py | 74 ++++++-------------------------------------- 1 file changed, 10 insertions(+), 64 deletions(-) diff --git a/arc/reaction_test.py b/arc/reaction_test.py index 8636a555e7..51b87cb4a3 100644 --- a/arc/reaction_test.py +++ b/arc/reaction_test.py @@ -167,23 +167,15 @@ def test_as_dict(self): self.rxn1.determine_family(self.rmgdb) rxn_dict_1 = self.rxn1.as_dict() # mol.atoms are not tested since all id's (including connectivity) changes depending on how the test is run. - expected_dict_1 = {'charge': 0, - 'family': 'H_Abstraction', + expected_dict_1 = {'family': 'H_Abstraction', 'family_own_reverse': True, - 'index': None, 'label': 'CH4 + OH <=> CH3 + H2O', 'multiplicity': 2, - 'p_species': [{'arkane_file': None, - 'bond_corrections': {'C-H': 3}, - 'charge': 0, + 'p_species': [{'bond_corrections': {'C-H': 3}, 'cheap_conformer': 'C 0.00000000 0.00000001 -0.00000000\n' 'H 1.06690511 -0.17519582 0.05416493\n' 'H -0.68531716 -0.83753536 -0.02808565\n' 'H -0.38158795 1.01273118 -0.02607927', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'CH3', 'long_thermo_description': "Bond corrections: {'C-H': 3}\n", 'mol': {'atom_order': rxn_dict_1['p_species'][0]['mol']['atom_order'], @@ -192,16 +184,10 @@ def test_as_dict(self): 'props': {}}, 'multiplicity': 2, 'number_of_rotors': 0}, - {'arkane_file': None, - 'bond_corrections': {'H-O': 2}, - 'charge': 0, + {'bond_corrections': {'H-O': 2}, 'cheap_conformer': 'O -0.00032832 0.39781490 0.00000000\n' 'H -0.76330345 -0.19953755 0.00000000\n' 'H 0.76363177 -0.19827735 0.00000000', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'H2O', 'long_thermo_description': "Bond corrections: {'H-O': 2}\n", 'mol': {'atom_order': rxn_dict_1['p_species'][1]['mol']['atom_order'], @@ -211,18 +197,12 @@ def test_as_dict(self): 'multiplicity': 1, 'number_of_rotors': 0}], 'products': ['CH3', 'H2O'], - 'r_species': [{'arkane_file': None, - 'bond_corrections': {'C-H': 4}, - 'charge': 0, + 'r_species': [{'bond_corrections': {'C-H': 4}, 'cheap_conformer': 'C -0.00000000 -0.00000000 0.00000000\n' 'H -0.63306457 -0.78034118 -0.42801448\n' 'H -0.38919244 0.98049560 -0.28294367\n' 'H 0.00329661 -0.09013273 1.08846898\n' 'H 1.01896040 -0.11002169 -0.37751083', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'CH4', 'long_thermo_description': "Bond corrections: {'C-H': 4}\n", 'mol': {'atom_order': rxn_dict_1['r_species'][0]['mol']['atom_order'], @@ -231,15 +211,9 @@ def test_as_dict(self): 'props': {}}, 'multiplicity': 1, 'number_of_rotors': 0}, - {'arkane_file': None, - 'bond_corrections': {'H-O': 1}, - 'charge': 0, + {'bond_corrections': {'H-O': 1}, 'cheap_conformer': 'O 0.00000000 0.00000000 0.61310000\n' 'H 0.00000000 0.00000000 -0.61310000', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'OH', 'long_thermo_description': "Bond corrections: {'H-O': 1}\n", 'mol': {'atom_order': rxn_dict_1['r_species'][1]['mol']['atom_order'], @@ -249,27 +223,18 @@ def test_as_dict(self): 'multiplicity': 2, 'number_of_rotors': 0}], 'reactants': ['CH4', 'OH'], - 'ts_label': None, } self.assertEqual(rxn_dict_1, expected_dict_1) rxn_dict_6 = self.rxn6.as_dict() # The ``long_thermo_description`` attribute isn't deterministic (order could change) - expected_dict_6 = {'charge': 0, - 'index': None, - 'label': 'NH2 + N2H3 <=> NH3 + H2NN[S]', + expected_dict_6 = {'label': 'NH2 + N2H3 <=> NH3 + H2NN[S]', 'multiplicity': 1, - 'p_species': [{'arkane_file': None, - 'bond_corrections': {'H-N': 3}, - 'charge': 0, + 'p_species': [{'bond_corrections': {'H-N': 3}, 'cheap_conformer': 'N 0.00064924 -0.00099698 0.29559292\n' 'H -0.41786606 0.84210396 -0.09477452\n' 'H -0.52039228 -0.78225292 -0.10002797\n' 'H 0.93760911 -0.05885406 -0.10079043', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'NH3', 'long_thermo_description': "Bond corrections: {'H-N': 3}\n", 'mol': {'atom_order': rxn_dict_6['p_species'][0]['mol']['atom_order'], @@ -278,22 +243,16 @@ def test_as_dict(self): 'props': {}}, 'multiplicity': 1, 'number_of_rotors': 0}, - {'arkane_file': None, - 'adjlist': """multiplicity 1 + {'adjlist': """multiplicity 1 1 N u0 p0 c+1 {2,D} {3,S} {4,S} 2 N u0 p2 c-1 {1,D} 3 H u0 p0 c0 {1,S} 4 H u0 p0 c0 {1,S}""", 'bond_corrections': {'H-N': 2, 'N=N': 1}, - 'charge': 0, 'cheap_conformer': 'N -0.08201544 0.01567102 0.28740725\n' 'N 1.12656450 -0.21525765 -0.48621674\n' 'H -0.50742562 -0.72901556 0.83982059\n' 'H -0.53712345 0.92860218 0.29862267', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'H2NN[S]', 'long_thermo_description': rxn_dict_6['p_species'][1]['long_thermo_description'], 'mol': {'atom_order': rxn_dict_6['p_species'][1]['mol']['atom_order'], @@ -304,16 +263,10 @@ def test_as_dict(self): 'number_of_rotors': 0, 'original_label': 'H2NN(S)'}], 'products': ['H2NN[S]', 'NH3'], - 'r_species': [{'arkane_file': None, - 'bond_corrections': {'H-N': 2}, - 'charge': 0, + 'r_species': [{'bond_corrections': {'H-N': 2}, 'cheap_conformer': 'N 0.00016375 0.40059499 0.00000000\n' 'H -0.83170922 -0.19995756 0.00000000\n' 'H 0.83154548 -0.20063742 0.00000000', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'NH2', 'long_thermo_description': "Bond corrections: {'H-N': 2}\n", 'mol': {'atom_order': rxn_dict_6['r_species'][0]['mol']['atom_order'], @@ -322,18 +275,12 @@ def test_as_dict(self): 'props': {}}, 'multiplicity': 2, 'number_of_rotors': 0}, - {'arkane_file': None, - 'bond_corrections': {'H-N': 3, 'N-N': 1}, - 'charge': 0, + {'bond_corrections': {'H-N': 3, 'N-N': 1}, 'cheap_conformer': 'N -0.46751749 0.03795671 0.31180026\n' 'N 0.79325823 -0.46038094 -0.24114357\n' 'H -1.19307188 -0.63034971 0.05027053\n' 'H -0.69753009 0.90231202 -0.17907452\n' 'H 1.56486123 0.15046192 0.05814730', - 'compute_thermo': True, - 'consider_all_diastereomers': True, - 'force_field': 'MMFF94s', - 'is_ts': False, 'label': 'N2H3', 'long_thermo_description': rxn_dict_6['r_species'][1]['long_thermo_description'], 'mol': {'atom_order': rxn_dict_6['r_species'][1]['mol']['atom_order'], @@ -343,7 +290,6 @@ def test_as_dict(self): 'multiplicity': 2, 'number_of_rotors': 0}], 'reactants': ['N2H3', 'NH2'], - 'ts_label': None, } self.assertEqual(rxn_dict_6, expected_dict_6) From 4010cb1d58fed093283f0fd143300bc97f81ecbe Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 09:30:23 +0300 Subject: [PATCH 7/8] Fix incorrect key in TSGuess.from_dict() --- arc/species/species.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc/species/species.py b/arc/species/species.py index 8ab01766eb..af81f40431 100644 --- a/arc/species/species.py +++ b/arc/species/species.py @@ -2218,7 +2218,7 @@ def from_dict(self, ts_dict: dict): else ts_dict['execution_time'] if 'execution_time' in ts_dict else None self.method = ts_dict['method'].lower() if 'method' in ts_dict else 'user guess' self.method_index = ts_dict['method_index'] if 'method_index' in ts_dict else None - self.method_direction = ts_dict['method_direction'] if 'method_index' in ts_dict else None + self.method_direction = ts_dict['method_direction'] if 'method_direction' in ts_dict else None self.imaginary_freqs = ts_dict['imaginary_freqs'] if 'imaginary_freqs' in ts_dict else None self.conformer_index = ts_dict['conformer_index'] if 'conformer_index' in ts_dict else None self.successful_irc = ts_dict['successful_irc'] if 'successful_irc' in ts_dict else None From 728aeea4f322e93e68c486bb04b6bf5901083863 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sat, 29 Jun 2024 14:20:54 +0300 Subject: [PATCH 8/8] Load output from restart_dict only if it exists --- arc/scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc/scheduler.py b/arc/scheduler.py index b41e45925c..1a5a32a8dd 100644 --- a/arc/scheduler.py +++ b/arc/scheduler.py @@ -298,7 +298,7 @@ def __init__(self, for rxn in self.rxn_list: self.rxn_dict[rxn.index] = rxn if self.restart_dict is not None: - self.output = self.restart_dict['output'] + self.output = self.restart_dict['output'] if 'output' in self.restart_dict else dict() self.output_multi_spc = self.restart_dict['output_multi_spc'] if 'output_multi_spc' in self.restart_dict else dict() if 'running_jobs' in self.restart_dict: self.restore_running_jobs()