Bader and CAstep

Bader charge density analysis

Moderator: moderators

dgeatches
Posts: 2
Joined: Wed Feb 20, 2013 11:24 pm

Bader and CAstep

Post by dgeatches »

Hello everyone,

I am new to Bader analysis so might be doing something silly....

Using den2cube on a formatted density output from a Castep run, I used Bader on the .cube file and think the output is a bit strange.

I implemented the fix suggested regarding the number of ions and that's worked ok. This is what the ACF.dat file says:

# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 6.8255 8.7431 6.5003 0.0000 0.0000 0.0000
2 1.3617 8.9180 2.8010 0.0000 0.0000 0.0000
3 1.9546 17.0519 7.8933 0.0000 0.0000 0.0000
4 6.8596 17.0624 2.2171 0.0000 3.6128 0.1109
5 3.5249 8.4721 23.6105 0.0000 0.0000 0.0000
6 9.0793 8.5748 27.1543 0.0000 0.0000 0.0000
7 8.2575 0.1537 22.1246 0.0000 0.0000 0.0000
8 4.5574 0.0426 28.5344 0.0000 0.0000 0.0000
9 3.5482 5.2277 7.7455 0.1095 1.9670 109.6494
10 6.9542 4.1747 11.3281 0.1105 2.0058 122.7785
11 5.6094 5.1807 2.7846 0.1094 1.9760 107.0984
12 2.2732 4.0100 65.9445 0.1240 2.0992 884.8618
13 5.7992 11.9117 2.8603 0.1103 2.0264 104.6723
14 2.3403 13.0691 -0.5556 0.1239 1.9940 519.8676
15 3.3088 11.7898 7.7609 0.1102 2.0134 107.0984
16 6.8312 12.8194 11.2339 0.1104 1.9908 123.1528
17 2.1061 12.6524 12.6195 0.1114 2.0180 124.9551
18 8.0282 13.9931 6.4285 0.1129 2.0063 111.2715
19 1.0603 13.9164 4.2171 0.1153 2.0304 109.8573
20 7.0812 12.5224 -1.9414 0.1240 1.8899 575.9054
.....................................................................................
65 1.0310 5.7128 26.2968 0.0008 0.4452 2.9530
66 4.8295 5.5760 -0.1569 0.0013 0.3315 1.9687
67 4.2359 5.5341 10.6414 0.0013 0.3801 1.9687
68 4.8970 11.4594 -0.1032 0.0013 0.3505 2.0103
69 4.1380 11.3938 10.6554 0.0013 0.2778 1.8855
70 8.8857 14.1406 9.3307 0.0014 0.3451 2.0934
71 0.1335 14.1768 1.2255 0.0017 0.3106 2.3985
72 0.1585 2.8968 1.1259 0.0016 0.2758 2.3569
73 8.9094 2.8427 9.3055 0.0014 0.2963 2.1628
74 6.1782 5.6604 19.2436 0.0013 0.2942 1.8716
75 5.5853 11.5023 30.0752 0.0013 0.3376 1.9825
76 6.2426 11.4952 19.2364 0.0013 0.3262 1.8439
77 1.5047 14.1806 20.6237 0.0013 0.3098 1.9271
78 1.4293 2.9310 20.5896 0.0013 0.3847 1.9548
79 0.8158 14.1991 31.4276 0.0013 0.3420 1.9687
80 0.6480 2.9302 31.5697 0.0013 0.2999 1.9825
81 0.4895 8.4835 16.2534 0.1230 2.4950 150.2705
82 5.2170 0.0437 14.9096 0.1246 2.4908 149.1753
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 5.9762

Species: H 1-8, O 9-56, Si 66-80, K 81, 82 (and Mg 57, Al, 58-65)

The pseudopotentials are ultrasoft with rcut values: H: 0.80, O: 1.30; Al: 2.00; Si 1.80; Mg: 2.83; K: 3.38

I would like to know
1) if these results are useless for charge analysis

