bader with castep

Bader charge density analysis

Moderator: moderators

Post Reply
sharu
Posts: 1
Joined: Tue Sep 20, 2011 3:48 pm

bader with castep

Post by sharu »

Hi,
I'm having problems with bader. I'm using Castep 5.5 for my calculations.
I tried to convert the *.den_fmt file to a cube file using den2cube but I'm getting strange results which make no sense. (the script isn't working properly anyway, it only reads two atoms where there should be 12)
I tried the check2xsf script, which can convert the density from the *.check file, too. but still Im getting nonsense results. (e.g. 202.2 electrons in the cell which only contains a single Benzene molecule)
is this a problem of converting the data into cube format?
does anyone have experience using bader with castep results?
EdinburghLad
Posts: 2
Joined: Mon Feb 06, 2012 3:34 pm

Re: bader with castep

Post by EdinburghLad »

Hey,

I've been having similar problems using CASTEP 5.5.1. I'm using periodic slabs with one or two bound ligands on top and the den2cube utility outputs an incorrect number of atoms every time (ca. 7 for a model with >100). I couldn't find this check2xsf script and OpenBabel is (somewhat predictably) useless as .cube is a read only format. Any suggestions would be greatly appreciated!

Cheers
graeme
Site Admin
Posts: 1999
Joined: Tue Apr 26, 2005 4:25 am
Contact:

Re: bader with castep

Post by graeme »

If there is a problem converting between between the castep density and the cube format, we would like to understand the problem. The den2cube script was written by Aaron Hopkinson and Matt Probert, and so problems with the script would be best dealt with by them. But, if I can facilitate this, or check that the cube file is being read properly by the bader code, I'm happy to do it. For example, if you have a cube file which is causing problems, I might be able to see what is wrong with it.
EdinburghLad
Posts: 2
Joined: Mon Feb 06, 2012 3:34 pm

Re: bader with castep

Post by EdinburghLad »

All,

Solution found! The den2cube source code extracts the number of ions by going to the "Total number of ions in cell" line in the .castep output and cutting away the first 60 characters. If you have less than ten atoms in your system this is fine, but if you have more it truncates the number.
To change this, open the source code and find the 'castepsearch' subroutine, then find the following piece of code:

! If we find the number, save it
if (search .eq. 26) then
read(line, '(t60, i10)', iostat=ios) noions
call castepsearcherror(ios, noions, run, copy)

change the value of t60 in the read line to t58. Save, compile and smile :-)

With thanks to my supervisor for spotting this!
qt0809
Posts: 2
Joined: Tue Aug 25, 2015 7:34 am

Re: bader with castep

Post by qt0809 »

hello EdinburghLad,

with your solution,I revise the den2cube code and compile it.but the problem is still,I just get the wrong file.I can't understand what it is,could you have a little time to help with it?
here is the wrong cube file

