Top Page > Browsing
How to plot Vhart in a given direction.
Date: 2018/05/23 02:08
Name: Carlos

Dear OpenMX developers and users,

I investigating a 2D material.
I know that in OpenMX the Hartree potential is written in Gaussian cube format(.vhart.cube).
However, I would like to plot the Hartree potential the along a specific direction. For instance, the direction "z" (perpendicular to plane of the 2D material).
Is there any available code to do that?
Please, could anyone indicate me the easiest way to do that?


Thanks in advance!

メンテ
Page: [1]

Re: How to plot Vhart in a given direction. ( No.1 )
Date: 2018/05/23 03:33
Name: Naoya Yamaguchi

Hi,
You can prepare the code by modifying "diff_gcube.c".
I leave an example of it (plotting the average in terms of a-b plane along c-axis):

You can modify lines 250-283 in "diff_gcube.c" as follows:
/*******************************************
make a file
*******************************************/

if ((fp1 = fopen(argv[3],"w")) != NULL){

/* Disabled *********************************************************************************************
fprintf(fp1,"%s\n",ctmp);
fprintf(fp1,"%s\n",ctmp);
fprintf(fp1,"%5d %12.6f %12.6f %12.6f\n",atomnum1,Grid_Origin1[1],Grid_Origin1[2],Grid_Origin1[3]);
fprintf(fp1,"%5d %12.6f %12.6f %12.6f\n",Ngrid1_1,gtv1[1][1],gtv1[1][2],gtv1[1][3]);
fprintf(fp1,"%5d %12.6f %12.6f %12.6f\n",Ngrid1_2,gtv1[2][1],gtv1[2][2],gtv1[2][3]);
fprintf(fp1,"%5d %12.6f %12.6f %12.6f\n",Ngrid1_3,gtv1[3][1],gtv1[3][2],gtv1[3][3]);

for (i=1; i<=atomnum1; i++){
fprintf(fp1,"%5.0f %12.6f %12.6f %12.6f %12.6f\n",
Gxyz1[i][0],0.0,Gxyz1[i][1],Gxyz1[i][2],Gxyz1[i][3]);
}

for (n1=0; n1<Ngrid1_1; n1++){
for (n2=0; n2<Ngrid1_2; n2++){
for (n3=0; n3<Ngrid1_3; n3++){
fprintf(fp1,"%13.3E",CubeData1[n1][n2][n3]-CubeData2[n1][n2][n3]);
if ((n3+1)%6==0) { fprintf(fp1,"\n"); }
}
/* avoid double \n\n when Ngrid3%6 == 0 */
if (Ngrid1_3%6!=0) fprintf(fp1,"\n");
}
}
* ********************************************************************************************************/

/* Added ***/
for (n3=0; n3<Ngrid1_3; n3++){
double sum=0.0;
for (n2=0; n2<Ngrid1_2; n2++){
for (n1=0; n1<Ngrid1_1; n1++){
sum+=CubeData1[n1][n2][n3];
}
}
fprintf(fp1,"%d %13.3E\n", n3, sum/(Ngrid1_1*Ngrid1_2));
}
/* ***/

fclose(fp1);
}
else{
printf("error in saving %s\n",argv[3]);
}

And, after making executable file for it, you may execute it:
% ./diff_gcube (INPUT(*.cube)) (INPUT(*.cube)) (OUTPUT)
However, I didn't check the behavior, so you should do the above carefully.

Regards,
Naoya Yamaguchi
メンテ
Re: How to plot Vhart in a given direction. ( No.2 )
Date: 2018/05/23 03:16
Name: Carlos

Dear Naoya Yamaguchi,

Thank you, for you prompt answer.
I am going to test your proposal.

Best regards,
メンテ

Page: [1]

Thread Title (must) Move the thread to the top
Your Name (must)
E-Mail (must)
URL
Password (used in modification of the submitted text)
Comment (must)

   Save Cookie