-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: main
Are you sure you want to change the base?
Conversation
Merging to
|
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
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 |
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 need to check, but this looks like something that could be accomplished, by using argsort
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, and I've just implemented this in commits below
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 inangles.py
. I've implemented testing for Q and its derivatives inexample/openmm/cv_Q
.