• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vasp.Incar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pymatgen.io.vasp.Incar的典型用法代码示例。如果您正苦于以下问题:Python Incar类的具体用法?Python Incar怎么用?Python Incar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Incar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _verify_inputs

    def _verify_inputs(self):
        """Validation of input files under user NEB directory."""
        user_incar = Incar.from_file(os.path.join(self.user_dir, "INCAR"))
        ref_incar = Incar.from_file(os.path.join(self.ref_dir_input, "INCAR"))

        # Check INCAR
        params_to_check = self.get("params_to_check", [])
        defaults = {"ICHAIN": 0, "LCLIMB": True}
        for p in params_to_check:
            if user_incar.get(p, defaults.get(p)) != ref_incar.get(p, defaults.get(p)):
                raise ValueError("INCAR value of {} is inconsistent!".format(p))

        # Check KPOINTS
        user_kpoints = Kpoints.from_file(os.path.join(self.user_dir, "KPOINTS"))
        ref_kpoints = Kpoints.from_file(os.path.join(self.ref_dir_input, "KPOINTS"))
        if user_kpoints.style != ref_kpoints.style or user_kpoints.num_kpts != ref_kpoints.num_kpts:
            raise ValueError("KPOINT files are inconsistent! "
                             "Paths are:\n{}\n{} with kpts = {} {}".format(
                self.user_dir, self.ref_dir_input, user_kpoints, ref_kpoints))

        # Check POTCAR
        user_potcar = Potcar.from_file(os.path.join(self.user_dir, "POTCAR"))
        ref_potcar = Potcar.from_file(os.path.join(self.ref_dir_input, "POTCAR"))
        if user_potcar.symbols != ref_potcar.symbols:
            raise ValueError("POTCAR files are inconsistent! "
                             "Paths are:\n{}\n{}".format(self.user_dir, self.ref_dir_input))

        # Check POSCARs
        for u, r in zip(self.user_sdir, self.ref_sdir_input):
            user_poscar = Poscar.from_file(os.path.join(u, "POSCAR"))
            ref_poscar = Poscar.from_file(os.path.join(r, "POSCAR"))
            if user_poscar.natoms != ref_poscar.natoms or \
                            user_poscar.site_symbols != ref_poscar.site_symbols:
                raise ValueError("POSCAR files are inconsistent! Paths are:\n{}\n{}".format(u, r))
开发者ID:montoyjh,项目名称:MatMethods,代码行数:34,代码来源:neb_tasks.py


示例2: _verify_inputs

    def _verify_inputs(self):
        user_incar = Incar.from_file(os.path.join(os.getcwd(), "INCAR"))
        ref_incar = Incar.from_file(os.path.join(self["ref_dir"], "inputs", "INCAR"))

        # perform some BASIC tests

        # check INCAR
        params_to_check = self.get("params_to_check", [])
        defaults = {"ISPIN": 1, "ISMEAR": 1, "SIGMA": 0.2}
        for p in params_to_check:
            if user_incar.get(p, defaults.get(p)) != ref_incar.get(p, defaults.get(p)):
                raise ValueError("INCAR value of {} is inconsistent!".format(p))

        # check KPOINTS
        user_kpoints = Kpoints.from_file(os.path.join(os.getcwd(), "KPOINTS"))
        ref_kpoints = Kpoints.from_file(os.path.join(self["ref_dir"], "inputs", "KPOINTS"))
        if user_kpoints.style != ref_kpoints.style or user_kpoints.num_kpts != ref_kpoints.num_kpts:
            raise ValueError("KPOINT files are inconsistent! Paths are:\n{}\n{}".format(
                os.getcwd(), os.path.join(self["ref_dir"], "inputs")))

        # check POSCAR
        user_poscar = Poscar.from_file(os.path.join(os.getcwd(), "POSCAR"))
        ref_poscar = Poscar.from_file(os.path.join(self["ref_dir"], "inputs", "POSCAR"))
        if user_poscar.natoms != ref_poscar.natoms or user_poscar.site_symbols != ref_poscar.site_symbols:
            raise ValueError("POSCAR files are inconsistent! Paths are:\n{}\n{}".format(
                os.getcwd(), os.path.join(self["ref_dir"], "inputs")))

        # check POTCAR
        user_potcar = Potcar.from_file(os.path.join(os.getcwd(), "POTCAR"))
        ref_potcar = Potcar.from_file(os.path.join(self["ref_dir"], "inputs", "POTCAR"))
        if user_potcar.symbols != ref_potcar.symbols:
            raise ValueError("POTCAR files are inconsistent! Paths are:\n{}\n{}".format(
                os.getcwd(), os.path.join(self["ref_dir"], "inputs")))
        logger.info("RunVaspFake: verified inputs successfully")
开发者ID:saurabh02,项目名称:MatMethods,代码行数:34,代码来源:run_calc.py


示例3: test_static_run_correction

    def test_static_run_correction(self):
        shutil.copy("OSZICAR.empty", "OSZICAR")
        s1 = Structure.from_file("POSCAR")
        incar = Incar.from_file("INCAR")

        # Test for NSW 0
        incar.update({"NSW": 0})
        incar.write_file("INCAR")
        h = VaspErrorHandler("vasp.out")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d['errors'], ['zpotrf'])
        s2 = Structure.from_file("POSCAR")
        self.assertAlmostEqual(s2.volume, s1.volume, 3)
        self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0)

        # Test for ISIF 0-2
        incar.update({"NSW":99, "ISIF":2})
        incar.write_file("INCAR")
        h = VaspErrorHandler("vasp.out")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d['errors'], ['zpotrf'])
        s2 = Structure.from_file("POSCAR")
        self.assertAlmostEqual(s2.volume, s1.volume, 3)
        self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0)
开发者ID:shyamd,项目名称:custodian,代码行数:26,代码来源:test_handlers.py


示例4: test_continue

 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()
开发者ID:shyamd,项目名称:custodian,代码行数:25,代码来源:test_jobs.py


示例5: setUpClass

    def setUpClass(cls):
        if not os.environ.get("VASP_PSP_DIR"):
            os.environ["VASP_PSP_DIR"] = os.path.join(module_dir,
                                                      "reference_files")
            print(
                'Note: This system is not set up to run VASP jobs. '
                'Please set your VASP_PSP_DIR environment variable.')

        cls.struct_si = PymatgenTest.get_structure("Si")

        cls.ref_incar = Incar.from_file(
            os.path.join(module_dir, "reference_files", "setup_test", "INCAR"))
        cls.ref_poscar = Poscar.from_file(
            os.path.join(module_dir, "reference_files", "setup_test",
                         "POSCAR"))
        cls.ref_potcar = Potcar.from_file(
            os.path.join(module_dir, "reference_files", "setup_test",
                         "POTCAR"))
        cls.ref_kpoints = Kpoints.from_file(
            os.path.join(module_dir, "reference_files", "setup_test",
                         "KPOINTS"))
        cls.ref_incar_preserve = Incar.from_file(os.path.join(module_dir,
                                                              "reference_files",
                                                              "preserve_incar",
                                                              "INCAR"))
开发者ID:aykol,项目名称:MatMethods,代码行数:25,代码来源:test_write_vasp.py


