Example #1
0
    def execute_forces(self):
        futures = {}
        process = WorkflowFactory('quantumespresso.pw.relax')

        inputs = {
            key: value
            for key, value in self.inputs.force.items() if key in
            process.get_description().get('spec').get('inputs').keys()
        }

        if not inputs.get('parameters').get_dict().get('CONTROL', {}).get(
                'tprnfor', False):
            parameters = inputs.get('parameters').get_dict()
            parameters.setdefault('CONTROL', {})
            parameters['CONTROL']['tprnfor'] = True
            inputs['parameters'] = ParameterData(dict=parameters)

        uuids = list(self.ctx.structures.keys())
        for uuid in uuids:
            if uuid in self.ctx.energy and uuid in self.ctx.forces:
                continue
            inputs_ = copy(inputs)
            inputs_['structure'] = self.ctx.structures.get(uuid)
            futures[uuid] = self.submit(process,
                                        max_iterations=Int(1),
                                        max_meta_convergence_iterations=Int(1),
                                        **inputs_)

        return ToContext(**futures)
Example #2
0
    def execute_replicate(self):
        futures = {}
        process = WorkflowFactory('zrl.utils.replicate')
        inputs = {
            key: value
            for key, value in self.inputs.structure.replicate.items() if key in
            process.get_description().get('spec').get('inputs').keys()
        }
        inputs.setdefault('verbose', self.inputs.verbose)

        for uuid, structure in chain(self.ctx.structures.items(),
                                     self.ctx.partial_structures.items()):
            if uuid not in self.ctx.energy or uuid not in self.ctx.forces:
                futures[uuid] = self.submit(process,
                                            structure=structure,
                                            **inputs)

        return ToContext(**futures)
Example #3
0
    def execute_partial(self):
        futures = {}
        process = WorkflowFactory('zrl.utils.partial_occ')

        inputs = {
            key: value
            for key, value in self.inputs.structure.partial.items() if key in
            process.get_description().get('spec').get('inputs').keys()
        }

        inputs.setdefault('verbose', self.inputs.verbose)
        uuids = list(self.ctx.partial_structures.keys())
        for uuid in uuids:
            if uuid in self.ctx.energy and uuid in self.ctx.forces:
                continue
            inputs_ = copy(inputs)
            inputs_['structure'] = self.ctx.partial_structures.get(uuid)
            inputs_.setdefault('seed', Int(self.ctx.rs.randint(2**16 - 1)))
            futures[uuid] = self.submit(process, **inputs_)

        return ToContext(**futures)