def define(cls, spec: CalcJobProcessSpec): super(Symmetrise3DStructure, cls).define(spec) spec.input("structure", valid_type=StructureData, required=False) spec.input("cif", valid_type=DataFactory("cif"), required=False) spec.input( "settings", valid_type=DataFactory("dict"), serializer=to_aiida_type, required=True, validator=cls.validate_settings, ) spec.outline(cls.validate_inputs, cls.compute) spec.output("symmetry", valid_type=SymmetryData, required=True) spec.output("structure", valid_type=StructureData, required=False) spec.exit_code( 300, "ERROR_INVALID_INPUT_RESOURCES", message="one of either a structure or cif input must be supplied", ) spec.exit_code( 301, "ERROR_NON_3D_STRUCTURE", message='the supplied structure must be 3D (i.e. have all dimensions pbc=True)"', ) spec.exit_code( 302, "ERROR_COMPUTE_OPTIONS", message="idealize can only be used when standardize=True", ) spec.exit_code( 303, "ERROR_RESET_KIND_NAMES", message="the kind names supplied are not compatible with the structure", ) spec.exit_code( 304, "ERROR_NEW_STRUCTURE", message="error creating new structure" ) spec.exit_code( 305, "ERROR_COMPUTING_SYMMETRY", message="error computing symmetry operations", )
def define(cls, spec: CalcJobProcessSpec): super(CryPropertiesWorkChain, cls).define(spec) # Input requires either a pre-computed wavefunction (fort.9) file, # or inputs for a Crystal Calculation spec.input( "wf_folder", valid_type=(orm.FolderData, orm.RemoteData, orm.SinglefileData), required=False, help="the folder containing the wavefunction fort.9 file", ) # expose_optional_inputs(spec, cls._scf_namespace, CryMainCalculation) spec.expose_inputs( cls._scf_class, namespace=cls._scf_name, namespace_options={"required": False, "populate_defaults": False}, ) spec.expose_outputs( cls._scf_class, namespace=cls._scf_name, namespace_options={"required": False}, ) # available property computations for pname, process_class in cls._cry_props.items(): spec.expose_inputs( process_class, namespace=pname, exclude=["wf_folder"], namespace_options={"required": False, "populate_defaults": False}, ) spec.expose_outputs( process_class, namespace=pname, namespace_options={"required": False} ) # additional input parameters spec.input( "check_remote", valid_type=orm.Bool, serializer=to_aiida_type, required=False, help=( "If a RemoteData wf_folder is input, check it contains the wavefunction file, " "before launching calculations. " "Note, this will fail if the remote computer is not immediately available" ), ) spec.input( "clean_workdir", valid_type=orm.Bool, serializer=to_aiida_type, required=False, help="If `True`, work directories of all called calculation will be cleaned at the end of execution.", ) spec.input( "test_run", valid_type=orm.Bool, required=False, serializer=to_aiida_type, help="break off the workchain before submitting a calculation", ) spec.outline( cls.check_inputs, if_(cls.check_wf_folder)( cls.submit_scf_calculation, cls.check_scf_calculation ), cls.submit_prop_calculations, cls.check_prop_calculations, ) spec.exit_code( 200, "END_OF_TEST_RUN", message=("Workchain ended before submitting calculation."), ) spec.exit_code( 201, "ERROR_NO_WF_INPUT", message=("Neither a wf_folder nor scf calculation was supplied."), ) spec.exit_code( 202, "ERROR_NO_PROP_INPUT", message=("No property calculation inputs were supplied."), ) spec.exit_code( 203, "ERROR_WF_FOLDER", message=("The supplied folder does contain the wavefunction file."), ) spec.exit_code( 210, "ERROR_SCF_SUBMISSION_FAILED", message=("The SCF calculation submission failed."), ) spec.exit_code( 301, "ERROR_SCF_CALC_FAILED", message=("The SCF calculation failed.") ) spec.exit_code( 302, "ERROR_PROP_CALC_FAILED", message=("One or more property calculations failed."), )
def define(cls, spec: CalcJobProcessSpec): super(CryMainBaseWorkChain, cls).define(spec) spec.expose_inputs(CryCalculation, namespace=cls._calc_namespace, exclude=()) spec.input( "{}.metadata.options.resources".format(cls._calc_namespace), valid_type=dict, required=False, ) spec.input( "basis_family", valid_type=orm.Str, required=False, serializer=to_aiida_type, help=( "An alternative to specifying the basis sets manually: " "one can specify the name of an existing basis set family " "and the work chain will generate the basis sets automatically " "based on the input structure." ), ) spec.input( "kpoints_distance", valid_type=orm.Float, required=False, serializer=to_aiida_type, validator=_validate_kpoint_distance, help=( "The minimum desired distance in 1/Å between k-points " "in reciprocal space. " "The explicit k-points will be generated automatically " "by the input structure, and " "will replace the SHRINK IS value in the input parameters." "Note: This methods assumes " "the PRIMITIVE unit cell is provided" ), ) spec.input( "kpoints_force_parity", valid_type=orm.Bool, required=False, serializer=to_aiida_type, help=( "Optional input when constructing the k-points based " "on a desired `kpoints_distance`. " "Setting this to `True` will force the k-point mesh " "to have an even number of points along each lattice vector " "except for any non-periodic directions." ), ) # TODO include option for symmetry calculation spec.outline( cls.setup, cls.validate_parameters, cls.validate_basis_sets, cls.validate_resources, while_(cls.should_run_process)( cls.prepare_calculation, cls.run_process, cls.inspect_process, ), cls.results, ) spec.expose_outputs(CryCalculation, exclude=("retrieved", "optimisation")) spec.exit_code( 201, "ERROR_INVALID_INPUT_PARAMETERS", message=( "The parameters could not be validated " "against the jsonschema." ), ) spec.exit_code( 202, "ERROR_INVALID_INPUT_BASIS_SETS", message=( "The explicit `basis_sets` or `basis_family` " "could not be used to get the necessary basis sets." ), ) spec.exit_code( 204, "ERROR_INVALID_INPUT_RESOURCES_UNDERSPECIFIED", message=( "The `metadata.options` did not specify both " "`resources.num_machines` and `max_wallclock_seconds`." ), ) spec.exit_code( 300, "ERROR_UNRECOVERABLE_FAILURE", message="The calculation failed with an unrecoverable error.", ) spec.exit_code( 320, "ERROR_INITIALIZATION_CALCULATION_FAILED", message="The initialization calculation failed.", )