TABLE OF CONTENTS


ABINIT/m_per_cond [ Modules ]

[ Top ] [ Modules ]

NAME

  m_per_cond

FUNCTION

  This module contains basic tools for periodic conditions traitement.

COPYRIGHT

 Copyright (C) 2008-2024 ABINIT group (MM)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

OUTPUT

SOURCE

20 #if defined HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include "abi_common.h"
25 
26 MODULE m_per_cond
27 
28  use defs_basis
29  use m_abicore
30 
31  implicit none
32 
33  private
34 
35  public :: per_cond   ! Return an arithmetic progression
36  public :: per_dist   ! Return the distance on a periodic grid
37 
38 
39  interface per_cond
40   module procedure per_cond_re
41   module procedure per_cond_int
42   module procedure per_cond_int3
43  end interface per_cond
44 
45  interface per_dist
46   module procedure per_dist_int
47   module procedure per_dist_int1
48   module procedure per_dist_int3
49  end interface per_dist
50 
51 CONTAINS  !===========================================================

m_per_cond/per_cond_int [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_cond_int

FUNCTION

 Given a 2d-array of integer initial(3,nb), it calulates the values
 of any of the array in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid(3)

INPUTS

  initial(1:3,0:nb-1)=initial point
  dim_grid(1:3)= box lengths
  nb= dimension
  metric=is the factor scale of the box axes

OUTPUT

  per_cond_int= initial in the box

SOURCE

120 function per_cond_int(nb,initial,dim_grid)
121 
122 !Arguments ------------------------------------
123 !scalars
124  integer,intent(in) :: nb
125  integer,intent(in) :: dim_grid(3)
126  integer :: per_cond_int(3,0:nb-1)
127  integer, intent(in) :: initial(3,0:nb-1)
128 
129 !Local variables-------------------------------
130  integer :: ii,jj
131 
132 ! *********************************************************************
133  do jj=0,nb-1
134   do ii=1,3
135    per_cond_int(ii,jj)=modulo(initial(ii,jj),dim_grid(ii))
136   end do
137  end do
138 
139 
140 end function per_cond_int

m_per_cond/per_cond_int3 [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_cond_int3

FUNCTION

 Given a 2d-array of integer initial(3,nb), it calulates the values
 of any of the array in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid(3)

INPUTS

  initial(1:3,0:nb-1)=initial point
  dim_grid(1:3)= box lengths
  nb= dimension
  metric=is the factor scale of the box axes

OUTPUT

  per_cond_int3= initial in the box

SOURCE

164 function per_cond_int3(initial,dim_grid)
165 
166 !Arguments ------------------------------------
167 !scalars
168  integer,intent(in) :: dim_grid(3)
169  integer :: per_cond_int3(3)
170  integer,intent(in) :: initial(3)
171 
172 
173 !Local variables-------------------------------
174  integer :: ii
175 
176 ! *********************************************************************
177 
178  do ii=1,3
179   per_cond_int3(ii) = modulo(initial(ii),dim_grid(ii))
180  end do
181 
182 end function per_cond_int3

m_per_cond/per_cond_re [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_cond_re

FUNCTION

 Given a 2d-array of integer initial(3,nb), it calulates the values
 of any of the array in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid(3)

INPUTS

  initial(1:3,0:nb-1)=initial point
  dim_grid(1:3)= box lengths
  nb= dimension
  metric=is the factor scale of the box axes

OUTPUT

  per_cond_re= initial in the box

SOURCE

75 function per_cond_re(nb,initial,dim_grid,metric)
76 
77 !Arguments ------------------------------------
78 !scalars
79  integer,intent(in) :: nb
80  integer,intent(in) :: dim_grid(3)
81  integer :: per_cond_re(3,0:nb-1)
82  real(dp),intent(in) :: initial(3,0:nb-1)
83  real(dp),intent(in) :: metric(1:3)
84 
85 !Local variables-------------------------------
86  integer :: ii,jj
87 
88 ! *********************************************************************
89  do jj=0,nb-1
90   do ii=1,3
91    per_cond_re(ii,jj)=modulo(nint(initial(ii,jj)/metric(ii)),dim_grid(ii))
92   end do
93  end do
94 
95 
96 end function per_cond_re

m_per_cond/per_dist_int [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_dist_int

FUNCTION

 Given a two 2d-array of integer initA(3,nb),initB(3,nb) in the
 periodic grid, it calulates the values
 of any of the distances in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid(3)

INPUTS

  initA(1:3,0:nb-1)=initial point
  initB(1:3,0:nb-1)=initial point
  dim_grid(1:3)= box lengths
  nb= dimension

OUTPUT

  per_dist_int= initial in the box

SOURCE

207 function per_dist_int(nb,initA,initB,dim_grid)
208 
209 !Arguments ------------------------------------
210 !scalars
211  integer,intent(in) :: nb
212  integer,intent(in) :: dim_grid(3)
213  integer :: per_dist_int(3,0:nb-1)
214  integer,intent(in) :: initA(3,0:nb-1),initB(3,0:nb-1)
215 
216 
217 !Local variables-------------------------------
218  integer :: ii,jj, bo
219 
220 ! *********************************************************************
221  do jj=0,nb-1
222   do ii=1,3
223    bo = abs(initA(ii,jj)-initB(ii,jj))
224    per_dist_int(ii,jj) = minval((/ bo,dim_grid(ii)-bo/))
225   end do
226  end do
227 
228 
229 end function per_dist_int

m_per_cond/per_dist_int1 [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_dist_int1

FUNCTION

 Given a two scalars of integer initA,initB in the
 periodic grid, it calulates the values
 of any of the distances in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid

INPUTS

  initA=initial point
  initB=initial point
  dim_grid= box lengths

OUTPUT

  per_dist_int1= initial in the box

SOURCE

254 function per_dist_int1(initA,initB,dim_grid)
255 
256 !Arguments ------------------------------------
257 !scalars
258  integer,intent(in) :: dim_grid,initA,initB
259  integer :: per_dist_int1
260 
261 
262 !Local variables-------------------------------
263  integer :: bo
264 
265 ! *********************************************************************
266  bo = abs(initA-initB)
267  per_dist_int1 = minval((/ bo,dim_grid-bo/))
268 
269 end function per_dist_int1

m_per_cond/per_dist_int3 [ Functions ]

[ Top ] [ m_per_cond ] [ Functions ]

NAME

  per_dist_int3

FUNCTION

 Given a two 3d-vector of integer initA(3),initB(3) in the
 periodic grid, it calulates the values
 of any of the distances in the periodic orthogonal discretized
 grid begining in 0 and of lengths dim_grid(3)

INPUTS

  initA(1:3)=initial point
  initB(1:3)=initial point
  dim_grid(1:3)= box lengths

OUTPUT

  per_dist_int3= initial in the box

SOURCE

294 function per_dist_int3(initA,initB,dim_grid)
295 
296 !Arguments ------------------------------------
297 !scalars
298  integer,intent(in) :: dim_grid(3)
299  integer :: per_dist_int3(3)
300  integer,intent(in) :: initA(3),initB(3)
301 
302 
303 !Local variables-------------------------------
304  integer :: ii, bo
305 
306 ! *********************************************************************
307  do ii=1,3
308   bo = abs(initA(ii)-initB(ii))
309   per_dist_int3(ii) = minval((/ bo,dim_grid(ii)-bo/))
310  end do
311 
312 end function per_dist_int3