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,
|
|