-
Notifications
You must be signed in to change notification settings - Fork 25
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
How to create a CompoundThermodynamicState from a torchForce object with global parameter #147
Comments
Is this specific to TorchForce? What if you change force = TorchForce('model.pt') to force = CustomBondForce('r') leaving everything else the same, including the calls to |
Thank you for the reply! I went ahead and tried your suggestion and it seems the problem is specific to TorchForce. I created a simple example to reproduce this behavior below. Also I think I might have found a workaround (inspired by the openmmml package) by adding the following lines.
In this Please let me know if my workaround is correct? |
@mikemhenry @ijpulidos can you take a look at this? This error is happening because of an interaction between SWIG and openmmtools.
for force_index in range(system.getNumForces()):
force = system.getForce(force_index)
try:
n_global_parameters = force.getNumGlobalParameters()
except AttributeError:
continue
for parameter_id in range(n_global_parameters):
parameter_name = force.getGlobalParameterName(parameter_id)
if parameter_name in searched_parameters:
yield force, parameter_name, parameter_id The problem is that SWIG can only return the correct Python Force subclass from The robust way of getting a list of all global parameters is to call |
Hi,
I would like to do a Hamiltonian REMD with custom defined states, with each state specified by a torchForce object with a different global parameter. But I am having trouble creating a CompoundThermodynamicState to be used with ReplicaExchangeSampler. I can create a GlobalParameterState, but when I use that to create CompoundThermodynamicState, it complains there is no global parameter in the system. I have no trouble doing the same thing with a MM force field. Any idea what might be going wrong?
Thank you!
Here is the structure of the code I was using:
And I am getting the following error:
The text was updated successfully, but these errors were encountered: