Cluster Expansion Basics

From Materials Simulation Group
Jump to: navigation, search

The following serves as a cheat sheet when preforming a manual cluster expansion.


  1. Generate clusters. This step creates structures that are then populated with the provided element species to create clusters. The structures aren't limited to the unit cell. Running mode 10 creates the file clusters.out.
    ./uncle.x 10
  2. Enumerate the superstructures. This step finds all the ways to tile space with the lattice vectors, species types and number of atoms per unit cell provided from lat.in and groundstatesearch.in. Running mode 20 creates the file struct_enum.out.
    ./uncle.x 20
  3. Find independent and identically distributed (i.i.d.) configurations. This should done on the super computer. You should expect it to take a while (several hours). Mode 42 creates the file training_set_structures.dat, which contains all your i.i.d. structures for a BCS fit.
    ./uncle.x 42 A where A is the desired number of i.i.d. structures
  4. Create a folder for each structure in training_set_structures.dat. Copy into each structure's folder the POTCAR, KPOINTS, and INCAR files.
  5. Compile and run makestr.x in each structure's directory and rename the output POSCAR.
  6. For each structure, find the mean lattice coordinate for the three elements. Change each structure's POSCAR so that the lattice constant is the mean lattice coordinate. See the wiki page on Vegard's Law for help.
  7. Run VASP in each folder.


Here is a sample bash script.


#!/bin/bash
# Manual cluster expansions
 
# Make a file that contains the numbers of the structures.
cat training_set_structures.dat | awk '{ print $2 }' > strNs
# Make a directory for each structure (it's really a configuration).
for i in `cat strNs`; do mkdir str$i; done;
# Copy the KPOINTS, INCAR, and POTCAR into each structure's directory.
for i in `cat strNs`; do cp ../KPOINTS str$i/; done;
for i in `cat strNs`; do cp ../INCAR str$i/; done;
for i in `cat strNs`; do cp ../POTCAR str$i/; done;
# Run vasp in each directory.
for i in `cat strNs`; do ~/codes/enumlib/trunk/makestr.x struct_enum.out $i; mv vasp* str$i/POSCAR; done;
# Recalculate the lattice parameter and replace its value in POTCAR. vegard is a bash function shown below.
for i in `cat strNs`; do cd str$i/; vegard; mv POSCAR.new POSCAR; cd ..; done;
# Run VASP in each structure's directory.
for i in `cat strNs`; do cd str$i/; sbatch runvasp.sh; cd ..; done;
 
# I added this function to my .bash_fcns.sh. Note the numbers you use to calculate the mean lattice coordinate will be different than those shown below.
function vegard() {
  { head -1 POSCAR; head -6 POSCAR | tail -1 | awk '{ print ($1/8*2.51 + $2/8*2.88 + $3/8*3.15) }'; tail -n +3 POSCAR; } > POSCAR.new
}