Hi,
I made a slight err in my previous post (1 a.m., sorry):
> One way I envisage to deal with this is to make n_dim a PARAMETER
> (using
> conditional compilation or macros to replace with 2,3,4 etc.), and
> then
> put the code inside SELECT CASE statements where the cases n_dim=2 and
>
> n_dim=3 and the general case would be handled explicitly.
This should have been: *Either* make n_dim a PARAMETER (so it is
replaced at compile time by the compiler), *or* use a SELECT CASE
clause. The second is more versatile as recompilation is not needed, but
I am not sure if it would do the desired effect.
Thanks,
Aleksandar
> ! All arrays have a first dimension of n_dim, usually 2 or 3
> ! This is not quite true Fortran 95...
> FindNeighbours: DO sphere=1, _n_spheres
> DO neighbour=sphere+1, _n_spheres
>
> direction=_nodes_coordinates[:,neighbour]-_nodes_coordinates[:,sphere];
>
>
> reduced_direction=direction-ANINT(direction/_box_lengths)*_box_lengths
>
>
> IF(ANY(ABS(direction-reduced_direction)>=(0.5_r_wp-packing%gap_tolerance)*_box_lengths))
> THEN
> boundary_contact=.TRUE.
> ELSE @;
> boundary_contact=.FALSE.
> END IF @;
> direction=reduced_direction
> distance=SQRT(SUM(direction^2))
> END DO
> END DO FindNeighbours
--
__________________________________
Aleksandar Donev
Complex Materials Theory Group (http://cherrypit.princeton.edu/)
Princeton Materials Institute & Program in Applied and Computational Mathematics
@ Princeton University
Address:
419 Bowen Hall, 70 Prospect Avenue
Princeton University
Princeton, NJ 08540-5211
E-mail: [log in to unmask]
WWW: http://atom.princeton.edu/donev
Phone: (609) 258-2775
Fax: (609) 258-6878
__________________________________
|