torchgpe.utils.potentials.time_dependent_variable#

torchgpe.utils.potentials.time_dependent_variable(var)[source]#

Transform a variable into a function of time

Parameters:

var (Union[float, Callable]) – The variable to transform. If it is a function, it is returned as is. If it is a constant, it is transformed into a function that returns the constant.

Examples

>>> time_dependent_variable(1)
lambda _: 1
>>> time_dependent_variable(lambda t: t)
lambda t: t