Repository navigation
Introduce Axes for Branched Residues - #502
ioanaapapa wants to merge 36 commits into
Conversation
…endent of residue index
…bour atom), removed res_position, removed redundant test for 2 point terminal residue case, was the same as test_get_ua_axes_bonded_terminal_2_points
harryswift01
left a comment
There was a problem hiding this comment.
Thanks for this, it's really nice to see the res_position logic gone, and finding edges from bonds is much cleaner. I've left a few comments, mostly from the code side. The main one is whether the topology caching should pick up these changes, since I think --axes local and --axes topology might give different results at the moment. The rest are small tidy-ups.
| return trans_axes, rot_axes, center, moment_of_inertia | ||
|
|
||
| def get_UA_axes(self, data_container, index: int, res_position): | ||
| def get_UA_axes(self, data_container, index: int, resindex: int): |
There was a problem hiding this comment.
Since get_UA_axes is called for every UA bead in every frame, we're recalculating the same edges for each bead in a residue. Could we work them out once per residue and pass them in? Also, the docstring calls this parameter res_index but it's resindex.
There was a problem hiding this comment.
Yes, that would be good. Would it then be best to find the edges in the covariance node, then pass them as an argument to get_res/UA_axes?
There was a problem hiding this comment.
I've just had a look at the topology caching and I'm not sure it's picking up these changes. _has_neighbor_bonds still uses resindex ± 1, and get_residue_axes_from_topology / get_UA_axes_from_topology don't use the edge logic at all, so I think --axes topology and --axes local will give different results for branched residues. Is updating the cached path in scope for this one, or should we pick it up as a follow-up?
There was a problem hiding this comment.
I haven't changed the topology caching -- axes topology and --axes local already give different results as the topology caching still uses the principal axes of a residue so we could follow up when we match those, as well. They should however match for UA rotation axes and that's where there might now be an issue that means we need to update it now. I'll have a look.
| f"resindex {resindex} and bonded resindex {resindex_prev}" | ||
| ) | ||
| residue = data_container.select_atoms(f"resindex {resindex}") | ||
| neighbours = data_container.select_atoms(f"not resindex {resindex}") |
There was a problem hiding this comment.
Since the edge atoms only depend on the bonds, could we work them out once in the axes topology node and cache them (e.g. edge_indices on ResidueAxesTopology)? That would save redoing the selections every frame and keep the local and topology paths in sync.
| f"or resindex {local_res_i + relative_id} " | ||
| f"or resindex {local_res_i + 1 + relative_id}" | ||
| ) | ||
| resindex = local_res_i + relative_res_i |
There was a problem hiding this comment.
Could we just use res.resindex here instead of local_res_i + relative_res_i? It avoids assuming the residues are numbered consecutively, and we wouldn't need to pass relative_res_i through.
There was a problem hiding this comment.
I remember this leading to an issue for systems with multiple molecules but I'll check again
jkalayan
left a comment
There was a problem hiding this comment.
Using the bonds instead of the residue indices to find terminal/non-terminal/branched neighbours makes the implementation general to any polymer, happy to see this merged.
Summary
Treatment for branched residues (i.e. non-terminal residues with three or more neighbouring residues) was introduced. This closes #425.
Changes
Edge atoms and neighbour residues definition is no longer dependent on residue index. The data_container used for calculating vibrational entropy at the UA level now consists of residue of interest + heavy atoms bonded to residue of interest in neighbour residues. The res_position argument is no longer used and get_UA_axes now has the resindex argument, which corresponds to the residue index of the residue of interest.
Science section of docs was updated to reflect changed and match labels and terminology used in upcoming paper about axes.
Testing
thioredoxin_res_rovib_diff_axes.csv
thioredoxin_ua_transvib_diff_axes.csv
Impact
Checklist
pyproject.tomlchanged, the lower bounds were reviewed deliberately