Initial commit with file writing and create mode working for atoms

This commit is contained in:
Alex 2019-11-25 18:19:25 -05:00
parent 624886bbe9
commit 8217e8b51c
15 changed files with 2465 additions and 271 deletions

130
README.md
View file

@ -1,96 +1,94 @@
# CAC_Model_Builder
This is a tool for building models in CAC. Commands and usage options are below.
This is a tool for building models in CAC. Commands and usage options are below. This code is intended to follow the atomsk code fairly closely.
## Modes
The modes follow similarly to the modes you find when using atomsk. The modes will be listed below alongside their syntax and other usage instructions. As a note, if a mode is being used then it has to come first.
## Flow of commands
### Mode Create
```flow
op1=>operation: Define atom types and lattices to be used
op2=>operation: Define regions and build
op3=>operation: Define modifiers
op4=>operation: Output data files
op1->op2->op3->op4
```
cacmb --create name element_type lattice_parameter esize
```
Mode create has the following parameters:
`name` - User defined name that either defines the atom type or the lattice type if using the basis option
## Command syntax
`element_type` - Specifies which element type to use, this dictates the crystal being build. Current acceptable options for element_type are:
### Atom types command
* FCC - Uses the Rhombohedral primitive fcc unit cell as the finite element.
`lattice_parameter` - The lattice parameter for the crystal structure.
`esize` - Number of atoms per edge of the finite element. A value of 2 signifies full atomistic resolution and is the lowest number acceptable.
**Example**
```
atom_types num_atoms {name mass}
cacmb --create Cu fcc 3.615 11
```
The parameters for the atoms command are:
Creates a copper element with a lattice parameter of 3.615 with 11 atoms per side
`num_atoms` - number of atom types defined for this model building session
#### Optional keywords
`{}` - indicate that the contents must be repeated `num_atoms` times.
**Orient**
`name` - Elemental name of atom
`mass` - mass of the atom
This command should only be called once, defining all atoms in one go. The atom types will then be defined in numeric order with the first atom defined being type one and the last one being type `num_atoms`.
### Lattice command
```
lattice id lattice_type lattice_parameter [type atom_type] [basis num_basis_atoms {type posx posy posz}]
``` orient [hkl] [hkl] [hkl]
orient [hkl] [hkl] [hkl]
```
The parameters for the lattice command are:
Default orientation is `[100] [010] [001]`. If this keyword is present then the user must provide the orientation matrix in form `[hkl] [hkl] [hkl]`.
`id` - User defined id for this lattice type
*Example:* `orient [-112] [110] [-11-1]`
`lattice_type` - One of predefined lattice types which specifies the element type used. Current accepted options are: `FCC`
**Basis**
`type` - Optional keyword which defines the atom type used for the lattice. This is used in place of basis if atoms are at lattice positions in these elements.
`atom_type` - The atom type which corresponds to the atoms at the lattice positions of the current element
`basis` - Optional keyword which is used in order to define the basis atoms instead of using the default definition. If basis is not included the following commands also are not included.
`num_basis_atoms` are the number of basis atoms in this element.
`{}` - indicate that the contents must be repeated `num_basis_atoms` times.
`type` - the atom type of the atom.
`posx posy posz` - The position of the basis atom relative to the lattice point at (0,0,0)
**Either type or basis keywords must be present in the lattice command, both cannot be used.**
## Region Command
```
region id lattice_id element_size units lenx leny lenz [zigzag] [origin x y z] [cat region_id dim [nomatch]] [orient [hkl] [hkl] [hkl]]
```
basis num atom_name x y z
```
`id` - User defined id for this region
Default basis has `atom_name = name` with position (0,0,0). If used then the `atom_name x y z` must be include `num` times.
`lattice_id` - The lattice type for this region
*Example:* `basis 2 Mg 0 0 0 Mg 0.5 0.288675 0.81647`
`element_size` - The element size used for this region defined as the number of atoms per element edge. An element size of 2 means that this region is at full atomistic resolution.
`units` - Either `lattice` or `box` which adjusts how the length values are calculated. Units `lattice` means the region will consist of `len` number of elements for every dim. Units `box` are defined in angstroms.
`lenx leny lenz` - The lengths of the box in each dimension in the user defined units
`zigzag` - Optional keyword which specifies if regions built with elements should have filled in boundaries (using atoms). If zigzag isn't present then the regions are built with filled in boundaries by default
`origin x y z` - Optional keyword which specifies the origin of the current region in angstroms. The region boundaries are then (x, x+lenx), (y, y+leny), (z,z+lenz).
`cat region_id outregionid dim [nomatch] ` - Optional keyword which stacks the current region on the face of another region defined by `dim`. `region_id` is the id of the region which is already build. `outregionid` is the user defined id of the combined stacked region which can be used with further merge commands. Default behavior is to expand the smallest region to match the larger one, using the optional keyword `nomatch` preserves the original regions and does not attempt to match the boundaries.
`orient [hkl] [hkl] [hkl]` simply orients the unit cell of this region. This defaults to [100] [010] [001]
### Write command
**Duplicate**
```
write file_name
duplicate numx numy numz
```
Self explanatory.
Default duplicate is `1 1 1`. This is used to replicate the element along each dimensions. This cannot be used if the keyword dimensions is included. By default jagged edges along boundaries are filled if duplicate is greater than `1 1 1`.
*Example:* `duplicate 10 10 10`
**Dimensions**
```
dimensions dimx dimy dimz
```
There is no default dimensions as duplicate is the default option. This command assigns a box with user-assigned dimensions and fills it with the desired element. By default atoms fill in the jagged edges at the boundaries if the dimensions command is included.
Example: `dimensions 100 100 100`
**ZigZag**
```
zigzag boolx booly boolz
```
Default zigzag is `f f f`. This command specifies whether a boundary should be left jagged (i.e. in essence not filled in). If `boolx` is `t` than the x dimension is left jagged and if it is `f` then the x dimension is filled.
*Example:* `zigzag t f t` gives a box with jagged edges in the x and z and filled edges in the y.
**Origin**
```
origin x y z
```
Default origin is `0 0 0`. This command just sets the origin for where the simulation cell starts building.
*Example:* `origin 10 0 1`