Example: Proline - QC-at-Davis/ALALI GitHub Wiki

Now, let's go over a real example: the amino acid Proline!

ALALI can be easily imported with:

import ALALI

From there, a molecule instance can be created. We'll need the SMILES string for proline, which can be found easily on PubChem.

# proline smiles is C1CC(NC1)C(=O)O
proline = ALALI.molecule("C1CC(NC1)C(=O)O", "smi")

For more information on molecule parameters, including how to remove hydrogens, simply enter

help(ALALI.molecule)

By default, hydrogens will be added to the molecule, a 3D conformation will be generated, and the class will automatically generate everything that we need to continue, including a pytket circuit, networkx graph, and RDKit molecule. These can be accessed as molecule attributes, as seen below.

All three representations rely on an atom index number. Each atom is indexed with an integer.

  • See RDKit documentation for working with RDKit molecules.
  • See networkx documentation for working with the networkx graph (Nodes are labelled with the atom index, and have the attribute 'symbol' to store the element type. Edges have the attribute 'type' to store the number of bonds)
  • See pytket documentation for working with the Pytket circuit objects (Pytket.circuit.Circuit)
pytket_circuit = proline.circuit
networkx_graph = proline.graph
rdkit_molecule = proline.mol

Now, we can output a .mol file (RDKit molecule), .graphml file (Networkx graph), and .txt file (Pytket circuit commands)

proline.output("proline")

These files will be saved to the working directory as proline.txt, proline.graphml, and proline.txt

Now, one might be interested in routing the Pytket circuit to an architecture. A list of available architectures is available here:

help(ALALI.ibm)

Our existing circuit can now be routed to the IBM tokyo 20-qubit machine with a simple command:

routed_circuit = ALALI.route_circuit(proline.circuit, ALALI.ibm.ibmq_20_tokyo)

Let's say that we don't want any BRIDGE or SWAP gates in our circuit. This could be useful because IBMQ doesn't support BRIDGE gates. We can do this with:

decomposed_circuit = ALALI.decompose_circuit(routed_circuit, 1)
# For the second parameter, using 1 will result in no BRIDGE gates and 2 will result in a fully decomposed circuit (including any SWAPs that can be decomposed)

Now we can have an IBMQ compatible circuit with the command:

ibm_circuit = ALALI.circuit_to_ibm(decomposed_circuit)
print(ibm_circuit) #Print the circuit

That's it! For more documentation, please use the help() function. More documentation is on the way. Of course, you now have access to RDKit/Networkx/Pytket molecule representations, so you can do whatever you want with those.