Skip to content

Commit

Permalink
bug in scoring/dope_score reduce class
Browse files Browse the repository at this point in the history
  • Loading branch information
SCMusson committed May 15, 2023
1 parent cda9ca3 commit c4e8028
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/molearn/scoring/dope_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Parallel_DOPE_Score():
results = np.array([r.get() for r in results])
'''
def __init__(self, mol, processes=-1, **kwargs):
def __init__(self, mol, processes=-1, context = 'spawn', **kwargs):
'''
:param biobox.Molecule mol: biobox molecule containing one example frame of the protein to be analysed. This will be passed to DOPE_Score class instances in each thread.
:param int processes: (default: -1) Number of processes argument to pass to multiprocessing.pool. This controls the number of threads created.
Expand All @@ -163,15 +163,15 @@ def __init__(self, mol, processes=-1, **kwargs):
self.processes = processes
self.mol = deepcopy(mol)
score = DOPE_Score
ctx = get_context('spawn')
ctx = get_context(context)
self.pool = ctx.Pool(processes=processes, initializer=set_global_score,
initargs=(score, dict(mol=mol)),
**kwargs,
)
self.process_function = process_dope

def __reduce__(self):
return (self.__class__, (self.mol, processes=self.processes))
return (self.__class__, (self.mol, self.processes))

def get_score(self, coords, **kwargs):
'''
Expand Down

0 comments on commit c4e8028

Please sign in to comment.