Example #1
0
 def setup_pseudo_potentials(self):
     """
     Based on the given input structure and the protocol, use the SSSP library to determine the
     optimal pseudo potentials for the different elements in the structure
     """
     structure = self.ctx.structure_initial_primitive
     pseudo_familyname = self.ctx.protocol['pseudo_familyname']
     self.ctx.inputs['pseudos'] = get_pseudos_from_structure(structure, pseudo_familyname)
Example #2
0
 def setup_pseudo_potentials(self):
     """
     Based on the given input structure, get the 
     pseudo potentials for the different elements in the structure
     """
     self.report('Running setup_pseudo_potentials')
     structure = self.ctx.structure_initial_primitive
     pseudo_familyname = self.ctx.protocol['pseudo_familyname']
     self.ctx.rsi_inputs['pseudos'] = get_pseudos_from_structure(structure, pseudo_familyname)
Example #3
0
    def use_pseudos_from_family(self, family_name):
        """
        Set the pseudo to use for all atomic kinds, picking pseudos from the
        family with name family_name.

        :note: The structure must already be set.

        :param family_name: the name of the group containing the pseudos
        """
        from collections import defaultdict

        try:
            ##  structure = inputdict.pop(self.get_linkname('structure'))
            structure = self.get_inputs_dict()[self.get_linkname('structure')]
        except AttributeError:
            raise ValueError(
                "Structure is not set yet! Therefore, the method "
                "use_pseudos_from_family cannot automatically set "
                "the pseudos")

        # A dict {kind_name: pseudo_object}
        kind_pseudo_dict = get_pseudos_from_structure(structure, family_name)

        # We have to group the species by pseudo, I use the pseudo PK
        # pseudo_dict will just map PK->pseudo_object
        pseudo_dict = {}
        # Will contain a list of all species of the pseudo with given PK
        pseudo_species = defaultdict(list)

        for kindname, pseudo in kind_pseudo_dict.iteritems():
            pseudo_dict[pseudo.pk] = pseudo
            pseudo_species[pseudo.pk].append(kindname)

        for pseudo_pk in pseudo_dict:
            pseudo = pseudo_dict[pseudo_pk]
            kinds = pseudo_species[pseudo_pk]
            # I set the pseudo for all species, sorting alphabetically
            self.use_pseudo(pseudo, sorted(kinds))
Example #4
0
    def validate_pseudo_potentials(self):
        """
        Validate the inputs related to pseudopotentials to check that we have the minimum required
        amount of information to be able to run a SiestaCalculation
        """

        if all(
            [key not in self.inputs for key in ['pseudos', 'pseudo_family']]):
            self.abort_nowait(
                'neither explicit pseudos nor a pseudo_family was specified in the inputs'
            )
            return
        elif all([key in self.inputs for key in ['pseudos', 'pseudo_family']]):
            self.report(
                'both explicit pseudos as well as a pseudo_family were specified: using explicit pseudos'
            )
            self.ctx.inputs['pseudo'] = self.inputs.pseudos
        elif 'pseudos' in self.inputs:
            self.report(
                'only explicit pseudos were specified: using explicit pseudos')
            self.ctx.inputs['pseudo'] = self.inputs.pseudos
        elif 'pseudo_family' in self.inputs:
            self.report(
                'only a pseudo_family was specified: using pseudos from pseudo_family'
            )
            structure = self.inputs.structure
            self.ctx.inputs['pseudo'] = get_pseudos_from_structure(
                structure, self.inputs.pseudo_family.value)

        for kind in self.inputs.structure.get_kind_names():
            if kind not in self.ctx.inputs['pseudo']:
                self.abort_nowait(
                    'no pseudo available for element {}'.format(kind))
            elif not isinstance(self.ctx.inputs['pseudo'][kind], PsfData):
                self.abort_nowait(
                    'pseudo for element {} is not of type PsfData'.format(
                        kind))
Example #5
0
    'md-numcgsteps': 7,
    'md-maxcgdispl': '0.200 bohr',
    'md-maxforcetol': '0.020 eV/Ang',
    'geometry-must-converge': True
}

parameters = Dict(dict=params_dict)
#------------------------------------------------------------------------
#
# No basis set spec in this calculation (default)
#
#--------------------- Pseudopotentials ---------------------------------
#
# FIXME: The family name is hardwired
#
pseudos_dict = get_pseudos_from_structure(s, 'sample_psf_family')
#-----------------------------------------------------------------------

#
#--All the inputs of a Siesta calculations are listed in a dictionary--
#
inputs = {
    'structure': s,
    'parameters': parameters,
    'code': code,
    'pseudos': pseudos_dict,
    'metadata': {
        'options': options,
        'label': "Water molecule -- geom fail"
    }
}
Example #6
0
'pao-energy-shift': '100 meV',
'%block pao-basis-sizes': """
Si DZP
%endblock pao-basis-sizes""",
    })

#The kpoints mesh
kpoints = KpointsData()
kpoints.set_kpoints_mesh([11, 11, 11])

##-------------------K-points for bands --------------------
bandskpoints = KpointsData()
bandskpoints = result['explicit_kpoints']

#The pseudopotentials
pseudos_dict = get_pseudos_from_structure(structure, 'nc-sr-04_pbe_standard-psf')

#Resources
options = {
    "max_wallclock_seconds": 600,
#    "withmpi" : True,
    "resources": {
        "num_machines": 1,
        "num_mpiprocs_per_machine": 1,
    }
}

inputs = {
    'structure': structure,
    'parameters': parameters,
    'code': code,