Working version of CACmb capable of building simple models for lammpsCAC

This commit is contained in:
Alex Selimov 2020-01-13 20:12:46 -05:00
parent d09ebfa7e0
commit fbae3a1594
6 changed files with 41 additions and 68 deletions

View file

@ -9,7 +9,7 @@ module io
integer :: outfilenum = 0, infilenum = 0
character(len=100) :: outfiles(10), infiles(10)
logical lmpcac
public
contains
@ -78,53 +78,6 @@ module io
end subroutine get_out_file
subroutine get_in_file(filename)
implicit none
character(len=100), intent(in) :: filename
character(len=100) :: temp_infile
logical :: file_exists
!If no filename is provided then this function is called with none and prompts user input
if (filename=='none') then
print *, "Please specify a filename with extension to read in:"
read(*,*) temp_infile
else
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 doesn't then ask the user for another input
inquire(file=trim(temp_infile), exist=file_exists)
if (.not.file_exists) then
print *, "The file ", temp_infile, "does not exist, please input an existing file to read in."
read(*,*) temp_infile
cycle
end if
if (scan(temp_infile,'.',.true.) == 0) then
print *, "No extension included on filename, please type a full filename that includes an extension."
read(*,*) temp_infile
cycle
end if
select case(temp_infile(scan(temp_infile,'.',.true.)+1:))
case('cac')
infilenum=infilenum+1
infiles(infilenum) = temp_infile
exit
case default
print *, "File type: ", trim(temp_infile(scan(temp_infile,'.',.true.):)), " not currently accepted. ", &
"please input a filename with extension from following list: cac."
read(*,*) temp_infile
end select
end do
end subroutine get_in_file
subroutine write_out
!This subroutine loops over alll of the outfile types defined and calls the correct writing subroutine