public static void removeElectronContainer(IChemModel chemModel, IElectronContainer electrons) { ICrystal crystal = chemModel.Crystal; if (crystal != null) { if (crystal.contains(electrons)) { crystal.removeElectronContainer(electrons); } return; } ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; if (moleculeSet != null) { SetOfMoleculesManipulator.removeElectronContainer(moleculeSet, electrons); } ISetOfReactions reactionSet = chemModel.SetOfReactions; if (reactionSet != null) { SetOfReactionsManipulator.removeElectronContainer(reactionSet, electrons); } }
public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom) { ICrystal crystal = chemModel.Crystal; if (crystal != null) { if (crystal.contains(atom)) { crystal.removeAtomAndConnectedElectronContainers(atom); } return; } ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; if (moleculeSet != null) { SetOfMoleculesManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom); } ISetOfReactions reactionSet = chemModel.SetOfReactions; if (reactionSet != null) { SetOfReactionsManipulator.removeAtomAndConnectedElectronContainers(reactionSet, atom); } }
/// <summary> Takes an object which subclasses IChemObject, e.g.Molecule, and will read /// this (from file, database, internet etc). If the specific implementation /// does not support a specific IChemObject it will throw an Exception. /// /// </summary> /// <param name="object"> The object that subclasses /// IChemObject /// </param> /// <returns> The IChemObject read /// </returns> /// <exception cref="CDKException"> /// </exception> public override IChemObject read(IChemObject object_Renamed) { if (object_Renamed is IReaction) { return((IChemObject)readReaction(object_Renamed.Builder)); } else if (object_Renamed is IChemModel) { IChemModel model = object_Renamed.Builder.newChemModel(); ISetOfReactions reactionSet = object_Renamed.Builder.newSetOfReactions(); reactionSet.addReaction(readReaction(object_Renamed.Builder)); model.SetOfReactions = reactionSet; return(model); } else if (object_Renamed is IChemFile) { IChemFile chemFile = object_Renamed.Builder.newChemFile(); IChemSequence sequence = object_Renamed.Builder.newChemSequence(); sequence.addChemModel((IChemModel)read(object_Renamed.Builder.newChemModel())); chemFile.addChemSequence(sequence); return(chemFile); } else { throw new CDKException("Only supported are Reaction and ChemModel, and not " + object_Renamed.GetType().FullName + "."); } }
public virtual void createIDs(ISetOfReactions reactionSet) { IReaction[] reactions = reactionSet.Reactions; for (int i = 0; i < reactions.Length; i++) { createIDs(reactions[i]); } }
public static void removeElectronContainer(ISetOfReactions set_Renamed, IElectronContainer electrons) { IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; ReactionManipulator.removeElectronContainer(reaction, electrons); } }
public static void removeAtomAndConnectedElectronContainers(ISetOfReactions set_Renamed, IAtom atom) { IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; ReactionManipulator.removeAtomAndConnectedElectronContainers(reaction, atom); } }
public static void setAtomProperties(ISetOfReactions set_Renamed, System.Object propKey, System.Object propVal) { IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; ReactionManipulator.setAtomProperties(reaction, propKey, propVal); } }
public static int getBondCount(ISetOfReactions set_Renamed) { int count = 0; IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { count += ReactionManipulator.getBondCount(reactions[i]); } return count; }
/// <deprecated> This method has a serious performace impact. Try to use /// other methods. /// </deprecated> public static IAtomContainer getAllInOneContainer(ISetOfReactions set_Renamed) { IAtomContainer container = set_Renamed.Builder.newAtomContainer(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; container.add(ReactionManipulator.getAllInOneContainer(reaction)); } return container; }
public static System.Collections.IList getAllChemObjects(ISetOfReactions set_Renamed) { System.Collections.ArrayList list = new System.Collections.ArrayList(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; list.AddRange(ReactionManipulator.getAllChemObjects(reaction)); } return(list); }
public static System.Collections.ArrayList getAllIDs(ISetOfReactions set_Renamed) { System.Collections.ArrayList IDlist = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; IDlist.AddRange(ReactionManipulator.getAllIDs(reaction)); } return(IDlist); }
public static int getBondCount(ISetOfReactions set_Renamed) { int count = 0; IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { count += ReactionManipulator.getBondCount(reactions[i]); } return(count); }
public static IReaction getRelevantReaction(IChemModel chemModel, IAtom atom) { IReaction reaction = null; if (chemModel.SetOfReactions != null) { ISetOfReactions reactionSet = chemModel.SetOfReactions; reaction = SetOfReactionsManipulator.getRelevantReaction(reactionSet, atom); } return(reaction); }
public static ISetOfMolecules getAllMolecules(ISetOfReactions set_Renamed) { ISetOfMolecules moleculeSet = set_Renamed.Builder.newSetOfMolecules(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; moleculeSet.add(ReactionManipulator.getAllMolecules(reaction)); } return(moleculeSet); }
//protected internal LoggingTool logger; /// <summary> Basic contructor</summary> public ChemFileCDO(IChemFile file) { //logger = new LoggingTool(this); currentChemFile = file; currentChemSequence = file.Builder.newChemSequence(); currentChemModel = file.Builder.newChemModel(); currentSetOfMolecules = file.Builder.newSetOfMolecules(); currentSetOfReactions = null; currentReaction = null; currentMolecule = file.Builder.newMolecule(); atomEnumeration = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable()); }
/// <deprecated> This method has a serious performace impact. Try to use /// other methods. /// </deprecated> public static IAtomContainer getAllInOneContainer(ISetOfReactions set_Renamed) { IAtomContainer container = set_Renamed.Builder.newAtomContainer(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; container.add(ReactionManipulator.getAllInOneContainer(reaction)); } return(container); }
public static IAtomContainer getRelevantAtomContainer(ISetOfReactions set_Renamed, IBond bond) { IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond); if (container != null) { // a match! return(container); } } return(null); }
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond) { IAtomContainer result = null; if (chemModel.SetOfMolecules != null) { ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; result = SetOfMoleculesManipulator.getRelevantAtomContainer(moleculeSet, bond); if (result != null) { return(result); } } if (chemModel.SetOfReactions != null) { ISetOfReactions reactionSet = chemModel.SetOfReactions; return(SetOfReactionsManipulator.getRelevantAtomContainer(reactionSet, bond)); } // This should never happen. return(null); }
public virtual void createIDs(IChemModel model) { ICrystal crystal = model.Crystal; if (crystal != null) { createIDs(crystal); } ISetOfMolecules moleculeSet = model.SetOfMolecules; if (moleculeSet != null) { createIDs(moleculeSet); } ISetOfReactions reactionSet = model.SetOfReactions; if (reactionSet != null) { createIDs(reactionSet); } }
public static int getBondCount(IChemModel chemModel) { int count = 0; ICrystal crystal = chemModel.Crystal; if (crystal != null) { count += crystal.getBondCount(); } ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; if (moleculeSet != null) { count += SetOfMoleculesManipulator.getBondCount(moleculeSet); } ISetOfReactions reactionSet = chemModel.SetOfReactions; if (reactionSet != null) { count += SetOfReactionsManipulator.getBondCount(reactionSet); } return(count); }
/// <summary> Puts all the Molecules of this container together in one /// AtomContainer. /// /// </summary> /// <returns> The AtomContainer with all the Molecules of this container /// /// </returns> /// <deprecated> This method has a serious performace impact. Try to use /// other methods. /// </deprecated> public static IAtomContainer getAllInOneContainer(IChemModel chemModel) { IAtomContainer container = chemModel.Builder.newAtomContainer(); ICrystal crystal = chemModel.Crystal; if (crystal != null) { container.add(crystal); } ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; if (moleculeSet != null) { container.add(SetOfMoleculesManipulator.getAllInOneContainer(moleculeSet)); } ISetOfReactions reactionSet = chemModel.SetOfReactions; if (reactionSet != null) { container.add(SetOfReactionsManipulator.getAllInOneContainer(reactionSet)); } return(container); }
public static System.Collections.IList getAllChemObjects(IChemModel chemModel) { System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(chemModel); ICrystal crystal = chemModel.Crystal; if (crystal != null) { list.Add(crystal); } ISetOfMolecules moleculeSet = chemModel.SetOfMolecules; if (moleculeSet != null) { list.AddRange(SetOfMoleculesManipulator.getAllChemObjects(moleculeSet)); } ISetOfReactions reactionSet = chemModel.SetOfReactions; if (reactionSet != null) { list.AddRange(SetOfReactionsManipulator.getAllChemObjects(reactionSet)); } return(list); }
public static System.Collections.ArrayList getAllIDs(ISetOfReactions set_Renamed) { System.Collections.ArrayList IDlist = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; IDlist.AddRange(ReactionManipulator.getAllIDs(reaction)); } return IDlist; }
/// <summary> Returns all the AtomContainer's of a Reaction.</summary> public static IAtomContainer[] getAllAtomContainers(ISetOfReactions set_Renamed) { return(SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(set_Renamed))); }
/// <summary> Returns all the AtomContainer's of a Reaction.</summary> public static IAtomContainer[] getAllAtomContainers(ISetOfReactions set_Renamed) { return SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(set_Renamed)); }
/// <summary> Procedure required by the CDOInterface. This function is only /// supposed to be called by the JCFL library /// </summary> public virtual void startObject(System.String objectType) { //logger.debug("START:" + objectType); if (objectType.Equals("Molecule")) { if (currentChemModel == null) currentChemModel = currentChemFile.Builder.newChemModel(); if (currentSetOfMolecules == null) currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules(); currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Atom")) { currentAtom = currentChemFile.Builder.newAtom("H"); //logger.debug("Atom # " + numberOfAtoms); numberOfAtoms++; } else if (objectType.Equals("Bond")) { bond_id = null; bond_stereo = -99; } else if (objectType.Equals("Animation")) { currentChemSequence = currentChemFile.Builder.newChemSequence(); } else if (objectType.Equals("Frame")) { currentChemModel = currentChemFile.Builder.newChemModel(); } else if (objectType.Equals("SetOfMolecules")) { currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules(); currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Crystal")) { currentMolecule = currentChemFile.Builder.newCrystal(currentMolecule); } else if (objectType.Equals("a-axis") || objectType.Equals("b-axis") || objectType.Equals("c-axis")) { crystal_axis_x = 0.0; crystal_axis_y = 0.0; crystal_axis_z = 0.0; } else if (objectType.Equals("SetOfReactions")) { currentSetOfReactions = currentChemFile.Builder.newSetOfReactions(); } else if (objectType.Equals("Reaction")) { if (currentSetOfReactions == null) startObject("SetOfReactions"); currentReaction = currentChemFile.Builder.newReaction(); } else if (objectType.Equals("Reactant")) { if (currentReaction == null) startObject("Reaction"); currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Product")) { if (currentReaction == null) startObject("Reaction"); currentMolecule = currentChemFile.Builder.newMolecule(); } }
/// <summary> Procedure required by the CDOInterface. This function is only /// supposed to be called by the JCFL library /// </summary> public virtual void startObject(System.String objectType) { //logger.debug("START:" + objectType); if (objectType.Equals("Molecule")) { if (currentChemModel == null) { currentChemModel = currentChemFile.Builder.newChemModel(); } if (currentSetOfMolecules == null) { currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules(); } currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Atom")) { currentAtom = currentChemFile.Builder.newAtom("H"); //logger.debug("Atom # " + numberOfAtoms); numberOfAtoms++; } else if (objectType.Equals("Bond")) { bond_id = null; bond_stereo = -99; } else if (objectType.Equals("Animation")) { currentChemSequence = currentChemFile.Builder.newChemSequence(); } else if (objectType.Equals("Frame")) { currentChemModel = currentChemFile.Builder.newChemModel(); } else if (objectType.Equals("SetOfMolecules")) { currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules(); currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Crystal")) { currentMolecule = currentChemFile.Builder.newCrystal(currentMolecule); } else if (objectType.Equals("a-axis") || objectType.Equals("b-axis") || objectType.Equals("c-axis")) { crystal_axis_x = 0.0; crystal_axis_y = 0.0; crystal_axis_z = 0.0; } else if (objectType.Equals("SetOfReactions")) { currentSetOfReactions = currentChemFile.Builder.newSetOfReactions(); } else if (objectType.Equals("Reaction")) { if (currentSetOfReactions == null) { startObject("SetOfReactions"); } currentReaction = currentChemFile.Builder.newReaction(); } else if (objectType.Equals("Reactant")) { if (currentReaction == null) { startObject("Reaction"); } currentMolecule = currentChemFile.Builder.newMolecule(); } else if (objectType.Equals("Product")) { if (currentReaction == null) { startObject("Reaction"); } currentMolecule = currentChemFile.Builder.newMolecule(); } }
public static IAtomContainer getRelevantAtomContainer(ISetOfReactions set_Renamed, IBond bond) { IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond); if (container != null) { // a match! return container; } } return null; }
public static System.Collections.IList getAllChemObjects(ISetOfReactions set_Renamed) { System.Collections.ArrayList list = new System.Collections.ArrayList(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; list.AddRange(ReactionManipulator.getAllChemObjects(reaction)); } return list; }
public static ISetOfMolecules getAllMolecules(ISetOfReactions set_Renamed) { ISetOfMolecules moleculeSet = set_Renamed.Builder.newSetOfMolecules(); IReaction[] reactions = set_Renamed.Reactions; for (int i = 0; i < reactions.Length; i++) { IReaction reaction = reactions[i]; moleculeSet.add(ReactionManipulator.getAllMolecules(reaction)); } return moleculeSet; }