We need 2 files

si-charge.cell

%block lattice_abc
3.8 3.8 3.8
60 60 60
%endblock lattice_abc
!
! Atomic co-ordinates for each species.
! These are in fractional co-ordinates wrt to the cell.
!
%block positions_frac
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
%endblock positions_frac
!
! Analyse structure to determine symmetry
!
symmetry_generate
!
! Specify M-P grid dimensions for electron wavevectors (K-points)
!
kpoint_mp_grid 4 4 4

si-charge.param

xc_functional : LDA
cutoff_energy : 1500 eV
#this next line causes the charge to be written in a den_fmt file
write_formatted_density : T
spin_polarised : false

The cutoff energy is somewhat higher than needed for a converged total energy - but it helps when making a smoother looking charge density plot.

Note

There are 2 ways to use the pseudopotentials:

- Using an external pseudopotential with extention .usp

- Using an internal pseudopotential created by the code during the execution according to type mentioned  in the param file which we will do it in this tutorial.


Execution

For serial calculation

/Si-charge$ castep.serial si-charge

For parallel calculation

/Si-charge$ mpirun -np 4 castep.mpi si-charge

 

We will get the following files

/Si-charge$ ls
Si_C19_LDA_OTF.usp  si-charge.bands  si-charge.bib  si-charge.castep  si-charge.castep_bin 
si-charge.cell  si-charge.check  si-charge.cst_esp  si-charge.den_fmt  si-charge.param

Plotting

You will see a file called silicon.den_fmt this contains the charge density in a formatted (i.e. a human readable, ASCII file). We need to change this file into a format Vesta can read. Copy it to a file called silicon.charg_frm

cp silicon.den_fmt silicon.charg_frm
Now edit the file silicon.charg_frm with a text editor to remove the first 11 lines. The file should now begin with 1 1 1 and a number. You can now open silicon.charg_frm with Vesta ( to install VESTA click here).  Note that Vesta needs both the cell and charge_frm files to make a plot. If you are working on a remote machine you will need to copy both of these back to your local machine to view with Vesta. You can find a walkthrough video of this process at https://youtu.be/_c2Hk4jxmm4