- Join us
MJR's Castep Notes
This page contains some random information about the use of Castep. It is incomplete, but contributions are welcome. It is provided mostly so that I can remember what I have done, and in the hope that it might be of some use to someone else.
Some of the background theory to Castep and DFT can be found in chapter IV of my thesis.
(I also have unmaintained notes on the ancient, Fortran77, pre-commercial version of Castep. In the unlikely event that someone wants these, they can still be found here.)
The Castep distribution provides many useful utilities. Some it does not include:
- c2x, a converter for Castep's check files, and can extract charge and spin density, wavefuctions, or simply atomic positions. It can also convert between .cell and .pdb files, and other similar tricks. It also can be built with the spglib crystal symmetry finder for symmetry analysis. C2x also supports other DFT codes, such as Siesta and VASP.
These notes should mostly apply to plane-wave codes in general, not just Castep, but I make no promises.
- Some notes on Bloch's Theorem.
- Some notes on interpolation and real-space integration of functions expressed in reciprocal space. Titled "Castep and Real Space Integrals" for brevity.
- Some notes on competing interpretations of Monkhorst-Pack grids.
A simple test of Castep on an ethene molecule.
Over-riding FFT grid selection
I often find myself wanting to do this, for various strange reasons. It seems to be undocumented and unsupported, but, in a .param file, a block such as the following seems to work.
%block devel_code STD_GRID=50 50 45 FINE_GRID=60 60 50 %endblock devel_code
Such devel_code blocks tend to have little error-checking, and are not intended to be used saved for by developers, so you have no right to blame anyone should they not behave as expected. For my own convenience, I record here the syntax for changing the Ewald converge tolerance from its default of 100 (should never be necessary). The value below should give wrong answers most of the time. Replacing the "2" with "1000" might give one confidence that the Ewald sum was correctly converged.
%block devel_code EWALD: PREC = 2 :ENDEWALD %endblock devel_code
SYS V IPC
The main use of this is that it magically merges MPI messages when run on a machine with multiple shared-memory nodes, and thus improves scaling. In other circumstances it is of little use, but adds C code to what is otherwise a pure Fortran project.
The source file for this which is part of Castep 17.21 (and
earlier) is incompatible with ifort 17.0 (and later) when used with
most versions of OpenMPI. This can be fixed by removing the
line and uncommenting the
line a couple of lines earlier in Source/Utility/FreeIPC.f90.
Depending on how one's compiler is set up, adding
to Source/Utility/fft.mkl.F90 may make it easier to compile this file.
The Castep build system is flexible, but, for bears of little brain, verging on the incomprehensible. I tend to use a simpler shell script for compilation, an example of which is below. The script will be tied to a particular version of Castep, due to the addition of extra source files as functionality is extended. It is offered with no guarantee of functionality or correctness!
- castep.org, including an on-line manual, and instructions for obtaining Castep for UK academics (for whom it is free), and EU academics (for whom it is currently E1800).
- Castep at CCPForge, including a bug tracker.
- JISC hosts a Castep email list
- Commerical Castep, from Accelrys.
Castep in TCM
The c2x utility is centrally installed.
Further information about Castep itself in TCM can be found on TCM's internal Castep page.