xiaoruiDong / RDMC

Reaction Data and Molecular Conformers (RDMC) is a package dealing with reactions, molecules, conformers, majorly in 3D.
https://xiaoruidong.github.io/RDMC/
MIT License
22 stars 1 forks source link

Support DE-GSM method for TS guess #37

Closed shihchengli closed 1 year ago

shihchengli commented 1 year ago

Description

This PR enables the generation of TS guesses using the DE-GSM method. The modified version of gsm program ((https://github.com/ZimmermanGroup/pyGSM) to support Gaussian quantum chemistry software has been added in RDMC. You can install gsm via PyPi by pip install pygsm-gaussian.

Example

        rxn_data = all_rxns.iloc[rxn_idx]
        rxn_smiles = rxn_data["rsmi"] + ">>" + rxn_data["psmi"]
        embedder = DEGSMGuesser(args.opt_method, args.nprocs, args.memory, args.gsm_args)
        optimizer = GaussianOptimizer(
            method=args.opt_method,
            nprocs=args.nprocs,
            memory=args.memory
        )
        pruner = None
        verifiers = [
            XTBFrequencyVerifier(),
            GaussianIRCVerifier(
                method=args.opt_method,
                nprocs=args.nprocs,
                memory=args.memory,
                fc_kw="CalcFC,ReCalc=7"
            )
        ]
        save_dir = os.path.join(args.exp_dir, str(rxn_idx))
        if os.path.exists(save_dir):
            continue

        ts_gen = TSConformerGenerator(
            rxn_smiles=rxn_smiles,
            embedder=embedder,
            optimizer=optimizer,
            pruner=pruner,
            verifiers=verifiers,
            save_dir=save_dir,
            use_smaller_multiplicity=False
        )

        _ = ts_gen(args.n_ts_conformers)

where the gsm_args is the additional argument you can specify when running gsm program. For example, if you don't want the reactants and products to be preoptimized before running DE-GSM, you can use "-reactant_geom_fixed -product_geom_fixed".

PattanaikL commented 1 year ago

DEGSM is only supported for Orca? Is it possible to make it work with Gaussian or is that a limitation of the package from Zimmerman?

shihchengli commented 1 year ago

It supports a bunch of different quantum chemistry packages ("QChem", "Orca", "Molpro", "PyTC", "TeraChemCloud", "OpenMM", "DFTB", "TeraChem", "BAGEL", "xTB_lot", "ase") as mentioned in here. Unfortunately, it doesn't support Gaussian. I think it is not difficult to support Gaussian in pyGSM package, pyGSM just needs to know how to get the forces of each atom from force calculation. I can write this code and do a PR in pyGSM. Hopefully, they would accept the PR.

PattanaikL commented 1 year ago

Now that we've ported all the pygsm code to external, do we still need to run setup.py for pygem? If we don't run setup.py, running pygsm will return an error since the gsm binary cannot be located.

shihchengli commented 1 year ago

The setup.py is needed to run so the entry point of pygsm can be settled up. The gsm is actually not a binary program but an entry point. I will fix this error message soon. By the way, I have published pygsm-gaussian on PyPi (https://pypi.org/project/pygsm-gaussian/). If you think installing it via PyPi would be more appropriate, I can remove the external part in this PR.

PattanaikL commented 1 year ago

Oh wow, nice work! I'm not sure if PyPi or external would be preferable. Perhaps the former, just so the RDMC repo is a bit cleaner. But I'll defer to @xiaoruiDong on this one

xiaoruiDong commented 1 year ago

Oh wow, nice work! I'm not sure if PyPi or external would be preferable. Perhaps the former, just so the RDMC repo is a bit cleaner. But I'll defer to @xiaoruiDong on this one

Haha, it is actually my suggestion to @shihchengli to build a PyPi or conda package. Since Lucky and I both agree on this, can @shihchengli change the PR accordingly? Thank you!

shihchengli commented 1 year ago

@PattanaikL @xiaoruiDong Thanks! The change has been made accordingly.