You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alex Selimov 5e56f2da10
Merge branch 'development' into 'master'
3 years ago
src Update to change style of restart and pycac.out files 3 years ago
.gitignore Update to git ignore to clean directory 4 years ago Add installation instructions 5 years ago
LICENSE Revert "Update license from gplv3 to MIT" 4 years ago
Numbered_element.png Working code which picks random position slightly outside element bounds 4 years ago Correcting problem with README 4 years ago
cacmb.png Update to documentation 4 years ago


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.


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.

Mode Create

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

element_type - Specifies which element type to use, this dictates the crystal being build. Current acceptable options for element_type are:

  • 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.


cacmb --create Cu fcc 3.615 11

Creates a copper element with a lattice parameter of 3.615 with 11 atoms per side

Optional keywords


orient [hkl] [hkl] [hkl]

Default orientation is [100] [010] [001]. If this keyword is present then the user must provide the orientation matrix in form [hkl] [hkl] [hkl].

Example: orient [-112] [110] [-11-1]


duplicate numx numy numz

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


dim 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


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


basis basisnum bname bx by bz

This function allows you to define a custom basis. bname bx by bz must be repeated basisnum times.


efill xyz

This command will rerun the creation algorithm with multiple times starting with an esize of esize and decreasing it by half on every iteration in an effort to maximize the reduction of degrees of freedom in the system. You must specify which dimensions will be filled. The code accepts x, y, z, xy, yz, xz, and xyz specifying which boundaries to fill in.

Mode Convert

cacmb --convert infile outfile

This mode converts a file infile to a file of outfile. The extensions determine the conversion process.

Mode Merge

cacmb --merge dim N infiles outfile

This mode merges multiple data files and creates one big simulation cell. The parameters are:

N - The number of files which are being read

dim - the dimension they are to be stacked along, can be either x, y, or z. If the argument none is passed then the cells are just overlaid. Future options will include a delete overlap command.

Additional options:


shift x y z

If the shift command is passed to mode merge then each file after the first file in the merge command is displaced by the vector [x, y, z]. This is additive so if you are merging three files and this command is passed then the second file is shifted by [x,y,z] and the third file is shifted by 2*[x,y,z].

Example: cacmb --merge z 2 Cu.mb Cu2.mb Cu3.mb Cumerged.mb shift 2 0 0 will shift the atomic and element positions in the Cu2.mb file by [2,0,0] and the positions in Cu3.mb by [4,0,0].



This will wrap atomic positions back inside the box. Effectively as if periodic boundary conditions are applied so that atoms which exit from one side of the simulation cell enter back in through the other.

###Mode Metric

--metric cmetric nfiles {filepaths} 


Options are additional portions of code which have additional functionality. Options are performed in the order that they appear in the argument list and can be added to any mode. If wanting to use strictly options use --convert to specify input and output files.

Option dislgen

-dislgen [ijk] [hkl] x y z burgers char_angle poisson 

This options adds an arbitrarily oriented dislocation into your model based on user inputs using the volterra displacement fields. The options are below

[ijk] - The vector for the line direction

[hkl] - The vector for the slip plane

burgers - The magnitude of the burgers vector for the dislocation to be inserted

x y z - The position of the dislocation centroid

char_angle - Character angle of the dislocation (0 is screw and 90 is edge)

poisson - Poisson's ratio used for the displacement field.

Option disloop

-disloop loop_normal radius x y z bx by bz poisson

This option imposes the displacement field for a dislocation in order to create a loop. This loop is unstable and will close if stress isn't applied.

loop_normal - The box dimension which defines the normal to the loop plane. As of now this dimension must be a closed back direction, meaning that for fcc a box dimension has to be of the (111) family of planes. Either x, y, or z.

n - The number of atoms to delete on the loop plane

x y z - The centroid of the loop.

bx by bz - The burgers vector for the dislocation

poisson - Poisson ratio for continuum solution

Option vacancy_disloop

-vacancydisloop loop_normal radius x y z 

This option creates a circular planar vacancy cluster of radius radius normal to the loop_normal centered on position x y z. Upon relaxing or energy minimization this cluster should become a prismatic dislocation loop.

Option Group

-group select_type group_shape shape_arguments additional keywords

This option selects a group of either elements or atoms and applies some transformation to them.

`select_type` - Either `atoms`, `elements`, or 'both'. `elements` selects elements based on whether the element center is within 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:


-group atoms block xlo xhi ylo yhi zlo zhi

This selects a group residing in a block with edges perpendicular to the simulation cell. The block boundaries are given by xlo xhi ylo yhi zlo zhi.

