Updates to metric and emrge and adding read_lmp

development
Alex Selimov 4 years ago
parent 85135e7c95
commit 8298c21503

@ -3,6 +3,7 @@
FC=mpif90
FFLAGS=-Wall -mcmodel=large -O0 -g -fbacktrace -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow,denormal
FFLAGS=-O2 -mcmodel=large
OBJDIR=obj
SRCS := $(wildcard *.f90)

@ -635,7 +635,7 @@ module io
end if
select case(temp_infile(scan(temp_infile,'.',.true.)+1:))
case('restart', 'mb', 'cac')
case('lmp','restart', 'mb', 'cac')
infilenum=infilenum+1
infiles(infilenum) = temp_infile
case('out')
@ -673,6 +673,8 @@ module io
call read_mb(infiles(i), displace, temp_box_bd)
case('restart')
call read_pycac(infiles(i), displace, temp_box_bd)
case('lmp')
call read_lmp(infiles(i), displace, temp_box_bd)
case('cac')
call read_lmpcac(infiles(i), displace, temp_box_bd)
case('out')
@ -1053,7 +1055,88 @@ module io
return
end subroutine
subroutine read_lmp(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
character(len=2) :: atom_species
integer :: i, j, k, atom_in, type_in, type_map(10), in_basis, node_types(10,8), &
lat_type, id
real(kind=dp) :: mass, r_in(3), newdisplace(3)
!Open the file
open(unit=11, file=trim(adjustl(file)), action='read',position='rewind')
!Now initialize 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 number of elements
read(11, *) atom_in, textholder
read(11, *) type_in, textholder
!Read box_boundaries
read(11,*) temp_box_bd(1:2), textholder, textholder
read(11,*) temp_box_bd(3:4), textholder, textholder
read(11,*) temp_box_bd(5:6), textholder, textholder
print *, "Read in ", atom_in, " atoms from ", trim(adjustl(file))
!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 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
read(11,*) textholder
!Start the reading loop
do i = 1, atom_in
read(11,*) id, type_in, r_in(:)
call add_atom(id, type_in, sub_box_num, r_in)
end do
close(11)
return
end subroutine read_lmp
subroutine read_lmpcac(file, displace, temp_box_bd)
!This subroutine is used to read .cac files which are used with the lammpsCAC format

@ -58,6 +58,15 @@ module mode_merge
if(shift_flag) call shift(new_starts, i)
end do
!Now reset tags
do i = 1, atom_num
tag_atom(i) = i
end do
do i = 1, ele_num
tag_ele(i) = i
end do
return
end subroutine merge

@ -50,10 +50,12 @@ module mode_metric
end select
!Now set the reference positions
print *, "Combining positions"
call convert_positions(r_zero, npreal)
!Now calculate the neighbor list for the reference configuration
call calc_neighbor(5.0_dp, r_zero, np)
print *, "Getting initial neighbor list"
call calc_neighbor(rc_off, r_zero, np)
!Reset element and box
call reset_data
@ -67,6 +69,7 @@ module mode_metric
print *, "Error in mode_metric where number of points in ", i, "th file is ", np_temp, " and number of points in" &
// "reference file is", npreal
end if
print *, "Calculating metric for file number ", i
call calc_metric
!Now create the output file num and write out to xyz format
ppos = scan(trim(infiles(i)),".", BACK= .true.)

@ -55,11 +55,6 @@ module opt_group
call refinefill_group
end if
if(displace)then
call get_group
call displace_group
end if
if(delete)then
call get_group
call delete_group
@ -75,6 +70,10 @@ module opt_group
call change_group_type
end if
if(displace)then
call get_group
call displace_group
end if
end subroutine group
subroutine parse_group(arg_pos)

Loading…
Cancel
Save