1717
1818PRECISION_MAP = {
1919 # decimal places
20- "coordinates_crystal" : 6 ,
21- ## Default values are used for the below
22- # "coordinates_crystal": 4,
23- # "angles": 4,
20+ "coordinates_crystal" : 9 ,
21+ "coordinates_cartesian" : 6 ,
22+ "angles" : 4 ,
2423}
2524
2625
@@ -67,11 +66,12 @@ def lattice_vectors(self):
6766 Reference:
6867 func: express.parsers.mixins.ionic.IonicDataMixin.lattice_vectors
6968 """
69+ precision = PRECISION_MAP ["coordinates_cartesian" ]
7070 return {
7171 "vectors" : {
72- "a" : self ._round (self .structure .lattice .matrix .tolist ()[0 ]),
73- "b" : self ._round (self .structure .lattice .matrix .tolist ()[1 ]),
74- "c" : self ._round (self .structure .lattice .matrix .tolist ()[2 ]),
72+ "a" : self ._round (self .structure .lattice .matrix .tolist ()[0 ], precision ),
73+ "b" : self ._round (self .structure .lattice .matrix .tolist ()[1 ], precision ),
74+ "c" : self ._round (self .structure .lattice .matrix .tolist ()[2 ], precision ),
7575 "alat" : 1.0 ,
7676 }
7777 }
@@ -83,14 +83,16 @@ def lattice_bravais(self):
8383 Reference:
8484 func: express.parsers.mixins.ionic.IonicDataMixin.lattice_bravais
8585 """
86+ precision_coordinates = PRECISION_MAP ["coordinates_cartesian" ]
87+ precision_angles = PRECISION_MAP ["angles" ]
8688 return {
8789 "type" : self ._lattice_type (),
88- "a" : self ._round (self .structure .lattice .a ),
89- "b" : self ._round (self .structure .lattice .b ),
90- "c" : self ._round (self .structure .lattice .c ),
91- "alpha" : self ._round (self .structure .lattice .alpha ),
92- "beta" : self ._round (self .structure .lattice .beta ),
93- "gamma" : self ._round (self .structure .lattice .gamma ),
90+ "a" : self ._round (self .structure .lattice .a , precision_coordinates ),
91+ "b" : self ._round (self .structure .lattice .b , precision_coordinates ),
92+ "c" : self ._round (self .structure .lattice .c , precision_coordinates ),
93+ "alpha" : self ._round (self .structure .lattice .alpha , precision_angles ),
94+ "beta" : self ._round (self .structure .lattice .beta , precision_angles ),
95+ "gamma" : self ._round (self .structure .lattice .gamma , precision_angles ),
9496 "units" : {"length" : "angstrom" , "angle" : "degree" },
9597 }
9698
0 commit comments