예제 #1
0
        /// <summary>
        /// Method which assigns van der Waals radii to the biopolymer
        /// default org/openscience/cdk/config/data/pdb_atomtypes.xml
        /// stored in the variable string vanDerWaalsFile.
        /// </summary>
        public void AssignVdWRadiiToProtein()
        {
            AtomTypeFactory atf   = null;
            var             atoms = Protein.Atoms.ToArray();

            try
            {
                atf = AtomTypeFactory.GetInstance(VanDerWaalsFile);
            }
            catch (Exception ex1)
            {
                Console.Out.WriteLine($"Problem with AtomTypeFactory due to:{ex1.ToString()}");
            }
            for (int i = 0; i < atoms.Length; i++)
            {
                try
                {
                    atf.Configure(atoms[i]);
                }
                catch (Exception ex2)
                {
                    Trace.TraceError($"Problem with atf.configure due to:{ex2.ToString()}");
                }
            }
        }
예제 #2
0
        public void TestRebond_IAtomContainer()
        {
            var rebonder = new RebondTool(2.0, 0.5, 0.5);
            var methane  = builder.NewAtomContainer();

            methane.Atoms.Add(builder.NewAtom("C", new Vector3(0.0, 0.0, 0.0)));
            methane.Atoms.Add(builder.NewAtom("H", new Vector3(0.6, 0.6, 0.6)));
            methane.Atoms.Add(builder.NewAtom("H", new Vector3(-0.6, -0.6, 0.6)));
            methane.Atoms.Add(builder.NewAtom("H", new Vector3(0.6, -0.6, -0.6)));
            methane.Atoms.Add(builder.NewAtom("H", new Vector3(-0.6, 0.6, -0.6)));

            // configure atoms
            var factory = AtomTypeFactory.GetInstance("NCDK.Config.Data.jmol_atomtypes.txt");

            //IAtom[] atoms = methane.GetAtoms();
            for (int i = 0; i < methane.Atoms.Count; i++)
            {
                factory.Configure(methane.Atoms[i]);
            }
            // rebond
            rebonder.Rebond(methane);

            Assert.AreEqual(5, methane.Atoms.Count);
            Assert.AreEqual(4, methane.Bonds.Count);
        }
예제 #3
0
        private SybylAtomTypeMatcher()
        {
            var stream = ResourceLoader.GetAsStream(SYBYL_ATOM_TYPE_LIST);

            factory    = AtomTypeFactory.GetInstance(stream, "owl");
            cdkMatcher = CDK.AtomTypeMatcher;
            var mapStream = ResourceLoader.GetAsStream(CDK_TO_SYBYL_MAP);

            mapper = AtomTypeMapper.GetInstance(CDK_TO_SYBYL_MAP, mapStream);
        }
예제 #4
0
        public void TestToString()
        {
            var factory = AtomTypeFactory.GetInstance("NCDK.Dict.Data.cdk-atom-types.owl");
            var type    = factory.GetAtomType("C.sp3");

            Assert.IsTrue(type is ImmutableAtomType);
            var output = type.ToString();

            Assert.IsTrue(output.Contains("ImmutableAtomType("));
            Assert.IsTrue(output.Contains("MBO:"));
        }
예제 #5
0
        public static void Script12_1()
        {
            var factory  = AtomTypeFactory.GetInstance("NCDK.Dict.Data.cdk-atom-types.owl");
            var atomType = factory.GetAtomType("C.sp3");

            Console.WriteLine($"element: {atomType.Symbol}");
            Console.WriteLine($"formal charge: {atomType.FormalCharge}");
            Console.WriteLine($"hybridization: {atomType.Hybridization}");
            Console.WriteLine($"neighbors: {atomType.FormalNeighbourCount}");
            Console.WriteLine($"lone pairs: {atomType.GetProperty<int>(NCDK.CDKPropertyName.LonePairCount)}");
            Console.WriteLine($"pi bonds: {atomType.GetProperty<int>(NCDK.CDKPropertyName.PiBondCount)}");
        }
예제 #6
0
        public void TestCloseEnoughToBond_IAtom_IAtom_Double()
        {
            var filename = "NCDK.Data.XYZ.viagra.xyz";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new XYZReader(ins);
            var atf      = AtomTypeFactory.GetInstance("NCDK.Config.Data.jmol_atomtypes.txt");
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            foreach (var atom in mol.Atoms)
            {
                atf.Configure(atom);
            }
            Assert.IsTrue(BondTools.CloseEnoughToBond(mol.Atoms[0], mol.Atoms[1], 1));
            Assert.IsFalse(BondTools.CloseEnoughToBond(mol.Atoms[0], mol.Atoms[8], 1));
        }
예제 #7
0
 public SmilesValencyChecker(string atomTypeList)
 {
     structgenATF = AtomTypeFactory.GetInstance(atomTypeList);
     Trace.TraceInformation($"Using configuration file: {atomTypeList}");
 }