-
Notifications
You must be signed in to change notification settings - Fork 51
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
Specifying hybrid topology factory (htf) from input file #988
Conversation
@zhang-ivy Can you help me figure out why I am getting the following error? This happens when I try to run the Traceback (most recent call last):
File "/home/user/miniconda3/envs/perses-dev/bin/perses-relative", line 33, in <module>
sys.exit(load_entry_point('perses', 'console_scripts', 'perses-relative')())
File "/home/user/workdir/repos/perses/perses/app/setup_relative_calculation.py", line 800, in run
setup_dict = run_setup(setup_options)
File "/home/user/workdir/repos/perses/perses/app/setup_relative_calculation.py", line 614, in run_setup
zero_state_error, one_state_error = validate_endstate_energies(_top_prop, _htf, _forward_added_valence_energy, _reverse_subtracted_valence_energy, beta = 1.0/(kB*temperature), ENERGY_THRESHOLD = ENERGY_THRESHOLD)#, trajectory_directory=f'{xml_directory}{phase}')
File "/home/user/workdir/repos/perses/perses/tests/utils.py", line 796, in validate_endstate_energies
nonalch_zero, nonalch_one, alch_zero, alch_one = generate_endpoint_thermodynamic_states(hybrid_system, top_proposal, repartitioned_endstate)
File "/home/user/workdir/repos/perses/perses/tests/utils.py", line 387, in generate_endpoint_thermodynamic_states
check_system(system)
File "/home/user/workdir/repos/perses/perses/tests/utils.py", line 346, in check_system
force = forces['PeriodicTorsionForce']
KeyError: 'PeriodicTorsionForce' As the error says it is expecting that key here, but the |
@ijpulidos : The error arises because |
softcore_LJ_v2=setup_options['softcore_v2'], | ||
interpolate_old_and_new_14s=setup_options['anneal_1,4s'], | ||
rmsd_restraint=setup_options['rmsd_restraint'] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijpulidos : I think you are missing a bunch of HybridTopologyFactory
and RESTCapableHybridTopologyFactory
arguments: https://github.com/choderalab/perses/blob/main/perses/app/relative_point_mutation_setup.py#L444-L460.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the ones in the code I linked are for the HybridTopologyFactory
. The only ones that are used for the RESTCapableHybridTopologyFactory
are: rest_radius=rest_radius, w_scale=w_scale
-- you'll want to make sure the yaml has options for specifying these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are correct.
@zhang-ivy You are correct, but I'm using what used to be in the |
I had to manually add the new option/key to the |
Related #995 |
_logger.info(f"\t\terror in zero state: {zero_state_error}") | ||
_logger.info(f"\t\terror in one state: {one_state_error}") | ||
elif isinstance(current_htf, RESTCapableHybridTopologyFactory): | ||
for endstate in [0, 1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When validating the RESTCapableHybridTopologyFactory
, we need to run validate_endstate_energies_point
twice -- once at each endstate. We don't want to run the test twice on the same htf though, since the test involves changing hybrid system parameters. I recommend making a copy of the htf within this for loop, like I do here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, it's probably better to make the copy inside the validate_endstate_energies_point
. This will help with not having to remember the function alters the htf and also should be better in terms of memory management. We would need to change this as well for validate_endstate_energies_md
and make the corresponding changes in relative_point_mutation_setup.py
and test_relative.py
. I'll do those, it should be an easy fix.
# update htf_setup_dictionary with new parameters | ||
htf_setup_dict.update(rest_specific_options) | ||
else: | ||
raise ValueError(f"Unsupported Hybrid Topology Factory. Check 'hybrid_topology_factory' name in input file.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a more useful error message here would be something like f"You specified an unsupported factory type: {factory_name}. Currently, the supported factories are: HybridTopologyFactory and RESTCapableHybridTopologyFactory."
One more thing that is no longer necessary due to your suggestion to make a copy of All the pickle code can be removed and we can just call: for endstate in [0, 1]:
validate_endstate_energies_point(htf, endstate=endstate, minimize=True) The pickle code is only in there because I wanted to run the validate function on fresh htfs each time (aka the same reason why I was making copies of the htfs). |
Description
Created a common API point to handle the Hybrid Topology Factory creation. It can handle the 'vanilla'
HybridTopologyFactory
and the newRESTCapableHybridTopologyFactory
.The new parameter for the input
yaml
file ishybrid_topology_factory
and it expects the full name of the class as a value. It raises an error if you provide an invalid name.Motivation and context
Resolves #899
How has this been tested?
Tested locally by running the protein-ligand example from cli.
Change log