예제 #1
0
def run_oo_dvr(oh_pots, desired_energies=None, num_pts=None, plot=False):
    """Runs the secondary DVR (over the OO coordinate) using the potentials created by some treatment of the OH.
        (then uses wfn_flipper to rephase wavefunctions whatever the ground state wavefunctions look like.)
    :param oh_pots: Potential curves of the OH=0 and OH=1. (col0: roo, col1: OH=0, col2: OH=1)
    :type oh_pots: np.ndarray
    :param desired_energies: number of energies/wavefunctions of the DVR to be saved to results objects
    :type desired_energies: int
    :param num_pts: number of points to cut the grid into.
    :type num_pts: int
    :param plot: If true, plots the potentials with the wavefunctions overlaid at their appropriate energies.
    :type plot: bool
    :return: energies_array (col0-?: energies, row0: OH=0, row1: OH=0),
             wavefunctions_array (col0-?: wavefunction values, 3rd dimension: OH=0 or 1)
    :rtype: 2 np.ndarrays
    """
    from PotentialHandlers import Potentials1D
    from Analysis2D import wfn_flipper
    dvr_1D = DVR("ColbertMiller1D")
    energies_array = np.zeros((2, desired_energies))
    wavefunctions_array = np.zeros((2, num_pts, desired_energies))
    mO = O / amutome
    muOO = mO / 2
    x = oh_pots[:, 0] * angtobohr
    mini = min(x) - 0.3
    maxi = max(x) + 0.15
    for j in np.arange(2):
        en = oh_pots[:, j + 1] / hartowave
        res = dvr_1D.run(potential_function=Potentials1D().potlint(x, en),
                         mass=muOO,
                         divs=num_pts,
                         domain=(mini, maxi),
                         num_wfns=desired_energies)
        potential = res.potential_energy.diagonal()
        ens = res.wavefunctions.energies * hartowave
        energies_array[j, :] = ens
        wavefunctions_array[j, :, :] = res.wavefunctions.wavefunctions
        if plot:
            forreal_potential = potential * hartowave
            ang_grid = res.grid / angtobohr
            plt.rcParams.update({'font.size': 22})
            plt.plot(ang_grid, forreal_potential, '-k', linewidth=6.0)
            plt.ylim(0, 8000)
            plt.xlim(2, 3.5)
            colors = ["purple", "violet", "orchid", "plum", "hotpink"]
            for i, wf in enumerate(res.wavefunctions):
                wfn = wf.data * 1000
                wfn += ens[i]
                plt.plot(ang_grid, wfn, colors[i], linewidth=6.0)
            plt.title("OH = %s" % j)
            # plt.savefig(os.path.join(
            #     os.path.dirname(os.path.dirname(__file__)), 'figures', 'cut DVR', 'rigid_OH_%s.png' % j))
            plt.show()
            plt.close()
    wavefunctions_array = wfn_flipper(wavefunctions_array)
    return energies_array, wavefunctions_array
예제 #2
0
def run_harmonic(mass_hd8o4, reference_xyz, log_data):
    finitedict = log_data.finite_dict(midpoint=True)
    ohHARpots, HARwfnarray = run_harmonic_dvr(finitedict,
                                              desired_energies=4,
                                              num_pts=500)
    HARwfnarray = wfn_flipper(HARwfnarray)
    # harmon = transition_moment(log_data, reference_xyz, mass_hd8o4, HARwfnarray)
    ooHARenergies, ooHARwavefunctions = run_oo_dvr(ohHARpots,
                                                   desired_energies=3,
                                                   num_pts=500,
                                                   plot=False)
    # har_trans_mom = calculate_intensities(ooHARwavefunctions, trans_mom=harmon)
    # har_notm = calculate_intensities(ooHARwavefunctions)
    make_adiabatplots(log_data.minimum_pot(), ohHARpots, ooHARenergies)
    plt.show()
예제 #3
0
def run_og(mass_hd8o4, reference_xyz, log_data):
    cut_dict = log_data.cut_dictionary(midpoint=True)
    ohpots, wfnarray = run_oh_dvr(cut_dict,
                                  mass='H',
                                  desired_energies=4,
                                  num_pts=500)
    wfnarray = wfn_flipper(wfnarray)
    ooh_energies, ooh_wavefunctions = run_oo_dvr(ohpots,
                                                 desired_energies=3,
                                                 num_pts=500,
                                                 plot=False)
    # original = transition_moment(log_data, reference_xyz, mass_hd8o4, wfnarray, plot=False)
    # plt.show()
    # og_intensities = calculate_intensities(ooh_wavefunctions, trans_mom=original)
    make_adiabatplots(log_data.minimum_pot(), ohpots, ooh_energies)
    plt.show()
