def check_oniom7(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append('element') if not (x.oniom.mask == 0): failed.append('mask') if not (x.get_coordinates() == expected_xyz).all(): failed.append('coordinates') if not (x.oniom.layer == 'L'): failed.append('layer') if not (x.oniom.link_bound_to == 123): failed.append('link bound to') if not (x.oniom.link_atom.element == 'H'): failed.append('link element') if not (x.oniom.link_atom.mm.atype == 'HC'): failed.append('link atype') if not (x.oniom.link_atom.mm.charge == 0.4): failed.append('link charge') if not (x.mm.charge == -0.10): failed.append('charge') if not (x.mm.atype == 'C3'): failed.append('atype') if not (x.oniom.link_scale1 == 0.9): failed.append('link scale1') if len(failed): sys.stderr.write('FAIL: oniom_line7 (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: oniom_line7 (%s)' % rw)
def check_oniom7(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append("element") if not (x.oniom.mask == 0): failed.append("mask") if not (x.get_coordinates() == expected_xyz).all(): failed.append("coordinates") if not (x.oniom.layer == "L"): failed.append("layer") if not (x.oniom.link_bound_to == 123): failed.append("link bound to") if not (x.oniom.link_atom.element == "H"): failed.append("link element") if not (x.oniom.link_atom.mm.atype == "HC"): failed.append("link atype") if not (x.oniom.link_atom.mm.charge == 0.4): failed.append("link charge") if not (x.mm.charge == -0.10): failed.append("charge") if not (x.mm.atype == "C3"): failed.append("atype") if not (x.oniom.link_scale1 == 0.9): failed.append("link scale1") if len(failed): sys.stderr.write("FAIL: oniom_line7 (%s: %s)\n" % (rw, ",".join(failed))) else: print("OK: oniom_line7 (%s)" % rw)
def check_mm(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == mm_element): failed.append("element") if not (x.get_coordinates() == mm_xyz).all(): failed.append("coordinates") if not (x.mm.charge == 0.0): failed.append("charge") if not (x.mm.atype == "O2"): failed.append("atype") if len(failed): sys.stderr.write("FAIL: mm_line (%s: %s)\n" % (rw, ",".join(failed))) else: print("OK: mm_line (%s)" % rw)
def check_mm(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == mm_element): failed.append('element') if not (x.get_coordinates() == mm_xyz).all(): failed.append('coordinates') if not (x.mm.charge == 0.0): failed.append('charge') if not (x.mm.atype == 'O2'): failed.append('atype') if len(failed): sys.stderr.write('FAIL: mm_line (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: mm_line (%s)' % rw)
def zmat2atom_xyz_read(line): atom = iolines.zmat2atom(line) T1 = atom.element == xyz_el T2 = atom.atomic_nr == xyz_atomic_nr T3 = atom.get_coordinates() == xyz_xyz if not T1: sys.stderr.write('zmat2atom xyz - failed element\n') if not T2: sys.stderr.write('zmat2atom xyz - failed atomic_nr\n') if not T3.all(): sys.stderr.write('zmat2atom xyz - failed coordinates\n') if T1 and T2 and T3.all(): return (True, atom) else: return (False, None)
def check_oniom1(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append("element") if not (x.oniom.mask == 0): failed.append("mask") if not (x.get_coordinates() == expected_xyz).all(): failed.append("coordinates") print(x.get_coordinates()) if not (x.oniom.layer == "L"): failed.append("layer") if len(failed): sys.stderr.write("FAIL: oniom_line1 (%s: %s)\n" % (rw, ",".join(failed))) else: print("OK: oniom_line1 (%s)" % rw)
def check_oniom1(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append('element') if not (x.oniom.mask == 0): failed.append('mask') if not (x.get_coordinates() == expected_xyz).all(): failed.append('coordinates') print (x.get_coordinates()) if not (x.oniom.layer == 'L'): failed.append('layer') if len(failed): sys.stderr.write('FAIL: oniom_line1 (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: oniom_line1 (%s)' % rw)
def check_oniom2(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append("element") if not (x.oniom.mask == 0): failed.append("mask") if not (x.get_coordinates() == expected_xyz).all(): failed.append("coordinates") if not (x.oniom.layer == "L"): failed.append("layer") if not (x.oniom.link_bound_to == 123): failed.append("link bound to") if not (x.oniom.link_atom.element == "H"): failed.append("link element") if hasattr(x.oniom.link_atom, "mm"): failed.append("link MM") if len(failed): sys.stderr.write("FAIL: oniom_line2 (%s: %s)\n" % (rw, ",".join(failed))) else: print("OK: oniom_line2 (%s)" % rw)
def check_oniom2(line, rw): x = iolines.zmat2atom(line) failed = [] if not (x.element == element): failed.append('element') if not (x.oniom.mask == 0): failed.append('mask') if not (x.get_coordinates() == expected_xyz).all(): failed.append('coordinates') if not (x.oniom.layer == 'L'): failed.append('layer') if not (x.oniom.link_bound_to == 123): failed.append('link bound to') if not (x.oniom.link_atom.element == 'H'): failed.append('link element') if hasattr(x.oniom.link_atom, 'mm'): failed.append('link MM') if len(failed): sys.stderr.write('FAIL: oniom_line2 (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: oniom_line2 (%s)' % rw)
def check_oniom8(line, rw): x = iolines.zmat2atom(oniom_line8) failed = [] if not (x.element == 'C'): failed.append('element') if not (x.oniom.mask == -1): failed.append('mask') if not (x.get_coordinates() == (-2.489649, 1.976316, -0.712795)).all(): failed.append('coordinates') if not (x.oniom.layer == 'L'): failed.append('layer') if not (x.oniom.link_bound_to == 5455): failed.append('link bound to') if not (x.oniom.link_atom.element == 'H'): failed.append('link element') if not (x.oniom.link_atom.mm.atype == 'HX'): failed.append('link atype') if not (x.oniom.link_atom.mm.charge == 0): failed.append('link charge') if not (x.mm.charge == 0.0569770): failed.append('charge') if not (x.mm.atype == 'C2'): failed.append('atype') if not (x.oniom.link_scale1 == 0.): failed.append('link scale1') if not (x.resinfo.name == 'C7'): failed.append('resinfo_name') if not (x.resinfo.resname == 'FPP'): failed.append('resinfo_resname') if not (x.resinfo.resnum == 336): failed.append('resinfo_resnum') if not (x.resinfo.chain == ''): failed.append('resinfo_chain') if len(failed): sys.stderr.write('FAIL: oniom_line8 (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: oniom_line8 (%s)' % rw)
def check_oniom8(line, rw): x = iolines.zmat2atom(oniom_line8) failed = [] if not (x.element == "C"): failed.append("element") if not (x.oniom.mask == -1): failed.append("mask") if not (x.get_coordinates() == (-2.489649, 1.976316, -0.712795)).all(): failed.append("coordinates") if not (x.oniom.layer == "L"): failed.append("layer") if not (x.oniom.link_bound_to == 5455): failed.append("link bound to") if not (x.oniom.link_atom.element == "H"): failed.append("link element") if not (x.oniom.link_atom.mm.atype == "HX"): failed.append("link atype") if not (x.oniom.link_atom.mm.charge == 0): failed.append("link charge") if not (x.mm.charge == 0.0569770): failed.append("charge") if not (x.mm.atype == "C2"): failed.append("atype") if not (x.oniom.link_scale1 == 0.0): failed.append("link scale1") if not (x.resinfo.name == "C7"): failed.append("resinfo_name") if not (x.resinfo.resname == "FPP"): failed.append("resinfo_resname") if not (x.resinfo.resnum == 336): failed.append("resinfo_resnum") if not (x.resinfo.chain == ""): failed.append("resinfo_chain") if len(failed): sys.stderr.write("FAIL: oniom_line8 (%s: %s)\n" % (rw, ",".join(failed))) else: print("OK: oniom_line8 (%s)" % rw)
failed.append('element') if not (x.get_coordinates() == mm_xyz).all(): failed.append('coordinates') if not (x.mm.charge == 0.0): failed.append('charge') if not (x.mm.atype == 'O2'): failed.append('atype') if len(failed): sys.stderr.write('FAIL: mm_line (%s: %s)\n' % (rw, ','.join(failed))) else: print('OK: mm_line (%s)' % rw) #1 check_oniom1(oniom_line1, 'read') atom1 = iolines.zmat2atom(oniom_line1) new_line1 = iolines.atom2zmat(atom1) check_oniom1(new_line1, 'write') # 2 check_oniom2(oniom_line2, 'read') atom2 = iolines.zmat2atom(oniom_line2) new_line2 = iolines.atom2zmat(atom2) check_oniom2(new_line2, 'write') # 3 check_oniom3(oniom_line3, 'read') atom3 = iolines.zmat2atom(oniom_line3) new_line3 = iolines.atom2zmat(atom3) check_oniom3(new_line3, 'write')