Beispiel #1
0
def test_nlist_graphene8_9A():
    system = get_system_graphene8()
    nlist = NeighborList(system)
    rcut = 9*angstrom
    nlist.request_rcut(rcut)
    nlist.update()
    nlist.check()
Beispiel #2
0
def test_nlist_graphene8_9A():
    system = get_system_graphene8()
    nlist = NeighborList(system)
    rcut = 9 * angstrom
    nlist.request_rcut(rcut)
    nlist.update()
    nlist.check()
Beispiel #3
0
def test_clean_momenta_2d():
    sys = get_system_graphene8()
    sys.set_standard_masses()
    masses = sys.masses
    vel = get_random_vel(300, False, masses)
    com_mom = np.dot(masses, vel)
    assert abs(com_mom).max() > 1e-10
    clean_momenta(sys.pos, vel, masses, sys.cell)
    com_mom = np.dot(masses, vel)
    assert abs(com_mom).max() < 1e-10
Beispiel #4
0
def test_clean_momenta_2d():
    sys = get_system_graphene8()
    sys.set_standard_masses()
    masses = sys.masses
    vel = get_random_vel(300, False, masses)
    com_mom = np.dot(masses, vel)
    assert abs(com_mom).max() > 1e-10
    clean_momenta(sys.pos, vel, masses, sys.cell)
    com_mom = np.dot(masses, vel)
    assert abs(com_mom).max() < 1e-10
Beispiel #5
0
def test_supercell_graphene_22():
    system11 = get_system_graphene8()
    system22 = system11.supercell(2, 2)
    assert abs(system22.cell.volume - system11.cell.volume * 4) < 1e-10
    assert abs(system22.cell.rvecs - system11.cell.rvecs * 2).max() < 1e-10
    assert system22.natom == system11.natom * 4
    assert system22.nbond == system11.nbond * 4
    assert abs(system22.pos[8:16] - system11.pos -
               system11.cell.rvecs[1]).max() < 1e-10
    assert abs(system22.pos[-8:] - system11.pos -
               system11.cell.rvecs.sum(axis=0)).max() < 1e-10
    assert issubclass(system22.bonds.dtype.type, np.integer)
Beispiel #6
0
def test_cell_graphene8():
    cell = get_system_graphene8().cell
    assert abs(cell.volume - np.linalg.norm(np.cross(cell.rvecs[0], cell.rvecs[1]))) < 1e-10
    assert abs(np.dot(cell.gvecs, cell.rvecs.transpose()) - np.identity(2)).max() < 1e-5
    vec1 = np.array([10.0, 0.0, 105.0])*angstrom
    cell.mic(vec1)
    assert abs(vec1 - np.array([0.156, 0.0, 105])*angstrom).max() < 1e-3
    vec2 = np.array([10.0, 0.0, 105.0])*angstrom
    cell.add_vec(vec2, cell.to_center(vec2))
    assert abs(vec1 - vec2).max() < 1e-10
    cell.add_vec(vec1, np.array([1,2]))
    assert abs(vec1 - np.array([10.002, 8.524, 105])*angstrom).max() < 1e-3
Beispiel #7
0
def test_cell_graphene8():
    cell = get_system_graphene8().cell
    assert abs(cell.volume - np.linalg.norm(np.cross(cell.rvecs[0], cell.rvecs[1]))) < 1e-10
    assert abs(np.dot(cell.gvecs, cell.rvecs.transpose()) - np.identity(2)).max() < 1e-5
    vec1 = np.array([10.0, 0.0, 105.0])*angstrom
    cell.mic(vec1)
    assert abs(vec1 - np.array([0.156, 0.0, 105])*angstrom).max() < 1e-3
    vec2 = np.array([10.0, 0.0, 105.0])*angstrom
    cell.add_vec(vec2, cell.to_center(vec2))
    assert abs(vec1 - vec2).max() < 1e-10
    cell.add_vec(vec1, np.array([1,2]))
    assert abs(vec1 - np.array([10.002, 8.524, 105])*angstrom).max() < 1e-3
Beispiel #8
0
def test_nlist_inc_r2():
    cell = get_system_graphene8().cell
    rmax = np.array([2, 2])
    r = np.array([-2, 1])
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-1, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([0, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([1, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([2, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-2, 2])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-1, 2])).all()
    r = np.array([2, 2])
    assert not nlist_inc_r(cell, r, rmax)
    assert (r == np.array([0, 0])).all()
Beispiel #9
0
def test_nlist_inc_r2():
    cell = get_system_graphene8().cell
    rmax = np.array([2, 2])
    r = np.array([-2, 1])
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-1, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([0, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([1, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([2, 1])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-2, 2])).all()
    assert nlist_inc_r(cell, r, rmax)
    assert (r == np.array([-1, 2])).all()
    r = np.array([2, 2])
    assert not nlist_inc_r(cell, r, rmax)
    assert (r == np.array([0, 0])).all()
Beispiel #10
0
def test_topology_graphene8():
    system = get_system_graphene8()
    check_topology_slow(system)
Beispiel #11
0
def get_ff_graphene(**kwargs):
    system = get_system_graphene8()
    system = system.supercell(2, 2)
    fn_pars = context.get_fn('test/parameters_polyene.txt')
    return ForceField.generate(system, fn_pars, **kwargs)
Beispiel #12
0
def test_vtens_pext_2():
    system = get_system_graphene8()
    part = ForcePartPressure(system, 1.0)
    check_vtens_part(system, part)
Beispiel #13
0
def test_topology_graphene8():
    system = get_system_graphene8()
    check_topology_slow(system)
Beispiel #14
0
def test_dlist_graphene8_bonds():
    system = get_system_graphene8()
    dlist = get_dlist_bonds(system)
    check_dlist(system, dlist)
Beispiel #15
0
def test_dlist_graphene8_random():
    system = get_system_graphene8()
    dlist = get_dlist_random(system)
    check_dlist(system, dlist)
Beispiel #16
0
def test_vtens_pext_2():
    system = get_system_graphene8()
    part = ForcePartPressure(system, 1.0)
    check_vtens_part(system, part)
Beispiel #17
0
def get_ff_graphene(**kwargs):
    system = get_system_graphene8()
    system = system.supercell(2, 2)
    fn_pars = pkg_resources.resource_filename(
        __name__, '../../data/test/parameters_polyene.txt')
    return ForceField.generate(system, fn_pars, **kwargs)
Beispiel #18
0
def get_ff_graphene(**kwargs):
    system = get_system_graphene8()
    system = system.supercell(2, 2)
    fn_pars = context.get_fn('test/parameters_polyene.txt')
    return ForceField.generate(system, fn_pars, **kwargs)
Beispiel #19
0
def test_iter_matches_peroxide_graphene8():
    system0 = get_system_graphene8()
    system1 = get_system_peroxide()
    assert len(list(system0.iter_matches(system1))) == 0
Beispiel #20
0
def test_dlist_graphene8_random():
    system = get_system_graphene8()
    dlist = get_dlist_random(system)
    check_dlist(system, dlist)
Beispiel #21
0
def test_dlist_graphene8_bonds():
    system = get_system_graphene8()
    dlist = get_dlist_bonds(system)
    check_dlist(system, dlist)
Beispiel #22
0
def get_ff_graphene(**kwargs):
    system = get_system_graphene8()
    system = system.supercell(2, 2)
    fn_pars = pkg_resources.resource_filename(__name__, '../../data/test/parameters_polyene.txt')
    return ForceField.generate(system, fn_pars, **kwargs)