openforcefield / openff-benchmark

Comparison benchmarks between public force fields and Open Force Field Initiative force fields
MIT License
11 stars 2 forks source link

Incorporation of Schrodinger optimization #63

Closed dfhahn closed 3 years ago

dfhahn commented 3 years ago

Description

This PR introduces the building of custom OPLS3e parameters and optimization of conformers with Schrodinger tools

Installation of schrodinger command group in a dev environment

First, follow the installation procedures for the openff-benchmark-optimization environment described in Deployment Procedure document

Once this is done, you can clone the environment into a development environment:

conda create -n openff-benchmark-dev --clone openff-benchmark-optimization
conda activate openff-benchmark-dev

Install the schrodinger branch from github:

git clone https://github.com/openforcefield/openff-benchmark
cd openff-benchmark
git checkout --track origin/schrodinger
pip install -e .

Docs

General help about new command group: openff-benchmark schrodinger --help

General comments

The schrodinger command group needs access to Schrodinger binaries. They will try to use the SCHRODINGER environment variable. If it is not set, the path to the Schrodinger binaries can be set in the --schrodinger-path command line option of the following commands.

Additionally, the OPLS3e force field makes use of custom parameters. The custom parameter directory can be set with the --opls-dir command line option.

The commands ffbuilder and optimize have the additional options to set --host and --max-jobs. With the --host option, you can specify the host (queue) on which the ffbuilder or optimization should be run. The name of the host has to be specified in your schrodinger.hosts configuration file. With --max-jobs, you can set the maximal number of parallel subjobs run on the host. If these options are not specified, default settings will be used.

Step 1: Build custom parameters

Start up a ffbuilder custom parameter calculation using default arguments and the QM optimized molecules:

openff-benchmark schrodinger ffbuilder [--opls-dir ~/.schrodinger/opls_dir] 4-compute-qm/b3lyp-d3bj/dzvp/

It takes into account already available custom parameters in the path given as the option --opls-dir. If --opls-dir is not given or the specified path is not available (i.e. if you are a new user), all parameters will be calculated from scratch. If you run the ffbuilder for the first time and don't have custom parameters yet, do not specify the --opls-dir as this will lead to an error. The same counts if you used OPLS3e before and run the ffbuilder for the first time with OPLS4. The command will create a ffbuilder job ffb_openff_benchmark in the directory 7-schrodinger-ffb. If there are already output files in the output directory, they will be moved to a backup directory 7-schrodinger-ffb/ffb_openff_benchmark.bk[.x] and previously build custom parameters will be automatically merged with the custom parameter path. The output directory can be changed with the -o/--output-path option.

Now you have to wait until the ffbuilder job has finished. You can check the progress of the calculations in the file 7-schrodinger-ffb/ffb_openff_benchmark.log.

Note: You might realize that the ffbuilder input file ffb_input.sdf includes less conformers than you gave as an input. That is correct as the ffbuilder needs only one conformer per molecule.

Step 2: Merge parameters in custom parameter path

This command merges the newly built parameters to your custom parameter path.

openff-benchmark schrodinger ffmerge 7-schrodinger-ffb

The input path must be the output path of step 1. The custom parameters path can be specified with the option --opls-dir, which defaults to ~/.schrodinger/opls_dir/. If the specified or the default --opls-dir does not exist, the directory will be created and initialized. This could be the case if you are a new user or you want to create a separate custom parameter directory.

Step 3a: Run optimization without custom parameters

Optimization using OPLS3e using NO custom parameters:

openff-benchmark schrodinger optimize 4-compute-qm/b3lyp-d3bj/dzvp/

This will create a Schrodinger macromodel optimization run in the directory 8-schrodinger-mm-default. The latter directory can be changed with the -o/--output-path option. If the directory already exists and you want to replace the data, you need to run the command with the option --delete-existing.

Step 3b: Run optimization with custom parameters

By adding a custom parameter path to the optimize command, the optimization will use OPLS3e with custom parameters. Warning: If you have not built the custom parameters correctly and merged them to your custom parameter path, (steps 1 and 2), the command will use the available custom parameters, but the newly built parameters will be missing.

openff-benchmark schrodinger optimize --opls-dir ${HOME}/.schrodinger/opls_dir 4-compute-qm/b3lyp-d3bj/dzvp/

This will create a Schrodinger macromodel optimization run in the directory 9-schrodinger-mm-custom. The latter directory can be changed with the -o/--output-path option. If the directory already exists and you want to replace the data, you need to run the command with the option --delete-existing.

Step 4: Postprocessing

The output files mmod_output.maegz in the respective directories will be postprocessed with the commands:

openff-benchmark schrodinger postprocess -o 4-compute-mm 8-schrodinger-mm-default/mmod_output.maegz

and

openff-benchmark schrodinger postprocess -o 4-compute-mm 9-schrodinger-mm-custom/mmod_output.maegz

This will save the postprocessed SDF files in 4-compute-mm/opls3e_default or 4-compute-mm/opls3e_custom. If these directories exist already and you want to replace the data, you need to run the commands with the option --delete-existing.

Hint: The last two commands can be run together: openff-benchmark schrodinger postprocess -o 4-compute-mm 8-schrodinger-mm-default/mmod_output.maegz 9-schrodinger-mm-custom/mmod_output.maegz )

The respective output directories can be included in the final analysis steps.

Todos

Questions

Status

codecov-io commented 3 years ago

Codecov Report

Merging #63 (2891ce2) into master (c814daa) will decrease coverage by 2.55%. The diff coverage is 34.11%.

dotsdl commented 3 years ago

Thank you for getting this up @dfhahn! I'll be reviewing this, but we will also seek testing help with Bill. Please let me know when you have set up a call with him to try things out on his infrastructure.

j-wags commented 3 years ago

@dfhahn, if I have some time, is this ready for my to try out? Are there particular code segments/commands that I can provide feedback on?

dfhahn commented 3 years ago

@j-wags , I just pushed some changes. Now it is ready to be tried out! Just try to follow the protocol above and let be know about encountered issues or suggestions for improvements.

codecov-commenter commented 3 years ago

Codecov Report

Merging #63 (6d7e54e) into master (5b26466) will decrease coverage by 2.39%. The diff coverage is 68.44%.

j-wags commented 3 years ago

This PR has been superseded by #84, which targets a merge into the season-1 branch, so that the schrodinger functionality can continue using the openforcefield namespace.