def test_loop(temp): path = '.' unitcell = UnitCell.from_directory(os.path.join(path)) ecis = EcisBox.from_directory(path) matrix = Matrix([[0.01/3, 1-0.01/3], [0.01, 0.99]], unitcell, ecis, size=30) mc = MonteCarlo(matrix, temp) ratio = 2 / matrix.matrix.size matrix.make_poscar('POSCAR', {2: 'V', -2: 'Fe', 1: 'N', -1: 'Vac'}) def loop(steps): ini_ene = mc.matrix.get_energy() pre = ini_ene for i in range(steps): spins = {0: (-1, 1), 1: (-2, 2)}[i%2] sites = {0: range(0, 3), 1: range(3, 4)}[i%2] pairs = mc.get_exchange_pairs(sites, spins=spins, ratio=ratio) de1 = mc.exe_flip(pairs) ini_ene += de1 if i%10000 == 0: matrix.make_poscar('POSCAR_{0}'.format(str(i)), {2: 'V', 1: 'C'}) # e = mc.matrix.get_energy() # de0 = e - pre # pre = e loop(2000000) matrix.make_poscar('POSCAR_10000', {2: 'V', 1: 'C'})
def condition(): path = '.' unitcell = UnitCell.from_directory(os.path.join(path)) print("space group:", unitcell.symm['number']) # print(unitcell.atoms) ecis = EcisBox.from_directory(path) ecis.print_conditions()