Exemplo n.º 1
0
    def test_postprocess(self):
        with cd(os.path.join(test_dir, "postprocess")):
            with ScratchDir(".", copy_from_current_on_enter=True):
                shutil.copy("INCAR", "INCAR.backup")

                v = VaspJob("hello",
                            final=False,
                            suffix=".test",
                            copy_magmom=True)
                v.postprocess()
                incar = Incar.from_file("INCAR")
                incar_prev = Incar.from_file("INCAR.test")

                for f in [
                        "INCAR",
                        "KPOINTS",
                        "CONTCAR",
                        "OSZICAR",
                        "OUTCAR",
                        "POSCAR",
                        "vasprun.xml",
                ]:
                    self.assertTrue(os.path.isfile(f"{f}.test"))
                    os.remove(f"{f}.test")
                shutil.move("INCAR.backup", "INCAR")

                self.assertAlmostEqual(incar["MAGMOM"],
                                       [3.007, 1.397, -0.189, -0.189])
                self.assertAlmostEqual(incar_prev["MAGMOM"], [5, -5, 0.6, 0.6])
Exemplo n.º 2
0
 def test_continue(self):
     # Test the continuation functionality
     with cd(os.path.join(test_dir, 'postprocess')):
         # Test default functionality
         with ScratchDir('.', copy_from_current_on_enter=True) as d:
             v = VaspJob("hello", auto_continue=True)
             v.setup()
             self.assertTrue(os.path.exists("continue.json"), "continue.json not created")
             v.setup()
             self.assertEqual(Poscar.from_file("CONTCAR").structure,
                              Poscar.from_file("POSCAR").structure)
             self.assertEqual(Incar.from_file('INCAR')['ISTART'], 1)
             v.postprocess()
             self.assertFalse(os.path.exists("continue.json"),
                              "continue.json not deleted after postprocessing")
         # Test explicit action functionality
         with ScratchDir('.', copy_from_current_on_enter=True) as d:
             v = VaspJob("hello", auto_continue=[{"dict": "INCAR",
                                                  "action": {"_set": {"ISTART": 1}}}])
             v.setup()
             v.setup()
             self.assertNotEqual(Poscar.from_file("CONTCAR").structure,
                                 Poscar.from_file("POSCAR").structure)
             self.assertEqual(Incar.from_file('INCAR')['ISTART'], 1)
             v.postprocess()
Exemplo n.º 3
0
    def test_postprocess(self):
        os.chdir(os.path.join(test_dir, 'postprocess'))
        shutil.copy('INCAR', 'INCAR.backup')

        v = VaspJob("hello", final=False, suffix=".test", copy_magmom=True)
        v.postprocess()
        incar = Incar.from_file("INCAR")
        incar_prev = Incar.from_file("INCAR.test")

        for f in ['INCAR', 'KPOINTS', 'CONTCAR', 'OSZICAR', 'OUTCAR',
                  'POSCAR', 'vasprun.xml']:
            self.assertTrue(os.path.isfile('{}.test'.format(f)))
            os.remove('{}.test'.format(f))
        shutil.move('INCAR.backup', 'INCAR')

        self.assertAlmostEqual(incar['MAGMOM'], [3.007, 1.397, -0.189, -0.189])
        self.assertAlmostEqual(incar_prev["MAGMOM"], [5, -5, 0.6, 0.6])
Exemplo n.º 4
0
    def test_postprocess(self):
        with cd(os.path.join(test_dir, 'postprocess')):
            with ScratchDir('.', copy_from_current_on_enter=True) as d:
                shutil.copy('INCAR', 'INCAR.backup')

                v = VaspJob("hello", final=False, suffix=".test", copy_magmom=True)
                v.postprocess()
                incar = Incar.from_file("INCAR")
                incar_prev = Incar.from_file("INCAR.test")

                for f in ['INCAR', 'KPOINTS', 'CONTCAR', 'OSZICAR', 'OUTCAR',
                          'POSCAR', 'vasprun.xml']:
                    self.assertTrue(os.path.isfile('{}.test'.format(f)))
                    os.remove('{}.test'.format(f))
                shutil.move('INCAR.backup', 'INCAR')

                self.assertAlmostEqual(incar['MAGMOM'], [3.007, 1.397, -0.189, -0.189])
                self.assertAlmostEqual(incar_prev["MAGMOM"], [5, -5, 0.6, 0.6])