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
Add truncated octahedral solvation option for Modeller.addSolvent() #3124
Comments
In what way is it difficult? You just specify appropriate box vectors. Here's the code from OpenMM-Setup that does it. |
@glass-w can provide more information about the difficulties here, but I think the bigger picture question is that you're asking "why is it hard for a new user to just do vectors = mm.Vec3(1,0,0), mm.Vec3(1/3,2*sqrt(2)/3,0), mm.Vec3(-1/3,sqrt(2)/3,sqrt(6)/3)
boxVectors = [(maxSize+geompadding)*v for v in vectors] ?" then the point is already made. :) If we can easily encapsulate these lines into Related to #3113, are there any assumptions in |
I was thinking more along the lines of, "Why is it hard for a new user to just select the 'truncated octahedron' option in OpenMM-Setup." |
Because we need to automate it, and OpenMM-Setup is intended to be used as a web app and not a user-accessible library like |
I've just tried solvating (with a truncated octahedron) my protein complex with the following code (mostly copied from https://github.com/openmm/openmm-setup/blob/931bddaf9fa185e44c79af2c638c22eed3cbe7d4/openmmsetup/openmmsetup.py#L249-L256): # Create a modeller
modeller = app.Modeller(topology, positions)
# Solvate
geompadding = 0.9 * unit.nanometers
maxSize = max(max((pos[i] for pos in positions))-min((pos[i] for pos in positions)) for i in range(3))
vectors = openmm.Vec3(1,0,0), openmm.Vec3(1/3,2*np.sqrt(2)/3,0), openmm.Vec3(-1/3,np.sqrt(2)/3,np.sqrt(6)/3)
boxVectors = [(maxSize+geompadding)*v for v in vectors]
modeller.addSolvent(self.system_generator.forcefield, model=water_model, boxVectors=boxVectors, ionicStrength=ionic_strength)
# Write to a PDB file
solvated_topology = modeller.getTopology()
solvated_positions = modeller.getPositions()
app.PDBFile.writeFile(solvated_topology, solvated_positions, open("trunc_oct_box_vecs_complex.pdb", "w"), keepIds=True) And when I visualize my system in pymol, the solvent box looks rectangular: When I use supercell to visualize the unit cells, it looks like the unit cell isn't actually rectangular, but has rhombic nature: Is this the desired behavior? Or should the solvent box/unit cells actually look like a truncated octahedron? |
That's correct. See the last paragraph under http://docs.openmm.org/latest/userguide/theory.html#periodic-boundary-conditions. |
Got it, thanks! |
I'm looking into how to implement this. Here is how we currently implement the padding option: openmm/wrappers/python/openmm/app/modeller.py Lines 393 to 394 in 4142e19
An obvious implementation would be to add another option for box shape. We would build a box of the specified shape with the specified padding distance. However, the way we currently compute box size (largest dimension along x, y, or z) doesn't really make sense for a non-rectangular box. Would it be better to instead find the minimal bounding sphere containing all particles, then set the box width to |
This sounds like a great approach.
Ideally, we would exclude solvent from the bounding sphere computation (eg
crystal waters and salts would not contribute), but this is a minor detail.
|
It turns out that it's quite difficult to automate solvation within a truncated octahedron.
Could we add an option to
Modeller.addSolvent()
that would allow the user to select between standard box shapes?cc : @glass-w, who can provide more information on use cases.
The text was updated successfully, but these errors were encountered: