We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Photonics

Photonics

Topics related to Lumerical and more.

qInterconnect for a simple logic gate

    • marinella.guzman
      Subscriber
      How to simulate a Hadamard gate using qInterconnect? I am trying to learn qInterconnect and first I wanted to see if I can use it to analyze a simple hadamard gate using a directional coupler. However, every time I try to run it, I get an error saying that the input state does not exist in the created Hilbert space. How do i fix this? 
       
      For context, this is the code I am trying to run:
       
      import sys,os

      from qinterconnect.solver import QSolver

      os.chdir(os.path.dirname(os.path.abspath(__file__)))

      nlsparams = {
                  "mode_per_channel": 1,
                  "nchannel": 2,
                  "interconnect_file": "Trial.icp",
                  "circuit": "Comp_DC",
                  "input_ports": ["port 1", "port 2"],
                  "output_ports": ["port 3", "port 4"],
                  "nmax":2,
                  "input_dims": [2,2],
                  "ket_in":{
                        (0, 1): [1,0],
                        (1, 0): [1,0]                    
                            },
                  "ket_out":{
                        (0,1): [0.707,0],
                        (1,0): [0.707,0]                    
                            },
                  "measurement_mask":[1,0],                         
            }

              

      nls = QSolver(**nlsparams)
      success_prob=nls.run()

      print(success_prob)
      print('Final Density Matrix:')
      print(nls.rho_final.tidyup(atol=1e-3))
    • Artemis Karvounis
      Ansys Employee

      Hello,

      thank you for contacting us.

      Well, you need to define properly the measurement mask. Therefore you need to modify your script in the following way:

      Instead of  "measurement_mask":[1,0] you need to write:    "measurement_mask":[100,1]

      More specifically, the measurement_mask is a required parameter in the dictionary of the simulation parameters. You may find more details on the following link: https://optics.ansys.com/hc/en-us/articles/7369338471443-qINTERCONNECT-User-Guide 

      Kind regards,

      Artemis

       
Viewing 1 reply thread
  • You must be logged in to reply to this topic.