aiida_castep.calculations package#



aiida_castep.calculations.castep module#

Calculations of CASTEP

class aiida_castep.calculations.castep.CastepCalculation(*args: Any, **kwargs: Any)[source]#

Bases: CalcJob, CastepInputGenerator

Class representing a generic CASTEP calculation - This class should work for all types of calculations.

_DEFAULTS = {'input_filename': 'aiida.cell', 'output_filename': 'aiida.castep', 'parent_folder_name': 'parent', 'parser_name': 'castep.castep', 'seedname': 'aiida', 'symlink_usage': True, 'use_kpoints': True, 'withmpi': True}#
__abstractmethods__ = frozenset({})#
__module__ = 'aiida_castep.calculations.castep'#
_abc_impl = <_abc_data object>#
_acceptable_tasks = ['singlepoint', 'geometryoptimization', 'geometryoptimisation']#
_copied_attributes = ['jobresource_param', 'custom_scheduler_commands', 'max_wallclock_seconds']#
_default_retrieve_list = ['*.err', '*.den_fmt', '*.elf_fmt', '*-out.cell', '*.pdos_bin']#
_extra_kpoints = {'bs': {'need_weigthts': False, 'task': ('bandstructure',)}, 'elnes': {'need_weights': True, 'task': ('elnes',)}, 'magres': {'need_weights': True, 'task': ('magres',)}, 'optics': {'need_weights': True, 'task': ('optics',)}, 'phonon': {'need_weights': False, 'task': ('phonon', 'phonon+efield')}, 'phonon_fine': {'need_weights': False, 'task': ('phonon', 'phonon+efield')}, 'spectral': {'need_weights': True, 'task': ('spectral',)}, 'supercell': {'need_weights': True, 'task': ('phonon',)}}#

Generate header lines to go into param and cell files :param other_nodes: A list of pairs of (linkname, node)


Add extra kpoints information to the calculation

_write_headers = True#
classmethod check_restart(builder, verbose=False)[source]#

Check the existence of restart file is needed

classmethod define(spec)[source]#

Define the process specification, including its inputs, outputs and known exit codes.

Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.


spec – the calculation job process spec to define.

classmethod dryrun_test(inputs, castep_exe='castep.serial', verbose=True)[source]#

Do a dryrun test in a folder with prepared builder or inputs

static get_castep_input_summary(builder)[source]#

Summarize the input for a builder


Routine to be called when create the input files and other stuff

  • folder – a aiida.common.folders.Folder subclass where the plugin should put all its files.

  • inputdict – a dictionary with the input nodes, as they would be returned by get_inputs_dict (without the Code!)

retrieve_dict = {'geometryoptimisation': ['.geom'], 'geometryoptimization': ['.geom'], 'magres': ['.magres'], 'molecular dynamics': ['.md'], 'moleculardynamics': ['.md'], 'phonon': ['.phonon'], 'phonon+efield': ['.phonon', '.efield'], 'spectral': ['.ome_bin', '.dome_bin'], 'transitionstatesearch': ['.ts']}#
classmethod submit_test(*args, **kwargs)[source]#

Test submission with a builder of inputs

static update_paraemters(inputs, *args, **kwargs)[source]#

Update the paramters for a given input dictionary/builder

static use_pseudos_from_family(inputs, family_name)[source]#
aiida_castep.calculations.castep.submit_test(arg, **kwargs)[source]#

This essentially test the submition

aiida_castep.calculations.datastructure module#

Classes for .param and .cell files

class aiida_castep.calculations.datastructure.CastepInputFile(*args, **kwargs)[source]#

Bases: OrderedDict

Class for storing key - values pairs of CASTEP inputs This class can be used for .param, .cell and also other CASTEP style inputs such as OptaDos’s odi file

self.get_file_lines is used for getting a list of strings as lines to be written to the file

self.get_string is used for getting the content to be passed to write function of a file-like object

sepecial properties: * header a list of lines to be put into the header * units a dictionary of the units

__init__(*args, **kwargs)[source]#
__module__ = 'aiida_castep.calculations.datastructure'#

Return a list of strings to be write out to the files

class aiida_castep.calculations.datastructure.CellFile(*args, **kwargs)[source]#

Bases: CastepInputFile

__module__ = 'aiida_castep.calculations.datastructure'#
class aiida_castep.calculations.datastructure.ParamFile(*args, **kwargs)[source]#

Bases: CastepInputFile

__module__ = 'aiida_castep.calculations.datastructure'#

aiida_castep.calculations.inpgen module#

