Esempio n. 1
0
        public void TestWrite()
        {
            StringWriter strWriter = new StringWriter();
            Mopac7Writer writer    = new Mopac7Writer(strWriter);

            var mol = new AtomContainer();

            mol.Atoms.Add(new Atom("Cr"));
            writer.Write(mol);
            writer.Close();

            Assert.IsTrue(strWriter.ToString().Contains("PM3"));
            Assert.IsTrue(strWriter.ToString().Contains("Cr "));
            Assert.IsTrue(strWriter.ToString().Contains("Generated by"));
        }
Esempio n. 2
0
        public void TestChargedCompounds()
        {
            var   mol      = new AtomContainer();
            IAtom aluminum = new Atom("Al");

            aluminum.FormalCharge = +3;
            mol.Atoms.Add(aluminum);

            StringWriter strWriter = new StringWriter();
            Mopac7Writer writer    = new Mopac7Writer(strWriter);

            writer.Write(mol);
            writer.Close();
            Assert.IsTrue(strWriter.ToString().Contains("CHARGE=3"));
        }
Esempio n. 3
0
        public void TestWriteWithOptimizationFalse()
        {
            var mol = new AtomContainer();

            mol.Atoms.Add(new Atom("Cr"));

            StringWriter strWriter      = new StringWriter();
            Mopac7Writer writer         = new Mopac7Writer(strWriter);
            var          customizations = new NameValueCollection();

            customizations["optimize"] = "false";
            writer.Listeners.Add(new PropertiesListener(customizations));
            writer.Write(mol);
            writer.Close();
            Assert.IsFalse(strWriter.ToString().Contains("PRECISE"));
        }
Esempio n. 4
0
        public void TestWriteWithCustomCommands()
        {
            var mol = new AtomContainer();

            mol.Atoms.Add(new Atom("Cr"));

            StringWriter strWriter      = new StringWriter();
            Mopac7Writer writer         = new Mopac7Writer(strWriter);
            var          customizations = new NameValueCollection();

            customizations["Commands"] = "THIS IS NOT GOING TO WORK";
            writer.Listeners.Add(new PropertiesListener(customizations));
            writer.Write(mol);
            writer.Close();
            Assert.IsTrue(strWriter.ToString().Contains("THIS IS NOT GOING TO WORK"));
        }
Esempio n. 5
0
        public void TestAccepts()
        {
            Mopac7Writer reader = new Mopac7Writer(new StringWriter());

            Assert.IsTrue(reader.Accepts(typeof(AtomContainer)));
        }