Module ppm_module_neighlist

This module provides neighbor search routines (cell lists, Verlet lists).

Defined Types

name description

no types

Defined Module Interfaces

Defined Module Subroutines

name description

no subroutines

Interface ppm_clist_destroy

Subroutines contained in this interface:

name description

ppm_clist_destroy

Properly deallocates the cell list it is passed.

Interface ppm_neighlist_clist

Subroutines contained in this interface:

name description

ppm_neighlist_clist_d

Create cell lists for all subs of this processor.

ppm_neighlist_clist_s

Interface ppm_neighlist_mkneighidx

Subroutines contained in this interface:

name description

ppm_neighlist_mkneighidx

Creates the index offset list of cell interactions.

Interface ppm_neighlist_vlist

Subroutines contained in this interface:

name description

ppm_neighlist_vlist_d

Create Verlet lists for all particles of this processor.

ppm_neighlist_vlist_s

Subroutine ppm_clist_destroy

Properly deallocates the cell list it is passed.

[Note]Note

At least using pgf90, this routine is actually not necessary as DEALLOCATE(clist) would be sufficient (no memory leak would occur according to Valgrind). But since this might be a compiler-dependent feature we do it the orthodox way for the sake of portability.

Arguments

name type dimension intent optional description

clist

ppm_t_clist array

(:)

Cell list which is to be deallocated.

info

integer

(OUT)

Returns status, 0 upon success

clist

ppm_t_clist array, (:), no intent declared

Cell list which is to be deallocated.

info

integer, , (OUT)

Returns status, 0 upon success

Used Modules

ppm_module_data, ppm_module_error, ppm_module_typedef, ppm_module_alloc, ppm_module_substop, ppm_module_substart

Subroutine ppm_neighlist_clist_d

Create cell lists for all subs of this processor.

[Note]Note

Symmetry is used as follows:

                                  - 2 1
                                  - 0 2
                                  - - -

cell 0 interacts with all cells >0 cells 2 interact with each other.

In 3D, the top Layer (larger z) above the numbered 2 x 2 block is also included. (Plus the appropriate diagonal interactions. see MkNeighIdx).

The cell list is created for the current topology topoid, which is passed by the user

