Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated workshop tutorial 0 for STFC workspace system #2

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 38 additions & 85 deletions docs/workshop/00_starting.md
Original file line number Diff line number Diff line change
@@ -1,117 +1,69 @@

## Connecting to teaching0
# Getting Started

Open a terminal and type:
## Settting up the Virtual Workspace

`ssh -X teaching0`
### Signing up to the STFC Training Workspace

This should present you with a prompt:
Open a browser and navigate to the link you have been emailed - the one that contains training.analysis.stfc.ac.uk.

`<username>@teaching0:~$`
This should prompt you for some information and it will then send your account for authorisation.

### Loading CASTEP
The command
Once the account is authorised, you will recieve and email with a link to login.

`module load phys/CASTEP`
### Creating the CASTEP Workspace

should load castep into the environment as `castep.mpi`. You can test this with
You should recieve an email with a link that you can use to connect to the STFC system. Save this email as you will use it to login during the training.

`castep.mpi -v`
Select New Workspace and then select CASTEP TRAINING WORKSHOP 2024 and click create workspace. This will generate you a virtual desktop on the STFC cloud service with access to CASTEP.

## Connecting to the virual desktop

### Loading Vesta
There is an incompatability with the VESTA and CASTEP modules on teaching0.
Mouse over the workspace and you should be presented with buttons to launch the workspace in either a new tab or new window.

Instead, open a new terminal and connect again to teaching0 (`ssh -X teaching0`). You can then load the VESTA module with:
This should open a new window and load a virtual desktop within the browser. This is a linux desktop with CASTEP and several visualisations available.

`module load vis/VESTA`
## Loading CASTEP

and run it:
Click the applications button in the bottom left and select software -> CASTEP. This will launch a terminal with shortcuts for running CASTEP.

`VESTA`
### Accessing the CASTEP help system

To search the castep help system for keywords containing castep:

## Connecting to young
Open a terminal and type
`castep-serial castep.serial -s lattice`

`ssh -X [email protected]`
To view detailed information on a particular keyword:

replacing mmmXXXX with your young account. This should present you with a shell on young:
`castep-serial castep.serial -h lattice_abc`

`[mmm0389@login01 ~]$`
### Running CASTEP

If you want to use the castep tools, (c2x, orbitals2bands, etc), you should add these to your path:
To run castep in serial with Si2 as the seedname, type

`export PATH=$PATH:/home/mmm0389/castep-24`
`castep-serial castep.serial Si2`

This will give you access to castep.mpi as well as the full suite of tools that come with castep.
To run castep in parallel using 16 core (the maximum for these virutal machines) with same Si2 seedname, type

### Copy the submission script
`castep-mpi mpirun -n 16 castep.mpi Si2`

To actually run castep on this machine, you need to use a submission script. This is similar to how most HPC systems work, and is useful if you intend to learn how to run castep on your own cluster.
Note that the `castep-serial` and `castep-mpi` parts that the start of the above lines are particular to these virtual machines for the tutorial. Running castep on your own machines would typically involve either `castep.serial Si2` for the serial version or `mpirun -n 4 castep.mpi Si2` for the parallel version.

`cp ~mmm0389/run_castep24.sh ~/`
## Tuorial files

This will give you a file called run_castep24.sh in your home folder. You *must* edit this file and change the line UKCP_YORK_P to be your relevant group on young (probably UKCP_EXT).. Please ask if you are not sure, as this will give errors later on.
The files needed for these tutorials can be found by navigating from Applications -> Data -> Course Materials (that will open up a file browser in the right place). They can also be accessed via the command line from this location: `/course_materials/`. Copy the files to somewhere in your home directory before trying to run CASTEP (you can't run CASTEP in the `/course_materials` directory. You can do that either using the graphical file browser or using the command line. For example:

### Scratch
Make a folder called Si2 in your home directory:

All calculations must be performed in the Scratch folder. This is a high speed filesystem for use in HPC environments. The folder is ~/Scratch
`mkdir ~/Si2`

### Running a castep calculation
Then copy in the corresponding tutorial file:

Create the cell and param files as normal. Copy the script into the folder and edit the final line which contains "Si2". Change this to be the <name> part of your castep calculation.
`cp /course_materials/Si2.tar.gz ~/Si2/`

eg. If your files are Al.cell and Al.param, change the last line to read

`gerun castep.mpi Al`

The number of cores are controlled by the line

`#$ -pe mpi 16`

and the job time limit by

`#$ -l h_rt=0:20:0`

requests a 20 minute (max) run.

Once this file has been edited, submit it to the queue with

`qsub run_castep24.sh`

You can see the status of the job by typing

`qstat`

which will show your active jobs, eg.

```
[mmm0389@login01 ~]$ qstat
job-ID prior name user state submit/start at queue slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
1141619 2.51381 Castep-exa mmm0389 qw 09/19/2023 12:04:38 16
```


It should change from "qw" (queued and waiting) to "r" (running) and then once the calculation is complete, it should disappear.

To cancel a job, use the job-id from qstat and type

`qdel <job number>`



## Editing a file
Edit the diamond.param file (increase the cutoff energy to 400 eV). To do this you will need to use an editor. (for experts `vi` and `emacs` are available). Otherwise I suggest using an editor called `nano`. This has helpful list of instructions are the bottom of the screen (but ask if you are confused!)

`[teaching01@arc-login01 ~]$ nano diamond.param`

Now submit the job again.

Compare the runs at 200 and 400eV. Which took longer? Has the total energy gone up or down. Look at the Atomic Populations section - is it what you expect?

## Summary of useful commands

* `mv` - rename (or move) a file eg. `mv oldfile newfile`
* `cp` - copy a file eg. `cp original copy`
* `pwd` - print current (working) directory
Expand All @@ -124,14 +76,15 @@ Compare the runs at 200 and 400eV. Which took longer? Has the total energy gone
* `cp ../myfile ./` - copy the file `myfile` in the folder below to the current folder
* `cp ~/myfile ./` - copy the file `myfile` in your home folder to the current folder
* `qstat` - look at the list of jobs running and queued on the cluster
* `mpirun -np 8 castep.mpi diamond` - submits a castep job with `diamond.cell` and `diamond.param` as inputs onto 8 cores with a time limit of 1 hour
* `castep-mpi mpirun -np 8 castep.mpi diamond` - submits a castep job with `diamond.cell` and `diamond.param` as inputs onto 8 cores with a time limit of 1 hour

### c2x

This is a handy free program written by Michael Rutter (TCM group Cambridge). It can convert
`castep.cell` and `castep.check` files into various formats eg `.cell`, `.pdb`. (and many other things!)

* `c2x -h` - list all the options
* `c2x --pdbn castep.cell castep.pdb`
* `c2x --pdbn castep.check castep.pdb`
* `c2x --cell castep.check new.cell`
* `castep-serial c2x -h` - list all the options
* `castep-serial c2x --pdbn castep.cell castep.pdb`
* `castep-serial c2x --pdbn castep.check castep.pdb`
* `castep-serial c2x --cell castep.check new.cell`
(useful at the end of geometry optimisation)
Loading