2) if they are, why has it occurred?

3) can it be fixed?

4) if they're not useless, how would I calculate the charge please?

Thank you for your time.

Best wishes,
Dawn Geatches
graeme
Site Admin
Posts: 2256
Joined: Tue Apr 26, 2005 4:25 am
Contact:

Re: Bader and CAstep

Post by graeme »

Something is messed up. The total number of electrons reported (5.9762) is not reasonable.

If you post the cube file, we can try to debug it.
dgeatches
Posts: 2
Joined: Wed Feb 20, 2013 11:24 pm

Re: Bader and CAstep

Post by dgeatches »

Hello Graeme,

apologies for my delayed response.

Please find the attached cube file as you suggested.

Thank you.
Dawn Geatches


[attachment=0]cube.tgz[/attachment]
Attachments
cube.tgz
(3.03 MiB) Downloaded 1054 times
graeme
Site Admin
Posts: 2256
Joined: Tue Apr 26, 2005 4:25 am
Contact:

Re: Bader and CAstep

Post by graeme »

Well, I'm not totally sure yet. There may be a Bohr/Ang conversion factor issue.

I do not see any core charges in your density. In fact, I don't see any charge on the Si or Al atoms. This will lead to poor or non-sensical results from the Bader analysis.

Still, it would be good to figure out the units problem -- if I have time, I'll get back to this. Perhaps see if the values are really density or perhaps the total charge in each voxel.
toshi_shingu
Posts: 3
Joined: Wed Oct 01, 2014 12:10 pm

Re: Bader and CAstep

Post by toshi_shingu »

Hello,
I think there are three issue with den2cube code; 1)Bohr/Ang conversion, 2) density scaling, 3) double count density at periodic boundaries.
try this patch and inform me any problem.

--- den2cube.f90.orig 2014-08-05 22:31:06.010687000 +0900
+++ den2cube.f90 2014-09-09 20:37:07.180696500 +0900
@@ -30,6 +30,7 @@
integer :: errortype ! Decides which type of error we've encountered
integer, dimension(3) :: gridpoints ! Grid points along a, b, c (na, nb, nc)
double precision, dimension(1:3, 1:3) :: reallattice ! Real space lattice vectors
+ double precision :: cellvol ! Cell volume (unit = A^3)
integer :: novoxels ! Number of voxels (na*nb*nc)
integer :: noions = 0 ! Total number of ions (Initialised to 0)
character (len=2), allocatable, dimension(:) :: symb ! Name of ion from .castep
@@ -40,7 +41,7 @@
integer :: i, j ! Loop counters
integer :: x, y, z ! Used for indexing voxel array

- double precision, parameter :: bohr2angstrom = 0.529177249 ! Unit conversion factor
+! double precision, parameter :: bohr2angstrom = 0.529177249 ! Unit conversion fac

integer, allocatable, dimension(:) :: atomno ! Atomic number (index for arrays)
double precision, dimension(3) :: origin = 0.0 ! Origin of system
@@ -101,10 +102,16 @@
! Search through the den_fmt file for the number of gridpoints, lattice vectors and voxels.
call densearch(filename, gridpoints, reallattice, novoxels, ios, errortype)

+ cellvol = reallattice(1,1)*(reallattice(2,2)*reallattice(3,3)-reallattice(2,3)*reallattice(3,2)) &
+ & + reallattice(1,2)*(reallattice(2,3)*reallattice(3,1)-reallattice(2,1)*reallattice(3,3)) &
+ & + reallattice(1,3)*(reallattice(2,1)*reallattice(3,2)-reallattice(2,2)*reallattice(3,1))
+! print *, "cellvol=", cellvol
+
! Scale the lattice vectors appropriately.
do i = 1, 3
do j = 1, 3
- reallattice(i,j) = reallattice(i,j)/(dble(gridpoints(i))*bohr2angstrom)
+! reallattice(i,j) = reallattice(i,j)/(dble(gridpoints(i))*bohr2angstrom)
+ reallattice(i,j) = reallattice(i,j)/dble(gridpoints(i))
end do
end do