Module for generating text based CASTEP inputs

class aiida_castep.calculations.inpgen.CastepInputGenerator[source]#

Bases: object

Class for generating CASTEP inputs

__dict__ = mappingproxy({'__module__': 'aiida_castep.calculations.inpgen', '__doc__': '\n    Class for generating CASTEP inputs\n    ', '__init__': <function CastepInputGenerator.__init__>, 'prepare_inputs': <function CastepInputGenerator.prepare_inputs>, '_prepare_cell_file': <function CastepInputGenerator._prepare_cell_file>, '_include_extra_kpoints': <function CastepInputGenerator._include_extra_kpoints>, '_prepare_pseudo_potentials': <function CastepInputGenerator._prepare_pseudo_potentials>, '_prepare_param_file': <function CastepInputGenerator._prepare_param_file>, '__dict__': <attribute '__dict__' of 'CastepInputGenerator' objects>, '__weakref__': <attribute '__weakref__' of 'CastepInputGenerator' objects>, '__annotations__': {}})#

Initialise the object

__module__ = 'aiida_castep.calculations.inpgen'#

list of weak references to the object (if defined)

_include_extra_kpoints(kpn_node, kpn_name, kpn_settings, report_fn=None)[source]#

Write extra kpoints to the cell


Prepare the cell file


Prepare the content of PARAM file


Prepare the pseudopotential part of the cell file


Prepare the inputs :param reset: Rest existing self.param_file and self.cell file module#

Tools for calculations


Bases: CalculationTools

__module__ = ''#
compare_with(the_other_calc, reverse=False)[source]#

Compare with another calculation Look for difference in get_castep_input_summary functions :params node: pk or uuid or node :params reverse: reverse the comparison, by default this node is the “new” and the one compared with is “old”.

create_restart(ignore_state=False, restart_mode='restart', use_output_structure=False, **kwargs)[source]#

Convenient fuction for getting a summary of the input of this calculation


calc – A CalcJobNode or ProcessBuilder or a nested input dictionary


A dictionary, entry_point='castep.castep', calcjob=None, param_update=None, param_delete=None, restart_mode='restart', use_castep_bin=False, parent_folder=None, reuse=False)[source]#

Function to create a restart for a calculation. :param inputs: A builder or nested dictionary :param entry_point: Name of the entry points :param param_update: Update the parameters :param param_delete: A list of parameters to be deleted :param restart_mode: Mode of the restart, ‘continuation’ or ‘restart’ :param use_castep_bin: Use hte ‘castep_bin’ file instead of check :param parent_folder: Remote folder to be used for restart :param reuse: Use the reuse mode, force=False, delete=None, **kwargs)[source]#

Convenient function to update the parameters of the calculation. Will atomiatically set the PARAM or CELL field in unstored ParaemterData linked to the calculation. If no Dict is linked to the calculation, a new node will be created.


This method relies on the help information to check and assign keywords to PARAM or CELL field of the Dict (i.e for generating .param and .cell file)


  • force – flag to force the update even if the Dict node is stored.

  • delete – A list of the keywords to be deleted., family_name)[source]#

Set the pseudos port namespace for a builder using pseudo family name :note: The structure must already be set in the builder.

  • builder – ProcessBuilder instance to be processed, it must have a structure

  • family_name – the name of the group containing the pseudos


The same builder with the pseudopotential set

aiida_castep.calculations.utils module#

Utility module

aiida_castep.calculations.utils._lowercase_dict(in_dict, dict_name)[source]#

Make sure the dictionary’s keys are in lower case :param dict_name: A string of the name for the dictionary. Only used in warning message.

aiida_castep.calculations.utils._uppercase_dict(in_dict, dict_name)[source]#

Make sure the dictionary’s keys are in upper case :param dict_name: A string of the name for the dictionary. Only used in warning message.

aiida_castep.calculations.utils.get_castep_ion_line(name, pos, label=None, spin=None, occupation=None, mix_num=None)[source]#

Generate a line in POSITIONS_ABS or POSITIONS_FRAC block

  • name – A sting or tuple of the names

  • pos – Position, a sequence of 3

  • label – A string or tuple of the labels

  • spin – Spins. (spin), (spin1, spin2), (x, y, z) or ((x1,y1,z1), (x2, y2, z2))

  • occupation – tuple of two of the occupation number

  • mix_num – mixture number, can be any integer but should not be repeated in a single cell file

Return line:

a string of the line to be added to the cell file

Module contents#

Sub-package for calculation plugins