qc_input = QchemInput( molecule, jobtype='opt', exchange='hf', basis='sto-3g', geom_opt_tol_gradient=300, geom_opt_tol_energy=100, geom_opt_tol_displacement=1200, geom_opt_max_cycles=50, # reduce this number to test not convergence case geom_opt_constrains= constrains # comment/uncomment this line to use or not constrains ) try: parsed_data = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization, force_recalculation=False) opt_molecule = parsed_data['optimized_molecule'] print('Optimized structure') print(opt_molecule) print('Final energy:', parsed_data['energy']) except OutputError as e: print(e.error_lines) parsed_data = basic_optimization(e.full_output) print('Last structure') print(parsed_data['optimization_steps'][-1]['molecule']) print('Last energy:', parsed_data['optimization_steps'][-1]['energy'])
ras_act=4, ras_elec=4, # ras_occ=66, ras_spin_mult=1, # singlets only ras_roots=10, # calculate 8 states ras_do_hole=True, ras_do_part=True, # ras_srdft_cor='srpbe', # ras_srdft_exc='srpbe', # ras_omega=300, set_iter=60) parsed_data, electronic_structure = get_output_from_qchem( qc_input, processors=4, force_recalculation=False, parser=rasci_parser, read_fchk=True, store_full_output=True) print('final structure') print(electronic_structure['structure']) # Analysis of diabatic states to use in diabatization print('\nAdiabatic states to use in diabatization (1e, max_jump 4)') list_diabatic = [] for i, state in enumerate(parsed_data['excited_states']): ratio = get_ratio_of_condition(state, n_electron=1, max_jump=4) if ratio > 0.1: mark = 'X'
# molecule ethene = [[0.0, 0.0000, 0.65750], [0.0, 0.0000, -0.65750], [0.0, 0.92281, 1.22792], [0.0, -0.92281, 1.22792], [0.0, -0.92281, -1.22792], [0.0, 0.92281, -1.22792]] symbols = ['C', 'C', 'H', 'H', 'H', 'H'] # create molecule molecule = Structure(coordinates=ethene, symbols=symbols, charge=0, multiplicity=1) # create Q-Chem input qc_input = QchemInput(molecule, jobtype='sp', exchange='hf', basis='sto-3g') print(qc_input.get_txt()) # get data from Q-Chem calculation output = get_output_from_qchem(qc_input, processors=1, force_recalculation=True, remote=remote_data_pc, scratch='/Users/abel/Scratch/export/', parser=basic_parser_qchem) # Get data print('OUTPUT') print(output) print('the energy is: ', output['scf_energy'])
ncols_remaining -= ncols_block sline = line.split() colmin, colmax = int(sline[0]) - 1, int(sline[-1]) line = next(contents_iter) # iterate over the rows for row in range(3*N): sline = line.split() rowidx = int(sline[0]) - 1 hessian_scf[rowidx, colmin:colmax] = list(map(float, sline[1:])) line = next(contents_iter, 'break') return hessian_scf #Running calcs #Getting gradient output_grad = get_output_from_qchem(qc_input1, processors=4) contents_splitlines = output_grad.splitlines() gradient = get_gradient(contents_splitlines, 3) print(gradient) #Getting hessian output_hess = get_output_from_qchem(qc_input2, processors=4) contents_splitlines2 = output_hess.splitlines() hessian = get_hessian(contents_splitlines2, 3) print(hessian) #Getting Energy and Dipole moment parsed_data = basic_parser_qchem(output_grad) print(parsed_data) e = parsed_data['scf_energy'] print(e)
multiplicity=1) # Transition state optimization qc_input = QchemInput(molecule, jobtype='ts', exchange='hf', basis='sto-3g', geom_opt_tol_gradient=300, geom_opt_tol_energy=100, geom_opt_tol_displacement=1200, geom_opt_max_cycles=50, # reduce this number to test not convergence case ) opt_data, ee = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization, force_recalculation=False, read_fchk=True, store_full_output=True) print('Transition state') print(opt_data['optimized_molecule']) # frequencies calculation qc_input = QchemInput(opt_data['optimized_molecule'], jobtype='freq', exchange='hf', basis='sto-3g', sym_ignore=True, symmetry=False, scf_guess=ee['coefficients'])
qc_input = QchemInput(molecule, jobtype='opt', exchange='b3lyp', basis='sto-3g', geom_opt_tol_gradient=300, geom_opt_tol_energy=100, geom_opt_tol_displacement=1200, geom_opt_max_cycles=50, # n_frozen_core=0, ) try: parsed_data, electronic_structure = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization, read_fchk=True, store_full_output=True ) except OutputError as e: print(e.error_lines) exit() opt_molecule = parsed_data['optimized_molecule'] print('Optimized molecule') print(opt_molecule.get_xyz()) basis_custom_repo = get_basis_from_ccRepo(molecule, 'cc-pVTZ') qc_input = QchemInput(opt_molecule, jobtype='sp',
symbols=symbols_monomer, charge=0, multiplicity=1) # optimization qchem input qc_input = QchemInput(monomer, jobtype='opt', exchange='hf', basis='sto-3g', geom_opt_tol_gradient=300, geom_opt_tol_energy=100, geom_opt_coords=-1, geom_opt_tol_displacement=1200) parsed_data = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization) opt_monomer = parsed_data['optimized_molecule'] print('Optimized monomer structure') print(opt_monomer) # Build dimer from monomer coor_monomer2 = np.array(opt_monomer.get_coordinates()) coor_monomer2[:, 2] += 6.0 # monomers separation coordinates = opt_monomer.get_coordinates() + coor_monomer2.tolist() symbols_dimer = symbols_monomer * 2 dimer = Structure(coordinates=coordinates,
multiplicity=1) print('Initial structure') print(molecule) # Initial calculation with STO-3G basis qc_input = QchemInput( molecule, jobtype='opt', exchange='hf', basis='sto-3g', ) parsed_data, ee = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization, force_recalculation=False, read_fchk=True) opt_molecule = parsed_data['optimized_molecule'] print('Optimized structure') print(opt_molecule) print('Final energy:', parsed_data['energy']) # Precise calculation with larger 6-31G basis using previous MO as guess qc_input = QchemInput(opt_molecule, jobtype='sp', exchange='hf', basis='6-31g', basis2=ee['basis'],
symbols=symbols_monomer, charge=0, multiplicity=1) # optimization qchem input qc_input = QchemInput(monomer, jobtype='opt', exchange='hf', basis='sto-3g', geom_opt_tol_gradient=300, geom_opt_tol_energy=100, geom_opt_coords=-1, geom_opt_tol_displacement=1200) parsed_data = get_output_from_qchem(qc_input, processors=4, parser=basic_optimization) opt_monomer = parsed_data['optimized_molecule'] print('Optimized monomer structure') print(opt_monomer) # Build dimer from monomer coor_monomer2 = np.array(opt_monomer.get_coordinates()) coor_monomer2[:, 2] += 4.0 # monomers separation coordinates = opt_monomer.get_coordinates() + coor_monomer2.tolist() symbols_dimer = symbols_monomer * 2 dimer = Structure(coordinates=coordinates,
symbols=['O', 'H'], charge=-1, multiplicity=1) # create qchem input qc_input = QchemInput(molecule, jobtype='sp', exchange='hf', basis='6-31G', unrestricted=True) # calculate and parse qchem output data = get_output_from_qchem(qc_input, processors=4, force_recalculation=True, parser=basic_parser_qchem, ) print('scf energy', data['scf_energy'], 'H') print('Orbital energies (H)') print(' {:^10} {:^10}'.format('alpha', 'beta')) for a, b in zip(data['orbital_energies']['alpha'], data['orbital_energies']['beta']): print('{:10.3f} {:10.3f}'.format(a, b)) print('dipole moment:', data['multipole']['dipole_moment'], data['multipole']['dipole_units']) print('quadrupole moment ({}):\n'.format(data['multipole']['quadrupole_units']), np.array(data['multipole']['quadrupole_moment'])) print('octopole moment ({}):\n'.format(data['multipole']['octopole_units']),
molecule_water = Structure(coordinates=water, symbols=['O', 'H', 'H'], charge=0, multiplicity=1) qc_input = QchemInput( molecule_water, jobtype='freq', exchange='hf', basis='6-31G', sym_ignore=True, ) parsed_data, ee = get_output_from_qchem(qc_input, parser=basic_frequencies, read_fchk=True) molecule_coor = np.array(ee['structure'].get_coordinates()) molecule_symbols = np.array(ee['structure'].get_symbols()) # print(' structure') print('Final energy:', parsed_data['scf_energy']) energies.append(parsed_data['scf_energy']) modes = [np.array(m['displacement']) for m in parsed_data['modes']] freqs = [m['frequency'] for m in parsed_data['modes']] print('freqs: ', freqs) frequencies.append(freqs) sm = SymmetryModes(group='c2v', coordinates=molecule_coor,
[-3.04726506, 1.30510083, -0.03293196], [-3.05052841, -0.54769055, 0.01011971]], symbols=['C', 'H', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H']) # create qchem input qc_input = QchemInput( molecule_cis, jobtype='sp', exchange='hf', basis='sto-3g', #sym_ignore=True ) # calculate and parse qchem output data_cis, ee_cis = get_output_from_qchem(qc_input, read_fchk=True, processors=4, parser=basic_parser_qchem) molecule_trans = Structure( coordinates=[[-1.06908233, -2.13352097, -0.00725330], [-0.53502155, -3.05996561, -0.04439369], [-2.13778918, -2.13379901, 0.04533562], [-0.39193053, -0.95978774, -0.02681816], [0.67677629, -0.95950970, -0.07940766], [-1.16057856, 0.37359983, 0.02664018], [-2.22928521, 0.37332175, 0.07923299], [-0.48342683, 1.54733308, 0.00707382], [-1.01748758, 2.47377771, 0.04421474], [0.58527987, 1.54761115, -0.04551805]], symbols=['C', 'H', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H'])
h2o2_mol = get_geometry_from_pubchem('h2o2') for molecule, group in zip([h2o2_mol, sh6_mol, water_mol, dichloro_mol, methane_mol, ammonia_mol], ['c2', 'Oh', 'c2v', 'c2h', 'Td', 'c3v']): qc_input = QchemInput(molecule, jobtype='opt', exchange='hf', basis='sto-3g', #geom_opt_tol_gradient=1, #geom_opt_tol_energy=1, #geom_opt_max_cycles=500, ) parsed_data = get_output_from_qchem(qc_input, parser=basic_optimization, processors=6) qc_input = QchemInput(parsed_data['optimized_molecule'], jobtype='freq', exchange='hf', basis='sto-3g', #sym_ignore=True, ) print(molecule) parsed_data, ee = get_output_from_qchem(qc_input, parser=basic_frequencies, read_fchk=True, processors=6) molecule_coor = np.array(ee['structure'].get_coordinates()) molecule_symbols = np.array(ee['structure'].get_symbols())