openmm / openmm-xtb

OpenMM plugin to interface with XTB
MIT License
10 stars 1 forks source link

Issues with serializing the new system #10

Closed kimjc95 closed 1 month ago

kimjc95 commented 1 month ago

Hi, I am trying to apply XTB forces on the non-standard residues I am handling.

My code looks like this:

final_system.addForce(XtbForce(XtbForce.GFNFF, 0.0, 1, True, xtb_atoms, element_list))

with open('system.xml', 'w') as f:
    f.write(XmlSerializer.serialize(final_system))

print("Creating simulation...", end='')
integrator = LangevinMiddleIntegrator((temperature+273.15)*kelvin, 1/picosecond, step_size*femtosecond)
platform = Platform.getPlatformByName('CUDA')
properties = {'Precision': 'single'}
simulation = Simulation(model.topology, final_system, integrator, platform, properties)
print("done.")

and I am getting the error like this:

---------------------------------------------------------------------------
OpenMMException                           Traceback (most recent call last)
[<ipython-input-12-7abd17af3d17>](https://localhost:8080/#) in <cell line: 184>()
    185     from openmmxtb import XtbForce
    186     with open('system.xml', 'w') as f:
--> 187         f.write(XmlSerializer.serialize(final_system))
    188 
    189     print("Creating simulation...", end='')

1 frames
[/usr/local/lib/python3.10/site-packages/openmm/openmm.py](https://localhost:8080/#) in serializeSystem(object)
   6824         Get the force field parameters for an interaction that should be calculated differently from others.
   6825 
-> 6826         Parameters
   6827         ----------
   6828         index : int

OpenMMException: There is no serialization proxy registered for type N9XtbPlugin8XtbForceE

Is there something I am missing? Thanks in advance.

kimjc95 commented 1 month ago

solved when I installed openmm openmm-xtb all together at once