From db8428113d54b888da8f96d5fa32496637600ba7 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Thu, 25 Mar 2021 11:40:47 -0400 Subject: [PATCH] Changes to restart file format --- src/io.f90 | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/io.f90 b/src/io.f90 index d2ffa21..5472c00 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -241,7 +241,6 @@ module io open(unit=11, file=trim(adjustl(file)), action='write', status='replace',position='rewind') - print *, max_basisnum, max_esize !Write header information write(11,1) timestep @@ -639,10 +638,10 @@ module io 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 +! 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('--calc', '--convert','--metric') infilenum = infilenum+1 @@ -968,12 +967,13 @@ module io real(kind=dp), dimension(6), intent(out) :: temp_box_bd !Internal Variables - integer :: i, in_eles, in_atoms, inbtypes(10), lat_type, ia, ie, inod, & - id, type_node, ilat, esize, tag, type, bnum, n, ibasis, ip + integer :: i, j, in_eles, in_atoms, inbtypes(10), lat_type, ia, ie, inod, & + id, type_node, ilat, esize, tag, type, bnum, n, ibasis, ip, atom_type_map(100) real(kind=dp) :: newdisplace(3), ra(3), in_lapa, ea, fa(3), va(6), & - ee(10,8), fe(3,10,8), ve(6,10,8), re(3,10,8) + ee(10,8), fe(3,10,8), ve(6,10,8), re(3,10,8), atomic_masses(10) character(len=100) :: textholder, fcc character(len=1000) :: line + character(len=2) :: atomic_element open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') @@ -1016,6 +1016,19 @@ module io call grow_sub_box(1) end if + !Now read in masses for atoms + read(11, '(a)') line + j = tok_count(line) + read(line, *) textholder, (atomic_masses(i), i=1, j-1) + + !Read define atom_types by mass + do i = 1, j + call atommassspecies(atomic_masses(i), atomic_element) + call add_atom_type(atomic_element, atom_type_map(i)) + end do + + + !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) @@ -1028,7 +1041,7 @@ module io do ia = 1, in_atoms read(11,'(a)') line(:) read(line,*) tag, type, ra(:), ea, fa(:), va(:) - call add_atom(tag, type, sub_box_num, ra) + call add_atom(tag, atom_type_map(type), sub_box_num, ra) call add_atom_data(atom_num, ea, fa, va) end do @@ -1046,6 +1059,9 @@ module io do inod =1, n*bnum read(11,*) ip, ibasis, inbtypes(ibasis), re(:,ibasis,ip), ee(ibasis,ip), fe(:,ibasis,ip), ve(:,ibasis,ip) end do + do i = 1, bnum + inbtypes(ibasis) = atom_type_map(inbtypes(ibasis)) + end do call lattice_map(bnum, inbtypes, n, 1.0_dp, lat_type) call add_element(tag, fcc, esize+1, lat_type, sub_box_num, re) call add_element_data(ele_num, ee, fe, ve) @@ -1276,7 +1292,6 @@ module io 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, textholder, arglen)