Baking (compiling) fast efficient functions during runtime
Currently, bottleneck "potential" functions are compiled at the build time as a separate
_potentials library. This may not be the optimal choice for those users who are willing to define their own potentials. Currently, they will have to modify package sources and to re-compile it. Another option is to implement compiling during runtime taking simple potential expressions as the input and producing fast library functions as the output.
Function stub example:
def build_potential(expression: str, inputs: Iterable, type: str, openmp: bool=True) -> Callable: """ Builds a potential or its gradient with the given expression. Args: expression: numerical formula of the potential in python formatting; inputs: adjustable parameters of the potential; type: the type of the potential ('potential-2-g' for example); openmp: if True, makes a parallel function compiled against OpenMP; Returns: A function implementing this potential. """ # Assemble sources, compile and import the function