fj wrote:
> On 23 juil, 07:51, Fatemeh <fateme.mirj...@[EMAIL PROTECTED]
> wrote:
>> Dear all;
>> I have written a simple program and called FFTW in it.
>> but I envisaged Segmentation Fault after "CALL dfftw_execute(plan)"
>> Is there anyone who can guide me where have I made a mistake?
>> ------------------------
>> program test
>> implicit none
>> include "fftw3.f"
>> integer::u,jatom,nat,h,functn,pp,ind1,ind2,ind3,nx,ny,nz,counter
>> real::i,j,k,rx,ry,rz,originx,originy,originz,te,tee
>> real,allocatable::struct(:,:),tau(:,:),r0(:,:)
>> complex,dimension(100,100,100)::dat,der
>> INTEGER*8 plan
>> read(88,*)nat
>> allocate(struct(nat,6),tau(4,3),r0(nat,3))
>> do pp=1,4
>> read(55,*)(tau(pp,h),h=1,3)
>> end do
>> originx=tau(3,1)
>> originy=tau(3,2)
>> originz=tau(3,3)
>> do jatom=1,nat
>> r0(jatom,1)=tau(jatom,1)-originx
>> r0(jatom,2)=tau(jatom,2)-originy
>> r0(jatom,3)=tau(jatom,3)-originz
>> read(666,*)(struct(jatom,h),h=1,6)
>> end do
>> nx=100;ny=100;nz=100
>> counter=1
>> i=0;j=0;k=0
>> do ind1=1,nx
>> i=i+0.1065
>> do ind2=1,ny
>> j=j+0.1065
>> do ind3=1,nz
>> k=k+0.1065
>> rx=i-originx
>> ry=j-originy
>> rz=k-originz
>> u=0
>> do jatom=1,nat
>> tee=struct(jatom,4) !*0.529177249
>> te=sqrt((rx-r0(jatom,1))**2+(ry-r0(jatom,2))**2+(rz-
>> r0(jatom,3))**2)
>> if (te.GT.tee) u=u+1
>> end do
>> if (u==3)then
>> dat(ind1,ind2,ind3)=(1.0,0.0)
>> else
>> dat(ind1,ind2,ind3)=(0.0,0.0)
>> end if
>> write(36,*)dat(ind1,ind2,ind3)
>> counter=counter+1
>> end do
>> k=0
>> end do
>> j=0
>> end do
>> CALL
>> dfftw_plan_dft_3d(plan,nx,ny,nz,dat,der,FFTW_BACKWARD,FFTW_ESTIMATE)
>> print*,"111"
>> CALL dfftw_execute(plan)
>> print*,"222"
>> CALL dfftw_destroy_plan(plan)
>> print*,"END"
>> end program test
>> ------------------------------------
>> the program can print "111" , but it isn't able to print "222".
>>
>> I'm anxiously looking forward your reply and guidelines.
>> with best regards,
>> Fatemeh
>
> Are you sure that the Real and Complex arrays are simple precision ?
> This is very unusual in scientific codes ! I don't know the FFTW
> library but I suspect the array declarations to be wrong :
>
> INTEGER, PARAMETER :: dp=SELECTED_REAL_KIND(15,100)
> REAL(dp) ,... :: ...
> COMPLEX(dp),... :: ...
How about dp=KIND(0.D0)?


|