Skip to content

Commit

Permalink
changed dict name as it is a keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaomar3 committed Oct 4, 2023
1 parent f4739f6 commit de0728b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python/avogadro/cjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ def __open_file(self, filePath):
py_dict_data = json.load(cjsonFile)
return py_dict_data
def __to_cjson(self, element_coords):
dict = {"element-coordinates" :element_coords}
cjsonData = json.dumps(dict, indent=4)
cjson_dict = {"element-coordinates" :element_coords}
cjsonData = json.dumps(cjson_dict, indent=4)
print(cjsonData)
def get_atoms_coords(self,filePath):
data = self.__open_file(filePath)
coords = data["atoms"]["coords"]["3d"]
elements = data["atoms"]["elements"]["number"]
# element_coords = {}
element_coords = [(*coords[i*3:(i+1)*3], elements[i]) for i in range(0, int(len(coords) / 3))]
print(type(element_coords))
self.__to_cjson(element_coords)

self.__to_cjson(element_coords)

0 comments on commit de0728b

Please sign in to comment.