Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor wrapper and add Gromacs support #140

Merged
merged 32 commits into from
Oct 8, 2020
Merged

Refactor wrapper and add Gromacs support #140

merged 32 commits into from
Oct 8, 2020

Conversation

jeff231li
Copy link
Collaborator

@jeff231li jeff231li commented Sep 26, 2020

This PR refactors the Amber simulation wrapper module paprika/amber.py and adds a new wrapper for Gromacs. Simulation wrappers are now stored in paprika/simulate.py.

from paprika.simulate import Amber
simulation = Amber()

from paprika.simulate import Gromacs
simulation = Gromacs()

Also added a small function in tleap.System to convert Amber prmtop/rst7 to Gromacs top/gro format.

Question: do you think it's better to have all caps for the simulation wrapper class name?

EDIT: I've made simulation class names all caps.

TODO

  • Compare Amber and Gromacs results for CB6-BUT-TIP3P system.

Status

  • Ready to go

@jeff231li jeff231li changed the title Refactor simulation wrapper and add Gromacs support Refactor wrapper and add Gromacs support Sep 26, 2020
@jeff231li jeff231li requested a review from slochower September 26, 2020 07:07
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2020

Codecov Report

Merging #140 into master will decrease coverage by 2.92%.
The diff coverage is 39.92%.

Copy link
Member

@slochower slochower left a comment

Choose a reason for hiding this comment

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

Do we have to change the openff-evaluator paprika protocol in light of this?

paprika/tleap.py Outdated Show resolved Hide resolved
Copy link
Member

@slochower slochower left a comment

Choose a reason for hiding this comment

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

I didn't run through the tutorial, so I trust that it works.

However, it struck me that perhaps we should create a simplified workflow because not every step is obvious. This could live in the documentation. For example, I noticed after converting the System to Gromacs, format you do:

    # Add dummy atom restraints - load in the Gromacs files instead 
    # of the amber files because the coordinates a shifted.
    structure = pmd.load_file(
        os.path.join(work_dir, window, f"{base_name}-sol.top"),
        xyz=os.path.join(work_dir, window, f"{base_name}-sol.gro"), 
        structure=True
    )
    plumed.add_dummy_atoms_to_file(structure,window=window)

...and I was thinking to myself, how would someone know to do this? It seems like the dummy atoms are in the structure already, because tleap is adding them, but I guess they still need to be added? (Also, should add_dummy_atoms_to_file be renamed to add_dummy_atoms_to_structure)?

Maybe the workflow could look something like:

  1. Setup the complex for the calculation by creating a bound pose and aligning it.
  2. Determine the number of windows for the umbrella sampling (attach, pull, and release phases of the calculation).
  3. Setup the restraints.
  4. Create the windows.
  5. Write the restraints to a file in each window (either AMBER-format or PLUMED-format).
  6. Create coordinates for all windows.
  7. Solvate the complex in each window and add dummy atoms. (Is this how you'd phrase things?)
  8. If using PLUMED, add dummy atoms to the restraint file (??)
    [...etc...]

What do you think?

@jeff231li
Copy link
Collaborator Author

Do we have to change the openff-evaluator paprika protocol in light of this?

I don't think we need to change the openff-evaluator protocol, this protocol is self-contained. I think if we change analysis.py and restraints/restraints.py then we will have to adapt the openff-evaluator protocol.

@jeff231li
Copy link
Collaborator Author

(Also, should add_dummy_atoms_to_file be renamed to add_dummy_atoms_to_structure)?

Hmm, maybe add_dummy_atom_restraints would be more accurate as we are adding positional restraints on the dummy atoms.

However, it struck me that perhaps we should create a simplified workflow because not every step is obvious
...and I was thinking to myself, how would someone know to do this?

Yeah, I agree that the workflow/protocol of doing APR calculations with pAPRika is not clear. I am planning on adding more info to the documentation and maybe have a flowchart diagram to demonstrate this.

  1. Solvate the complex in each window and add dummy atoms. (Is this how you'd phrase things?)

The dummy atoms are already added with tleap it's just that the positional restraints on the dummy atoms require absolute coordinates, unlike all the other restraints. When tleap solvates the host-guest-dum system in vacuum, the program shifts the coordinates. This is not a problem when we run Amber simulations because we take care of the dummy atom restraints in the simulation config file.

@slochower
Copy link
Member

Hmm, maybe add_dummy_atom_restraints would be more accurate as we are adding positional restraints on the dummy atoms.

I think that is a bit more explicit.

Yeah, I agree that the workflow/protocol of doing APR calculations with pAPRika is not clear. I am planning on adding more info to the documentation and maybe have a flowchart diagram to demonstrate this.

+1

The dummy atoms are already added with tleap it's just that the positional restraints on the dummy atoms require absolute coordinates, unlike all the other restraints. When tleap solvates the host-guest-dum system in vacuum, the program shifts the coordinates. This is not a problem when we run Amber simulations because we take care of the dummy atom restraints in the simulation config file.

This makes sense. I think I didn't totally appreciate the distinction before.

@slochower
Copy link
Member

The binding free-energy for CB6-BUT-TIP3P:

image

@slochower LGTM?

I'll give it another once-over tomorrow.

docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
@slochower
Copy link
Member

Do we need to upload the tutorial/complex files? That's going to make this repo heavyweight. Can we not just load the relevant files from ../data and not save tutorial-generated files?

docs/workflow.rst Outdated Show resolved Hide resolved
docs/workflow.rst Outdated Show resolved Hide resolved
docs/workflow.rst Outdated Show resolved Hide resolved
docs/workflow.rst Outdated Show resolved Hide resolved
docs/workflow.rst Outdated Show resolved Hide resolved
docs/workflow.rst Outdated Show resolved Hide resolved
Copy link
Member

@slochower slochower left a comment

Choose a reason for hiding this comment

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

Looks pretty good. I added a bunch of comments about minor wording changes, mostly in the documentation.

@jeff231li
Copy link
Collaborator Author

Do we need to upload the tutorial/complex files? That's going to make this repo heavyweight. Can we not just load the relevant files from ../data and not save tutorial-generated files?

Yeah, I can remove the complex folder from the repository and the tutorials can use the files from paprika/data

@codecov-io
Copy link

Codecov Report

Merging #140 into master will decrease coverage by 2.92%.
The diff coverage is 39.92%.

@jeff231li jeff231li merged commit ffd7341 into master Oct 8, 2020
@jeff231li jeff231li deleted the gromacs_support branch October 8, 2020 17:38
jeff231li added a commit that referenced this pull request Oct 9, 2020
Fixes bug in #140 where additional PDB files were suppressed by filter_template
@jeff231li jeff231li mentioned this pull request Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants