def test_local(): # Fetch some stuff from cirdb db = CirDB() bz = db.get("molecule", "norbornene") pre_string = bz.tojson() db = LocalDB("/tmp/testdb/") db.store("molecule", 'norbornene', bz, nowarn=True) post_string = db.get('molecule', 'norbornene').tojson() assert pre_string == post_string # Do the same thing for a system of 3 norbornenes s = System([bz.copy() for i in range(3)]) pre_string = s.tojson() db.store("system", 'norbornene-3', s, nowarn=True) post_string = db.get('system', 'norbornene-3').tojson() assert pre_string == post_string
def test_local(): # Fetch some stuff from cirdb db = CirDB() bz = db.get("molecule", "norbornene") pre_string = bz.tojson() db = LocalDB("/tmp/testdb/") db.store("molecule", 'norbornene', bz, nowarn=True) post_string = db.get('molecule', 'norbornene').tojson() assert pre_string == post_string # Do the same thing for a system of 3 norbornenes s = System([bz.copy() for i in range(3)]) pre_string = s.tojson() db.store("system", 'norbornene-3', s, nowarn=True) post_string = db.get('system', 'norbornene-3').tojson() assert pre_string == post_string
def test_wireframe_renderer(): from collections import defaultdict from chemlab.db.cirdb import CirDB v = QtViewer() #v.widget.background_color = black mol = Molecule([ Atom("O", [-0.499, 0.249, 0.0]), Atom("H", [-0.402, 0.249, 0.0]), Atom("H", [-0.532, 0.198, 0.10]) ]) mol.bonds = np.array([[0, 1], [0, 2]]) mol = CirDB().get("molecule", "moronic acid") ar = v.add_renderer(WireframeRenderer, mol.r_array, mol.type_array, mol.bonds) # Try without bonds #ar2 = v.add_renderer(WireframeRenderer, mol.r_array + 0.5, mol.type_array, np.array([])) v.run()
def test_cir(): db = CirDB() bz = db.get("molecule", "norbornene")
def test_cir(): db = CirDB() bz = db.get("molecule", "norbornene") display_molecule(bz)