Support for CP2K

I saw that there is an old post about CP2K input generators. New CP2K input generator in Avogadro,

I was wondering if there are plans to incorporate additional support for CP2K / periodic calculations in general? I was just trying to visualize a TDDFT spectrum and some cube files but couldn’t, hence the post.

test-NTO_00101_Hole_State-1_0.txt (335.9 KB)

PBE-SVP.out (103.2 KB)

Yes - @brockdyer03 wrote some support for reading xsf files. I can post that as a plugin for testing if you like.

I’d like to have more support - but obviously, without knowing what people want (e.g., the survey and the forum) it’s hard to do everything possible. I’ve wanted better support for DOS and band structure plots, but don’t have many example files.

It looks like it would be possible to build on GitHub - cp2k/cp2k-output-tools: Python tools to handle CP2K output files · GitHub which can generate JSON or YAML output. (Unclear on what it does with TDDFT.) Should be possible to build a Python plugin from that.

I should have been a bit clearer - what features would you want from CP2K / periodic calculation support?

For this one, it would be nice to be able to (a) simply read the structure to ensure it makes sense (b) plot the TDDFT spectra. I have not yet ran DOS and band structure calculations yet but Im certain I will encounter them at some point.

Also, the cube file with the TDDFT NTOs (see previous attachment) doesn’t work… From what I could see it is formatted like any other cube file I’ve seen. I don’t know how cube files are handled for periodic systems though.

Happy to provide some examples!

The cube file should be an “easy” fix when I have some time this afternoon.

Support for more output formats will take a bit, since writing good parsers takes time.

As I said, it’s probably easiest to go through a Python parser first. I’ll check if that cp2k-output tool offers up the spectral data, band structure, etc. If so, it’s probably 30 minutes to an hour to hook up a format plugin.

If you can get some examples of DOS / PDOS, band structures, etc. it would be great. I’m not sure I can get all that into the 2.1 release, but there’s already code for DOS / PDOS and band structure plots in there.

Awesome! So, the following input for the NaCl crystal

Test.inp (1.5 KB)

Produces the following output:

Test.out (60.6 KB)

and the following DOS & PDOS

NaCl-1.dos.txt (2.3 KB)

NaCl-k2_curve-1.pdos.txt (29.0 KB)

NaCl-k1_curve-1.pdos.txt (22.9 KB)

NaCl-curve-1.dos.txt (15.7 KB)

NaCl-1.dos.txt (2.3 KB)

(Note they come with .dos & .pdos extensions, it would be cool if these were enabled to upload in the forum). Still figuring out how to get the band structure.

Looks like there are some example files:

For example diamond:

Thank you, yes. This file produces the following output

diamond.out (47.7 KB)

and the following .bs file with the band structure

diamond.bs.txt (17.1 KB)

Yeah, the trick with that cube file is that it has a non-rectangular grid. At the moment, that’s not supported.

The “easy” way to get something useful would be to create a new rectilinear cube and pad with some zeros outside your unit cell.

The longer-term fix is to add support for non-rectangular unit cells, but that’ll have to wait for after the 2.1 release.