Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reflect new file layout of .geom files in near_field #259

Merged
merged 3 commits into from
Jun 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions misc/near_field/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
#FC = ifort
#FFLAGS = -warn all -O3
#MPIFC = mpif90
#LIBS =
#MPILIBS= -L/opt/hpmpi/lib/linux_64 -lmpi

# ----- HP-UX
#FC = f90
#MPIFC = mpif90
#FFLAGS = +O3
#LIBS =
#MPILIBS = -L/opt/mpi/lib/hpux64/ -lmpio

# ---- GNU Fortran Compiler
FC = gfortran
FFLAGS = -O3 -ffast-math -funroll-loops $(EXTRA_FLAGS)
# -ffast-math causes IEEE_INVALID_FLAG in checknfsymm, this is probably OK but safer is to skip this optimization
FFLAGS = -O3 -funroll-loops $(EXTRA_FLAGS)
# depending on your MPI implementation you may need one of the following (either special compiler wrapper, which takes
# care of libraries), or standard compiler with explicit specification of MPI Fortran libraries
# MPIFC = mpifort
MPIFC = $(FC)
LIBS =
MPILIBS= -lfmpich2g
# You might need something like the following on Windows (with MinGW)
#MPILIBS += -I"C:/Program Files/MPICH2/include"
Expand Down
3,750 changes: 1,875 additions & 1,875 deletions misc/near_field/RUNTESTS/box11/nearfieldX_yz.DAT.ref

Large diffs are not rendered by default.

2,878 changes: 1,439 additions & 1,439 deletions misc/near_field/RUNTESTS/box11/nearfieldY_xy.DAT.ref

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion misc/near_field/RUNTESTS/box11/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if [ $ERR -ne 0 ]; then
echo "ADDA returned error $ERR"
exit $ERR
fi
#grep "#@#" adda.out > commvar
mv box.geom target
echo '------------gendip--------------'
../../gendip > gendip.out
Expand Down
9 changes: 9 additions & 0 deletions misc/near_field/RUNTESTS/coated/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.xf
*.xmgr
inputl
line_input
line_points
nearfield_line.DAT
nearfield_[x-y][y-z].DAT
plane_points_[x-y][y-z]
plane_input_[x-y][y-z]
2 changes: 2 additions & 0 deletions misc/near_field/RUNTESTS/coated/clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
rm -f *.out *-X *-Y *.xf *_xy *.SAV *.DAT log mueller err.dat target *.xmgr inputl line_*
3 changes: 3 additions & 0 deletions misc/near_field/RUNTESTS/coated/commvar
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
15.707963 WAVENUM #@#
0 0 1 DIRECTION #@#
0 1 0 POLARIZATION #@#
351 changes: 351 additions & 0 deletions misc/near_field/RUNTESTS/coated/nearfield_line.DAT.ref

Large diffs are not rendered by default.

3,136 changes: 3,136 additions & 0 deletions misc/near_field/RUNTESTS/coated/nearfield_xy.DAT.ref

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions misc/near_field/RUNTESTS/coated/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
echo '------------adda----------------'
$ADDABIN -store_beam -store_dip_pol -save_geom -dir . -prop 0 0 1 -pol cm -lambda 0.400 -m 0.5 2 2 0.2 -shape coated 0.5 -eps 9 -dpl 100 -grid 16 &> adda.out
ERR=$?
if [ $ERR -ne 0 ]; then
echo "ADDA returned error $ERR"
exit $ERR
fi
mv coated.geom target
echo '------------gendip-------------------'
../../gendip > gendip.out
echo '------------genplane-------------------'
cat >plane_input_xy <<%EOF%
8.0 3
-20.0 35.0 55
-20.0 35.0 55
%EOF%
../../genplane < plane_input_xy > plane_points_xy
echo '------------nearfield------------'
cat >input_xy <<%EOF%
DIPY.SAV
400 ! lambda
plane_points_xy
nearfield_xy
1 !eincflag
0 !iformat
1 !debug
0 !internal
%EOF%
$MPIEXEC ../../nearfield < input_xy > nearfield.out

echo -------------verifying-------------
../../checknfsymm < input_xy > checknfsymm.out

