Skip to content

Commit ebda515

Browse files
committed
not use joblib when n_job=1
1 parent 320fca1 commit ebda515

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

package/MDAnalysis/analysis/encore/confdistmatrix.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,25 @@ def conformational_distance_matrix(ensemble,
171171
# Initialize workers. Simple worker doesn't perform fitting,
172172
# fitter worker does.
173173
indices = trm_indices((0, 0), (framesn - 1, framesn - 1))
174-
Parallel(n_jobs=n_jobs, verbose=verbose, require='sharedmem',
175-
max_nbytes=max_nbytes)(delayed(conf_dist_function)(
176-
np.int64(element),
177-
rmsd_coordinates,
178-
distmat,
179-
weights,
180-
fitting_coordinates,
181-
subset_weights) for element in indices)
174+
if n_jobs == 1:
175+
for element in indices:
176+
conf_dist_function(np.int64(element),
177+
rmsd_coordinates,
178+
distmat,
179+
weights,
180+
fitting_coordinates,
181+
subset_weights)
182+
else:
183+
Parallel(n_jobs=n_jobs,
184+
verbose=verbose,
185+
require='sharedmem',
186+
max_nbytes=max_nbytes)(delayed(conf_dist_function)(
187+
np.int64(element),
188+
rmsd_coordinates,
189+
distmat,
190+
weights,
191+
fitting_coordinates,
192+
subset_weights) for element in indices)
182193

183194

184195
# When the workers have finished, return a TriangularMatrix object

0 commit comments

Comments
 (0)