diff --git a/src/caller.f90 b/src/caller.f90 index dc99fbd..c948304 100644 --- a/src/caller.f90 +++ b/src/caller.f90 @@ -64,6 +64,8 @@ module caller arg_pos = arg_pos + 1 case('-norefine') arg_pos = arg_pos + 1 + case('all_new') + arg_pos = arg_pos + 1 case('-orient') call orient_opt(arg_pos) case('-unorient') diff --git a/src/elements.f90 b/src/elements.f90 index 3e73d37..3b3fc28 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -332,22 +332,32 @@ module elements end subroutine add_atom - subroutine add_atom_type(type, inttype) + subroutine add_atom_type(type, inttype, force_new) !This subroutine adds a new atom type to the module list of atom types character(len=2), intent(in) :: type integer, intent(out) :: inttype + logical, optional, intent(in) :: force_new + integer :: i - logical :: exists + logical :: exists, force + if(present(force_new)) then + force = force_new + else + force = .false. + end if + exists = .false. - do i=1, 10 - if(type == type_to_name(i)) then - exists = .true. - inttype = i - exit - end if - end do + if(.not.force) then + do i=1, 10 + if(type == type_to_name(i)) then + exists = .true. + inttype = i + exit + end if + end do + end if if (exists.eqv..false.) then atom_types = atom_types+1 diff --git a/src/io.f90 b/src/io.f90 index aab20c9..e78fef7 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -10,7 +10,7 @@ module io integer :: outfilenum = 0, infilenum = 0 character(len=100) :: outfiles(100), infiles(100), in_lattice_type='' - logical :: force_overwrite, norefine + logical :: force_overwrite, norefine, all_new real(kind=dp) :: in_lapa=0.0 public contains @@ -772,7 +772,7 @@ module io !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 do i = 1, new_atom_types - call add_atom_type(new_type_to_name(i), new_type_to_type(i)) + call add_atom_type(new_type_to_name(i), new_type_to_type(i), all_new) end do !Read the number of lattice types, basisnum, and number of nodes for each lattice type read(11,*) new_lattice_types, (basisnum(i), i = lattice_types+1, lattice_types+new_lattice_types), & @@ -903,7 +903,7 @@ module io print *, j do i = 1, j call atommassspecies(atomic_masses(i), atomic_element) - call add_atom_type(atomic_element, atom_type_map(i)) + call add_atom_type(atomic_element, atom_type_map(i), all_new) print *, i, atom_type_map(i) end do @@ -1057,7 +1057,7 @@ module io !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)) + call add_atom_type(atomic_element, atom_type_map(i), all_new) end do @@ -1171,7 +1171,7 @@ module io do i = 1, type_in read(11,*) j, mass call ATOMMASSSPECIES(mass, atom_species) - call add_atom_type(atom_species, type_map(i)) + call add_atom_type(atom_species, type_map(i), all_new) end do !Read useless info @@ -1259,7 +1259,7 @@ module io do i = 1, type_in read(11,*) j, mass, textholder call ATOMMASSSPECIES(mass, atom_species) - call add_atom_type(atom_species, type_map(i)) + call add_atom_type(atom_species, type_map(i), all_new) end do !Read useless info diff --git a/src/main.f90 b/src/main.f90 index a41f396..92afba1 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -42,6 +42,7 @@ program main force_overwrite=.false. norefine=.false. wrap_flag = .false. + all_new = .false. end_mode_arg = 0 @@ -70,6 +71,8 @@ program main call set_cac(i) case('-set_types') call set_types(i) + case('-all_new') + all_new=.true. end select end do !Determine if a mode is being used and what it is. The first argument has to be the mode