public void TestNewCrystal_IAtomContainer() { IChemObjectBuilder builder = RootObject.Builder; ICrystal crystal = builder.NewCrystal(builder.NewAtomContainer()); Assert.IsNotNull(crystal); }
public void TestNewCrystal() { IChemObjectBuilder builder = RootObject.Builder; ICrystal crystal = builder.NewCrystal(); Assert.IsNotNull(crystal); }
public void TestIsEmpty_Crystal() { var model = (IChemModel)NewChemObject(); IChemObjectBuilder builder = model.Builder; ICrystal crystal = builder.NewCrystal(); model.Crystal = crystal; Assert.IsTrue(model.IsEmpty()); crystal.Atoms.Add(builder.NewAtom("C")); Assert.IsFalse(model.IsEmpty()); model.Crystal = null; Assert.IsTrue(model.IsEmpty()); }
public void TestRoundTrip() { StringWriter sWriter = new StringWriter(); PDBWriter writer = new PDBWriter(sWriter); ICrystal crystal = builder.NewCrystal(); crystal.A = new Vector3(0, 1, 0); crystal.B = new Vector3(1, 0, 0); crystal.C = new Vector3(0, 0, 2); IAtom atom = builder.NewAtom("C"); atom.Point3D = new Vector3(0.1, 0.1, 0.3); crystal.Atoms.Add(atom); writer.Write(crystal); writer.Close(); string output = sWriter.ToString(); Assert.IsNotNull(output); Assert.IsTrue(output.Length > 0); PDBReader reader = new PDBReader(new StringReader("")); var chemFile = reader.Read(builder.NewChemFile()); reader.Close(); Assert.IsNotNull(chemFile); Assert.AreEqual(1, chemFile.Count); IChemSequence sequence = chemFile[0]; Assert.AreEqual(1, sequence.Count); IChemModel chemModel = sequence[0]; Assert.IsNotNull(chemModel); // can't do further testing as the PDBReader does not read // Crystal structures :( }
public void TestCMLCrystal() { var writer = new StringWriter(); var crystal = builder.NewCrystal(); var silicon = builder.NewAtom("Si"); silicon.FractionalPoint3D = new Vector3(0, 0, 0); crystal.Atoms.Add(silicon); crystal.A = (new Vector3(1.5, 0.0, 0.0)); crystal.B = (new Vector3(0.0, 2.0, 0.0)); crystal.C = (new Vector3(0.0, 0.0, 1.5)); using (var cmlWriter = new CMLWriter(writer)) { cmlWriter.Write(crystal); } var cmlContent = writer.ToString(); Debug.WriteLine("****************************** TestCMLCrystal()"); Debug.WriteLine(cmlContent); Debug.WriteLine("******************************"); Assert.IsTrue(cmlContent.IndexOf("</crystal>") != -1); // the cystal info has to be present Assert.IsTrue(cmlContent.IndexOf("<atom") != -1); // an Atom has to be present }