#  Test consistency of chemical JSON I/O for a covalent molecule

from chemsh       import *
from chemsh.utils import testutils
from numpy        import array

ref = Fragment(coords='ethane.cjson')
ref.save('ethane_save.cjson')
saved = Fragment(coords='ethane_save.cjson')
  
# Test atoms
testutils.validate(saved.natoms, ref.natoms)
testutils.validate(saved.znums, ref.znums)
testutils.validate(saved.coords, ref.coords, tol=1.0e-10)
testutils.validate(saved.charges, ref.charges, tol=1.0e-10)

# Test connectivity
testutils.validate(saved.conn, ref.conn)

