qdk_chemistry.ui.cli module
Command-line interface for QDK Chemistry MCP tools.
All commands live at the top level — no nested groups. Algorithm
commands use a run- prefix.
Usage:
qc run-scf --project-name myproj ...
qc summary --project-name myproj --filename wf.wavefunction.json
qc list-projects
qc workflow --config pipeline.json --project-name myproj
Compound algorithms (run-mcscf, run-qpe, run-energy) accept a --config
JSON file for nested algorithm settings, with optional --set key=value
overrides. Generate a default config template with:
qc defaults --type mcscf
Use --dry-run before any command to preview parameters without executing.
- qdk_chemistry.ui.cli.compute_valence_space_parameters(wavefunction: qdk_chemistry.data.Wavefunction, charge: SupportsInt | SupportsIndex, include_double_d_shell: bool = False) tuple[int, int]
Get the default number of active electrons and active orbitals, which are obtained from the valence electrons and orbitals of the atomic element types in the structure. The structure is automatically extracted from the wavefunction.
- Parameters:
wavefunction – The input wavefunction (the molecular structure is taken from
wavefunction.orbitals.basis_set.structure).charge – The total charge of the molecular system. Should match the charge used in the upstream SCF calculation.
include_double_d_shell – When
True, add 5 correlating d’ orbitals per d-block atom (Sc-Zn, Y-Cd, Hf-Hg) to capture the strong nd / (n+1)d’ radial correlation in transition metals (the “double d-shell” effect). Defaults toFalseto preserve the historical sizing.
- Returns:
Pair of ( n_active_electrons, n_active_orbitals )
- Return type:
Examples
>>> nele, norb = compute_valence_space_parameters(wavefunction, charge) >>> nele, norb = compute_valence_space_parameters(wavefunction, charge, include_double_d_shell=True)
- qdk_chemistry.ui.cli.load_data_object(filename, data_class)
Load a data object from either json or hdf5 file based on extension.
- Parameters:
- Returns:
The loaded data object
- Raises:
ValueError – If file extension is not supported
- qdk_chemistry.ui.cli.save_data_object(data_obj, filename)
Save a data object to either json or hdf5 file based on extension.
- Parameters:
- Returns:
The filename where data was saved
- Return type:
- Raises:
ValueError – If file extension is not supported
- qdk_chemistry.ui.cli.create_majorana_mapping(project_name, out_mapping_filename, encoding='jordan-wigner', num_modes=None, hamiltonian_filename=None, overwrite=False)
Create and save a MajoranaMapping for a mode count or Hamiltonian.
- qdk_chemistry.ui.cli.create_model_hamiltonian(project_name, model, out_hamiltonian_filename, lattice_type, lattice_params, epsilon=0.0, t=1.0, u_coulomb=0.0, v_coulomb=None, z=1.0, potential=None, potential_params=None, overwrite=False)
Construct and save a fermionic lattice-model Hamiltonian.
- qdk_chemistry.ui.cli.create_spin_model_hamiltonian(project_name, model, out_qubit_hamiltonian_filename, lattice_type, lattice_params, jx=0.0, jy=0.0, jz=0.0, hx=0.0, hy=0.0, hz=0.0, j=None, h=None, overwrite=False)
Construct and save an Ising or Heisenberg QubitHamiltonian.
- qdk_chemistry.ui.cli.create_structure(project_name, coordinates_json, symbols, nuclear_charges=None, masses=None, filename_to_save='structure.structure.json', overwrite=False)
Create and save a Structure from Bohr coordinates; use convert_coordinates for Angstrom input.
- qdk_chemistry.ui.cli.describe_backend(backend_type, name)
Describe accepted configuration fields for a cache or remote backend.
- qdk_chemistry.ui.cli.get_active_space_indices(project_name, input_filename)
Return active, inactive, and virtual orbital indices from a supported object.
- qdk_chemistry.ui.cli.get_algorithm_default_settings(algorithm_type, algorithm_name=None)
Return default settings for an algorithm implementation.
- qdk_chemistry.ui.cli.get_algorithm_default_type(algorithm_type)
Return the default implementation name for an algorithm type.
- qdk_chemistry.ui.cli.get_ansatz(project_name, wavefunction_filename, hamiltonian_filename, out_ansatz_filename, overwrite=False)
Combine a saved Hamiltonian and Wavefunction into a saved Ansatz.
- qdk_chemistry.ui.cli.get_orbitals_from_input(project_name, input_filename, out_orbitals_filename, overwrite=False)
Extract and save Orbitals from a supported electronic-structure object.
- qdk_chemistry.ui.cli.get_top_configurations(project_name, wavefunction_filename, max_determinants=None)
Return configuration strings ranked by Wavefunction CI coefficient magnitude.
- qdk_chemistry.ui.cli.list_cache_backends()
List registered cache backend names.
- qdk_chemistry.ui.cli.list_remote_backends()
List registered remote execution backend names.
- qdk_chemistry.ui.cli.run_active_space_selector(project_name, wavefunction_filename, out_wavefunction_filename, charge=None, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run an active-space selector on a Wavefunction and save the resulting Wavefunction.
- qdk_chemistry.ui.cli.run_circuit_executor(project_name, circuit_filename, shots, out_executor_data_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Execute a Circuit and save its CircuitExecutorData.
- qdk_chemistry.ui.cli.run_controlled_evolution_circuit_mapper(project_name, time_evolution_unitary_filename, out_circuit_filename, control_indices=None, power=1, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Map a TimeEvolutionUnitary to a saved controlled Circuit.
- Return type:
- Parameters:
- qdk_chemistry.ui.cli.run_dynamical_correlation_calculator(project_name, ansatz_filename, out_wavefunction_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run dynamical correlation for an Ansatz and save the resulting Wavefunction.
- qdk_chemistry.ui.cli.run_energy_estimator(project_name, circuit_filename, qubit_hamiltonian_filename, out_energy_result_filename, out_measurement_data_filename, total_shots, noise_model=None, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Estimate a mapped Hamiltonian expectation value, excluding core energy, and variance from a Circuit.
- Return type:
- Parameters:
project_name (str)
circuit_filename (str)
qubit_hamiltonian_filename (str)
out_energy_result_filename (str)
out_measurement_data_filename (str)
total_shots (int)
noise_model (Any | None)
algorithm_name (str | None)
settings (dict | None)
cache (str | None)
remote (str | None)
remote_config (dict | None)
remote_timeout (int)
overwrite (bool)
- qdk_chemistry.ui.cli.run_hamiltonian_constructor(project_name, orbitals_filename, out_hamiltonian_filename, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Build and save a fermionic Hamiltonian from molecular Orbitals.
- qdk_chemistry.ui.cli.run_multi_configuration_calculation(project_name, hamiltonian_filename, out_wavefunction_filename, n_active_alpha_electrons, n_active_beta_electrons=None, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run a multi-configuration calculation and save its Wavefunction.
- Return type:
- Parameters:
project_name (str)
hamiltonian_filename (str)
out_wavefunction_filename (str)
n_active_alpha_electrons (int)
n_active_beta_electrons (int | None)
algorithm_name (str | None)
settings (dict | None)
cache (str | None)
remote (str | None)
remote_config (dict | None)
remote_timeout (int)
overwrite (bool)
- qdk_chemistry.ui.cli.run_multi_configuration_scf(project_name, orbitals_filename, out_wavefunction_filename, n_active_alpha_electrons, n_active_beta_electrons=None, ham_constructor_algorithm_name=None, ham_constructor_settings=None, mc_calculator_algorithm_name=None, mc_calculator_settings=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run MCSCF from active-space Orbitals and save the resulting Wavefunction.
- Return type:
- Parameters:
project_name (str)
orbitals_filename (str)
out_wavefunction_filename (str)
n_active_alpha_electrons (int)
n_active_beta_electrons (int | None)
ham_constructor_algorithm_name (str | None)
ham_constructor_settings (dict | None)
mc_calculator_algorithm_name (str | None)
mc_calculator_settings (dict | None)
settings (dict | None)
cache (str | None)
remote (str | None)
remote_config (dict | None)
remote_timeout (int)
overwrite (bool)
- qdk_chemistry.ui.cli.run_orbital_localization(project_name, wavefunction_filename, out_wavefunction_filename, loc_indices_alpha, loc_indices_beta=None, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Localize selected Wavefunction orbitals and save the resulting Wavefunction.
- qdk_chemistry.ui.cli.run_phase_estimation(project_name, state_prep_circuit_filename, qubit_hamiltonian_filename, out_qpe_result_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run phase estimation and save a QpeResult whose mapped energies exclude core energy.
- Return type:
- Parameters:
- qdk_chemistry.ui.cli.run_projected_multi_configuration_calculation(project_name, hamiltonian_filename, configurations_json, out_wavefunction_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Solve a Hamiltonian in a supplied determinant subspace and save the Wavefunction.
- qdk_chemistry.ui.cli.run_qubit_hamiltonian_solver(project_name, qubit_hamiltonian_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None)
Diagonalize a QubitHamiltonian and return its mapped energy, excluding core energy, and eigenstate.
- qdk_chemistry.ui.cli.run_qubit_mapper(project_name, hamiltonian_filename, mapping_filename, out_qubit_hamiltonian_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Save a mapped QubitHamiltonian excluding core energy and return its filename with the companion offset.
- Return type:
- Parameters:
- qdk_chemistry.ui.cli.run_scf(project_name, structure_filename, out_wavefunction_filename, charge, spin_multiplicity, basis_set, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Run an HF or DFT self-consistent-field calculation and save its Wavefunction.
- Return type:
- Parameters:
- qdk_chemistry.ui.cli.run_stability_checker(project_name, wavefunction_filename, out_stability_result_filename, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Evaluate orbital-rotation stability and save the StabilityResult.
- qdk_chemistry.ui.cli.run_state_preparation(project_name, wavefunction_filename, out_circuit_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Compile a Wavefunction into a saved Circuit.
- qdk_chemistry.ui.cli.run_time_evolution_builder(project_name, qubit_hamiltonian_filename, evolution_time, out_time_evolution_unitary_filename, algorithm_name=None, settings=None, cache=None, remote=None, remote_config=None, remote_timeout=120, overwrite=False)
Build exp(-iHt) from a QubitHamiltonian and save the TimeEvolutionUnitary.
- Return type:
- Parameters:
- qdk_chemistry.ui.cli.resolve_project_path(project_name, projects_dir)
Resolve a single-component project name beneath the projects directory.
- qdk_chemistry.ui.cli.cmd_plugin(args)[source]
Install or maintain the QDK Chemistry Copilot plugin.
- qdk_chemistry.ui.cli.cmd_correlate(args)[source]
Run dynamical correlation calculator (MP2, CCSD, …).
- qdk_chemistry.ui.cli.cmd_casci(args)[source]
Run multi-configuration (CASCI / selected-CI) calculation.
- qdk_chemistry.ui.cli.cmd_mcscf(args)[source]
Run multi-configuration SCF (MCSCF / CASSCF).
This is a compound algorithm with nested sub-algorithms for the Hamiltonian constructor and multi-configuration calculator. Use
--configfor full control over sub-algorithm settings, or--setfor quick overrides.
- qdk_chemistry.ui.cli.cmd_sparse_ci(args)[source]
Run projected multi-configuration (sparse CI) calculation.
- qdk_chemistry.ui.cli.cmd_energy(args)[source]
Estimate energy from circuit measurements.
This is a compound algorithm with optional noise model. Use
--configfor full control, or--setfor quick overrides.
- qdk_chemistry.ui.cli.cmd_qpe_build_evolution(args)[source]
Build time evolution unitary U = exp(-iHt).
- qdk_chemistry.ui.cli.cmd_qpe_map_circuit(args)[source]
Map time evolution unitary to controlled circuit.
- qdk_chemistry.ui.cli.cmd_qpe(args)[source]
Run quantum phase estimation (full pipeline).
Sub-algorithms are configured inline in the settings dict:
{"qpe": {"settings": { "qpe_circuit_builder": { "num_bits": 10, "unitary_builder": {"algorithm_name": "trotter", "time": 1.0, "order": 2}, "controlled_circuit_mapper": {"algorithm_name": "pauli_sequence"} }, "circuit_executor": {"algorithm_name": "qdk_sparse_state_simulator"} }}}
- qdk_chemistry.ui.cli.cmd_defaults(args)[source]
Print default algorithm settings or a config template.
With
--type, generates a compound config template (mcscf, qpe, energy). With--algorithm-type, shows the default algorithm name. With--algorithm-type --algorithm-name, shows settings for that algorithm.
- qdk_chemistry.ui.cli.cmd_list_algorithms(args)[source]
List all available algorithm types and implementations.
- qdk_chemistry.ui.cli.cmd_list_remote_backends(_args)[source]
List available remote execution backend names.
- qdk_chemistry.ui.cli.cmd_describe_backend(args)[source]
Describe configuration parameters for a cache or remote backend.
- qdk_chemistry.ui.cli.cmd_data_summary(args)[source]
Print a human-readable summary of any data file.
- qdk_chemistry.ui.cli.cmd_data_convert(args)[source]
Convert a data file between JSON and HDF5 formats.
- qdk_chemistry.ui.cli.cmd_data_get_orbitals(args)[source]
Extract and save orbitals from a Wavefunction/Hamiltonian/Ansatz/ConfigurationSet.
- qdk_chemistry.ui.cli.cmd_data_get_active_space_indices(args)[source]
Get active, inactive, and virtual orbital space indices.
- qdk_chemistry.ui.cli.cmd_data_get_ansatz(args)[source]
Build and save an Ansatz from wavefunction + Hamiltonian.
- qdk_chemistry.ui.cli.cmd_data_get_top_configurations(args)[source]
Get top CI determinants ranked by coefficient magnitude.
- qdk_chemistry.ui.cli.cmd_data_create_structure(args)[source]
Create a molecular structure in a project.
- qdk_chemistry.ui.cli.cmd_data_get_energy(args)[source]
Get energy value from a Wavefunction, QpeResult, or EnergyExpectationResult.
- qdk_chemistry.ui.cli.cmd_data_get_structure_xyz(args)[source]
Export structure as XYZ format string.
- qdk_chemistry.ui.cli.cmd_data_get_circuit_stats(args)[source]
Analyze circuit resource profile: gates, depth, qubits.
- qdk_chemistry.ui.cli.cmd_data_get_qubit_hamiltonian_info(args)[source]
Inspect qubit Hamiltonian: qubits, terms, norm, hermiticity.
- qdk_chemistry.ui.cli.cmd_data_get_stability_result(args)[source]
Inspect wavefunction stability result.
- qdk_chemistry.ui.cli.cmd_data_get_qpe_result(args)[source]
Inspect QPE result: energies, phase, bits.
- qdk_chemistry.ui.cli.cmd_utils_list_projects(_args)[source]
List all projects in the scratch directory.
- qdk_chemistry.ui.cli.cmd_utils_list_files(args)[source]
List data files in a project, with inferred types.
- qdk_chemistry.ui.cli.cmd_utils_convert_coordinates(args)[source]
Convert coordinates between Bohr and Angstrom.
- qdk_chemistry.ui.cli.cmd_utils_convert_energy(args)[source]
Convert energy between Hartree, eV, and kcal/mol.
- qdk_chemistry.ui.cli.cmd_utils_compute_valence_params(args)[source]
Compute valence space parameters (active electrons & orbitals).
- qdk_chemistry.ui.cli.cmd_utils_resolve_phase_energy(args)[source]
Resolve QPE phase to energy using the unitary’s phase mapping.
- qdk_chemistry.ui.cli.cmd_workflow(args)[source]
Execute a multi-step workflow from a JSON configuration file.
- qdk_chemistry.ui.cli.cmd_describe(args)[source]
Output a JSON schema for a CLI or workflow command.
- qdk_chemistry.ui.cli.cmd_list_commands(_args)[source]
List all available commands in JSON format for agent discovery.
- qdk_chemistry.ui.cli.cmd_remote_run(args)[source]
Execute a serialized algorithm job from an input directory.
This command is invoked by the remote execution backend on compute nodes. It replaces the generated Python script with a stable, single-command interface.
- Steps:
Optionally connect to a remote cache (from the manifest).
Check the cache for a full result hit → write outputs and exit.
Deserialize inputs (resolving
"cached"entries from the cache).Reconstruct and execute the algorithm.
Store results in the remote cache (best-effort).
Serialize outputs to the output directory.
- qdk_chemistry.ui.cli.create_parser()[source]
Create the argument parser with grouped subcommands.
Top-level groups:
qc run scf ... # algorithm execution qc data summary ... # data inspection / extraction qc config algorithms # configuration & discovery qc project list # project management qc util convert-energy # unit conversion helpers qc workflow ... # multi-step pipelines qc describe ... # command introspection
- Return type: