01-Nature Tutorial- Vibrational structure

[1]:
#This code is from:
#https://qiskit-community.github.io/qiskit-nature/tutorials/02_vibrational_structure.html
[2]:
from qiskit_nature.second_q.drivers import GaussianForcesDriver

# if you ran Gaussian elsewhere and already have the output file
driver = GaussianForcesDriver(logfile="/home/venkat/Downloads/CO2_freq_B3LYP_631g.log")

# if you want to run the Gaussian job from Qiskit
#driver = GaussianForcesDriver(
#                 ['#p B3LYP/6-31g Freq=(Anharm) Int=Ultrafine SCF=VeryTight',
#                  '',
#                  'CO2 geometry optimization B3LYP/6-31g',
#                  '',
#                  '0 1',
#                  'C  -0.848629  2.067624  0.160992',
#                  'O   0.098816  2.655801 -0.159738',
#                  'O  -1.796073  1.479446  0.481721',
#                  '',
#                  ''])

[3]:
from qiskit_nature.second_q.problems import HarmonicBasis

basis = HarmonicBasis([2, 2, 2, 2])
[4]:
from qiskit_nature.second_q.problems import VibrationalStructureProblem
from qiskit_nature.second_q.mappers import DirectMapper

vibrational_problem = driver.run(basis=basis)
vibrational_problem.hamiltonian.truncation_order = 2
main_op, aux_ops = vibrational_problem.second_q_ops()
[5]:
print(main_op)
Vibrational Operator
number modes=4, number modals=[2, 2, 2, 2], number terms=50
  (1268.0676746875001+0j) * ( +_0_0 -_0_0 )
