How to generate spin density cube file

Hello :wave:

I’m pretty new in QM methods and I’m trying to perform all my calculation using psi4 from python. Becouse it’s my intention to integrate the procedures in our group molecular discovery pipeline.

I would like to generate spin density maps. It seems pretty straight forward as it’s said in the documentation. However I don’t know how to calculate ρα(r)−ρβ(r).


This task can be used to obtain the alpha and beta electron densities, ρα(r) and ρβ(r), together with the total density ρ(r)=ρα(r)+ρβ(r), and the spin density ρ(r)=ρα(r)−ρβ(r).

Can anyone help me with this?


You can see an example input file (not Python script) of using cubeprop here. The important part for getting cubeprop to deliver spin density maps is line 13, where “density” is included in the cubeprop_tasks options.

Lines 1-20 of that file are what you need to get the cube files, everything after that is just testing that Psi’s cube files match some reference ones. Converting those lines to a Python input file is a good exercise if you’re just getting started with Psi4. See this page of the documentation for basic Psi4/Python syntax.

Feel free to ask if you get stuck while trying to convert the file.


Thank for your help. I didn’t notice that Ds.cube stand for density spin.

Best regards