Particles in cell icell of sub isub are: LET a = clist(isub)%lhbx(icell) LET b = clist(isub)%lhbx(icell+1) + `clist(isub)%lpdx(a:b-1)

[Warning]Warning

the sub index isub is NOT the global sub number, but just linear from 1 to ppm_nsublist!

Arguments

name type dimension intent optional description

topoid

integer

(IN)

ID of current topology

xp

real array

(:,:)

(IN)

Particle co-ordinates

np

integer

(IN)

Number of particles

cutoff

real array

(:)

(IN)

Cutoff in all (2,3) space directions. Actual cell size may differ,

lsymm

logical

(IN)

Use symmetry?

clist

ppm_t_clist array

(:)

Cell list data structure

info

integer

(OUT)

Returns 0 upon success

pidx

integer array

(:)

X

Indices of those particles that are

topoid

integer, , (IN)

ID of current topology

xp

real array, (:,:), (IN)

Particle co-ordinates

np

integer, , (IN)

Number of particles

cutoff

real array, (:), (IN)

Cutoff in all (2,3) space directions. Actual cell size may differ, due to round-off, but it always >= cutoff.

lsymm

logical, , (IN)

Use symmetry?

clist

ppm_t_clist array, (:), no intent declared

Cell list data structure

info

integer, , (OUT)

Returns 0 upon success

(Optional) pidx

integer array, (:), no intent declared

Indices of those particles that are to be ranked. By default, all particles are ranked. If given, particle indices in cell list are relative to xp(:,pidx(:)) and not xp(:,:)

Used Modules

ppm_module_data, ppm_module_util_rank, ppm_module_error, ppm_module_typedef, ppm_module_alloc, ppm_module_check_id, ppm_module_substop, ppm_module_substart

Subroutine ppm_neighlist_clist_s

Arguments

name type dimension intent optional description

topoid

integer

(IN)

ID of current topology

xp

real array

(:,:)

(IN)

Particle co-ordinates

np

integer

(IN)

Number of particles

cutoff

real array

(:)

(IN)

Cutoff in all (2,3) space directions. Actual cell size may differ,

lsymm

logical

(IN)

Use symmetry?

clist

ppm_t_clist array

(:)

Cell list data structure

info

integer

(OUT)

Returns 0 upon success

pidx

integer array

(:)

X

Indices of those particles that are

topoid

integer, , (IN)

ID of current topology

xp

real array, (:,:), (IN)

Particle co-ordinates

np

integer, , (IN)

Number of particles

cutoff

real array, (:), (IN)

Cutoff in all (2,3) space directions. Actual cell size may differ, due to round-off, but it always >= cutoff.

lsymm

logical, , (IN)

Use symmetry?

clist

ppm_t_clist array, (:), no intent declared

Cell list data structure

info

integer, , (OUT)

Returns 0 upon success

(Optional) pidx

integer array, (:), no intent declared

Indices of those particles that are to be ranked. By default, all particles are ranked. If given, particle indices in cell list are relative to xp(:,pidx(:)) and not xp(:,:)

Used Modules

ppm_module_data, ppm_module_util_rank, ppm_module_error, ppm_module_typedef, ppm_module_alloc, ppm_module_check_id, ppm_module_substop, ppm_module_substart

Subroutine ppm_neighlist_mkneighidx

Creates the index offset list of cell interactions. The interaction for the cell with itself is always included as the first entry.

[Note]Note

If the loops do not vectorize, maybe we need to duplicate them and put IF(ppm_dim…) statements around!

[Warning]Warning

ind and jnd are allocated inside this routine! The lists are always (3 x nnd) since then no IF statements in the inner loop are needed to distinguish between 2D and 3D case. Since nnd is <28 anyway, this should not be too much of a memory waste.

Arguments

name type dimension intent optional description

lsymm

logical

(IN)

T for using symmetry, F for full list

ind

integer array

(:,:)

First interaction partner (box which interacts).

jnd

integer array

(:,:)

Second interaction partner (box which is interacted with).

nnd

integer

(OUT)

Number of box-box interactions to be performed.

info

integer

(OUT)

Returns status, 0 on success

lsymm

logical, , (IN)

T for using symmetry, F for full list

ind

integer array, (:,:), no intent declared

First interaction partner (box which interacts).

1st index: 1…3 (x,y,[z]) index shift. 2nd index: interaction number 1…nnd.

jnd

integer array, (:,:), no intent declared

Second interaction partner (box which is interacted with).

1st index: 1…3 (x,y,[z]) index shift. 2nd index: interaction number 1…nnd.

nnd

integer, , (OUT)

Number of box-box interactions to be performed.

info

integer, , (OUT)

Returns status, 0 on success

Used Modules

ppm_module_data, ppm_module_alloc, ppm_module_error, ppm_module_substop, ppm_module_substart

Subroutine ppm_neighlist_vlist_d

Create Verlet lists for all particles of this processor.

[Tip]Tip

Ghostparticles must be included when passing the positions xp and the array size np to generate Verlet lists for real/ghost interactions.

[Note]Note

The list needs to be rebuilt as soon as a particle has moved a distance larger than 0.5*skin. It is the users responsibility to detect when this is the case and call this routine again.

vlist and nvlist are allocated in this routine. The user just needs to pass pointers.

the two cases for lsymm have their own duplicated loops since the lsymm=F case does not vectorize. lsymm=T (using symmetry) however does.

[Note]Note

The VECTOR case was tested and found to vectorize on the NEC SX-5 even without compiler directives. Requires (almost) two repetitions of the main loops.

Arguments

name type dimension intent optional description

topoid

integer

(IN)

ID of current topology

xp

real array

(:,:)

(IN)

particle co-ordinates

np

integer

(IN)

number of particles.

cutoff

real

(IN)

cutoff radius for PP interactions

skin

real

(IN)

Verlet list skin layer thickness.

lsymm

logical

(IN)

Use symmetry

vlist

integer array

(:,:)

Verlet list. First index: particles with which particle ip interacts.

nvlist

integer array

(:)

Number of particles with which ip has to interact. Index: ip.

info

integer

(OUT)

Returns status, 0 upon success

pidx

integer array

(:)

X

OPTIONAL indices of those particles that are to be included in the

clist

ppm_t_clist array

(:)

X

Cell list data structure. Pass this argument as null to force

lstore

logical

(IN)

X

OPTIONAL Set this to .TRUE. to store (and return) the Verlet lists in

topoid

integer, , (IN)

ID of current topology

xp

real array, (:,:), (IN)

particle co-ordinates

np

integer, , (IN)

number of particles. The number of ghostparticles should be included to include interactions between real and ghost-particles.

cutoff

real, , (IN)

cutoff radius for PP interactions

skin

real, , (IN)

Verlet list skin layer thickness.

lsymm

logical, , (IN)

Use symmetry

vlist

integer array, (:,:), no intent declared

Verlet list. First index: particles with which particle ip interacts. Second index: ip. The second index only runs up to the largest ip with non-zero nvlist. This is to save memory since the last particles are the ghosts and they do not have a verlet list. This is only allocated and returned if lstore is .TRUE.

nvlist

integer array, (:), no intent declared

Number of particles with which ip has to interact. Index: ip.

info

integer, , (OUT)

Returns status, 0 upon success

(Optional) pidx

integer array, (:), no intent declared

OPTIONAL indices of those particles that are to be included in the list. By default all particles are taken. If given, particles indices in Verlet lists are relative to xp(:,pidx) and not xp(:,:)

(Optional) clist

ppm_t_clist array, (:), no intent declared

Cell list data structure. Pass this argument as null to force this routine to recreate a cell list and store it in clist. Otherwise, the cell list in clist is (re)used for the vlist being created. PPM will use internal data structures to store the clist if this argument is not passed.

[Note]Note

use ppm_destroy_clist to deallocate the cell list.

(Optional) lstore

logical, , (IN)

OPTIONAL Set this to .TRUE. to store (and return) the Verlet lists in vlist. If this is false, only nvlist is determined and returned. Default is .TRUE.

Used Modules

ppm_module_data, ppm_module_error, ppm_module_alloc, ppm_module_check_id, ppm_module_substop, ppm_module_write, ppm_module_substart

Subroutine ppm_neighlist_vlist_s

Arguments

name type dimension intent optional description

topoid

integer

(IN)

ID of current topology

xp

real array

(:,:)

(IN)

particle co-ordinates

np

integer

(IN)

number of particles.

cutoff

real

(IN)

cutoff radius for PP interactions

skin

real

(IN)

Verlet list skin layer thickness.

lsymm

logical

(IN)

Use symmetry

vlist

integer array

(:,:)

Verlet list. First index: particles with which particle ip interacts.

nvlist

integer array

(:)

Number of particles with which ip has to interact. Index: ip.

info

integer

(OUT)

Returns status, 0 upon success

pidx

integer array

(:)

X

OPTIONAL indices of those particles that are to be included in the

clist

ppm_t_clist array

(:)

X

Cell list data structure. Pass this argument as null to force

lstore

logical

(IN)

X

OPTIONAL Set this to .TRUE. to store (and return) the Verlet lists in

topoid

integer, , (IN)

ID of current topology

xp

real array, (:,:), (IN)

particle co-ordinates

np

integer, , (IN)

number of particles. The number of ghostparticles should be included to include interactions between real and ghost-particles.

cutoff

real, , (IN)

cutoff radius for PP interactions

skin

real, , (IN)

Verlet list skin layer thickness.

lsymm

logical, , (IN)

Use symmetry

vlist

integer array, (:,:), no intent declared

Verlet list. First index: particles with which particle ip interacts. Second index: ip. The second index only runs up to the largest ip with non-zero nvlist. This is to save memory since the last particles are the ghosts and they do not have a verlet list. This is only allocated and returned if lstore is .TRUE.

nvlist

integer array, (:), no intent declared

Number of particles with which ip has to interact. Index: ip.

info

integer, , (OUT)

Returns status, 0 upon success

(Optional) pidx

integer array, (:), no intent declared

OPTIONAL indices of those particles that are to be included in the list. By default all particles are taken. If given, particles indices in Verlet lists are relative to xp(:,pidx) and not xp(:,:)

(Optional) clist

ppm_t_clist array, (:), no intent declared

Cell list data structure. Pass this argument as null to force this routine to recreate a cell list and store it in clist. Otherwise, the cell list in clist is (re)used for the vlist being created. PPM will use internal data structures to store the clist if this argument is not passed.

[Note]Note

use ppm_destroy_clist to deallocate the cell list.

(Optional) lstore

logical, , (IN)

OPTIONAL Set this to .TRUE. to store (and return) the Verlet lists in vlist. If this is false, only nvlist is determined and returned. Default is .TRUE.

Used Modules

ppm_module_data, ppm_module_error, ppm_module_alloc, ppm_module_check_id, ppm_module_substop, ppm_module_write, ppm_module_substart

Defined Module Variables

name type dimension description

no variables

Used Modules

ppm_module_typedef