From e6d7741060527382721d9672b11d3342ac8d15fc Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Tue, 21 Apr 2020 13:25:55 -0400 Subject: [PATCH 1/4] Working changes to io.f90 --- src/io.f90 | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/io.f90 b/src/io.f90 index f929e29..1e1d956 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').or.(type_ele(i) == 'bcc')) write_num = write_num + size_ele(i)**3 end do !Write total number of atoms + elements write(11, '(i16, a)') write_num, ' atoms' @@ -196,7 +196,7 @@ module io do i = 1, ele_num call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp) select case(trim(adjustl(type_ele(i)))) - case('fcc') + case('fcc','bcc') do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 interp_num = interp_num+1 call apply_periodic(r_interp(:,iatom)) @@ -949,4 +949,66 @@ module io call set_max_esize end if end subroutine read_pycac + + subroutine read_cac(file, displace, temp_box_bd) + !This subroutine is used to read .cac files which are used with the lammpsCAC format + character(len=100), intent(in) :: file + real(kind=dp), dimension(3), intent(in) :: displace + real(kind = dp), dimension(6), intent(out) :: temp_box_bd + + character(len=100) :: textholder, element_type, esize + character(len=2) :: atom_species + integer :: i, j, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) + + real(kind=dp) :: mass, r_in(3,10,8) + + + !First open the file + open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') + + !Read header information + read(11, *) textholder + read(11, *) textholder + + !Read number of elements + read(11, *) ele_in, textholder + read(11, *) type_in, textholder + + !Read box_boundaries + read(11,*) textholder + read(11,*) box_bd(1:2), texholder + read(11,*) box_bd(3:4), texholder + read(11,*) box_bd(5:6), texholder + + !Read useless information + read(11,*) textholder + read(11,*) textholder + + !Read atomic masses + do i = 1, type_in + read(11,*) j, mass, textholder + call ATOMMASSSPECIES(mass, atom_species) + call add_atom_type(atom_species, type_map(i)) + end do + + !Read useless info + do i = 1, 3 + read(11,*) textholder + end do + + !Start the reading loop + do i = 1, ele_in + read(11,*) j, ele, element_type, in_basis, esize + select case(trim(adjustl(element_type))) + case('Eight_Node') + !Read in all the data + do j = 1, 8*in_basis + read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,ibasis,inod) + end do + + ! + end select + end do + + end subroutine read_cac end module io From b3e05da6a4e55e01df9de7dae899dea4b1cc8f7d Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Wed, 22 Apr 2020 12:52:37 -0400 Subject: [PATCH 2/4] Working changes for reading .cac files --- README.md | 5 ++--- src/call_option.f90 | 4 +++- src/elements.f90 | 38 +++++++++++++++++++++++++++++++++-- src/io.f90 | 49 +++++++++++++++++++++++++++++++++++---------- src/main.f90 | 5 +++++ 5 files changed, 84 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3455000..8f20ec6 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ This option creates a circular planar vacancy cluster of radius `radius` normal This option selects a group of either elements, nodes, atoms and applies some transformation to them. -`select_type` - Either `nodes`, `atoms`, `elements`, `nodes/atoms`, `all`. When using the option `nodes` only nodes which are within the group are selected, `elements` selects elements based on whether the element center is within the group, `nodes/atoms` selects both nodes and atoms for the group. `all` selects elements based on the element center and atoms based on their position. +`select_type` - Either `atoms`, `elements`,`both`. `elements` selects elements based on whether the element center is within the group, `nodes/atoms` selects both nodes and atoms for the group. `both` selects elements based on the element center and atoms based on their position. `group_shape` - Specifies what shape the group takes and dictates which options must be passed. Each shape requires different arguments and these arguments are represented by the placeholder `shape_arguments`. The accepted group shapes and arguments are below: @@ -230,7 +230,7 @@ This command wraps atoms back into the simulation cell as though periodic bounda **Remesh** ``` -remesh esize lattice_parameter lattice_type +remesh esize ``` This command remeshes the atoms/elements within the group to the new element size `esize`. Currently only accepts an `esize` of 2 which refines it to full atomistics. When remeshing to atomistics the group can contain any orientations of elements but when remeshing to different finite elements, the group must contain all atoms/elements with the same orientation. `lattice_parameter` is the lattice parameter for the elements within the group and `lattice_type` is the lattice type (integer) that these new elements will be assigned to. @@ -294,7 +294,6 @@ This command will delete all overlapping atoms within a specific cutoff radius ` This option is primarily used when reading data from non .mb formats. This code simply sets the orientation variable for the specified sub box `sbox`. **** - ## Position Specification Specifying positions in cacmb can be done through a variety of ways. Examples of each format is shown below. diff --git a/src/call_option.f90 b/src/call_option.f90 index ead7af0..b8cc3b8 100644 --- a/src/call_option.f90 +++ b/src/call_option.f90 @@ -33,8 +33,10 @@ subroutine call_option(option, arg_pos) call sbox_ori(arg_pos) case('-delete') call run_delete(arg_pos) + case('-set_cac') + arg_pos = arg_pos+3 case default print *, 'Option ', trim(adjustl(option)), ' is not currently accepted.' stop 3 end select -end subroutine call_option \ No newline at end of file +end subroutine call_option diff --git a/src/elements.f90 b/src/elements.f90 index e9fc928..6265b3c 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -35,13 +35,13 @@ module elements integer :: lattice_types = 0 integer :: max_ng_node, ng_node(10) !Max number of nodes per element and number of nodes per element for each lattice type integer :: max_esize=0 !Maximum number of atoms per side of element + real(kind=dp) :: lapa(10) !These variables contain information on the basis, for simplicities sake we limit !the user to the definition of 10 lattice types with 10 basis atoms at each lattice point. !This can be easily increased with no change to efficiency integer :: max_basisnum, basisnum(10) !Max basis atom number, number of basis atoms in each lattice type integer :: basis_type(10,10) - real(kind=dp) :: lapa(10) !Additional module level variables we need logical :: wrap_flag @@ -632,4 +632,38 @@ module elements end select end subroutine -end module elements \ No newline at end of file + subroutine lattice_map(in_bnum, in_btypes, in_ngnodes, in_lapa, lat_type) + !This subroutine maps an input lattice type to either a new lattice type or an existing one depending on basis_type and + !number of nodes at the atoms + + integer, intent(in) :: in_ngnodes, in_bnum, in_btypes(10) !Input variables + real(kind=dp), intent(in) :: in_lapa + integer, intent(out) :: lat_type + + integer j, ibasis + + lat_type = 0 + lat_loop:do j = 1, lattice_types + !Check all the lattice level variables + if ((basisnum(j) == in_bnum).and.(ng_node(j) == in_ngnodes).and.(is_equal(lapa(j),in_lapa))) then + !Now check lattice level variables + do ibasis = 1, basisnum(j) + if(basis_type(ibasis,j) /= in_btypes(ibasis)) cycle old_loop + end do + lat_type = j + exit lat_loop + end if + end do lat_loop + + !If it doesn't match an existing lattice type we add it + if( lat_type == 0) then + lattice_types = lattice_types + 1 + basisnum(lattice_types) = in_bnum + basis_types(:,lattice_types) = in_btypes + ng_node(lattice_types) = in_ngnodes + lapa(lattice_types) = in_lapa + end if + + end subroutine lattice_map + +end module elements diff --git a/src/io.f90 b/src/io.f90 index 1e1d956..22692e8 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -8,9 +8,9 @@ module io implicit none integer :: outfilenum = 0, infilenum = 0 - character(len=100) :: outfiles(100), infiles(100) + character(len=100) :: outfiles(100), infiles(100), in_lattice_type='' logical :: force_overwrite - + real(kind=dp) :: in_lapa=0.0 public contains @@ -958,12 +958,15 @@ module io character(len=100) :: textholder, element_type, esize character(len=2) :: atom_species - integer :: i, j, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) - - real(kind=dp) :: mass, r_in(3,10,8) + integer :: i, j, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) + real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3), in_ori(3,3) - - !First open the file + !First check to make sure that we have set the needed variables + if(is_equal(in_lapa,0.0_dp).or.(in_lattice_type=='')) then + print *, "Please use set_cac to set needed parameters to read in .cac file" + stop 3 + end if + !Open the file open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') !Read header information @@ -978,8 +981,7 @@ module io read(11,*) textholder read(11,*) box_bd(1:2), texholder read(11,*) box_bd(3:4), texholder - read(11,*) box_bd(5:6), texholder - + read(11,*) box_bd(5:6), texholder !Read useless information read(11,*) textholder read(11,*) textholder @@ -1005,10 +1007,35 @@ module io do j = 1, 8*in_basis read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,ibasis,inod) end do - - ! + + !Now calculate the orientation matrix based on the lattice type. + lat_vec = r_in(:,1,2) - r_in(:,1,1) + lat_vec = lat_vec / norm2(lat_vec) + + !Now figure out if is an existing lattice_type + call lattice_map(in_basis, in_basis_types, 8, in_lapa, lat_type) + + end select end do end subroutine read_cac + + subroutine set_cac(apos) + !This code parses input values + integer, intent(in) :: apos + integer :: arglen, arg_pos + + arg_pos = apos + 1 + call get_command_argument(arg_pos, in_lapa, arglen) + if (arglen==0) then + print *, "Missing lattice parameter for set_input_lat" + end if + + arg_pos = arg_pos + 1 + call get_command_argument(arg_pos, in_lattice_type, arglen) + if (arglen==0) then + print *, "Missing lattice type for set_input_lat" + end if + end subroutine set_input_lat(arg_pos) end module io diff --git a/src/main.f90 b/src/main.f90 index 958a3c0..8d153ce 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -60,6 +60,11 @@ program main !This lets us know if we need to wrap atomic positions back into the cell case('-wrap') wrap_flag=.true. + + !This gives necessary information in order to correctly read .cac files + case('-set_cac') + call set_cac(i) + end select end do !Determine if a mode is being used and what it is. The first argument has to be the mode From 4038cab76fe4630e39710819423ce6ec11365302 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Thu, 23 Apr 2020 12:17:04 -0400 Subject: [PATCH 3/4] Latest working changes to read-CAC --- src/elements.f90 | 2 - src/io.f90 | 97 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 77 insertions(+), 22 deletions(-) diff --git a/src/elements.f90 b/src/elements.f90 index 6265b3c..484057f 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -294,8 +294,6 @@ module elements integer :: i - max_ng_node = 0 - do i=1, n select case(trim(adjustl(element_types(i)))) case('fcc') diff --git a/src/io.f90 b/src/io.f90 index 22692e8..964a816 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -776,7 +776,7 @@ module io integer :: i, inod, ibasis, j, k, in_eles, in_atoms, ele_types, in_lat_num, in_atom_types, & atom_type_map(10), etype_map(10), etype, lat_type, new_lattice_map(10), & atom_type - real(kind=dp) :: newdisplace(3), r_in(3,1,8), r_in_atom(3), new_displace(3) + real(kind=dp) :: newdisplace(3), r_in(3,1,8), r_in_atom(3) character(len=100) :: textholder, in_lattype_map(10) character(len=2) :: atomic_element !First open the file @@ -950,7 +950,7 @@ module io end if end subroutine read_pycac - subroutine read_cac(file, displace, temp_box_bd) + subroutine read_lmpcac(file, displace, temp_box_bd) !This subroutine is used to read .cac files which are used with the lammpsCAC format character(len=100), intent(in) :: file real(kind=dp), dimension(3), intent(in) :: displace @@ -958,8 +958,8 @@ module io character(len=100) :: textholder, element_type, esize character(len=2) :: atom_species - integer :: i, j, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) - real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3), in_ori(3,3) + integer :: i, j, k, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) + real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3,3), in_ori(3,3), temp_box_bd(6), newdisplace(3) !First check to make sure that we have set the needed variables if(is_equal(in_lapa,0.0_dp).or.(in_lattice_type=='')) then @@ -968,6 +968,9 @@ module io end if !Open the file open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') + + !Now initialiaze some important variables + max_basis_num = 10 !Read header information read(11, *) textholder @@ -979,9 +982,38 @@ module io !Read box_boundaries read(11,*) textholder - read(11,*) box_bd(1:2), texholder - read(11,*) box_bd(3:4), texholder - read(11,*) box_bd(5:6), texholder + read(11,*) temp_box_bd(1:2), texholder + read(11,*) temp_box_bd(3:4), texholder + read(11,*) temp_box_bd(5:6), texholder + + !Shift the box boundaries if needed + do i = 1, 3 + if (abs(displace(i)) > lim_zero) then + newdisplace(i) = displace(i) - temp_box_bd(2*i-1) + else + newdisplace(i)=displace(i) + end if + temp_box_bd(2*i-1) = temp_box_bd(2*i-1) + newdisplace(i) + temp_box_bd(2*i) = temp_box_bd(2*i) + newdisplace(i) + end do + + !Grow box boundaries + call grow_box(temp_box_bd) + + !Allocate sub_box + if (sub_box_num == 0) then + call alloc_sub_box(1) + else + call grow_sub_box(1) + end if + + !Because orientations and other needed sub_box information isn't really + !present within the .cac file we just default a lot of it. + sub_box_ori(:,:,sub_box_num+1) = identity_mat(3) + sub_box_bd(:, sub_box_num+1) = temp_box_bd + sub_box_num = sub_box_num + 1 + + !Read useless information read(11,*) textholder read(11,*) textholder @@ -1001,25 +1033,50 @@ module io !Start the reading loop do i = 1, ele_in read(11,*) j, ele, element_type, in_basis, esize + !Check to see if we need to grow the max_basis_num select case(trim(adjustl(element_type))) case('Eight_Node') - !Read in all the data - do j = 1, 8*in_basis - read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,ibasis,inod) + !Read in all the data + do j = 1, 8*in_basis + read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,ibasis,inod) + end do + + !Now calculate the lattice vectors and shift the nodal points from the corners to the center of the unit cell + !Please check the nodal numbering figure in the readme in order to understand which nodes are used for the + !calculation + lat_vec(:,1) = (r_node(:,1,2) - r_node(:,1,1))/esize + lat_vec(:,2) = (r_node(:,1,4) - r_node(:,1,1))/esize + lat_vec(:,3) = (r_node(:,1,5) - r_node(:,1,1))/esize + + !Now shift all the nodal positions + select case(trim(adjustl(in_lattice_type))) + case('fcc','FCC') + do ibasis = 1, in_basis + r_in(:,ibasis,1) = r_in(:,ibasis,1) + lat_vec(:,1) + lat_vec(:,2) + lat_vec(:,3) + newdisplace + r_in(:,ibasis,2) = r_in(:,ibasis,2) - lat_vec(:,1) + lat_vec(:,2) + lat_vec(:,3) + newdisplace + r_in(:,ibasis,3) = r_in(:,ibasis,3) - lat_vec(:,1) - lat_vec(:,2) + lat_vec(:,3) + newdisplace + r_in(:,ibasis,4) = r_in(:,ibasis,4) + lat_vec(:,1) - lat_vec(:,2) + lat_vec(:,3) + newdisplace + r_in(:,ibasis,5) = r_in(:,ibasis,5) + lat_vec(:,1) + lat_vec(:,2) - lat_vec(:,3) + newdisplace + r_in(:,ibasis,6) = r_in(:,ibasis,6) - lat_vec(:,1) + lat_vec(:,2) - lat_vec(:,3) + newdisplace + r_in(:,ibasis,7) = r_in(:,ibasis,7) - lat_vec(:,1) - lat_vec(:,2) - lat_vec(:,3) + newdisplace + r_in(:,ibasis,8) = r_in(:,ibasis,8) + lat_vec(:,1) - lat_vec(:,2) - lat_vec(:,3) + newdisplace end do - - !Now calculate the orientation matrix based on the lattice type. - lat_vec = r_in(:,1,2) - r_in(:,1,1) - lat_vec = lat_vec / norm2(lat_vec) - - !Now figure out if is an existing lattice_type - call lattice_map(in_basis, in_basis_types, 8, in_lapa, lat_type) - - + case default + print *, in_lattice_type, " is not an accepted lattice type. Please select from: fcc" + end select + !Now map it to either an existing or new lattice type + call lattice_map(in_basis, in_basis_types, 8, in_lapa, lat_type) + + !Now add the element + call add_element(in_lattice_type, esize, lat_type, sub_box_num, r_in) + + case('Atom') + read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,1,1) + call add_atom(in_basis_types(ibasis), sub_box_num, r_in(:,1,1)) end select end do - end subroutine read_cac + end subroutine read_lmpcac subroutine set_cac(apos) !This code parses input values From b52d7761e09795fc9fd050615d1edcb68a26dc75 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Tue, 2 Jun 2020 16:42:12 -0400 Subject: [PATCH 4/4] First working version of reading in .cac format. Works for two separate orientations --- src/call_option.f90 | 2 +- src/elements.f90 | 5 +++-- src/io.f90 | 54 +++++++++++++++++++++++++-------------------- src/main.f90 | 2 -- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/call_option.f90 b/src/call_option.f90 index b8cc3b8..368e542 100644 --- a/src/call_option.f90 +++ b/src/call_option.f90 @@ -34,7 +34,7 @@ subroutine call_option(option, arg_pos) case('-delete') call run_delete(arg_pos) case('-set_cac') - arg_pos = arg_pos+3 + arg_pos=arg_pos +3 case default print *, 'Option ', trim(adjustl(option)), ' is not currently accepted.' stop 3 diff --git a/src/elements.f90 b/src/elements.f90 index 484057f..6252427 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -646,7 +646,7 @@ module elements if ((basisnum(j) == in_bnum).and.(ng_node(j) == in_ngnodes).and.(is_equal(lapa(j),in_lapa))) then !Now check lattice level variables do ibasis = 1, basisnum(j) - if(basis_type(ibasis,j) /= in_btypes(ibasis)) cycle old_loop + if(basis_type(ibasis,j) /= in_btypes(ibasis)) cycle lat_loop end do lat_type = j exit lat_loop @@ -657,9 +657,10 @@ module elements if( lat_type == 0) then lattice_types = lattice_types + 1 basisnum(lattice_types) = in_bnum - basis_types(:,lattice_types) = in_btypes + basis_type(:,lattice_types) = in_btypes ng_node(lattice_types) = in_ngnodes lapa(lattice_types) = in_lapa + lat_type = lattice_types end if end subroutine lattice_map diff --git a/src/io.f90 b/src/io.f90 index 964a816..ab90f85 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -591,7 +591,7 @@ module io end if select case(temp_infile(scan(temp_infile,'.',.true.)+1:)) - case('restart', 'mb') + case('restart', 'mb', 'cac') infilenum=infilenum+1 infiles(infilenum) = temp_infile exit @@ -618,6 +618,8 @@ module io call read_mb(infiles(i), displace, temp_box_bd) case('restart') call read_pycac(infiles(i), displace, temp_box_bd) + case('cac') + call read_lmpcac(infiles(i), displace, temp_box_bd) case default print *, "The extension ", trim(adjustl(outfiles(i)(scan(outfiles(i),'.',.true.)+1:))), & " is not accepted for writing. Please select from: mb and try again" @@ -956,10 +958,11 @@ module io real(kind=dp), dimension(3), intent(in) :: displace real(kind = dp), dimension(6), intent(out) :: temp_box_bd - character(len=100) :: textholder, element_type, esize + character(len=100) :: textholder, element_type character(len=2) :: atom_species - integer :: i, j, k, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10) - real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3,3), in_ori(3,3), temp_box_bd(6), newdisplace(3) + integer :: i, j, k, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10), esize, & + lat_type + real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3,3), in_ori(3,3), newdisplace(3) !First check to make sure that we have set the needed variables if(is_equal(in_lapa,0.0_dp).or.(in_lattice_type=='')) then @@ -969,22 +972,21 @@ module io !Open the file open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') - !Now initialiaze some important variables - max_basis_num = 10 + !Now initialiaze some important variables if they aren't defined + if (max_basisnum==0) max_basisnum = 10 + if (max_ng_node==0) max_ng_node=8 !Read header information read(11, *) textholder - read(11, *) textholder !Read number of elements read(11, *) ele_in, textholder read(11, *) type_in, textholder !Read box_boundaries - read(11,*) textholder - read(11,*) temp_box_bd(1:2), texholder - read(11,*) temp_box_bd(3:4), texholder - read(11,*) temp_box_bd(5:6), texholder + read(11,*) temp_box_bd(1:2), textholder + read(11,*) temp_box_bd(3:4), textholder + read(11,*) temp_box_bd(5:6), textholder !Shift the box boundaries if needed do i = 1, 3 @@ -1016,7 +1018,6 @@ module io !Read useless information read(11,*) textholder - read(11,*) textholder !Read atomic masses do i = 1, type_in @@ -1026,13 +1027,11 @@ module io end do !Read useless info - do i = 1, 3 - read(11,*) textholder - end do + read(11,*) textholder !Start the reading loop do i = 1, ele_in - read(11,*) j, ele, element_type, in_basis, esize + read(11,*) j, element_type, in_basis, esize !Check to see if we need to grow the max_basis_num select case(trim(adjustl(element_type))) case('Eight_Node') @@ -1044,10 +1043,10 @@ module io !Now calculate the lattice vectors and shift the nodal points from the corners to the center of the unit cell !Please check the nodal numbering figure in the readme in order to understand which nodes are used for the !calculation - lat_vec(:,1) = (r_node(:,1,2) - r_node(:,1,1))/esize - lat_vec(:,2) = (r_node(:,1,4) - r_node(:,1,1))/esize - lat_vec(:,3) = (r_node(:,1,5) - r_node(:,1,1))/esize - + lat_vec(:,1) = (r_in(:,1,2) - r_in(:,1,1))/(2*esize) + lat_vec(:,2) = (r_in(:,1,4) - r_in(:,1,1))/(2*esize) + lat_vec(:,3) = (r_in(:,1,5) - r_in(:,1,1))/(2*esize) + !Now shift all the nodal positions select case(trim(adjustl(in_lattice_type))) case('fcc','FCC') @@ -1068,7 +1067,7 @@ module io call lattice_map(in_basis, in_basis_types, 8, in_lapa, lat_type) !Now add the element - call add_element(in_lattice_type, esize, lat_type, sub_box_num, r_in) + call add_element(in_lattice_type, esize, lat_type, sub_box_num, r_in(:,1:max_basisnum,1:max_ng_node)) case('Atom') read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,1,1) @@ -1082,17 +1081,24 @@ module io !This code parses input values integer, intent(in) :: apos integer :: arglen, arg_pos + + character(len=100) :: textholder arg_pos = apos + 1 - call get_command_argument(arg_pos, in_lapa, arglen) + call get_command_argument(arg_pos, textholder, arglen) if (arglen==0) then print *, "Missing lattice parameter for set_input_lat" end if + read(textholder,*) in_lapa + print *, in_lapa arg_pos = arg_pos + 1 - call get_command_argument(arg_pos, in_lattice_type, arglen) + call get_command_argument(arg_pos, textholder, arglen) if (arglen==0) then print *, "Missing lattice type for set_input_lat" end if - end subroutine set_input_lat(arg_pos) + read(textholder,*) in_lattice_type + print *, in_lattice_type + + end subroutine set_cac end module io diff --git a/src/main.f90 b/src/main.f90 index 8d153ce..53fa4fa 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -61,10 +61,8 @@ program main case('-wrap') wrap_flag=.true. - !This gives necessary information in order to correctly read .cac files case('-set_cac') call set_cac(i) - end select end do !Determine if a mode is being used and what it is. The first argument has to be the mode