def test_nlist_polyethylene4_9A(): system = get_system_polyethylene4() nlist = NeighborList(system) rcut = 9*angstrom nlist.request_rcut(rcut) nlist.update() nlist.check()
def test_nlist_polyethylene4_9A(): system = get_system_polyethylene4() nlist = NeighborList(system) rcut = 9 * angstrom nlist.request_rcut(rcut) nlist.update() nlist.check()
def test_nlist_inc_r1(): cell = get_system_polyethylene4().cell rmax = np.array([2]) r = np.array([0]) assert nlist_inc_r(cell, r, rmax) assert (r == np.array([1])).all() assert nlist_inc_r(cell, r, rmax) assert (r == np.array([2])).all() assert not nlist_inc_r(cell, r, rmax) assert (r == np.array([0])).all()
def test_supercell_polyethylene_2(): system1 = get_system_polyethylene4() system2 = system1.supercell(2) assert abs(system2.cell.volume - system1.cell.volume * 2) < 1e-10 assert abs(system2.cell.rvecs - system1.cell.rvecs * 2).max() < 1e-10 assert system2.natom == system1.natom * 2 assert system2.nbond == system1.nbond * 2 assert abs(system2.pos[12:24] - system1.pos - system1.cell.rvecs[0]).max() < 1e-10 assert issubclass(system2.bonds.dtype.type, np.integer)
def test_cell_polyethylene4(): cell = get_system_polyethylene4().cell assert cell.rvecs.shape == (1, 3) assert cell.gvecs.shape == (1, 3) assert abs(cell.volume - np.linalg.norm(cell.rvecs[0])) < 1e-10 assert abs(np.dot(cell.gvecs, cell.rvecs.transpose()) - 1) < 1e-5 vec1 = np.array([10.0, 0.0, 105.0])*angstrom cell.mic(vec1) assert abs(vec1 - np.array([-0.15, -0.374, 104.89])*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])) assert abs(vec1 - np.array([4.925, -0.187, 104.945])*angstrom).max() < 1e-3
def get_ff_polyethylene(**kwargs): system = get_system_polyethylene4() system = system.supercell(2) fn_pars = context.get_fn('test/parameters_alkane.txt') return ForceField.generate(system, fn_pars, **kwargs)
def test_vtens_pext_1(): system = get_system_polyethylene4() part = ForcePartPressure(system, 1.0) check_vtens_part(system, part)
def test_topology_polyethylene4(): system = get_system_polyethylene4() check_topology_slow(system)
def get_ff_polyethylene(**kwargs): system = get_system_polyethylene4() system = system.supercell(2) fn_pars = pkg_resources.resource_filename( __name__, '../../data/test/parameters_alkane.txt') return ForceField.generate(system, fn_pars, **kwargs)
def get_ff_polyethylene(**kwargs): system = get_system_polyethylene4() system = system.supercell(2) fn_pars = pkg_resources.resource_filename(__name__, '../../data/test/parameters_alkane.txt') return ForceField.generate(system, fn_pars, **kwargs)