QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: baizq on August 15, 2013, 05:50

Title: extract isovalue of the transmission eigenstates
Post by: baizq on August 15, 2013, 05:50
Dear all,

I remember that, in some previous version (maybe ver 2008.x), it is possible to extract isovalues of transmission eigenstates using VNL for plotting with other software. Is the functionality still available in the current versions (ver. 12.x)? Or is there any other way for the extraction?

Thanks&regards,
baizq
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 15, 2013, 09:26
No, and I may be wrong but I don't actually think that has ever been possible. Producing an isosurface is pretty difficult, and extracting data for the isosurface itself is probably never likely to work in another software.

I believe you are thinking of extracting the data grid itself, and then use another software than like VNL can do isosurfaces based on the data points. That's trivial - you can export CUBE files by using "Export" in the Result Viewer.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 15, 2013, 10:13
Hi Anders,

Thanks. Yes, what I want is to extract the data grid. But when I follow your suggestion by "Export" to CUBE, the file contains the following information:

CUBE FILE.
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
    0 0.000000e+00 0.000000e+00 0.000000e+00
  264 1.811253e-01 1.109073e-17 1.109073e-17
   58 0.000000e+00 1.783511e-01 1.092086e-17
  738 0.000000e+00 0.000000e+00 1.813163e-01

Not supported - yet.

May I know what it means...? ???

baizq
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 15, 2013, 10:31
It means you are trying to export a complex grid. So far, this export is only supported for real grids. But I have a Python script that can do complex grids too. It can even include the configuration too.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 15, 2013, 10:47
Thanks... I am waiting... what's the weather like in Copenhagen? ;)
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 15, 2013, 11:15
We had a very nice summer, not Singapore-hot, but nice enough, dry and sunny.  8)

See attached file. I think you can understand the code regarding the choices for exporting complex data using either 'real', 'imag', 'abs', or (default) 'abs2', i.e. |psi|^2.

This file contains a bonus too - the possibility to make the post-scf analysis at a higher (or lower) mesh cut-off than used in the calculation, for higher level of detail in the plots.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 15, 2013, 14:05
Hi Anders,

Thank you very much for your help!  :)

baizq
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 14:50
Hi Anders,

I have got a problem with the script you passed to me: the extracted isovalue grid of transmission eigenstates is correct but the geometric configuration is not. The way I called the cubefile_with_configuration() function is as follows:

Code
    
import sys

# Complex grid
configuration = nlread('/home/z400/B1/MS/Ti-mos2/MoS2-Ti-singlecontact.nc', object_id='gID000')[0]
te = TransmissionEigenstate(
    configuration=configuration,
    energy=0.48*eV,
    k_point=[0, 0],
    quantum_number=0,
    spin=Spin.Up,
    contributions=Left,
    energy_zero_parameter=AverageFermiLevel,
    )

with open("transmission_eigenstates_Ti_long.cube","w") as cubefile:
    cubefile_with_configuration(te, stream=cubefile)

The program reads in the device configuration from the converged .nc file, makes a post-processing for transmission eigenstates, and dumps the configuration and isovalue grid to the .cube file. But output atomic coordinates, as well as some of the atomic numbers, are not correct. Do you have any suggestion about this?

Thanks&regards,
baizq
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 14:56
Tricky to say without further information, but a typical thing that can go wrong is that coordinates (or grid) are in Bohr and not Angstrom.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 15:47
I have noticed the coordinates are in Bohr instead of Angstrom. But even taking this into account, the coordinates are also completely wrong. Since both the nc and cube files are huge, I cannot attach them to the forum. Let me try to share them in another way.
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 15:49
I only need to see the top of the CUBE file, the part with the coordinates and the "cell", along with the system in Python format.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 15:58
OK. Here it is.

