private void openCustomResidueRenderSettings(int residueID)
        {
            List <Residue> residues = primaryStructure.GetResiduesByID(residueID);

            if (residues.Count == 0)
            {
                return;
            }

            List <int> residueIDs = new List <int>()
            {
                residueID
            };
            List <string> atomNames = new List <string>();

            foreach (Atom atom in residues[0].Atoms.Values)
            {
                atomNames.Add(atom.Name);
            }

            ResidueRenderSettings residueSettings = new ResidueRenderSettings();

            if (moleculeRenderSettings.CustomResidueRenderSettings.ContainsKey(residueID))
            {
                residueSettings = moleculeRenderSettings.CustomResidueRenderSettings[residueID].Clone();
            }

            customSettingsPanel.Initialise(residueIDs, residueName, atomNames, ResidueUpdateType.ID, residueSettings, saveCustomResidueIDSettings, onCloseCustomResidueSettings);

            //residueIDsPanel.gameObject.SetActive(false);
        }
        private void openUpdateAllResiduesPanel(List <int> residueIDs)
        {
            if (residueIDs == null || residueIDs.Count == 0)
            {
                return;
            }

            List <Residue> residues = primaryStructure.GetResiduesByID(residueIDs);

            if (residues == null || residues.Count == 0)
            {
                return;
            }

            Residue selectedResidue = residues[0];

            bool             atomNamesAllTheSame      = true;
            HashSet <string> selectedResidueAtomNames = new HashSet <string>();

            foreach (Atom atom in selectedResidue.Atoms.Values)
            {
                selectedResidueAtomNames.Add(atom.Name);
            }

            foreach (Residue residue in residues)
            {
                HashSet <string> residueAtomNames = new HashSet <string>();
                foreach (Atom atom in residue.Atoms.Values)
                {
                    residueAtomNames.Add(atom.Name);
                }

                if (!residueAtomNames.SetEquals(selectedResidueAtomNames))
                {
                    atomNamesAllTheSame = false;
                }
            }

            List <string> atomNames = null;

            if (atomNamesAllTheSame)
            {
                atomNames = new List <string>();

                foreach (Atom atom in selectedResidue.Atoms.Values)
                {
                    atomNames.Add(atom.Name);
                }
            }

            bool residueSettingsAllTheSame = true;

            foreach (Residue residue in residues)
            {
                if (!moleculeRenderSettings.CustomResidueRenderSettings.ContainsKey(residue.ID) ||
                    !moleculeRenderSettings.CustomResidueRenderSettings[residue.ID].Equals(moleculeRenderSettings.CustomResidueRenderSettings[selectedResidue.ID]))
                {
                    residueSettingsAllTheSame = false;
                    break;
                }
            }
            ResidueRenderSettings panelResidueSettings = new ResidueRenderSettings();

            if (residueSettingsAllTheSame)
            {
                if (moleculeRenderSettings.CustomResidueRenderSettings.ContainsKey(selectedResidue.ID))
                {
                    panelResidueSettings = moleculeRenderSettings.CustomResidueRenderSettings[selectedResidue.ID].Clone();
                }
            }

            customSettingsPanel.Initialise(residueIDs, null, atomNames, ResidueUpdateType.All, panelResidueSettings, saveCustomResidueSettings, onCloseCustomResidueSettings);
        }