def test_supercell_nobonds(): cellpar = 2.867*angstrom sys111 = System( numbers=np.array([26, 26]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]])*cellpar, ffatypes=['Fe', 'Fe'], rvecs=np.identity(3)*cellpar, ) sys333 = sys111.supercell(3,3,3)
def test_supercell_nobonds(): cellpar = 2.867 * angstrom sys111 = System( numbers=np.array([26, 26]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]) * cellpar, ffatypes=['Fe', 'Fe'], rvecs=np.identity(3) * cellpar, ) sys333 = sys111.supercell(3, 3, 3)
def test_supercell_dipoles(): cellpar = 2.867*angstrom sys111 = System( numbers=np.array([26, 26]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]])*cellpar, ffatypes=['Fe', 'Fe'], dipoles=np.array([[0.1,1.0,2.0],[0.5,0.7,0.9]]), radii2=np.array([0.0,2.0]), rvecs=np.identity(3)*cellpar, ) sys333 = sys111.supercell(3,3,3) assert (sys333.dipoles == np.tile(np.array([[0.1,1.0,2.0],[0.5,0.7,0.9]]), (27,1))).all() assert (sys333.radii2 == np.tile(np.array([0.0,2.0]), 27)).all()
def test_supercell_charges(): cellpar = 2.867 * angstrom sys111 = System( numbers=np.array([26, 26]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]) * cellpar, ffatypes=['Fe', 'Fe'], charges=np.array([0.1, 1.0]), radii=np.array([0.0, 2.0]), rvecs=np.identity(3) * cellpar, ) sys333 = sys111.supercell(3, 3, 3) assert (sys333.charges == np.tile(np.array([0.1, 1.0]), 27)).all() assert (sys333.radii == np.tile(np.array([0.0, 2.0]), 27)).all()
def test_remove_duplicate_dipoles(): cellpar = 2.867*angstrom system1 = System( numbers=np.array([26, 27]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]])*cellpar, ffatypes=['A', 'B'], dipoles=np.array([[0.1,1.0,2.0],[0.5,0.7,0.9]]), radii2=np.array([0.0,2.0]), rvecs=np.identity(3)*cellpar, ) system2 = system1.supercell(1, 2, 1) system2.cell = system1.cell system3 = system2.remove_duplicate() for j, number in enumerate([26, 27]): #By removing duplicates, atoms might be reordered i = np.where( system3.numbers == number)[0] assert system1.radii2[j] == system3.radii2[i] assert np.all( system1.dipoles[j] == system3.dipoles[i] )
def test_remove_duplicate_dipoles(): cellpar = 2.867 * angstrom system1 = System( numbers=np.array([26, 27]), pos=np.array([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]) * cellpar, ffatypes=['A', 'B'], dipoles=np.array([[0.1, 1.0, 2.0], [0.5, 0.7, 0.9]]), radii2=np.array([0.0, 2.0]), rvecs=np.identity(3) * cellpar, ) system2 = system1.supercell(1, 2, 1) system2.cell = system1.cell system3 = system2.remove_duplicate() for j, number in enumerate([26, 27]): #By removing duplicates, atoms might be reordered i = np.where(system3.numbers == number)[0] assert system1.radii2[j] == system3.radii2[i] assert np.all(system1.dipoles[j] == system3.dipoles[i])