Skip to content

Allow number of processes to be greater than number of SR/LR atoms and of planes

Davide Mandelli requested to merge Issue-73 into master

Modify computation of LR and SR QM/MM energy/forces to allow having more processes than SR/LR atoms and density planes.

Atoms array:

Atoms arrays are distributed in chunks over processes in the 'mimic_distribute_atoms' subroutine of "mimic_wrapper.f90" in CPMD. In CPMD, I modified 'mimic_distribute_atoms' so that it returns id_start (id of first atom in the chunk) and natoms (total number of atoms in the chunk), instead of id_start and id_end as in previous version.

Here in MiMiC: (i) I changed accordingly all the subroutines that compute long and short range interactions so that they accept as arguments id_start and natoms instead of id_start and id_end; (ii) I modified accordingly the intervals of the do loops; (iii) I added an 'if' statement so that processes with natoms=0 stay idle (subroutines return without doing computation).

Planes:

Planes are distributed in chunks over processes in "loadpa_utils.mod.F90" of CPMD and chunks are defined by id_start and id_end. The algorithm is such that id_end<id_start if a process does not own any planes. This is not a problem in CPMD because do loops with id_start>id_end simply do not execute.

Here in MiMiC: I modified the subroutine 'compute_electronic_multipoles' in "mimic_fragments.F90" and 'compute_lr_potential' in "mimic_long_range.F90" so that processes that do not hold any planes (id_start>id_end) return an empty array of multipoles, and do not compute contribution to the lr potential.

NOTE1: Also 'compute_sr_forces_electrons' and 'compute_sr_potential_electrons' of "mimic_short_range.F90" receive as arguments x_start and x_end of the grid. I updated also these two subroutines, but I am still trying to understand how the electron density is accessed.

NOTE2: This merge should be done together with the corresponding one on CPMD.

Edited by Davide Mandelli

Merge request reports