Working changes for reading .cac files

development
Alex Selimov 5 years ago
parent e6d7741060
commit b3e05da6a4

@ -191,7 +191,7 @@ This option creates a circular planar vacancy cluster of radius `radius` normal
This option selects a group of either elements, nodes, atoms and applies some transformation to them.
`select_type` - Either `nodes`, `atoms`, `elements`, `nodes/atoms`, `all`. When using the option `nodes` only nodes which are within the group are selected, `elements` selects elements based on whether the element center is within the group, `nodes/atoms` selects both nodes and atoms for the group. `all` selects elements based on the element center and atoms based on their position.
`select_type` - Either `atoms`, `elements`,`both`. `elements` selects elements based on whether the element center is within the group, `nodes/atoms` selects both nodes and atoms for the group. `both` selects elements based on the element center and atoms based on their position.
`group_shape` - Specifies what shape the group takes and dictates which options must be passed. Each shape requires different arguments and these arguments are represented by the placeholder `shape_arguments`. The accepted group shapes and arguments are below:
@ -230,7 +230,7 @@ This command wraps atoms back into the simulation cell as though periodic bounda
**Remesh**
```
remesh esize lattice_parameter lattice_type
remesh esize
```
This command remeshes the atoms/elements within the group to the new element size `esize`. Currently only accepts an `esize` of 2 which refines it to full atomistics. When remeshing to atomistics the group can contain any orientations of elements but when remeshing to different finite elements, the group must contain all atoms/elements with the same orientation. `lattice_parameter` is the lattice parameter for the elements within the group and `lattice_type` is the lattice type (integer) that these new elements will be assigned to.
@ -294,7 +294,6 @@ This command will delete all overlapping atoms within a specific cutoff radius `
This option is primarily used when reading data from non .mb formats. This code simply sets the orientation variable for the specified sub box `sbox`.
****
## Position Specification
Specifying positions in cacmb can be done through a variety of ways. Examples of each format is shown below.

@ -33,6 +33,8 @@ subroutine call_option(option, arg_pos)
call sbox_ori(arg_pos)
case('-delete')
call run_delete(arg_pos)
case('-set_cac')
arg_pos = arg_pos+3
case default
print *, 'Option ', trim(adjustl(option)), ' is not currently accepted.'
stop 3

@ -35,13 +35,13 @@ module elements
integer :: lattice_types = 0
integer :: max_ng_node, ng_node(10) !Max number of nodes per element and number of nodes per element for each lattice type
integer :: max_esize=0 !Maximum number of atoms per side of element
real(kind=dp) :: lapa(10)
!These variables contain information on the basis, for simplicities sake we limit
!the user to the definition of 10 lattice types with 10 basis atoms at each lattice point.
!This can be easily increased with no change to efficiency
integer :: max_basisnum, basisnum(10) !Max basis atom number, number of basis atoms in each lattice type
integer :: basis_type(10,10)
real(kind=dp) :: lapa(10)
!Additional module level variables we need
logical :: wrap_flag
@ -632,4 +632,38 @@ module elements
end select
end subroutine
subroutine lattice_map(in_bnum, in_btypes, in_ngnodes, in_lapa, lat_type)
!This subroutine maps an input lattice type to either a new lattice type or an existing one depending on basis_type and
!number of nodes at the atoms
integer, intent(in) :: in_ngnodes, in_bnum, in_btypes(10) !Input variables
real(kind=dp), intent(in) :: in_lapa
integer, intent(out) :: lat_type
integer j, ibasis
lat_type = 0
lat_loop:do j = 1, lattice_types
!Check all the lattice level variables
if ((basisnum(j) == in_bnum).and.(ng_node(j) == in_ngnodes).and.(is_equal(lapa(j),in_lapa))) then
!Now check lattice level variables
do ibasis = 1, basisnum(j)
if(basis_type(ibasis,j) /= in_btypes(ibasis)) cycle old_loop
end do
lat_type = j
exit lat_loop
end if
end do lat_loop
!If it doesn't match an existing lattice type we add it
if( lat_type == 0) then
lattice_types = lattice_types + 1
basisnum(lattice_types) = in_bnum
basis_types(:,lattice_types) = in_btypes
ng_node(lattice_types) = in_ngnodes
lapa(lattice_types) = in_lapa
end if
end subroutine lattice_map
end module elements

@ -8,9 +8,9 @@ module io
implicit none
integer :: outfilenum = 0, infilenum = 0
character(len=100) :: outfiles(100), infiles(100)
character(len=100) :: outfiles(100), infiles(100), in_lattice_type=''
logical :: force_overwrite
real(kind=dp) :: in_lapa=0.0
public
contains
@ -959,11 +959,14 @@ module io
character(len=100) :: textholder, element_type, esize
character(len=2) :: atom_species
integer :: i, j, ele_in, type_in, type_map(10), in_basis, node_types(10,8), inod, ibasis, in_basis_types(10)
real(kind=dp) :: mass, r_in(3,10,8), lat_vec(3), in_ori(3,3)
real(kind=dp) :: mass, r_in(3,10,8)
!First open the file
!First check to make sure that we have set the needed variables
if(is_equal(in_lapa,0.0_dp).or.(in_lattice_type=='')) then
print *, "Please use set_cac to set needed parameters to read in .cac file"
stop 3
end if
!Open the file
open(unit=11, file=trim(adjustl(file)), action='read',position='rewind')
!Read header information
@ -979,7 +982,6 @@ module io
read(11,*) box_bd(1:2), texholder
read(11,*) box_bd(3:4), texholder
read(11,*) box_bd(5:6), texholder
!Read useless information
read(11,*) textholder
read(11,*) textholder
@ -1006,9 +1008,34 @@ module io
read(11, *) inod, ibasis, in_basis_types(ibasis), r_in(:,ibasis,inod)
end do
!
!Now calculate the orientation matrix based on the lattice type.
lat_vec = r_in(:,1,2) - r_in(:,1,1)
lat_vec = lat_vec / norm2(lat_vec)
!Now figure out if is an existing lattice_type
call lattice_map(in_basis, in_basis_types, 8, in_lapa, lat_type)
end select
end do
end subroutine read_cac
subroutine set_cac(apos)
!This code parses input values
integer, intent(in) :: apos
integer :: arglen, arg_pos
arg_pos = apos + 1
call get_command_argument(arg_pos, in_lapa, arglen)
if (arglen==0) then
print *, "Missing lattice parameter for set_input_lat"
end if
arg_pos = arg_pos + 1
call get_command_argument(arg_pos, in_lattice_type, arglen)
if (arglen==0) then
print *, "Missing lattice type for set_input_lat"
end if
end subroutine set_input_lat(arg_pos)
end module io

@ -60,6 +60,11 @@ program main
!This lets us know if we need to wrap atomic positions back into the cell
case('-wrap')
wrap_flag=.true.
!This gives necessary information in order to correctly read .cac files
case('-set_cac')
call set_cac(i)
end select
end do
!Determine if a mode is being used and what it is. The first argument has to be the mode

Loading…
Cancel
Save