示例6: test_eddrmm

 def test_eddrmm(self):
     h = VaspErrorHandler("vasp.eddrmm")
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["eddrmm"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["ALGO"], "Normal")
     self.assertEqual(h.correct()["errors"], ["eddrmm"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["POTIM"], 0.25)
开发者ID:shyamd,项目名称:custodian,代码行数:9,代码来源:test_handlers.py


示例7: _verify_files

 def _verify_files(self, skip_kpoints=False, preserve_incar=False):
     if not preserve_incar:
         self.assertEqual(Incar.from_file(os.path.join(module_dir, "INCAR")), self.ref_incar)
         self.assertEqual(str(Poscar.from_file(os.path.join(module_dir, "POSCAR"))), str(self.ref_poscar))
         self.assertEqual((Potcar.from_file(os.path.join(module_dir, "POTCAR"))).symbols, self.ref_potcar.symbols)
         if not skip_kpoints:
             self.assertEqual(str(Kpoints.from_file(os.path.join(module_dir, "KPOINTS"))), str(self.ref_kpoints))
     else:
         self.assertEqual(Incar.from_file(os.path.join(module_dir, "INCAR")), self.ref_incar_preserve)
开发者ID:hackingmaterials,项目名称:MatMethods,代码行数:9,代码来源:test_write_vasp.py


示例8: test_rhosyg

 def test_rhosyg(self):
     h = VaspErrorHandler("vasp.rhosyg")
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["rhosyg"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["SYMPREC"], 1e-4)
     self.assertEqual(h.correct()["errors"], ["rhosyg"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["ISYM"], 0)
开发者ID:shyamd,项目名称:custodian,代码行数:9,代码来源:test_handlers.py


示例9: setup

    def setup(self):
        """
        Performs initial setup for VaspJob, including overriding any settings
        and backing up.
        """

        if self.backup:
            for f in VASP_INPUT_FILES:
                shutil.copy(f, "{}.orig".format(f))

        if self.auto_npar:
            try:
                incar = Incar.from_file("INCAR")
                # Only optimized NPAR for non-HF and non-RPA calculations.
                if not (incar.get("LHFCALC") or incar.get("LRPA") or
                        incar.get("LEPSILON")):
                    if incar.get("IBRION") in [5, 6, 7, 8]:
                        # NPAR should not be set for Hessian matrix
                        # calculations, whether in DFPT or otherwise.
                        del incar["NPAR"]
                    else:
                        import multiprocessing
                        # try sge environment variable first
                        # (since multiprocessing counts cores on the current
                        # machine only)
                        ncores = os.environ.get('NSLOTS') or \
                            multiprocessing.cpu_count()
                        ncores = int(ncores)
                        for npar in range(int(math.sqrt(ncores)),
                                          ncores):
                            if ncores % npar == 0:
                                incar["NPAR"] = npar
                                break
                    incar.write_file("INCAR")
            except:
                pass

        # Auto continue if a read-only STOPCAR is present
        if self.auto_continue and \
           os.path.exists("STOPCAR") and \
           not os.access("STOPCAR", os.W_OK):
            # Remove STOPCAR
            os.chmod("STOPCAR", 0o644)
            os.remove("STOPCAR")

            # Setup INCAR to continue
            incar = Incar.from_file("INCAR")
            incar['ISTART'] = 1
            incar.write_file("INCAR")

            shutil.copy('CONTCAR', 'POSCAR')

        if self.settings_override is not None:
            VaspModder().apply_actions(self.settings_override)
开发者ID:xhqu1981,项目名称:custodian,代码行数:54,代码来源:jobs.py


示例10: test_run

 def test_run(self):
     with ScratchDir(".") as d:
         for f in ["INCAR", "POSCAR", "POTCAR", "KPOINTS"]:
             shutil.copy(os.path.join('..', test_dir, f), f)
         oldincar = Incar.from_file("INCAR")
         v = GenerateVaspInputJob("pymatgen.io.vasp.sets.MPNonSCFSet",
                                  contcar_only=False)
         v.run()
         incar = Incar.from_file("INCAR")
         self.assertEqual(incar["ICHARG"], 11)
         self.assertEqual(oldincar["ICHARG"], 1)
         kpoints = Kpoints.from_file("KPOINTS")
         self.assertEqual(str(kpoints.style), "Reciprocal")
开发者ID:shyamd,项目名称:custodian,代码行数:13,代码来源:test_jobs.py


示例11: setUpClass

    def setUpClass(cls):
        if not SETTINGS.get("VASP_PSP_DIR"):
            SETTINGS["VASP_PSP_DIR"] = os.path.join(module_dir, "reference_files")
            print(
                "This system is not set up to run VASP jobs. "
                "Please set VASP_PSP_DIR variable in your ~/.pmgrc.yaml file."
            )

        cls.struct_si = PymatgenTest.get_structure("Si")

        cls.ref_incar = Incar.from_file(os.path.join(module_dir, "reference_files", "setup_test", "INCAR"))
        cls.ref_poscar = Poscar.from_file(os.path.join(module_dir, "reference_files", "setup_test", "POSCAR"))
        cls.ref_potcar = Potcar.from_file(os.path.join(module_dir, "reference_files", "setup_test", "POTCAR"))
        cls.ref_kpoints = Kpoints.from_file(os.path.join(module_dir, "reference_files", "setup_test", "KPOINTS"))
        cls.ref_incar_preserve = Incar.from_file(os.path.join(module_dir, "reference_files", "preserve_incar", "INCAR"))
开发者ID:hackingmaterials,项目名称:MatMethods,代码行数:15,代码来源:test_write_vasp.py


示例12: test_setup

    def test_setup(self):
        if "VASP_PSP_DIR" not in os.environ:
            os.environ["VASP_PSP_DIR"] = test_dir
        os.chdir(os.path.join(test_dir, 'setup_neb'))

        v = VaspNEBJob("hello", half_kpts=True)
        v.setup()

        incar = Incar.from_file("INCAR")
        count = multiprocessing.cpu_count()
        if count > 1:
            self.assertGreater(incar["NPAR"], 1)

        kpt = Kpoints.from_file("KPOINTS")
        kpt_pre = Kpoints.from_file("KPOINTS.orig")
        self.assertEqual(kpt_pre.style.name, "Monkhorst")
        self.assertEqual(kpt.style.name, "Gamma")

        shutil.copy("KPOINTS.orig", "KPOINTS")
        os.remove("INCAR.orig")
        os.remove("KPOINTS.orig")
        os.remove("POTCAR.orig")
        poscars = glob.glob("[0-9][0-9]/POSCAR.orig")
        for p in poscars:
            os.remove(p)
开发者ID:xhqu1981,项目名称:custodian,代码行数:25,代码来源:test_jobs.py


示例13: test_check

    def test_check(self):

        shutil.copy("INCAR", "INCAR.orig")

        h = DriftErrorHandler(max_drift=0.05, to_average=11)
        self.assertFalse(h.check())

        h = DriftErrorHandler(max_drift=0.05)
        self.assertFalse(h.check())

        h = DriftErrorHandler(max_drift=0.0001)
        self.assertFalse(h.check())

        incar = Incar.from_file("INCAR")
        incar["EDIFFG"] = -0.01
        incar.write_file("INCAR")

        h = DriftErrorHandler(max_drift=0.0001)
        self.assertTrue(h.check())

        h = DriftErrorHandler()
        h.check()
        self.assertEqual(h.max_drift,0.01)

        clean_dir()
        shutil.move("INCAR.orig", "INCAR")
开发者ID:shyamd,项目名称:custodian,代码行数:26,代码来源:test_handlers.py


示例14: test_aliasing_incar

    def test_aliasing_incar(self):
        os.chdir(os.path.join(test_dir, "aliasing"))
        shutil.copy("INCAR", "INCAR.orig")
        h = AliasingErrorHandler("vasp.aliasing_incar")
        h.check()
        d = h.correct()

        self.assertEqual(d["errors"], ['aliasing_incar'])
        self.assertEqual(d["actions"],
                         [{'action': {'_unset': {'NGY':1, 'NGZ': 1}},
                           'dict': 'INCAR'}, {"file": "CHGCAR",
                            "action": {"_file_delete": {'mode': "actual"}}},
                          {"file": "WAVECAR",
                            "action": {"_file_delete": {'mode': "actual"}}}])

        incar = Incar.from_file('INCAR.orig')
        incar["ICHARG"] = 10
        incar.write_file("INCAR")
        d = h.correct()
        self.assertEqual(d["errors"], ['aliasing_incar'])
        self.assertEqual(d["actions"],
                         [{'action': {'_unset': {'NGY': 1, 'NGZ': 1}},
                           'dict': 'INCAR'}])

        shutil.move("INCAR.orig", "INCAR")
        clean_dir()
        os.chdir(test_dir)
开发者ID:shyamd,项目名称:custodian,代码行数:27,代码来源:test_handlers.py


示例15: test_nicht_konv

 def test_nicht_konv(self):
     h = VaspErrorHandler("vasp.nicht_konvergent")
     h.natoms_large_cell = 5
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["nicht_konv"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["LREAL"], True)
开发者ID:shyamd,项目名称:custodian,代码行数:7,代码来源:test_handlers.py


示例16: postprocess

    def postprocess(self):
        """
        Postprocessing includes renaming and gzipping where necessary.
        Also copies the magmom to the incar if necessary
        """
        for f in VASP_OUTPUT_FILES + [self.output_file]:
            if os.path.exists(f):
                if self.final and self.suffix != "":
                    shutil.move(f, "{}{}".format(f, self.suffix))
                elif self.suffix != "":
                    shutil.copy(f, "{}{}".format(f, self.suffix))

        if self.copy_magmom and not self.final:
            try:
                outcar = Outcar("OUTCAR")
                magmom = [m['tot'] for m in outcar.magnetization]
                incar = Incar.from_file("INCAR")
                incar['MAGMOM'] = magmom
                incar.write_file("INCAR")
            except:
                logger.error('MAGMOM copy from OUTCAR to INCAR failed')

        # Remove continuation so if a subsequent job is run in
        # the same directory, will not restart this job.
        if os.path.exists("continue.json"):
            os.remove("continue.json")
开发者ID:materialsproject,项目名称:custodian,代码行数:26,代码来源:jobs.py


示例17: setup

    def setup(self):
        """
        Method is identical to custodian.vasp.jobs.setup(), except that the
        environment variable PBS_NUM_PPN is checked first when auto_npar =
        True.
        """
        files = os.listdir(".")
        num_structures = 0
        if not set(files).issuperset(VASP_INPUT_FILES):
            for f in files:
                try:
                    struct = read_structure(f)
                    num_structures += 1
                except:
                    pass
            if num_structures != 1:
                raise RuntimeError("{} structures found. Unable to continue."
                                   .format(num_structures))
            else:
                self.default_vis.write_input(struct, ".")

        if self.backup:
            for f in VASP_INPUT_FILES:
                shutil.copy(f, "{}.orig".format(f))

        if self.auto_npar:
            try:
                incar = Incar.from_file("INCAR")
                # Only optimized NPAR for non-HF and non-RPA calculations.
                if not (incar.get("LHFCALC") or incar.get("LRPA") or
                        incar.get("LEPSILON")):
                    if incar.get("IBRION") in [5, 6, 7, 8]:
                        # NPAR should not be set for Hessian matrix
                        # calculations, whether in DFPT or otherwise.
                        del incar["NPAR"]
                    else:
                        import multiprocessing
                        # try pbs environment variable first
                        # try sge environment variable second
                        # Note!
                        # multiprocessing.cpu_count() will include hyperthreads
                        # in the CPU count, which will set NPAR to be too large
                        # and can cause the job to hang if you use compute
                        # nodes with scratch partitions.
                        ncores = (os.environ.get("PBS_NUM_PPN") or
                                  os.environ.get('NSLOTS') or
                                  multiprocessing.cpu_count())
                        ncores = int(ncores)
                        for npar in range(int(math.sqrt(ncores)),
                                          ncores):
                            if ncores % npar == 0:
                                incar["NPAR"] = npar
                                break
                    incar.write_file("INCAR")
            except:
                pass

        if self.settings_override is not None:
            VaspModder().apply_actions(self.settings_override)
开发者ID:jkglasbrenner,项目名称:sshcustodian,代码行数:59,代码来源:sshjobs.py


示例18: setup

    def setup(self):
        """
        Performs initial setup for VaspNEBJob, including overriding any settings
        and backing up.
        """
        neb_dirs = self.neb_dirs

        if self.backup:
            # Back up KPOINTS, INCAR, POTCAR
            for f in VASP_NEB_INPUT_FILES:
                shutil.copy(f, "{}.orig".format(f))
            # Back up POSCARs
            for path in neb_dirs:
                poscar = os.path.join(path, "POSCAR")
                shutil.copy(poscar, "{}.orig".format(poscar))

        if self.half_kpts and os.path.exists("KPOINTS"):
            kpts = Kpoints.from_file("KPOINTS")
            kpts.kpts = np.maximum(np.array(kpts.kpts) / 2, 1)
            kpts.kpts = kpts.kpts.astype(int).tolist()
            if tuple(kpts.kpts[0]) == (1, 1, 1):
                kpt_dic = kpts.as_dict()
                kpt_dic["generation_style"] = 'Gamma'
                kpts = Kpoints.from_dict(kpt_dic)
            kpts.write_file("KPOINTS")

        if self.auto_npar:
            try:
                incar = Incar.from_file("INCAR")
                import multiprocessing
                # Try sge environment variable first
                # (since multiprocessing counts cores on the current
                # machine only)
                ncores = os.environ.get('NSLOTS') or multiprocessing.cpu_count()
                ncores = int(ncores)
                for npar in range(int(math.sqrt(ncores)),
                                  ncores):
                    if ncores % npar == 0:
                        incar["NPAR"] = npar
                        break
                incar.write_file("INCAR")
            except:
                pass

        if self.auto_continue and \
                os.path.exists("STOPCAR") and \
                not os.access("STOPCAR", os.W_OK):
            # Remove STOPCAR
            os.chmod("STOPCAR", 0o644)
            os.remove("STOPCAR")

            # Copy CONTCAR to POSCAR
            for path in self.neb_sub:
                contcar = os.path.join(path, "CONTCAR")
                poscar = os.path.join(path, "POSCAR")
                shutil.copy(contcar, poscar)

        if self.settings_override is not None:
            VaspModder().apply_actions(self.settings_override)
开发者ID:materialsproject,项目名称:custodian,代码行数:59,代码来源:jobs.py


示例19: setUpClass

    def setUpClass(cls):
        cls.struct_si = PymatgenTest.get_structure("Si")

        cls.ref_incar = Incar.from_file(
            os.path.join(module_dir, "..", "..", "test_files", "setup_test", "INCAR"))
        cls.ref_poscar = Poscar.from_file(
            os.path.join(module_dir, "..", "..", "test_files", "setup_test",
                         "POSCAR"))
        cls.ref_potcar = Potcar.from_file(
            os.path.join(module_dir, "..", "..", "test_files", "setup_test",
                         "POTCAR"))
        cls.ref_kpoints = Kpoints.from_file(
            os.path.join(module_dir, "..", "..", "test_files", "setup_test",
                         "KPOINTS"))
        cls.ref_incar_preserve = Incar.from_file(os.path.join(module_dir,
                                                              "..", "..", "test_files",
                                                              "preserve_incar", "INCAR"))
开发者ID:montoyjh,项目名称:MatMethods,代码行数:17,代码来源:test_write_vasp.py


示例20: test_postprocess

    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])
开发者ID:ProjectFrank,项目名称:custodian,代码行数:17,代码来源:test_jobs.py



注:本文中的pymatgen.io.vasp.Incar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vasp.Kpoints类代码示例发布时间:2022-05-25
下一篇:
Python smartio.read_structure函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap