-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refactor] Towards a non-driver focused future #701
Comments
When doing these kinds of refactorings it's good to try as much as possible to preserve the version control history of each file (so |
I agree, that would be ideal. However, to some degree this might not be possible because we need to actually copy instead of move the code, in order to abide by our deprecation policies. |
Perhaps we could have one commit that moves the code to the new location, followed by another commit that copies it back to the old. |
The idea behind this comment is to explain the change in direction that you will see in my refactoring PR (#722). As discussed with @mrossinek and @woodsp-ibm, we will change this proposed structure in favor of a flatter and hopefully more intuitive one, where:
So, some modules will still follow the structure shown above:
But we will slightly modify the rest of the modules to follow:
Did I overlook anything? |
Thanks for the summary, @ElePT! Looks like you got everything right 👍 EDIT: You may want to indicate that |
I am reopening this Epic. I faultily linked it to the PR which does the code restructuring, but more upcoming refactorings are related to this. |
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
Minor update: I updated the issue description, including the UML graphics, to reflect the design changes as also discussed by @ElePT further up |
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
As outlined in qiskit-community#701, Qiskit Nature is working towards a non-driver focused future. This means, rather than the `BaseProblem` interface taking in a `BaseDriver` and an optional list of `BaseTransformer` instances, the problem itself should be a fully standalone description of the user's problem of interest. In other words, `BaseProblem` should be the produced result of a `BaseDriver` and, by extension, `BaseTransformer` instances should transform problem instances. This commit works towards such a future by refactoring the code: - `BaseProblem` is the returned object of `BaseDriver.run` - `BaseTransformer.transform` has `BaseProblem` as in- and output - `BaseProblem` takes over the role of `GroupedProperty` - in doing so, `Hamiltonian` objects are more clearly separated from `Property` objects (further refactoring to come)
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:
A more detailed overview including the main classes is given by the following UML:
Workflow
Someone already familiar with Qiskit Nature, should not have much trouble understanding the
relations outlined by the following class diagram:
Together with this pseudo code, this should roughly outline the intended workflow:
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
The text was updated successfully, but these errors were encountered: