aoterodelaroza / critic2

Analysis of quantum chemical interactions in molecules and solids.
Other
97 stars 35 forks source link

Missing comma in json file #36

Closed wutobias closed 3 years ago

wutobias commented 3 years ago

Hi,

sorry for bothering again. I found another, possibly related, issue (relating to #35).

The values in key:value pairs in the json file written through CPREPORT pyridine.json should have a comma after each each value but the last one. Instead there is no comma at all. For example:

      "pointprops": [{
        "id": 1,
        "name": "gtf",
        "expression": "gtf(1)",
        "value": 8.10929084287072E+03
        "id": 2,
        "name": "vtf",
        "expression": "vtf(1)",
        "value": -1.24921420021359E+05
      }],

However, it should be

      "pointprops": [{
        "id": 1,
        "name": "gtf",
        "expression": "gtf(1)",
        "value": 8.10929084287072E+03,
        "id": 2,
        "name": "vtf",
        "expression": "vtf(1)",
        "value": -1.24921420021359E+05
      }],

This makes the file unreadable with python, for instance (pyridine.json generated from the example in #35):

import json
with open("./pyridine.json") as fopen:
    py_data = json.load(fopen)

Regards, Tobias

aoterodelaroza commented 3 years ago

Sorry about that. I used to use a json validator to help me with this but since I don't use the format that often mistakes like this do slip by. I'll take a look.

aoterodelaroza commented 3 years ago

OK, I pushed the change. Please pull and try again. I should get myself a library for this... these errors in the code aren't easy to spot just by looking at it.

wutobias commented 3 years ago

Excellent, it works! The json files are being written correctly now. Thank you so much!

Tobias