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

Added Functionalized pores with percent fills. #14

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

whitehml
Copy link

More tests to be added later. Hopefully should be PEP8 compliant; I ran autopep8 with --in-place -a -a.

@rmatsum836
Copy link
Collaborator

Looks good so far. The changes autopep8 made in porebuilder.py should be reverted. Once tests are added, I'll look at it again

Copy link
Collaborator

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

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

Handful of comments but it looks good overall

up_port = mb.Port(
anchor=self[0], orientation=[
0, 1, 0], separation=.075)
self.add(up_port, "up")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be named down. It's not a strict requirement but it's a convention from mb.Polymer that I would like to continue for simple systems.

self.children[1],
self.children[1].labels['up'],
self.children[0].labels['up'])
up_port = mb.Port(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this port should be in O

@@ -1,5 +1,8 @@
import mbuild as mb
import numpy as np
from random import shuffle
from copy import deepcopy
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see deepcopy being used, maybe this was debug/experimental?

@@ -1,5 +1,8 @@
import mbuild as mb
import numpy as np
from random import shuffle
from copy import deepcopy
from six import string_types
Copy link
Collaborator

Choose a reason for hiding this comment

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

six is not in the standard Python library, so we should add it to requirements.txt

func_ports = [func_ports] * len(func_groups)

if len(func_groups) != len(func_percent) or len(
func_groups) != len(func_ports):
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about if not len x == y == z:?

b_surface = []

for C in Top:
if C.pos[0] >= 0 and C.pos[1] <= .336 * (n_sheets - 1) + pore_width:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why we need to check for a positive x coordinate?

if C.pos[0] >= 0 and C.pos[1] >= .335 * (n_sheets - 1):
b_surface.append(C),

for side, surface in zip((Top,Bot),(t_surface,b_surface)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we raname side to something like pore_wall? It clashes a little bit with the side_dim argument we are using elsewhere.

0, 1, 0], separation=.075)
self.add(up_port, "up")

with pytest.raises(ValueError):
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

func_groups=[H(), O()], func_percent=[.03, .04, .03])

for per in range(1, 10):
pore = pb.GraphenePoreFunctionalized(
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • This is a fairly long test, maybe switch it to only 3 values of per?

  • We should test this for different values of pore_width to verify the process of finding the surfaces. Two or three values should be enough

for per in range(1, 10):
pore = pb.GraphenePoreFunctionalized(
func_groups=H(), func_percent=per / 10)
assert(pore.n_particles - 2688 > (per - .3) / 10 *
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's split this into two assert statements. And I'm not sure where 864 comes from?

Copy link
Author

@whitehml whitehml Jul 25, 2018

Choose a reason for hiding this comment

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

864 is the total number of inner surface carbons that could potentially be functionalized. Now that I changed the function so that it adds exactly the right amount of new groups instead of relying on dice rolls I'll be re-writing the test cases next.

@mattwthompson
Copy link
Collaborator

It doesn't need to be included in this PR, but it occurred to me that code finding the surface atoms would be useful for other things (i.e. applying a partial charge) and could be moved into a separate function.

@mattwthompson
Copy link
Collaborator

@gawquon can you rebase? The master branch is passing on Travis now

Something like this should work

git checkout master
git pull rmatsum836/master
git checkout Funtionalize_pore 
git merge master
git commit
git push origin Funtionalize_pore

@rmatsum836
Copy link
Collaborator

I forgot where we were with this but rebasing seems to have fixed the tests. Does this PR look okay to you @mattwthompson?

@mattwthompson
Copy link
Collaborator

I think my comments from last summer still need fixing but overall it's good.

@rmatsum836
Copy link
Collaborator

@gawquon @mattwthompson Commenting here so this can get picked back up and merged soon.

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.

3 participants