I just answered a similar question (with recommended links). See Topology creation for non-standard amino acid residues.