123456789101112131415161718192021222324(* very small bond module to help compute atom environments (a la molprint2d) from MOL2 files *)openPrintftypet={idx:int;src:int;dst:int}(* indexes start at 1 in the MOL2 file format *)letcreate(idx:int)(src:int)(dst:int):t={idx=idx-1;src=src-1;dst=dst-1}letdummy=create(-1)(-1)(-1)(* example line (output of OpenBabel):
" 1 1 11 ar" *)letof_mol2_linel=tryScanf.sscanfl" %d %d %d %s"(funidxsrcdst_bullshit->createidxsrcdst)with_->failwith("Bond.of_mol2_line: could not parse: "^l)letto_string(a:t):string=sprintf"%d %d %d"a.idxa.srca.dst