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

Periodic Calculation #988

Open
spriti523 opened this issue Dec 5, 2022 · 3 comments
Open

Periodic Calculation #988

spriti523 opened this issue Dec 5, 2022 · 3 comments

Comments

@spriti523
Copy link

What should we add?

Can we do electronic structure for periodic calculations, such as silicon crystal, with the implemented PySCF driver in qiskit-nature? I know it can be done in PySCF. If so, any suggestions for the usage? Or any suggestion for implementation?

@spriti523 spriti523 added the type: feature request New feature or request label Dec 5, 2022
@mrossinek
Copy link
Member

The PySCFDriver has no built-in functionality to support this. To my knowledge, calculations of periodic electronic structure systems have not been done with Qiskit Nature (at least there is no specific implementation for this purpose).

The biggest question is probably how one can fit a relevant problem onto a quantum computer today. This will likely involve some sort of embedding scheme which requires an implementation in some code. Qiskit Nature (as mentioned above) does not provide a periodic embedding scheme at the time of writing. If PySCF has such an implementation, it may be possible to combine it with the new Qiskit Nature - PySCF Plugin.

I have not looked for this myself but my best suggestion would be to check the PySCF code and then see if you can use the plugin which I linked above. If you do manage, please do let us know! If not, feel free to open a feature request for specific needs and then we will be happy to discuss.

I will leave this open for now but will label it a discussion rather than feature request. For the latter one would need to formalize a lot more what the actual requirements are and potentially propose a specific embedding implementation to achieve this.

@mrossinek mrossinek added type: discussion and removed type: feature request New feature or request labels Dec 6, 2022
@MarcoBarroca
Copy link
Contributor

I just saw this discussion and decided to give it a try. This is a minimal example for a Li bcc cell built from the pbc k-point tutorial here and the PySCF Plugin example.

import numpy
from pyscf.pbc import gto, scf
from pyscf import mcscf

from qiskit.algorithms.optimizers import SLSQP
from qiskit.primitives import Estimator
from qiskit_nature.second_q.algorithms import GroundStateEigensolver, VQEUCCFactory
from qiskit_nature.second_q.circuit.library import UCCSD
from qiskit_nature.second_q.mappers import ParityMapper, QubitConverter

from qiskit_nature_pyscf import QiskitSolver

cell = gto.Cell(
    a = numpy.eye(3)*3.43,
    atom = '''Li     0.      0.      0.    
              Li     1.713408998 1.713408998 1.713408947 
            ''',
    basis = 'sto3g',
    verbose = 4,
    exp_to_discard=0.1
)
cell.build()

mf = scf.RHF(cell).density_fit()
mf.with_df.mesh = [10]*3
mf.kernel()

h_f = scf.RHF(cell).run()

norb, nelec = 2, 2

cas = mcscf.CASCI(h_f, norb, nelec)

converter = QubitConverter(ParityMapper(), two_qubit_reduction=True)

vqe = VQEUCCFactory(Estimator(), UCCSD(), SLSQP())

algorithm = GroundStateEigensolver(converter, vqe)

cas.fcisolver = QiskitSolver(algorithm)

cas.kernel()

This works, as in it will spit out a result, but it requires you to mix the PBC and molecule modules of PySCF. They have a page discussing this for post-HF models but not for mcscf so I'm unsure as to wether this is 100% correct.

@spriti523
Copy link
Author

The electronic structure is used only till cas = mcscf.CASCI(h_f, norb, nelec) The issue is to merge the Pyscf periodic calculation with the GroundStateEigensolver of Qiskit it still doesn't have that functionality. Could you do numpy_excited_states_solver.solve(the periodic problem?). This has to be installed in the driver feature from qiskit.

@mrossinek mrossinek changed the title Periodic Calulation Periodic Calculation Mar 2, 2023
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

3 participants