Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute thermo #140

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions t3/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,8 @@ def log_species_to_calculate(self,
Args:
species_keys (List[int]): Entries are T3 species indices.
species_dict (dict): The T3 species dictionary.

Todo:
Log the reasons one by one with line breaks and enumerate
"""
if len(species_keys):
if len(species_keys) and any(spc_dict['compute_thermo'] for spc_dict in species_dict.values()):
self.info('\n\nSpecies to calculate thermodynamic data for:')
max_label_length = max([len(spc_dict['QM label'])
for key, spc_dict in species_dict.items() if key in species_keys])
Expand All @@ -193,6 +190,8 @@ def log_species_to_calculate(self,
self.info(f'-----{space1} ------{space2} -----------------------------')
for key in species_keys:
spc_dict = species_dict[key]
if not spc_dict['compute_thermo']:
continue
smiles = spc_dict['object'].molecule[0].to_smiles()
space1 = ' ' * (max_label_length - len(spc_dict['QM label']) + 1)
space2 = ' ' * (max_smiles_length - len(smiles) + 1)
Expand Down
18 changes: 16 additions & 2 deletions t3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def execute(self):
self.run_arc(arc_kwargs=self.qm)
self.process_arc_run()
if not additional_calcs_required and self.iteration >= len(self.rmg['model']['core_tolerance']):
# T3 iterated through all of the user requested tolerances, and there are no more calculations required
# T3 iterated through all the user requested tolerances, and there are no more calculations required
break

if self.check_overtime():
Expand Down Expand Up @@ -1231,6 +1231,7 @@ def load_species_and_reactions_from_chemkin_file(self) -> Tuple[List[Species], L
def add_species(self,
species: Species,
reasons: Union[List[str], str],
compute_thermo: bool = True,
) -> Optional[int]:
"""
Add a species to self.species and to self.qm['species'].
Expand All @@ -1239,6 +1240,7 @@ def add_species(self,
Args:
species (Species): The species to consider.
reasons (Union[List[str], str]): Reasons for calculating this species.
compute_thermo (bool, optional): Whether to compute thermo for this species (default: ``True``).

Returns:
Optional[int]: The T3 species index (the respective self.species key) if the species was just added,
Expand All @@ -1256,6 +1258,7 @@ def add_species(self,
'reasons': reasons,
'converged': None,
'iteration': self.iteration,
'compute_thermo': compute_thermo,
}

# Check whether T3 has xyz information for this species, if so process it.
Expand All @@ -1274,7 +1277,7 @@ def add_species(self,
xyzs.append(xyz_dict)
if len(xyzs):
if self.qm['adapter'] == 'ARC':
# Make qm_species and ARCSpecies instance to consider the xyz information
# Make qm_species an ARCSpecies instance to consider the xyz information
qm_species = ARCSpecies(label=qm_species.label,
rmg_species=qm_species,
xyz=xyzs,
Expand All @@ -1283,6 +1286,17 @@ def add_species(self,
else:
raise NotImplementedError(f"Passing XYZ information to {self.qm['adapter']} "
f"is not yet implemented.")
if not self.species_requires_refinement(qm_species):
if isinstance(qm_species, ARCSpecies):
qm_species.compute_thermo = False
qm_species.include_in_thermo_lib = False
else:
qm_species = ARCSpecies(label=qm_species.label,
rmg_species=qm_species,
xyz=None,
compute_thermo=False,
include_in_thermo_lib=False,
)
self.qm['species'].append(qm_species)
return key

Expand Down