def __checkInputArguments(self, bra, ket, J):
     if not isinstance(J, int):
         raise MatrixElementException("J is not <int>")
     if not isinstance(bra, QN_2body_LS_Coupling):
         raise MatrixElementException("<bra| is not <QN_2body_LS_Coupling>")
     if not isinstance(ket, QN_2body_LS_Coupling):
         raise MatrixElementException("|ket> is not <QN_2body_LS_Coupling>")
    def setInteractionParameters(cls, *args, **kwargs):
        """ 
        Arguments for a radial potential form V(r; mu_length, constant, n, ...)
        
        :b_length 
        :hbar_omega
        :potential       <str> in PotentialForms Enumeration
        :mu_length       <float>  fm
        :constant        <float>  MeV
        :n_power         <int>
        """
        # Refresh the Force parameters
        if cls.PARAMS_FORCE:
            cls.PARAMS_FORCE = {}

        params_and_defaults = {
            SHO_Parameters.b_length: 1,
            SHO_Parameters.hbar_omega: 1,
            CentralMEParameters.potential: None,
            CentralMEParameters.mu_length: None,
            CentralMEParameters.constant: 1,
            CentralMEParameters.n_power: 0
        }

        for param, default in params_and_defaults.items():

            value = kwargs.get(param)
            if value is None:
                if default is None:
                    raise MatrixElementException(
                        "Required parameter [{}]: got None".format(param))
                value = default

            if (param == CentralMEParameters.potential):
                value = value.lower()
                if (value not in PotentialForms.members()):
                    raise MatrixElementException(
                        "Potential name is not defined "
                        "in PotentialForms Enumeration, got: [{}]".format(
                            value))

            if param in SHO_Parameters.members():
                # if param == SHO_Parameters.b_length:
                #     # In the center of mass system, b_length = b_length / sqrt_(2)
                #     value *= np.sqrt(2)
                #     ## NO b_rel = sqrt_(2)*b !!, transformation taken into account
                #     ## for the Talmi integrals and the B_nlp coefficients
                cls.PARAMS_SHO[param] = value
            else:
                cls.PARAMS_FORCE[param] = value

        cls._integrals_p_max = -1
        cls._talmiIntegrals = []
 def _validKet_relativeAngularMomentums(self):
     """ 
     get valid l' qqnns (as tuple) in the c.o.m for the bra wave function
     """
     raise MatrixElementException(
         "Abstract Method, implement according to force.")
     return
 def _interactionSeries(self):
     """
     Final Method.!!
     C_[X](n1,n2, l1,l2, (n1,n2, l1,l2)' L, L', ..., p)
     carry valid values, call delta and common constants
     """
     raise MatrixElementException("Series to be implemented here from "
                                  "secureIter or minimalIter classes")
     return
 def deltaConditionsForGlobalQN(self):
     """
     Define if non null requirements on LS coupled J Matrix Element, 
     before doing the center of mass decomposition.
     
     return True when conditions are fulfilled.
     
     Acts on (n1,l1)(n2,l2) (L_t,S) (n1,l1)'(n2,l2)'(L_t', S') (JT) qu. Numbers
     """
     raise MatrixElementException("Abstract Method, require implementation")
 def centerOfMassMatrixElementEvaluation(self):
     """
     Matrix Element to be called for a defined interaction.
         <(n1,l1)(n2,l2) (LS)| V |(n1,l1)'(n2,l2)'(L'S') (T)>
     Use:
         1. Define deltas or factors over global conditions
         2. Define variables for the Moshinski transformation.
         3. Instance the Talmi Integrals in the limits/interaction
     """
     raise MatrixElementException("Abstract Method, require implementation")
 def _deltaConditionsForCOM_Iteration(self):
     """
     Define if non null requirements on LS coupled J(and T) Matrix Element, 
     while doing the center of mass decomposition (n,l,n',l', N, L indexes 
     involved). 
     
     TODO: Check parity depending on the total wave function (J,T dependence)
     
     return True when conditions are fulfilled.
     """
     raise MatrixElementException("Abstract Method, Implement me!")
    def _run(self):

        if len(self.__class__.__bases__) > 1:
            raise MatrixElementException(
                "You are making use of Talmi transformation from another matrix"
                " element definition (multiple inheritance): {}, \n"
                "<TalmiTransformation>._run() is only valid to calculate m.e. "
                "directly <(n1l1)(n2l2)(L) |V[overwritable] |(n1l1)'(n2l2)'(L')>."
                "Otherwise, this class is helper for the main matrix element.\n"
                "Then, change the order of the parent classes for <TalmiTransformation>"
                " to be a helper ".format(self.__class__.__bases__))

        if not self.isNullMatrixElement:

            self._value = self.centerOfMassMatrixElementEvaluation()
 def _potentialShapes(r, potential, mu, n_pow=0):
     """
     functions V(r) for the central potentials
     """
     x = r / mu
     if potential == PotentialForms.Gaussian:
         return np.exp(-np.power(x, 2))
     elif potential == PotentialForms.Gaussian_power:
         return np.exp(-np.power(x, 2)) / np.power(x, n_pow)
     elif potential == PotentialForms.Power:
         return np.power(x, n_pow)
     elif potential == PotentialForms.Coulomb:
         return 1 / x
     elif potential == PotentialForms.Exponential:
         return np.exp(-x)
     elif potential == PotentialForms.Yukawa:
         return np.exp(-x) / (x)
     else:
         raise MatrixElementException(
             "Not implemented Potential option ::" + potential)
 def _globalInteractionCoefficient(self):
     """ 
     Coefficient non dependent on the COM qqnn series ex:(L,L', S,S', JT ...)
     """
     raise MatrixElementException("Abstract Method, Implement me!")
     return
 def _interactionConstantsForCOM_Iteration(self):
     """ 
     Coefficients n,l, N, L dependent for the intern sum and the interaction.
     """
     raise MatrixElementException("Abstract Method, Implement me!")
     return