/// <summary> /// construct a new reader from a Reader type object /// <param name="input">reader from which input is read</param> /// </summary> public PMPReader(TextReader input) { this.input = input; this.lineNumber = 0; /* compile patterns */ objHeader = new Regex(".*\\((\\d+)\\s(\\w+)$", RegexOptions.Compiled); objCommand = new Regex(".*\\(A\\s([CFDIO])\\s(\\w+)\\s+\"?(.*?)\"?\\)$", RegexOptions.Compiled); atomTypePattern = new Regex("^(\\d+)\\s+(\\w+)$", RegexOptions.Compiled); rebonder = new RebondTool(2.0, 0.5, 0.5); }
private bool createBondsWithRebondTool(IBioPolymer pol) { RebondTool tool = new RebondTool(2.0, 0.5, 0.5); try { // configure atoms AtomTypeFactory factory = AtomTypeFactory.getInstance("jmol_atomtypes.txt", pol.Builder); IAtom[] atoms = pol.Atoms; for (int i = 0; i < atoms.Length; i++) { try { IAtomType[] types = factory.getAtomTypes(atoms[i].Symbol); if (types.Length > 0) { // just pick the first one AtomTypeManipulator.configure(atoms[i], types[0]); } else { System.Console.Out.WriteLine("Could not configure atom with symbol: " + atoms[i].Symbol); } } catch (System.Exception e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Console.Out.WriteLine("Could not configure atom (but don't care): " + e.Message); //logger.debug(e); } } tool.rebond(pol); } catch (System.Exception e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //logger.error("Could not rebond the polymer: " + e.Message); //logger.debug(e); } return(true); }
private static bool CreateBondsWithRebondTool(IAtomContainer molecule) { var tool = new RebondTool(2.0, 0.5, 0.5); try { foreach (var atom in molecule.Atoms) { try { var types = factory.GetAtomTypes(atom.Symbol); var type = types.FirstOrDefault(); if (type != null) { // just pick the first one AtomTypeManipulator.Configure(atom, type); } else { Trace.TraceWarning("Could not configure atom with symbol: " + atom.Symbol); } } catch (Exception e) { Trace.TraceWarning("Could not configure atom (but don't care): " + e.Message); Debug.WriteLine(e); } } tool.Rebond(molecule); } catch (Exception e) { Trace.TraceError($"Could not rebond the polymer: {e.Message}"); Debug.WriteLine(e); } return(true); }