MEGACELL: A nanocrystal model construction software for HRTEM multislice simulation Daniel G. Stroppa*, Luciano A. Montoro, Ricardo D. Righetto, Antonio J. Ramirez Brazilian Synchrotron Light Laboratory, 13083-970, Campinas, SP, Brazil *dstroppa@lnls.br Intro: This document contains the support information for MEGACELL software. It includes the disclaimer, the technical information and the user’s manual for MEGACELL 1.1. Please contact the corresponding author if additional information is required. MEGACELL files are available at http://megacell.lnls.br 1. Disclaimer MEGACELL may be freely distributed and edited as open-source citation-ware software, provided that no charge above the cost of distribution is levied, and that this disclaimer text is always attached to it. Please contact the corresponding author for including any substantial improvement made on MEGACELL code on the updated versions. Please consider using the following citation if MEGACELL application provided relevant support: “Stroppa, D. G.; Righetto, R. D.; Montoro, L. A.; Ramirez, A. J.; MEGACELL: A nanocrystal model construction software for HRTEM multislice simulation, Ultramicroscopy, 2011, doi:10.1016/j.ultramic.2011.03.013.” MEGACELL is provided as is without any guarantees or warranty. Although the authors have attempted to find and correct any bugs in it, the authors are not responsible for any damage or losses of any kind caused by the use or misuse of MEGACELL. The authors are under no obligation to provide support, service, corrections, or upgrades to MEGACELL. For more information, please send an email to the corresponding author. MEGACELL development was related to D. G. Stroppa Ph.D. thesis work at State University of Campinas. This project was funded by FAPESP and supported by LNLS. 2. Technical features 2.1 Programming Language MEGACELL was fully developed in the MATLAB platform. 2.2 Compatibility MEGACELL is available as a 32-bit standalone executable for the Microsoft Windows 2000/XP/Vista/7 platforms, in which it was tested and assured to run. This executable was generated with the MATLAB Compiler toolbox. Also, the megacell.m file (as well as its auxiliary functions) is available, which can be edited and executed in MATLAB, regarding the MEGACELL disclaimers. Although MEGACELL is not readily compatible with GNU Octave, this compatibility might be achieved with some minor changes in the code and relaying of the graphical user interface. 2.3 Known Issues MEGACELL may be incompatible with outdated MATLAB versions. The oldest MATLAB version in which MEGACELL was tested is R2009a. 2.4 Release notes Version 1.1: - Inclusion of .xyz input file support. - Inclusion of the bbox_factor on the parameter input file. - Graphical user interface update 2.5 Install instructions The executable (.exe) version of MEGACELL requires the MATLAB Compiler Runtime Environment installation. This compiler is included on the self-extracting package (megacell_pkg.exe). 2.5.1 MEGACELL standalone executable installation 1. Copy the MEGACELL self-extracting package (megacell_pkg.exe) to the desired path on your local machine; 2. Execute it from there; All the files contained in the package will be extracted to the current location; 3. The installation of the MATLAB Compiler Runtime Environment will begin automatically. Follow the instructions; 4. MEGACELL is ready to run just by clicking megacell.exe! 2.5.2 MEGACELL source code installation 1. Extract the megacell_source.zip file to the desired location; 2. Open MATLAB; 3. Point MATLAB path to the MEGACELL location; 4. Type megacell in the MATLAB command line to run the program; The MEGACELL source code can be edited from the MATLAB Editor or any other preferred text editor; 3. Basic instructions 3.1 MEGACELL standalone executable 1. Run MEGACELL.exe - the following interface will be loaded; 2. Proceed to the software interface by clicking on I Agree - the following interface will be loaded; 3. Browse the input parameter file on the upper field; 4. Select the supercell output format; 5. Click “Generate File”; The output files will be placed on the same folder as the input text file. A complete description for the input text file is presented on Section 4. 4. Construction stages The nanocrystal model construction by MEGACELL is performed according to the parameters informed by the user on the input text file, which is thoroughly discussed in this chapter subsections. The input file parameters description is divided among the MEGACELL construction steps, which are depicted on software workflow in Figure 1. Figure 1: MEGACELL simplified workflow. The operation blocks are highlighted on bold boxes. 4.1 Unit Cell definition The Unit Cell operation block retrieves the unit cell information and stores it for the subsequent steps. Firstly, the unit cell general information is retrieved from the [Unit Cell] subsection as depicted in Table 1. Table 1: Unit Cell general information input in the [Unit Cell] subsection General layout Example Comments name = sample name = Si_x sample is the project name and the generated files prefix n_atoms = N n_atoms = 18 N is the number of atoms within the unit cell a=A a = 0.5431 A is the a lattice parameter in nanometers b=B b = 0.5431 B is the b lattice parameter in nanometers c=C c = 0.5431 C is the c lattice parameter in nanometers alpha = D alpha = 90 D is the alpha lattice angle in degrees beta = E beta = 90 E is the beta lattice angle in degrees gamma = F gamma = 90 F is the gamma lattice angle in degrees Secondly, the atoms relative coordinates within the unit cell are retrieved from the input text file subsection named [Atoms Coordinates]. Each atom coordinates are informed relatively to the lattice parameters and range from 0 to 1 for each axis, as exemplified on Table 2. Table 2: Atoms relative coordinates input in the [Atoms Coordinates] subsection General layout Example Comments tn = Z t1 = Si n are integers ranging from 1 to N; Z is the atom type xn = x0 x1 = 0 x0 is the relative coordinate of the atom n in the a axis yn = y0 y1 = 0 y0 is the relative coordinate of the atom n in the b axis zn = z0 z1 = 0 z0 is the relative coordinate of the atom n in the c axis 4.2 Supercell The Supercell operation block generates a supercell structure, which is a combination of unit cells replications along the space and cuts steps. Note that all the operations in this section are performed on the points space, which is equivalent to consider the lattice parameters equal to 1 and the lattice angles equal to 90. The application of lattice parameters and angles is only performed on the Real space operation block. 4.2.1 Block Building The Block Building operation generates block with dimensions l x m x n (unit cells) by replicating the unit cell along the Cartesian directions (x; y; z) according to the [Supercell] subsection, as exemplified in Table 3. The constructed block is centered at the (0,0,0) position and each atomic position is checked in order to prevent duplicated atoms. Table 3: Input for the [Supercell] subsection General layout Example Comments bulkx = l bulkx = 8 l is the block dimension in unit cells along the x axis bulky = m bulky = 8 m is the block dimension in unit cells along the y axis bulkz = n bulkz = 8 n is the block dimension in unit cells along the z axis bbox_factor = bb bbox_factor = 0.8 bb is the final supercell fraction occupied by the model 4.2.2 Symmetric Cuts The Symmetric Cuts operation crops the atomic positions which are beyond the cutting planes specified by the user on the input text file section named [Symmetric Cuts]. As this operation performs cuts in the first octant (x ≥ 0; y ≥ 0; z ≥ 0) and automatically executes mirrored cuts for the other octants, this routine should only be used when the desired cuts can be described with a 4m symmetry. The Asymmetric cuts operation is indicated for any other cutting operation. The input information for the Symmetric cuts routine defines the cutting planes using the crystalline plane notation and the distance from the origin. An example for the input information is shown in Table 4 and the geometric relationships for a {110] cut is depicted in Figure 2. Table 5: Symmetric cuts input in the [Symmetric Cuts] subsection General layout Example Comments cuts = h cuts = 1 h is the number of cuts in the first octant wxh = xs wx1 = 1 xs is the a Miller index for the specified cut plane wyh = ys wy1 = 1 ys is the b Miller index for the specified cut plane wzh = zs wz1 = 0 zs is the c Miller index for the specified cut plane wdh = ds wd1 = 4.5 ds is the specified cut distance from the origin in unit cells units Figure 2: Dimetric view (left) and top-view (center) from a symmetric cut plane designation example. It was considered an 8 x 8 x 8 unit cells building block, a (110) cut plane and a cut distance equal to 4.5 unit cells units. The cut result is shown after the 4m symmetry operations (right). 4.2.3 Asymmetric Cuts The Asymmetric Cuts operation crops the atomic positions which are beyond the cutting planes specified by the user on the input text file section named [Asymmetric Cuts]. As this operation perform cuts using a planes defined by sets of three points in the space, any convex polyhedral shape can be obtained. The only restriction this operation presents is that (0, 0, 0) cannot be used as a reference point for the cut planes. An example for the input information is shown in Table 5 and a cut example is depicted in Figure 3. Table 6: Asymmetric cuts input in the [Asymmetric Cuts] subsection General layout Example Comments cuts = j cuts = 1 h is the number of asymmetric cuts x1j = x1 x1j = 5.0 x1 is the x coordinate for the first point used to define the cut plane y1j = y1 y1j = 5.0 y1 is the y coordinate for the first point used to define the cut plane z1j = z1 z1j = 3.0 z1 is the z coordinate for the first point used to define the cut plane x2j = x2 x2j = 4.0 x2 is the x coordinate for the second point used to define the cut plane y2j = y2 y2j = -1.0 y2 is the y coordinate for the second point used to define the cut plane z2j = z2 z2j = 5.5 z2 is the z coordinate for the second point used to define the cut plane x3j = x3 x3j = -5.0 x3 is the x coordinate for the third point used to define the cut plane y3j = y3 y3j = 2.0 y3 is the y coordinate for the third point used to define the cut plane z3j = z3 z3j = -1.5 z3 is the z coordinate for the third point used to define the cut plane Figure 3: Dimetric view from an asymmetric cut plane designation example. It was considered an 8 x 8 x 8 unit cells building block and the cut coordinates exemplified in Table 6. 4.3 Real Space The Real Space operation converts the system coordinates from the point space to the real space, considering the lattice parameters and angles informed on [Unit Cell] section on the text input file. This process is a linear operation that can be described by four matrix operations. The first one is the lattice expansion and is represented by matrix A on Figure 4. The three next operations are related to the lattice angles consideration, which is evaluated as rotation operations separately for each axis and are depicted by Matrices α, β, γ on Figure 4. Figure 4: Matrices used to describe the point space to real space linear transformation. a, b, c are the lattice parameters and α, β, γ are the lattice angles from the unit cell. 4.3.1 Zone Axis The Zone Axis operation performs a rotation operation for each atomic coordinate relative to the supercell center in order to orientate the construction according to the zone axis informed by the user on the input file subsection named [Zone Axis]. The chosen zone axis is aligned to the original Cartesian z axis on the point space. An example for the zone axis input information is shown in Table 7 and some orientation examples are depicted in Figure 5. Table 7: Zone Axis input in the [Zone Axis] subsection General layout Example Comments zax = zx zax = 0 zx is the a Miller index related to zone axis orientation zay = zy zay = 0 zy is the a Miller index related to zone axis orientation zaz = zz zaz = 1 zz is the a Miller index related to zone axis orientation Figure 5: Examples of different zone axis orientations for a given supercell geometry. 4.4 Normalization The Normalization operation rewrites the atomic position as a function of the supercell total dimensions after the orientation step. This operation is necessary for generating the EMS supercell input file, as well as a consideration that avoids atomic positions on the edges of the structure in the relative coordinates. No changes on the input text file are required as this operation is automatically performed as a function of the supercell dimensions. 4.5 Multislice The Multislice operation segments the supercell file in m slices along the zone axis direction according to the specification given by the user on the input file section named [Multislice]. The slices thickness is given by the dimension of the supercell along the zone axis direction divided by the number of slices. An additional normalization step is performed in order to avoid the existence of atomic positions at the slices’ edges. An example for the multislice input information is shown in Table 8. Table 8: Zone Axis input in the [Zone Axis] subsection General layout Example Comments n = mn n = 32 mn is the number of slices to be generated on the Multislice operation 4.6 Export 4.6.1 Raw Data The Raw Data export operation takes place just after the Zone Axis operation and generates a text file with the Supercell atomic positions in the real space. The output file format is .xyz, which is exemplified in Table 9. Table 10 presents a brief list of softwares that can import .xyz files for the supercell visualization. Table 9: Example of a Raw Data export file in the .xyz format Line General layout Example Comments 1 Ntot 500 Ntot is the total number of atoms on the supercell Z is the atomic type and xr, yr, zr are the atoms n Z ; xr ; yr ; zr Si ; 1.2 ; 3.1 ; 0.0 coordinates in nm. n goes from 2 to N+1 ; is a tabulation character Table 10: Softwares for .xyz files visualization Name Link Comments Vesta http://www.geocities.jp/kmo_mma/crystal/en/vesta.html Citation-ware Avogadro http://avogadro.openmolecules.net/ Freeware, Open source CrystalMaker http://www.crystalmaker.com Proprietary software, demo freely availabe 4.6.2 EMS The EMS export operation takes place after the Normalization operation for generating a text file with the Supercell atomic positions in the real space, and after the Multislice operation for generating the multislice files. The output file format is .txt with an adequate header and atomic positions description for EMS HRTEM simulation software. Additional information about the atomic species may be informed on the [Atom Type] subsection on the input file according to the example shown in Table 11. Appendix 1 contains an example file depicting the EMS header and atom input example. Table 11: Atoms information input in the [Atom Info] subsection General layout Example Comments num_types = Na num_types = 2 Na is the number of different atomic species in the unit cell atomtypena = Z atomtype1 = Ce Z is the atomic type occ1 = o occ1 = 1 o is the occupancy value for the given atomic specie dw1 = w dw1 = 0.004 w is the Debye-Waller factor for the given atomic specie abs1 = s abs1 = 0.004 s is the absorbance for the given atomic specie 4.7 Raw files (.xyz) import The construction of complex models from the combination of simpler ones is partially supported by MEGACELL. A function the .xyz file path allows the user to load models and to generate supercells according to EMS or Dr. Probe standards. This feature allows the user to edit the simpler models to a complex structure and then load it again into MEGACELL. The basic steps are: 1. Initial models construction; export .xyz format; 2. Edition and combination of the .xyz files using a text editor or custom script; 3. Browse a modified parameter input file including all the atomic species ([Atom Info] section) contained on the final .xyz file; 4. Browse the final .xyz file; 5. Select the supercell output format; 6. Click “Generate File”; Appendix 1: EMS format example file|G:\HAP_TESTE.txt name|HAP_TEST creator|dstroppa date|Tue Dec 07 11:02:50 BRST 2010 system|triclinic superCell|false HMSymbol|1|1|0|0|0| P 0 rps|0|x , y , z lattice|0|8.6458 lattice|1|5.4362 lattice|2|2.2905 lattice|3|90.0 lattice|4|90.0 lattice|5|90.0 atom|0|Ca,_,0.390902,0.300178,0.200,0.005,1.000,0.041,Def,2 atom|1|Ca,_,0.336355,0.450437,0.200,0.005,1.000,0.041,Def,2 atom|2|Ca,_,0.281809,0.600696,0.200,0.005,1.000,0.041,Def,2 atom|3|Ca,_,0.227262,0.750955,0.200,0.005,1.000,0.041,Def,2 atom|4|Ca,_,0.499995,0.300178,0.200,0.005,1.000,0.041,Def,2 atom|5|Ca,_,0.445448,0.450437,0.200,0.005,1.000,0.041,Def,2 atom|6|Ca,_,0.390902,0.600696,0.200,0.005,1.000,0.041,Def,2 ... atom|n|Z,_,x,y,z,s,o ,w,Def,2