Exemplo n.º 1
0
    def __init__(self, dimension, ncomponents, eps):
        r"""Initialize a new in homogeneous Hagedorn wavepacket.

        :param dimension: The space dimension :math:`D` the packet has.
        :param ncomponents: The number :math:`N` of components the packet has.
        :param eps: The semi-classical scaling parameter :math:`\varepsilon` of the basis functions.
        :return: An instance of :py:class:`HagedornWavepacketInhomogeneous`.
        """
        self._dimension = dimension
        self._number_components = ncomponents

        self._eps = eps

        # The parameter sets Pi_i
        self._Pis = []
        # The basis shapes K_i
        self._basis_shapes = []
        # The coefficients c^i
        self._coefficients = []

        for d in xrange(self._number_components):
            # Default basis shapes for all components
            bs = HyperCubicShape(self._dimension * [1])
            self._basis_shapes.append(bs)

            # A Gaussian
            self._coefficients.append(
                zeros((bs.get_basis_size(), 1), dtype=complexfloating))

            # Default parameters of harmonic oscillator eigenstates
            q = zeros((self._dimension, 1))
            p = zeros((self._dimension, 1))
            Q = eye(self._dimension)
            P = 1.0j * eye(self._dimension)
            S = 0.0

            self._Pis.append([q, p, Q, P, S])

        # Cache basis sizes
        self._basis_sizes = [bs.get_basis_size() for bs in self._basis_shapes]

        # No quadrature set
        self._QE = None

        # Function for taking continuous roots
        self._sqrt = [
            ContinuousSqrt() for n in xrange(self._number_components)
        ]
    def __init__(self, dimension, ncomponents, eps):
        r"""Initialize a new in homogeneous Hagedorn wavepacket.

        :param dimension: The space dimension :math:`D` the packet has.
        :param ncomponents: The number :math:`N` of components the packet has.
        :param eps: The semi-classical scaling parameter :math:`\varepsilon` of the basis functions.
        :return: An instance of :py:class:`HagedornWavepacketInhomogeneous`.
        """
        self._dimension = dimension
        self._number_components = ncomponents

        self._eps = eps

        # The parameter sets Pi_i
        self._Pis = []
        # The basis shapes K_i
        self._basis_shapes = []
        # The coefficients c^i
        self._coefficients = []

        for d in xrange(self._number_components):
            # Default basis shapes for all components
            bs = HyperCubicShape( self._dimension*[1] )
            self._basis_shapes.append(bs)

            # A Gaussian
            self._coefficients.append(zeros((bs.get_basis_size(),1), dtype=complexfloating))

            # Default parameters of harmonic oscillator eigenstates
            q = zeros((self._dimension, 1))
            p = zeros((self._dimension, 1))
            Q = eye(self._dimension)
            P = 1.0j * eye(self._dimension)
            S = 0.0

            self._Pis.append([q, p, Q, P, S])

        # Cache basis sizes
        self._basis_sizes = [ bs.get_basis_size() for bs in self._basis_shapes ]

        # No quadrature set
        self._QE = None

        # Function for taking continuous roots
        self._sqrt = [ ContinuousSqrt() for n in xrange(self._number_components) ]
Exemplo n.º 3
0
    def create_basis_shape(self, description):
        try:
            bs_type = description["type"]
        except:
            # Default setting
            bs_type = "HyperCubicShape"

        if bs_type == "HyperCubicShape":
            from HyperCubicShape import HyperCubicShape
            limits = description["limits"]
            BS = HyperCubicShape(limits)

        elif bs_type == "HyperbolicCutShape":
            from HyperbolicCutShape import HyperbolicCutShape
            K = description["K"]
            D = description["dimension"]
            BS = HyperbolicCutShape(D, K)

        else:
            raise ValueError("Unknown basis shape type " + str(bs_type))

        return BS
Exemplo n.º 4
0
 def testContains(self):
     h = HyperCubicShape(self.n, self.limits, self.lima, self.lima_inv)
     assert h.contains((1,0)) == True
     assert h.contains((12,-2)) == False