# updateAllDefectsAndTransitions¶

updateAllDefectsAndTransitions(defect_lists=None, transition_path_lists=None, processes_per_defect=None, processes_per_path=None)

User command that takes the list of defects and paths and updates them all while maximizing parallel calculations.

Parameters: defect_lists (sequence of VacancyList | SubstitutionalList | InterstitialList SplitInterstitialList | DefectPairList | DefectClusterList) – A sequence of defect lists to be updated. Default: None transition_path_lists (sequence of TransitionPathList) – A sequence of transition path lists to be updated. Default: None processes_per_defect (int) – Number of processes per defect. Default: Mimimum value defined in the defect lists. processes_per_path (int) – Number of processes per path Default: Minimum value defined in the paths.

## Notes¶

In a single SMW input script, there could be

1. multiple charge states in a defect.
2. multiple defects in a defect list.
3. multiple defect lists.

By default, processes_per_defect=None, all available processes defined in a SMW run script will be assigned to a single defect without parallelization. Thus, each task in a defect will be run with all available processes in serial.

SMW provides full level of parallelization in Defect/NEB calculations.

Note

For optimal parallelization setting, (processes_per_defect-1) ( # of charge states ) should be an integer.

### Parallelization of different charge states in a defect¶

#### Case 1¶

charge_states = [0]
vacancies=VacancyList(
HfO2,
charge_states=charge_states,processes_per_defect=13
).filterByLatticeSpecies(Oxygen)


If a single charge state is defined in a defect list, all 13 processes will be assigned to each task in a single defect and all tasks in a defect will be run in serial.

#### Case 2¶

charge_states = [0,1]
vacancies=VacancyList(
HfO2,
charge_states=charge_states,processes_per_defect=17
).filterByLatticeSpecies(Oxygen)


If there are multiple charge states in a defect list, tasks will be parallelized by the number of charge states: (processes_per_defect-1) / ( # of charge states ) = (17-1)/2 = 8 . Thus,8 processes will be assigned to each task and two tasks will be run in parallel.

### Parallelization of Defects¶

Multi-defect calculations can be parallelized by processes_per_defect keyword either in defect lists ( DefectClusterList, DefectPairList, InterstitialList, SplitInterstitialList, SubstitutionalList, VacancyList) or updateAllDefectsAndTransitions function.

#### Case 3¶

Defect definition in SMW input script :

charge_states=[0]
vacancies=VacancyList(
HfO2,
charge_states=charge_states,processes_per_defect=8
).filterByWyckoffIndex([0,53])


MPI setting in smw run script setting (Define total number of processes for SMW run script):

mpirun -np 16  atkpython smw_input.py.


Defect calculations will be parallelized by (total number of processes in smw run script ) / (processe_per_defect). Thus, 16/8 = 2 defects will be run in parallel.

#### Case 4¶

Defect definition in smw input script :

charge_states=[0]
Hf_vac=VacancyList(HfO2,charge_states=charge_states).filterByWyckoffIndex(0)
O_vac=VacancyList(HfO2, charge_states=charge_statee).filterByWyckoffIndex(53)

vaclist=[Hf_vac,O_vac]
updateAllDefectsAndTransitions(defect_lists=vaclist, processes_per_defect=8)


MPI setting in smw run script (Define total number of processes in SMW input script):

mpirun -np 16  atkpython smw_input.py


In this last case, there are two defect lists and each of them has a single defect. In order to parallelize defects over multiple defect lists, it is required to make a super defect lists (a list of defect lists) and update it in updateAllDefectsAndTransitions class. Otherwise, the defect lists will be run in serial.

If different values are assigned to processes_per_defect in the defect list and updateAllDefectsAndTransitions, SMW will select the value in updateAllDefectsAndTransitions.