CASTEP job automation (Perl script)

Dear all, 

I would like to automate running a series of jobs each with a different cutoff energy. I read the scripting manual but couldn't figure it out how to correctly do this. I did generate and save the input files, and also created a Perl script document inside my project directory . How to write a script to run a series of jobs with different cutoff energies, say for example from 500eV to 600eV in steps of 25eV?

I am using Materials Studio 2024 (Default installation) on Windows 11. 

Any help is much appreciated. 

Answers 2
TM
TM 2025-07-02

First, you can review the following tutorial to experience actual scripting, 
    Tutorials > Scripting tutorials > Using scripting to calculate the interaction energy between two layers
.

The simplest way is to prepare some .xsd files of tha same structure with different names and copy&paste the script generated by CASTEP Calculation dialog > Copy script (next to the Run button) into the .pl file as follows,

-----
...
my $doc = $Documents{"Crystal_Ecut0500.xsd"}; #-- You have to add this line to call the .xsd file as $doc manually
my $results = Modules->CASTEP->Energy->Run($system, Settings(
    UseCustomEnergyCutoff => 'Yes', 
    EnergyCutoff => 500
));

my $doc = $Documents{"Crystal_Ecut0525.xsd"}; #-- You have to add this line to call the .xsd file as $doc manually
my $results = Modules->CASTEP->Energy->Run($system, Settings(
    UseCustomEnergyCutoff => 'Yes', 
    EnergyCutoff => 525
));
...
-----

If you are familiar with Perl, you could use a sprintf statement and a for-loop to incrementally change the cutoff energy while renaming .xsd files. 

CM
CM 2025-07-02

Could you please add the script to which you refer. A copy paste should be sufficient.
Are you doing convergence testing?
I think I have a script for this but do not have access to the relevant backup after switching to a new machine -> This might take some time.