예제 #4
0
def run_allh(mass_h9o4, reference_xyz, log_data):
    cut_dict = log_data.cut_dictionary(midpoint=True)
    ohpots, wfnarray = run_oh_dvr(cut_dict,
                                  mass='H',
                                  desired_energies=4,
                                  num_pts=500)
    wfnarray = wfn_flipper(wfnarray)
    ooh_energies, ooh_wavefunctions = run_oo_dvr(ohpots,
                                                 desired_energies=4,
                                                 num_pts=500,
                                                 plot=False)
    allh_trans_mom = transition_moment(log_data, reference_xyz, mass_h9o4,
                                       wfnarray)
    allh_intensities = calculate_intensities(ooh_wavefunctions,
                                             trans_mom=allh_trans_mom)
    make_spect(ooh_energies,
               allh_intensities,
               line_type='g-',
               label_name="All H - Transition moment",
               freq_shift=0)
예제 #5
0
def run_lintrans(mass_hd8o4, reference_xyz, log_data):
    cut_dict = log_data.cut_dictionary(midpoint=True)
    ohpots, wfnarray = run_oh_dvr(cut_dict,
                                  mass='H',
                                  desired_energies=4,
                                  num_pts=500)
    wfnarray = wfn_flipper(wfnarray)
    ooh_energies, ooh_wavefunctions = run_oo_dvr(ohpots,
                                                 desired_energies=3,
                                                 num_pts=500,
                                                 plot=False)
    lin_trans_mom = linear_tm(log_data,
                              reference_xyz,
                              mass_hd8o4,
                              wfnarray,
                              plot=False)
    lin_intensities = calculate_intensities(ooh_wavefunctions,
                                            trans_mom=lin_trans_mom)
    make_spect(ooh_energies,
               lin_intensities,
               line_type='C1-',
               label_name=" Anharmonic - Linear Transition moment",
               freq_shift=15)
예제 #6
0
def run_relax(mass_hd8o4, reference_xyz, log_data):
    cut_dict = log_data.cut_dictionary(midpoint=True)
    ohpots, wfnarray = run_oh_dvr(cut_dict,
                                  mass='H',
                                  desired_energies=4,
                                  num_pts=500)
    wfnarray = wfn_flipper(wfnarray)
    ooh_energies, ooh_wavefunctions = run_oo_dvr(ohpots,
                                                 desired_energies=3,
                                                 num_pts=500,
                                                 plot=False)
    original = transition_moment(log_data,
                                 reference_xyz,
                                 mass_hd8o4,
                                 wfnarray,
                                 plot=False)
    # plt.show()
    og_intensities = calculate_intensities(ooh_wavefunctions,
                                           trans_mom=original)
    make_spect(ooh_energies,
               og_intensities,
               line_type='C3-',
               label_name="Relaxed Scan",
               freq_shift=0)
예제 #7
0
        plt.xlabel("OO distance")
        plt.ylabel("Transition Moment")
        # plt.ylim(-1, 1)
        plt.legend()
        plt.show()
    return mus


main_dir = os.path.dirname(os.path.dirname(__file__))
scan_dir = os.path.join(main_dir, "2D Scans", "logs")
VAA_dir = os.path.join(main_dir, 'VAA')

if __name__ == '__main__':
    from GaussianHandler import LogInterpreter
    from Analysis2D import run_dvr, wfn_flipper
    from MakeSpectra import to_eck_struct_new
    ref_xyz = os.path.join(main_dir, "structures",
                           "reference_structure_official.xyz")
    all_scans = list(
        sorted(glob.glob(os.path.join(scan_dir, "2Dtet_rig*.log"))))
    cut_dict = LogInterpreter(*all_scans).cut_dictionary(midpoint=True)
    ohpots, wfnarray = run_dvr(cut_dict, desired_energies=4, num_pts=100)
    wfnarray = wfn_flipper(wfnarray)
    tet = (np.array((15.999, 15.999, 1.008, 2.014, 2.014, 15.999, 2.014, 2.014,
                     15.999, 2.014, 2.014, 2.014, 2.014)) / amutome)
    results = to_eck_struct_new(ref_xyz, all_scans, tet)
    dipadedodas = interp_dipoles(results, len(wfnarray[0]))
    derivies = deriv_dipoles(dipadedodas)
    mus = psi_trans(dipadedodas, wfnarray, plot=True)
    lin_mus = lin_psi_trans(dipadedodas, derivies, wfnarray, plot=True)