additional keywords- Represents the various transformations which can be performed on a group. These additional keywords are given below.


-group atoms wedge dim1 dim2 bx by bz bw This selects a group which are within a wedge shape. The options are given as follows: dim1 - The dimension containing the plane normal of the wedge base. dim2 - The thickness dimension. Wedge groups are currently required to span the entire cell thickness in one dimensions which is normal to the triangular face. This through thickness dimension is dim2. bx by bz - Centroid of the center of the base bw - Base width


-group atoms notch dim1 dim2 bx by bz bw tr This shape is similar to a wedge shape except instead of becoming atomically sharp, it finishes in a rounded tip with tip radius tr. Options are as follows. dim1 - The dimension containing the plane normal of the wedge base. dim2 - The thickness dimension. Wedge groups are currently required to span the entire cell thickness in one dimensions which is normal to the triangular face. This through thickness dimension is dim2. bx by bz - Centroid of the center of the base bw - Base width tr - Tip radius


-group atoms sphere x y z r This shape selects all atoms within a sphere centered at (x,y,z) with radius r.


displace x y z 

This is similar to the mode merge -shift argument. This simply shift atoms and elements within the group by a vector [x,y,z].



This command wraps atoms back into the simulation cell as though periodic boundary conditions are being used.


remesh esize 

This command remeshes the atoms/elements within the group to the new element size esize.



This command attempts to reduce the degrees of freedom in the model by replacing them with graded elements. This code works by starting at elements with size esize and then checks all degrees of freedom to see which ones can be replaced by inserting the element. It then iterates over elements of esize-2 to esize=2 which is full atomic resolution.



This command deletes all selected atoms and elements within the group.


random n

This command selects n random atoms and n random elements within your group bounds. If using group type atoms or elements then only n random atoms or elements are selected. This random atoms/elements then form the new group.



This keyword changes the selection criteria when using elements or both to element nodes instead of element centroids.



This keyword changes the group selection criteria from the atoms/elements inside a region to the atoms/elements outside the group.

Option overwrite


If this option is passed then all files are automatically overwritten without asking the user.

Option boundary

-boundary box_bc

This allows the user to specify the boundary conditions for the model being outputted. The format is a 3 character string with p indicating periodic and s indicating shrink-wrapped.

Example: -boundary psp

Option Delete

-delete keywords

Delete requires the usage of additional keywords to specify which delete action will be taken. These additional keywords are below:


-delete overlap rc_off

This command will delete all overlapping atoms within a specific cutoff radius rc_off. This currently does not affect elements.

Option sbox_ori

-sbox_ori sbox [hkl] [hkl] [hkl]

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.

Option redef_box

-redef_box redef_dim {xlo xhi} {ylo yhi} {zlo zhi}

This option allows for the user to redefine box boundaries deleting atoms/elements outside of the new box boundaries. Elements are refined to atmoistics if they intersect the newly defined box boundaries. The arguments are described below: redef_dim - The dimensions to be redefined. Can be any permutation of x, y, z, xy, yz, xz, xyz. The order of the dimensions dictates the order that the new dimensions must be defined

Position Specification

Specifying positions in cacmb can be done through a variety of ways. Examples of each format is shown below.

val - Where val is a number, then that value in Angstroms is used as the position. As an example, 11.1 would be read in as a position of 11.1 \AA.

-inf - This specifies the lower box boundary in the specific dimension. The vector -inf -inf -inf specifies the bottom corner of the simulation cell which also acts as the simulation cell origin. The vector -inf 10 3 instead puts only the x position at the simulation cell origin.

inf - Similar to -inf but references the upper boundary of the box in that dimension

inf-val - Using a minus sign reduces the position from the upper boundary by val. inf-10 would be at a distance of 10 \AA from the upper boundary in that dimension.

inf+val - This increases the position from the lower boundary. inf+10 would be a position 10\AA from the lower boundary within the cell.

inf*val - This gives you a fractional position in the simulation cell. As an example inf*0.5 gives you the center point of the simulation cell.

rand - Returns a random position that lies within the simulation cell.

rand[val1:val2] - returns a random position that lies within the range

rande[facenum] - Returns a random position in an interelement boundary which is offset of the element face facenum. Face numbers are based on the which vertices comprise the face. Vertex numbers are shown in the figure below for the primitive fcc unit cell which is what the fcc rhombohedral element is based from. The face numbers are:

Face 1: [1,2,3,4]

Face 2: [1,2,6,5]

Face 3: [2,3,7,6]

Face 4: [3,4,8,7]

Face 5: [1,4,8,5]

Face 6: [5,6,7,8]

Image for vertex numbers is: