pyvibdmc.simulation_utilities.potential_manager

Classes

Potential

A potential handler that is able to call python functions that

Potential_NoMP

Version of Potential where no multiprocessing is included. As such, it does not leave a worker in the potential

NN_Potential

Subclass of Potential_NoMP, where a model argument is provided for convenience

Potential_Direct

Version of Potential where the actual Python function is passed rather than

Module Contents

class pyvibdmc.simulation_utilities.potential_manager.Potential(potential_function, potential_directory, python_file, num_cores=1, pass_timestep=False, pot_kwargs=None)[source]

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 <num_cores> 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

potential_function
python_file
potential_directory
num_cores = 1
pass_timestep = False
pot_kwargs = None
property pool

Returns the potential manager’s pool so that it can be used internally with Imp Samp or with the user elsewhere

getpot(cds, timeit=False)[source]

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

mp_close()[source]
class pyvibdmc.simulation_utilities.potential_manager.Potential_NoMP(potential_function, potential_directory, python_file, pass_timestep=False, ch_dir=False, pot_kwargs=None)[source]

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.

potential_function
python_file
pass_timestep = False
potential_directory
pot_kwargs = None
ch_dir = False
getpot(cds, timeit=False)[source]

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

class pyvibdmc.simulation_utilities.potential_manager.NN_Potential(potential_function, potential_directory, python_file, model, ch_dir=False, pot_kwargs=None, pass_timestep=False)[source]

Bases: Potential_NoMP

Subclass of Potential_NoMP, where a model argument is provided for convenience

model
ch_dir = False
pot_kwargs = None
getpot(cds, timeit=False)[source]

Subclass of Potential_NoMP, but with an explicit argument passed for the NN model for convenience.

class pyvibdmc.simulation_utilities.potential_manager.Potential_Direct(potential_function, pot_kwargs=None, pass_timestep=False)[source]

Version of Potential where the actual Python function is passed rather than being imported from an external file. At the request of Mark.

potential_function
pot_kwargs = None
pass_timestep = False
getpot(cds, timeit=False)[source]