-
Notifications
You must be signed in to change notification settings - Fork 79
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
Improve of betacristabolite recipe #1124
Conversation
…with freud_generate_bonds)
Bug fixed, pending test for new use case. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1124 +/- ##
==========================================
+ Coverage 87.11% 87.18% +0.06%
==========================================
Files 62 62
Lines 6451 6483 +32
==========================================
+ Hits 5620 5652 +32
Misses 831 831
☔ View full report in Codecov by Sentry. |
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 think the handling of decimal dimensions needs to be addressed. Otherwise, it looks goodl
scale_Lz = math.ceil(box.Lz / ref_dims[2]) | ||
|
||
silica_list = list() | ||
for particle in list(betacristabolite.particles()): |
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.
don't need to turn this into a list, can just use the particles iterable.
temp.translate(shift) | ||
silica_list.append(temp) | ||
|
||
self.add(silica_list) | ||
|
||
count = 0 | ||
for particle in list(self.particles()): |
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.
should also not generate the list first.
|
||
count = 0 | ||
for particle in list(self.particles()): | ||
if particle.name.startswith("O") and particle.pos[2] > 1.0: | ||
if particle.name.startswith("O") and particle.pos[2] >= box.Lz: |
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.
So this line originally was so you could determine surface oxygens. But if we make the particles position have to be larger than the z dimension of the box, won't we generate zero ports? Seems like this should maybe be some fraction of the the box.Lz.
assert surface.n_bonds == 2400 | ||
|
||
# 2D dimension provided | ||
surface = Betacristobalite(dimensions=(5.3888 * 1.2, 4.589110 * 1.25)) |
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.
So something seems a bit off to me here based on these inputs. I'm worried about the bondlength distributions. What if a particle gets closely placed towards an edge and near a particle already at that edge? I'm not sure fractional values for dimensions should be allowed since this behavior could result.
I would suggest either making a smaller version of the surface so it's easier to tile with integer values, writing a call that instead of loading the mol2, actually does the carving of the amorphous surface which should account for the exact box size specified and not have this issue, or have some filter that removes particles that get within a certain cutoff radius.
# Bogus values provided | ||
with pytest.raises(ValueError): | ||
surface = Betacristobalite(dimensions="bogus") | ||
|
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.
Should add the test:
assert len(surface.available_ports()) > 1 | |
distancesList = [] | |
for particle in surface.particles(): | |
assert len( | |
surface.particles_in_range(particle, dmax=0.001, max_particles=1) | |
) ==0 | |
assert np.min(distancesList) > 0.001 # 1/1000 of a nm is too close |
PR Summary:
Modify the
Betacristobalite
recipe so that it can be created with a custom size (with some borrow code fromwater_box
recipe).PR Checklist