code: public static AbstractMolecule getMoleculeForMonomer(final Monomer monomer) throws BuilderMoleculeException, ChemistryException {
      String input = getInput(monomer);
      if (input != null) {
        List<Attachment> listAttachments = monomer.getAttachmentList();
        AttachmentList list = new AttachmentList();
  
        for (Attachment attachment : listAttachments) {
          list.add(new org.helm.chemtoolkit.Attachment(attachment.getAlternateId(), attachment.getLabel(), attachment.getCapGroupName(), attachment.getCapGroupSMILES()));
        }
        try {
          return Chemistry.getInstance().getManipulator().getMolecule(input, list);
        } catch (IOException | CTKException e) {
          throw new BuilderMoleculeException("Molecule can't be built for the given monomer");
        }
      }
      return null;
    }
docs: method to build a molecule for a given monomer
  
  @param monomer input monomer
  @return generated molecule for the given monomer
  @throws BuilderMoleculeException if the monomer can't be built
  @throws ChemistryException if the Chemistry Engine can not be initialized