CASTEP

CASTEP is a reference code for calculating material properties from first principles. Using density functional theory, it can simulate a wide range of material properties, including energy, atomic-level structure, vibrational properties, electronic response properties, and more. In particular, it has a wide range of spectroscopic features that directly relate to experiments, such as infrared and Raman spectroscopies, NMR, and core-level spectra.

For more information

Running CASTEP

Module Version Notes
castep 16.1
19.1
24.1
Group license

To see the available versions when you are logged into eXplor, run the command:

module spider castep

To use CASTEP, type:

module load castep/<version>

specifying one of the available versions.

Example of a Slurm Job Script for CASTEP

Script for Parallel Calculation

#!/bin/bash -x 

#SBATCH --account=<project>
#SBATCH --partition=std
#SBATCH --job-name=castep-mpi
#SBATCH --output=SLURM-%x.%N.%j.out 
#SBATCH --error=SLURM-%x.%N.%j.err 
#SBATCH --nodes=4
#SBATCH --ntasks=32
#SBATCH --cpus-per-task=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=2-02:00:00
#SBATCH --exclude=cnd[01-04,06-12] # IVY nodes are showing issues with CASTEP

env | grep -i slurm 

echo ""
echo "  JOB started: $(date) "
echo ""

cd $SLURM_SUBMIT_DIR

echo "Submission Directory: $SLURM_SUBMIT_DIR"

# Creating temporary directory
WORKDIR="$SCRATCHDIR/job.$SLURM_JOB_ID.$USER"
mkdir -p $WORKDIR

echo ""
echo "Working Directory: $WORKDIR"
echo ""

module purge
module load castep/intel-2019.4/24.1 

# Copying files to $WORKDIR
cp $SLURM_SUBMIT_DIR/*.cell $WORKDIR/
cp $SLURM_SUBMIT_DIR/*.param $WORKDIR/
cd $WORKDIR

unset I_MPI_PMI_LIBRARY

# Run the program with the working directory
srun --mpi=pmi2 castep.mpi MS_opt_charge

# Copying all files to the output directory
OUTDIR="$SLURM_SUBMIT_DIR/outdir.$SLURM_JOB_ID"
if [ ! -e $OUTDIR ]; then 
  mkdir $OUTDIR
fi

mv $WORKDIR/* $OUTDIR

# Going back to the submission directory
cd $SLURM_SUBMIT_DIR

# Removing the $WORKDIR 
rmdir $WORKDIR

echo ""
echo "  JOB finished: $(date) "
echo ""

Script for Serial Calculation

#!/bin/bash -x 

#SBATCH --account=<project>
#SBATCH --partition=std
#SBATCH --job-name=castep-serial
#SBATCH --output=SLURM-%x.%N.%j.out 
#SBATCH --error=SLURM-%x.%N.%j.err 
#SBATCH --nodes=1
#SBATCH --ntasks=8
#SBATCH --cpus-per-task=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=1-00:00:00
#SBATCH --exclude=cnd[01-04,06-12] # IVY nodes are showing issues with CASTEP

env | grep -i slurm 

echo ""
echo "  JOB started: $(date) "
echo ""

cd $SLURM_SUBMIT_DIR

echo "Submission Directory: $SLURM_SUBMIT_DIR"

# Creating temporary directory
WORKDIR="$SCRATCHDIR/job.$SLURM_JOB_ID.$USER"
mkdir -p $WORKDIR

echo ""
echo "Working Directory: $WORKDIR"
echo ""

module purge
module load castep/intel-2019.4/24.1 

# Copying files to $WORKDIR
cp $SLURM_SUBMIT_DIR/*.cell $WORKDIR/
cp $SLURM_SUBMIT_DIR/*.param $WORKDIR/
cd $WORKDIR

# Run the program with the working directory
srun castep.serial MS_opt_charge

# Copying all files to the output directory
OUTDIR="$SLURM_SUBMIT_DIR/outdir.$SLURM_JOB_ID"
if [ ! -e $OUTDIR ]; then 
  mkdir $OUTDIR
fi

mv $WORKDIR/* $OUTDIR

# Going back to the submission directory
cd $SLURM_SUBMIT_DIR

# Removing the $WORKDIR 
rmdir $WORKDIR

echo ""
echo "