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

Bond length and angle distributions #32

Merged
merged 12 commits into from
Jan 12, 2022

Conversation

chrisjonesBSU
Copy link
Member

This PR creates 2 functions. One that returns the bond lengths for a given bond pair, and one that returns bond angles for a given angle triplet. It allows the user to accumulate lengths and angles over a range of snapshots for better sampling.

A quick note about handling PBCs: I chose to use the periodic images stored in the gsd file to unwrap positions before finding the bond vectors. I think the other option would be to check if a vector is larger than half the box and correct it using the box length, but I'm not sure how to do that if we don't have a cubic volume. IMO, unwrapping the relevant positions first seems like the best option.

@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #32 (2dc0afe) into master (2750eac) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
+ Coverage   99.55%   99.62%   +0.07%     
==========================================
  Files           5        5              
  Lines         224      270      +46     
==========================================
+ Hits          223      269      +46     
  Misses          1        1              
Impacted Files Coverage Δ
cmeutils/structure.py 100.00% <100.00%> (ø)

Copy link
Member

@jennyfothergill jennyfothergill left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +55 to +57
pos1_unwrap = pos1 + (img1 * snap.configuration.box[:3])
pos2_unwrap = pos2 + (img2 * snap.configuration.box[:3])
pos3_unwrap = pos3 + (img3 * snap.configuration.box[:3])
Copy link
Member

Choose a reason for hiding this comment

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

you could use freud unwrap if you wanted to support non-orthogonal boxes, but it's not urgent

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I thought about that as well. I say we can add that later if the need arises.

@chrisjonesBSU chrisjonesBSU merged commit f367ed2 into cmelab:master Jan 12, 2022
@chrisjonesBSU chrisjonesBSU deleted the bond_dists branch November 15, 2023 19:27
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