From 32ab5a60583be60dba15af52922180e779199318 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Tue, 19 May 2020 16:16:26 -0400 Subject: [PATCH] Added basic basis functionality to code --- README.md | 17 +++++++---------- src/io.f90 | 2 +- src/mode_create.f90 | 30 ++++++++++++++++-------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 2bb3db2..5bdd240 100644 --- a/README.md +++ b/README.md @@ -75,16 +75,6 @@ There is no default dimensions as duplicate is the default option. This command Example: `dimensions 100 100 100` -**ZigZag** - -``` -zigzag boolx booly boolz -``` - -Default zigzag is `f f f`. This command specifies whether a boundary should be left jagged (i.e. in essence not filled in). If `boolx` is `t` than the x dimension is left jagged and if it is `f` then the x dimension is filled. - -*Example:* `zigzag t f t` gives a box with jagged edges in the x and z and filled edges in the y. - **Origin** ``` @@ -95,6 +85,13 @@ Default origin is `0 0 0`. This command just sets the origin for where the simul *Example:* `origin 10 0 1` +**Basis** + +``` +basis basisnum bname bx by bz +``` + +This function allows you to define a custom basis. `bname bx by bz` must be repeated `basisnum` times. ### Mode Convert ``` diff --git a/src/io.f90 b/src/io.f90 index f929e29..d178baf 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -161,7 +161,7 @@ module io !Calculate total atom number write_num = atom_num do i = 1,ele_num - if(type_ele(i) == 'fcc') write_num = write_num + size_ele(i)**3 + if(type_ele(i) == 'fcc') write_num = write_num + basisnum(lat_ele(i))*size_ele(i)**3 end do !Write total number of atoms + elements write(11, '(i16, a)') write_num, ' atoms' diff --git a/src/mode_create.f90 b/src/mode_create.f90 index 4e92492..ed60daf 100644 --- a/src/mode_create.f90 +++ b/src/mode_create.f90 @@ -166,6 +166,7 @@ module mode_create integer :: ori_pos, i, j, arglen, stat character(len=100) :: textholder character(len=20) :: orient_string + character(len=2) :: btype logical :: isortho, isrighthanded @@ -206,20 +207,6 @@ module mode_create call parse_ori_vec(orient_string, orient(i,:)) arg_pos = arg_pos+1 - ! ori_pos=2 - ! do j = 1,3 - ! if (orient_string(ori_pos:ori_pos) == '-') then - ! ori_pos = ori_pos + 1 - ! read(orient_string(ori_pos:ori_pos), *, iostat=stat) orient(i,j) - ! if (stat>0) STOP "Error reading orient value" - ! orient(i,j) = -orient(i,j) - ! ori_pos = ori_pos + 1 - ! else - ! read(orient_string(ori_pos:ori_pos), *, iostat=stat) orient(i,j) - ! if(stat>0) STOP "Error reading orient value" - ! ori_pos=ori_pos + 1 - ! end if - ! end do end do !If the duplicate command is passed then we extract the information on the new bounds. @@ -245,6 +232,21 @@ module mode_create read(textholder, *) origin(i) arg_pos = arg_pos + 1 end do + case('basis') + call get_command_argument(arg_pos, textholder) + read(textholder, *) basisnum(1) + arg_pos = arg_pos + 1 + max_basisnum=basisnum(1) + do i = 1, max_basisnum + call get_command_argument(arg_pos, btype) + arg_pos = arg_pos+1 + call add_atom_type(btype, basis_type(i,1)) + do j = 1, 3 + call get_command_argument(arg_pos, textholder) + read(textholder, *) basis_pos(j,i) + arg_pos=arg_pos+1 + end do + end do case default !If it isn't an option then you have to exit