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
23 stars 1 forks source link

Final modules #34

Closed shihchengli closed 1 year ago

shihchengli commented 2 years ago

Description

This PR enables the current TSConformerGenerator object to run some final modules, including TSOptimizer or TSVerifier, in a different level of theory than the one used for generating TS conformers. Besides, a filter function was added. This function will rank the existing conformers by their energies and users can choose the top N with the lowest energies to be passed for the following steps. The number of reactions to be passed to the following steps of verifiers and final_modules can be defined by giving the values of n_verifies and n_refines when calling the TSConformerGenerator object. The calculation results of final_modules will be saved in a folder called final_modules.

Example

    final_modules = [
        GaussianOptimizer(
            method=args.reopt_method,
            nprocs=args.nprocs,
            memory=args.memory
        ),
        XTBFrequencyVerifier(),
        GaussianIRCVerifier(
            method=args.reopt_method,
            nprocs=args.nprocs,
            memory=args.memory,
            fc_kw="CalcFC,ReCalc=7"
        )
    ]

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

    _ = ts_gen(args.n_ts_conformers, args.n_ts_verifies, args.n_ts_refines)

where the args.reopt_method is the method used for further reoptimization and verification for conformers obtained from lower-accuracy calculations, args.n_ts_verifies and args.n_ts_refines are the values of n_verifies and n_refines passed to the TSConformerGenerator object.