diff --git a/.gitignore b/.gitignore index 154e35de1..a4c16d6cb 100644 --- a/.gitignore +++ b/.gitignore @@ -81,7 +81,7 @@ docs/_build/ # mkdocs site/ -docs/reference/ +docs/reference/bloqade/ # PyBuilder .pybuilder/ diff --git a/docs/builder-workflow/overview.md b/docs/reference/overview.md similarity index 100% rename from docs/builder-workflow/overview.md rename to docs/reference/overview.md diff --git a/docs/builder-workflow/standard.md b/docs/reference/standard.md similarity index 51% rename from docs/builder-workflow/standard.md rename to docs/reference/standard.md index 0e9e3f969..746f89316 100644 --- a/docs/builder-workflow/standard.md +++ b/docs/reference/standard.md @@ -1,10 +1,8 @@ # Build Workflow - -``` mermaid +```mermaid flowchart TD - ProgramStart(["start"]) Geometry("Geometry or Lattice") @@ -67,9 +65,13 @@ flowchart TD python julia"]) - Submit("Execution - ------------ + Execution(" + Execution hardware only + ------------------------------- run_async() + + Hardware and simulation + ------------------------------- run() __call__") @@ -97,7 +99,24 @@ flowchart TD Services -->|quera| QuEraBackends; Services -->|braket| BraketBackends; Services -->|bloqade| BloqadeBackends; - QuEraBackends --> Submit; - BraketBackends --> Submit; - BloqadeBackends --> Submit; + QuEraBackends --> Execution; + BraketBackends --> Execution; + BloqadeBackends --> Execution; + + click ProgramStart "../bloqade/#bloqade.start"; + click Geometry "../bloqade/atom_arrangement/"; + click Coupling "../bloqade/builder/drive/"; + click Detuning "../bloqade/builder/field/#bloqade.builder.field.Detuning"; + click Rabi "../bloqade/builder/field/#bloqade.builder.field.Rabi"; + click Amplitude "../bloqade/builder/field/#bloqade.builder.field.Amplitude"; + click Phase "../bloqade/builder/field/#bloqade.builder.field.Phase"; + click SpaceModulation "../bloqade/builder/spatial/"; + click Waveform "../bloqade/builder/waveform/"; + click Options "../bloqade/builder/pragmas/"; + click Services "../bloqade/builder/backend/"; + click QuEraBackends "../bloqade/builder/backend/quera/#bloqade.builder.backend.quera.QuEraDeviceRoute"; + click BraketBackends "../bloqade/builder/backend/braket/#bloqade.builder.backend.braket.BraketDeviceRoute"; + click BloqadeBackends "../bloqade/builder/backend/bloqade/#bloqade.builder.backend.bloqade.BloqadeBackend"; + click Execution "../bloqade/ir/routine/braket/#bloqade.ir.routine.braket.BraketRoutine"; + ``` diff --git a/mkdocs.yml b/mkdocs.yml index ff755f2ca..22519caa8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,8 +12,8 @@ nav: - Home: index.md - Tutorials: 'https://queracomputing.github.io/bloqade-python-examples/latest/' - Reference: - - Builder Overview: builder-workflow/overview.md - - Builder Standard Diagram: builder-workflow/standard.md + - Builder Overview: reference/overview.md + - Builder Standard Diagram: reference/standard.md - API References : reference/bloqade/ - Blog: - 2023: diff --git a/pyproject.toml b/pyproject.toml index 6e68755c0..508589f45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bloqade" -version = "0.9.0" +version = "0.10.0" description = "Neutral atom software development kit" authors = [ {name = "QuEra Computing Inc.", email = "info@quera.com"}, diff --git a/src/bloqade/codegen/common/assign_variables.py b/src/bloqade/codegen/common/assign_variables.py index 83c1b5a16..402e2b0ee 100644 --- a/src/bloqade/codegen/common/assign_variables.py +++ b/src/bloqade/codegen/common/assign_variables.py @@ -164,13 +164,11 @@ def __init__(self, mapping: Dict[str, numbers.Real]): self.scalar_visitor = AssignScalar(mapping) def visit_chain(self, ast: location.Chain) -> location.Chain: - return location.Chain( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) - ) + return location.Chain(*ast.shape, self.scalar_visitor.emit(ast.lattice_spacing)) def visit_square(self, ast: location.Square) -> location.Square: return location.Square( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) + *ast.shape, self.scalar_visitor.emit(ast.lattice_spacing) ) def visit_rectangular(self, ast: location.Rectangular) -> location.Rectangular: @@ -183,23 +181,21 @@ def visit_rectangular(self, ast: location.Rectangular) -> location.Rectangular: def visit_triangular(self, ast: location.Triangular) -> location.Triangular: return location.Triangular( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) + *ast.shape, self.scalar_visitor.emit(ast.lattice_spacing) ) def visit_honeycomb(self, ast: location.Honeycomb) -> location.Honeycomb: return location.Honeycomb( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) + *ast.shape, self.scalar_visitor.emit(ast.lattice_spacing) ) def visit_kagome(self, ast: location.Kagome) -> location.Kagome: return location.Kagome( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) + *ast.shape, self.scalar_visitor.emit(ast.lattice_spacing) ) def visit_lieb(self, ast: location.Lieb) -> location.Lieb: - return location.Lieb( - ast.shape[0], self.scalar_visitor.emit(ast.lattice_spacing) - ) + return location.Lieb(*ast.shape, self.scalar_visitor.emit(ast.lattice_spacing)) def visit_list_of_locations( self, ast: location.ListOfLocations diff --git a/src/bloqade/codegen/common/json.py b/src/bloqade/codegen/common/json.py index 4778e8a66..1057064a7 100644 --- a/src/bloqade/codegen/common/json.py +++ b/src/bloqade/codegen/common/json.py @@ -216,7 +216,8 @@ def visit_honeycomb(self, ast: Honeycomb) -> Any: return { "honeycomb": { "lattice_spacing": self.scalar_serializer.visit(ast.lattice_spacing), - "L": ast.shape[0], + "L1": ast.shape[0], + "L2": ast.shape[1], } } @@ -224,7 +225,8 @@ def visit_kagome(self, ast: Kagome) -> Any: return { "kagome": { "lattice_spacing": self.scalar_serializer.visit(ast.lattice_spacing), - "L": ast.shape[0], + "L1": ast.shape[0], + "L2": ast.shape[1], } } @@ -232,7 +234,8 @@ def visit_lieb(self, ast: Lieb) -> Any: return { "lieb": { "lattice_spacing": self.scalar_serializer.visit(ast.lattice_spacing), - "L": ast.shape[0], + "L1": ast.shape[0], + "L2": ast.shape[1], } } @@ -263,7 +266,8 @@ def visit_square(self, ast: Square) -> Any: "lattice_spacing": self.visit( self.scalar_serializer.visit(ast.lattice_spacing) ), - "L": ast.shape[0], + "L1": ast.shape[0], + "L2": ast.shape[1], } } @@ -271,7 +275,8 @@ def visit_triangular(self, ast: Triangular) -> Any: return { "triangular": { "lattice_spacing": self.scalar_serializer.visit(ast.lattice_spacing), - "L": ast.shape[0], + "L1": ast.shape[0], + "L2": ast.shape[1], } } diff --git a/src/bloqade/ir/location/bravais.py b/src/bloqade/ir/location/bravais.py index 2a36ab649..886014431 100644 --- a/src/bloqade/ir/location/bravais.py +++ b/src/bloqade/ir/location/bravais.py @@ -222,7 +222,9 @@ class Square(BoundedBravais): - loc (0,0) Args: - L (int): number of sites in linear direction. n_atoms = L * L. + L1 (int): number of sites in linear direction. n_atoms = L1 * L1. + L2 (Optional[int]): number of sites in direction a2. + n_atoms = L1 * L2, default is L1 lattice_spacing (Scalar, Real): lattice spacing. Defaults to 1.0. @@ -233,8 +235,12 @@ class Square(BoundedBravais): """ @beartype - def __init__(self, L: int, lattice_spacing: ScalarType = 1.0): - super().__init__(L, L, lattice_spacing=lattice_spacing) + def __init__( + self, L1: int, L2: Optional[int] = None, lattice_spacing: ScalarType = 1.0 + ): + if L2 is None: + L2 = L1 + super().__init__(L1, L2, lattice_spacing=lattice_spacing) def __repr__(self): return super().__repr__() @@ -367,7 +373,10 @@ class Honeycomb(BoundedBravais): Args: - L (int): number of sites in linear direction. n_atoms = L * L * 2. + L1 (int): number of unit cells in linear direction. n_atoms = L1 * L1 * 2. + L2 (Optional[int]): number of unit cells in direction a2. + n_atoms = L1 * L2 * 2, default is L1. + lattice_spacing (Scalar, Real): lattice spacing. Defaults to 1.0. @@ -379,8 +388,12 @@ class Honeycomb(BoundedBravais): """ @beartype - def __init__(self, L: int, lattice_spacing: ScalarType = 1.0): - super().__init__(L, L, lattice_spacing=lattice_spacing) + def __init__( + self, L1: int, L2: Optional[int] = None, lattice_spacing: ScalarType = 1.0 + ): + if L2 is None: + L2 = L1 + super().__init__(L1, L2, lattice_spacing=lattice_spacing) def __repr__(self): return super().__repr__() @@ -406,6 +419,8 @@ class Triangular(BoundedBravais): Args: L (int): number of sites in linear direction. n_atoms = L * L. + L2 (Optional[int]): number of sites along a2 direction, + n_atoms = L1 * L2, default is L1. lattice_spacing (Scalar, Real): lattice spacing. Defaults to 1.0. @@ -417,8 +432,12 @@ class Triangular(BoundedBravais): """ @beartype - def __init__(self, L: int, lattice_spacing: ScalarType = 1.0): - super().__init__(L, L, lattice_spacing=lattice_spacing) + def __init__( + self, L1: int, L2: Optional[int] = None, lattice_spacing: ScalarType = 1.0 + ): + if L2 is None: + L2 = L1 + super().__init__(L1, L2, lattice_spacing=lattice_spacing) def __repr__(self): return super().__repr__() @@ -444,7 +463,9 @@ class Lieb(BoundedBravais): - loc3 (0 ,0.5) Args: - L (int): number of sites in linear direction. n_atoms = L * L. + L1 (int): number of unit cells in linear direction. n_atoms = 3* L1 * L1. + L2 (Optional[int]): number of unit cells along a2 direction, + n_atoms = 3 * L1 * L2, default is L1. lattice_spacing (Scalar, Real): lattice spacing. Defaults to 1.0. @@ -456,8 +477,12 @@ class Lieb(BoundedBravais): """ @beartype - def __init__(self, L: int, lattice_spacing: ScalarType = 1.0): - super().__init__(L, L, lattice_spacing=lattice_spacing) + def __init__( + self, L1: int, L2: Optional[int] = None, lattice_spacing: ScalarType = 1.0 + ): + if L2 is None: + L2 = L1 + super().__init__(L1, L2, lattice_spacing=lattice_spacing) def __repr__(self): return super().__repr__() @@ -483,7 +508,9 @@ class Kagome(BoundedBravais): - loc3 (0.25 ,0.25sqrt(3)) Args: - L (int): number of sites in linear direction. n_atoms = L * L. + L1 (int): number of sites in linear direction. n_atoms = 3 * L1 * L1. + L2 (Optional[int]): number of unit cells along a2 direction, + n_atoms = 3 * L1 * L2, default is L1. lattice_spacing (Scalar, Real): lattice spacing. Defaults to 1.0. @@ -495,8 +522,12 @@ class Kagome(BoundedBravais): """ @beartype - def __init__(self, L: int, lattice_spacing: ScalarType = 1.0): - super().__init__(L, L, lattice_spacing=lattice_spacing) + def __init__( + self, L1: int, L2: Optional[int] = None, lattice_spacing: ScalarType = 1.0 + ): + if L2 is None: + L2 = L1 + super().__init__(L1, L2, lattice_spacing=lattice_spacing) def __repr__(self): return super().__repr__() diff --git a/tests/test_lattice_pprint.py b/tests/test_lattice_pprint.py index 359911175..0a3ca1aa6 100644 --- a/tests/test_lattice_pprint.py +++ b/tests/test_lattice_pprint.py @@ -101,7 +101,7 @@ def test_square_pprint(): square_pprint_var_output = open(square_pprint_var_output_path, "r").read() bl = cast("bl") - assert str(Square(7, bl)) == square_pprint_var_output + assert str(Square(7, lattice_spacing=bl)) == square_pprint_var_output def test_rectangular_pprint():