24 #include "./base/base_uses.f90"
31 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'pme_tools'
45 SUBROUTINE set_list(part, npart, center, p1, rs, ipart, core_center)
47 TYPE(particle_type),
DIMENSION(:),
INTENT(IN) :: part
48 INTEGER,
INTENT(IN) :: npart
49 INTEGER,
DIMENSION(:, :),
INTENT(IN) :: center
50 INTEGER,
INTENT(OUT) :: p1
51 TYPE(realspace_grid_type),
INTENT(IN) :: rs
52 INTEGER,
INTENT(INOUT) :: ipart
53 INTEGER,
DIMENSION(:, :),
OPTIONAL,
POINTER :: core_center
56 INTEGER,
DIMENSION(3) :: lb, ub
57 REAL(kind=
dp) :: charge
58 TYPE(atomic_kind_type),
POINTER :: atomic_kind
66 IF (ipart > npart)
EXIT
67 atomic_kind => part(ipart)%atomic_kind
69 IF (charge == 0.0_dp .AND. part(ipart)%shell_index == 0) cycle
70 IF (rs%desc%parallel)
THEN
72 IF (all(rs%desc%group_dim == 1))
THEN
73 ndim = rs%desc%group_size
76 IF (mod(ipart, ndim) == npos)
THEN
82 IF (part(ipart)%shell_index /= 0 .AND.
PRESENT(core_center))
THEN
83 IF (in_slice(core_center(:, part(ipart)%shell_index), lb, ub))
THEN
87 IF (in_slice(center(:, ipart), lb, ub))
THEN
108 FUNCTION in_slice(pos, lb, ub)
RESULT(internal)
110 INTEGER,
DIMENSION(3),
INTENT(IN) :: pos, lb, ub
113 IF (all(pos >= lb) .AND. all(pos <= ub))
THEN
119 END FUNCTION in_slice
132 TYPE(particle_type),
DIMENSION(:),
INTENT(IN) :: part
133 TYPE(cell_type),
POINTER :: box
134 INTEGER,
DIMENSION(:, :),
INTENT(OUT) :: center
135 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: delta
136 INTEGER,
DIMENSION(:),
INTENT(IN) :: npts
137 INTEGER,
INTENT(IN) :: n
141 REAL(kind=
dp),
DIMENSION(3) :: ca, gp, s
146 rmp = real(mp, kind=
dp)
147 DO ipart = 1,
SIZE(part)
152 gp = real(npts, kind=
dp)*s
154 IF (mod(n, 2) == 0)
THEN
155 center(:, ipart) = int(gp + rmp) - mp
156 ca(:) = real(center(:, ipart), kind=
dp) + 0.5_dp
158 center(:, ipart) = nint(gp)
159 ca(:) = real(center(:, ipart), kind=
dp)
161 center(:, ipart) = center(:, ipart) + npts(:)/2
162 center(:, ipart) =
modulo(center(:, ipart), npts(:))
163 center(:, ipart) = center(:, ipart) - npts(:)/2
165 delta(:, ipart) = gp - ca(:)
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
subroutine, public real_to_scaled(s, r, cell)
Transform real to scaled cell coordinates. s=h_inv*r.
Defines the basic variable types.
integer, parameter, public dp
Define the data structure for the particle information.