Ejemplo n.º 1
0
    def calculate_trim_wf(self):
        """Launch a pw_bands calculation on the TRIM points for the structure."""
        self.report(
            'Using parities at TRIM points to calculatte Z2 invariant.')
        kpoints = generate_trim(self.ctx.current_structure,
                                self.inputs.dimensionality)

        inputs = AttributeDict(
            self.exposed_inputs(PwBaseWorkChain, namespace='band'))
        inputs.clean_workdir = self.inputs.clean_workdir
        inputs.pw.code = self.inputs.pw_code
        inputs.pw.structure = self.ctx.current_structure
        inputs.pw.parameters = inputs.pw.parameters.get_dict()
        inputs.pw.parameters.setdefault('CONTROL', {})
        inputs.pw.parameters['CONTROL']['calculation'] = 'bands'
        inputs.pw.parent_folder = self.ctx.scf_folder
        inputs.kpoints = kpoints

        inputs = prepare_process_inputs(PwBaseWorkChain, inputs)
        running = self.submit(PwBaseWorkChain, **inputs)

        self.report('launching PwBaseWorkChain<{}> in {} mode'.format(
            running.pk, 'bands'))

        return ToContext(workchain_trim=running)
Ejemplo n.º 2
0
    def setup_scf(self):
        """Set the inputs for the `scf` calculation."""
        if 'parent_folder' in self.inputs:
            self.report('IGNORING `parent_folder` input.')

        inputs = AttributeDict(
            self.exposed_inputs(PwBaseWorkChain, namespace='scf'))
        inputs.pw.code = self.inputs.code
        inputs.pw.pseudos = self.inputs.pseudos
        inputs.pw.structure = self.inputs.structure
        inputs.clean_workdir = self.inputs.clean_workdir

        self.ctx.inputs = inputs
Ejemplo n.º 3
0
    def run_relax(self):
        """Run the PwRelaxWorkChain to run a relax PwCalculation."""
        inputs = AttributeDict(
            self.exposed_inputs(PwRelaxWorkChain, namespace='relax'))
        inputs.structure = self.ctx.current_structure
        inputs.base.pw.pseudos = self.inputs.pseudos
        inputs.base.pw.code = self.inputs.code
        inputs.clean_workdir = self.inputs.clean_workdir

        running = self.submit(PwRelaxWorkChain, **inputs)

        self.report('launching PwRelaxWorkChain<{}>'.format(running.pk))

        return ToContext(workchain_relax=running)
Ejemplo n.º 4
0
    def run_scf(self):
        """Run the PwBaseWorkChain in scf mode on the input structure."""
        inputs = AttributeDict(
            self.exposed_inputs(PwBaseWorkChain, namespace='scf'))
        inputs.clean_workdir = self.inputs.clean_workdir
        inputs.pw.code = self.inputs.pw_code
        inputs.pw.structure = self.ctx.current_structure
        inputs.pw.parameters = inputs.pw.parameters.get_dict()
        inputs.pw.parameters.setdefault('CONTROL', {})
        inputs.pw.parameters['CONTROL']['calculation'] = 'scf'

        inputs = prepare_process_inputs(PwBaseWorkChain, inputs)
        running = self.submit(PwBaseWorkChain, **inputs)

        self.report('launching PwBaseWorkChain<{}> in {} mode'.format(
            running.pk, 'scf'))

        return ToContext(workchain_scf=running)
Ejemplo n.º 5
0
    def setup_bands(self):
        """Set the inputs for the `bands` calculation."""
        inputs = AttributeDict(
            self.exposed_inputs(PwBaseWorkChain, namespace='bands'))

        inputs.pw.code = self.inputs.code
        inputs.kpoints = self.ctx.kpt_data

        inputs.pw.pseudos = self.inputs.pseudos
        inputs.pw.structure = self.inputs.structure
        inputs.pw.parent_folder = self.ctx.remote
        inputs.clean_workdir = self.inputs.clean_workdir

        inputs.pw.parameters = inputs.pw.parameters.get_dict()
        inputs.pw.parameters.setdefault('CONTROL', {})
        inputs.pw.parameters['CONTROL']['calculation'] = 'bands'
        inputs.pw.parameters['SYSTEM']['nosym'] = True

        inputs = prepare_process_inputs(PwBaseWorkChain, inputs)

        self.ctx.inputs = inputs
Ejemplo n.º 6
0
    def setup_bands_loop(self):
        """Perform initial setup for bands calculation loop."""
        self.ctx.iteration = 0
        # self.ctx.max_iteration = self.inputs.max_iter
        if 'bands' in self.inputs:
            inputs = AttributeDict(
                self.exposed_inputs(PwBaseWorkChain, namespace='bands'))
        else:
            inputs = AttributeDict(
                self.exposed_inputs(PwBaseWorkChain, namespace='scf'))

        inputs.pw.parameters = inputs.pw.parameters.get_dict()
        inputs.pw.parameters.setdefault('CONTROL', {})
        inputs.pw.parameters['CONTROL']['calculation'] = 'bands'

        inputs.pw.parent_folder = self.ctx.scf_folder
        inputs.clean_workdir = self.inputs.clean_workdir
        inputs.pw.structure = self.ctx.current_structure
        inputs.pw.pseudos = self.inputs.pseudos
        inputs.pw.code = self.inputs.code

        self.ctx.inputs = inputs

        self.ctx.current_kpoints_distance = self.inputs.starting_kpoints_distance.value
        self.ctx.min_kpoints_distance = self.inputs.min_kpoints_distance.value
        self.ctx.scale_kpoints_distance = self.inputs.scale_kpoints_distance.value

        self.ctx.gap_threshold = self.inputs.gap_threshold.value

        if 'starting_kpoints' in self.inputs:
            self.ctx.dim = get_kpoint_grid_dimensionality(
                self.inputs.starting_kpoints)
        else:
            self.ctx.dim = orm.Int(3)

        self.ctx.found_crossings = []
        self.ctx.do_loop = True
        self.ctx.flag = False

        self.report('Starting loop to find bands crossings.')