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

Hydrolysis families and tests #770

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
cd22e16
Minor: CI style modifications
alongd Jun 29, 2024
8360e04
Minor: Fixed typo in Arkane test
alongd Dec 28, 2024
a4bc672
Minor: Removed debug print from species test
alongd Dec 28, 2024
db1c9b7
Minor: Modifications to ARC's executable
alongd Dec 28, 2024
1c9087f
Minor: Style modifications to mapping engine
alongd Dec 7, 2024
79a8fcd
Removed RMG-Py and RMG-database repo paths from common
alongd Jul 1, 2024
bc2e986
Relocated reaction into a sub module
alongd Jun 29, 2024
0745e3b
Added RMG_DB_PATH to settings
alongd Jul 2, 2024
9b6d609
Added clean_text() to common
alongd Jun 29, 2024
b0661f8
Tests: common.clean_text()
alongd Jun 29, 2024
2e25650
Added hydrolysis as an ARC reaction family
alongd Jul 2, 2024
d916add
Added the family module
alongd Jul 2, 2024
8def1c8
Tests: Added family tests
alongd Jul 2, 2024
c35814f
Removed rmgdb from reaction
alongd Jul 2, 2024
b9793a7
Tests: Adaptations to reaction tests
alongd Jul 2, 2024
3ec81c1
Corrected import in arkane test
alongd Jul 2, 2024
a940871
Don't consider additional TS conformers if there's just one
alongd Jul 3, 2024
d3c545f
Removed the determine_family() function from the rmgdb module
alongd Jul 3, 2024
844a26f
Don't use RMGDatabase to determine reaction family
alongd Jul 3, 2024
81a3d0c
Tests: Removed RMGDatabase from tests
alongd Jul 3, 2024
4e4430f
Modifications to how reaction family is used in ARC
alongd Jul 3, 2024
8ae1e84
Make family a property of reaction
alongd Jul 3, 2024
2935222
Tests: Adaptations to ARC tests
alongd Jul 3, 2024
e2529ee
Modifications to Scheduler
alongd Dec 7, 2024
1f9f17d
Removed the rmgdb module
alongd Dec 7, 2024
e665628
TMP: commented out NMD tests, they are dealt with in a different PR
alongd Dec 7, 2024
7386f06
TMP: Skip NMD in ts check, it is dealt with in a different PR
alongd Dec 7, 2024
a076910
Removed unnecessary functions from mapping engine
alongd Dec 7, 2024
e00107e
Removed _check_r_n_p_symbols_between_rmg_and_arc_rxns from common
alongd Dec 28, 2024
0ec2009
Updated Heuristics TS search
alongd Dec 28, 2024
815bb52
Removed rmgdb from main
alongd Dec 28, 2024
6f3960e
Tests: Updated heuristics tests
alongd Dec 28, 2024
caa7ab8
Modifications to mapping engine
alongd Dec 28, 2024
ea5df51
Tests: Modifications to mapping engine tests
alongd Dec 28, 2024
370bab0
Modifications to mapping driver
alongd Dec 28, 2024
b6d2c76
Tests: Modifications to mapping driver tests
alongd Dec 28, 2024
c098bff
Tests: Modifications to reaction tests
alongd Dec 28, 2024
748cee4
Added check_molecule_list_order() to species converter
alongd Dec 28, 2024
8ee1df3
Added RMG thermo and kinetics scripts
alongd Dec 28, 2024
bc84c2f
Modified the trype of the species rmg_thermo attribute
alongd Dec 28, 2024
b421593
Modified the type of the Reaction rmg_kinetics attribute
alongd Dec 28, 2024
6ec7b58
Updated processor to use RMG's scripts instead of RMG's API
alongd Dec 28, 2024
b6e1885
Updated plotter for RMG's parsed data
alongd Dec 28, 2024
cb5288b
Tests: Updated H atomtype in common tests to H0
alongd Dec 28, 2024
232fc81
Removed rmg_reaction from reaction
alongd Jan 5, 2025
94feced
Tests: Removed rmg_reaction from reaction tests
alongd Jan 5, 2025
f56c112
Tests: Minor: Fix isotope SMILES in conformers tests
alongd Jan 5, 2025
24ef5b0
Removed utilization of .rmg_reaction from ARC's modules
alongd Jan 5, 2025
6e4ebf8
Todo: fix plotter
alongd Jan 5, 2025
223de60
tmp cache
alongd Jan 5, 2025
dd2799c
f autotst ts
alongd Jan 8, 2025
48fcba5
tmp cache
alongd Jan 8, 2025
0c2a969
f kinbot tst
alongd Jan 8, 2025
76a7b41
Check species type in Reaction
alongd Jan 8, 2025
b3fc0c8
f scripts
alongd Jan 8, 2025
f17190e
Added calculate_arrhenius_rate_coefficient() to common
alongd Jan 8, 2025
1c55fb4
Tests: calculate_arrhenius_rate_coefficient
alongd Jan 8, 2025
7181fdf
Updated plotter to use calculate_arrhenius_rate_coefficient()
alongd Jan 12, 2025
baabf90
f common
alongd Jan 12, 2025
55d7b11
f plotter
alongd Jan 12, 2025
da7eef4
f processor
alongd Jan 12, 2025
e371839
f reation
alongd Jan 12, 2025
f643f72
TMP
alongd Jan 12, 2025
20e1318
f rxn
alongd Jan 12, 2025
f037468
TMP
alongd Jan 29, 2025
93ff11a
Exclude hidden and underscore files from ARC families list
LeenFahoum Feb 3, 2025
c7cc0c8
Added different hydrolysis arc families groups
LeenFahoum Feb 3, 2025
c2d3d8d
Added tests for arc families groups
LeenFahoum Feb 3, 2025
2b4492f
Added is_water function
LeenFahoum Feb 3, 2025
c616d3b
test for is_water function
LeenFahoum Feb 3, 2025
90cf784
Add electronegativity-based neighbor selection and YAML data
LeenFahoum Feb 5, 2025
9197474
tests for get_neighbors_by_electronegativity()
LeenFahoum Feb 5, 2025
5eedfdd
Add functions to retrieve, and count matching dihedral angles
LeenFahoum Feb 6, 2025
522387c
tests for all dihedral functions
LeenFahoum Feb 6, 2025
54ac6f1
Add TS guess generation for hydrolysis reaction families
LeenFahoum Feb 6, 2025
7dbcbd2
Add unit tests for TS guess generation in hydrolysis reaction families
LeenFahoum Feb 6, 2025
e86ce34
Minor update in ether hydrolysis family definition
LeenFahoum Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/cont_int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
- name: Cache RMG-Py
id: cache-rmg-py
uses: actions/cache@v2
env:
CACHE_NUMBER: 2
with:
path: RMG-Py
key: ${{ runner.os }}-rmg-main
Expand All @@ -55,6 +57,8 @@ jobs:
- name: Cache RMG-database
id: cache-rmg-db
uses: actions/cache@v2
env:
CACHE_NUMBER: 2
with:
path: RMG-database
key: ${{ runner.os }}-rmgdb-main
Expand Down Expand Up @@ -102,7 +106,7 @@ jobs:
path: TS-GCN
ref: main
fetch-depth: 1

