Bug in reading CHGCAR when atomic coordinates are negative

Bader charge density analysis

Moderator: moderators

Post Reply
Niek
Posts: 1
Joined: Mon Oct 12, 2015 3:30 pm

Bug in reading CHGCAR when atomic coordinates are negative

Post by Niek »

Hi,

I think I found a small bug in the function reading CHGCAR-files. When there are negative values in the positions of the atoms their positions are read in without the minus signs, e.g. for this set of coordinates:
Direct
0.633302 0.832574 0.480461
0.366698 0.167426 0.519539
-0.015159 0.601853 0.375438
0.015159 0.398147 0.624562
0.084854 0.639891 0.529016
0.915146 0.360109 0.470984
0.418923 0.920548 0.620505
0.581077 0.079452 0.379495
0.496088 0.719649 -0.002744
0.503912 0.280351 0.002744
-0.004088 0.785536 -0.000089

Where for the last atom the following coordinates are read in:
0.004088 0.785536 0.000089

This is probably due to the read statement at line 89 of chgcar_mod.f90:
READ(100,'(3(2X,1F8.6))') ions%r_dir(i,:)
I think it will be fixed if this line is changed to:
READ(100,'(3(1X,1F9.6))') ions%r_dir(i,:)

greetings,
Niek
Post Reply