+ (3813.8767834375008+0j) * ( +_0_1 -_0_1 )
+ (705.8633818750002+0j) * ( +_1_0 -_1_0 )
+ (-46.025705898886045+0j) * ( +_1_0 -_1_1 )
+ (-46.025705898886045+0j) * ( +_1_1 -_1_0 )
+ (2120.1145593750007+0j) * ( +_1_1 -_1_1 )
+ (238.31540750000005+0j) * ( +_2_0 -_2_0 )
+ (728.9613775000003+0j) * ( +_2_1 -_2_1 )
+ (238.31540750000005+0j) * ( +_3_0 -_3_0 )
+ (728.9613775000003+0j) * ( +_3_1 -_3_1 )
+ (4.942542500000002+0j) * ( +_0_0 -_0_0 +_1_0 -_1_0 )
+ (-88.20174216876333+0j) * ( +_0_0 -_0_0 +_1_0 -_1_1 )
+ (-88.20174216876333+0j) * ( +_0_0 -_0_0 +_1_1 -_1_0 )
+ (14.827627500000007+0j) * ( +_0_0 -_0_0 +_1_1 -_1_1 )
+ (14.827627500000007+0j) * ( +_0_1 -_0_1 +_1_0 -_1_0 )
+ (-264.60522650629+0j) * ( +_0_1 -_0_1 +_1_0 -_1_1 )
+ (-264.60522650629+0j) * ( +_0_1 -_0_1 +_1_1 -_1_0 )
+ (44.482882500000024+0j) * ( +_0_1 -_0_1 +_1_1 -_1_1 )
+ (-10.205891250000004+0j) * ( +_2_0 -_2_0 +_0_0 -_0_0 )
+ (-30.617673750000016+0j) * ( +_2_0 -_2_0 +_0_1 -_0_1 )
+ (-4.194299375000002+0j) * ( +_2_0 -_2_0 +_1_0 -_1_0 )
+ (42.67527310283147+0j) * ( +_2_0 -_2_0 +_1_0 -_1_1 )
+ (42.67527310283147+0j) * ( +_2_0 -_2_0 +_1_1 -_1_0 )
+ (-12.582898125000007+0j) * ( +_2_0 -_2_0 +_1_1 -_1_1 )
+ (-30.61767375000002+0j) * ( +_2_1 -_2_1 +_0_0 -_0_0 )
+ (-91.85302125000007+0j) * ( +_2_1 -_2_1 +_0_1 -_0_1 )
+ (-12.582898125000007+0j) * ( +_2_1 -_2_1 +_1_0 -_1_0 )
+ (128.02581930849442+0j) * ( +_2_1 -_2_1 +_1_0 -_1_1 )
+ (128.02581930849442+0j) * ( +_2_1 -_2_1 +_1_1 -_1_0 )
+ (-37.74869437500002+0j) * ( +_2_1 -_2_1 +_1_1 -_1_1 )
+ (-10.205891250000004+0j) * ( +_3_0 -_3_0 +_0_0 -_0_0 )
+ (-30.617673750000016+0j) * ( +_3_0 -_3_0 +_0_1 -_0_1 )
+ (-4.194299375000002+0j) * ( +_3_0 -_3_0 +_1_0 -_1_0 )
+ (42.67527310283147+0j) * ( +_3_0 -_3_0 +_1_0 -_1_1 )
+ (42.67527310283147+0j) * ( +_3_0 -_3_0 +_1_1 -_1_0 )
+ (-12.582898125000007+0j) * ( +_3_0 -_3_0 +_1_1 -_1_1 )
+ (7.0983500000000035+0j) * ( +_3_0 -_3_0 +_2_0 -_2_0 )
+ (21.29505000000001+0j) * ( +_3_0 -_3_0 +_2_1 -_2_1 )
+ 0j * ( +_3_0 -_3_1 +_2_0 -_2_1 )
+ 0j * ( +_3_0 -_3_1 +_2_1 -_2_0 )
+ 0j * ( +_3_1 -_3_0 +_2_0 -_2_1 )
+ 0j * ( +_3_1 -_3_0 +_2_1 -_2_0 )
+ (-30.61767375000002+0j) * ( +_3_1 -_3_1 +_0_0 -_0_0 )
+ (-91.85302125000007+0j) * ( +_3_1 -_3_1 +_0_1 -_0_1 )
+ (-12.582898125000007+0j) * ( +_3_1 -_3_1 +_1_0 -_1_0 )
+ (128.02581930849442+0j) * ( +_3_1 -_3_1 +_1_0 -_1_1 )
+ (128.02581930849442+0j) * ( +_3_1 -_3_1 +_1_1 -_1_0 )
+ (-37.74869437500002+0j) * ( +_3_1 -_3_1 +_1_1 -_1_1 )
+ (21.29505000000001+0j) * ( +_3_1 -_3_1 +_2_0 -_2_0 )
+ (63.88515000000004+0j) * ( +_3_1 -_3_1 +_2_1 -_2_1 )
[6]:
qubit_mapper = DirectMapper()
qubit_op = qubit_mapper.map(main_op)

