Пример #1
0
description = 'R' + str(bond_length) + '_ccsd'

molecule = MolecularData_Dirac(geometry=geometry,
                               basis=basis,
                               charge=charge,
                               description=description,
                               data_directory=data_directory)

if os.path.exists("{}/{}.hdf5".format(data_directory, molecule.name)) is False:
    print(
        "No file found. You should first run a calculation with save=True (see LiH_save.py)"
    )
    sys.exit(0)

print("HDF5 file found, loading from file. Name : {}".format(
    molecule.get_from_file('name')))
print('Hartree-Fock energy of {} Hartree.'.format(
    molecule.get_from_file('hf_energy')))
print('MP2 energy of {} Hartree.'.format(molecule.get_from_file('mp2_energy')))
print('CCSD energy of {} Hartree.'.format(
    molecule.get_from_file('ccsd_energy')))
E_core = molecule.get_from_file('nuclear_repulsion')
one_body_coeff = molecule.get_from_file('one_body_coefficients')
two_body_coeff = molecule.get_from_file('two_body_coefficients')
fermionic_ham_print = molecule.get_from_file('print_molecular_hamiltonian')
print('Core energy : {} Hartree.'.format(E_core))
#print('Molecular Hamiltonian : {}'.format(fermionic_ham_print))
""" If one actually wants to use it to construct the qubit Hamiltonian, do :
fermionic_ham = InteractionOperator(float(E_core),one_body_coeff,two_body_coeff)
qubit_ham = jordan_wigner(fermionic_ham)
evs = min(eigenspectrum(qubit_ham))
Пример #2
0
molecule = MolecularData_Dirac(geometry=geometry,
                               basis=basis,
                               charge=charge,
                               description=description,
                               data_directory=data_directory)

molecule = run_dirac(molecule,
                     fcidump=fcidump,
                     point_nucleus=point_nucleus,
                     properties=properties,
                     save=save,
                     delete_input=delete_input,
                     delete_xyz=delete_xyz,
                     delete_output=delete_output,
                     delete_MRCONEE=delete_MRCONEE,
                     delete_MDCINT=delete_MDCINT)

print('Hartree-Fock energy of {} Hartree. From the hdf5 file: {}'.format(
    molecule.get_energies()[0], molecule.get_from_file('hf_energy')))
print('Dipole moment: {}. From the hdf5 file: {}.'.format(
    molecule.get_elecdipole(), molecule.get_from_file('elec_dipole')))
print('Quadrupole moment: {}. From the hdf5 file: {}'.format(
    molecule.get_elecquadrupole(), molecule.get_from_file('elec_quadrupole')))
print('Polarizability: {}. From the hdf5 file: {}'.format(
    molecule.get_elecpolarizability(),
    molecule.get_from_file('elec_polarizability')))
print(
    "The gradient can be read in the output. I've not define an option to extract it from the ouput yet."
)
Пример #3
0
                         save=save)

if save is False:
    molecular_hamiltonian = molecule.get_molecular_hamiltonian()[0]
    qubit_hamiltonian = jordan_wigner(molecular_hamiltonian)
    evs = eigenspectrum(qubit_hamiltonian)
    print('Hartree-Fock energy of {} Hartree.'.format(
        molecule.get_energies()[0]))
    print('MP2 energy of {} Hartree.'.format(molecule.get_energies()[1]))
    print('CCSD energy of {} Hartree.'.format(molecule.get_energies()[2]))
    print('Solving the Qubit Hamiltonian (Jordan-Wigner): \n {}'.format(
        min(evs)))

else:
    print("HDF5 file found, loading from file. Name : {}".format(
        molecule.get_from_file('name')))
    print('Hartree-Fock energy of {} Hartree.'.format(
        molecule.get_from_file('hf_energy')))
    print('MP2 energy of {} Hartree.'.format(
        molecule.get_from_file('mp2_energy')))
    print('CCSD energy of {} Hartree.'.format(
        molecule.get_from_file('ccsd_energy')))
    E_core = molecule.get_from_file('nuclear_repulsion')
    one_body_coeff = molecule.get_from_file('one_body_coefficients')
    two_body_coeff = molecule.get_from_file('two_body_coefficients')
    molecular_ham_print = molecule.get_from_file('print_molecular_hamiltonian')
    molecular_ham = InteractionOperator(float(E_core), one_body_coeff,
                                        two_body_coeff)
    qubit_ham = jordan_wigner(molecular_ham)
    evs = min(eigenspectrum(qubit_ham))
    print("Ground-state of the qubit Hamiltonian is {}.".format(evs))
Пример #4
0
print()
description = 'R' + str(bond_length) + '_ccsd'

molecule = MolecularData_Dirac(geometry=geometry,
                               basis=basis,
                               multiplicity=multiplicity,
                               charge=charge,
                               description=description,
                               data_directory=data_directory)


if os.path.exists("{}/{}.hdf5".format(data_directory,molecule.name)) is False:
      print("No file found. You should first run a calculation with save=True (see LiH_save.py")
      sys.exit(0)

print("HDF5 file found, loading from file. Name : {}".format(molecule.get_from_file('name')))
print('Hartree-Fock energy of {} Hartree.'.format(molecule.get_from_file('hf_energy')))
print('MP2 energy of {} Hartree.'.format(molecule.get_from_file('mp2_energy')))
print('CCSD energy of {} Hartree.'.format(molecule.get_from_file('ccsd_energy')))
E_core=molecule.get_from_file('nuclear_repulsion')
one_body_coeff = molecule.get_from_file('one_body_coefficients')
two_body_coeff = molecule.get_from_file('two_body_coefficients')
fermionic_ham_print = molecule.get_from_file('print_molecular_hamiltonian')
print('Core energy : {} Hartree.'.format(E_core))
#print('Molecular Hamiltonian : {}'.format(fermionic_ham_print))

""" If one actually wants to use it to construct the qubit Hamiltonian, do :
fermionic_ham = InteractionOperator(float(E_core),one_body_coeff,two_body_coeff)
qubit_ham = jordan_wigner(fermionic_ham)
evs = min(eigenspectrum(qubit_ham))
"""