Code
CUBE FILE. DATA VALUES IN UNITS OF 1/Hartree**0.5/Bohr**1.5, LENGTHS IN BOHR
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
  213 0.000000e+00 0.000000e+00 0.000000e+00
  257 1.812844e-01 1.110047e-17 1.110047e-17
   58 0.000000e+00 1.783511e-01 1.092086e-17
  746 0.000000e+00 0.000000e+00 1.813732e-01
   22 2.777701e+00 2.586091e+00 7.464619e-01
   22 1.162003e+01 2.586091e+00 7.464619e-01
   22 2.777701e+00 7.758274e+00 7.464619e-01
   22 1.162003e+01 7.758274e+00 7.464619e-01
   42 1.821067e+01 1.724095e+00 2.239386e+00
   16 1.539942e+01 5.172182e+00 2.239386e+00
   16 2.102191e+01 5.172182e+00 2.239386e+00
   22 7.199100e+00 2.586091e+00 3.732310e+00
   22 7.199100e+00 7.758274e+00 3.732310e+00
   22 2.777701e+00 1.700851e-16 5.225234e+00
   22 1.162003e+01 7.115218e-16 5.225234e+00
   16 1.539942e+01 9.429425e-16 5.225234e+00
   16 2.102191e+01 1.287221e-15 5.225234e+00
   22 2.777701e+00 5.172182e+00 5.225234e+00
   22 1.162003e+01 5.172182e+00 5.225234e+00
   42 1.821067e+01 6.896278e+00 5.225234e+00
   22 7.199100e+00 4.408177e-16 8.212425e+00
   42 1.821067e+01 1.724095e+00 8.212425e+00
   22 7.199100e+00 5.172182e+00 8.212425e+00
   16 1.539942e+01 5.172182e+00 8.212425e+00
   16 2.102191e+01 5.172182e+00 8.212425e+00
   22 2.777701e+00 2.586091e+00 9.705349e+00
   22 1.162003e+01 2.586091e+00 9.705349e+00
   22 2.777701e+00 7.758274e+00 9.705349e+00
   22 1.162003e+01 7.758274e+00 9.705349e+00
   16 1.539942e+01 9.429425e-16 1.119827e+01
   16 2.102191e+01 1.287221e-15 1.119827e+01
   42 1.821067e+01 6.896278e+00 1.119827e+01
   22 7.199100e+00 2.586091e+00 1.269120e+01
   22 7.199100e+00 7.758274e+00 1.269120e+01
   22 2.777701e+00 1.700851e-16 1.418412e+01
   22 1.162003e+01 7.115218e-16 1.418412e+01
   42 1.821067e+01 1.724095e+00 1.418412e+01
   22 2.777701e+00 5.172182e+00 1.418412e+01
   22 1.162003e+01 5.172182e+00 1.418412e+01
   16 1.539942e+01 5.172182e+00 1.418412e+01
   16 2.102191e+01 5.172182e+00 1.418412e+01
   22 7.199100e+00 4.408177e-16 1.716997e+01
   16 1.539942e+01 9.429425e-16 1.716997e+01
   16 2.102191e+01 1.287221e-15 1.716997e+01
   22 7.199100e+00 5.172182e+00 1.716997e+01
   42 1.821067e+01 6.896278e+00 1.716997e+01
   22 2.777701e+00 2.586091e+00 1.866289e+01
   22 1.162003e+01 2.586091e+00 1.866289e+01
   22 2.777701e+00 7.758274e+00 1.866289e+01
   22 1.162003e+01 7.758274e+00 1.866289e+01
   42 1.821067e+01 1.724095e+00 2.015582e+01
   16 1.539942e+01 5.172182e+00 2.015582e+01
   16 2.102191e+01 5.172182e+00 2.015582e+01
   22 7.199100e+00 2.586091e+00 2.165008e+01
   22 7.199100e+00 7.758274e+00 2.165008e+01
   22 2.777701e+00 1.700851e-16 2.314301e+01
   22 1.162003e+01 7.115218e-16 2.314301e+01
   16 1.539942e+01 9.429425e-16 2.314301e+01
   16 2.102191e+01 1.287221e-15 2.314301e+01
   22 2.777701e+00 5.172182e+00 2.314301e+01
   22 1.162003e+01 5.172182e+00 2.314301e+01
   42 1.821067e+01 6.896278e+00 2.314301e+01
   22 7.199100e+00 4.408177e-16 2.612886e+01
   42 1.821067e+01 1.724095e+00 2.612886e+01
   22 7.199100e+00 5.172182e+00 2.612886e+01
   16 1.539942e+01 5.172182e+00 2.612886e+01
   16 2.102191e+01 5.172182e+00 2.612886e+01
   22 2.777701e+00 2.586091e+00 2.762178e+01
   22 1.162003e+01 2.586091e+00 2.762178e+01
   22 2.777701e+00 7.758274e+00 2.762178e+01
   22 1.162003e+01 7.758274e+00 2.762178e+01
   16 1.539942e+01 9.429425e-16 2.911470e+01
   16 2.102191e+01 1.287221e-15 2.911470e+01
   42 1.821067e+01 6.896278e+00 2.911470e+01
   22 7.199100e+00 2.586091e+00 3.060763e+01
   22 7.199100e+00 7.758274e+00 3.060763e+01
   22 2.777701e+00 1.700851e-16 3.210055e+01
   22 1.162003e+01 7.115218e-16 3.210055e+01
   42 1.821067e+01 1.724095e+00 3.210055e+01
   22 2.777701e+00 5.172182e+00 3.210055e+01
   22 1.162003e+01 5.172182e+00 3.210055e+01
   16 1.539942e+01 5.172182e+00 3.210055e+01
   16 2.102191e+01 5.172182e+00 3.210055e+01
   22 7.199100e+00 4.408177e-16 3.508774e+01
   16 1.539942e+01 9.429425e-16 3.508774e+01
   16 2.102191e+01 1.287221e-15 3.508774e+01
   22 7.199100e+00 5.172182e+00 3.508774e+01
   42 1.821067e+01 6.896278e+00 3.508774e+01
   22 2.777701e+00 2.586091e+00 3.658067e+01
   22 1.162003e+01 2.586091e+00 3.658067e+01
   22 2.777701e+00 7.758274e+00 3.658067e+01
   22 1.162003e+01 7.758274e+00 3.658067e+01
   42 1.821067e+01 1.724095e+00 3.807359e+01
   16 1.539942e+01 5.172182e+00 3.807359e+01
   16 2.102191e+01 5.172182e+00 3.807359e+01
   22 7.199100e+00 2.586091e+00 3.956651e+01
   22 7.199100e+00 7.758274e+00 3.956651e+01
   22 2.777701e+00 1.700851e-16 4.105944e+01
   22 1.162003e+01 7.115218e-16 4.105944e+01
   16 1.539942e+01 9.429425e-16 4.105944e+01
   16 2.102191e+01 1.287221e-15 4.105944e+01
   22 2.777701e+00 5.172182e+00 4.105944e+01
   22 1.162003e+01 5.172182e+00 4.105944e+01
   42 1.821067e+01 6.896278e+00 4.105944e+01
   22 7.199100e+00 4.408177e-16 4.404529e+01
   42 1.821067e+01 1.724095e+00 4.404529e+01
   22 7.199100e+00 5.172182e+00 4.404529e+01
   16 1.539942e+01 5.172182e+00 4.404529e+01
   16 2.102191e+01 5.172182e+00 4.404529e+01
   22 2.777701e+00 2.586091e+00 4.553821e+01
   22 1.162003e+01 2.586091e+00 4.553821e+01
   22 2.777701e+00 7.758274e+00 4.553821e+01
   22 1.162003e+01 7.758274e+00 4.553821e+01
   16 1.539942e+01 9.429425e-16 4.703113e+01
   16 2.102191e+01 1.287221e-15 4.703113e+01
   42 1.821067e+01 6.896278e+00 4.703113e+01
   22 7.199100e+00 2.586091e+00 4.852540e+01
   22 7.199100e+00 7.758274e+00 4.852540e+01
   22 2.777701e+00 1.700851e-16 5.001833e+01
   22 1.162003e+01 7.115218e-16 5.001833e+01
   42 1.821067e+01 1.724095e+00 5.001833e+01
   22 2.777701e+00 5.172182e+00 5.001833e+01
   22 1.162003e+01 5.172182e+00 5.001833e+01
   16 1.539942e+01 5.172182e+00 5.001833e+01
   16 2.102191e+01 5.172182e+00 5.001833e+01
   22 7.199100e+00 4.408177e-16 5.300417e+01
   16 1.539942e+01 9.429425e-16 5.300417e+01
   16 2.102191e+01 1.287221e-15 5.300417e+01
   22 7.199100e+00 5.172182e+00 5.300417e+01
   42 1.821067e+01 6.896278e+00 5.300417e+01
   22 2.777701e+00 2.586091e+00 5.449710e+01
   22 1.162003e+01 2.586091e+00 5.449710e+01
   22 2.777701e+00 7.758274e+00 5.449710e+01
   22 1.162003e+01 7.758274e+00 5.449710e+01
   42 1.821067e+01 1.724095e+00 5.599002e+01
   16 1.539942e+01 5.172182e+00 5.599002e+01
   16 2.102191e+01 5.172182e+00 5.599002e+01
   22 7.199100e+00 2.586091e+00 5.748295e+01
   22 7.199100e+00 7.758274e+00 5.748295e+01
   16 1.539942e+01 9.429425e-16 5.897587e+01
   16 2.102191e+01 1.287221e-15 5.897587e+01
   42 1.821067e+01 6.896278e+00 5.897587e+01
   42 1.821067e+01 1.724095e+00 6.196306e+01
   16 1.539942e+01 5.172182e+00 6.196306e+01
   16 2.102191e+01 5.172182e+00 6.196306e+01
   16 1.539942e+01 9.429425e-16 6.494891e+01
   16 2.102191e+01 1.287221e-15 6.494891e+01
   42 1.821067e+01 6.896278e+00 6.494891e+01
   42 1.821067e+01 1.724095e+00 6.793476e+01
   16 1.539942e+01 5.172182e+00 6.793476e+01
   16 2.102191e+01 5.172182e+00 6.793476e+01
   16 1.539942e+01 9.429425e-16 7.092060e+01
   16 2.102191e+01 1.287221e-15 7.092060e+01
   42 1.821067e+01 6.896278e+00 7.092060e+01
   42 1.821067e+01 1.724095e+00 7.390645e+01
   16 1.539942e+01 5.172182e+00 7.390645e+01
   16 2.102191e+01 5.172182e+00 7.390645e+01
   16 1.539942e+01 9.429425e-16 7.689364e+01
   16 2.102191e+01 1.287221e-15 7.689364e+01
   42 1.821067e+01 6.896278e+00 7.689364e+01
   42 1.821067e+01 1.724095e+00 7.987949e+01
   16 1.539942e+01 5.172182e+00 7.987949e+01
   16 2.102191e+01 5.172182e+00 7.987949e+01
   16 1.539942e+01 9.429425e-16 8.286534e+01
   16 2.102191e+01 1.287221e-15 8.286534e+01
   42 1.821067e+01 6.896278e+00 8.286534e+01
   42 1.821067e+01 1.724095e+00 8.585119e+01
   16 1.539942e+01 5.172182e+00 8.585119e+01
   16 2.102191e+01 5.172182e+00 8.585119e+01
   16 1.539942e+01 9.429425e-16 8.883838e+01
   16 2.102191e+01 1.287221e-15 8.883838e+01
   42 1.821067e+01 6.896278e+00 8.883838e+01
   42 1.821067e+01 1.724095e+00 9.182423e+01
   16 1.539942e+01 5.172182e+00 9.182423e+01
   16 2.102191e+01 5.172182e+00 9.182423e+01
   16 1.539942e+01 9.429425e-16 9.481007e+01
   16 2.102191e+01 1.287221e-15 9.481007e+01
   42 1.821067e+01 6.896278e+00 9.481007e+01
   42 1.821067e+01 1.724095e+00 9.779592e+01
   16 1.539942e+01 5.172182e+00 9.779592e+01
   16 2.102191e+01 5.172182e+00 9.779592e+01
   16 1.539942e+01 9.429425e-16 1.007818e+02
   16 2.102191e+01 1.287221e-15 1.007818e+02
   42 1.821067e+01 6.896278e+00 1.007818e+02
   42 1.821067e+01 1.724095e+00 1.037690e+02
   16 1.539942e+01 5.172182e+00 1.037690e+02
   16 2.102191e+01 5.172182e+00 1.037690e+02
   16 1.539942e+01 9.429425e-16 1.067548e+02
   16 2.102191e+01 1.287221e-15 1.067548e+02
   42 1.821067e+01 6.896278e+00 1.067548e+02
   42 1.821067e+01 1.724095e+00 1.097407e+02
   16 1.539942e+01 5.172182e+00 1.097407e+02
   16 2.102191e+01 5.172182e+00 1.097407e+02
   16 1.539942e+01 9.429425e-16 1.127265e+02
   16 2.102191e+01 1.287221e-15 1.127265e+02
   42 1.821067e+01 6.896278e+00 1.127265e+02
   42 1.821067e+01 1.724095e+00 1.157137e+02
   16 1.539942e+01 5.172182e+00 1.157137e+02
   16 2.102191e+01 5.172182e+00 1.157137e+02
   16 1.539942e+01 9.429425e-16 1.186995e+02
   16 2.102191e+01 1.287221e-15 1.186995e+02
   42 1.821067e+01 6.896278e+00 1.186995e+02
   42 1.821067e+01 1.724095e+00 1.216854e+02
   16 1.539942e+01 5.172182e+00 1.216854e+02
   16 2.102191e+01 5.172182e+00 1.216854e+02
   16 1.539942e+01 9.429425e-16 1.246712e+02
   16 2.102191e+01 1.287221e-15 1.246712e+02
   42 1.821067e+01 6.896278e+00 1.246712e+02
   42 1.821067e+01 1.724095e+00 1.276571e+02
   16 1.539942e+01 5.172182e+00 1.276571e+02
   16 2.102191e+01 5.172182e+00 1.276571e+02
   16 1.539942e+01 9.429425e-16 1.306443e+02
   16 2.102191e+01 1.287221e-15 1.306443e+02
   42 1.821067e+01 6.896278e+00 1.306443e+02
   42 1.821067e+01 1.724095e+00 1.336301e+02
   16 1.539942e+01 5.172182e+00 1.336301e+02
   16 2.102191e+01 5.172182e+00 1.336301e+02
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 16:03
The system contains Ti (22), Mo (42), and S(16). Obviously the atomic numbers in the first a few lines are wrong.

