Adding new workflow type
To add a new workflow type, all the tasks in the workflow should already be implemented in the code base. see Adding new task.
All the workflows in the litesoph are defined in the dictionary litesoph.common.workflows_data.predefined_workflow
.
The step by step procedure to add a new workflow type to the litesoph code base is described below.
Add the new workflow type identifier in the class
WorkflowTypes
.Every workflow types has a unique identifier that is used identify them. This identifier is defined in the class
WorkflowTypes
Class WorkflowTypes(str, enum): . . NEW_WORKFLOW = 'new_workflow'
This string will be used to identifier the new workflow type
Define the new workflow in the dictionary
litesoph.common.workflows_data.predefined_workflow
.All the workflow types are defined in the dictionary
predefined_workflow
The workflow is defined as an ordered chain of tasks that needs to be completed to obtain a desired quantity, like Averaged spectrum of a molecule. In litesoph, workflow is modeled as an ordered chain of blocks, where each block is group of the same task type but with different input parameters.
For Example, Averaged spectrum of a molecule workflow can be modeled as:
Block-1 Block-2 Block-3 Block-4 |---------------| |-----------------| |--------------------| |----------------| | | | | | | | | | 1. ground |----> | 2. RT-TDDFT- x |----->| 5.compute-spectra-x|--->| 8. compute | | state | | 3. RT-TDDFT- y | | 6.compute-spectra-y| | average spectra| |---------------| | 4. RT-TDDFT- z | | 7.compute-spectra-z| |----------------| |-----------------| |--------------------|
All the information about the workflow will be encoded in the dictionary. The averaged spectrum workflow is encoded in the dictionary as follows:
predefined_workflow = { . . .# key is workflow type identifier "averaged_spectrum": { "name": "Averaged Spectrum", "blocks": [{'name' : 'Ground State', 'store_same_task_type': True, 'task_type': tt.GROUND_STATE }, {'name':'RT TDDFT', 'store_same_task_type': True, 'task_type': tt.RT_TDDFT }, {'name':'Compute Spectrum', 'store_same_task_type': True, 'task_type': tt.COMPUTE_SPECTRUM }, {'name': 'Compute Averaged Spectrum', 'store_same_task_type': True, 'task_type': tt.COMPUTE_AVERAGED_SPECTRUM }, {'name': 'End'}], "task_sequence" : [step(0 ,0 , tt.GROUND_STATE), step(1 ,1 ,tt.RT_TDDFT, { 'polarization':[1,0,0], }), step(2 ,1 ,tt.RT_TDDFT, { 'polarization': [0,1,0], }), step(3 ,1 ,tt.RT_TDDFT, { 'polarization': [0,0,1], }), step(4 ,2 ,tt.COMPUTE_SPECTRUM), step(5 ,2 ,tt.COMPUTE_SPECTRUM), step(6 ,2 ,tt.COMPUTE_SPECTRUM), step(7, 3, tt.COMPUTE_AVERAGED_SPECTRUM)], } }
This information will be used to build WorkflowInfo objects will be used in executing the workflow. see
WorkflowInfo
- litesoph.common.workflows_data.predefined_workflow
alias of { ‘averaged_spectrum’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>}, { ‘name’: ‘Compute Averaged ‘ ‘Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_AVERAGED_SPECTRUM: ‘compute_average_spectrum’>}, {‘name’: ‘End’}], ‘dependency_map’: { ‘0’: None, ‘1’: ‘0’, ‘2’: ‘0’, ‘3’: ‘0’, ‘4’: ‘1’, ‘5’: ‘2’, ‘6’: ‘3’, ‘7’: [‘4’, ‘5’, ‘6’]}, ‘name’: ‘Averaged Spectrum’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘polarization’: [1, 0, 0]}, env_parameters={}), step(id=2, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘polarization’: [0, 1, 0]}, env_parameters={}), step(id=3, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘polarization’: [0, 0, 1]}, env_parameters={}), step(id=4, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=5, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=6, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=7, block_id=3, task_type=<TaskTypes.COMPUTE_AVERAGED_SPECTRUM: ‘compute_average_spectrum’>, parameters={}, env_parameters={})]}, ‘kohn_sham_decomposition’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>}, { ‘name’: ‘Compute KSD’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.TCM: ‘tcm’>}, {‘name’: ‘End’}], ‘dependency_map’: { ‘0’: None, ‘1’: ‘0’, ‘2’: ‘1’, ‘3’: [‘0’, ‘1’]}, ‘name’: ‘Kohn Sham Decomposition’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘properties’: [‘spectrum’, ‘ksd’]}, env_parameters={}), step(id=2, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=3, block_id=3, task_type=<TaskTypes.TCM: ‘tcm’>, parameters={}, env_parameters={})]}, ‘masking’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Diople Moment Analysis’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.MASKING: ‘masking’>}, {‘name’: ‘End’}], ‘dependency_map’: {‘0’: None, ‘1’: ‘0’, ‘2’: ‘1’}, ‘name’: ‘Masking’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘properties’: [‘spectrum’]}, env_parameters={‘laser’: True}), step(id=2, block_id=2, task_type=<TaskTypes.MASKING: ‘masking’>, parameters={}, env_parameters={})]}, ‘mo_population_tracking’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>}, { ‘name’: ‘Compute MO ‘ ‘population’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.MO_POPULATION: ‘mo_population’>}, {‘name’: ‘End’}], ‘dependency_map’: { ‘0’: None, ‘1’: ‘0’, ‘2’: ‘1’, ‘3’: [‘0’, ‘1’]}, ‘name’: ‘MO Population Tracking’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘properties’: [‘spectrum’, ‘ksd’]}, env_parameters={}), step(id=2, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=3, block_id=3, task_type=<TaskTypes.MO_POPULATION: ‘mo_population’>, parameters={}, env_parameters={})]}, ‘pump_probe’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute TAS’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_TAS: ‘compute_tas’>}, {‘name’: ‘End’}], ‘dependency_map’: { ‘0’: None, ‘1’: ‘0’, ‘2’: ‘1’, ‘3’: ‘0’, ‘4’: ‘3’}, ‘name’: ‘Pump Probe’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘properties’: [‘spectrum’]}, env_parameters={}), step(id=2, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={}), step(id=3, block_id=3, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={‘properties’: [‘spectrum’]}, env_parameters={‘laser’: True}), step(id=4, block_id=4, task_type=<TaskTypes.COMPUTE_TAS: ‘compute_tas’>, parameters={}, env_parameters={})]}, ‘spectrum’: { ‘blocks’: [ { ‘name’: ‘Ground State’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.GROUND_STATE: ‘ground_state’>}, { ‘name’: ‘RT TDDFT’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.RT_TDDFT: ‘rt_tddft’>}, { ‘name’: ‘Compute Spectrum’, ‘store_same_task_type’: True, ‘task_type’: <TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>}, {‘name’: ‘End’}], ‘dependency_map’: {‘0’: None, ‘1’: ‘0’, ‘2’: ‘1’}, ‘name’: ‘Spectrum’, ‘task_sequence’: [ step(id=0, block_id=0, task_type=<TaskTypes.GROUND_STATE: ‘ground_state’>, parameters={}, env_parameters={}), step(id=1, block_id=1, task_type=<TaskTypes.RT_TDDFT: ‘rt_tddft’>, parameters={}, env_parameters={}), step(id=2, block_id=2, task_type=<TaskTypes.COMPUTE_SPECTRUM: ‘spectrum’>, parameters={}, env_parameters={})]}}