Esempio n. 1
0
    def __init__(self,
                 kernel,
                 context,
                 unit_config,
                 output_file="",
                 integrator="EulerBDIntegrator",
                 reaction_handler="Gillespie",
                 evaluate_topology_reactions=True,
                 evaluate_forces=True,
                 evaluate_observables=True,
                 skin=0):
        """
        Creates a new simulation object
        :param kernel: the kernel to use
        :param context: the parent low level context object
        :param unit_config: the unit configuration
        :param output_file: the output file
        :param integrator: the integrator
        :param reaction_handler: the reaction handler
        :param evaluate_topology_reactions: whether to evaluate topology reactions
        :param evaluate_forces: whether to evaluate forces
        :param evaluate_observables: whether to evaluate observables
        :param skin: the skin size for neighbor lists
        """
        available_kernels = _KernelProvider.get().available_kernels()
        if kernel not in available_kernels:
            raise ValueError(
                "The selected kernel was \"{}\" but only {} "
                "are available.".format(
                    kernel,
                    ", ".join(['"{}"'.format(x) for x in available_kernels])))
        self._unit_conf = unit_config
        self._kernel = kernel
        self._simulation = _Simulation()
        self._simulation.set_kernel(kernel)
        self._simulation.context = context

        self.output_file = output_file
        self._observables = _Observables(self)

        self.integrator = integrator
        self.reaction_handler = reaction_handler
        self.evaluate_topology_reactions = evaluate_topology_reactions
        self.evaluate_forces = evaluate_forces
        self.evaluate_observables = evaluate_observables
        self.skin = skin
        self.simulation_scheme = "ReaDDyScheme"
        self.show_progress = True

        self._progress = None

        if kernel == "CPU":
            self._kernel_configuration = _CPUKernelConfiguration()
        else:
            self._kernel_configuration = _NOOPKernelConfiguration()
Esempio n. 2
0
    def __init__(self, kernel, context, unit_config, output_file="", integrator="EulerBDIntegrator",
                 reaction_handler="Gillespie", evaluate_topology_reactions=True, evaluate_forces=True,
                 evaluate_observables=True, skin=0):
        """
        Creates a new simulation object
        :param kernel: the kernel to use
        :param context: the parent low level context object
        :param unit_config: the unit configuration
        :param output_file: the output file
        :param integrator: the integrator
        :param reaction_handler: the reaction handler
        :param evaluate_topology_reactions: whether to evaluate topology reactions
        :param evaluate_forces: whether to evaluate forces
        :param evaluate_observables: whether to evaluate observables
        :param skin: the skin size for neighbor lists
        """
        available_kernels = _KernelProvider.get().available_kernels()
        if kernel not in available_kernels:
            raise ValueError("The selected kernel was \"{}\" but only {} "
                             "are available.".format(kernel, ", ".join(['"{}"'.format(x) for x in available_kernels])))
        self._unit_conf = unit_config
        self._kernel = kernel
        self._simulation = _Simulation()
        self._simulation.set_kernel(kernel)
        self._simulation.context = context

        self._evaluate_topology_reactions = True
        self._evaluate_forces = True
        self._evaluate_observables = True
        self._skin = 0
        self._integrator = "EulerBDIntegrator"
        self._reaction_handler = "Gillespie"
        self._simulation_scheme = "ReaDDyScheme"
        self._output_file = ""

        self.output_file = output_file
        self._observables = _Observables(self)

        self.integrator = integrator
        self.reaction_handler = reaction_handler
        self.evaluate_topology_reactions = evaluate_topology_reactions
        self.evaluate_forces = evaluate_forces
        self.evaluate_observables = evaluate_observables
        self.skin = skin
        self._show_progress = True
        self._progress_output_stride = 10

        self._progress = None

        if kernel == "CPU":
            self._kernel_configuration = _CPUKernelConfiguration()
        else:
            self._kernel_configuration = _NOOPKernelConfiguration()