@@ -121,11 +128,11 @@
call errorchecking(errortype, ios, filename)
write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) noions,origin(1),origin(2),origin(3)
call errorchecking(errortype, ios, filename)
- write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(1)+1,reallattice(1,1),reallattice(1,2),reallattice(1,3)
+ write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(1),reallattice(1,1),reallattice(1,2),reallattice(1,3)
call errorchecking(errortype, ios, filename)
- write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(2)+1,reallattice(2,1),reallattice(2,2),reallattice(2,3)
+ write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(2),reallattice(2,1),reallattice(2,2),reallattice(2,3)
call errorchecking(errortype, ios, filename)
- write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(3)+1,reallattice(3,1),reallattice(3,2),reallattice(3,3)
+ write(100,'(t3,i3,tr3,f9.6,tr3,f9.6,tr3,f9.6)',iostat=ios) gridpoints(3),reallattice(3,1),reallattice(3,2),reallattice(3,3)
call errorchecking(errortype, ios, filename)

! Allocate the array to the correct size, check for errors
@@ -178,24 +185,14 @@
errortype = 22 ! 22 is writing .cube

! Scale the voxels.
- voxel = voxel/dble(novoxels)
-
- do x = 1, gridpoints(1)+1
- do y = 1, gridpoints(2)+1
- do z = 1, gridpoints(3)+1
- ! Copy edge voxels while we're here.
- voxel(gridpoints(1)+1,y,z) = voxel(1,y,z)
- voxel(x,gridpoints(2)+1,z) = voxel(x,1,z)
- voxel(gridpoints(1)+1,gridpoints(2)+1,z) = voxel(1,1,z)
-
- voxel(x,y,gridpoints(3)+1) = voxel(x,y,1)
- voxel(gridpoints(1)+1,y,gridpoints(3)+1) = voxel(1,y,1)
- voxel(x,gridpoints(2)+1,gridpoints(3)+1) = voxel(x,1,1)
- end do
+! voxel = voxel/dble(novoxels)
+ voxel = voxel/cellvol

+ do x = 1, gridpoints(1)
+ do y = 1, gridpoints(2)
! Thanks to Phil Hasnip for this next part:
- do z = 1, gridpoints(3)+1, 6
- write(100, '(t3, 6(e11.5,tr2))', iostat=ios) (voxel(x,y,z+i-1),i=1,min(6,gridpoints(3)+2-z))
+ do z = 1, gridpoints(3), 6
+ write(100, '(t3, 6(e11.5,tr2))', iostat=ios) (voxel(x,y,z+i-1),i=1,min(6,gridpoints(3)+1-z))
call errorchecking(errortype, ios, filename)
end do
end do
lhtlx95
Posts: 1
Joined: Tue Sep 30, 2014 3:03 am

Re: Bader and CAstep

Post by lhtlx95 »

Hello toshi_shingu, thank you very much for your effort of den2cube!
I modified den2cube with your patch, and used it to convert the *.den_fmt file of CASTEP to a cube file, then used bader on the cube file and got the output file. For comparison, I also did bader analysis of the same model from VASP output.
Comparing the ACF.dat file from CASTEP output with that from VASP output, I found the difference of the total number of electrons is subtle, only 0.0017, but the charge of each atom is very different.

the ACF.dat file from CASTEP

# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 0.6635 1.0245 1.3193 0.0000 0.0000 0.0000
2 3.2275 5.3074 0.4150 0.0000 0.0000 0.0000
3 4.4406 8.1475 7.1580 0.0000 0.0000 0.0000
4 1.7812 3.7775 7.7980 0.0000 0.0000 0.0000
5 5.6561 0.9637 -0.0080 0.0000 2.1723 0.0018
6 8.3722 5.2675 -0.5733 0.0000 2.1556 0.0033
7 9.5133 8.1129 6.1255 0.0000 0.0000 0.0000
8 7.0165 3.7368 6.8142 0.0000 0.0000 0.0000
9 3.4062 8.9143 0.2628 7.9483 1.2056 16.6074
10 3.7679 2.9754 0.3087 7.9408 1.1893 16.1309
11 1.0798 1.8090 0.9220 7.9773 1.1944 19.7432
12 0.2895 3.5757 3.2926 7.9537 1.1467 19.5352
13 3.8226 1.4621 2.5267 7.9550 1.1531 17.5785
14 2.8200 3.9499 2.5747 7.9570 1.1236 18.0860
15 0.8429 4.5601 0.8471 7.9574 1.1906 15.2124
16 1.1839 7.3008 0.7328 7.9580 1.1524 15.6800
17 3.6589 6.1489 0.1633 7.9877 1.1100 18.2697
18 2.8430 8.0605 2.7004 7.9512 1.1316 19.7544
19 1.2471 5.9941 3.0221 7.9484 1.1507 17.6867
20 0.2855 8.4792 2.9717 7.9541 1.1326 17.8660
21 1.6606 8.8779 7.6773 7.9483 1.1678 16.7230
22 1.3629 6.1676 7.8106 7.9479 1.1486 15.3478
23 3.9746 7.3089 7.3514 7.9871 1.1115 18.7843
24 4.8065 5.4083 4.8585 7.9569 1.1340 18.7711
25 1.3151 7.4887 5.4899 7.9499 1.1500 17.7685
26 2.2451 4.9966 5.5782 7.9579 1.1453 18.2143
27 4.2357 4.5099 7.2871 7.9618 1.1678 15.1981
28 3.9947 1.7230 7.3381 7.9481 1.1712 16.5294
29 1.2848 2.9434 7.8983 7.9689 1.2010 19.6071
30 2.2668 0.9291 5.4587 7.9578 1.1507 20.1702
31 3.9946 3.0094 5.0718 7.9885 1.1814 16.8205
32 4.8733 0.5898 5.0855 7.9609 1.1518 17.5216
33 8.4554 8.8743 -0.7260 7.9510 1.1893 16.5160
34 8.8047 2.9569 -0.7288 7.9410 1.1977 16.1616
35 6.1311 1.7883 -0.2275 7.9830 1.2544 19.7955
36 5.4247 3.5016 2.3834 7.9935 1.1780 18.9575
37 8.8489 1.4432 1.4898 7.9540 1.1552 18.0327
38 7.8799 3.8967 1.5622 7.9560 1.1474 17.6115
39 5.9098 4.5030 -0.1667 7.9547 1.1787 15.4857
40 6.2622 7.2560 -0.2647 7.9573 1.1442 15.6381
41 8.7628 6.1249 -0.8342 7.9883 1.1053 18.2514
42 7.9284 8.0131 1.7072 7.9525 1.1547 19.8126
43 6.3006 5.9462 2.0120 7.9506 1.1493 17.7538
44 5.3744 8.4418 1.9792 7.9559 1.1267 18.0736
45 6.7457 8.8477 6.6838 7.9435 1.1864 16.5660
46 6.4616 6.1500 6.8150 7.9493 1.1452 15.2868
47 9.0453 7.2825 6.3511 7.9848 1.1124 18.6075
48 9.8397 5.4294 3.8476 7.9571 1.1184 19.7203
49 6.4327 7.4784 4.4823 7.9596 1.1488 18.1960
50 7.2803 4.9052 4.5759 7.9914 1.1417 16.8695
51 9.2959 4.4966 6.2861 7.9537 1.1754 15.1796
52 9.1184 1.6506 6.3533 7.9451 1.1850 16.4870
53 6.4090 2.9826 6.6405 7.9875 1.2577 18.8084
54 7.2957 1.0328 4.5030 7.9881 1.1379 18.8788
55 8.8151 2.9860 4.1005 7.9620 1.1631 17.0395
56 9.9010 0.4860 4.0744 7.9619 1.1216 18.5656
57 2.4763 1.5073 -0.5159 0.0000 0.0000 0.0000
58 7.6191 1.4669 -1.5407 0.0000 0.0000 0.0000
59 6.1300 2.9812 4.4479 0.0000 0.0000 0.0000
60 5.0630 6.0114 -1.0819 0.0556 0.3356 0.4450
61 2.5452 7.5033 8.6532 0.0551 0.3396 0.4420
62 0.0195 3.0100 -0.0181 0.0572 0.3392 0.4471
63 0.0014 6.0213 -0.0782 0.0557 0.3379 0.4455
64 7.6575 7.4622 -1.6222 0.0560 0.3364 0.4460
65 5.0522 3.0070 8.2096 0.0565 0.3219 0.4481
66 3.8495 8.9575 1.8108 0.0960 0.2803 0.2972
67 3.8931 2.9497 1.9047 0.0948 0.2868 0.2939
68 1.2963 4.4932 2.4227 0.0948 0.2625 0.2944
69 1.3780 7.4591 2.3599 0.0951 0.2762 0.2947
70 1.2483 8.9799 6.1230 0.0944 0.2717 0.2908
71 1.1583 6.0443 6.1897 0.0944 0.2758 0.2929
72 3.7611 4.5242 5.7341 0.0951 0.2882 0.2962
73 3.7238 1.5182 5.7762 0.0953 0.2800 0.2944
74 8.9229 8.9360 0.8152 0.0957 0.2641 0.2949
75 9.0045 2.9341 0.8783 0.0947 0.2682 0.2926
76 6.3891 4.4570 1.3955 0.0947 0.2777 0.2952
77 6.4616 7.4247 1.3596 0.0950 0.2784 0.2954
78 6.3417 8.9563 5.1418 0.0957 0.2904 0.2954
79 6.2593 6.0465 5.2078 0.0949 0.2769 0.2944
80 8.8880 4.4861 4.7237 0.0954 0.2742 0.2949
81 8.8864 1.5079 4.7806 0.0951 0.2710 0.2931
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 384.0017

