-
Notifications
You must be signed in to change notification settings - Fork 25
Description
TODOS:
- Rearrange and expand user guide (Docs rearrangement and update #428)
- Polish examples
Explanation
Hey @mattwthompson I've just gone through the protein-ligand example from #328 - It looks really good! it's not too long and everything's well explained. I'll organise it with headings and might rephrase or re-organise things but my big notes are about the API.
First, I love that the + operator works with Interchange objects!!!
Secondly, I've talked to @j-wags about this a little, but Interchange seems to me to basically be Topology on steroids (plus an FF and positions). In this example in particular, the Topology is only really constructed to write a file and construct the Interchange. I wonder if allowing Interchange.from_smirnoff() to accept a list of Molecule objects as an alternative to a Topology could simplify the API?
Even if it uses Topology under the hood, my suspicion is that this would replace most usages of Topology by users. I think this would be a huge win for teaching, because Topology is a pretty nebulous term in MD world, and the type at the moment is really the only intermediate type. Without Topology, the main workflow for applying a force field takes Molecule objects, a ForceField object, a position array, and a boxvectors array, and combines them into an Interchange object. This is a beautiful workflow with no intermediate steps where each input corresponds exactly to a comp chem concept and half of them are numpy arrays that everyone has used a million times before.
So my suggestion here is:
@classmethod
def from_smirnoff(
cls,
force_field: ForceField,
- topology: Topology,
+ topology: Union[Topology, List[Molecule]],
box=None,
) -> "Interchange":(And being able to specify positions in this method probably makes sense too, though it wouldn't come up in this example)
Would you accept PRs for this change?
Finally, my energies at the end were a bit strange:
OpenMM Energies:
Bond: 11279.70703125 kJ / mol
Angle: 5386.8837890625 kJ / mol
Torsion: 7612.54052734375 kJ / mol
Nonbonded: None
vdW: 5095140.218750465 kJ / mol
Electrostatics: -20698.04012266005 kJ / mol
AMBER Energies:
Bond: 2695.9208 kcalories_per_mole
Angle: 1287.4972 kcalories_per_mole
Torsion: 1819.4409 kcalories_per_mole
Nonbonded: None
vdW: 5095170.807108 kjoule_per_mole
Electrostatics: -80669.06598800002 kjoule_per_mole
If my maths is right these are within 30 kJ/mol and <1% of each other (which seems fine) except the electrostatics, which are out by a factor of 4. Do you know what that's about? If its expected we should probably make a note of it.
For the rest of the docs, I'm going to just look at re-arranging the stuff there so that the user guide starts by describing what Interchange is for: (a) Creating Interchange objects (b) writing input files for MD engines (c) tweaking force fields without having to re-apply them all the time (this is missing atm but Jeff said it was a big deal. Some notes on how this is done would be cool but I'll see how far I can get on my own). I'll try to organise the remaining info into a theory page like BespokeFit, and I'll make sure the API docs are using the new stuff in Sphinx 4.4.