示例#1
0
    def converged(self):
        """Check if configuration is relaxed.

           This is called when self.rundir[-1] is complete and not a constant volume job.

           Convergence criteria is: at least 2 relaxation jobs are complete, and:
                                    1) the last job completed with <= 3 ionic steps
                                    or 2) the last two jobs had final E0 differ by less than
                                          self.settings["nrg_convergence"]
        """
        if len(self.rundir) >= 2:
            if io.ionic_steps(self.rundir[-1]) <= 3:
                return True
            if self.settings["nrg_convergence"] != None:
                if io.job_complete(self.rundir[-1]) and io.job_complete(
                        self.rundir[-2]):
                    osz_1 = io.Oszicar(os.path.join(self.rundir[-1],
                                                    "OSZICAR"))
                    osz_2 = io.Oszicar(os.path.join(self.rundir[-2],
                                                    "OSZICAR"))
                    if abs(osz_1.E[-1] -
                           osz_2.E[-1]) < self.settings["nrg_convergence"]:
                        return True

        return False
示例#2
0
    def status(self):
        """ Determine the status of a vasp convergence series of runs. Individual runs in the series
            are in directories labeled "run.0", "run.1", etc.

            Returns a tuple: (status = "incomplete" or "complete" or "not_converging",
                                task = continuedir or "relax" or "constant" or None)

            The first value is the status of the entire convergence.

            The second value is the current task, where 'continuedir' is the path to a
            vasp job directory that is not yet completed, "relax" indicates another
            volume convergence job is required, and "constant" that a constant volume run is required.
        """

        # check if all complete
        if io.job_complete(self.finaldir):
            return ("complete", None)

        # check status of convergence runs
        self.update_rundir()

        # if not yet started
        if len(self.rundir) == 0:
            return ("incomplete", "setup")

        # if the latest run is complete:
        if io.job_complete(self.rundir[-1]):

            # if it is a final constant volume run
            if io.get_incar_tag("SYSTEM", self.rundir[-1]) != None:
                if io.get_incar_tag("SYSTEM",
                                    self.rundir[-1]).split()[-1].strip().lower(
                                    ) == "final":
                    # if io.get_incar_tag("ISIF", self.rundir[-1]) == 2 and \
                    #    io.get_incar_tag("NSW", self.rundir[-1]) == 0 and \
                    #    io.get_incar_tag("ISMEAR", self.rundir[-1]) == -5:
                    return ("complete", None)

            # elif constant volume run (but not the final one)
            if io.get_incar_tag("ISIF", self.rundir[-1]) in [0, 1, 2]:
                if io.get_incar_tag("NSW", self.rundir[-1]) == len(
                        io.Oszicar(os.path.join(self.rundir[-1],
                                                "OSZICAR")).E):
                    return ("incomplete", "relax"
                            )  # static run hit NSW limit and so isn't "done"
                else:
                    return ("incomplete", "constant")

            # elif convergence criteria met
            if self.converged():
                return ("incomplete", "constant")

            # elif not converging, return 'not_converging' error
            if self.not_converging():
                return ("not_converging", None)

            # else continue relaxing
            else:
                return ("incomplete", "relax")

        # elif not converging, return 'not_converging' error
        elif self.not_converging():
            return ("not_converging", None)

        # else if the latest run is not complete, continue running it
        return ("incomplete", self.rundir[-1])
示例#3
0
    def status(self):
        """ Determine the status of a vasp relaxation series of runs. Individual runs in the series
            are in directories labeled "run.0", "run.1", etc.

            Returns a tuple: (status = "incomplete" or "complete" or "not_converging",
                                task = "setup" or "new_run" or None)

            The first value is the status of the entire relaxation.

            The second value is the current task, where 
            "setup" means to start running calculations in run.0 in the current folder
            "new_run" indicates another calculation job is required as present run is incomplete and need to start a next run.
        """

        # check if all complete
        if io.job_complete(os.path.join(self.finaldir, "01")):
            return ("complete", None)

        # check status of relaxation runs
        self.update_rundir()

        # if not yet started
        if len(self.rundir) == 0:
            return ("incomplete", "setup")

        # check if all complete
        if io.job_complete(os.path.join(self.rundir[-1], "01")):
            # if it is a final constant volume run
            if io.get_incar_tag("SYSTEM", self.rundir[-1]) != None:
                if io.get_incar_tag("SYSTEM",
                                    self.rundir[-1]).split()[-1].strip().lower(
                                    ) == "final":
                    return ("complete", None)

            # elif constant volume run (but not the final one)
            if io.get_incar_tag("ISIF", self.rundir[-1]) in [0, 1, 2]:
                if io.get_incar_tag("NSW", self.rundir[-1]) == len(
                        io.Oszicar(
                            os.path.join(self.rundir[-1], "01", "OSZICAR")).E):
                    print "first "
                    return ("incomplete", "new_run"
                            )  # static run hit NSW limit and so isn't "done"
                else:
                    return ("incomplete", "constant")

            # elif convergence criteria met
            if self.converged():
                return ("incomplete", "constant")

            # elif not converging, return 'not_converging' error
            if self.not_converging():
                return ("not_converging", None)

            # else continue relaxing
            else:
                return ("incomplete", "new_run")

        # elif not converging, return 'not_converging' error
        elif self.not_converging():
            return ("not_converging", None)

        # else if the latest run is not complete, continue with a new run
        return ("incomplete", 'new_run')