private void CreateResidues() { List<Residue> auxRes = new List<Residue>(); List<Atom> localAtoms = new List<Atom>(); //this.residues = new List<Residue>(); Residue residue = null; foreach (Atom atom in this.atoms) { //if (residue == null || atom.ResidueSequenceNumber != residue.ResidueSequenceNumber|| if (residue == null || atom.tabParam[2] != residue.ResidueSequenceNumber || atom.tabParam[1] != residue.ChainIdentifier) //atom.ChainIdentifier != residue.ChainIdentifier) { residue = new Residue(this, atom,flag); auxRes.Add(residue); } else { bool test = false; foreach(var item in residue.Atoms ) if (atom.AtomName == item.AtomName) { ErrorBase.AddErrors("Residue " + residue.ResidueName + " has two the same atoms " + atom.AtomName); test = true; } if (!test) residue.Atoms.Add(atom); //residue.AddAtom(atom); } atom.tabParam = null; } this.residues = new List<Residue>(auxRes); auxRes = null; }