Skip to content

Commit

Permalink
add threadpoolctl to clustenm app
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Oct 20, 2023
1 parent 5acb01a commit 6b644aa
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions prody/apps/prody_apps/prody_clustenm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,41 @@ def prody_clustenm(pdb, **kwargs):
except TypeError:
raise TypeError("Please provide cutoff as a float or equation using math")

ens = prody.ClustENM(pdb.getTitle())
ens.setAtoms(select)
ens.run(n_gens=ngens, n_modes=nmodes,
n_confs=nconfs, rmsd=eval(rmsd),
cutoff=cutoff, gamma=gamma,
maxclust=eval(maxclust), threshold=eval(threshold),
solvent=solvent, force_field=eval(forcefield),
sim=sim, temp=temp, t_steps_i=t_steps_i,
t_steps_g=eval(t_steps_g),
outlier=outlier, mzscore=mzscore,
sparse=sparse, kdtree=kdtree, turbo=turbo,
parallel=parallel, fitmap=fitmap,
fit_resolution=fit_resolution, **kwargs)
nproc = kwargs.get('nproc')
if nproc:
try:
from threadpoolctl import threadpool_limits
except ImportError:
raise ImportError('Please install threadpoolctl to control threads')

with threadpool_limits(limits=nproc, user_api="blas"):
ens = prody.ClustENM(pdb.getTitle())
ens.setAtoms(select)
ens.run(n_gens=ngens, n_modes=nmodes,
n_confs=nconfs, rmsd=eval(rmsd),
cutoff=cutoff, gamma=gamma,
maxclust=eval(maxclust), threshold=eval(threshold),
solvent=solvent, force_field=eval(forcefield),
sim=sim, temp=temp, t_steps_i=t_steps_i,
t_steps_g=eval(t_steps_g),
outlier=outlier, mzscore=mzscore,
sparse=sparse, kdtree=kdtree, turbo=turbo,
parallel=parallel, fitmap=fitmap,
fit_resolution=fit_resolution, **kwargs)
else:
ens = prody.ClustENM(pdb.getTitle())
ens.setAtoms(select)
ens.run(n_gens=ngens, n_modes=nmodes,
n_confs=nconfs, rmsd=eval(rmsd),
cutoff=cutoff, gamma=gamma,
maxclust=eval(maxclust), threshold=eval(threshold),
solvent=solvent, force_field=eval(forcefield),
sim=sim, temp=temp, t_steps_i=t_steps_i,
t_steps_g=eval(t_steps_g),
outlier=outlier, mzscore=mzscore,
sparse=sparse, kdtree=kdtree, turbo=turbo,
parallel=parallel, fitmap=fitmap,
fit_resolution=fit_resolution, **kwargs)

single = not kwargs.pop('multiple')
outname = join(outdir, prefix)
Expand Down

0 comments on commit 6b644aa

Please sign in to comment.