示例#1
0
    def get_inputs_scf(self):
        """
        Initialize inputs for scf workflow:
        wf_param, options, calculation parameters, codes, structure
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        # change beta parameter
        for key, val in six.iteritems(self.ctx.wf_dict.get('beta')):
            scf_wf_dict['inpxml_changes'].append(('set_atomgr_att_label', {
                'attributedict': {
                    'nocoParams': [('beta', val)]
                },
                'atom_label': key
            }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        if 'calc_parameters' in input_scf:
            calc_parameters = input_scf.calc_parameters.get_dict()
        else:
            calc_parameters = {}
        input_scf.calc_parameters = calc_parameters

        return input_scf
示例#2
0
    def get_inputs_scf(self):
        """
        Initializes inputs for further iterations.
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))
        if 'structure' in input_scf:
            del input_scf.structure
            del input_scf.inpgen
            del input_scf.calc_parameters

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()
            if 'inpxml_changes' in scf_wf_dict:
                old_changes = scf_wf_dict['inpxml_changes']
                new_changes = []
                for change in old_changes:
                    if 'shift_value' not in change[0]:
                        new_changes.append(change)
                scf_wf_dict['inpxml_changes'] = new_changes

        scf_wf_dict['mode'] = 'force'
        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        scf_wc = self.ctx.scf_res
        last_calc = load_node(
            scf_wc.outputs.output_scf_wc_para.get_dict()['last_calc_uuid'])

        input_scf.remote_data = last_calc.outputs.remote_folder
        if self.ctx.new_fleurinp:
            input_scf.fleurinp = self.ctx.new_fleurinp

        return input_scf
