Closed daico007 closed 1 year ago
Patch coverage: 96.00
% and project coverage change: +0.03
:tada:
Comparison is base (
5e505ab
) 87.13% compared to head (7767544
) 87.16%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
A few comments:
let us ditch the "row" and "column" terminology in the Checkered2DPattern and Grid2DPattern. It would be more consistent (with the 3d packing) and clearer to say:
n : int
Number of points along x-axis
m : int
Number of points along y-axis
Similarly, I think change the accepted values for shift to be either 'n' or 'm' (or 'x' or 'y') where shift='n' would mean shifting occurs in the x-direction (shifting every other row in 'm').
To make it clear what is being done, I think the description in the docstring should probably state what is done:
Generates a square grid of dimensions n by m, then shifts points accordingly to generate a triangular arrangement. shift='n' would mean shifting occurs in the x-direction, where the code shifts every other row in the range specified by 'm'. Similarly shift='m' performs shifting along the y-direction, where the code shifts every other column in range specified by 'n'. By default, shifting will be half the distance between neighboring points in the direction of shifting. This code will allow patterns to be generated that are only periodic in one direction; to generate a periodic pattern, m should be even when shift='n' and 'n' should be even when shift='m'.
To generalize, could also allow the value of the delta_shift to be set; this allows of course a wider range of grids to be defined, but also if delta_shift is set to zero, it would recover grid2dpattern. As such, we should probably just have Grid2DPattern inherit from this class, setting delta_shift=0.
I think Triangle2DPattern might be a more appropriate name than checkered, since a square lattice can be checkered by alternately labeling the points (which might actually be a useful addition to the code in a future PR, being able to label the point and thus being able to pass a point label name to the apply function so that only select points would get compounds moved to them) .
PR Summary:
Add new 2D checkered patter to mBuild
pattern.py
. Grid2DPattern:Checkered2DPattern:
PR Checklist