Exemplo n.º 1
0
def test_mbd_coulomb():
    a = 14.4
    beta = 2.0
    enes = []
    for coords, species, vol_ratios in peptide_meoh:
        geom = MBDGeom(coords, get_spectrum=True)
        _, eigs, C = geom.mbd_energy_species(species, vol_ratios, beta=0.83)
        omega_t = np.sqrt(eigs)
        alpha_0, C6, R_vdw = from_volumes(species, vol_ratios)
        omega = 4 * C6 / (3 * alpha_0 ** 2)
        charges = np.ones_like(alpha_0)
        masses = 1 / (alpha_0 * omega ** 2)
        ecoul = geom.coulomb_energy(
            charges, masses, omega_t, 'fermi', R_vdw, beta, a, C
        )
        edip = geom.dipole_energy(
            alpha_0, omega, omega_t, 'fermi,dip', R_vdw, beta, a, C
        )
        C = np.identity(len(omega_t))
        omega_non = np.repeat(omega, 3)
        ecoul_non = geom.coulomb_energy(
            charges, masses, omega_non, 'fermi', R_vdw, beta, a, C
        )
        edip_non = geom.dipole_energy(
            alpha_0, omega, omega_t, 'fermi,dip', R_vdw, beta, a, C
        )
        enes.append(ecoul - edip - (ecoul_non - edip_non))
    ene_int = enes[2] - enes[0] - enes[1]
    assert ene_int == approx(0.0002460638172163822 / 627.503, rel=1e-10)
Exemplo n.º 2
0
def test_argon_dimer_rsscs_rpa():
    geom = MBDGeom([(0, 0, 0), (0, 0, 4 * ang)], do_rpa=True, get_rpa_orders=True)
    ene, orders = geom.mbd_energy_species(['Ar', 'Ar'], [1, 1], 0.83)
    assert ene == approx(-0.0002462647623815428, rel=1e-10)
    assert orders[1] == approx(-0.0002461558113413099, rel=1e-10)
    assert orders[2] == approx(0)
    assert orders[3] == approx(-1.0885208380438466e-07, rel=1e-10)
Exemplo n.º 3
0
def test_argon_crystal_modes():
    coords, lattice, k_grid, species, vol_ratios = argon_crystal
    geom = MBDGeom(
        coords, lattice, custom_k_pts=[(0, 0, 0), (0.1, 0, 0)], get_spectrum=True
    )
    _, eigs, C = geom.mbd_energy_species(species, vol_ratios, 0.83)
    assert abs(C[:, :, 0].imag).sum() == approx(0)
    assert abs(C[:, :, 1].imag).sum() != approx(0)