We introduce how to install Atomsk into Matlantis and create polycrystals with grain boundaries.
Atomsk* is a free and open-source command-line tool specialized in creating and editing crystal and molecular structure data for atomic-level simulations in computational materials chemistry.
*Atomsk: https://atomsk.univ-lille.fr/
Table of Contents
-----
Installation
- Download the program (tar.gz file). Please obtain the Linux amd64 (64-bit) version from the following site. We have confirmed that the beta-0.13.1 version works.
Download site: https://atomsk.univ-lille.fr/dl.php
- Move the tar.gz file to the location where you want to install Atomsk in the Matlantis environment. In this example, we'll explain how to install it in /home/jovyan/tools.
- Extract the file and rename the directory to "atomsk".
When running in a notebook: *Note: "!" is not needed if running in a terminal.
!tar xvzf ~/tools/atomsk_b0.13.1_Linux-amd64.tar.gz
!mv ~/tools/atomsk_b0.13.1_Linux-amd64 ~/tools/atomsk - The installation is successful if you can run the atomsk command as shown below.
%%bash
$HOME/tools/atomsk/atomsk
example output :
___________________________________________________
| ___________ |
| o---o A T O M S K |
| o---o| Version Beta 0.13.1 |
| | |o (C) 2010 Pierre Hirel |
| o---o https://atomsk.univ-lille.fr |
|___________________________________________________|
*** Working out of office hours? You should sleep sometimes. :-)
>>> Atomsk is a free, Open Source software.
To learn more, enter 'license'.
>>> Atomsk command-line interpreter:
..> Type "help" for a summary of commands.
@atomsk:20240621_atomsk> \o/ Program terminated successfully!
Total time: 0.001 s.; CPU time: 0.000 s.
As an intput file, the small version of HEA structure is used.
Creating polycrystal
We introduce how to create grain boundaries in the high-entropy alloy CoCrFeMnNi.
The following tutorial was referenced:
- Tutorials > Grain Boundaries: https://atomsk.univ-lille.fr/tutorial_grainboundaries.php
- Tutorials > Polycrystals: https://atomsk.univ-lille.fr/tutorial_polycrystal.php
- Document: https://atomsk.univ-lille.fr/doc.php
-
First, prepare the seed crystal. This can be generated in Atomsk as follows. You can also create structures using ASE. Here is how:
%%bash
## create Ni(fcc)
$HOME/tools/atomsk/atomsk --create fcc 3.52 Ni Ni.xsf
## build supercell 3x3x3
$HOME/tools/atomsk/atomsk Ni.xsf -duplicate 3 3 3 Ni333.xsf
# randomly substitute 20% Ni atoms with Cr
$HOME/tools/atomsk/atomsk Ni333.xsf -select random 20% Ni -substitute Ni Cr NiCr.xsf
# randomly substitute 20% Ni atoms with Co
$HOME/tools/atomsk/atomsk NiCr.xsf -select random 20% Ni -substitute Ni Co NiCrCo.xsf
# randomly substitute 20% Ni atoms with Fe
$HOME/tools/atomsk/atomsk NiCrCo.xsf -select random 20% Ni -substitute Ni Fe NiCrCoFe.xsf
# randomly substitute 20% Ni atoms with Mn
$HOME/tools/atomsk/atomsk NiCrCoFe.xsf -select random 20% Ni -substitute Ni Mn CoCrFeMnNi.xsf -
Next, create a parameter file (in text format) specifying details such as the size of the cell box you wish to create. For example, to create a polycrystal with four grains within a 180×180×180 Å cell box, we created the following polycrystal_large.txt file.
box 180 180 180 # the size of cell
random 4 # the number of polycrystal
-
Finally, use Atomsk in --polycrystal mode with the configuration file created in step 2 (in this case, polycrystal_large.txt) to create the polycrystal polycrystal_large.cfg. The polycrystal_param.txt file generated at the same time can be used to reproduce the same polycrystal.
%%bash
$HOME/tools/atomsk/atomsk --polycrystal CoCrFeMnNi.xsf polycrystal_large.txt polycrystal_large.cfg -wrap
When visualized in Ovito, it can be seen as follows.
(Upper: original elemental color, Lower: result of pattern matching (FCC: green))
Tips: Using ASE for Creating Structures
You can also create seed crystal using ASE. For example, you can create a unit cell as follows:
1. Create the fcc structure for Al
from ase.build import bulk
atoms = bulk(crystalstructure="fcc", name="Al", a=3.584, cubic=True)
2. Define a function to randomly replace elements
import numpy as np
def random_replace(atoms, elements, replacement_rate=0.75):
# Copy the Atoms object
atoms_c = atoms.copy()
# Calculate the number of atoms to randomly select for replacement
total_atoms = len(atoms_c)
num_replacements_per_element = int(total_atoms * replacement_rate / len(elements))
for e in elements:
# Select random indices
rand_indices = np.random.choice(total_atoms, num_replacements_per_element, replace=False)
# Replace elements
atoms_c.numbers[rand_indices] = e
return atoms_c
3. Specify the elements to be replaced and randomly replace the elements
elements = [24, 26, 27, 28] # Cr, Fe, Co, Ni
atoms_HEA = random_replace(atoms*(3, 3, 3), elements)
4. Visualize and check the results
from pfcc_extras import view_ngl
view_ngl(atoms_HEA)
Proceed to Creating polytical step2