Closed taoliu032 closed 1 year ago
I haven't tried it myself, since I immediately call ForceField.createSystem
each time I construct one and have not needed to serialize them, but it might not be possible: https://github.com/openmm/openmm/issues/2451
Note that most other OpenMM objects (openmm.System
most importantly) are readily serializable to XML.
ForceFields aren't serializable. You might be able to pickle it?
Thank you Matt and Peter! The only reason I'm thinking of outputing to a .xml file instead of directly calling ForceField.createSystem()
is that it's a pain in the neck to install openmmforcefields
and openff-toolkit
on our super computer cluster -- they don't allow us to do Conda install. I tried pip install git+<github page url>
but it didn't install all the dependencies like openff-units
. So I thought about parameterizing the molecule on my local computer into a .xml file first...
ForceFields aren't serializable. You might be able to pickle it?
Could you elaborate what it means? I'm not sure I understand the pickle part. Thank you!
Don't use the pre-installed python. Install a copy of miniconda in your home directory. Within that, you can do whatever you want.
@peastman -- miniconda is what I use on my local computer but I didn't know there's such a hack on computer clusters 😎 -- I will try it out, thank you! If you have time, would you mind explaining the pickle part you mentioned above?
Also, I'm a novice in terms of handling force field parameters in .xml files, so just to make sure I didn't confuse any of you: by "GAFF parameters in .xml format", I meant a force field file that has such format: http://docs.openmm.org/latest/userguide/application/05_creating_ffs.html#writing-the-xml-file
There's no way to automatically write it out in that format. Don't worry about pickling: it wouldn't accomplish what you described. You would need to create the file by hand, or just rely on the TemplateGenerator (which is the recommended workflow).
The parameters for GAFF have already been converted to XML format. The problem is identifying the atom types for an arbitrary small molecule. That's implemented programmatically by code in AmberTools.
Thanks a lot! I'd prefer to rely on the TemplateGenerator. AmberTools is also a bit painful to use on our computer cluster, since the provided version appears to conflict with the installed openmm/7.7.0 regarding using fftw vs. fftw-mpi... Within miniconda, I think this won't be an issue and I might as well just create a conda environment and do parameterization via openmmforcefields
:)
I have another question on converting other force field formats to xml format (perhaps I should open another issue for this question?):
Is there any tool that can convert force field parameters from .key format (to be used in tinker) to .xml (so that can be used in openmm)? For example, the following force field parameters were obtained by the parameterization tool "poltype". These parameters are meant to simulate a small molecule together with a DNA which is modeled by AMOEBA18. I was manually converting these parameters to an .xml file and wonder if there is a tool to help
parameters /home/taoliu/poltype2/ParameterFiles/amoebabio18_header.prm OPENMP-THREADS 12 digits 8 RESP-WEIGHT 1
############################# Literature References #############################
Wu, J.C.; Chattree, G.; Ren, P.Y.; Automation of AMOEBA polarizable force field parameterization for small molecules. Theor Chem Acc.
atom 401 401 O "DB00728 " 8 15.999 2 atom 402 402 O "DB00728 " 8 15.999 2 atom 403 403 O "DB00728 " 8 15.999 2 atom 404 404 O "DB00728 " 8 15.999 1 atom 405 405 N "DB00728 " 7 14.007 4 atom 406 406 N "DB00728 " 7 14.007 3 atom 407 407 C "DB00728 " 6 12.011 4 atom 408 408 C "DB00728 " 6 12.011 4 atom 409 409 C "DB00728 " 6 12.011 4 atom 410 410 C "DB00728 " 6 12.011 4 atom 411 411 C "DB00728 " 6 12.011 4 atom 412 412 C "DB00728 " 6 12.011 4 atom 413 413 C "DB00728 " 6 12.011 4 ... vdw 409 3.8200 0.1010
vdw 410 3.8200 0.1010
vdw 415 3.8200 0.1010 ...
Thanks for your time! Have a good weekend!
Is there any tool that can convert force field parameters from .key format (to be used in tinker) to .xml (so that can be used in openmm)?
Probably not. Force field conversion is difficult and error-prone when possible and often simply impossible, even if it seems like the sort of thing that seems like it should be feasible. You could write one for a more narrow use case, though I'm not sure if that's a good idea or not.
Hello!
I recently started using openmmforcefields package and absolutely love it! Thank you very much to all the developers!
I like the idea of parameterizing molecules on the fly, but I also wonder if there is a way to output the generated GAFF parameters (or other force field parameters) for a small molecule into a .xml file, that is compatible with openmm?
Thank you very much and happy holidays!
Best, Tao