qdk_chemistry package

QDK/Chemistry Library.

class qdk_chemistry.TargetProfile

Bases: object

A Q# target profile.

A target profile describes the capabilities of the hardware or simulator which will be used to run the Q# program.

Adaptive_RI = TargetProfile.Adaptive_RI
Adaptive_RIF = TargetProfile.Adaptive_RIF
Base = TargetProfile.Base
Unrestricted = TargetProfile.Unrestricted
classmethod from_str(key)

Creates a target profile from a string. :param value: The string to parse. :raises ValueError: If the string does not match any target profile.

Return type:

TargetProfile

qdk_chemistry.qdk_init(*, target_profile=TargetProfile.Unrestricted, target_name=None, project_root=None, language_features=None, trace_circuit=None)

Initializes the Q# interpreter.

Parameters:
  • target_profile (TargetProfile) – Setting the target profile allows the Q# interpreter to generate programs that are compatible with a specific target. See :py:class: qsharp.TargetProfile.

  • target_name (Optional[str]) – An optional name of the target machine to use for inferring the compatible target_profile setting.

  • project_root (Optional[str]) – An optional path to a root directory with a Q# project to include. It must contain a qsharp.json project manifest.

  • trace_circuit (Optional[bool]) – Enables tracing of circuit during execution. Passing True is required for the dump_circuit function to return a circuit. The circuit function is NOT affected by this parameter will always generate a circuit.

  • language_features (List[str] | None)

Return type:

Config

qdk_chemistry.get_qdk_profile_config()

Returns the Q# interpreter configuration.

Return type:

Config

Returns:

The Q# interpreter configuration.

class qdk_chemistry.QDKChemistryConfig

Bases: pybind11_object

QDKChemistry Configuration class.

This class provides access to QDKChemistry configuration functionality, including resource directory management and other configuration options.

Examples

>>> import qdk_chemistry._core as core
>>> config = core.QDKChemistryConfig()
>>>
>>> # Get current resources directory
>>> current_dir = config.get_resources_dir()
>>> print(f"Current resources directory: {current_dir}")
>>>
>>> # Set custom resources directory
>>> config.set_resources_dir("/path/to/custom/resources")
>>>
>>> # Verify the change
>>> new_dir = config.get_resources_dir()
>>> print(f"New resources directory: {new_dir}")
>>>
>>> # Or use static methods directly
>>> core.QDKChemistryConfig.get_resources_dir()
>>> core.QDKChemistryConfig.set_resources_dir("/another/path")
__init__(*args, **kwargs)
static get_resources_dir() str

Get the current resources directory path.

Returns:

The current resources directory path as a string.

Return type:

str

Examples

>>> import qdk_chemistry._core as core
>>> resources_path = core.QDKChemistryConfig.get_resources_dir()
>>> print(f"Resources directory: {resources_path}")
static set_resources_dir(path: str) None

Set the resources directory path.

Parameters:

path (str) – The new resources directory path.

Examples

>>> import qdk_chemistry._core as core
>>> core.QDKChemistryConfig.set_resources_dir("/path/to/custom/resources")
>>> # Verify the change
>>> print(core.QDKChemistryConfig.get_resources_dir())

Subpackages

Submodules