Encoding and decoding hydrogen-bond patterns of organic compounds