markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
307 stars 118 forks source link

Fix periodic width initialization in umbrella sampling #1522

Closed sefalkner closed 2 years ago

sefalkner commented 2 years ago

Running pyemma.thermo.estimate_umbrella_sampling with periodicity in a dimension leads to the error:

~/anaconda3/envs/pytorch/lib/python3.9/site-packages/pyemma/thermo/util/util.py in get_umbrella_sampling_data(us_trajs, us_centers, us_force_constants, md_trajs, kT, width)
    271         width = _np.zeros(shape=(umbrella_centers.shape[1],), dtype=_np.float64)
    272     else:
--> 273         width = _np.asarray(
    274             map(lambda w: w if w is not None and w > 0.0 else 0.0, width),
    275             dtype=_np.float64)

TypeError: float() argument must be a string or a number, not 'map'

np.asarray can't construct an array from an iterator anymore, np.fromiter should fix the problem.

clonker commented 2 years ago

Hi, thank you for your fix! The test failures are unrelated, so I am going ahead and will merge.