def _mb_to_proto(cmpd, proto):
    """Given mb.Compound, parse propertes into compound_pb2.Compound."""
    proto.name = cmpd.name
    proto.pos.x, proto.pos.y, proto.pos.z = cmpd.pos
    proto.charge = cmpd.charge
    proto.id = id(cmpd)
    proto.periodicity.x, proto.periodicity.y, proto.periodicity.z = (
        cmpd.periodicity
    )
    if cmpd.element:
        proto.element.name = cmpd.element.name
        proto.element.symbol = cmpd.element.symbol
        proto.element.atomic_number = cmpd.element.atomic_number
        proto.element.mass = cmpd.element.mass

    return proto