Here I also attached the python file for your reference.
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 16:11
Well, no :) The first few lines are not coordinates, that's the cell vectors, and the number of grid points in each direction. You can see the cube file format at http://paulbourke.net/dataformats/cube/. So, perhaps all is ok?
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 16:37
Oh...sorry...I am less familiar with the Gaussian cube format... let me read it through first...

But I still don't think the problem is solved because when I drag and drop the CUBE file to VESTA, the atomic coordinates are all wrong... (see attached file extracted from VESTA and the one directly from VNL)...
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 16:47
This looks more like a problem that perhaps we and VESTA don't agree on the exact specification of the CUBE file format, because they are not even close to each other... I used to have VESTA installed but I don't anymore (I found it terribly difficult to use ;) ) so I can't really test it myself.

Is there any particular plotting you can't do in VNL that you need VESTA for? I don't know if you noticed, but 13.8 is now available in beta-release, and the 3D viewer has some new options for controlling the plotting.
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 16:50
Saaaaaaaaaay. I never noticed that extra column in the CUBE format... The coordinates are given in the example, at the link I sent, by 5 columns. The 2nd one is always zero, not sure what it's for - but it's missing in our export.

Try changing line 54 in the script to

Code: python
            stream.write("%5i%13.6e%13.6e%13.6e%13.6e\n" % (e.atomicNumber(),0,c[0],c[1],c[2]))

