示例#1
0
def run_dimer():
    x0 = (-0.5767, 1.6810, 0)
    geom0 = AnaPot.get_geom(x0)

    N = np.array((-0.9, 0.43, 0))
    N /= np.linalg.norm(N)
    R = 0.125
    coords = dimer_method(geom0, N, R, AnaPot, max_step=0.6, max_cycles=5)

    coords = np.array(coords)
    pot = AnaPot()
    pot.plot()
    ax = pot.ax
    for i, rot_cycle in enumerate(coords):
        ax.plot(*rot_cycle.T[:2], "o-", label=f"Cycle {i:02d}")
    ax.legend()
    plt.show()
示例#2
0
def run_dimer():
    x0 = (-0.5767, 1.6810, 0)
    geom0 = AnaPot.get_geom(x0)

    N = np.array((-0.9, 0.43, 0))
    N /= np.linalg.norm(N)
    R = 0.125

    geom1, geom2 = get_dimer_ends(geom0, N, R, AnaPot)
    coords = list()
    for i in range(35):
        f0 = geom0.forces
        norm_f0 = np.linalg.norm(f0)
        print(f"{i:0d} {norm_f0:.6f}")
        if norm_f0 < 1e-3:
            print("Converged!")
            break
        # Rotation
        rot_result = rotate_dimer(geom0, geom1, geom2, N, R)
        geom1, geom2, N, C, _ = rot_result
        # Translation
        trans_result = translate_dimer(geom0, N, C)
        update_dimer_ends(geom0, geom1, geom2, N, R)
        # Backup for plotting
        cs = (geom1.coords, geom0.coords, geom2.coords)
        coords.append(cs)

    # geom0.calculator.plot_eigenvalue_structure(grid=100)
    coords = np.array(coords)
    pot = AnaPot()
    pot.plot()
    ax = pot.ax
    for i, rot_cycle in enumerate(coords):
        ax.plot(*rot_cycle.T[:2], "o-", label=f"Cycle {i:02d}")
    ax.legend()
    plt.show()
示例#3
0
def test_fs():
    from pysisyphus.calculators.XTB import XTB
    from pysisyphus.cos.FreezingString import FreezingString
    # educt = geom_from_library("ciscis_24hexadiene_xtbopt.xyz")
    # product = geom_from_library("trans34dimethylcyclobutene.xyz")

    educt = AnaPot.get_geom((-1.05274, 1.02776, 0))
    product = AnaPot.get_geom((1.94101, 3.85427, 0))
    images = (educt, product)
    
    def calc_getter():
        return AnaPot()

    fs = FreezingString(images, calc_getter, max_nodes=10)
    from pysisyphus.optimizers.SteepestDescent import SteepestDescent
    sd = SteepestDescent(fs)
    sd.run()
    pot = AnaPot()
    pot.plot()
    crds = fs.allcoords.reshape(-1, 3)
    # pot.ax.plot(c[:,0], c[:,1], "o-")
    pot.ax.plot(*crds[:,:2].T, "o-")
    plt.show()
    from pysisyphus.optimizers.StringOptimizer import StringOptimizer