the ACF.dat file from VASP

# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 0.6635 1.0245 1.3193 0.4295 0.1151 2.5182
2 3.2275 5.3074 0.4150 0.3889 0.0996 2.2020
3 4.4406 8.1475 7.1580 0.4000 0.1146 2.4104
4 1.7812 3.7775 7.7980 0.4081 0.1212 2.3341
5 5.6561 0.9637 -0.0080 0.4114 0.1236 2.5442
6 8.3722 5.2675 -0.5733 0.4025 0.1063 2.2452
7 9.5133 8.1129 6.1255 0.3957 0.0943 2.3654
8 7.0165 3.7368 6.8142 0.4071 0.1308 2.2435
9 3.4062 8.9143 0.2628 7.6123 0.9211 14.5371
10 3.7679 2.9754 0.3087 7.6024 0.9045 14.1013
11 1.0798 1.8090 0.9220 7.3929 0.6670 15.7577
12 0.2895 3.5757 3.2926 7.5949 0.8298 18.1692
13 3.8226 1.4621 2.5267 7.6118 0.8607 16.2654
14 2.8200 3.9499 2.5747 7.6070 0.8328 16.7070
15 0.8429 4.5601 0.8471 7.6248 0.9217 13.5396
16 1.1839 7.3008 0.7328 7.6180 0.9217 13.9404
17 3.6589 6.1489 0.1633 7.4379 0.7071 15.0417
18 2.8430 8.0605 2.7004 7.5967 0.8375 18.3687
19 1.2471 5.9941 3.0221 7.6033 0.8578 16.3862
20 0.2855 8.4792 2.9717 7.6039 0.8477 16.4865
21 1.6606 8.8779 7.6773 7.6078 0.8831 14.6187
22 1.3629 6.1676 7.8106 7.6112 0.9100 13.6287
23 3.9746 7.3089 7.3514 7.4282 0.6993 15.3228
24 4.8065 5.4083 4.8585 7.6057 0.8397 17.3317
25 1.3151 7.4887 5.4899 7.5987 0.8498 16.4358
26 2.2451 4.9966 5.5782 7.5987 0.8448 16.7555
27 4.2357 4.5099 7.2871 7.6261 0.9300 13.5006
28 3.9947 1.7230 7.3381 7.6030 0.8868 14.4370
29 1.2848 2.9434 7.8983 7.4113 0.7159 15.8922
30 2.2668 0.9291 5.4587 7.5967 0.8468 18.6961
31 3.9946 3.0094 5.0718 7.6247 0.8873 14.5594
32 4.8733 0.5898 5.0855 7.6191 0.8493 16.0487
33 8.4554 8.8743 -0.7260 7.6120 0.9046 14.4582
34 8.8047 2.9569 -0.7288 7.6080 0.8807 14.0998
35 6.1311 1.7883 -0.2275 7.4082 0.6942 15.7015
36 5.4247 3.5016 2.3834 7.6220 0.8945 16.3756
37 8.8489 1.4432 1.4898 7.6078 0.8614 16.6966
38 7.8799 3.8967 1.5622 7.6082 0.8485 16.2564
39 5.9098 4.5030 -0.1667 7.6188 0.9270 13.7605
40 6.2622 7.2560 -0.2647 7.6181 0.9080 13.9100
41 8.7628 6.1249 -0.8342 7.4273 0.6947 14.9844
42 7.9284 8.0131 1.7072 7.5985 0.8462 18.4170
43 6.3006 5.9462 2.0120 7.6014 0.8528 16.4310
44 5.3744 8.4418 1.9792 7.6086 0.8400 16.7162
45 6.7457 8.8477 6.6838 7.6049 0.9022 14.4970
46 6.4616 6.1500 6.8150 7.6165 0.9298 13.5923
47 9.0453 7.2825 6.3511 7.4322 0.6922 15.2157
48 9.8397 5.4294 3.8476 7.5942 0.8294 18.2726
49 6.4327 7.4784 4.4823 7.5972 0.8499 16.7581
50 7.2803 4.9052 4.5759 7.6256 0.8732 14.6235
51 9.2959 4.4966 6.2861 7.6232 0.8867 13.5118
52 9.1184 1.6506 6.3533 7.6044 0.8649 14.3960
53 6.4090 2.9826 6.6405 7.4254 0.7103 14.5107
54 7.2957 1.0328 4.5030 7.6249 0.8811 16.4420
55 8.8151 2.9860 4.1005 7.6138 0.8745 15.5027
56 9.9010 0.4860 4.0744 7.6029 0.8365 17.1044
57 2.4763 1.5073 -0.5159 0.3253 0.7849 4.7674
58 7.6191 1.4669 -1.5407 0.3245 0.7801 4.7597
59 6.1300 2.9812 4.4479 0.2741 0.8712 5.9677
60 5.0630 6.0114 -1.0819 0.5113 0.6959 3.5011
61 2.5452 7.5033 8.6532 0.5075 0.7030 3.4886
62 0.0195 3.0100 -0.0181 0.5098 0.6835 3.4127
63 0.0014 6.0213 -0.0782 0.5102 0.6996 3.4886
64 7.6575 7.4622 -1.6222 0.5061 0.6890 3.4502
65 5.0522 3.0070 8.2096 0.5115 0.6762 3.4740
66 3.8495 8.9575 1.8108 0.8078 0.5690 3.0369
67 3.8931 2.9497 1.9047 0.8199 0.5625 3.0951
68 1.2963 4.4932 2.4227 0.8128 0.5761 3.0605
69 1.3780 7.4591 2.3599 0.8118 0.5760 3.0743
70 1.2483 8.9799 6.1230 0.8118 0.5782 3.0770
71 1.1583 6.0443 6.1897 0.8115 0.5705 3.0653
72 3.7611 4.5242 5.7341 0.8126 0.5783 3.0845
73 3.7238 1.5182 5.7762 0.8177 0.5812 3.1129
74 8.9229 8.9360 0.8152 0.8103 0.5694 3.0371
75 9.0045 2.9341 0.8783 0.8103 0.5746 3.0355
76 6.3890 4.4570 1.3955 0.8220 0.5892 3.1372
77 6.4616 7.4247 1.3596 0.8144 0.5674 3.0891
78 6.3417 8.9563 5.1418 0.8187 0.5790 3.1198
79 6.2593 6.0465 5.2078 0.8186 0.5808 3.1131
80 8.8880 4.4861 4.7237 0.8171 0.5633 3.0999
81 8.8864 1.5079 4.7806 0.8180 0.5702 3.1134
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 384.0000

