def _backend(self): """ Query function for the c++ backend object. """ if self.__backend is None: # Construct the c++ backend object. if self.__use_buckets: cpp_types = bucketListToStdVectorStdVectorString(self.__types) else: cpp_types = stringListToStdVectorStdVectorString(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
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 = bucketListToStdVectorStdVectorString(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