O-TiO2-110-8-vac
Extracted from a CASTEP density formatted file using den2cube
88 0.000000 0.000000 0.000000
9 0.708647 0.236216 0.236216
2 7.558904 1.889726 1.889726
2 9.448630 1.889726 1.889726
8 6.000000 2.652230 0.624932 0.624932
8 6.000000 0.492652 0.098530 0.098530
8 6.000000 3.662361 0.826271 0.826271
8 6.000000 3.340128 0.894086 0.894086
8 6.000000 2.751932 0.680893 0.680893
8 6.000000 1.856618 0.523208 0.523208
8 6.000000 5.090952 1.264450 1.264450
8 6.000000 4.069525 1.097364 1.097364
8 6.000000 1.909946 0.570962 0.570962
8 6.000000 5.033990 1.290930 1.290930
8 6.000000 4.757423 1.366518 1.366518
8 6.000000 4.236885 1.171887 1.171887
8 6.000000 3.273912 0.995640 0.995640
8 6.000000 6.469543 1.726089 1.726089
8 6.000000 5.486819 1.569795 1.569795
8 6.000000 3.327241 1.043393 1.043393
8 6.000000 6.174717 1.838949 1.838949
8 6.000000 5.605759 1.628178 1.628178
8 6.000000 4.691207 1.468071 1.468071
8 6.000000 7.918757 2.209161 2.209161
8 6.000000 6.904114 2.042227 2.042227
8 6.000000 4.744535 1.515825 1.515825
8 6.000000 7.842837 2.227214 2.227214
8 6.000000 7.592012 2.311381 2.311381
8 6.000000 7.004105 2.098284 2.098284
8 6.000000 6.108501 1.940503 1.940503
8 6.000000 9.358074 2.686824 2.686824
8 6.000000 6.431682 1.569795 1.569795
8 6.000000 4.272104 1.043393 1.043393
8 6.000000 13.098001 3.659653 3.659653
8 6.000000 7.119580 1.838949 1.838949
8 6.000000 6.513107 1.620754 1.620754
8 6.000000 5.636070 1.468071 1.468071
8 6.000000 8.894275 2.217159 2.217159
8 6.000000 7.848977 2.042227 2.042227
8 6.000000 5.689398 1.515825 1.515825
8 6.000000 8.857616 2.244824 2.244824
8 6.000000 8.536875 2.311381 2.311381
8 6.000000 7.916584 2.083931 2.083931
8 6.000000 7.053364 1.940503 1.940503
8 6.000000 10.339099 2.695021 2.695021
8 6.000000 9.266271 2.514658 2.514658
8 6.000000 7.106693 1.988256 1.988256
8 6.000000 10.233240 2.707524 2.707524
8 6.000000 9.954169 2.783812 2.783812
8 6.000000 9.442350 2.592523 2.592523
8 6.000000 8.470659 2.412934 2.412934
8 6.000000 11.759313 3.168426 3.168426
8 6.000000 10.683566 2.987090 2.987090
8 6.000000 8.523987 2.460688 2.460688
8 6.000000 11.702551 3.193136 3.193136
8 6.000000 11.371464 3.256244 3.256244
8 6.000000 10.769889 3.039681 3.039681
8 6.000000 9.887953 2.885366 2.885366
8 6.000000 13.137141 3.631449 3.631449
8 6.000000 8.710688 2.306271 2.306271
22 4.000000 1.889726 0.472431 0.472431
22 4.000000 6.881379 2.132739 2.132739
22 4.000000 0.708647 0.236216 0.236216
22 4.000000 3.947666 0.976191 0.976191
22 4.000000 3.307020 0.944863 0.944863
22 4.000000 2.616450 2.601489 2.601489
22 4.000000 2.125942 0.708647 0.708647
22 4.000000 5.172091 1.401576 1.401576
22 4.000000 4.724315 1.417294 1.417294
22 4.000000 4.053415 1.189310 1.189310
22 4.000000 3.543236 1.181079 1.181079
22 4.000000 6.762647 1.931763 1.931763
22 4.000000 6.141609 1.889726 1.889726
22 4.000000 5.453880 3.547299 3.547299
22 4.000000 4.960531 1.653510 1.653510
22 4.000000 8.242964 2.407957 2.407957
22 4.000000 5.669178 1.417294 1.417294
22 4.000000 4.990086 1.187309 1.187309
22 4.000000 4.488099 1.181079 1.181079
22 4.000000 7.691803 1.915402 1.915402
22 4.000000 7.086472 1.889726 1.889726
22 4.000000 6.410954 1.662728 1.662728
22 4.000000 5.905394 1.653510 1.653510
22 4.000000 9.092299 2.383281 2.383281
22 4.000000 8.503767 2.362157 2.362157
22 4.000000 8.142338 2.195399 2.195399
22 4.000000 7.322688 2.125942 2.125942
22 4.000000 10.518916 2.858821 2.858821
22 4.000000 9.921061 2.834589 2.834589
22 4.000000 9.193704 2.590312 2.590312
22 4.000000 8.739983 2.598373 2.598373
22 4.000000 11.944285 3.332897 3.332897
0.00000E+00 0.00000E+00
0.00000E+00 0.00000E+00
0.14654+166 0.14654+166
0.14654+166 0.14654+166
0.64076E-27 0.64076E-27
0.64076E-27 0.64076E-27
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.75168-154 0.75168-154
0.00000E+00 0.00000E+00
0.00000E+00 0.00000E+00

best regards
Post Reply