Working commit for dislocation generation branch
This commit is contained in:
parent
41024b9674
commit
d0e6253d64
26
README.md
26
README.md
@ -111,4 +111,28 @@ This mode merges multiple data files and creates one big simulation cell. The pa
|
||||
|
||||
`N` - The number of files which are being read
|
||||
|
||||
`dim` - the dimension they are to be stacked along, can be either `x`, `y`, or `z`. If the argument `none` is passed then the cells are just overlaid. Future options will include a delete overlap command.
|
||||
`dim` - the dimension they are to be stacked along, can be either `x`, `y`, or `z`. If the argument `none` is passed then the cells are just overlaid. Future options will include a delete overlap command.
|
||||
|
||||
## Options
|
||||
|
||||
Options are additional portions of code which have additional functionality. Options are performed in the order that they appear in the argument list and can be added to any mode. If wanting to use strictly options use `--convert` to specify input and output files.
|
||||
|
||||
### Option dislgen
|
||||
|
||||
```
|
||||
-dislgen [ijk] [hkl] x y z char_angle poisson
|
||||
```
|
||||
|
||||
|
||||
|
||||
This options adds an arbitrarily oriented dislocation into your model based on user inputs using the volterra displacement fields. The options are below
|
||||
|
||||
`[ijk]` - The vector for the line direction
|
||||
|
||||
`[hkl]` - The vector for the slip plane
|
||||
|
||||
`x y z` - The position of the dislocation centroid
|
||||
|
||||
`char_angle` - Character angle of the dislocation (0 is screw and 90 is edge)
|
||||
|
||||
`poisson` - Poisson's ratio used for the displacement field.
|
12
src/Makefile
12
src/Makefile
@ -1,8 +1,9 @@
|
||||
FC=ifort
|
||||
#FFLAGS=-mcmodel=large -g -O0 -stand f08 -fpe0 -traceback -check bounds,uninit -warn all -implicitnone -no-wrap-margin
|
||||
FFLAGS=-mcmodel=large -Ofast
|
||||
FFLAGS=-mcmodel=large -Ofast -no-wrap-margin
|
||||
MODES=mode_create.o mode_merge.o mode_convert.o
|
||||
OBJECTS=main.o elements.o io.o subroutines.o functions.o atoms.o call_mode.o box.o $(MODES)
|
||||
OPTIONS=opt_disl.o
|
||||
OBJECTS=main.o elements.o io.o subroutines.o functions.o atoms.o call_mode.o box.o call_option.o $(MODES) $(OPTIONS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .f .f90 .F90 .o
|
||||
@ -25,9 +26,10 @@ cleantest:
|
||||
$(RM) testfuncs testfuncs.o
|
||||
|
||||
$(OBJECTS) : parameters.o
|
||||
atoms.o subroutines.o testfuncs.o : functions.o
|
||||
main.o io.o build_subroutines.o: elements.o
|
||||
atoms.o subroutines.o testfuncs.o box.o : functions.o
|
||||
main.o io.o $(MODES) $(OPTIONS) : elements.o
|
||||
call_mode.o : $(MODES)
|
||||
call_option.o : $(OPTIONS)
|
||||
$(MODES) io.o: atoms.o box.o
|
||||
$(MODES) main.o : io.o
|
||||
testfuncs.o elements.o mode_create.o: subroutines.o
|
||||
testfuncs.o elements.o mode_create.o opt_disl.o: subroutines.o
|
||||
|
12
src/box.f90
12
src/box.f90
@ -1,7 +1,7 @@
|
||||
module box
|
||||
!This module contains information on the properties of the current box.
|
||||
use parameters
|
||||
|
||||
use functions
|
||||
implicit none
|
||||
|
||||
real(kind=dp) :: box_bd(6) !Global box boundaries
|
||||
@ -34,8 +34,14 @@ module box
|
||||
|
||||
integer, intent(in) :: n
|
||||
|
||||
allocate(sub_box_ori(3,3,n), sub_box_bd(6,n), sub_box_array_bd(2,2,n))
|
||||
integer :: i
|
||||
|
||||
allocate(sub_box_ori(3,3,n), sub_box_bd(6,n), sub_box_array_bd(2,2,n))
|
||||
do i = 1, n
|
||||
sub_box_ori(:,:,i) = identity_mat(3)
|
||||
sub_box_bd(:,i) = 0.0_dp
|
||||
sub_box_array_bd(:,:,i) = 1
|
||||
end do
|
||||
end subroutine alloc_sub_box
|
||||
|
||||
subroutine grow_sub_box(n)
|
||||
@ -58,7 +64,7 @@ module box
|
||||
call move_alloc(temp_bd, sub_box_bd)
|
||||
|
||||
temp_array_bd(:,:,1:sub_box_num) = sub_box_array_bd
|
||||
temp_array_bd(:,:,sub_box_num+1:) = 0.0_dp
|
||||
temp_array_bd(:,:,sub_box_num+1:) = 1
|
||||
call move_alloc(temp_array_bd, sub_box_array_bd)
|
||||
|
||||
return
|
||||
|
@ -232,4 +232,14 @@ END FUNCTION StrDnCase
|
||||
end if
|
||||
return
|
||||
end function is_equal
|
||||
|
||||
pure function unitvec(n,vec)
|
||||
integer, intent(in) :: n
|
||||
real(kind=dp), intent(in) :: vec(n)
|
||||
real(kind=dp) :: unitvec(n)
|
||||
|
||||
unitvec = vec/norm2(vec)
|
||||
return
|
||||
end function unitvec
|
||||
|
||||
end module functions
|
||||
|
12
src/io.f90
12
src/io.f90
@ -409,7 +409,7 @@ module io
|
||||
end do
|
||||
|
||||
!Write the number of atom types in the current model and all of their names
|
||||
write(11,*) atom_types, (type_to_name(i), i=1, atom_types)
|
||||
write(11,*) atom_types, (type_to_name(i)//' ', i=1, atom_types)
|
||||
!Write the number of lattice_types, basisnum and number of nodes for each lattice type
|
||||
write(11,*) lattice_types, (basisnum(i), i = 1, lattice_types), (ng_node(i), i = 1, lattice_types)
|
||||
!Now for every lattice type write the basis atom types
|
||||
@ -544,10 +544,14 @@ module io
|
||||
read(11,*) sub_box_bd(:,sub_box_num+i)
|
||||
sub_box_bd(:,sub_box_num+i) = sub_box_bd(:, sub_box_num+i) + displace(:)
|
||||
!Read in sub_box_array_bd
|
||||
read(11,*) ((sub_box_ori(j, k, sub_box_num+i), j = 1, 2), k = 1, 2)
|
||||
|
||||
read(11,*) ((sub_box_array_bd(j, k, sub_box_num+i), j = 1, 2), k = 1, 2)
|
||||
end do
|
||||
sub_box_num = sub_box_num + n
|
||||
|
||||
!Add the existing element boundaries
|
||||
sub_box_array_bd(:,1,sub_box_num+1:) = sub_box_array_bd(:,1,sub_box_num+1:) + atom_num
|
||||
sub_box_array_bd(:,2,sub_box_num+1:) = sub_box_array_bd(:,2,sub_box_num+1:) + ele_num
|
||||
|
||||
sub_box_num = sub_box_num + n
|
||||
|
||||
!Read in the number of atom types and all their names
|
||||
read(11, *) new_atom_types, (new_type_to_name(i), i = 1, new_atom_types)
|
||||
|
19
src/main.f90
19
src/main.f90
@ -17,7 +17,7 @@ program main
|
||||
use io
|
||||
|
||||
|
||||
integer :: i, end_mode_arg, arg_num
|
||||
integer :: i, end_mode_arg, arg_num, arg_pos
|
||||
character(len=100) :: argument
|
||||
|
||||
!Call initialization functions
|
||||
@ -37,12 +37,25 @@ program main
|
||||
end if
|
||||
|
||||
!Now we loop through all of the arguments and check for passed options or for a filename to be written out
|
||||
do i = end_mode_arg-1, arg_num
|
||||
call get_command_argument(i, argument)
|
||||
arg_pos = end_mode_arg
|
||||
do while(.true.)
|
||||
!Exit the loop if we are done reading
|
||||
if(arg_pos > arg_num) exit
|
||||
|
||||
call get_command_argument(arg_pos, argument)
|
||||
|
||||
!Check to see if a filename was passed
|
||||
if(scan(argument,'.',.true.) > 0) then
|
||||
call get_out_file(argument)
|
||||
arg_pos = arg_pos + 1
|
||||
|
||||
!Check to see if an option has been passed
|
||||
else if(argument(1:1) == '-') then
|
||||
call call_option(argument, arg_pos)
|
||||
!Otherwise print that the argument is not accepted and move on
|
||||
else
|
||||
print *, trim(adjustl(argument)), " is not accepted. Skipping to next argument"
|
||||
arg_pos = arg_pos + 1
|
||||
end if
|
||||
end do
|
||||
|
||||
|
@ -230,10 +230,10 @@ module mode_create
|
||||
|
||||
case default
|
||||
!If it isn't an option then you have to exit
|
||||
arg_pos = arg_pos -1
|
||||
exit
|
||||
end select
|
||||
end do
|
||||
|
||||
!Calculate the lattice periodicity length in lattice units
|
||||
do i = 1, 3
|
||||
lattice_space(i) = norm2(orient(i,:))
|
||||
|
@ -2,7 +2,12 @@ module parameters
|
||||
|
||||
implicit none
|
||||
|
||||
!Default precision
|
||||
integer, parameter :: dp= selected_real_kind(15,307)
|
||||
!Parameters for floating point tolerance
|
||||
real(kind=dp), parameter :: lim_zero = epsilon(1.0_dp), &
|
||||
lim_large = huge(1.0_dp)
|
||||
!Numeric constants
|
||||
real(kind=dp), parameter :: pi = 3.14159265358979323846_dp
|
||||
|
||||
end module parameters
|
@ -1,6 +1,7 @@
|
||||
module subroutines
|
||||
use parameters
|
||||
use functions
|
||||
use box
|
||||
implicit none
|
||||
|
||||
integer :: allostat, deallostat
|
||||
@ -170,4 +171,36 @@ module subroutines
|
||||
return
|
||||
end subroutine parse_ori_vec
|
||||
|
||||
subroutine parse_pos(i, pos_string, pos)
|
||||
!This subroutine parses the pos command allowing for command which include inf
|
||||
integer, intent(in) :: i !The dimension of the position
|
||||
character(len=100), intent(in) :: pos_string !The position string
|
||||
real(kind=dp), intent(out) :: pos !The output parsed position value
|
||||
|
||||
integer :: iospara
|
||||
if(trim(adjustl(pos_string)) == 'inf') then
|
||||
pos=box_bd(2*i)
|
||||
else if(trim(adjustl(pos_string)) == '-inf') then
|
||||
pos=box_bd(2*i-1)
|
||||
else if ((index(pos_string,'-') > 0).and.(index(pos_string,'inf')>0)) then
|
||||
!Now extract the number we are reducing from infinity
|
||||
read(pos_string(index(pos_string,'-')+1:), *, iostat=iospara) pos
|
||||
pos = box_bd(2*i) - pos
|
||||
else if ((index(pos_string,'+') > 0).and.(index(pos_string,'inf')>0)) then
|
||||
!Now extract the number we are reducing from infinity
|
||||
read(pos_string(index(pos_string,'+')+1:), *, iostat=iospara) pos
|
||||
pos = box_bd(2*i-1) + pos
|
||||
else if ((index(pos_string,'*') > 0).and.(index(pos_string,'inf')>0)) then
|
||||
!Now extract the number we are reducing from infinity
|
||||
read(pos_string(index(pos_string,'*')+1:), *, iostat=iospara) pos
|
||||
pos = (box_bd(2*i)-box_bd(2*i-1))*pos
|
||||
else
|
||||
read(pos_string, *, iostat=iospara) pos
|
||||
end if
|
||||
|
||||
if (iospara > 0) then
|
||||
print *, "Error reading position argument ", trim(adjustl(pos_string)), ". Please reformat and try again."
|
||||
end if
|
||||
end subroutine parse_pos
|
||||
|
||||
end module subroutines
|
Loading…
x
Reference in New Issue
Block a user