Skip to content

Conversation

@LeenFahoum
Copy link
Contributor

new hydrolysis families and tests

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some minor initial comments, I think that the commits should first be organized in terms of function definitions (there's a missing """ to one of the docstrings, making other functions hard to read)

spc (ARCSpecies): The species to check.
Returns:
bool: Whether the species is water.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the issue is that there's no closing """ for the docstring

return O_counter == 1 and H_counter == 2


def get_neighbors_by_electronegativity(spc: ARCSpecies,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit deletes the def of another functions

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Leen!
Please see the comments I added

@LeenFahoum
Copy link
Contributor Author

Hi Alon,
I just finished updating the code according to your comments and force-pushed the changes.
Could you please take a look and let me know if any further adjustments are needed?

@LeenFahoum LeenFahoum force-pushed the hydrolysis branch 2 times, most recently from 0440a42 to 2098e03 Compare November 26, 2025 09:28
@LeenFahoum LeenFahoum force-pushed the hydrolysis branch 5 times, most recently from 7df407b to b91616f Compare December 30, 2025 15:45
Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @LeenFahoum for this contribution!
Please see me comments below

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I only added two small comments

alongd and others added 16 commits January 4, 2026 21:29
carbonyl based, nitrile, and ether hydrolysis
carbonyl- based, nitrile, and ether hydrolysis
Adds the following:

1.Reaction setup and family filtering

    -hydrolysis(reaction): Main entry to generate TS guesses for hydrolysis reactions

    -get_products_and_check_families(): Retrieves hydrolysis product data and checks for carbonyl-based and ether hydrolysis families

    -load_hydrolysis_parameters(): Loads family-specific parameters from hydrolysis_families_parameters.yml

2.Reactant and atom index mapping

    -extract_reactant_and_indices(): Identifies reactants and key atomic indices (a, b, e, d, o, h1)

    -process_hydrolysis_reaction(): Extracts water and main reactant from reactants

    -get_neighbors_by_electronegativity(): Ranks neighbors by effective electronegativity, returns the top-ranked and remaining neighbors, excluding a specified atom.

3.Z-matrix setup and geometric manipulation

    -setup_zmat_indices(): Converts XYZ indices to Z-matrix indices

    -process_chosen_d_indices(): Applies bond stretching and generates TS variants with or without dihedral adjustment

    -stretch_ab_bond(): Stretches the a–b bond based on family parameters
     -get_matching_dihedrals(): Identifies dihedral angles in the Z-matrix that involve a specified set of atom indices.

   -Add nitrile fallback second-pass with controlled dihedral adjustment
         - First pass attempts nitrile TSG without forcing dihedral changes 
         - If nitrile hydrolysis is present but no nitrile TSG is formed, run an additional pass that forces dihedral adjustments
         - Stop immediately once at least one nitrile TSG is found OR if all possible dihedral indices were exhausted without producing a valid TSG

   
   -Use fixed factors; try original angle first, flip only if needed
           - Use a fixed defined list of dihedral adjustment factors (instead of previous scattered handling)
           - Apply these factors to modify the original angle first
           - Only attempt the 180° flipped angle if no TS guesses are generated from the original angle variants
           - Improve normalization and docstrings for clarity

4.TS generation and validation

    -process_family_specific_adjustments(): Applies family-specific internal coordinates and generates TS guesses

    -generate_hydrolysis_ts_guess(): Builds TS geometry, validates bonds, collisions, and uniqueness

    -check_ts_bonds(): Validates water bond geometry in TS guess

    -check_dao_angle(): Rejects guesses with near-linear angels for DAO angel

- added is_water method into ARCSpecies as a class method
carbonyl-based, nitrile, and ether hydrolysis
-Allow setting multiple optimization methods via opt_methods

-Default to ['SLSQP', 'Nelder-Mead', 'BFGS'] if not specified

-Handle None values in BEST_GUESSES to prevent errors

-Add function to get sorted distances from a given atom in a molecule
-test_add_atoms_using_internal_coords()

-test_sorted_distances_of_atom() 

-Update formatting of tests and add tests
Raise a ValueError when only one of solvation_method or solvent is defined.
Both must be provided together or both must be None.
Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alongd alongd merged commit 43d59cf into main Jan 5, 2026
6 checks passed
@alongd alongd deleted the hydrolysis branch January 5, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants