-
Notifications
You must be signed in to change notification settings - Fork 12
Constant potential tutorial #49
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
base: main
Are you sure you want to change the base?
Conversation
|
Example docs for this PR rendered here |
peastman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a well written tutorial. I wonder if it could be made simpler, though. Building everything by hand is complicated. What about this?
- Load a PDB file with the model.
- Use a ForceField to create a System. You can use a standard force field for the water and ions, and provide a minimal XML file for the AU residues.
- Provide code to take a System and "constant potentialify" it: add a ConstantPotentialForce, copy the Coulomb parameters from the NonbondedForce, set them to zero in the NonbondedForce.
This should take less code overall, and users will be able to copy it directly for their own simulations, even if they involve different molecules.
| " system.addConstraint(i_o, i_h2, L_OH)\n", | ||
| " system.addConstraint(i_h1, i_h2, L_HH)\n", | ||
| "\n", | ||
| " residue = topology.addResidue(\"WAT\", chain_water)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should be "HOH".
| " # Get all of the charges, and find the sum of the electrode charges.\n", | ||
| " # We divide out OpenMM's units before passing charges to Python's sum() function.\n", | ||
| " charges = self._conp.getCharges(simulation.context).value_in_unit(openmm.unit.elementary_charge)\n", | ||
| " charge_i = sum([charges[i] for i in self._i_indices]) * openmm.unit.elementary_charge\n", | ||
| " charge_j = sum([charges[j] for j in self._j_indices]) * openmm.unit.elementary_charge\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use openmm.unit.sum(), which knows how to add Quantities.
Adds a tutorial on setting up a constant potential simulation. Effectively shows how to replicate one data point from this paper.