Function for querying if a process is a master or slave process.

Returns:True if the process is the master process in the parallel computation. False if it is a slave process.
Return type:bool

Usage Examples

Printing the total energy to the terminal window. If the program is run in a parallel fashion, the processIsMaster function can be used to ensure that only the master process prints to the screen.

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=[Nitrogen, Hydrogen, Hydrogen, Hydrogen],
    cartesian_coordinates=[[ 0.     ,  0.      ,  0.124001],
                           [ 0.     ,  0.941173, -0.289336],
                           [ 0.81508, -0.470587, -0.289336],
                           [-0.81508, -0.470587, -0.289336]]*Angstrom

# Define the calculator
calculator = HuckelCalculator()

# Print the total energy to the screen
# and avoid writing this for each process.

energy = TotalEnergy(molecule_configuration).evaluate()

if processIsMaster():
   print('Total Energy =', energy)


Care should be taken when using the processIsMaster function. Misuse can cause the program to hang. We recommend that the this function is used only for printing to the terminal while debugging.