def eval_at_equil(self, conc):
        evaluated = TwoPhaseLandauPolynomialBase.eval_at_equil(self, conc)

        # The above function that order parameter changes when it can
        # however, it can be that it is still energetically favorable
        # to not change. Thus, evaluate when forcing it to stay
        # zero
        eval_zero = TwoPhaseLandauPolynomialBase.evaluate(self,
                                                          conc,
                                                          shape=0.0)

        if eval_zero < evaluated:
            return eval_zero
        return evaluated
    def eval_at_equil(self, conc):
        """Evaluate the free energy at equillibrium order.

        :param float conc: Concentration
        """

        return TwoPhaseLandauPolynomialBase.eval_at_equil(self, conc) - \
            self.discontinuity_jump*heaviside(conc - self.discontinuity_conc)
 def __init__(self,
              c1=0.0,
              c2=1.0,
              num_dir=3,
              init_guess=None,
              conc_order1=2,
              conc_order2=2):
     TwoPhaseLandauPolynomialBase.__init__(self,
                                           c1=c1,
                                           c2=c2,
                                           num_dir=num_dir,
                                           init_guess=init_guess,
                                           conc_order1=conc_order1,
                                           conc_order2=conc_order2)
     self._kernel = None
     self._phase_one_regressor = None
     self.discontinuity_conc = 0.0
     self.discontinuity_jump = 0.0
    def evaluate(self, conc, shape=None):
        """
        Evaluate the free energy polynomial

        :param float conc: Concentration
        :param shape list: List with the shape order parameters.
            If None, the shape order parameters are set to their
            equillibrium
        """
        if shape is None:
            return self.eval_at_equil(conc)
        return TwoPhaseLandauPolynomialBase.evaluate(self, conc, shape=shape) - \
              self.discontinuity_jump*heaviside(conc - self.discontinuity_conc)
    def to_dict(self):
        data = TwoPhaseLandauPolynomialBase.to_dict(self)

        data["discontinuity_jump"] = self.discontinuity_jump
        data["discontinuity_conc"] = self.discontinuity_conc

        # Store the kernel regressor
        try:
            data["kernel_regressor"] = self.phase_one_regressor.to_dict()
            data["kernel"] = self.kernel.to_dict()
        except RuntimeError:
            pass
        return data
 def to_dict(self):
     data = TwoPhaseLandauPolynomialBase.to_dict(self)
     data["conc_phase1"] = self.coeff_phase1.tolist()
     return data
 def __init__(self, c1=0.0, c2=1.0, num_dir=3):
     TwoPhaseLandauPolynomialBase.__init__(self,
                                           c1=c1,
                                           c2=c2,
                                           num_dir=num_dir)
     self.coeff_phase1 = np.zeros(3)