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

Adapt fermionic drivers to the new input flow #16

Closed
7 tasks
manoelmarques opened this issue Jan 28, 2021 · 3 comments
Closed
7 tasks

Adapt fermionic drivers to the new input flow #16

manoelmarques opened this issue Jan 28, 2021 · 3 comments

Comments

@manoelmarques
Copy link
Contributor

Migrated from Enterprise Github.
Creator: @mrossinek

All fermionic drivers need to be adapted to produce a SecondQuantizedSumOp rather than a QMolecule. As a good starting point, the following may be helpful to transform what is currently stored in a QMolecule into a FermionicSumOp:

base_ops = []

one_body_ints = qmol.one_body_integrals
for idx in itertools.product(range(len(one_body_ints)), repeat=2):
    coeff = one_body_ints[idx]
    if not coeff:
        continue
    label = ['I'] * len(one_body_ints)
    base_op = FermionicOperator(label, coeff=coeff)
    for i, op in [(idx[0], '+'), (idx[1], '-')]:
        label_i = label.copy()
        label_i[i] = op
        base_op *= FermionicOperator(''.join(label_i))
    base_ops.append(base_op)

two_body_ints = qmol.two_body_integrals
for idx in itertools.product(range(len(two_body_ints)), repeat=4):
    coeff = two_body_ints[idx]
    if not coeff:
        continue
    label = ['I'] * len(two_body_ints)
    base_op = FermionicOperator(label, coeff=coeff)
    # mind the chemists' notation of the two-electron integrals!
    for i, op in [(idx[0], '+'), (idx[2], '+'), (idx[3], '-'), (idx[1], '-')]:
        label_i = label.copy()
        label_i[i] = op
        base_op *= FermionicOperator(''.join(label_i))
    base_ops.append(base_op)

fer_op = FermionicSumOp(base_ops)
  • CP2KDriver
  • FCIDumpDriver
  • GaussianDriver
  • HDF5Driver
  • Psi4Driver
  • PyQuanteDriver
  • PySCFDriver
@manoelmarques
Copy link
Contributor Author

Creator: @mrossinek

Some thought on the above snippet:

  • we should generalize this to also work for n-body terms (like Mario Motta did recently in this PR: [WIP] subroutines for analytic/parallel q-EOM calculations qiskit-aqua#1483)
  • the above may be easier if we use the physicist' notation for the integrals/coefficients
  • we should probably implement the above as a utility method in the FermionicOperator class
  • if we do so, we can do the transformation to physicist' notation internally (and allow the user to disable it through a kwarg)

@mrossinek mrossinek changed the title Adapt fermionic drivers to produce a SecondQuantizedSumOp Adapt fermionic drivers to the new input flow Feb 4, 2021
@mrossinek
Copy link
Member

Disclaimer: some of the above comments are outdated. New information on how the drivers need to be adapted will follow in the near future.

@mrossinek
Copy link
Member

As explained in #5 we will leave the drivers mostly unchanged for now. We can re-open this once needed.

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

No branches or pull requests

2 participants