diff --git a/docker/expo_tutorial/deuteron/Deuteron_H2.ipynb b/docker/expo_tutorial/deuteron/Deuteron_H2.ipynb index 0ddada2bd..5e628405d 100644 --- a/docker/expo_tutorial/deuteron/Deuteron_H2.ipynb +++ b/docker/expo_tutorial/deuteron/Deuteron_H2.ipynb @@ -16,10 +16,10 @@ "from openfermionpsi4 import run_psi4\n", "from openfermion.hamiltonians import MolecularData\n", "import numpy as np\n", - "import pyxacc as xacc\n", - "from pyxacc import InstructionParameter\n", - "import pyxaccvqe as vqe\n", - "from pyxaccvqe import PauliOperator\n", + "import xacc\n", + "from xacc import InstructionParameter\n", + "import xaccvqe as vqe\n", + "from xaccvqe import PauliOperator\n", "%matplotlib inline" ] }, diff --git a/docker/expo_tutorial/h2/H2.ipynb b/docker/expo_tutorial/h2/H2.ipynb index bc62d5cab..43319832c 100644 --- a/docker/expo_tutorial/h2/H2.ipynb +++ b/docker/expo_tutorial/h2/H2.ipynb @@ -14,8 +14,8 @@ "outputs": [], "source": [ "import numpy as np\n", - "import pyxacc as xacc\n", - "import pyxaccvqe as vqe\n", + "import xacc\n", + "import xaccvqe as vqe\n", "from openfermion.hamiltonians import MolecularData\n", "from openfermionpsi4 import run_psi4\n", "from openfermion.transforms import get_fermion_operator" diff --git a/docs/source/dwave.rst b/docs/source/dwave.rst index 2d8eaf2e4..df3886633 100644 --- a/docs/source/dwave.rst +++ b/docs/source/dwave.rst @@ -12,28 +12,28 @@ To install this plugin, run the following $ git clone https://github.com/ornl-qci/xacc-dwave $ cd xacc-dwave && mkdir build && cd build - $ cmake .. -DXACC_DIR=$HOME/.xacc + $ cmake .. -DXACC_DIR=$HOME/.xacc -Alternatively, if you installed the XACC Python bindings, then you can run +Alternatively, if you installed the XACC Python bindings, then you can run .. code:: - $ cmake .. -DXACC_DIR=$(python -m pyxacc -L) + $ cmake .. -DXACC_DIR=$(python -m xacc -L) -ensuring that the ``pyxacc`` module is in your ``PYTHONPATH``. +ensuring that the ``xacc`` module is in your ``PYTHONPATH``. -You have now installed the D-Wave plugin. It is located in ``$XACC_ROOT/plugins``, +You have now installed the D-Wave plugin. It is located in ``$XACC_ROOT/plugins``, where ``XACC_ROOT`` is your XACC install prefix. Setting Credentials ------------------- -In order to target the D-Wave Qubist remote resources you must provide +In order to target the D-Wave Qubist remote resources you must provide XACC with your API key. By default XACC will search for a config file at ``$HOME/.dwave_config``. -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ python -m pyxacc -c dwave -k YOURAPIKEY + $ python -m xacc -c dwave -k YOURAPIKEY diff --git a/docs/source/ibm.rst b/docs/source/ibm.rst index d924a6050..670b5e7bd 100644 --- a/docs/source/ibm.rst +++ b/docs/source/ibm.rst @@ -14,15 +14,15 @@ To install this plugin, run the following $ git clone https://github.com/ornl-qci/xacc-ibm $ cd xacc-ibm && mkdir build && cd build - $ cmake .. -DXACC_DIR=$HOME/.xacc + $ cmake .. -DXACC_DIR=$HOME/.xacc -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ cmake .. -DXACC_DIR=$(python -m pyxacc -L) + $ cmake .. -DXACC_DIR=$(python -m xacc -L) -ensuring that pyxacc is in your ``PYTHONPATH``. +ensuring that xacc is in your ``PYTHONPATH``. You have now installed the IBM plugin. It is located in ``$XACC_ROOT/plugins``, where ``XACC_ROOT`` is your XACC install prefix. @@ -32,11 +32,11 @@ Setting Credentials In order to target the IBM Quantum Experience, you must provide XACC with your API key. -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ python -m pyxacc -c ibm -k YOURAPIKEY + $ python -m xacc -c ibm -k YOURAPIKEY Alternatively, open the file ``$HOME/.ibm_config``, and add the following contents @@ -94,13 +94,13 @@ kernel code for this example can be found in `Scalable Quantum Simulation of Mol Ry(qreg[1], 7.8539752); Rx(qreg[0], 1.57079); } - + __qpu__ g1Term (qbit qreg, float theta) { initializeState(qreg, theta); cbit creg[1]; creg[0] = MeasZ(qreg[0]); } - + __qpu__ g2Term (qbit qreg, float theta) { initializeState(qreg, theta); cbit creg[1]; @@ -120,7 +120,7 @@ kernel code for this example can be found in `Scalable Quantum Simulation of Mol creg[1] = MeasZ(qreg[1]); creg[0] = MeasZ(qreg[0]); } - + __qpu__ g5Term(qbit qreg, float theta) { initializeState(qreg, theta); cbit creg[2]; @@ -179,5 +179,3 @@ kernel code for this example can be found in `Scalable Quantum Simulation of Mol return 0; } - - diff --git a/docs/source/rigetti.rst b/docs/source/rigetti.rst index fd788b69d..d24ea74f5 100644 --- a/docs/source/rigetti.rst +++ b/docs/source/rigetti.rst @@ -14,15 +14,15 @@ To install this plugin, run the following $ git clone https://github.com/ornl-qci/xacc-rigetti $ cd xacc-rigetti && mkdir build && cd build - $ cmake .. -DXACC_DIR=$HOME/.xacc + $ cmake .. -DXACC_DIR=$HOME/.xacc -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ cmake .. -DXACC_DIR=$(python -m pyxacc -L) + $ cmake .. -DXACC_DIR=$(python -m xacc -L) -ensuring that pyxacc is in your ``PYTHONPATH``. +ensuring that xacc is in your ``PYTHONPATH``. You have now installed the Rigetti plugin. It is located in ``$XACC_ROOT/plugins`` and ``$XACC_ROOT/plugins``, where ``XACC_ROOT`` is your XACC install prefix. @@ -34,11 +34,11 @@ In order to target the Rigetti QVM you must provide XACC with your API key. By d XACC will use your PyQuil Config file at ``$HOME/.pyquil_config``. See `Connecting to the Rigetti Forest `_ for information on creating this file. -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ python -m pyxacc -c rigetti -k YOURAPIKEY -u YOURUSERID + $ python -m xacc -c rigetti -k YOURAPIKEY -u YOURUSERID Rigetti Command Line Arguments ------------------------------ @@ -54,8 +54,8 @@ The Rigetti plugin exposes the following command line arguments Rigetti QVM Tutorial --------------------- -Let's test out the Rigetti Accelerator by creating a code to -perform quantum teleportation. +Let's test out the Rigetti Accelerator by creating a code to +perform quantum teleportation. Create a new directory called test-xacc-rigetti and cd into it. Let's now create a test-xacc-rigetti.cpp file and get it started with the following boilerplate code: @@ -313,7 +313,7 @@ the Hydrogen molecule (code taken from `Scalable Quantum Simulation of Molecular import pyquil.api as forest from pyquil.gates import X, Z, H, CNOT, RX, RY, RZ import numpy as np - import pyxacc as xacc + import xacc # Pyquil State Preparation circuit gen def statePrep(qs, angle): @@ -410,6 +410,3 @@ This will produce a file called ``pyquil_out.csv``. Plotting this shows the correct expectation values from the simulation. .. image:: ../assets/pyquil_out.png - - - diff --git a/docs/source/tnqvm.rst b/docs/source/tnqvm.rst index f8cc759c3..a9ba43b31 100644 --- a/docs/source/tnqvm.rst +++ b/docs/source/tnqvm.rst @@ -26,16 +26,15 @@ To install this plugin, run the following $ git clone https://github.com/ornl-qci/tnqvm $ cd tnqvm && mkdir build && cd build - $ cmake .. -DXACC_DIR=$HOME/.xacc + $ cmake .. -DXACC_DIR=$HOME/.xacc -If you installed the XACC Python bindings, then you can run +If you installed the XACC Python bindings, then you can run .. code:: - $ cmake .. -DXACC_DIR=$(python -m pyxacc -L) + $ cmake .. -DXACC_DIR=$(python -m xacc -L) -ensuring that pyxacc is in your ``PYTHONPATH``. +ensuring that xacc is in your ``PYTHONPATH``. -You have now installed the TNQVM plugin. It is located in ``$XACC_ROOT/plugins``, +You have now installed the TNQVM plugin. It is located in ``$XACC_ROOT/plugins``, where ``XACC_ROOT`` is your XACC install prefix. - diff --git a/docs/source/xacc-vqe.rst b/docs/source/xacc-vqe.rst index 05f84fd9b..c9b908136 100644 --- a/docs/source/xacc-vqe.rst +++ b/docs/source/xacc-vqe.rst @@ -14,16 +14,15 @@ To install this plugin, run the following $ git clone https://github.com/ornl-qci/xacc-vqe $ cd xacc-vqe && mkdir build && cd build - $ cmake .. -DXACC_DIR=$HOME/.xacc + $ cmake .. -DXACC_DIR=$HOME/.xacc If you installed the XACC Python bindings, then you can run .. code:: - $ cmake .. -DXACC_DIR=$(python -m pyxacc -L) + $ cmake .. -DXACC_DIR=$(python -m xacc -L) -ensuring that pyxacc is in your ``PYTHONPATH``. +ensuring that xacc is in your ``PYTHONPATH``. You have now installed the XACC-VQE plugin. It is located in ``$XACC_ROOT/plugins``, where ``XACC_ROOT`` is your XACC install prefix. - diff --git a/tools/framework/xacc-framework b/tools/framework/xacc-framework index 746f89a9b..4426c011a 100644 --- a/tools/framework/xacc-framework +++ b/tools/framework/xacc-framework @@ -19,7 +19,7 @@ import multiprocessing import platform try: - import pyxacc as xacc + import xacc except ImportError: print('Error - cannot import XACC Python Bindings. Exiting') sys.exit() @@ -34,7 +34,7 @@ def parse_args(args): parser.add_argument("-i", "--initialize", action='store_true', help="Initialize the framework.", required=False) parser.add_argument("-L", "--location", action='store_true', help="Print the path to the XACC install location.", required=False) parser.add_argument("-b", "--branch", default='master',type=str, help="Print the path to the XACC install location.", required=False) - + opts = parser.parse_args(args) return opts @@ -43,14 +43,14 @@ availablePluginUrls = { 'xacc-scaffold' : ornlqci+'/xacc-scaffold', 'xacc-rigetti' : ornlqci+'/xacc-rigetti', 'xacc-dwave' : ornlqci+'/xacc-dwave', 'xacc-ibm' : ornlqci+'/xacc-ibm', - 'xacc-python' : ornlqci+'/xacc-python', + 'xacc-python' : ornlqci+'/xacc-python', 'tnqvm' : ornlqci+'/tnqvm', 'ibm' : ornlqci+'/xacc-ibm', 'rigetti' : ornlqci+'/xacc-rigetti', 'scaffold' : ornlqci+'/xacc-scaffold', - 'dwave' : ornlqci+'/xacc-dwave', - 'vqe' : ornlqci+'/xacc-vqe', - 'xacc-dwsapi-embedding' : ornlqci+'/xacc-dwsapi-embedding', + 'dwave' : ornlqci+'/xacc-dwave', + 'vqe' : ornlqci+'/xacc-vqe', + 'xacc-dwsapi-embedding' : ornlqci+'/xacc-dwsapi-embedding', 'xacc-projectq' : ornlqci+'/xacc-projectq' } def mkdir_p(path): @@ -83,8 +83,8 @@ def initialize(): file.close() file = open(xaccHome+'/.internal_plugins', 'w') - - xaccLocation = os.path.dirname(os.path.realpath(xacc.__file__)) + + xaccLocation = os.path.dirname(os.path.realpath(xacc.__file__)) if platform.system() == "Darwin": libname1 = "libxacc-quantum-gate.dylib" libname2 = "libxacc-quantum-aqc.dylib" @@ -96,10 +96,10 @@ def initialize(): file.write(xaccLocation+'/lib/'+libname1+'\n') if xaccLocation+'/lib/'+libname2+'\n' not in contents: file.write(xaccLocation+'/lib/'+libname2+'\n') - + file.write(contents) file.close() - + def main(argv=None): opts = parse_args(sys.argv[1:]) @@ -109,8 +109,8 @@ def main(argv=None): if not os.path.exists(os.environ['HOME']+'/.xacc/.internal_plugins'): initialize() - - # pyxacc can be installed in site-packages/xacc-...-egg or + + # pyxacc can be installed in site-packages/xacc-...-egg or # in ${XACC_DIR}/lib/python, we need to figure out which one xaccLocation = os.path.dirname(os.path.realpath(xacc.__file__)) if opts.location: @@ -118,9 +118,9 @@ def main(argv=None): sys.exit(0) print('XACC Install Location = ', xaccLocation) xacc_cwd = os.getcwd() - + cpus = str(multiprocessing.cpu_count()) - if not opts.make_threads == None: + if not opts.make_threads == None: cpus = str(opts.make_threads) branch = 'master' @@ -145,7 +145,7 @@ def main(argv=None): print("--------------------------- ERROR -----------------------------") print("") exit() - + # Create a CMakeLists.txt file cmakeContents = """ project(""" + plugin + """-project LANGUAGES CXX) @@ -168,17 +168,17 @@ def main(argv=None): mkdir_p(plugin+'-install/build') os.chdir(plugin+'-install') - # Write the CMakeLists file + # Write the CMakeLists file cmakelists = open("CMakeLists.txt", "w") cmakelists.write("%s" % cmakeContents) cmakelists.close() - + # Execute the build os.chdir('build') cmakecmd = ['cmake', '..'] subprocess.check_call(cmakecmd, stderr=subprocess.STDOUT, shell=False) subprocess.check_call(['make', '-j'+cpus], stderr=subprocess.STDOUT, shell=False) - + os.chdir(xacc_cwd) if __name__ == "__main__":