print(qubit_op)
SparsePauliOp(['IIIIIIII', 'IIIIIIIZ', 'IIIIIIZI', 'IIIIIZII', 'IIIIXXII', 'IIIIYYII', 'IIIIZIII', 'IIIZIIII', 'IIZIIIII', 'IZIIIIII', 'ZIIIIIII', 'IIIIIZIZ', 'IIIIXXIZ', 'IIIIYYIZ', 'IIIIZIIZ', 'IIIIIZZI', 'IIIIXXZI', 'IIIIYYZI', 'IIIIZIZI', 'IIIZIIIZ', 'IIIZIIZI', 'IIIZIZII', 'IIIZXXII', 'IIIZYYII', 'IIIZZIII', 'IIZIIIIZ', 'IIZIIIZI', 'IIZIIZII', 'IIZIXXII', 'IIZIYYII', 'IIZIZIII', 'IZIIIIIZ', 'IZIIIIZI', 'IZIIIZII', 'IZIIXXII', 'IZIIYYII', 'IZIIZIII', 'IZIZIIII', 'IZZIIIII', 'ZIIIIIIZ', 'ZIIIIIZI', 'ZIIIIZII', 'ZIIIXXII', 'ZIIIYYII', 'ZIIIZIII', 'ZIIZIIII', 'ZIZIIIII'],
              coeffs=[ 4.85420003e+03+0.j, -6.18564597e+02+0.j, -1.86053067e+03+0.j,
 -3.49485635e+02+0.j, -2.58640489e+01+0.j, -2.58640489e+01+0.j,
 -1.04971911e+03+0.j, -1.11855863e+02+0.j, -3.42575167e+02+0.j,
 -1.11855863e+02+0.j, -3.42575167e+02+0.j,  1.23563563e+00+0.j,
  2.20504355e+01+0.j,  2.20504355e+01+0.j,  3.70690688e+00+0.j,
  3.70690688e+00+0.j,  6.61513066e+01+0.j,  6.61513066e+01+0.j,
  1.11207206e+01+0.j, -2.55147281e+00+0.j, -7.65441844e+00+0.j,
 -1.04857484e+00+0.j, -1.06688183e+01+0.j, -1.06688183e+01+0.j,
 -3.14572453e+00+0.j, -7.65441844e+00+0.j, -2.29632553e+01+0.j,
 -3.14572453e+00+0.j, -3.20064548e+01+0.j, -3.20064548e+01+0.j,
 -9.43717359e+00+0.j, -2.55147281e+00+0.j, -7.65441844e+00+0.j,
 -1.04857484e+00+0.j, -1.06688183e+01+0.j, -1.06688183e+01+0.j,
 -3.14572453e+00+0.j,  1.77458750e+00+0.j,  5.32376250e+00+0.j,
 -7.65441844e+00+0.j, -2.29632553e+01+0.j, -3.14572453e+00+0.j,
 -3.20064548e+01+0.j, -3.20064548e+01+0.j, -9.43717359e+00+0.j,
  5.32376250e+00+0.j,  1.59712875e+01+0.j])
[7]:
basis = HarmonicBasis([3, 3, 3, 3])

vibrational_problem = driver.run(basis=basis)
vibrational_problem.hamiltonian.truncation_order = 2
main_op, aux_ops = vibrational_problem.second_q_ops()

qubit_mapper = DirectMapper()

qubit_op = qubit_mapper.map(main_op)

