pyvibdmc.simulation_utilities.potential_manager =============================================== .. py:module:: pyvibdmc.simulation_utilities.potential_manager Classes ------- .. autoapisummary:: pyvibdmc.simulation_utilities.potential_manager.Potential pyvibdmc.simulation_utilities.potential_manager.Potential_NoMP pyvibdmc.simulation_utilities.potential_manager.NN_Potential pyvibdmc.simulation_utilities.potential_manager.Potential_Direct Module Contents --------------- .. py:class:: Potential(potential_function, potential_directory, python_file, num_cores=1, pass_timestep=False, pot_kwargs=None) A potential handler that is able to call python functions that call .so files, either generated by f2py or loaded in by ctypes. :param potential_function: The name of a python function (user specified) that will take in a n x m x 3 stack of geometries and return a 1D numpy array filled with potential values in hartrees. :type potential_function: str :param potential_dir: The *absolute path* to the directory that contains the .so file and .py file. If it"s a python function, then just the absolute path to your .py file. :type: str :param num_cores: Will create a pool of processes using Python"s multiprocessing module. This should never be larger than the number of processors on the machine this code is run. :type: int .. py:attribute:: potential_function .. py:attribute:: python_file .. py:attribute:: potential_directory .. py:attribute:: num_cores :value: 1 .. py:attribute:: pass_timestep :value: False .. py:attribute:: pot_kwargs :value: None .. py:property:: pool Returns the potential manager's pool so that it can be used internally with Imp Samp or with the user elsewhere .. py:method:: getpot(cds, timeit=False) Uses the potential function we got to call potential :param cds: A stack of geometries (nxmx3, n=num_geoms;m=num_atoms;3=x,y,z) whose energies we need :type cds: np.ndarray :param timeit: The logger telling the potential manager whether or not to time the potential call :type timeit: bool .. py:method:: mp_close() .. py:class:: Potential_NoMP(potential_function, potential_directory, python_file, pass_timestep=False, ch_dir=False, pot_kwargs=None) Version of Potential where no multiprocessing is included. As such, it does not leave a worker in the potential directory of interest. If you need to cd into the directory to call a potential (for example, the potential loads in a file using a relative path or something), then use ch_dir=True. Not the default since it is computationally inefficient to cd during each potential call when not necessary. .. py:attribute:: potential_function .. py:attribute:: python_file .. py:attribute:: pass_timestep :value: False .. py:attribute:: potential_directory .. py:attribute:: pot_kwargs :value: None .. py:attribute:: ch_dir :value: False .. py:method:: getpot(cds, timeit=False) Uses the potential function we got to call potential :param cds: A stack of geometries (nxmx3, n=num_geoms;m=num_atoms;3=x,y,z) whose energies we need :type cds: np.ndarray :param timeit: The logger telling the potential manager whether or not to time the potential call :type timeit: bool .. py:class:: NN_Potential(potential_function, potential_directory, python_file, model, ch_dir=False, pot_kwargs=None, pass_timestep=False) Bases: :py:obj:`Potential_NoMP` Subclass of Potential_NoMP, where a model argument is provided for convenience .. py:attribute:: model .. py:attribute:: ch_dir :value: False .. py:attribute:: pot_kwargs :value: None .. py:method:: getpot(cds, timeit=False) Subclass of Potential_NoMP, but with an explicit argument passed for the NN model for convenience. .. py:class:: Potential_Direct(potential_function, pot_kwargs=None, pass_timestep=False) Version of Potential where the actual Python function is passed rather than being imported from an external file. At the request of Mark. .. py:attribute:: potential_function .. py:attribute:: pot_kwargs :value: None .. py:attribute:: pass_timestep :value: False .. py:method:: getpot(cds, timeit=False)