示例#1
0
def pull_eq_structure(all_scans, eq_roo, eq_roh, mass):
    from GaussianHandler import LogInterpreter
    eq_crds = LogInterpreter(*all_scans, scancoord_1=(0, 1), scancoord_2=(1, 2)).\
        get_crds_for_one(xdist=eq_roo, ydist=eq_roh)
    eq_crds *= angtobohr
    com = np.dot(mass, eq_crds) / np.sum(mass)
    com_eqcrds = eq_crds - com
    return com_eqcrds
示例#2
0
def twodee_plot():
    allscans = list(sorted(glob.glob(os.path.join(scan_dir, "logs", "2Dtet_par*.log"))))
    ref_xyz = os.path.join(main_dir, "structures", "reference_structure_official.xyz")
    data = LogInterpreter(*allscans, optimized=True, method="partrig", scancoord_1=(0, 1), scancoord_2=(1, 2))
    mass = (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))
                     / 5.485794E-4)
    pdict, freq, wfns = run2d(data.energies)
    dipadedodas = dipoles(data, ref_xyz, mass, pdict)
    dip_spect(dipadedodas, freq, wfns)
 def logData(self):
     if self._logData is None:
         from GaussianHandler import LogInterpreter
         if self.method == "rigid":
             optBool = False
         else:
             optBool = True
         self._logData = LogInterpreter(*self.scanLogs, moleculeObj=self, optimized=optBool)
     return self._logData
示例#4
0
def make_scan_plots(log_data, grid=False, contour=True):
    fig = plt.figure()
    if grid:
        pts = np.array(list(log_data.cartesians.keys()))
        plt.plot(pts[:, 0], pts[:, 1], 'o')
        # plt.close()
    if contour:
        pts = log_data.energies
        mid_oh = (pts[:, 0] / 2) - pts[:, 1]
        mid_oh *= -1
        pot = pts[:, 2]
        # load rigid data for difference plots
        rscans = list(
            sorted(glob.glob(os.path.join(scan_dir, "2Dtet_ri*.log"))))
        rel = LogInterpreter(*rscans,
                             method='rigid',
                             scancoord_1=(0, 1),
                             scancoord_2=(1, 2),
                             optimized=False)
        rpts = rel.energies
        rpot = rpts[:, 2]
        pot = np.abs((pot - rpot))
        pot *= hartowave
        pot[pot > 2000] = 2000

        # pot *= hartowave
        # pot[pot > 15000] = 15000
        plt.tick_params(labelsize=22)
        plt.rcParams.update({'font.size': 22})
        plt.tricontourf(pts[:, 0], mid_oh, pot, cmap='Purples_r', levels=15)
        plt.ylim(-0.7, 0.2)
        plt.xlim(2, 4)
        plt.colorbar()
        plt.tricontour(pts[:, 0], mid_oh, pot, colors='k', levels=15)
        # plt.close()
    return fig
示例#5
0
def lindsey(reference_xyz, all_scans, mass):
    """enumerates the code above."""
    from GaussianHandler import LogInterpreter
    ref = pull_ref_struct(reference_xyz, mass)
    all_coords = LogInterpreter(*all_scans,
                                scancoord_1=(0, 1),
                                scancoord_2=(1, 2)).cartesians
    all_coords = np.array(list(all_coords.values()))
    all_coords *= angtobohr
    all_dips = LogInterpreter(*all_scans).dipoles
    all_dips = np.array(list(all_dips.values()))
    eck_rotated_linds = np.zeros((len(all_coords), len(ref), 3))
    eck_rotated_dipoles = np.zeros((len(all_dips), 3))
    for i, coord, dip in zip(np.arange(len(all_coords)), all_coords, all_dips):
        com = np.dot(mass, coord) / np.sum(mass)
        com_coord = coord - com
        com_dip = dip - com
        eck = lindsey_way(ref, com_coord, mass)
        eck_rotated_dipoles[i] = rotator_dipoles(eck, com_dip)
        newbies = rotator(eck, com_coord)
        eck_rotated_linds[i] = newbies
    return eck_rotated_linds, eck_rotated_dipoles
示例#6
0
        :arg harm2d_0: PES of OH=0 for FD method
        :arg harm2d_1: PES of OH=1 for FD method
        :arg anharm_0: PES of OH=0 for DVR method
        :arg anharm_1: PES of OH=1 for DVR method"""
    Comp.plot_comparison_2d(harm2d_0, harm2d_1, anharm_0, anharm_1, mini_pot)
    plt.savefig(
        os.path.join(main_dir, 'figures', '2D_partrig_VAA_energycurves.png'))
    plt.close()

    Comp.plot_diffs(harm1d_0, harm1d_1, anharm_0, anharm_1, harm2d_0, harm2d_1)
    plt.savefig(
        os.path.join(main_dir, 'figures', 'E0E1_partrig_differenceplot.png'))
    plt.close()


if __name__ == '__main__':
    main_dir = os.path.dirname(os.path.dirname(__file__))
    elect_pot = np.loadtxt(
        os.path.join(main_dir, '1D Scans', '1D_partrig_electpot.dat'))
    harm1d_0, harm1d_1 = run_1d_harmonic_analysis(elect_pot)

    scan_dir = os.path.join(main_dir, '2D Scans')
    all_scans = list(
        sorted(glob.glob(os.path.join(scan_dir, "2Dtet_partrig*.log"))))
    cut_dict = LogInterpreter(*all_scans).cut_dictionary(midpoint=True)
    mini_pot = LogInterpreter(*all_scans).minimum_pot()
    harm2d_0, harm2d_1 = run_2d_harmonic_analysis(mini_pot)
    anharm_0, anharm_1 = run_2d_anharmonic_analysis(mini_pot)
    run_comp_plots(mini_pot, harm1d_0, harm1d_1, harm2d_0, harm2d_1, anharm_0,
                   anharm_1)
示例#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)
示例#8
0
    relax_allscans = list(
        sorted(glob.glob(os.path.join(scan_dir, "2Dtet_re*.log"))))
    tet_h9o4 = (np.array(
        (15.999, 15.999, 1.008, 1.008, 1.008, 15.999, 1.008, 1.008, 15.999,
         1.008, 1.008, 1.008, 1.008)) / amutome)
    tet_hd8o4 = (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)
    tet_d9o4 = (np.array(
        (15.999, 15.999, 2.014, 2.014, 2.014, 15.999, 2.014, 2.014, 15.999,
         2.014, 2.014, 2.014, 2.014)) / amutome)
    ref_xyz = os.path.join(main_dir, "structures",
                           "reference_structure_official.xyz")
    rig_data = LogInterpreter(*rig_allscans,
                              method="rigid",
                              scancoord_1=(0, 1),
                              scancoord_2=(1, 2),
                              optimized=False)
    partrig_data = LogInterpreter(*partrig_allscans,
                                  method="partrig",
                                  scancoord_1=(0, 1),
                                  scancoord_2=(1, 2),
                                  optimized=True)
    relax_data = LogInterpreter(*relax_allscans,
                                method="relax",
                                scancoord_1=(0, 1),
                                scancoord_2=(1, 2),
                                optimized=True)

    from DVR2D import twodee_plot
    twodee_plot()
示例#9
0
            for j in range(len(atom_str)):
                f.write(
                    "%s %5.8f %5.8f %5.8f \n" %
                    (atom_str[j], crds[i, j, 0], crds[i, j, 1], crds[i, j, 2]))
            f.write("\n")


if __name__ == '__main__':
    main_dir = os.path.dirname(os.path.dirname(__file__))
    log_dir = os.path.join(main_dir, '2D Scans', 'logs')
    rlog_list = sorted(glob.glob(os.path.join(log_dir, '2Dtet_ri*.log')))
    # onedee = os.path.join(main_dir, "1D Scans", "1D_relax_ooscan.log")
    reference_xyz = os.path.join(main_dir, "structures",
                                 "reference_structure_official.xyz")
    log_data = LogInterpreter(*rlog_list,
                              method="rigid",
                              optimized=False,
                              scancoord_1=(0, 1),
                              scancoord_2=(1, 2))
    mass_array = (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)) / 5.485794E-4)
    # all_crd = LogInterpreter(*rlog_list, method='relax', optimized=True, scancoord_1=(0, 1), scancoord_2=(1, 2))\
    #     .cartesians.values()
    # all_crd = np.array(list(all_crd))
    import eckartRotation as eckin
    results = eckin.many_rotations(reference_xyz, log_data, mass_array)
    zmcs = results[0]
    tet = ["O", "O", "H", "D", "D", "O", "D", "D", "O", "D", "D", "D", "D"]
    get_xyz('rigid_coords_posteckart.xyz', zmcs, tet)
示例#10
0
    elif i == 21:
        two = wfn
    elif i == 36:
        three = wfn
    else:
        pass
wfn = [zero, one, two, three]

ref_xyz = os.path.join(main_dir, "structures",
                       "reference_structure_official.xyz")
slog_dir = os.path.join(main_dir, "2D Scans", "logs")
allscans = list(sorted(glob.glob(os.path.join(slog_dir, "2Dtet_rig*.log"))))
tet_hd8o4 = (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)) / 5.485794E-4)
data = LogInterpreter(*allscans, scancoord_1=(0, 1), scancoord_2=(1, 2))
results = eckin.many_rotations(ref_xyz, data, tet_hd8o4)
zmcs = results[0]
oo_pos = (0, 1)
oops = zmcs[:, oo_pos]
diffs = np.diff(oops, axis=1)
diffs = diffs.reshape((len(diffs), 3))
oodists = np.linalg.norm(diffs, axis=1)
oodists = np.around(oodists, 4)

oh_pos = (1, 2)
ohps = zmcs[:, oh_pos]
ohdiffs = np.diff(ohps, axis=1)
ohdiffs = ohdiffs.reshape((len(ohdiffs), 3))
ohdists = np.linalg.norm(ohdiffs, axis=1)
ohdists = np.around(ohdists, 4)
示例#11
0
        plt.xlim(2, 4)
    if print_vals:
        print("Minimum Shift:", grid[np.argmin(ground_fit)] -
              grid[np.argmin(excited_fit)])  # excited shifted left = pos
        print("Energy Difference:", min(excited_fit) - min(ground_fit))
        return fig


if __name__ == '__main__':
    main_dir = os.path.dirname(os.path.dirname(__file__))
    scan_dir = os.path.join(main_dir, '2D Scans', 'logs')
    all_scans = list(sorted(glob.glob(os.path.join(scan_dir,
                                                   "2Dtet_pa*.log"))))
    data = LogInterpreter(*all_scans,
                          method='partrig',
                          scancoord_1=(0, 1),
                          scancoord_2=(1, 2),
                          optimized=True)
    make_scan_plots(data)
    # make_scan_plots(data, grid=True, contour=False)
    plt.show()

    # mini_pot = data.minimum_pot()
    # finitedict = data.finite_dict(midpoint=True)
    # cut_dict = data.cut_dictionary(midpoint=True)
    #
    # # for harmonic OH treatment
    # # HOfreqs = do_the_freqy_science(finitedict)
    # # plt.show()
    # ohHARpots, HARwfnarray = run_harmonic_dvr(finitedict, desired_energies=3, num_pts=500, plots=False)
    # wfn_flipper(HARwfnarray)