print(qubit_op)
SparsePauliOp(['IIIIIIIIIIII', 'IIIIIIIIIIIZ', 'IIIIIIIIIXIX', 'IIIIIIIIIYIY', 'IIIIIIIIIIZI', 'IIIIIIIIIZII', 'IIIIIIIIZIII', 'IIIIIIIXXIII', 'IIIIIIIYYIII', 'IIIIIIXIXIII', 'IIIIIIYIYIII', 'IIIIIIIZIIII', 'IIIIIIXXIIII', 'IIIIIIYYIIII', 'IIIIIIZIIIII', 'IIIIIZIIIIII', 'IIIXIXIIIIII', 'IIIYIYIIIIII', 'IIIIZIIIIIII', 'IIIZIIIIIIII', 'IIZIIIIIIIII', 'XIXIIIIIIIII', 'YIYIIIIIIIII', 'IZIIIIIIIIII', 'ZIIIIIIIIIII', 'IIIIIIIIZIIZ', 'IIIIIIIXXIIZ', 'IIIIIIIYYIIZ', 'IIIIIIXIXIIZ', 'IIIIIIYIYIIZ', 'IIIIIIIZIIIZ', 'IIIIIIXXIIIZ', 'IIIIIIYYIIIZ', 'IIIIIIZIIIIZ', 'IIIIIIIIZXIX', 'IIIIIIIIZYIY', 'IIIIIIIXXXIX', 'IIIIIIIYYXIX', 'IIIIIIIXXYIY', 'IIIIIIIYYYIY', 'IIIIIIXIXXIX', 'IIIIIIYIYXIX', 'IIIIIIXIXYIY', 'IIIIIIYIYYIY', 'IIIIIIIZIXIX', 'IIIIIIIZIYIY', 'IIIIIIXXIXIX', 'IIIIIIYYIXIX', 'IIIIIIXXIYIY', 'IIIIIIYYIYIY', 'IIIIIIZIIXIX', 'IIIIIIZIIYIY', 'IIIIIIIIZIZI', 'IIIIIIIXXIZI', 'IIIIIIIYYIZI', 'IIIIIIXIXIZI', 'IIIIIIYIYIZI', 'IIIIIIIZIIZI', 'IIIIIIXXIIZI', 'IIIIIIYYIIZI', 'IIIIIIZIIIZI', 'IIIIIIIIZZII', 'IIIIIIIXXZII', 'IIIIIIIYYZII', 'IIIIIIXIXZII', 'IIIIIIYIYZII', 'IIIIIIIZIZII', 'IIIIIIXXIZII', 'IIIIIIYYIZII', 'IIIIIIZIIZII', 'IIIIIZIIIIIZ', 'IIIIIZIIIXIX', 'IIIIIZIIIYIY', 'IIIIIZIIIIZI', 'IIIIIZIIIZII', 'IIIIIZIIZIII', 'IIIIIZIXXIII', 'IIIIIZIYYIII', 'IIIIIZXIXIII', 'IIIIIZYIYIII', 'IIIIIZIZIIII', 'IIIIIZXXIIII', 'IIIIIZYYIIII', 'IIIIIZZIIIII', 'IIIXIXIIIIIZ', 'IIIYIYIIIIIZ', 'IIIXIXIIIXIX', 'IIIXIXIIIYIY', 'IIIYIYIIIXIX', 'IIIYIYIIIYIY', 'IIIXIXIIIIZI', 'IIIYIYIIIIZI', 'IIIXIXIIIZII', 'IIIYIYIIIZII', 'IIIXIXIIZIII', 'IIIYIYIIZIII', 'IIIXIXIXXIII', 'IIIXIXIYYIII', 'IIIYIYIXXIII', 'IIIYIYIYYIII', 'IIIXIXXIXIII', 'IIIXIXYIYIII', 'IIIYIYXIXIII', 'IIIYIYYIYIII', 'IIIXIXIZIIII', 'IIIYIYIZIIII', 'IIIXIXXXIIII', 'IIIXIXYYIIII', 'IIIYIYXXIIII', 'IIIYIYYYIIII', 'IIIXIXZIIIII', 'IIIYIYZIIIII', 'IIIIZIIIIIIZ', 'IIIIZIIIIXIX', 'IIIIZIIIIYIY', 'IIIIZIIIIIZI', 'IIIIZIIIIZII', 'IIIIZIIIZIII', 'IIIIZIIXXIII', 'IIIIZIIYYIII', 'IIIIZIXIXIII', 'IIIIZIYIYIII', 'IIIIZIIZIIII', 'IIIIZIXXIIII', 'IIIIZIYYIIII', 'IIIIZIZIIIII', 'IIIZIIIIIIIZ', 'IIIZIIIIIXIX', 'IIIZIIIIIYIY', 'IIIZIIIIIIZI', 'IIIZIIIIIZII', 'IIIZIIIIZIII', 'IIIZIIIXXIII', 'IIIZIIIYYIII', 'IIIZIIXIXIII', 'IIIZIIYIYIII', 'IIIZIIIZIIII', 'IIIZIIXXIIII', 'IIIZIIYYIIII', 'IIIZIIZIIIII', 'IIZIIIIIIIIZ', 'IIZIIIIIIXIX', 'IIZIIIIIIYIY', 'IIZIIIIIIIZI', 'IIZIIIIIIZII', 'IIZIIIIIZIII', 'IIZIIIIXXIII', 'IIZIIIIYYIII', 'IIZIIIXIXIII', 'IIZIIIYIYIII', 'IIZIIIIZIIII', 'IIZIIIXXIIII', 'IIZIIIYYIIII', 'IIZIIIZIIIII', 'IIZIIZIIIIII', 'IIZXIXIIIIII', 'IIZYIYIIIIII', 'IIZIZIIIIIII', 'IIZZIIIIIIII', 'IXXXXIIIIIII', 'IXXYYIIIIIII', 'IYYXXIIIIIII', 'IYYYYIIIIIII', 'XIXIIIIIIIIZ', 'YIYIIIIIIIIZ', 'XIXIIIIIIXIX', 'XIXIIIIIIYIY', 'YIYIIIIIIXIX', 'YIYIIIIIIYIY', 'XIXIIIIIIIZI', 'YIYIIIIIIIZI', 'XIXIIIIIIZII', 'YIYIIIIIIZII', 'XIXIIIIIZIII', 'YIYIIIIIZIII', 'XIXIIIIXXIII', 'XIXIIIIYYIII', 'YIYIIIIXXIII', 'YIYIIIIYYIII', 'XIXIIIXIXIII', 'XIXIIIYIYIII', 'YIYIIIXIXIII', 'YIYIIIYIYIII', 'XIXIIIIZIIII', 'YIYIIIIZIIII', 'XIXIIIXXIIII', 'XIXIIIYYIIII', 'YIYIIIXXIIII', 'YIYIIIYYIIII', 'XIXIIIZIIIII', 'YIYIIIZIIIII', 'XIXIIZIIIIII', 'YIYIIZIIIIII', 'XIXXIXIIIIII', 'XIXYIYIIIIII', 'YIYXIXIIIIII', 'YIYYIYIIIIII', 'XIXIZIIIIIII', 'YIYIZIIIIIII', 'XIXZIIIIIIII', 'YIYZIIIIIIII', 'IZIIIIIIIIIZ', 'IZIIIIIIIXIX', 'IZIIIIIIIYIY', 'IZIIIIIIIIZI', 'IZIIIIIIIZII', 'IZIIIIIIZIII', 'IZIIIIIXXIII', 'IZIIIIIYYIII', 'IZIIIIXIXIII', 'IZIIIIYIYIII', 'IZIIIIIZIIII', 'IZIIIIXXIIII', 'IZIIIIYYIIII', 'IZIIIIZIIIII', 'IZIIIZIIIIII', 'IZIXIXIIIIII', 'IZIYIYIIIIII', 'IZIIZIIIIIII', 'IZIZIIIIIIII', 'XXIIXXIIIIII', 'XXIIYYIIIIII', 'YYIIXXIIIIII', 'YYIIYYIIIIII', 'ZIIIIIIIIIIZ', 'ZIIIIIIIIXIX', 'ZIIIIIIIIYIY', 'ZIIIIIIIIIZI', 'ZIIIIIIIIZII', 'ZIIIIIIIZIII', 'ZIIIIIIXXIII', 'ZIIIIIIYYIII', 'ZIIIIIXIXIII', 'ZIIIIIYIYIII', 'ZIIIIIIZIIII', 'ZIIIIIXXIIII', 'ZIIIIIYYIIII', 'ZIIIIIZIIIII', 'ZIIIIZIIIIII', 'ZIIXIXIIIIII', 'ZIIYIYIIIIII', 'ZIIIZIIIIIII', 'ZIIZIIIIIIII'],
              coeffs=[ 1.07887200e+04+0.j, -5.99228047e+02+0.j, -4.23824394e+01+0.j,
 -4.23824394e+01+0.j, -1.80252102e+03+0.j, -3.01548776e+03+0.j,
 -3.45178064e+02+0.j, -2.94280439e+01+0.j, -2.94280439e+01+0.j,
 -9.18025376e+00+0.j, -9.18025376e+00+0.j, -1.03679640e+03+0.j,
 -7.41626275e+01+0.j, -7.41626275e+01+0.j, -1.73093915e+03+0.j,
 -1.02728562e+02+0.j, -1.33241035e+01+0.j, -1.33241035e+01+0.j,
 -3.15193265e+02+0.j, -5.41673122e+02+0.j, -1.02728562e+02+0.j,
 -1.33241035e+01+0.j, -1.33241035e+01+0.j, -3.15193265e+02+0.j,
 -5.41673122e+02+0.j,  1.23563563e+00+0.j,  2.20504355e+01+0.j,
  2.20504355e+01+0.j, -1.74745266e+00+0.j, -1.74745266e+00+0.j,
  3.70690688e+00+0.j,  3.11840250e+01+0.j,  3.11840250e+01+0.j,
  6.17817813e+00+0.j, -1.74745266e+00+0.j, -1.74745266e+00+0.j,
 -3.11840250e+01+0.j, -3.11840250e+01+0.j, -3.11840250e+01+0.j,
 -3.11840250e+01+0.j,  2.47127125e+00+0.j,  2.47127125e+00+0.j,
  2.47127125e+00+0.j,  2.47127125e+00+0.j, -5.24235798e+00+0.j,
 -5.24235798e+00+0.j, -4.41008711e+01+0.j, -4.41008711e+01+0.j,
 -4.41008711e+01+0.j, -4.41008711e+01+0.j, -8.73726330e+00+0.j,
 -8.73726330e+00+0.j,  3.70690688e+00+0.j,  6.61513066e+01+0.j,
  6.61513066e+01+0.j, -5.24235798e+00+0.j, -5.24235798e+00+0.j,
  1.11207206e+01+0.j,  9.35520750e+01+0.j,  9.35520750e+01+0.j,
  1.85345344e+01+0.j,  6.17817813e+00+0.j,  1.10252178e+02+0.j,
  1.10252178e+02+0.j, -8.73726330e+00+0.j, -8.73726330e+00+0.j,
  1.85345344e+01+0.j,  1.55920125e+02+0.j,  1.55920125e+02+0.j,
  3.08908906e+01+0.j, -2.55147281e+00+0.j,  3.60832746e+00+0.j,
  3.60832746e+00+0.j, -7.65441844e+00+0.j, -1.27573641e+01+0.j,
 -1.04857484e+00+0.j, -1.06688183e+01+0.j, -1.06688183e+01+0.j,
  1.48290877e+00+0.j,  1.48290877e+00+0.j, -3.14572453e+00+0.j,
 -1.50879875e+01+0.j, -1.50879875e+01+0.j, -5.24287422e+00+0.j,
  3.60832746e+00+0.j,  3.60832746e+00+0.j, -5.10294563e+00+0.j,
 -5.10294563e+00+0.j, -5.10294563e+00+0.j, -5.10294563e+00+0.j,
  1.08249824e+01+0.j,  1.08249824e+01+0.j,  1.80416373e+01+0.j,
  1.80416373e+01+0.j,  1.48290877e+00+0.j,  1.48290877e+00+0.j,
  1.50879875e+01+0.j,  1.50879875e+01+0.j,  1.50879875e+01+0.j,
  1.50879875e+01+0.j, -2.09714969e+00+0.j, -2.09714969e+00+0.j,
 -2.09714969e+00+0.j, -2.09714969e+00+0.j,  4.44872630e+00+0.j,
  4.44872630e+00+0.j,  2.13376366e+01+0.j,  2.13376366e+01+0.j,
  2.13376366e+01+0.j,  2.13376366e+01+0.j,  7.41454383e+00+0.j,
  7.41454383e+00+0.j, -7.65441844e+00+0.j,  1.08249824e+01+0.j,
  1.08249824e+01+0.j, -2.29632553e+01+0.j, -3.82720922e+01+0.j,
 -3.14572453e+00+0.j, -3.20064548e+01+0.j, -3.20064548e+01+0.j,
  4.44872630e+00+0.j,  4.44872630e+00+0.j, -9.43717359e+00+0.j,
 -4.52639625e+01+0.j, -4.52639625e+01+0.j, -1.57286227e+01+0.j,
 -1.27573641e+01+0.j,  1.80416373e+01+0.j,  1.80416373e+01+0.j,
 -3.82720922e+01+0.j, -6.37868203e+01+0.j, -5.24287422e+00+0.j,
 -5.33440914e+01+0.j, -5.33440914e+01+0.j,  7.41454383e+00+0.j,
  7.41454383e+00+0.j, -1.57286227e+01+0.j, -7.54399375e+01+0.j,
 -7.54399375e+01+0.j, -2.62143711e+01+0.j, -2.55147281e+00+0.j,
  3.60832746e+00+0.j,  3.60832746e+00+0.j, -7.65441844e+00+0.j,
 -1.27573641e+01+0.j, -1.04857484e+00+0.j, -1.06688183e+01+0.j,
 -1.06688183e+01+0.j,  1.48290877e+00+0.j,  1.48290877e+00+0.j,
 -3.14572453e+00+0.j, -1.50879875e+01+0.j, -1.50879875e+01+0.j,
 -5.24287422e+00+0.j,  1.77458750e+00+0.j, -2.50964571e+00+0.j,
 -2.50964571e+00+0.j,  5.32376250e+00+0.j,  8.87293750e+00+0.j,
 -2.81707541e+00+0.j, -2.81707541e+00+0.j, -2.81707541e+00+0.j,
 -2.81707541e+00+0.j,  3.60832746e+00+0.j,  3.60832746e+00+0.j,
 -5.10294563e+00+0.j, -5.10294563e+00+0.j, -5.10294563e+00+0.j,
 -5.10294563e+00+0.j,  1.08249824e+01+0.j,  1.08249824e+01+0.j,
  1.80416373e+01+0.j,  1.80416373e+01+0.j,  1.48290877e+00+0.j,
  1.48290877e+00+0.j,  1.50879875e+01+0.j,  1.50879875e+01+0.j,
  1.50879875e+01+0.j,  1.50879875e+01+0.j, -2.09714969e+00+0.j,
 -2.09714969e+00+0.j, -2.09714969e+00+0.j, -2.09714969e+00+0.j,
  4.44872630e+00+0.j,  4.44872630e+00+0.j,  2.13376366e+01+0.j,
  2.13376366e+01+0.j,  2.13376366e+01+0.j,  2.13376366e+01+0.j,
  7.41454383e+00+0.j,  7.41454383e+00+0.j, -2.50964571e+00+0.j,
 -2.50964571e+00+0.j,  3.54917500e+00+0.j,  3.54917500e+00+0.j,
  3.54917500e+00+0.j,  3.54917500e+00+0.j, -7.52893713e+00+0.j,
 -7.52893713e+00+0.j, -1.25482286e+01+0.j, -1.25482286e+01+0.j,
 -7.65441844e+00+0.j,  1.08249824e+01+0.j,  1.08249824e+01+0.j,
 -2.29632553e+01+0.j, -3.82720922e+01+0.j, -3.14572453e+00+0.j,
 -3.20064548e+01+0.j, -3.20064548e+01+0.j,  4.44872630e+00+0.j,
  4.44872630e+00+0.j, -9.43717359e+00+0.j, -4.52639625e+01+0.j,
 -4.52639625e+01+0.j, -1.57286227e+01+0.j,  5.32376250e+00+0.j,
 -7.52893713e+00+0.j, -7.52893713e+00+0.j,  1.59712875e+01+0.j,
  2.66188125e+01+0.j,  2.81707541e+00+0.j,  2.81707541e+00+0.j,
  2.81707541e+00+0.j,  2.81707541e+00+0.j, -1.27573641e+01+0.j,
  1.80416373e+01+0.j,  1.80416373e+01+0.j, -3.82720922e+01+0.j,
 -6.37868203e+01+0.j, -5.24287422e+00+0.j, -5.33440914e+01+0.j,
 -5.33440914e+01+0.j,  7.41454383e+00+0.j,  7.41454383e+00+0.j,
 -1.57286227e+01+0.j, -7.54399375e+01+0.j, -7.54399375e+01+0.j,
 -2.62143711e+01+0.j,  8.87293750e+00+0.j, -1.25482286e+01+0.j,
 -1.25482286e+01+0.j,  2.66188125e+01+0.j,  4.43646875e+01+0.j])
[8]:
# for simplicity, we will use the smaller basis again
vibrational_problem = driver.run(basis=HarmonicBasis([2, 2, 2, 2]))
vibrational_problem.hamiltonian.truncation_order = 2

[9]:
from qiskit_algorithms import NumPyMinimumEigensolver
from qiskit_nature.second_q.algorithms import GroundStateEigensolver

solver = GroundStateEigensolver(
    qubit_mapper,
    NumPyMinimumEigensolver(filter_criterion=vibrational_problem.get_default_filter_criterion()),
)

[10]:
result = solver.solve(vibrational_problem)
print(result)
=== GROUND STATE ===

* Vibrational ground state energy (cm^-1): 2432.10695403655
The number of occupied modals for each mode is:
- Mode 0: 1.0
- Mode 1: 1.0
- Mode 2: 1.0
- Mode 3: 1.0
[ ]: