print('#' * 60) print('REL Dirac calculation with speed of light = ', speed_of_light, ' a.u.') print('#' * 60) print() run_ccsd = True if run_ccsd: description = 'R' + str(bond_length) + '_ccsd' else: description = 'R' + str(bond_length) + '_scf' relativistic = True molecule = MolecularData_Dirac(geometry=geometry, basis=basis, multiplicity=multiplicity, charge=charge, speed_of_light=speed_of_light, description=description, relativistic=relativistic, data_directory=data_directory) molecule = run_dirac(molecule, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, delete_FCIDUMP=delete_FCIDUMP, run_ccsd=run_ccsd, relativistic=relativistic, speed_of_light=speed_of_light)
delete_MDCINT = True fcidump = True geometry = [('Be', (0., 0., 0.))] print() print('#' * 40) print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True point_nucleus = True description = 'ccsd' 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, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, run_ccsd=run_ccsd) molecular_hamiltonian = molecule.get_molecular_hamiltonian()[0] number_orbs = len(molecule.get_integrals_FCIDUMP()[1])
point_nucleus = True print() print('#' * 40) print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True if run_ccsd: description = 'R' + str(bond_length) + '_ccsd' else: description = 'R' + str(bond_length) + '_scf' molecule = MolecularData_Dirac(geometry=geometry, basis=basis, multiplicity=multiplicity, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, delete_FCIDUMP=delete_FCIDUMP, run_ccsd=run_ccsd, save=save) print('Hartree-Fock energy of {} Hartree.'.format(molecule.get_energies()[0]))
# Generate molecule at different bond lengths. hf_energies = [] mp2_energies = [] ccsd_energies = [] fci_energies = [] bond_lengths = [] for point in range(n_points): bond_length = 2.8 + bond_length_interval * point bond_lengths += [bond_length] description = str(round(bond_length, 2)) print(description) geometry = [('He', (0., 0., 0.)), ('He', (0., 0., bond_length))] molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, run_ccsd=run_ccsd) hf_energies += [molecule.get_energies()[0]] mp2_energies += [molecule.get_energies()[1]] ccsd_energies += [molecule.get_energies()[2]]
print() print('#' * 40) print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True point_nucleus = True if run_ccsd: description = 'R' + str(bond_length) + '_ccsd' else: description = 'R' + str(bond_length) + '_scf' molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, fcidump=True, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, run_ccsd=run_ccsd) print("spinorbs = ", molecule.get_integrals_FCIDUMP()[1]) molecular_hamiltonian = molecule.get_molecular_hamiltonian()[0]
basis = 'STO-3G' bond_length = 2.0 charge = 0 data_directory = os.getcwd() geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., bond_length))] print() print('#' * 40) print('NONREL CCSD loading') print('#' * 40) print() 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(
delete_MDCINT = True geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., bond_length))] print() print('#' * 40) print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True description = 'R' + str(bond_length) + '_ccsd' point_nucleus = True relativistic = False molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule_ccsd = run_dirac(molecule, fcidump=True, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, relativistic=relativistic, run_ccsd=run_ccsd) print("spinorbs = ", molecule_ccsd.get_integrals_FCIDUMP()[1])
delete_MRCONEE = True delete_MDCINT = True geometry = [('He', (0., 0., 0.)), ('H', (0., 0., bond_length))] print() print('#' * 40) print('NONREL CCSD Dirac calculation') print('#' * 40) print() run_ccsd = True description = 'R' + str(bond_length) + '_ccsd' point_nucleus = True molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, fcidump=True, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, run_ccsd=run_ccsd) molecular_hamiltonian = molecule.get_molecular_hamiltonian()[0] qubit_hamiltonian = jordan_wigner(molecular_hamiltonian)
print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True point_nucleus = True if run_ccsd: description = 'R' + str(bond_length) + '_ccsd' else: description = 'R' + str(bond_length) + '_scf' properties = ['MOLGRD', 'DIPOLE', 'QUADRUPOLE', 'EFG', 'POLARIZABILITY'] #properties = False molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, fcidump=True, propint=propint, properties=properties, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, delete_MDPROP=delete_MDPROP, run_ccsd=run_ccsd)
delete_MRCONEE = True delete_MDCINT = True geometry = [('H', (0., 0., 0.)), ('H', (0., 0., bond_length))] print() print('#'*40) print('NONREL Dirac calculation') print('#'*40) print() run_dft="LDA" point_nucleus = True description = 'R' + str(bond_length) + '_' + run_dft molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, NONREL=True, get="DFCOEF", run_dft=run_dft) print('DFT energy of {} Hartree.'.format(molecule.get_energies()[0]))
('H', (0., R * np.sin(angle_rad), -R * np.cos(angle_rad))), ('H', (0., -R * np.sin(angle_rad), -R * np.cos(angle_rad))), ('H', (0., -R * np.sin(angle_rad), R * np.cos(angle_rad)))] print() print('#' * 40) print('NONREL Dirac calculation') print('#' * 40) print() run_ccsd = True point_nucleus = True description = 'R' + str(R) + '_T' + str(angle) + '_ccsd' molecule = MolecularData_Dirac(geometry=geometry, basis=basis, charge=charge, description=description, data_directory=data_directory) molecule = run_dirac(molecule, fcidump=True, point_nucleus=point_nucleus, delete_input=delete_input, delete_xyz=delete_xyz, delete_output=delete_output, delete_MRCONEE=delete_MRCONEE, delete_MDCINT=delete_MDCINT, run_ccsd=run_ccsd) print('Spinorbs = ', molecule.get_integrals_FCIDUMP()[1]) print('size spinorbs : {}'.format(len(molecule.get_integrals_FCIDUMP()[1])))
print('NONREL Dirac calculation') print('#' * 40) print() point_nucleus = True run_ccsd = False if run_ccsd: description = 'R' + str(bond_length) + '_ccsd' else: description = 'R' + str(bond_length) + '_scf' save = True properties = ['MOLGRD', 'DIPOLE', 'QUADRUPOLE', 'EFG', 'POLARIZABILITY'] 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(
bond_length = 2.0 multiplicity = 1 charge = 0 data_directory=os.getcwd() geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., bond_length))] print() print('#'*40) print('NONREL CCSD loading') print('#'*40) 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')