- name: Cache KinBot
id: cache-kinbot
uses: actions/cache@v2
Expand All @@ -129,7 +133,7 @@ jobs:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}

- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v3
with:
Expand Down Expand Up @@ -164,14 +168,14 @@ jobs:
echo 'export PATH=$PATH:'"$(pwd)" >> ~/.bashrc
make
cd ..

- name: Set ARC Path
run: |
echo 'export PYTHONPATH=$PYTHONPATH:'"$(pwd)" >> $GITHUB_ENV
echo 'export PATH=$PATH:'"$(pwd)" >> $GITHUB_ENV
echo 'export PYTHONPATH=$PYTHONPATH:'"$(pwd)" >> ~/.bashrc
echo 'export PATH=$PATH:'"$(pwd)" >> ~/.bashrc

- name: Install AutoTST
run: |
cd AutoTST
Expand All @@ -183,7 +187,7 @@ jobs:
# install pyaml
conda install -n tst_env -c conda-forge -y pyyaml
cd ..

- name: Install TS-GCN
run: |
cd TS-GCN
Expand All @@ -194,7 +198,7 @@ jobs:
bash devtools/create_env_cpu.sh
conda env update -n ts_gcn -f environment.yml
cd ..

- name: Install KinBot
run: |
cd KinBot
Expand All @@ -218,13 +222,13 @@ jobs:
- name: Install Torch Ani
run: |
conda env create -f devtools/tani_environment.yml

