Source code for schrodinger.application.matsci.qb_sdk.parameters

# Copyright (c) 2021, Qu & Co
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.

# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
This module contains all the main parameters used by the package and their default values.
"""

# built-in
import os
from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional


[docs]@dataclass class QubecChemistryProblem: """ Model for a QUBEC job problem definition Attributes: geometry (list): A molecular geometry represent a list of atom and coordinates basis_set (str): A valid basis set for molecular wavefunction charge (int): The desired charge of the system multiplicity (int): The spin multiplicity """ geometry: List basis_set: str charge: Optional[int] = 0 multiplicity: Optional[int] = 1 properties: Optional[Dict[str, bool]] = field(default_factory=dict)
[docs]class QubecAlgorithm(Enum): """ Enumeration with the avaliable quantum algorithms in QUBEC Current values are: 'vqa' and 'qpe_re' Values: 'vqa': variational quantum algorithm 'qpe_re': resource estimator using the quantum phase estimation algorithm """ vqa = "vqa" qpe_re = "qpe_re"
[docs]class QubecSdkError(Exception): """ Wrapper for general QUBEC SDK exception """ pass
# TODO: change this default to the production environment endpoint before release QUBEC_SDK_ENDPOINT = os.environ.get("QUBEC_ENDPOINT", "cloud-quandco.com") QUBEC_SDK_PORT = os.environ.get("QUBEC_PORT", 443) QUBEC_SDK_PROTOCOL = os.environ.get("QUBEC_PROTOCOL", "https") QUBEC_SDK_VERBOSE = os.environ.get("QUBEC_VERBOSE", "false").lower() in ("true", "t", "1") QUBEC_SDK_TERMINATE_ON_FAIL = os.environ.get("QUBEC_TERMINATE_ON_FAIL", "true").lower() in ( "true", "t", "1", ) BASE_URL = f"{QUBEC_SDK_PROTOCOL}://{QUBEC_SDK_ENDPOINT}:{QUBEC_SDK_PORT}/qubec/v1" SEPARATOR = "--------------------------------\n" ENCODING_FMT = "utf-8" AVAILABLE_ALGORITHMS = ["vqa", "qpe_re"] AVAILABLE_PROPERTIES = ["dipole", "polarizability"] AVAILABLE_BACKEND_TYPES = ["qpu", "simulator", "noisy_simulator"] DEFAULT_BACKEND_TYPE = "simulator" DEFAULT_PROVIDER = "qiskit" DEFAULT_QPU_CHIP = "ibmq_athens" DEFAULT_SIMULATION_TYPE = "tomography" DEFAULT_N_SHOTS = 8192 DEFAULT_SCF_PARAMETERS = { "scf_spin_treatment": "unrestricted", "scf_es": False, "scf_n_es": 1, "scf_max_iter": 30, } DEFAULT_QUANTUM_PARAMETERS = { "paired_electrons": False, "circuit_ansatz": "puccd", "initial_angles": "cc", "quantum_es_algorithm": "ss_vqe", "quantum_es": False, "quantum_n_es": 1, "variational_proc": True, "max_variational_iter": 30, "error_mitigation": False, "qpe_algorithm": "sparse_qubitization", "hamiltonian_dynamics": "qubitization", "target_optimiziation": "physical_qubits", "qpe_platform": "superconducting", "target_accuracy": 1, "error_rate": 1, }