giovannipizzi / seekpath

A module to obtain and visualize k-vector coefficients and obtain band paths in the Brillouin zone of crystal structures
Other
114 stars 45 forks source link

double precision as default #7

Closed tkotani closed 7 years ago

tkotani commented 7 years ago

Dear author, It is a great application. I really appreciate your efforts.

Here is my sample for NiO.

import seekpath
cell = [[0.5, 0.5, 1.0],[0.5, 1.0, 0.5],[1.0, 0.5, 0.5]]
positions = [[0, 0, 0],[.25,.25,.25],[.5,.5,.5],[.75,.75,.75]]
numbers = [1,2,3,3]
structure = (cell, positions, numbers)
with_time_reversal=False
a=seekpath.get_path(structure,with_time_reversal) for i in a.keys():
print i, a[i]

I think all numbers should be double precision, or exact values. (I saw numbers such as 0.66666667 in its console output. It is problematic in my case).

takao kotani

giovannipizzi commented 7 years ago

Hi, if you see 0.66666667, it's because the default precision for printing in numpy is 8. If you add the following two lines before the beginning of your script:

import numpy
numpy.set_printoptions(precision=16)

you will see that everything is in double precision. It's not possible to use exact values both because the underlying library (spglib) uses float numbers, and because anyway in most cases the input comes from a simulation code and is not an exact number.