amazon-braket / amazon-braket-sdk-python

A Python SDK for interacting with quantum devices on Amazon Braket
https://aws.amazon.com/braket/
Apache License 2.0
300 stars 118 forks source link

Factory methods for AHS AtomArrangments #969

Open peterkomar-aws opened 4 months ago

peterkomar-aws commented 4 months ago

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.

  1. 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)
  2. Rectangular lattice
    dx = 4e-6
    dy = 6e-6
    register = AtomArrangement.from_rectangular_lattice(dx, dy, canvas)
  3. Honeycomb lattice
    d = 6e-6
    register = AtomArrangement.from_honeycomb_lattice(d, canvas)
  4. Bravais lattice
    a1 = (0, 5e-6)
    a2 = (3e-6, 4e-6)
    register = AtomArrangement.from_bravais_lattice(a1, a2, canvas)
  5. 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:

math411 commented 4 months ago

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.

AbdullahKazi500 commented 4 months ago

Hi @math411 my PR #981 Addresses the issue for UF Hack

peterkomar-aws commented 4 months ago

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.

AbdullahKazi500 commented 4 months ago

@peterkomar-aws Hi peter there is an update I will soon report

AbdullahKazi500 commented 4 months ago

atom @peterkomar-aws

peterkomar-aws commented 4 months ago

@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)

AbdullahKazi500 commented 4 months ago

ok @peterkomar-aws I will look into it

AbdullahKazi500 commented 4 months ago

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

peterkomar-aws commented 4 months ago

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.

AbdullahKazi500 commented 4 months ago

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

AbdullahKazi500 commented 4 months ago

@peterkomar-aws Added existing tests as well as my own tests to validate in the final PR