echo ------------genline----------------
cat > line_input <<%EOF%
-10 7.5 7.5
25 7.5 7.5
-10 25 350
%EOF%
../../genline < line_input > line_points
echo ------------nearfieldline----------
cat >inputl <<%EOF%
DIPY.SAV
400 ! lambda
line_points
nearfield_line
0 !eincflag
0 !iformat
0 !debug
0 !internal
%EOF%
$MPIEXEC ../../nearfield < inputl > nearfieldl.out

grep ERROR gendip.out > err.dat
grep ERROR nearfield.out | grep -v _SZ >> err.dat
grep ERROR checknfsymm.out | grep -v _SZ >> err.dat
awk '{ ZUM+=$3 } END { printf "%.12f\n", ZUM} ' err.dat

paste nearfield_xy.DAT nearfield_xy.DAT.ref | awk '{ SUM+=($4-$8)*($4-$8)} END { printf "%.12f\n", SUM}'
paste nearfield_line.DAT nearfield_line.DAT.ref | awk '{ SUM+=($4-$8)*($4-$8)} END { printf "%.12f\n", SUM}'
1 change: 0 additions & 1 deletion misc/near_field/RUNTESTS/readsphere/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ if [ $ERR -ne 0 ]; then
exit $ERR
fi
mv read.geom target
#grep "#@#" adda.out > commvar
echo '------------gendip-------------------'
../../gendip > gendip.out
echo '------------genplane-------------------'
Expand Down
3 changes: 1 addition & 2 deletions misc/near_field/RUNTESTS/sop/run
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash
echo '------------adda----------------'
$ADDABIN -store_beam -store_dip_pol -store_int_field -save_geom -dir . -prop -1 0 0 -pol cm -lambda 0.300 -m 0.5 5.0 -shape read target.in -eps 9 -size 0.030 &> adda.out
$ADDABIN -store_beam -store_dip_pol -store_int_field -save_geom -dir . -prop -1 0 0 -pol cm -lambda 0.300 -m 0.5 5.0 -shape read target.in -eps 9 -size 0.030 -grid 20 &> adda.out
ERR=$?
if [ $ERR -ne 0 ]; then
echo "ADDA returned error $ERR"
exit $ERR
fi
mv read.geom target
#grep "#@#" adda.out > commvar
echo '------------gendip-------------------'
../../gendip > gendip.out
echo '------------genplane-------------------'
Expand Down
3 changes: 1 addition & 2 deletions misc/near_field/RUNTESTS/sphereinternal/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ if [ $ERR -ne 0 ]; then
echo "ADDA returned error $ERR"
exit $ERR
fi
#grep "#@#" adda.out > commvar
mv sphere.geom target
tail -n+4 target > target.tmp
grep -v '^#' target > target.tmp
nump=`wc -l target.tmp`
cat >hh <<%EOF%
0
Expand Down
24 changes: 14 additions & 10 deletions misc/near_field/gendip.f
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subroutine createdip(fdipin,fdipout,iout,fbeam,ffie)
& bCXPL2I,bCXPL3R,bCXPL3I

integer xi,yj,zk
integer OS
integer OS,skipped,line
complex*16, allocatable :: CXPOL(:,:)
complex*16, allocatable :: INCBEAM(:,:)
complex*16, allocatable :: FIELD(:,:)
Expand Down Expand Up @@ -75,25 +75,29 @@ subroutine createdip(fdipin,fdipout,iout,fbeam,ffie)
write(*,*) 'Reading target ...'
!---------------------get number of dipoles-------------------------
OS=0
skipped=0
open(UNIT=3114,FILE='target',STATUS='OLD',ERR=900)
read(3114,*)
read(3114,*)
read(3114,*)
! both # and Nmat in the beginning of a line should cause error in the following
399 read(3114,*,ERR=400,END=200) xi,yj,zk
goto 401
400 write(*,*) 'NMAT>1'
OS=OS+1
goto 399
401 OS=OS+1
400 if (OS.eq.0) then
skipped=skipped+1
else
line=skipped+OS+1
write(*,*) ' ERROR!: Wrong format of target at line',line
stop
endif
goto 399
200 write(*,*) 'Readed Dipoles',OS
close(3114)

!-------------------------------------------------------------------
write(*,*)
open(UNIT=3114,FILE='target',STATUS='OLD',ERR=900)
read(3114,*)
read(3114,*)
read(3114,*)
do i=1,skipped
read(3114,*)
enddo

iext=0
open(UNIT=3115,FILE=fbeam,STATUS='OLD',iostat=iosb)
Expand Down