question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[refactor] Towards a non-driver focused future

See original GitHub issue

What should we add?

This Epic outlines the plan for the upcoming restructuring of the entire Qiskit Nature code base. Separate issues will be created outlining the refactoring plan for each existing module in more detail. (Some modules/files will not be migrated. See at the bottom of this description.)

Vision

We are undertaking a step away from the existing control flow in which Qiskit Nature uses drivers to handle the electronic structure integral generation by calling other classical codes. Instead, the plan is to design a code- and language-agnostic description (implemented with HDF5) of a problem for Qiskit Nature to solve, which the classical code can generate directly. In this way, the responsibility over the control flow of a calculation is handed over to the classical codes rather than remaining within Qiskit Nature.

This has multiple benefits, a major one being the immediate availability of iterative embedding techniques already implemented in classical codes (e.g. CASSCF). In Qiskit Nature’s current design, only CASCI calculations are possible and an implementation of CASSCF would require a custom driver class for each classical code, which is not scalable for the future.

Another issue will be opened in the near future outlining this vision in more detail and discussing the planned HDF5 file structure.

Code Structure

With such a drastic change in design, we are taking this opportunity to restructure the code base. The following structure roughly outlines the intended new structure:

qiskit_nature/
    second_quantization/
        algorithms/
            excited_state_solvers/
            ground_state_solvers/
            initial_points/
        circuit/
            library/
                ansatzes/
                initial_states/
        operators/
        mappers/
        hamiltonians/
        properties/
        problems/
        transformers/
        drivers/

A more detailed overview including the main classes is given by the following UML:

overview

Workflow

Someone already familiar with Qiskit Nature, should not have much trouble understanding the relations outlined by the following class diagram:

relations

Together with this pseudo code, this should roughly outline the intended workflow:

from qiskit_nature.second_quantization.algorithms.ground_state_solvers import (
    GroundStateEigensolver,
    VQEUCCFactory,
)
from qiskit_nature.second_quantization.mappers import JordanWignerMapper, QubitConverter
from qiskit_nature.second_quantization.drivers import HDF5Driver

problem = HDF5Driver("problem_description.hdf5").run()

solver = GroundStateEigensolver(
    VQEUCCFactory(),
    QubitConverter(JordanWignerMapper()),
)

result = solver.solve(problem)

More details on the various modules will be provided by the respective issues.

Unaffected modules

  • constants.py
  • deprecation.py
  • exceptions.py
  • hdf5.py
  • logging.py
  • optionals.py
  • runtime
  • settings.py
  • utils
  • version.py
  • VERSION.txt

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mrossinekcommented, Jul 21, 2022

Minor update: I updated the issue description, including the UML graphics, to reflect the design changes as also discussed by @ElePT further up

1reaction
mrossinekcommented, Jul 4, 2022

Thanks for the summary, @ElePT! Looks like you got everything right 👍

EDIT: You may want to indicate that ElectronicStructureResult (and similar classes) will become part of the problems module

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control Transition Interfaces in Semiautonomous Vehicles
Designing safe and effective systems for control transitions between human and vehicle is a difficult task, due to increased reaction times ...
Read more >
Architecture Software Platform for Plug-In Electric Vehicle ...
to vehicle-grid integration and PEV charge management. The focus group findings helped inform current project and potential future efforts including:.
Read more >
Refactor Now or Never - YouTube
Webinar Agenda:0:06 Introduction5:48 Code smells9:10 Method-level code smells28:16 Class-level code smells45:26 General code smells55:00 ...
Read more >
The Collaborative Software Process - Laurie Williams
ter 7 suggests future research to further validate and collaborative ... Programming pairs routinely "refactor" the code base by continuous change and en-....
Read more >
Free Railway Reservation System Project Report - My Mental Health ...
The Future of Disability in America - Institute of Medicine 2007-10-24 ... lean, focused, and thoroughly comprehensive reference for those who live in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found