Species: H 1-8, O 9-56, Si 66-81, Al 60-65, Mg 57-59

I would like to know if den2cube with your patch still exists other problem, or if it can be used, how could I calculate the charge of each atom from CASTEP output properly?
Thank you for your time.
Best wishes!
toshi_shingu
Posts: 3
Joined: Wed Oct 01, 2014 12:10 pm

Re: Bader and CAstep

Post by toshi_shingu »

Hello lhtlx95,
There are zero-electrons atoms (H and Mg) in your ACF.dat from CASTEP output.
It might be a core charge issue.
Adding core charges to valence charges will solve this, but I dont know whether CASTEP can output core charges or not.
Shawn
Posts: 5
Joined: Mon Dec 22, 2014 6:47 pm

Re: Bader and CAstep

Post by Shawn »

Hi,

I am new to this and may be doing something wrong,
I tried to start with the NaCl example in the site and my results are not right.
I have attached the castep .denfmt and the den2cube .cube file.
Here are my resultsfrom the ACF.dat:
# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 0.0000 0.0000 0.0000 0.0722 2.1072 80.6198
2 0.0000 5.3813 5.3813 0.0542 2.1072 73.5667
3 5.3813 0.0000 5.3813 0.0542 2.1072 73.5667
4 5.3813 5.3813 0.0000 0.0542 2.1072 73.5667
5 5.3813 5.3813 5.3813 0.0453 3.0494 241.4150
6 5.3813 0.0000 0.0000 0.0508 3.0494 255.7809
7 0.0000 5.3813 0.0000 0.0508 3.0494 255.7809
8 0.0000 0.0000 5.3813 0.0508 3.0494 255.7809
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 0.4324

