Exemplo n.º 1
0
    def _backend(self):
        """
        Query function for the c++ backend object.
        """
        if self.__backend is None:
            # Construct the c++ backend object.
            cpp_types = stringListToStdVectorString(self.__types)
            cpp_coords = numpy2DArrayToStdVectorStdVectorDouble(
                self.__lattice.sites())
            cpp_possible_types = Backend.StdMapStringInt(self.__possible_types)

            # Send in the coordinates and types to construct the backend configuration.
            self.__backend = Backend.Configuration(cpp_coords, cpp_types,
                                                   cpp_possible_types)

        # Return the backend.
        return self.__backend
Exemplo n.º 2
0
    def _backend(self, possible_types):
        """
        Query for the local configuration backend object.

        :param possible_types: A dict with the global mapping of type strings
                               to integers.

        :returns: The interactions object in C++
        """
        if self.__backend is None:
            # Construct the c++ backend object.
            cpp_types  = Backend.StdVectorString(self.__types)
            cpp_coords = numpy2DArrayToStdVectorStdVectorDouble(self.__coordinates)
            cpp_possible_types = Backend.StdMapStringInt(possible_types)

            # Send in the coordinates and types to construct the backend configuration.
            self.__backend = Backend.Configuration(cpp_coords,
                                                   cpp_types,
                                                   cpp_possible_types)

        # Return the backend.
        return self.__backend