示例#3
0
    def get_inputs_scf(self):
        """
        Initialize inputs for the scf cycle
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        # set up q vector for the reference calculation
        list_ref_qss = self.ctx.wf_dict['ref_qss']
        if [x for x in list_ref_qss if x != 0]:
            changes_dict = {
                'qss': self.ctx.wf_dict['ref_qss'],
                'l_noco': True,
                'ctail': False,
                'l_ss': True
            }
        else:
            changes_dict = {
                'qss': ' 0.0 0.0 0.0 ',
                'l_noco': False,
                'ctail': True,
                'l_ss': False
            }

        scf_wf_dict['inpxml_changes'].append(('set_inpchanges', {
            'change_dict': changes_dict
        }))

        # change beta parameter
        for key, val in six.iteritems(self.ctx.wf_dict.get('beta')):
            scf_wf_dict['inpxml_changes'].append(('set_atomgr_att_label', {
                'attributedict': {
                    'nocoParams': [('beta', val)]
                },
                'atom_label': key
            }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        if 'structure' in input_scf:  # add info about spin spiral propagation
            if 'calc_parameters' in input_scf:
                calc_parameters = input_scf.calc_parameters.get_dict()
            else:
                calc_parameters = {}
            sum_vec = np.array([np.pi / 4.0, np.e / 3.0, np.euler_gamma])
            calc_parameters['qss'] = {
                'x': sum_vec[0],
                'y': sum_vec[1],
                'z': sum_vec[2]
            }
            input_scf.calc_parameters = Dict(dict=calc_parameters)
        return input_scf
示例#4
0
    def get_inputs_first_scf(self):
        """
        Initialize inputs for the first iteration.
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))
        input_scf.metadata.label = 'SCF_forces'
        input_scf.metadata.description = 'The SCF workchain converging forces, part of the Relax'

        if self.ctx.wf_dict['break_symmetry']:
            calc_para = None
            if 'calc_parameters' in input_scf:
                calc_para = input_scf.calc_parameters
            # currently we always break the full symmetry
            break_dict = Dict(dict={'atoms': ['all']})  # for provenance
            broken_sys = break_symmetry_wf(input_scf.structure,
                                           wf_para=break_dict,
                                           parameterdata=calc_para)
            input_scf.structure = broken_sys['new_structure']
            input_scf.calc_parameters = broken_sys['new_parameters']

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        scf_wf_dict['mode'] = 'force'

        if self.ctx.wf_dict['film_distance_relaxation']:
            scf_wf_dict['inpxml_changes'].append(('set_atomgr_att', {
                'attributedict': {
                    'force': [('relaxXYZ', 'FFT')]
                },
                'species': 'all'
            }))

        for specie_off in self.ctx.wf_dict['atoms_off']:
            scf_wf_dict['inpxml_changes'].append(('set_atomgr_att_label', {
                'attributedict': {
                    'force': [('relaxXYZ', 'FFF')]
                },
                'atom_label': specie_off
            }))

        scf_wf_dict['inpxml_changes'].append(('set_atomgr_att_label', {
            'attributedict': {
                'force': [('relaxXYZ', 'FFF')]
            },
            'atom_label': '49'
        }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        return input_scf
示例#5
0
    def get_inputs_scf(self):
        """
        Initialize inputs for the scf cycle
        """
        input_scf = AttributeDict(self.exposed_inputs(FleurScfWorkChain, namespace='scf'))
        input_scf.metadata.label = 'reference_scf_SSDisp'
        input_scf.metadata.description = ('The SCF workchain converging reference charge'
                                          ' density for Spin Spiral Dispersion')

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []
        # set up q vector for the reference calculation
        string_ref_qss = ' '.join(map(str, self.ctx.wf_dict['ref_qss']))
        if [x for x in self.ctx.wf_dict['ref_qss'] if x != 0]:
            changes_dict = {'qss': string_ref_qss, 'l_noco': True, 'ctail': False, 'l_ss': True}
        else:
            changes_dict = {'qss': ' 0.0 0.0 0.0 ', 'l_noco': False, 'ctail': True, 'l_ss': False}

        scf_wf_dict['inpxml_changes'].append(('set_inpchanges', {'change_dict': changes_dict}))

        # change beta parameter
        for key, val in six.iteritems(self.ctx.wf_dict.get('beta')):
            scf_wf_dict['inpxml_changes'].append(('set_atomgr_att_label', {
                'attributedict': {
                    'nocoParams': [('beta', val)]
                },
                'atom_label': key
            }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        if 'structure' in input_scf:  # add info about spin spiral propagation
            if 'calc_parameters' in input_scf:
                calc_parameters = input_scf.calc_parameters.get_dict()
            else:
                calc_parameters = {}
            calc_parameters['qss'] = {
                'x': self.ctx.wf_dict['prop_dir'][0],
                'y': self.ctx.wf_dict['prop_dir'][1],
                'z': self.ctx.wf_dict['prop_dir'][2]
            }
            input_scf.calc_parameters = Dict(dict=calc_parameters)

        return input_scf
示例#6
0
    def get_inputs_scf(self):
        """
        Initialize inputs for scf workflow:
        wf_param, options, calculation parameters, codes, structure
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        soc = self.ctx.wf_dict.get('sqa_ref')
        if not self.ctx.wf_dict.get('use_soc_ref'):
            scf_wf_dict['inpxml_changes'].append(('set_inpchanges', {
                'change_dict': {
                    'l_soc': False
                }
            }))
        else:  # set soc parameters explicitly
            changes_dict = {'theta': soc[0], 'phi': soc[1], 'l_soc': True}
            scf_wf_dict['inpxml_changes'].append(('set_inpchanges', {
                'change_dict': changes_dict
            }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        if 'structure' in input_scf:
            if 'calc_parameters' in input_scf:
                calc_parameters = input_scf.calc_parameters.get_dict()
            else:
                calc_parameters = {}
            calc_parameters['soc'] = {'theta': soc[0], 'phi': soc[1]}
            input_scf.calc_parameters = Dict(dict=calc_parameters)

        return input_scf
示例#7
0
    def get_inputs_scf(self):
        """
        Get the input for the scf workchain after the fixed density matrix calculations
        to relax the density matrix
        """
        input_scf = AttributeDict(self.exposed_inputs(FleurScfWorkChain, namespace='scf_with_ldau'))

        if 'fleur' not in input_scf:
            input_scf.fleur = self.inputs.fleur

        if 'options' not in input_scf:
            input_scf.options = self.inputs.options

        if 'settings' not in input_scf:
            settings = {}
        else:
            settings = input_scf.settings.get_dict()

        if 'remove_from_remotecopy_list' not in settings:
            settings['remove_from_remotecopy_list'] = []
        settings['remove_from_remotecopy_list'].append('mixing_history*')

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        scf_wf_dict['inpxml_changes'].append(('set_inpchanges', {
            'change_dict': {
                'l_linMix': False,
            }
        }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)
        input_scf.settings = Dict(dict=settings)

        return input_scf
示例#8
0
    def get_inputs_scf(self):
        """
        Initialize inputs for scf workflow
        """
        input_scf = AttributeDict(
            self.exposed_inputs(FleurScfWorkChain, namespace='scf'))

        if 'wf_parameters' not in input_scf:
            scf_wf_dict = {}
        else:
            scf_wf_dict = input_scf.wf_parameters.get_dict()

        if 'inpxml_changes' not in scf_wf_dict:
            scf_wf_dict['inpxml_changes'] = []

        # switch off SOC on an atom specie
        for atom_label in self.ctx.wf_dict['soc_off']:
            scf_wf_dict['inpxml_changes'].append(('set_species_label', {
                'at_label': atom_label,
                'attributedict': {
                    'special': {
                        'socscale': 0.0
                    }
                },
                'create': True
            }))

        input_scf.wf_parameters = Dict(dict=scf_wf_dict)

        if 'calc_parameters' in input_scf:
            calc_parameters = input_scf.calc_parameters.get_dict()
        else:
            calc_parameters = {}
        input_scf.calc_parameters = calc_parameters

        return input_scf