Change implementation to make atom types a bit better

development
Alex Selimov 2 years ago
parent f9e7f68676
commit 59a0c18779

@ -509,7 +509,7 @@ module io
character(len=100), intent(in) :: file character(len=100), intent(in) :: file
integer :: interp_max, i, j, inod, ibasis, ip, unique_index(50), unique_size(50), unique_type(50), unique_num, & integer :: interp_max, i, j, inod, ibasis, ip, unique_index(50), unique_size(50), unique_type(50), unique_num, &
etype etype
real(kind=dp) :: box_vec(3), masses(10) real(kind=dp) :: box_vec(3)
1 format('time' / i16, f23.15) 1 format('time' / i16, f23.15)
2 format('number of elements' / i16) 2 format('number of elements' / i16)
@ -548,9 +548,6 @@ module io
write(11,3) node_num write(11,3) node_num
write(11,19) max_ng_node, max_basisnum write(11,19) max_ng_node, max_basisnum
write(11,5) atom_num write(11,5) atom_num
do i = 1, atom_types
call atommass(type_to_name(i),masses(i))
end do
write(11,*) "masses: " write(11,*) "masses: "
write(11, *) (masses(i), i = 1, atom_types) write(11, *) (masses(i), i = 1, atom_types)
write(11,7) box_bc(1:1), box_bc(2:2), box_bc(3:3) write(11,7) box_bc(1:1), box_bc(2:2), box_bc(3:3)
@ -631,7 +628,7 @@ module io
write(11,*) box_bd(:) write(11,*) box_bd(:)
!Write the number of atom types in the current model and all of their names !Write the number of atom types in the current model and all of their names
write(11,*) atom_types, (type_to_name(i)//' ', i=1, atom_types) write(11,*) atom_types, (masses(i), i=1, atom_types)
!Write the number of lattice_types, basisnum and number of nodes for each lattice type !Write the number of lattice_types, basisnum and number of nodes for each lattice type
write(11,*) lattice_types, (basisnum(i), i = 1, lattice_types), (ng_node(i), i = 1, lattice_types) write(11,*) lattice_types, (basisnum(i), i = 1, lattice_types), (ng_node(i), i = 1, lattice_types)
!Now for every lattice type write the basis atom types !Now for every lattice type write the basis atom types
@ -754,9 +751,8 @@ module io
new_type_to_type(10), new_lattice_types, new_lattice_map(10), btype_map(10,10), bnum_map(10), & new_type_to_type(10), new_lattice_types, new_lattice_map(10), btype_map(10,10), bnum_map(10), &
node_map(10) node_map(10)
character(len=100) :: etype character(len=100) :: etype
real(kind=dp) :: r(3), newdisplace(3), lapa_map(10) real(kind=dp) :: r(3), newdisplace(3), lapa_map(10), new_masses(10)
real(kind=dp), allocatable :: r_innode(:,:,:) real(kind=dp), allocatable :: r_innode(:,:,:)
character(len = 2) :: new_type_to_name(10)
!First open the file !First open the file
open(unit=11, file=trim(adjustl(file)), action='read',position='rewind') open(unit=11, file=trim(adjustl(file)), action='read',position='rewind')
@ -777,11 +773,11 @@ module io
call grow_box(temp_box_bd) call grow_box(temp_box_bd)
!Read in the number of atom types and all their names !Read in the number of atom types and all their names
read(11, *) new_atom_types, (new_type_to_name(i), i = 1, new_atom_types) read(11, *) new_atom_types, (new_masses(i), i = 1, new_atom_types)
!Now fit these into the global list of atom types, after this new_type_to_type is the actual global !Now fit these into the global list of atom types, after this new_type_to_type is the actual global
!type of the atoms within this file !type of the atoms within this file
do i = 1, new_atom_types do i = 1, new_atom_types
call add_atom_type(new_type_to_name(i), new_type_to_type(i), all_new) call add_atom_type(new_masses(i), new_type_to_type(i), all_new)
end do end do
!Read the number of lattice types, basisnum, and number of nodes for each lattice type !Read the number of lattice types, basisnum, and number of nodes for each lattice type
read(11,*) new_lattice_types, (bnum_map(i), i = 1, new_lattice_types),(node_map(i), i =1, new_lattice_types) read(11,*) new_lattice_types, (bnum_map(i), i = 1, new_lattice_types),(node_map(i), i =1, new_lattice_types)
@ -893,8 +889,7 @@ module io
!Read define atom_types by mass !Read define atom_types by mass
print *, j print *, j
do i = 1, j do i = 1, j
call realatomspecies(atomic_masses(i), atomic_element) call add_atom_type(atomic_masses(i), atom_type_map(i), all_new)
call add_atom_type(atomic_element, atom_type_map(i), all_new)
print *, i, atom_type_map(i) print *, i, atom_type_map(i)
end do end do
@ -1029,8 +1024,7 @@ module io
!Read define atom_types by mass !Read define atom_types by mass
do i = 1, j do i = 1, j
call realatomspecies(atomic_masses(i), atomic_element) call add_atom_type(atomic_masses(i), atom_type_map(i), all_new)
call add_atom_type(atomic_element, atom_type_map(i), all_new)
end do end do
if(in_atoms > 0 ) then if(in_atoms > 0 ) then
@ -1152,8 +1146,7 @@ module io
!Read atomic masses !Read atomic masses
do i = 1, type_in do i = 1, type_in
read(11,*) j, mass read(11,*) j, mass
call realatomspecies(mass, atom_species) call add_atom_type(mass, type_map(i), all_new)
call add_atom_type(atom_species, type_map(i), all_new)
end do end do
!Read useless info !Read useless info
@ -1226,8 +1219,7 @@ module io
!Read atomic masses !Read atomic masses
do i = 1, type_in do i = 1, type_in
read(11,*) j, mass, textholder read(11,*) j, mass, textholder
call realatomspecies(mass, atom_species) call add_atom_type(mass, type_map(i), all_new)
call add_atom_type(atom_species, type_map(i), all_new)
end do end do
!Read useless info !Read useless info
@ -1311,6 +1303,7 @@ module io
integer :: i, j,arglen, arg_pos, ntypes integer :: i, j,arglen, arg_pos, ntypes
character(len=100) :: textholder character(len=100) :: textholder
real(kind=dp) :: mass
arg_pos = apos + 1 arg_pos = apos + 1
call get_command_argument(arg_pos, textholder, arglen) call get_command_argument(arg_pos, textholder, arglen)
@ -1320,7 +1313,8 @@ module io
do i=1,ntypes do i=1,ntypes
arg_pos = arg_pos + 1 arg_pos = arg_pos + 1
call get_command_argument(arg_pos, textholder, arglen) call get_command_argument(arg_pos, textholder, arglen)
call add_atom_type(textholder, j) call atommass(textholder, mass)
call add_atom_type(mass, j)
end do end do
return return

@ -186,6 +186,7 @@ module mode_create
character(len=100) :: orient_string character(len=100) :: orient_string
character(len=2) :: btype character(len=2) :: btype
logical :: isortho, isrighthanded, bool logical :: isortho, isrighthanded, bool
real(kind=dp) :: mass
!Pull out all required positional arguments !Pull out all required positional arguments
@ -265,7 +266,8 @@ module mode_create
do i = 1, max_basisnum do i = 1, max_basisnum
call get_command_argument(arg_pos, btype) call get_command_argument(arg_pos, btype)
arg_pos = arg_pos+1 arg_pos = arg_pos+1
call add_atom_type(btype, basis_type(i,1)) call atommass(btype, mass)
call add_atom_type(mass, basis_type(i,1))
do j = 1, 3 do j = 1, 3
call get_command_argument(arg_pos, textholder) call get_command_argument(arg_pos, textholder)
read(textholder, *) basis_pos(j,i) read(textholder, *) basis_pos(j,i)
@ -334,7 +336,8 @@ module mode_create
if (basisnum(1) == 0) then if (basisnum(1) == 0) then
max_basisnum = 1 max_basisnum = 1
basisnum(1) = 1 basisnum(1) = 1
call add_atom_type(name, basis_type(1,1)) !If basis command not defined then we use name as the atom_name call atommass(name, mass)
call add_atom_type(mass, basis_type(1,1)) !If basis command not defined then we use name as the atom_name
basis_pos(:,1) = 0.0_dp basis_pos(:,1) = 0.0_dp
end if end if
@ -371,6 +374,8 @@ module mode_create
numlatpoints = numlatpoints*(bd_in_lat(2*i)-bd_in_lat(2*i-1)) numlatpoints = numlatpoints*(bd_in_lat(2*i)-bd_in_lat(2*i-1))
end do end do
if(numlatpoints < 0) stop "number of lattice points is negative, this can occur if the model is too big"
!Allocate the correct lat variable !Allocate the correct lat variable
select case(esize) select case(esize)
!Atomistics !Atomistics

Loading…
Cancel
Save