Factory methods for AHS AtomArrangments
Describe the feature you'd like Currently there is a single low-level constructor for AtomArrangements, which creates an empty atom arrangement object, after which its add method can be used to add atoms.
Use cases of condensed matter physics often require specifying atom arrangements with regular structure, such as square, triangle, honeycomb lattices. To specify these lattices, currently one need to explicitly program the coordinates of each atom in lattice. It would be much better to be able to use pre-packaged factory methods to create these arrangements, and maybe even the most general 2-d decorated Bravais lattice too.
A good reference on decorated Bravais lattices: https://courses.physics.illinois.edu/phys560/sp2011/lecture/Phys560Notes-3.pdf
How would this feature be used? Please describe. Atom arrangements could be defined by defining a regular lattice structure and a canvas where the actual sites are placed.
- Square lattice
canvas_boundary_points = [(0,0), (7.5e-5, 0), (0, 7.6e-5), (7.5e-5, 7.6e-5)] canvas = Canvas(canvas_boundary_points) d = 4e-6 register = AtomArrangement.from_square_lattice(d, canvas) - Rectangular lattice
dx = 4e-6 dy = 6e-6 register = AtomArrangement.from_rectangular_lattice(dx, dy, canvas) - Honeycomb lattice
d = 6e-6 register = AtomArrangement.from_honeycomb_lattice(d, canvas) - Bravais lattice
a1 = (0, 5e-6) a2 = (3e-6, 4e-6) register = AtomArrangement.from_bravais_lattice(a1, a2, canvas) - Decorated Bravais lattice
a1 = (0, 10e-6) a2 = (6e-6, 8e-6) basis = [(0,0), (0, 5e-6), (4e-6, 2e-6)] register = AtomArrangement.from_bravais_lattice(a1, a2, canvas, basis=basis)
Describe alternatives you've considered
One alternative to the API from_bravais_lattice method above would be to provide n1, n2 repetition numbers of the unit cell instead of the Canvas object. This would however not allow us to fit the atom arrangement into a pre-defined bounding box, and would not allow us to create staggered arrangements, where say row 1 contains unit cells 0,1,2,3, and row 2 contains unit cells 1,2,3,4, and row 3 contains unit cells 2,3,4,5.
Additional context Useful links:
- https://en.wikipedia.org/wiki/Bravais_lattice
- https://courses.physics.illinois.edu/phys560/sp2011/lecture/Phys560Notes-3.pdf
- https://en.wikipedia.org/wiki/Point_in_polygon
Hi @peterkomar-aws, thank you for raising this suggestion. This seems to be a good first issue for new contributors so I shall add that tag on.
Hi @math411 my PR #981 Addresses the issue for UF Hack
HI @AbdullahKazi500 , thanks for the PR. It's a good start but needs more work, please let us know if you plan to keep working on it.
@peterkomar-aws Hi peter there is an update I will soon report
@peterkomar-aws
@AbdullahKazi500 , please consolidate your work to a single feature branch and single PR. Tests will not pass otherwise. (For how to do it, see e.g. https://webapps.stackexchange.com/questions/95940/how-can-i-change-multiple-files-and-submit-them-in-one-pull-request-on-github)
ok @peterkomar-aws I will look into it
Hi @peterkomar-aws I have added #988 #987 #985 all the Pull requests into one Final Pull request---- #989
I have not added the test PR #986 Into #989 because it was in a different directory
so now you only have to review the two PRs below
#989
#986
Thank you I hope it is not an issue
Thank you @AbdullahKazi500 , the test and the code need to live on the same branch before the github actions can test them. Please add them into a single PR.
Okay that works @peterkomar-aws peter can you specify if I have to add some tests from the repository as well if yes do I Have to add all of them because I Have added my Unit tests
@peterkomar-aws Added existing tests as well as my own tests to validate in the final PR
Closing in favor of #1081.