def test_read_my_displacement_file(self): myvc = VaspChecker(name="dynamics") mydisp = myvc.read_my_displacement_file(myvc.keywords["name"], "XDATCAR_vasp522") self.assertEqual(mydisp["numatoms"], 4) self.assertEqual(mydisp["configs"][6][0], " 0.00000000 0.00000000 0.00286262\n") mydisp = myvc.read_my_displacement_file(myvc.keywords["name"], "XDATCAR_vasp5211") self.assertEqual(mydisp["numatoms"], 4) self.assertEqual(mydisp["configs"][2][1], " 0.50244722 0.50000000 0.00000000\n")
def test_combine_displacement_files(self): myvc = VaspChecker(name="dynamics_split") myvc.combine_displacement_files() shutil.move(os.path.join(testdir, "dynamics_split/XDATCAR"), os.path.join(testdir, "childdir")) shutil.move(os.path.join(testdir, "dynamics_split/XDATCAR_combined"), os.path.join(testdir, "childdir")) disp_compare = myvc.read_my_displacement_file(myvc.keywords["name"], "XDATCAR_compare") disp_combined = myvc.read_my_displacement_file("childdir", "XDATCAR_combined") print "COMPARE" for key, value in disp_compare.iteritems(): self.assertEqual(value, disp_combined[key])
def test_write_my_displacement_file(self): myvc = VaspChecker(name="childdir") mydisp = myvc.read_my_displacement_file("dynamics", "XDATCAR_vasp5211") myvc.write_my_displacement_file(mydisp) mydisp2 = myvc.read_my_displacement_file() self.assertEqual(mydisp, mydisp2) mydisp = myvc.read_my_displacement_file("dynamics", "XDATCAR_vasp522") myvc.write_my_displacement_file(mydisp) mydisp2 = myvc.read_my_displacement_file() self.assertEqual(mydisp, mydisp2)
def test_read_my_displacement_file(self): myvc = VaspChecker(name="dynamics") mydisp = myvc.read_my_displacement_file(myvc.keywords['name'], "XDATCAR_vasp522") self.assertEqual(mydisp['numatoms'], 4) self.assertEqual(mydisp['configs'][6][0], " 0.00000000 0.00000000 0.00286262\n") mydisp = myvc.read_my_displacement_file(myvc.keywords['name'], "XDATCAR_vasp5211") self.assertEqual(mydisp['numatoms'], 4) self.assertEqual(mydisp['configs'][2][1], " 0.50244722 0.50000000 0.00000000\n")
def test_combine_displacement_files(self): myvc = VaspChecker(name="dynamics_split") myvc.combine_displacement_files() shutil.move(os.path.join(testdir, "dynamics_split/XDATCAR"), os.path.join(testdir, "childdir")) shutil.move(os.path.join(testdir, "dynamics_split/XDATCAR_combined"), os.path.join(testdir, "childdir")) disp_compare = myvc.read_my_displacement_file(myvc.keywords['name'], "XDATCAR_compare") disp_combined = myvc.read_my_displacement_file("childdir", "XDATCAR_combined") print "COMPARE" for key, value in disp_compare.iteritems(): self.assertEqual(value, disp_combined[key])
def test_forward_displacement(self): myvc = VaspChecker(name="dynamics") myvc.forward_displacement_file(os.path.join(testdir, "childdir")) dp = myvc.read_my_displacement_file("dynamics") dc = myvc.read_my_displacement_file("childdir") self.assertEqual(dp, dc)