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

Implementations of 2 new cvs: native contact fraction Q and angles between two vectors #327

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

yihengwuKP
Copy link
Collaborator

Hi I've implemented two new cvs: 1. angle between two vectors 2. native contact fraction Q. Please let me know if anything needs to be modified! I've added another python script under colvars contacts.py for Q, but the vector angles are added in angles.py. I've implemented testing for Q and its derivatives in example/openmm/cv_Q.

Copy link

trunk-io bot commented Jul 9, 2024

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

update the examples, this is simply a better choice of
the contacts. Otherwise it contains bonded pairs which
will always be there.
pysages/colvars/contacts.py Outdated Show resolved Hide resolved
pysages/colvars/angles.py Outdated Show resolved Hide resolved
Comment on lines 15 to 25
def remap_indices(contacts, sorted_unique_indices):
# create the mapping from old indices to new indices
old_indices = np.array(sorted_unique_indices)
new_indices = np.arange(len(sorted_unique_indices))
index_mapping = np.zeros(old_indices.max() + 1, dtype=new_indices.dtype)
index_mapping = index_mapping.at[old_indices].set(new_indices)

contacts = np.array(contacts)
remapped_contacts = index_mapping[contacts]

return remapped_contacts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check, but this looks like something that could be accomplished, by using argsort

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and I've just implemented this in commits below

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

Successfully merging this pull request may close these issues.

2 participants