Skip to content
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

Driver-refactoring Design #147

Closed
pbark opened this issue Apr 21, 2021 · 3 comments
Closed

Driver-refactoring Design #147

pbark opened this issue Apr 21, 2021 · 3 comments

Comments

@pbark
Copy link
Contributor

pbark commented Apr 21, 2021

The drivers have remained mostly unchanged during the past releases and require some updates before more complex workflows (such as those proposed by #26) can be implemented.
We have defined a few tasks which should be tackled as part of this refactoring.

Extraction of a MoleculeDriver

The introduction of the Molecule object introduced a concept of a parameterized-input for those drivers, which couple to a classical code to compute the one- and two-electron integrals at runtme. We have come to the conclusion, that the design of this structure can be improved by following an approach as shown below:
Qiskit_Nature-Driver_Updates
A pseudo-code of the MoleculeDriver could look similar to this:

class MoleculeDriver:
   def __init__(self, molecule, driver_type, driver_kwargs):
      # intitialize stuff

   def run(self):
      driver_cls = getattr(qiskit_nature.drivers, self._driver_type)
      driver = driver_cls.from_molecule(self._molecule)
      for key, value in self._driver_kwargs:
         setattr(driver, key, value)
      return driver.run()

This will allow us to remove the molecule keyword-arguments from all drivers in favor of a from_molecule classmethod-initializer.

General improvements

The following general improvements are planned for the drivers:

@pbark

This comment has been minimized.

@mrossinek
Copy link
Member

mrossinek commented Apr 28, 2021

With the updated description of this issue above, I propose to convert this issue into an Epic after everyone had time to review it. I will create separate implementation-oriented issues for all subtasks which can then be assigned to sprints in order to gradually close this (then) Epic.

Here are the proposed implementation subtasks:

  • extract MoleculeDriver (potentially with Fermionic and Bosonic subclasses)
  • iterate all drivers (pyscf, pyquante, psi4, gaussian [allow from_molecule()], fcidump, hdf5 [no calculation involved]) and do the following:
    • general improvements
    • more rigorous input checking
    • improve/update documentation (incl. installation instructions)

I would also like to suggest to relocate the entire contents of qiskit_nature.drivers into qiskit_nature.drivers.second_quantization.
Although this may seem unnecessarily nested it will help with navigation once we add first_quantization or sampling modules because those will not combine with the existing drivers. Thus, moving them into a second_quantization module will make that incompatibility directly clear from the code imports.
If we decide to go with this, consequently the transformers will also be moved into a second_quantization submodule (qiskit_nature.transformers.second_quantization).

A final note on the Embedding: for the time being, the Embedding will ship with specific driver subclasses to handle the embedding. In the future, this may be streamlined further (if possible). The details of this implementation will be tackled once we integrate the Embedding itself.

@mrossinek
Copy link
Member

The extraction of the Molecule-based drivers was done in #287 and #166 will supersede this Epic as the one tracking the general driver improvements which remain to be tackled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants