Commit 7cf0c55c authored by Dundar Yilmaz's avatar Dundar Yilmaz

layered

parent 12c0181f
No preview for this file type
No preview for this file type
......@@ -17,13 +17,13 @@ module ceramic_type
contains
procedure, public :: print_block
procedure , public :: create_surface_roughness
procedure , public :: cleave_surface
procedure , public :: find_functional_sites
procedure, public :: create_defects
procedure, public :: create_binary_defects
procedure, public :: create_layered_monovacancy_defects
end type
type(ceramic ) , allocatable , dimension(:) :: blocks
! type(ceramic ) :: base_ceramic
contains
function read_unit_cell(filename) result(new_ceramic)
type(ceramic) :: new_ceramic
......@@ -251,9 +251,6 @@ contains
& 'New Lattice Constant :',h_matrix(3,3),&
& 'Strain applied:(%)',(base_ceramic%h_matrix(3,3)-h_matrix(3,3))/h_matrix(3,3)*100
end if
! nx=int(box_lengths(1)/base_ceramic%h_matrix(1,1))
! ny=int(box_lengths(2)/base_ceramic%h_matrix(2,2))
! nz=int(box_lengths(3)/base_ceramic%h_matrix(3,3))
n_atoms=nx*ny*nz*base_ceramic%n_atoms
n_ucell=base_ceramic%n_atoms
new_block%n_atoms=n_atoms
......@@ -284,7 +281,7 @@ contains
do i=1,nx
do j=1,ny
do k=1,nz
! print*,i,j,k
! print*,i,j,k
pos=box_dimensions(box_id,:)+&
(/&
& dble(i-1)*h_matrix(1,1),&
......@@ -311,7 +308,7 @@ contains
end do
end do
n_atoms=cnt
!print*, 'N atoms : ',cnt
print*, 'N atoms : ',cnt
! pause
!detect surface atoms
!-----------------------------------------------
......@@ -351,8 +348,6 @@ contains
end if
end do
iostat=cnt
1001 format(A6,3(f9.3),x,3(f7.2,x))
1002 format(A6,i5,A4,3x,i2,10x,3(f8.3),23x,A2)
end function print_block
......@@ -440,7 +435,7 @@ contains
end if
end if
end do
write(*,'(A,x,i3,x,A,x,A)') 'Defects are created.' , n_defects, def_symbol, 'Atoms deleted'
write(*,'(A,x,i8,x,A,x,A)') 'Defects are created.' , n_defects, def_symbol, 'Atoms deleted'
iostat=0
end function
function create_binary_defects(this,def_symbA,def_symbB,n_defs,def_treshold,direction) result(iostat)
......@@ -481,9 +476,49 @@ contains
end do
i=i+1
end do
! stop
end function
function create_layered_monovacancy_defects(this,def_symbA,plane,n_defs,&
boundary_lo,boundary_hi) result(iostat)
class(ceramic) :: this
character(len=2) :: def_symbA
character(len=1) :: plane
integer :: n_defs
integer :: iostat
real*8 :: boundary_hi,boundary_lo
integer :: n_atoms
integer :: i,j,k,del_atomA,del_atomB
real*8 :: rn
real*8, dimension(3) :: vecij
iostat=0
n_atoms=this%n_atoms
print*, 'Creating Layered vacancy defects',n_defs
i=0
do while( i < n_defs )
call random_number(rn)
101 del_atomA=int(n_atoms*rn)+1 ! pick random
if (this%deleted(del_atomA) .eq. 1) cycle
if (this%symbol(del_atomA) .ne. def_symbA ) cycle
!print*,del_atomA,this%symbol(del_atomA)
if (plane == 'z')then
if(this%coord(del_atomA,3) > boundary_hi) cycle
if(this%coord(del_atomA,3) < boundary_lo) cycle
end if
if (plane == 'y')then
if(this%coord(del_atomA,2) > boundary_hi) cycle
if(this%coord(del_atomA,2) < boundary_lo) cycle
end if
if (plane == 'x')then
if(this%coord(del_atomA,1) > boundary_hi) cycle
if(this%coord(del_atomA,1) < boundary_lo) cycle
end if
print*, this%coord(del_atomA,:)
this%deleted(del_atomA) = 1
i=i+1
end do
! stop
end function
function create_surface_roughness(this, surf_type,rough_type ) result(iostat)
class(ceramic) :: this
......@@ -535,4 +570,49 @@ contains
iostat=0
end function create_surface_roughness
function cleave_surface(this, surf_type,cut_pos ) result(iostat)
class(ceramic) :: this
integer :: surf_type
real*8 :: cut_pos
integer :: iostat,cnt_al,cnt_o
integer :: i , j , k,cnt
integer , allocatable,dimension(:) :: surf_list
real*8 :: surf_depth=2.d0
real*8 , dimension(3) :: vec
real*8 :: z_limit,z_cor,rn
if( surf_type == 1 ) then ! upper surface
z_limit= cut_pos !box_dimensions(this%block_id,3)+box_lengths(3)-surf_depth
end if
if( surf_type == 2 ) then ! lower surface
z_limit=cut_pos !box_dimensions(this%block_id,3)+surf_depth
end if
cnt=0
cnt_o=0
cnt_al=0
do i=1,this%n_atoms
z_cor=this%coord(i,3)
if( surf_type == 1 ) then
if ( z_cor > z_limit ) then
call random_number(rn)
this%deleted(i)=1
cnt=cnt+1
if( this%symbol(i) .eq. 'Al') cnt_al=cnt_al+1
if( this%symbol(i) .eq. 'O ') cnt_o=cnt_o+1
! print*,'Deleted ',cnt,this%symbol(i)
end if
end if
if( surf_type == 2 ) then
if ( z_cor < z_limit ) then
call random_number(rn)
this%deleted(i)=1
cnt=cnt+1
if( this%symbol(i) .eq. 'Al') cnt_al=cnt_al+1
if( this%symbol(i) .eq. 'O ') cnt_o=cnt_o+1
!print*,'Deleted ',cnt,this%symbol(i)
end if
end if
end do
print*,cnt_al, ' Al atoms ',cnt_o , 'Oxygen Atoms '
iostat=0
end function cleave_surface
end module ceramic_type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -348,6 +348,7 @@ contains
real*8 :: scale
if( count > 5000) then
scale=0.5+exp((5000.d0-dble(count))/20000.d0)/2.d0
!write(*,*) 'Rescaling',scale,count
else
scale=1.d0
end if
......
No preview for this file type
......@@ -214,7 +214,7 @@ contains
end if
if( this%mers(i)%symbol(j) .eq. 'O ') then
!this%mers(i)%atype(j) = 3
this%mers(i)%mass(j) = 16.0
this%mers(i)%mass(j) = 15.999
end if
if( this%mers(i)%symbol(j) .eq. 'N ') then
!this%mers(i)%atype(j) = 4
......
No preview for this file type
No preview for this file type
......@@ -8,6 +8,7 @@ module print_files
implicit none
integer, allocatable , dimension(:,:) :: bondtable
integer :: n_total_bonds
integer :: pcursor
contains
function connection_table(filename) result(iostat)
......@@ -186,11 +187,22 @@ module print_files
& printedatoms(i)%charge,printedatoms(i)%coord
end do
print*,'--M--'
write(9,*)
write(9,*) ' Masses'
write(9,*)
pcursor=1
do while (pcursor <= maxtype)
do i=1,n_atoms
write(9,*) i,printedatoms(i)%mass
if(pcursor <= maxtype) then
if (printedatoms(i)%atomtype .eq. pcursor) then
print*,printedatoms(i)%atomtype , printedatoms(i)%mass
write(9,*) pcursor,printedatoms(i)%mass !, printedatoms(i)%atomtype
pcursor = pcursor +1
end if
end if
!write(9,*) i,printedatoms(i)%mass, printedatoms(i)%atomtype
end do
end do
write(9,*)
write(9,*) ' Bonds'
......@@ -416,7 +428,7 @@ end if
write(144,*)
write(144,1008)
write(144,*)
write(145,'(A,x,i6)') 'Number of particles = ',n_total_atoms
write(145,'(A,x,i9)') 'Number of particles = ',n_total_atoms
write(145,'(A)') 'A =1.0'
write(145,'(A,x,f13.6)')'H0(1,1)=', BOX(1)
write(145,'(A,x,f13.6)')'H0(1,2)=', 0.0
......
No preview for this file type
No preview for this file type
......@@ -22,18 +22,26 @@ integer :: n_def_groups,n_cross_links,n_basis_mers,n_bindef_groups
integer,allocatable ::n_defects(:),def_type(:),def_block(:)
integer,allocatable :: n_binary_defects(:)
character(len=2) ,allocatable :: def_symbol(:),def_symbolsA(:),def_symbolsB(:)
logical :: done
logical :: done,cleave_surf
real*8 :: coord(3),save_penalty,total_penalty,inter_penalty,self_penalty,vec(3)
real*8 :: mctemp,rn,cross_link_min_dist
real*8 :: cleave_z
real*8, allocatable:: def_treshold(:)
character(len=2) :: symbol
character(len=40) ::npfilename, npsurfdata
character(len=8) :: cleave_type
logical :: nanoparticle_mode=.false.
type(chain) , dimension(:), allocatable :: save_chains
type(nanoparticle) :: particle
type(ceramic),allocatable :: base_unitcells(:)
logical :: layered_vacancy_defects =.False.
integer :: n_amorph_chain_groups
integer , dimension(:,:) ,allocatable :: chainlist
integer :: n_vacancy,n_vacancy_layers
integer , allocatable :: lmv_def_block(:),lmv_n_defects(:)
real*8, allocatable:: lmv_boundaryhi(:), lmv_boundarylo(:),lmv_deftresholds(:)
character(len=1) ,allocatable ,dimension(:) :: lmv_planes
character(len=2) ,allocatable ,dimension(:) :: lmv_def_symbols
open(11,file=filename,status='old')
open(12,file='log.txt', status='unknown')
nfunctional=0
......@@ -124,6 +132,13 @@ opls_flag=.false.
end do
end if
end if
if ( word .eq. 'cleave') then
cleave_surf = .True.
call word_next_read(cline,word,done)
read(word,*) cleave_z
call word_next_read(cline,word,done)
read(word,*) cleave_type
end if
if( word .eq. 'defects') then
call word_next_read(cline,word,done)
read(word,*) n_def_groups
......@@ -146,6 +161,19 @@ opls_flag=.false.
end do
end if
if( word .eq. 'layered_monovacancy_defects') then
layered_vacancy_defects = .True.
call word_next_read(cline,word,done)
read(word,*) n_vacancy_layers
allocate(lmv_def_block(n_vacancy_layers),lmv_def_symbols(n_vacancy_layers), &
lmv_n_defects(n_vacancy_layers),lmv_planes(n_vacancy_layers), &
lmv_boundaryhi(n_vacancy_layers), lmv_boundarylo(n_vacancy_layers),&
lmv_deftresholds(n_vacancy_layers))
do i = 1, n_vacancy_layers
read(11,*) lmv_def_block(i) , lmv_def_symbols(i),lmv_planes(i), lmv_n_defects(i), &
lmv_boundarylo(i), lmv_boundaryhi(i), lmv_deftresholds(i)
end do
end if
if ( word .eq. 'amorph_chain') then
call word_next_read(cline,word,done)
read(word,*) n_amorph_chain_groups
......@@ -432,6 +460,29 @@ if( n_boxes > 0 ) then
print*,'Bottom Block: ',blocks(1)%n_atoms-sum(blocks(1)%deleted(:))
print*,'Top Block: ',blocks(2)%n_atoms-sum(blocks(2)%deleted(:))
end if
if( cleave_surf) then
write(*,*) 'Implementing Surface Cleaving'
if( cleave_type == 'up') then
do i =1, n_boxes
iostat=blocks(i)%cleave_surface(1,cleave_z)
end do
end if
if( cleave_type == 'down') then
do i = 1, n_boxes
iostat= blocks(i)%cleave_surface(2,cleave_z)
end do
end if
print*,'Bottom Block: ',blocks(1)%n_atoms-sum(blocks(1)%deleted(:))
print*,'Top Block: ',blocks(2)%n_atoms-sum(blocks(2)%deleted(:))
end if
if ( layered_vacancy_defects) then
do i = 1, n_vacancy_layers
iostat = blocks(lmv_def_block(i))%create_layered_monovacancy_defects(&
lmv_def_symbols(i),lmv_planes(i),lmv_n_defects(i),lmv_boundarylo(i),&
lmv_boundaryhi(i))
end do
end if
indx=0
do i=1,n_boxes
indx=blocks(i)%print_block('block.pdb',indx)
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment