public void TestAddStereo0D()
        {
            NInchiStructure structure = new NInchiStructure();

            Assert.AreEqual(0, structure.Stereos.Count);
            structure.Stereos.Add(TestNInchiStereo0D.GetTestStereo0D());
            Assert.AreEqual(1, structure.Stereos.Count);
        }
        public void TestAddBond()
        {
            NInchiStructure structure = new NInchiStructure();

            Assert.AreEqual(0, structure.Bonds.Count);
            structure.Bonds.Add(TestNInchiBond.GetTestBond());
            Assert.AreEqual(1, structure.Bonds.Count);
        }
        public void TestAddAtom()
        {
            NInchiStructure structure = new NInchiStructure();

            Assert.AreEqual(0, structure.Atoms.Count);
            structure.Atoms.Add(TestNInchiAtom.GetNewTestAtom());
            Assert.AreEqual(1, structure.Atoms.Count);
        }
        public void TestGetStereo0D()
        {
            NInchiStructure structure = new NInchiStructure();
            NInchiStereo0D  stereo    = TestNInchiStereo0D.GetTestStereo0D();

            structure.Stereos.Add(stereo);
            Assert.AreEqual(stereo, structure.Stereos[0]);
        }
        public void TestGetBond()
        {
            NInchiStructure structure = new NInchiStructure();
            NInchiBond      bond      = TestNInchiBond.GetTestBond();

            structure.Bonds.Add(bond);
            Assert.AreEqual(bond, structure.Bonds[0]);
        }
        public void TestGetAtom()
        {
            NInchiStructure structure = new NInchiStructure();
            NInchiAtom      atom      = TestNInchiAtom.GetNewTestAtom();

            structure.Atoms.Add(atom);
            Assert.AreEqual(atom, structure.Atoms[0]);
        }
Beispiel #7
0
        private static void CreateAtoms(NInchiStructure output, int numatoms, IntPtr intPtrAtoms)
        {
            var iatoms = (Inchi_Atom *)intPtrAtoms.ToPointer();

            for (int i = 0; i < numatoms; i++)
            {
                Inchi_Atom iatom = iatoms[i];
                var        natom = new NInchiAtom(iatom.X, iatom.Y, iatom.Z, new string(iatom.elname))
                {
                    Charge            = iatom.charge,
                    Radical           = (INCHI_RADICAL)iatom.radical,
                    ImplicitH         = iatom.num_iso_H[0],
                    ImplicitProtium   = iatom.num_iso_H[1],
                    ImplicitDeuterium = iatom.num_iso_H[2],
                    ImplicitTritium   = iatom.num_iso_H[3],
                    IsotopicMass      = iatom.isotopic_mass
                };
                output.Atoms.Add(natom);
            }
        }
Beispiel #8
0
        private static void CreateStereos(NInchiStructure output, int numstereo, IntPtr intPtrStereos)
        {
            var istereos = (Inchi_Stereo0D *)intPtrStereos.ToPointer();

            for (int i = 0; i < numstereo; i++)
            {
                // jobject atC, an0, an1, an2, an3, stereo;
                Inchi_Stereo0D istereo = istereos[i];

                NInchiAtom atC = null;
                if (istereo.central_atom != NO_ATOM)
                {
                    atC = output.Atoms[istereo.central_atom];
                }
                var an0    = output.Atoms[istereo.neighbor[0]];
                var an1    = output.Atoms[istereo.neighbor[1]];
                var an2    = output.Atoms[istereo.neighbor[2]];
                var an3    = output.Atoms[istereo.neighbor[3]];
                var stereo = new NInchiStereo0D(atC, an0, an1, an2, an3, (INCHI_STEREOTYPE)istereo.type, (INCHI_PARITY)istereo.parity);
                output.Stereos.Add(stereo);
            }
        }
Beispiel #9
0
        private static void CreateBonds(NInchiStructure output, int numatoms, IntPtr intPtrAtoms)
        {
            var iatoms = (Inchi_Atom *)intPtrAtoms.ToPointer();

            for (int i = 0; i < numatoms; i++)
            {
                Inchi_Atom iatom    = iatoms[i];
                int        numbonds = iatom.num_bonds;
                if (numbonds > 0)
                {
                    var atO = output.Atoms[i];
                    for (int j = 0; j < numbonds; j++)
                    {
                        /* Bonds get recorded twice, so only pick one direction... */
                        if (iatom.neighbor[j] < i)
                        {
                            var atT   = output.Atoms[iatom.neighbor[j]];
                            var nbond = new NInchiBond(atO, atT, (INCHI_BOND_TYPE)iatom.bond_type[j], (INCHI_BOND_STEREO)iatom.bond_stereo[j]);
                            output.Bonds.Add(nbond);
                        }
                    }
                }
            }
        }
Beispiel #10
0
 public void SetStructure(NInchiStructure structure)
 {
     this.Atoms   = structure.Atoms;
     this.Bonds   = structure.Bonds;
     this.Stereos = structure.Stereos;
 }
Beispiel #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public NInchiInput(NInchiStructure struct_, string opts)
     : this(opts)
 {
     SetStructure(struct_);
 }
Beispiel #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public NInchiInput(NInchiStructure struct_)
     : this()
 {
     SetStructure(struct_);
 }