diff --git a/README.md b/README.md index c83516c..036981d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Default duplicate is `1 1 1`. This is used to replicate the element along each d **Dimensions** ``` -dimensions dimx dimy dimz +dim dimx dimy dimz ``` There is no default dimensions as duplicate is the default option. This command assigns a box with user-assigned dimensions and fills it with the desired element. By default atoms fill in the jagged edges at the boundaries if the dimensions command is included. @@ -129,6 +129,11 @@ wrap This will wrap atomic positions back inside the box. Effectively as if periodic boundary conditions are applied so that atoms which exit from one side of the simulation cell enter back in through the other. +###Mode Metric +``` +--metric cmetric nfiles {filepaths} +``` + ## 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. diff --git a/src/box.f90 b/src/box.f90 index faf268c..83d81a8 100644 --- a/src/box.f90 +++ b/src/box.f90 @@ -97,4 +97,10 @@ module box end do return end subroutine in_sub_box + + subroutine reset_box + !This subroutine just resets the box boundary and position + box_bc = "ppp" + box_bd(:) = 0 + end subroutine reset_box end module box diff --git a/src/elements.f90 b/src/elements.f90 index a12d263..ab1a60e 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -793,4 +793,11 @@ module elements virial_node(:,:,:,ie) = virial return end subroutine add_element_data + + subroutine reset_data + !This function resets all of the data arrays for the elements and atoms + atom_num = 0 + ele_num = 0 + node_num = 0 + end subroutine reset_data end module elements diff --git a/src/io.f90 b/src/io.f90 index e1ec449..556ce1f 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -583,49 +583,41 @@ module io temp_infile = filename end if - !Infinite loop which only exists if user provides valid filetype - do while(.true.) + !Check to see if file exists, if it does then ask user if they would like to overwrite the file + inquire(file=trim(temp_infile), exist=file_exists) + if (.not.file_exists) then + print *, "The file ", trim(adjustl(filename)), " does not exist. Please input an existing file to read." + stop 3 + end if - !Check to see if file exists, if it does then ask user if they would like to overwrite the file - inquire(file=trim(temp_infile), exist=file_exists) - if (.not.file_exists) then - print *, "The file ", trim(adjustl(filename)), " does not exist. Please input a filename that exists" - read(*,*) temp_infile - cycle + select case(temp_infile(scan(temp_infile,'.',.true.)+1:)) + case('restart', 'mb', 'cac') + infilenum=infilenum+1 + infiles(infilenum) = temp_infile + case('out') + if(atom_types == 0) then + print *, "Please run -set_types command prior to running code requiring reading in pycac_*.out files" + stop 3 end if - - select case(temp_infile(scan(temp_infile,'.',.true.)+1:)) - case('restart', 'mb', 'cac') - infilenum=infilenum+1 - infiles(infilenum) = temp_infile - exit - case('out') - if(atom_types == 0) then - print *, "Please run -set_types command prior to running code requiring reading in pycac_*.out files" - stop 3 - end if - select case(trim(adjustl(mode))) - case('--convert','--metric') - infilenum = infilenum+1 - infiles(infilenum) = temp_infile - exit - case default - print *, "Files of type .out cannot be used with mode ", trim(adjustl(mode)) - stop 3 - end select - - case default - print *, "File type: ", trim(temp_infile(scan(temp_infile,'.',.true.):)), "not currently accepted. ", & - "please input a filename with extension from following list: mb, restart, cac, or out." - read(*,*) temp_infile - + select case(trim(adjustl(mode))) + case('--convert','--metric') + infilenum = infilenum+1 + infiles(infilenum) = temp_infile + case default + print *, "Files of type .out cannot be used with mode ", trim(adjustl(mode)) + stop 3 end select - end do + + case default + print *, "File type: ", trim(temp_infile(scan(temp_infile,'.',.true.):)), "not currently accepted. ", & + "please input a filename with extension from following list: mb, restart, cac, or out." + stop 3 + end select end subroutine get_in_file subroutine read_in(i, displace, temp_box_bd) - !This subroutine loops over alll of the outfile types defined and calls the correct writing subroutine + !This subroutine reads in file i integer, intent(in) :: i real(kind=dp), dimension(3), intent(in) :: displace @@ -1067,6 +1059,7 @@ module io end do call add_element(tag, fcc, esize+1, lat_type, sub_box_num, re) call add_element_data(ele_num, ee, fe, ve) + node_num = node_num + 8 end do end if call set_max_esize diff --git a/src/opt_delete.f90 b/src/opt_delete.f90 index 09cefb1..c3bcc9e 100644 --- a/src/opt_delete.f90 +++ b/src/opt_delete.f90 @@ -3,6 +3,7 @@ module opt_delete use parameters use subroutines use elements + use neighbors implicit none diff --git a/src/subroutines.f90 b/src/subroutines.f90 index 1015968..b272c16 100644 --- a/src/subroutines.f90 +++ b/src/subroutines.f90 @@ -198,66 +198,6 @@ module subroutines end do end subroutine - subroutine build_cell_list(numinlist, r_list, rc_off, cell_num, num_in_cell, cell_list, which_cell) - !This subroutine builds a cell list based on rc_off - - !----------------------------------------Input/output variables------------------------------------------- - - integer, intent(in) :: numinlist !The number of points within r_list - - real(kind=dp), dimension(3,numinlist), intent(in) :: r_list !List of points to be used for the construction of - !the cell list. - - real(kind=dp), intent(in) :: rc_off ! Cutoff radius which dictates the size of the cells - - integer, dimension(3), intent(inout) :: cell_num !Number of cells in each dimension. - - integer, allocatable, intent(inout) :: num_in_cell(:,:,:) !Number of points within each cell - - integer, allocatable, intent(inout) :: cell_list(:,:,:,:) !Index of points from r_list within each cell. - - integer, dimension(3,numinlist), intent(out) :: which_cell !The cell index for each point in r_list - - !----------------------------------------Begin Subroutine ------------------------------------------- - - integer :: i, j, cell_lim, c(3) - real(kind=dp) :: box_len(3) - integer, allocatable :: resize_cell_list(:,:,:,:) - - !First calculate the number of cells that we need in each dimension - do i = 1,3 - box_len(i) = box_bd(2*i) - box_bd(2*i-1) - cell_num(i) = int(box_len(i)/(rc_off/2))+1 - end do - - !Initialize/allocate variables - cell_lim = 10 - allocate(num_in_cell(cell_num(1),cell_num(2),cell_num(3)), cell_list(cell_lim, cell_num(1), cell_num(2), cell_num(3))) - - !Now place points within cell - do i = 1, numinlist - !c is the position of the cell that the point belongs to - do j = 1, 3 - c(j) = int((r_list(j,i)-box_bd(2*j-1))/(rc_off/2)) + 1 - end do - - !Place the index in the correct position, growing if necessary - num_in_cell(c(1),c(2),c(3)) = num_in_cell(c(1),c(2),c(3)) + 1 - if (num_in_cell(c(1),c(2),c(3)) > cell_lim) then - allocate(resize_cell_list(cell_lim+10,cell_num(1),cell_num(2),cell_num(3))) - resize_cell_list(1:cell_lim, :, :, :) = cell_list - resize_cell_list(cell_lim+1:, :, :, :) = 0 - call move_alloc(resize_cell_list, cell_list) - end if - - cell_list(num_in_cell(c(1),c(2),c(3)),c(1),c(2),c(3)) = i - which_cell(:,i) = c - end do - - return - end subroutine build_cell_list - - subroutine check_right_ortho(ori, isortho, isrighthanded) !This subroutine checks whether provided orientations in the form: ! | x1 x2 x3 | @@ -301,4 +241,5 @@ module subroutines return end subroutine check_right_ortho + end module subroutines