Controlling macromolecular structures towards effective antimicrobial polymers