Header Ads Widget

Ab initio Calculations Using Elk Code

Last Posts

10/recent/ticker-posts

3D Visualization of electron density in VESTA

 

  • Vitaliy Romaka

    Vitaliy Romaka - 2012-10-26

    Hello everybody,
    So, I have successfully plotted 3D electron density obtained from RHO3D.OUT file in program VESTA.
    Step-by-step:
    1. Generate RHO3D.OUT File, appropriate flags are required in elk.in (see Elk Manual) with some k-grid
    In the file you will have something like this:

        20    20    20 : grid size
       0.000000000       0.000000000       0.000000000      0.1643019997E-01
      0.4478461620       0.000000000       0.000000000      0.1747919287E-01
      0.8956923241       0.000000000       0.000000000      0.2061542978E-01
       1.343538486       0.000000000       0.000000000      0.2528383332E-01
       1.791384648       0.000000000       0.000000000      0.2966042854E-01
    …..
    2. Note somewhere the first line (20 20 20) you will need it later. Now delete the first line, you should have only 4 columns. From these 4 columns we will need to have only the last one, so delete first 3 columns. (I usually open the file in Origin, and re-export only last column)
    3. Change file name to something XXXXXX.LED and open the file. Now you should add at the beginning of your file:
    Compound name, (something like - super-duper solid AxByCz)
    Cell parameters separated by space, or TAB (a b c alpha beta gamma) (4.154 2.564 7.896 90 90 90) in Angstrems A.
    I have found that with this method you may have probably to play with "a b c", to try them like "c b a". I used this method for tetragonal structure, so "c a a" were used, and of course remember alpha beta gamma.
    And finally k-grid separated by space or TAB (kx ky kz). Remember, this k-grid we have already noted somewhere, it was 20 20 20.
    Finally the file should looks like this:

    super-duper solid AxByCz
    4.154 2.564 7.896 90 90 90
    20 20 20
    0.1643019997E-01
    0.1747919287E-01
    0.2061542978E-01
    0.2528383332E-01
    0.2966042854E-01

    Now save it. Run VESTA and open this file
    Ta-dam!

    P.S.
    Use it, improve it, have fun, and don't forget to post your solutions here.

     

  • Vitaliy Romaka

    Vitaliy Romaka - 2012-10-26

    Same method was also successfully applied to visualize ELF (electron localization function) from ELF3D.OUT

     

  • Anton F.

    Anton F. - 2012-10-27

    Hi!
    Thank you for this useful information on plotting 3d-data from Elk with Vesta! I've performed the algorythm and it worked out. So I think Elk developers should consider to add it to Elk's FAQ or user's guide.

    Best wishes,
    Anton F.

     

  • Vitaliy Romaka

    Vitaliy Romaka - 2012-10-27

    Don't forget, that ou can open GEOMETRY.OUT file directly in VESTA. This is a new feature of the newest VESTA 3.x version

     

  • Eike Schwier

    Eike Schwier - 2012-11-16

    Hello.

    Thanks to your work I could update my igor procedure for converting Rho2VESTA. I just tested it with Bi2Se3 and the result looks convincing, if compared with the output of GEOMETRY.OUT (see image). I have been using the GRD dataformat before so for this it seems that the plot3d vectors in elk have to look like this:
    plot3d
    0 0 0
    0 0 1
    0 1 0
    1 0 0

    So for those of you that have igor, here my procedure. Feel free to comment on points to improve.

    And for those of you who do not like to dive to much into the code:
    - The lattice constant remains in bohr for compatibility with loading GEOMETRY.OUT in VESTA.
    - You can change the valueof aB in the 3. line if you want Angstroem.

    Convert it with VESTA orIt leaves the lattice constant in bohr, but you can change the value of aB if you like A better.

    function elk_3Dplot2VESTA() // (plot3dFile, title)
    
        string plot3dFile = "RHO3D.OUT" // string plot3dFile
        string title = "generic name" // string title
        variable aB = 1//0.52917720859 // stay in bohr for VESTA compatibility with GEOMETRY.OUT
    
        close/A
        //  pathInfo importPath 
        NewPath/O importPath
        
        
        // ################################################
        // BEGIN - read GEOMETRY.OUT
        // ################################################
        
        variable refGeo
        
        variable a1, a2, a3 // components of 1. lattice vector
        variable b1, b2, b3 // components of 2. lattice vector
        variable c1, c2, c3 // components of 3. lattice vector
        
        string GEOfile = "GEOMETRY.OUT"
        Open/R/Z=2/P=importPath refGeo as GEOfile
        string line
    
        variable g
        for(g=0;g>-1;g+=0)
    
            FReadLine refGeo, line
            if(strlen(line)==0)
                break
            endif
            if(strsearch(line, "avec", 0)>=0)
                FReadLine refGeo, line
                sscanf line, "%f  %f  %f " , a1, a2, a3
                FReadLine refGeo, line
                sscanf line, "%f  %f  %f " , b1, b2, b3
                FReadLine refGeo, line
                sscanf line, "%f  %f  %f " , c1, c2, c3
            endif
        endfor          
        close/A
      
        // ################################################
        // BEGIN - read "3D data".OUT
        // ################################################
        
        string exportLine
        string dumpStr
        variable dumpVar
        variable ref3dIN, ref3dOUT
        string numX, numy, numZ
        string intensity
    
        string fileName = plot3dFile
        Open /R/P=importPath ref3dIN as fileName
    
        FReadLine ref3dIN, line
        sscanf line ,"%s %s %s %s %s", numX, numy, numZ, dumpStr, dumpStr // get number of grid points in the x,y and z direction of plot 3D
        string exportName = plot3dFile[0,strlen(plot3dFile)-5] + ".GRD"
        print exportName
        Open/P=importPath ref3dOUT as exportName
        exportLine = title
        exportLine += "\n"
        fprintf ref3dOUT, exportLine
        exportLine = num2str(sqrt(a1^2+a2^2+a3^2)*aB) + " " + num2str(sqrt(b1^2+b2^2+b3^2)*aB) + " " + num2str(sqrt(c1^2+c2^2+c3^2)*aB) + " "
        exportLine += num2str(elk_vec2ang(b1,b2,b3,c1,c2,c3)) + " " + num2str(elk_vec2ang(a1,a2,a3,c1,c2,c3)) + " " + num2str(elk_vec2ang(a1,a2,a3,b1,b2,b3)) + " "
        exportLine += "\n"
        fprintf ref3dOUT, exportLine
    
        exportLine = numX + " " + numY + " " + numZ + " "
        exportLine += "\n"
        fprintf ref3dOUT, exportLine
    
        variable r
        for(r=0;r>-1;r+=0)
    
            FReadLine ref3dIN, line
            if(strlen(line)==0)
                break
            endif
            sscanf line ,"%f %f %f %s", dumpVar,dumpVar,dumpVar, intensity
            exportLine = intensity
            exportLine += "\n"
            fprintf ref3dOUT, exportLine
    
        endfor
            close/a
    
    end
    function elk_vec2ang(x1,x2,x3,y1,y2,y3)
    
        variable x1,x2,x3,y1,y2,y3
    
        return (360/2/pi)*acos( ( x1*y1 + x2*y2 + x3*y3 ) / ( sqrt(x1^2+x2^2+x3^2) * sqrt(y1^2+y2^2+y3^2) ) )
    end
    

    Also thank you Anton for the information about VESTA and the GEOMETRY.OUT file. This is a nice feature.

    best wishes,
    Eike

     

  • Vitaliy Romaka

    Vitaliy Romaka - 2012-11-19

    Eike
    Are you sure Anton wrote something about GEOMETRY.OUT and VESTA? ;-)
    For additional information on volumteric and strucuture data formats, take a look on VESTA manual, probably you will find it useful for your programs.

     

Eike Schwier

Eike Schwier - 2012-11-19

Ups, sorry. It was in fact you who added the comment about VESTA and GEOMETRY.OUT after Antons post. Seems I missed the little dotted line separating your two posts. So after all, all thanks to you ;)
Actually I did read the manual on volumetric data, but I find the formats are not very well described or only described via links to external pages that did not seem to describe the formats either. So for someone who just wanted a converter that was kind of tough. But luckily, that is not the case anymore.

 

https://sourceforge.net/p/elk/discussion/897820/thread/0979b76b/ 

Post a Comment

0 Comments