SUSUKITA, Ryutaro1
M2 library is a library to use MDGRAPE-2 boards.
A unit is a logical unit resources of one or more MDGRAPE-2 boards are allocated for. Units have all data necessary to use MDGRAPE-2. For units, M2 library provides the following functions and subroutines. The function names and constant names used for the functions and the subroutines are declared in 'm2_unit.h'.
CHARACTER*(*) FUNCTION
INTEGER MODE
DOUBLE PRECISION LOWER
DOUBLE PRECISION UPPER
INTEGER NUM_PIPELINES
M2_ALLOCATE_UNIT allocates a unit. Resources which are not currently allocated for other units and groups (see section 2) are allocated.
FUNCTION specifies the function table which corresponds the force function or a potential function calculated by the unit. M2 library includes the function tables listed in Table 1.
MODE must be M2_FORCE or M2_POTENTIAL if the function represents a force or a potential, respectively.
LOWER and UPPER specify the range which includes coordinates of positions of particles which appear in the calculation of force or potential. LOWER and UPPER must be less and greater than all the coordinates, respectively. If the specified range is wider than it must be, the accuracy of the calculation may not be optimized.
NUM_PIPELINES specifies the number of pipelines allocated for the unit.
The environment variable M2_ON specifies a list of boards. The
pipelines on only the boards are allowed to be allocated for the unit.
M2_ON must be a list of board numbers or ranges of board
numbers. The numbers or the ranges must be separated by ,. A
range of
-
is equivalent to
,...,
. If M2_ON is not set, all boards are allowed to be
allocated.
The environment variable M2_SIZE specifies the number of boards if NUM_PIPELINES is NULL_INTEGER. The pipelines on boards of the number are allocated for the unit. If M2_SIZE is not set, pipelines on all boards are allocated.
The particle offset of the unit is set to 0.
M2_ALLOCATE_UNIT returns a non-zero integer which points to the unit on success. It returns 0 on failure.
CHARACTER*(*) FUNCTION
INTEGER MODE
DOUBLE PRECISION PERIOD
INTEGER NUM_PIPELINES
M2_ALLOCATE_PERIODIC_UNIT is similar to M2_ALLOCATE_UNIT except that PERIOD specifies the period of the unit.
INTEGER UNIT
M2_FREE_UNIT frees the unit UNIT.
INTEGER UNIT
M2_GET_NUM_PIPELINES returns the number of pipelines allocated for the unit UNIT.
INTEGER UNIT
DOUBLE PRECISION FUNCTION F(W)
DOUBLE PRECISION W
M2_SET_HOST_FUNCTION sets the Fortran function which corresponds to a force function or a potential function calculated by the unit UNIT to F. M2 library includes the Fortran functions listed in Table 1.
INTEGER UNIT
DOUBLE PRECISION RJ(3, N)
INTEGER N
M2_SET_POSITIONS sets the position of particle
, ..., the
position of particle
of the unit UNIT to
RJ, where
is the particle offset of the unit. RJ(1,
J), RJ(2, J) and RJ(3, J) specify the x, y and z
coordinates of the position of particle
,
respectively. If M2_SET_CELLS was not called and the particle
offset of the unit is 0, M2_SET_POSITIONS sets the number of
the cells of the unit to 1 and the base and sets the number of the
particles of cell 0 to 0 and N, respectively.
INTEGER UNIT
DOUBLE PRECISION A
M2_SET_RSCALE set the rscale of the unit UNIT to A. A must be 0 or positive.
INTEGER UNIT
DOUBLE PRECISION AJ(N)
INTEGER N
M2_SET_RSCALES sets the rscale of particle
, ..., the
rscale of particle
of the unit UNIT to AJ(1), ..., AJ(N), respectively, where
is the particle
offset of the unit. AJ(1), ..., AJ(N) must be 0 or
positive. If any two of the charge, the softening and the neighbor
radius of each particle of the unit were set, M2_SET_RSCALES
fails.
INTEGER UNIT
DOUBLE PRECISION ACICJ(NCJ, NCI)
INTEGER NCI
INTEGER NCJ
M2_SET_RSCALE_MATRIX sets the rscale matrix of the unit UNIT to an
matrix whose component (
,
) is specified by ACICJ(J, I). ACICJ(1,
1), ..., ACICJ(NCJ, 1), ..., ACICJ(1, NCI), ..., ACICJ(NCJ, NCI) must be 0 or positive. If any two of charge matrix,
softening matrix and neighbor radius matrix of the unit were set, M2_SET_RSCALE_MATRIX fails.
INTEGER UNIT
DOUBLE PRECISION B
M2_SET_CHARGE set the charge of the unit UNIT to B.
INTEGER UNIT
DOUBLE PRECISION BJ(N)
INTEGER N
M2_SET_CHARGES sets the charge of particle
, ..., the
charge of particle
of the unit UNIT to BJ(1), ..., BJ(N), respectively, where
is the particle
offset of the unit. If any two of the rscale, the softening
and the neighbor radius of each particle of the unit were set, M2_SET_CHARGES fails.
INTEGER UNIT
DOUBLE PRECISION BCICJ(NCJ, NCI)
INTEGER NCI
INTEGER NCJ
M2_SET_CHARGE_MATRIX sets the charge matrix of the unit UNIT to an
matrix whose component (
,
) is specified by BCICJ(J, I). If any two of
rscale matrix, softening matrix and neighbor radius matrix of the
unit were set, M2_SET_CHARGE_MATRIX fails.
INTEGER UNIT
INTEGER CJ(N)
INTEGER N
M2_SET_TYPES sets the types of particle
, ..., the
type of particle
of the unit UNIT to CJ(1), ..., CJ(N), respectively, where
is the particle
offset of the unit.
INTEGER UNIT
INTEGER CI(N)
INTEGER N
M2_SET_PIPELINE_TYPES sets the types of the particles on which
forces are calculated by M2_CALCULATE_FORCES or whose
potentials are calculated by M2_CALCULATE_POTENTIAL
afterwards. UNIT specifies the unit. CI(1), ..., CI(N)
specify the type of particle 0, ..., the type of particle
, respectively.
INTEGER UNIT
DOUBLE PRECISION E
M2_SET_SOFTENING sets the softening of the unit UNIT to E.
INTEGER UNIT
DOUBLE PRECISION EJ(N)
INTEGER N
M2_SET_SOFTENINGS sets the softening of particle
, ..., the
softening of particle
of the unit UNIT to EJ(1), ..., EJ(N), respectively, where
is the particle
offset of the unit. If any two of the rscale, the charge and the
neighbor radius of each particle of the unit were set, M2_SET_SOFTENINGS fails.
INTEGER UNIT
DOUBLE PRECISION ECICJ(NCJ, NCI)
INTEGER NCI
INTEGER NCJ
M2_SET_SOFTENING_MATRIX sets the softening matrix of the unit UNIT to an
matrix whose component (
,
) is specified by ECICJ(J, I). If any two of
rscale matrix, charge matrix and neighbor radius matrix of the unit
were set, m2_set_softening_matrix fails.
INTEGER UNIT
INTEGER EI(N)
INTEGER N
M2_SET_PIPELINE_SOFTENINGS sets the softenings of the
particles on which forces are calculated by M2_CALCULATE_FORCES or whose potentials are calculated by M2_CALCULATE_POTENTIAL afterwards. UNIT specifies the
unit. EI(1), ..., EI(N) specify the softening of particle
0, ..., the softening of particle
, respectively.
INTEGER UNIT
INTEGER OFFSET
M2_SET_PARTICLE_OFFSET sets the particle offset of the unit UNIT to OFFSET.
INTEGER UNIT
INTEGER BASES(N)
INTEGER SIZES(N)
INTEGER N
M2_SET_CELLS sets cell 0, ..., cell
of the unit
UNIT to BASES(1), SIZES(1), ..., BASES(N), SIZES(N), respectively.
BASES(K) and SIZES(K) specify the
base and the number of the particles of cell K, respectively.
INTEGER UNIT
DOUBLE PRECISION H
M2_SET_NEIGHBOR_RADIUS sets the neighbor radius of the unit UNIT to H. H must be 0 or positive.
INTEGER UNIT
DOUBLE PRECISION HJ(N)
INTEGER N
M2_SET_NEIGHBOR_RADII sets the neighbor radius of particle
, ..., the neighbor radius of particle
of the
unit UNIT to HJ(1), ..., HJ(N), respectively, where
is the particle offset of the unit. HJ(1), ..., HJ(N) must be 0 or positive. If any two of the rscale, the charge and
the softening of each particle of the unit were set, M2_SET_NEIGHBOR_RADII fails.
INTEGER UNIT
DOUBLE PRECISION HCICJ(NCJ, NCI)
INTEGER NCI
INTEGER NCJ
M2_SET_NEIGHBOR_RADIUS_MATRIX sets the neighbor radius
matrix of the unit UNIT to an
matrix whose component (
,
) is specified by HCICJ(J, I). HCICJ(1, 1), ..., HCICJ(NCJ, 1), ..., HCICJ(1, NCI), ..., HCICJ(NCJ, NCI) must be 0 or positive. If
any two of rscale matrix, charge matrix and softening matrix of the
unit were set, M2_SET_NEIGHBOR_RADIUS_MATRIX fails.
INTEGER UNIT
INTEGER HI(N)
INTEGER N
M2_SET_PIPELINE_NEIGHBOR_RADII sets the neighbor radii of
the particles on which forces are calculated by M2_CALCULATE_FORCES or whose potentials are calculated by M2_CALCULATE_POTENTIAL afterwards. UNIT specifies the
unit. HI(1), ..., HI(N) specify the neighbor radius of
particle 0, ..., the neighbor radius of particle
,
respectively. HI(1), ..., HI(N) must be 0 or positive.
INTEGER UNIT
DOUBLE PRECISION RI(3, N)
INTEGER N
DOUBLE PRECISION FI(3, N)
M2_CALCULATE_FORCES calculates the force exerted on each given particle and searches for neighbors of the particle.
UNIT specifies the unit which calculates and searches.
RI specifies the position of particle
0, ..., the position of particle
. RI(1, I), RI(2, I) and RI(3, I) specify the x, y and z
coordinates of the position of particle
, respectively.
The force exerted on the given particle
is calculated as
| the number of the cells | |
| the base of cell |
|
| the number of the particles of cell |
|
| the force function |
As neighbors of the given particle
, particles of the unit which
satisfy
are searched for, where the
coefficient
is determined in a similar way to
except that
is determined from neighbor radius.
FI returns
, ...,
. FI(1, I), FI(2, I) and FI(3, I) returns the x, y and z
coordinate of
, respectively.
INTEGERS UNIT
DOUBLE PRECISION RI(3, N)
INTEGERS N
DOUBLE PRECISION PI(N)
M2_CALCULATE_POTENTIALS is similar to M2_CALCULATE_FORCES except that the potential of each given
particle is calculated. The potential of the given particle
is
calculated as
INTEGER UNIT
DOUBLE PRECISION RI(3, N)
INTEGER N
DOUBLE PRECISION FI(3, N)
M2_START_FORCE_CALCULATION is similar to M2_CALCULATE_FORCES except that FI returns the forces after M2_WAIT_CALCULATION is called for the unit UNIT and FI may not return the forces if any elements of RI is changed before m2_wait_calculation is called for the unit UNIT.
INTEGERS UNIT
DOUBLE PRECISION RI(3, N)
INTEGERS N
DOUBLE PRECISION PI(N)
M2_START_POTENTIAL_CALCULATION is similar to M2_CALCULATE_POTENTIALS except that PI returns the potentials after M2_WAIT_CALCULATION is called for the unit UNIT and PI may not return the potentials if any element of RI is changed before m2_wait_calculation is called for the unit UNIT.
INTEGER UNIT
See M2_START_FORCE_CALCULATION and M2_START_POTENTIAL_CALCULATION.
INTEGER UNIT
INTEGER NLI(N)
INTEGER N
INTEGER L(NL)
INTEGER NL
M2_GET_NEIGHBORS is called to get the neighbors which were found by M2_CALCULATE_FORCES or M2_CALCULATE_POTENTIALS.
UNIT specifies the unit which found the neighbors.
NLI(1), ..., NLI(N) returns
offsets in L to be referred to as follows: L(1), ...,
L(NLI(1)) return the particle numbers of the neighbors of
particle 0, respectively. ... L(NLI(N - 1) + 1), ..., L(NLI(N)) return the particle numbers of the neighbors of particle N - 1, respectively. If
, the particle numbers of
the neighbors of particle
are not returned.
A group is a group of units resources of one or more MDGRAPE-2 boards are allocated for. For groups, M2 library provides the following functions. The function names and constant names for the functions are declared in 'm2_group.h'.
INTEGER NUM_PIPELINES
M2_ALLOCATE_GROUP allocates a group which has no units. Pipelines which are not currently allocated for other unit groups and units are allocated. The number of allocated pipelines is determined in a similar way to M2_ALLOCATE_UNIT. M2_ALLOCATE_GROUP returns a non-zero integer which points to the group on success. It returns 0 on failure.
INTEGER GROUP
CHARACTER*(*) FUNCTION
INTEGER MODE
DOUBLE PRECISION LOWER
DOUBLE PRECISION UPPER
INTEGER NUM_PIPELINES
INTEGER PRIVATE
M2_ALLOCATE_MEMBER is similar to M2_ALLOCATE_UNIT except that the allocated unit becomes a member of the group GROUP and quantities of the unit PRIVATE does not specify may be shared. If a quantity is shared, a library function called to set the quantity of the unit also set the same quantities of other member units of the group. If a quantity is not shared, it is private. PRIVATE must be 0, NULL_INTEGER or the sum of one or more of the following flags:
| flag | quantity of unit |
| M2_POSITIONS | positions of particles |
| M2_RSCALE | rscale |
| M2_RSCALES | rscales of particles |
| M2_RSCALE_MATRIX | rscale matrix |
| M2_CHARGE | charge |
| M2_CHARGES | charges of particles |
| M2_CHARGE_MATRIX | charge matrix |
| M2_NEIGHBOR_RADIUS | neighbor radius |
| M2_NEIGHBOR_RADII | neighbor radii of particles |
| M2_NEIGHBOR_RADIUS_MATRIX | neighbor radius matrix |
| M2_SOFTENING | softening |
| M2_SOFTENINGS | softenings of particles |
| M2_SOFTENING_MATRIX | softening matrix |
| M2_TYPES | types of particles |
| M2_CELLS | cells |
| M2_PARTICLE_OFFSET | particle offset |
INTEGER GROUP
CHARACTER*(*) FUNCTION
INTEGER MODE
DOUBLE PRECISION PERIOD
INTEGER NUM_PIPELINES
INTEGER PRIVATE
M2_ALLOCATE_PERIODIC_MEMBER is similar to M2_ALLOCATE_MEMBER except that PERIOD specifies the period of the unit.
INTEGER GROUP
M2_FREE_GROUP frees all member units of the group GROUP and the group.
INTEGER GROUP
M2_GET_NUM_GROUP_PIPELINES returns the number of pipelines allocated for the group GROUP.
INTEGER GROUP
DOUBLE PRECISION RJ(3, N)
INTEGER N
M2_SET_MEMBER_POSITIONS is equivalent to calling M2_SET_POSITIONS for each member unit of the group GROUP.
INTEGER GROUP
M2_WAIT_MEMBER_CALCULATION is equivalent to calling M2_WAIT_CALCULATION for each member unit of the group GROUP.
This document was generated using the LaTeX2HTML translator Version 99.2beta6 (1.42)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 fortran_document
The translation was initiated by on 2001-05-10