Ejemplo n.º 1
0
    def get_pw_common_inputs(self):
        """Return the dictionary of inputs to be used as the basis for each `PwBaseWorkChain`."""
        protocol, protocol_modifiers = self._get_protocol()
        checked_pseudos = protocol.check_pseudos(
            modifier_name=protocol_modifiers.get('pseudo', None),
            pseudo_data=protocol_modifiers.get('pseudo_data', None))
        known_pseudos = checked_pseudos['found']

        inputs = AttributeDict({
            'pw': {
                'code':
                self.inputs.code.pw,
                'pseudos':
                get_pseudos_from_dict(self.ctx.current_structure,
                                      known_pseudos),
                'parameters':
                self.ctx.scf_parameters,
                'metadata': {},
            }
        })

        if 'options' in self.inputs:
            inputs.pw.metadata.options = self.inputs.options.get_dict()
        else:
            inputs.pw.metadata.options = self.get_default_options(
                with_mpi=True)

        return inputs
        def get_common_inputs():
            """Return the dictionary of inputs to be used as the basis for each `PwBaseWorkChain`."""
            protocol, protocol_modifiers = self._get_protocol()
            checked_pseudos = protocol.check_pseudos(
                modifier_name=protocol_modifiers.get('pseudo', None),
                pseudo_data=protocol_modifiers.get('pseudo_data', None))
            known_pseudos = checked_pseudos['found']

            inputs = AttributeDict({
                'pw': {
                    'code': self.inputs.code,
                    'parameters': self.ctx.parameters,
                    'metadata': {},
                }
            })

            if 'pseudo_family' in self.inputs:
                inputs.pw['pseudos'] = get_pseudos_from_structure(
                    self.inputs.structure, self.inputs.pseudo_family.value)
            else:
                inputs.pw['pseudos'] = get_pseudos_from_dict(
                    self.inputs.structure, known_pseudos)

            if 'set_2d_mesh' in self.inputs:
                inputs['set_2d_mesh'] = self.inputs.set_2d_mesh

            if 'options' in self.inputs:
                inputs.pw.metadata.options = self.inputs.options.get_dict()
            else:
                inputs.pw.metadata.options = get_default_options(with_mpi=True)

            return inputs