|The proposed feature would be a method in the System class to update the corresponding parameters in an OpenMM Context. Hopefully, it would be called like this:|
pdb = PDBFile('molecule.pdb')
forcefield = ForceField('ff.xml')
system = forcefield.createSystem(pdb.topology)
integrator = VerletIntegrator(0.001*picosecond)
simulation = Simulation(pdb.topology, system, integrator)
forcefield2 = ForceField('ff2.xml')
system2 = forcefield2.createSystem(pdb.topology)
# This line
Alternatively, it could be called like this (even though it's less convenient):
# I had to write function to copy the parameters from system2 to simulation.system; currently required for the force.updateParametersInContext() methods.
In this example, ff2.xml and ff.xml only differ in the force field parameters. Thus, system and system2 are expected to differ in the following ways:
1) Floating point parameters for every Force, such as atomic charges and bond lengths.
2) Virtual site weights.
3) Atomic masses (though not very important for my research).
system and system2 are not expected to differ in the following ways:
4) Numbers of Forces, types of Forces, or the Forces being in a different order
5) Numbers of particles
However, there are some other potential use cases for other people, which I cannot really comment on:
6) The atom indices that particlular interactions depend on.
7) Periodic box vectors (I usually don't set these from the System, but it is conceivable).
For the purposes of force field optimization, only items (1) and (2) are sufficient. I would be happy with a updateParametersInContext() method that carried out just these two things and nothing else.