and see if that improves things.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 16:53
Ok. I have checked the coordinates. If converting the unit from Bohr to Angstrom, they appear to be correct. Then the problem should lie in the importing of the cube file to VESTA...

Thank you for your help, Anders.
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 16:59
Ok...Ok...That might be where the problem lies...it is five column..."the first is the atom number, second (?), the last three are the x,y,z coordinates of the atom center".

Let me try to change the code first...

But... why do they make a space for such an extra meaningless column....
Title: Re: extract isovalue of the transmission eigenstates
Post by: Anders Blom on August 30, 2013, 17:01
And above all: who is responsible for this file format, officially? Gaussian? Why is the top Google hit for the format specification a page from 2003 where the 2nd column indeed is unknown?

The column might be for charge, or some other property. Just weird nobody knows  ???
Title: Re: extract isovalue of the transmission eigenstates
Post by: baizq on August 30, 2013, 17:37
Anders, you are right. Inserting a zero column in between the atomic number and coordinates solves the problem(see attach file). VESTA may by default treat the 3rd column as x, 4th as y, and 5th as z, following the format of the weird Gaussian cube file. Since we missed a column at first, it cannot find the fifth column and just sets the z coordinates as pure zero. This explains why in my first plot all atoms are accumulated at the two ends of the supercell.

The reason I insist to use VESTA is simply that.... I have plotted all the other figures in the manuscript with VESTA...just to make sure of style consistency...Anyway I promise next time I will use VNL for plotting... ;)

Thanks for your help. Have a nice weekend.

baizq