Skip to content

Using NewtonNet

geodesic_ts_hess_irc_newtonnet

geodesic_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, logger, clean_up=True)

Perform geodesic, transition state, and intrinsic reaction coordinate (IRC) calculations using NewtonNet.

Parameters:

  • reactant (Atoms) –

    The reactant structure.

  • product (Atoms) –

    The product structure.

  • calc_kwargs1 (dict) –

    Keyword arguments for the ASE calculator for the geodesic and IRC jobs.

  • calc_kwargs2 (dict) –

    Keyword arguments for the ASE calculator for the TS job with custom Hessian.

  • logger (Logger) –

    Logger for logging information.

  • clean_up (bool, default: True ) –

    Whether to clean up raw files after completion, by default True.

Returns:

  • List[Dict[str, Any]]

    List containing results from geodesic, TS, and IRC jobs.

Source code in ts_workflow_examples/geodesic_ts_with_hessian/using_newtonnet.py
def geodesic_ts_hess_irc_newtonnet(
        reactant: Atoms,
        product: Atoms,
        calc_kwargs1: Dict[str, Any],
        calc_kwargs2: Dict[str, Any],
        logger: logging.Logger,
        clean_up: bool = True,
) -> List[Dict[str, Any]]:
    """
    Perform geodesic, transition state, and intrinsic reaction coordinate (IRC) calculations using NewtonNet.

    Parameters
    ----------
    reactant : Atoms
        The reactant structure.
    product : Atoms
        The product structure.
    calc_kwargs1 : dict
        Keyword arguments for the ASE calculator for the geodesic and IRC jobs.
    calc_kwargs2 : dict
        Keyword arguments for the ASE calculator for the TS job with custom Hessian.
    logger : logging.Logger
        Logger for logging information.
    clean_up : bool, optional
        Whether to clean up raw files after completion, by default True.

    Returns
    -------
    List[Dict[str, Any]]
        List containing results from geodesic, TS, and IRC jobs.
    """
    # Create NEB job
    job1 = strip_decorator(geodesic_job)(reactant, product, calc_kwargs=calc_kwargs1)
    logger.info("Created Geodesic job.")

    # Create TS job with custom Hessian
    job2 = strip_decorator(ts_job)(job1['highest_e_atoms'], use_custom_hessian=True, **calc_kwargs2)
    logger.info("Created TS job with custom Hessian.")

    # Create IRC job in forward direction
    job3 = strip_decorator(irc_job)(job2['atoms'], direction='forward', **calc_kwargs1)
    logger.info("Created IRC job in forward direction.")

    # Create IRC job in reverse direction
    job4 = strip_decorator(irc_job)(job2['atoms'], direction='reverse', **calc_kwargs1)
    logger.info("Created IRC job in reverse direction.")

    logger.info("All jobs executed successfully.")

    if clean_up:
        # Delete the raw files
        directory_patterns = ["quacc-*", "tmp*"]

        # Delete directories matching patterns
        for pattern in directory_patterns:
            for dir_path in glob.glob(pattern):
                if os.path.isdir(dir_path):
                    shutil.rmtree(dir_path)

    return [job1, job2, job3, job4]