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

Speed up functions for retrieving old/new positions from hybrid positions #1005

Closed
zhang-ivy opened this issue May 10, 2022 · 0 comments · Fixed by #1020
Closed

Speed up functions for retrieving old/new positions from hybrid positions #1005

zhang-ivy opened this issue May 10, 2022 · 0 comments · Fixed by #1020
Assignees
Labels

Comments

@zhang-ivy
Copy link
Contributor

I've noticed that the HybridTopologyFactory functions for retrieving old/new positions from the hybrid positions are very slow.

I've found that these are much faster:

def new_positions(htf, hybrid_positions):
    n_atoms_new = htf._topology_proposal.n_atoms_new
    hybrid_indices = [htf._new_to_hybrid_map[idx] for idx in range(n_atoms_new)]
    return hybrid_positions[hybrid_indices, :]

def old_positions(htf, hybrid_positions):
    n_atoms_old = htf._topology_proposal.n_atoms_old
    hybrid_indices = [htf._old_to_hybrid_map[idx] for idx in range(n_atoms_old)]
    return hybrid_positions[hybrid_indices, :]

We should 1) double check that the functions I wrote do the same thing as the original functions and 2) integrate my functions with the existing ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants