ATAT mcsqs

Compile ATAT mcsqs on WSL2 Ubuntu and prepare output for VASP

Official documentation for the Alloy-Theoretic Automated Toolkit (ATAT): https://www.brown.edu/Departments/Engineering/Labs/avdw/atat/manual/manual.html

Official documentation for the ATAT mcsqs: https://www.brown.edu/Departments/Engineering/Labs/avdw/atat/manual/node47.html

Great text about the use of mcsqs: https://cniu.me/2017/08/05/SQS.html#generate-sqs

Great text explaining well the cluster expansion method: http://www.jespertoftkristensen.com/JTK/Blog/Entries/2014/3/4_What_are_Cluster_Expansions_and_ATAT.html

Tested PC:
  • Intel(R) Core(TM) i5-14600K 3.50 GHz
  • RTX 2060 SUPER
  • Kingston FURY 32GB KIT DDR5 6000MHz CL32 Renegade
  • WSL2 Ubuntu version: 22.04
Prerequisities
sudo apt-get upgrade
sudo apt-get install tcsh
Compile ATAT

Download the whole toolkit of ATAT from here https://www.brown.edu/Departments/Engineering/Labs/avdw/atat/, or write the following command: 

wget http://alum.mit.edu/www/avdw/atat/atat3_36.tar.gz

Compile it (https://www.brown.edu/Departments/Engineering/Labs/avdw/atat/manual/node9.html):

tar xvzf atat3_36.tar.gz
cd atat
mkdir build

Change the folder where the binaries will be installed (change BINDIR=/where/you/want):

nano makefile 

Changing first line to -> BINDIR=/home/lebedmi2/SOFTWARE/ATAT/atat/build
Save (control + s) and exit nano (control + x).
In the main folder (atat):

make -j 10
make install

To be able to run a mcsqs binary without giving the full path to it, add the BINDIR directory to the environment variables:

cd build
pwd
nano ~/.bashrc

Scroll to the bottom of the file and write:

export PATH=/home/lebedmi2/SOFTWARE/ATAT/atat/build:$PATH

Save and exit nano. Refresh the console:

source ~/.bashrc

Test mcsqs, it should provide list of parameters for the script:

mcsqs
 
Converting output from ATAT mcsqs to POSCAR format

To convert an output with the best found randomized structure from mcsqs into POSCAR, use the following script https://github.com/c-niu/sqs2poscar:

git clone https://github.com/c-niu/sqs2poscar.git
cd sqs2poscar
nano sqs2poscar
To the first two lines of sqs2poscar, write: 
#include <cstring>
#include <stdlib.h>
c++ ./sqs2poscar.cpp -o ./sqs2poscar
Export path to sqs2poscar to system variables:
nano /.bashrc
export PATH=/home/lebedmi2/SOFTWARE/ATAT/sqs2poscar:$PATH
source ~/.bashrc

Convert the output from mcsqs to POSCAR with this command:

sqs2poscar bestsqs.out

Resulting File: bestsqs.out-POSCAR
In bestsqs.out-POSCAR, modify the second line by replacing ‚xxx‘ with your specific lattice constant.

Sort the bestsqs.out-POSCAR using atomsk and save the output as POSCAR:

sed -i '2s/.*/3.4/' bestsqs.out-POSCAR
atomsk bestsqs.out-POSCAR -sort species up -frac POSCAR
atomsk POSCAR cif
atomsk POSCAR lmp

Here, ‚3.4‘ defines the lattice parameters.

Note: To avoid the possible too large skew problem when converting to LAMMPS format, the second line in sqscell.out cannot have larger value than the first one, and the third line cannot have larger value than the first and the second one. For example, the following will lead to the skew problem:

6 0 0
0 7 0
0 0 4 

or 

5 0 0
0 5 0
0 0 6
 
Example: conventional fcc cell of Cr0.125Fe0.29167Ni0.29167Cu0.29167

Two input files are required here for mcsqs: rndstr.in and sqscell.out. In rndstr.in, we define a structure featuring a conventional fcc cell with four atoms, where each atomic position is accompanied by the relative concentrations of the elements under consideration. sqscell.out specifies the dimensions of the supercell being sought. To create the initial structure serving as input for mcsqs, it might be usefull to get the lattice parameters and atomic coordinations using atomsk (you can skip this step):

mkdir fcc
cd test_fcc
atomsk --create fcc 1 Cr -frac POSCAR

Note: I will set the lattice parameters to 1. The appropriate lattice parameter can be adjusted during the conversion of the mcsqs output to POSCAR format. This makes easier the process of defining the distances necessary to construct clusters up to a specified number of nearest neighbors.

To have the given relative concentrations of elements in the structure, conventional fcc lattice converted to 3 x 2 x 2 supercell with 48 atoms is required (Cr -> 6/48 = 0.125, Fe -> 14/48=0.29167, …) 

Create ‚rndstr.in‘ file defining the initial conventional fcc cell with 4 atoms. Next to each atomic position, the relative concentrations of the elements must be written.

nano rndstr.in
1.00000000 0.00000000 0.00000000
0.00000000 1.00000000 0.00000000
0.00000000 0.00000000 1.00000000
1 0 0
0 1 0
0 0 1
0.00000000 0.00000000 0.00000000 Cr=.125, Fe=0.29167, Ni=.29167, Cu=.29167
0.50000000 0.50000000 0.00000000 Cr=.125, Fe=0.29167, Ni=.29167, Cu=.29167
0.00000000 0.50000000 0.50000000 Cr=.125, Fe=0.29167, Ni=.29167, Cu=.29167
0.50000000 0.00000000 0.50000000 Cr=.125, Fe=0.29167, Ni=.29167, Cu=.29167

We will search for the special quasirandom structure for 3 x 2 x 2 supercell with 48 atoms. This will be defined in sqscell.out:

nano sqscell.out
1
3 0 0
0 2 0
0 0 2

Run the mcsqs: Define the pair clusters up to fourth nearest neighbours:

mcsqs -2=1.5

Search for the most disordered structure:

mcsqs -rc

Stop the searching whenever you want (the outputs will be saved). The program terminates upon achieving an ideal match, where all the requested correlation parameters align precisely with those of a disordered state (see file bestcorr.out and the last column showing the differences between the best SQS structure found so far and the targeted disordered state). However, attaining such a match may never happened if the ‚clusters.out‘ file contains a large number of clusters. Regardless of that, the files ‚bestsqs.out‘ and ‚bestcorr.out‘ will always hold the optimal solution found up to that point, so the code can be halted if the current solution is deemed satisfactory.

Convert bestsqs.out to POSCAR:

sqs2poscar bestsqs.out
sed -i '2s/.*/3.4/' bestsqs.out-POSCAR
atomsk bestsqs.out-POSCAR -sort species up -frac POSCAR
atomsk POSCAR cif
atomsk POSCAR lmp
 
Example: primitive fcc cell of Cr0.332Fe0.222Ni0.222Cu0.222
For converting the structure into primitive cell, VESTA is useful:
VESTA in WSL2:
sudo apt-get install libgtk-3-0 libglu1-mesa
wget https://jp-minerals.org/vesta/archives/3.5.8/VESTA-gtk3.tar.bz2
tar xvjf VESTA-gtk3.tar.bz2

Export VESTA to path. Then you can run it with command ‚VESTA‘:

export /home/lebedmi2/SOFTWARE/VESTA/VESTA-gtk3:$PATH

Visualise with VESTA:

VESTA POSCAR

To achieve the given atomic concentrations, 4x3x3 supercell with 36 atoms is needed. rndstr.in:

0.7071067691         0.0000000000         0.0000000000
0.3535533845         0.6123724252         0.0000000000
0.3535533845         0.2041241417         0.5773502593
1 0 0
0 1 0
0 0 1
0.000000000         0.000000000         0.000000000 Cu=0.333332,Ni=0.222222,Cr=0.222222,Fe=0.222222


sqscell.out:

1
4 0 0
0 3 0
0 0 3

The following is equivalent input:

rndstr.in:

1 1 1 90 90 90
.0 .5 .5

.5 .0 .5
.5 .5 .0
.0 .0 .0 Cu=0.333332,Ni=0.222222,Cr=0.222222,Fe=0.222222

sqscell.out:

1
0.0 2.0 2.0

1.5 0.0 1.5
1.5 1.5 0.0
 
Example: bcc Cr0.25Fe0.25Ni0.25Cu0.25

rndstr.in:

1.00000000 0.00000000 0.00000000
0.00000000 1.00000000 0.00000000
0.00000000 0.00000000 1.00000000
1 0 0
0 1 0
0 0 1
0.00000000 0.00000000 0.00000000 Cr=.25,Fe=.25,Ni=.25,Cu=.25
0.50000000 0.50000000 0.50000000 Cr=.25,Fe=.25,Ni=.25,Cu=.25

sqscell.out (2 x 2 x 2 supercell, 16 atoms):

1
2 0 0
0 2 0
0 0 2
 
Example: hcp Cr0.25Fe0.25Ni0.25Cu0.25

rndstr.in:

1 0.00000000 0.00000000
-0.5 0.86602540 0.00000000
0.00000000 0.00000000 1.58800000
1 0 0
0 1 0
0 0 1
0.00000000 0.00000000 0.00000000 Cr=.25,Fe=.25,Ni=.25,Cu=.25
0.33333333 0.66666667 0.50000000 Cr=.25,Fe=.25,Ni=.25,Cu=.25

sqscell.out (2 x 2 x 2, 16 atoms):

1
2 0 0
0 2 0
0 0 2
 
Example: sc Cr0.25Fe0.25Ni0.25Cu0.25

rndstr.in:

1.00000000 0.00000000 0.00000000
0.00000000 1.00000000 0.00000000
0.00000000 0.00000000 1.00000000
1 0 0
0 1 0
0 0 1
0.00000000 0.00000000 0.00000000 Cr=.25,Fe=.25,Ni=.25,Cu=.25

sqscell.out (4 x 2 x 2 supercell, 16 atoms):

1
4 0 0
0 2 0
0 0 2