- name: Install XTB
run: |
conda env create -f devtools/xtb_environment.yml

- name: Test with pytest
shell: bash -el {0}
shell: bash -el {0}
run: |
source ~/.bashrc
conda activate arc_env
Expand All @@ -248,4 +252,4 @@ jobs:
flags: unittests
name: codecov-umbrella
verbose: true
fail_ci_if_error: false
fail_ci_if_error: false
4 changes: 1 addition & 3 deletions ARC.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def parse_command_line_arguments(command_line_args=None):
command_line_args: The command line arguments.

Returns:
The parsed command-line arguments by key words.
The parsed command-line arguments by keywords.
"""

parser = argparse.ArgumentParser(description='Automatic Rate Calculator (ARC)')
parser.add_argument('file', metavar='FILE', type=str, nargs=1,
help='a file describing the job to execute')
Expand All @@ -45,7 +44,6 @@ def main():
"""
The main ARC executable function
"""

args = parse_command_line_arguments()
input_file = args.file
project_directory = os.path.abspath(os.path.dirname(args.file))
Expand Down
2 changes: 2 additions & 0 deletions arc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import arc.utils

import arc.job
import arc.family
import arc.reaction
import arc.settings
import arc.species
import arc.statmech
79 changes: 3 additions & 76 deletions arc/checks/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import numpy as np
from typing import TYPE_CHECKING, List, Optional, Tuple, Union

import arc.rmgdb as rmgdb
from arc import parser
from arc.common import (ARC_PATH,
convert_list_index_0_to_1,
Expand All @@ -20,9 +19,6 @@
)
from arc.imports import settings
from arc.species.converter import check_xyz_dict, displace_xyz, xyz_to_dmat
from arc.mapping.engine import (get_atom_indices_of_labeled_atoms_in_an_rmg_reaction,
get_rmg_reactions_from_arc_reaction,
)
from arc.statmech.factory import statmech_factory

if TYPE_CHECKING:
Expand Down Expand Up @@ -300,73 +296,7 @@ def check_normal_mode_displacement(reaction: 'ARCReaction',
job (JobAdapter): The frequency job object instance.
amplitudes (Union[float, List[float]], optional): The factor(s) multiplication for the displacement.
"""
if job is None:
return
if reaction.family is None:
rmgdb.determine_family(reaction)
amplitudes = amplitudes or [0.1, 0.2, 0.4, 0.6, 0.8, 1]
amplitudes = [amplitudes] if isinstance(amplitudes, float) else amplitudes
reaction.ts_species.ts_checks['NMD'] = False
rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=reaction) or list()
freqs, normal_modes_disp = parser.parse_normal_mode_displacement(path=job.local_path_to_output_file, raise_error=False)
if not len(normal_modes_disp):
return
largest_neg_freq_idx = get_index_of_abs_largest_neg_freq(freqs)
bond_lone_hs = any(len(spc.mol.atoms) == 2 and spc.mol.atoms[0].element.symbol == 'H'
and spc.mol.atoms[0].element.symbol == 'H' for spc in reaction.r_species + reaction.p_species)
# bond_lone_hs = False
xyz = parser.parse_xyz_from_file(job.local_path_to_output_file)
if not xyz['coords']:
xyz = reaction.ts_species.get_xyz()

done = False
for amplitude in amplitudes:
xyz_1, xyz_2 = displace_xyz(xyz=xyz, displacement=normal_modes_disp[largest_neg_freq_idx], amplitude=amplitude)
dmat_1, dmat_2 = xyz_to_dmat(xyz_1), xyz_to_dmat(xyz_2)
dmat_bonds_1 = get_bonds_from_dmat(dmat=dmat_1,
elements=xyz_1['symbols'],
tolerance=1.5,
bond_lone_hydrogens=bond_lone_hs)
dmat_bonds_2 = get_bonds_from_dmat(dmat=dmat_2,
elements=xyz_2['symbols'],
tolerance=1.5,
bond_lone_hydrogens=bond_lone_hs)
got_expected_changing_bonds = False
for i, rmg_reaction in enumerate(rmg_reactions):
r_label_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=reaction,
rmg_reaction=rmg_reaction)[0]
if r_label_dict is None:
continue
expected_breaking_bonds, expected_forming_bonds = reaction.get_expected_changing_bonds(r_label_dict=r_label_dict)
if expected_breaking_bonds is None or expected_forming_bonds is None:
continue
got_expected_changing_bonds = True
breaking = [determine_changing_bond(bond, dmat_bonds_1, dmat_bonds_2) for bond in expected_breaking_bonds]
forming = [determine_changing_bond(bond, dmat_bonds_1, dmat_bonds_2) for bond in expected_forming_bonds]
if len(breaking) and len(forming) \
and not any(entry is None for entry in breaking) and not any(entry is None for entry in forming) \
and all(entry == breaking[0] for entry in breaking) and all(entry == forming[0] for entry in forming) \
and breaking[0] != forming[0]:
reaction.ts_species.ts_checks['NMD'] = True
done = True
break
if not got_expected_changing_bonds and not reaction.ts_species.ts_checks['NMD']:
reaction.ts_species.ts_checks['warnings'] += 'Could not compare normal mode displacement to expected ' \
'breaking/forming bonds due to a missing RMG template; '
reaction.ts_species.ts_checks['NMD'] = True
break
if not len(rmg_reactions):
# Just check that some bonds break/form, and that this is not a torsional saddle point.
warning = f'Cannot check normal mode displacement for reaction {reaction} since a corresponding ' \
f'RMG template could not be generated'
logger.warning(warning)
reaction.ts_species.ts_checks['warnings'] += warning + '; '
if any(bond not in dmat_bonds_2 for bond in dmat_bonds_1) \
or any(bond not in dmat_bonds_1 for bond in dmat_bonds_2):
reaction.ts_species.ts_checks['NMD'] = True
break
if done:
break
reaction.ts_species.ts_checks['NMD'] = True


def determine_changing_bond(bond: Tuple[int, ...],
Expand Down Expand Up @@ -539,14 +469,11 @@ def get_rxn_normal_mode_disp_atom_number(rxn_family: Optional[str] = None,
if rms_list is not None \
and (not isinstance(rms_list, list) or not all(isinstance(entry, float) for entry in rms_list)):
raise TypeError(f'rms_list must be a non empty list, got {rms_list} of type {type(rms_list)}.')
family = rxn_family
if family is None and reaction is not None and reaction.family is not None:
family = reaction.family.label
if family is None:
if reaction.family is None:
logger.warning(f'Cannot deduce a reaction family for {reaction}, assuming {default} atoms in the reaction zone.')
return default
content = read_yaml_file(os.path.join(ARC_PATH, 'data', 'rxn_normal_mode_disp.yml'))
number_by_family = content.get(rxn_family, default)
number_by_family = content.get(rxn_family or reaction.family, default)
if rms_list is None or not len(rms_list):
return number_by_family
entry = None
Expand Down
Loading
Loading