QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: coollailai on July 13, 2012, 11:20

Title: export electron difference density data and data processing
Post by: coollailai on July 13, 2012, 11:20
hi, everyone.
I calculate electron difference density of two supercells(A and B) through VNL. And I want to do some data processing. For example, the electron difference density of A minus the electron difference density of B. I know in VNL there is a export choice about electron difference density . However, do I save the export file as txt format?  And I don't understand the export file and don't know how to do the data processing. Do I need to write some codes for data processing. If I have to write codes, can you share the standard format of codes?
Thanks~~
Title: Re: export electron difference density data and data processing
Post by: Anders Blom on July 13, 2012, 12:48
This is much easier than you might expect :) If you have two densities you can just subtract them and save the result in a NC file and visualize it in VNL. We do this in the I-V curve tutorial to plot the voltage drop: http://quantumwise.com/publications/tutorials/mini-tutorials/98 (scroll down).

So, let's say you have the densities for A and B saved in files A.nc and B.nc, and we assume they are the only electron difference densities in these files, then a simple script will be the trick:

Code: python
eddA = nlread("A.nc", ElectronDifferenceDensity)[0]
eddB = nlread("B.nc", ElectronDifferenceDensity)[0]
nlsave("difference.nc", eddA-eddB)

Then open difference.nc in VNL and plot it.
Title: Re: export electron difference density data and data processing
Post by: coollailai on July 14, 2012, 08:24
Thank you.
I tried, and it works. this simple code can be used for subtraction.
VNL can plot the data directly. However, I can't do the data processing to this plot, especially the numerical analysis (like this figure at attachment). So I think export this data might be a good way. However, the export file (I save as txt format) is just a file containing a lot of matrix. And now I don't know how to do this.
Title: Re: export electron difference density data and data processing
Post by: Anders Blom on July 14, 2012, 08:29
The exported file is a CUBE file which is a format that other programs can read, e.g. Matlab. But the plots shown in the figure are just contour plots, which you can do with VNL, export PNG images, and the labels you just add by hand later on in a drawing program or Word or whatever you prefer.
Title: Re: export electron difference density data and data processing
Post by: coollailai on July 14, 2012, 08:49
thanks~
That is really helpful.