# Generating Spin Density Cube Files `orto` can generate a cube file for the spin density of your system using `orto gen spden`. This wraps `orca_plot` and generates a spin density cube file without the time consuming interactive part, or the need to write bizarre input files. The cube file is computed in parallel as part of a batch job, allowing relatively dense grids to be specified. ## Setup To use this feature, you need to first set the `orto_orca_load` environment variable - this specifies the command used to load the _ORCA_ module on your system. Typically a module system like Lmod or Environment Modules is used to manage software on HPC systems, and you will need to set this variable accordingly. For example, when using Environment Modules, this may be set as ::: {code-block} bash export orto_orca_load="orca/6.0.1" ::: We advise that you set this to the version of _ORCA_ you use most frequently. Alternatively, you can provide the `--orca_load` optional argument in `orto gen spden` and specify the command to load _ORCA_ - this overrides the environment variable and so can be used to submit jobs with different versions of _ORCA_. ## Usage To generate a spin density cube file, run ::: {code-block} bash orto gen spden ::: where `` is the path to your _ORCA_ `.gbw` file, and `` is the number of cores to use in the cube file generation job. ::: {note} You will need `.densities` and `.densitiesinfo` files with the same basename and parent directory as the `.gbw` file. ::: This will then submit a batch job to generate the cube file. ### Number of points The number of points in the cube file is determined by the `--n_pts` keyword argument - if this is not specified, a default of 100 points per dimension is used. ### Memory The amount of memory to use in the cube file generation job can be specified using the `--memory` keyword argument, by default, 500 MB of memory is used per core. ### Other Arguments Additional command line arguments for `orto gen spden` can be listed by running ::: {code-block} bash orto gen spden -h ::: ## Example - Triplet Oxygen From these [files](oxygen.zip), you can use `orto` to generate a cube file for the spin-density of triplet molecular oxygen using four cores. :::{code-block} bash orto gen spden oxygen.gbw 4 ::: This creates a jobscript (`oxygen_spin_density_job.sh`) which is then submitted to the scheduler. After this job finishes, the file `oxygen.spindens.cube` will be present in the same directory as `oxygen.gbw`.