coulomb_kmc.kmc_mpi_decomp module¶
-
class
coulomb_kmc.kmc_mpi_decomp.
FMMMPIDecomp
(fmm, max_move, boundary_condition, cuda=False)¶ Bases:
coulomb_kmc.kmc_fmm_common.LocalOctalBase
Class that handles the MPI decomposition and converts proposed moves into the internal representation expected by the classes that handle the direct and indirect interactions.
- Parameters
fmm – FMM instance to use.
max_move (float) – Maximum distance of any hop.
boundary_condition – Boundary condition to use.
-
free_win_ind
()¶ Free the MPI.Win for the global to local map for FMM cells.
-
get_local_fmm_cell
(idx)¶ Helper function that returns the local fmm cell linear index for a particle.
- Parameters
idx – Local particle index.
-
get_local_fmm_cell_array
(ids)¶ For each local id in an ctypes.c_int64 numpy array returns the linear local id in the local data structure of fmm cells.
- Parameters
ids – NumPy array (INT64) of local ids.
-
get_win_ind
()¶ Create and return the MPI.Win for the global to local map for FMM cells.
-
initialise
(positions, charges, fmm_cells, ids)¶ Initialise the data structures for the direct interactions.
- Parameters
positions – Initial positions of charges.
charges – Initial charge values.
fmm_cells – FMM cells of the input charges.
ids – Unique global ids of charges.
-
setup_propose
(moves)¶ Converts a tuple of proposed moves into the internal data structure for proposed moves.
- Parameters
moves – Proposed moves in tuple form. e.g. ((id, proposed_positions), …).
-
setup_propose_with_dats
(site_max_counts, current_sites, prop_positions, prop_masks, prop_energy_diffs, prop_charges=None)¶ Converts proposed moves passed with the propose_with_dats interface into the internal data structure for proposed moves that can be passed to the classes for direct and indirect interactions.
- Parameters
site_max_counts – ScalarArray, dtype=c_int64 Input
current_sites – ParticleDat, dtype=c_int64 Input
prop_positions – ParticleDat, dtype=c_double Input
prop_masks – ParticleDat, dtype=c_int64 Input
prop_energy_diffs – ParticleDat, dtype=c_double Output
prop_charges – ParticleDat, dtype=c_double Input (optional)
- Returns:
tuple – (total_moves, num_particles, host_data, cuda_data), where total_moves is the total number of proposed moves, num_particles is the number of particles (charges) with proposed moves, host_data is the proposed move data on the host and cuda_data is the proposed move data on a CUDA device (if applicable).
The host_data and cuda_data contain the following entries:
rate_location
Storage location of change in energy value.
new_positions
Proposed positions.
new_charges
Proposed charges.
new_ids
Global ids of proposed moves.
new_fmm_cells
New FMM cell containing proposed move.
new_shifted_positions
Proposed position shifted into halo region on sub-domain.
old_positions
Original position.
old_charges
Original charge.
old_ids
Original global id.
old_fmm_cells
Original FMM cell.
exclusive_sum
Used as a map from old positions to new positions.