00001
00002
00003
00004 subroutine gencif(a1,a2,a3,amin,amax,bmin,bmax,cmin,cmax,nsi,cs,asi)
00005 use m_gencif_sub
00006 implicit none
00007 real(8),intent(in)::a1(3),a2(3),a3(3)
00008 integer,intent(in)::amin,amax,bmin,bmax,cmin,cmax
00009
00010 integer::nsi
00011 character(len=2)::cs(nsi)
00012 real(8)::asi(3,nsi)
00013
00014 integer::nkd
00015 character(len=2)::csr
00016 character(len=2),allocatable::csref(:)
00017 integer,allocatable::kd(:)
00018 real(8),allocatable::zn(:)
00019
00020 integer,allocatable::kd_sc(:)
00021 real(8),allocatable::asi_sc(:,:)
00022 real(8)::aa(3,3),aa_sc(3,3)
00023 integer::i,is,js,ks,ip,j,ia
00024 integer::na,nb,nc,nsi_sc
00025 character(len=256)::cbuf
00026
00027 allocate(kd(nsi));kd=0
00028 csr=cs(1)
00029 is=1
00030 kd(1)=is
00031 do ia=2,nsi
00032 if(csr/=cs(ia))then
00033 csr=cs(ia)
00034 is=is+1
00035 kd(ia)=is
00036 else
00037 kd(ia)=is
00038 endif
00039 enddo
00040 nkd=is
00041
00042 allocate(csref(nkd))
00043 csr=cs(1)
00044 is=1
00045 csref(is)=csr
00046 do ia=2,nsi
00047 if(csr/=cs(ia))then
00048 csr=cs(ia)
00049 is=is+1
00050 csref(is)=csr
00051 endif
00052 enddo
00053
00054 allocate(zn(nkd));zn=0.0d0
00055 do i=1,nkd
00056 do is=0,102
00057 if(csref(i).eq.atom_name(is))then
00058 js=is
00059 endif
00060 enddo
00061 zn(i)=dble(js)
00062 enddo
00063
00064 aa(:,1)=a1(:)
00065 aa(:,2)=a2(:)
00066 aa(:,3)=a3(:)
00067
00068 na=amax-amin
00069 nb=bmax-bmin
00070 nc=cmax-cmin
00071 nsi_sc=nsi*na*nb*nc
00072
00073 allocate(kd_sc(nsi_sc));kd_sc=0
00074 allocate(asi_sc(3,nsi_sc));asi_sc=0.0d0
00075
00076 asi(1,:)=asi(1,:)/dble(na)
00077 asi(2,:)=asi(2,:)/dble(nb)
00078 asi(3,:)=asi(3,:)/dble(nc)
00079
00080 do is=1,na
00081 do js=1,nb
00082 do ks=1,nc
00083 do i=1,nsi
00084 ip=i+nsi*(ks-1)+nsi*nc*(js-1)+nsi*nc*nb*(is-1)
00085 asi_sc(1,ip)=asi(1,i)+dble((is-1))/dble(na)
00086 asi_sc(2,ip)=asi(2,i)+dble((js-1))/dble(nb)
00087 asi_sc(3,ip)=asi(3,i)+dble((ks-1))/dble(nc)
00088 kd_sc(ip)=kd(i)
00089 enddo
00090 enddo
00091 enddo
00092 enddo
00093
00094 aa_sc(:,1)=aa(:,1)*dble(na)
00095 aa_sc(:,2)=aa(:,2)*dble(nb)
00096 aa_sc(:,3)=aa(:,3)*dble(nc)
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 cbuf='cif'
00107 call printcif(cbuf,aa_sc(1,1),nkd,zn(1),nsi_sc,kd_sc(1),asi_sc(1,1),na,nb,nc)
00108
00109 return
00110 end
00111