Skip to content
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

[Question] How to XmlSerializer.serialize a SamplerState? #664

Open
lucl13 opened this issue Mar 15, 2023 · 1 comment
Open

[Question] How to XmlSerializer.serialize a SamplerState? #664

lucl13 opened this issue Mar 15, 2023 · 1 comment

Comments

@lucl13
Copy link

lucl13 commented Mar 15, 2023

Dear all,

I'd like to XmlSerializer.serialize a SamplerState as a restart file. Is that possible? It seems XmlSerializer doesn't support this object.

Best

@lucl13
Copy link
Author

lucl13 commented Mar 15, 2023

It can be done by:

_context = thermodynamic_state.create_context(openmm.VerletIntegrator(2.0*unit.femtosecond))
simulation.sampler_state.apply_to_context(_context)

with open('test.rst', 'w') as f:
    f.write(openmm.XmlSerializer.serialize(_context.getState(getPositions=True, getVelocities=True)))

@lucl13 lucl13 changed the title How to XmlSerializer.serialize a SamplerState? [Question] How to XmlSerializer.serialize a SamplerState? Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant