@@ -35,6 +35,9 @@ def createParallelCalculator(pqobj, ncpu, pmap):
3535 ncpu -- number of parallel jobs
3636 pmap -- a parallel map function used to submit job to workers
3737
38+ The ``pqobj.evaluatortype`` is reset to 'BASIC' because other
39+ evaluator types are not supported within parallel calculations.
40+
3841 Return a proxy calculator instance that has the same interface,
3942 but executes the calculation in parallel split among ncpu jobs.
4043 '''
@@ -63,6 +66,8 @@ def __init__(self, pqobj, ncpu, pmap):
6366 object .__setattr__ (self , 'pqobj' , pqobj )
6467 object .__setattr__ (self , 'ncpu' , ncpu )
6568 object .__setattr__ (self , 'pmap' , pmap )
69+ # parallel calculations support only the BASIC evaluation
70+ self .pqobj .evaluatortype = 'BASIC'
6671 return
6772
6873
@@ -116,6 +121,23 @@ def parallel_eval(stru):
116121 restore_eval ()
117122 return rv
118123
124+
125+ @property
126+ def evaluatortype (self ):
127+ """str : Type of evaluation procedure.
128+
129+ Parallel calculations allow only the 'BASIC' type.
130+ """
131+ return self .pqobj .evaluatortype
132+
133+ @evaluatortype .setter
134+ def evaluatortype (self , value ):
135+ if value != "BASIC" :
136+ emsg = "Parallel calculations require 'BASIC' evaluatortype."
137+ raise ValueError (emsg )
138+ self .pqobj .evaluatortype = value
139+ return
140+
119141 # class ParallelPairQuantity
120142
121143 # Create proxy method and properties to the wrapped PairQuantity
@@ -167,8 +189,6 @@ def _parallelData(kwd):
167189 '''Helper for calculating and fetching raw results from a worker node.
168190 '''
169191 pqobj = kwd ['pqobj' ]
170- if pqobj .evaluatortype == 'OPTIMIZED' :
171- pqobj = copy .copy (pqobj )
172192 pqobj ._setupParallelRun (kwd ['cpuindex' ], kwd ['ncpu' ])
173193 pqobj .eval ()
174194 return pqobj ._getParallelData ()
0 commit comments