def dgradV_dT(self, X, T):
        """
        Find the derivative of the gradient with respect to temperature.

        This is useful when trying to follow the minima of the potential as they
        move with temperature.
        """
        T_eps = self.T_eps
        try:
            gradVT = self._gradVT
        except:
            # Create the gradient function
            self._gradVT = helper_functions.gradientFunction(
                self.V1T_from_X, self.x_eps, self.Ndim, self.deriv_order)
            gradVT = self._gradVT
        # Need to add extra axes to T since extra axes get added to X in
        # the helper function.
        T = np.asanyarray(T)[..., np.newaxis, np.newaxis]
        assert (self.deriv_order == 2 or self.deriv_order == 4)
        if self.deriv_order == 2:
            y = gradVT(X, T + T_eps, False) - gradVT(X, T - T_eps, False)
            y *= 1. / (2 * T_eps)
        else:
            y = gradVT(X, T - 2 * T_eps, False)
            y -= 8 * gradVT(X, T - T_eps, False)
            y += 8 * gradVT(X, T + T_eps, False)
            y -= gradVT(X, T + 2 * T_eps, False)
            y *= 1. / (12 * T_eps)
        return y
Example #2
0
 def gradVCW(self, X, T):
     '''
     Calculate the gradient of VCW for counterterm calculation.
     '''
     try:
         f = self._gradVCW
     except:
         self._gradVCW = helper_functions.gradientFunction(
                 self.V1, self.x_eps, self.Ndim, self.deriv_order)
         f = self._gradVCW
     T = np.asanyarray(T)[...,np.newaxis,np.newaxis]
     return f(X, T)
    def gradV0(self, X):
        """
        Find the gradient of the full effective potential.

        This uses :func:`helper_functions.gradientFunction` to calculate the
        gradient using finite differences, with differences
        given by `self.x_eps`. Note that `self.x_eps` is only used directly
        the first time this function is called, so subsequently changing it
        will not have an effect.
        """
        try:
            f = self._gradV0
        except:
            # Create the gradient function
            self._gradV0 = helper_functions.gradientFunction(
                self.V0, self.x_eps, self.Ndim, self.deriv_order)
            f = self._gradV0
        return f(X)
    def gradV(self, X, T):
        """
        Find the gradient of the full effective potential.

        This uses :func:`helper_functions.gradientFunction` to calculate the
        gradient using finite differences, with differences
        given by `self.x_eps`. Note that `self.x_eps` is only used directly
        the first time this function is called, so subsequently changing it
        will not have an effect.
        """
        try:
            f = self._gradV
        except:
            # Create the gradient function
            self._gradV = helper_functions.gradientFunction(
                self.Vtot, self.x_eps, self.Ndim, self.deriv_order)
            f = self._gradV
        # Need to add extra axes to T since extra axes get added to X in
        # the helper function.
        T = np.asanyarray(T)[..., np.newaxis, np.newaxis]
        return f(X, T, False)
Example #5
0
def Dhss(X, T, m):
    return helper_functions.gradientFunction(Dhs, m.x_eps, m.Ndim,
                                             m.deriv_order)(X, T, m)[..., 1]