Thank you in advance
Attachments
NaCl.tar.gz
files
(1.25 MiB) Downloaded 890 times
graeme
Site Admin
Posts: 2256
Joined: Tue Apr 26, 2005 4:25 am
Contact:

Re: Bader and CAstep

Post by graeme »

There is clearly something wrong with the normalization and/or the units, given the total charge calculated. I tried various combinations converted between the charge in a voxel and the density in a voxel, as well as Ang -> Bohr, but I couldn't make it work. The fact that the charge on Na and Cl are similar in magnitude is also problematic. Maybe looking at the conversion script, or the program that wrote the charge density file should be the next step.
Shawn
Posts: 5
Joined: Mon Dec 22, 2014 6:47 pm

Re: Bader and CAstep

Post by Shawn »

Thank you very much for your quick reply. I tried using the check2xsf script to convert the castep.check to .cube as an alternative to the den2cube that I had last to check whether there is a problem with the conversion script. My results are still not correct. I have attached a copy of .cube from check2xsf. Here is my result from this run.
# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 0.0000 0.0000 0.0000 55.0202 2.1072 70.2595
2 0.0000 5.3813 5.3813 55.0202 2.1072 70.2595
3 5.3813 0.0000 5.3813 55.0202 2.1072 70.2595
4 5.3813 5.3813 0.0000 55.0202 2.1072 70.2595
5 5.3813 5.3813 5.3813 52.9530 3.0494 241.4150
6 5.3813 10.7627 10.7627 52.9530 3.0494 241.4150
7 10.7627 5.3813 10.7627 52.9530 3.0494 241.4150
8 10.7627 10.7627 5.3813 52.9530 3.0494 241.4150
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 431.8929
Attachments
halite.cube.tar.gz
.cube from check2xsf
(146.71 KiB) Downloaded 859 times
toshi_shingu
Posts: 3
Joined: Wed Oct 01, 2014 12:10 pm

Re: Bader and CAstep

Post by toshi_shingu »

Hello Shawn.
I cannot make xxx.cube from your result because den2cube requires xxx.castep and xxx.den_fmt.
I attach den2cube.f90 which mainly fixed unit conversion as Prof. graeme pointed out.

Regards,
Attachments
den2cube.tar.gz
(6.84 KiB) Downloaded 917 times
Shawn
Posts: 5
Joined: Mon Dec 22, 2014 6:47 pm

Re: Bader and CAstep

Post by Shawn »

Hi Toshi_shingu,

Thank you for providing the modified den2cube, the results look good now. Here are my results for NaCl, it looks similar to that of Prof Graeme. Thanks once again.
# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 0.0000 0.0000 0.0000 8.1532 1.1151 10.4115
2 0.0000 2.8477 2.8477 8.1532 1.1151 10.4115
3 2.8477 0.0000 2.8477 8.1532 1.1151 10.4115
4 2.8477 2.8477 0.0000 8.1532 1.1151 10.4115
5 2.8477 2.8477 2.8477 7.8469 1.6137 35.7743
6 2.8477 0.0000 0.0000 7.8469 1.6137 35.7743
7 0.0000 2.8477 0.0000 7.8469 1.6137 35.7743
8 0.0000 0.0000 2.8477 7.8469 1.6137 35.7743
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 64.0004
Shawn
Posts: 5
Joined: Mon Dec 22, 2014 6:47 pm

Re: Bader and CAstep

Post by Shawn »

Hi again,

I have another question. My apologies for bothering you again. We can get the ionic radii as the shyortest distance of an atom to its Bader boundary. Does the MIN DIST in the ACF.dat represent the ionic radii? If so, my results for NaF are not right. I have tried 90*90*90 and 60*60*60 FFT grids and the results are almost same. Thank you for all your help.

# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 2.3170 2.3170 2.3170 7.8508 1.2357 16.3784
2 2.3170 0.0000 0.0000 7.8508 1.2357 16.3784
3 0.0000 2.3170 0.0000 7.8508 1.2357 16.3784
4 0.0000 0.0000 2.3170 7.8508 1.2357 16.3784
5 0.0000 0.0000 0.0000 8.1493 1.0298 8.4994
6 0.0000 2.3170 2.3170 8.1493 1.0298 8.4994
7 2.3170 0.0000 2.3170 8.1493 1.0298 8.4994
8 2.3170 2.3170 0.0000 8.1493 1.0298 8.4994
--------------------------------------------------------------------------------
VACUUM CHARGE: 0.0000
VACUUM VOLUME: 0.0000
NUMBER OF ELECTRONS: 64.0005
graeme
Site Admin
Posts: 2256
Joined: Tue Apr 26, 2005 4:25 am
Contact:

Re: Bader and CAstep

Post by graeme »

No this is not the ionic radii. It is main there as a sanity check. When people do not have core charges, this distance can become small, since the Bader volumes extend into the core. I would not try to interpret this distance in terms of materials properties.
Shawn
Posts: 5
Joined: Mon Dec 22, 2014 6:47 pm

Re: Bader and CAstep

Post by Shawn »

Thank you for your reply Prof Graeme. So how can I calculate the ionic radii? I have included a study (attached) where they have calculated it from Bader analysis (e.g. Page 4, last paragraph, line 4-5).

thank you again
Attachments
Dong_2013.pdf
(546.52 KiB) Downloaded 863 times
Post Reply