if (st.countTokens() > 2) { if (elementTitle.equals("a")) { ((ICrystal) currentMolecule).setA(new Vector3d(Double.parseDouble(st.nextToken()), Double .parseDouble(st.nextToken()), Double.parseDouble(st.nextToken()))); } else if (elementTitle.equals("b")) {
if (st.countTokens() > 2) { if (elementTitle.equals("a")) { ((ICrystal) currentMolecule).setA(new Vector3d(Double.parseDouble(st.nextToken()), Double .parseDouble(st.nextToken()), Double.parseDouble(st.nextToken()))); } else if (elementTitle.equals("b")) {
private void possiblySetCellParams(double a, double b, double c, double alpha, double beta, double gamma) { if (a != 0.0 && b != 0.0 && c != 0.0 && alpha != 0.0 && beta != 0.0 && gamma != 0.0) { logger.info("Found and set crystal cell parameters"); Vector3d[] axes = CrystalGeometryTools.notionalToCartesian(a, b, c, alpha, beta, gamma); crystal.setA(axes[0]); crystal.setB(axes[1]); crystal.setC(axes[2]); } }
private void possiblySetCellParams(double a, double b, double c, double alpha, double beta, double gamma) { if (a != 0.0 && b != 0.0 && c != 0.0 && alpha != 0.0 && beta != 0.0 && gamma != 0.0) { logger.info("Found and set crystal cell parameters"); Vector3d[] axes = CrystalGeometryTools.notionalToCartesian(a, b, c, alpha, beta, gamma); crystal.setA(axes[0]); crystal.setB(axes[1]); crystal.setC(axes[2]); } }
crystal.setA(axes[0]); crystal.setB(axes[1]); crystal.setC(axes[2]);
crystal.setA(axes[0]); crystal.setB(axes[1]); crystal.setC(axes[2]);
((ICrystal) currentMolecule).setA(axes[0]); ((ICrystal) currentMolecule).setB(axes[1]); ((ICrystal) currentMolecule).setC(axes[2]);
((ICrystal) currentMolecule).setA(axes[0]); ((ICrystal) currentMolecule).setB(axes[1]); ((ICrystal) currentMolecule).setC(axes[2]);
line = readLine(); st = new StringTokenizer(line, " "); crystal.setA(new Vector3d(Double.parseDouble(st.nextToken()), Double.parseDouble(st .nextToken()), Double.parseDouble(st.nextToken()))); line = readLine();
line = readLine(); st = new StringTokenizer(line, " "); crystal.setA(new Vector3d(Double.parseDouble(st.nextToken()), Double.parseDouble(st .nextToken()), Double.parseDouble(st.nextToken()))); line = readLine();
logger.debug((lineNumber++) + ": ", line); axis.z = FortranFormat.atof(line); crystal.setA(axis); axis = new Vector3d(); logger.debug("parsing B: ");
@Test public void testGetA() { ICrystal crystal = (ICrystal) newChemObject(); crystal.setA(new Vector3d(1.0, 2.0, 3.0)); Vector3d a = crystal.getA(); Assert.assertNotNull(a); }
@Test public void testSetZeroAxes() { ICrystal crystal = (ICrystal) newChemObject(); crystal.setA(new Vector3d(1.0, 2.0, 3.0)); Vector3d a = crystal.getA(); Assert.assertNotNull(a); }
@Test public void testSetA_Vector3d() { ICrystal crystal = (ICrystal) newChemObject(); crystal.setA(new Vector3d(1.0, 2.0, 3.0)); Vector3d a = crystal.getA(); Assert.assertEquals(1.0, a.x, 0.001); Assert.assertEquals(2.0, a.y, 0.001); Assert.assertEquals(3.0, a.z, 0.001); }
@Test public void testClone_Axes() throws Exception { ICrystal crystal1 = (ICrystal) newChemObject(); Vector3d axes = new Vector3d(1.0, 2.0, 3.0); crystal1.setA(axes); ICrystal crystal2 = (ICrystal) crystal1.clone(); // test cloning of axes crystal1.getA().x = 5.0; Assert.assertEquals(1.0, crystal2.getA().x, 0.001); }
@Test public void testCMLCrystal() throws Exception { StringWriter writer = new StringWriter(); ICrystal crystal = new Crystal(); IAtom silicon = new Atom("Si"); silicon.setFractionalPoint3d(new Point3d(0.0, 0.0, 0.0)); crystal.addAtom(silicon); crystal.setA(new Vector3d(1.5, 0.0, 0.0)); crystal.setB(new Vector3d(0.0, 2.0, 0.0)); crystal.setC(new Vector3d(0.0, 0.0, 1.5)); CMLWriter cmlWriter = new CMLWriter(writer); cmlWriter.write(crystal); cmlWriter.close(); String cmlContent = writer.toString(); logger.debug("****************************** testCMLCrystal()"); logger.debug(cmlContent); logger.debug("******************************"); Assert.assertTrue(cmlContent.indexOf("</crystal>") != -1); // the cystal info has to be present Assert.assertTrue(cmlContent.indexOf("<atom") != -1); // an Atom has to be present }
crystal.setA(new Vector3d(rprim[0][0] * acell[0], rprim[0][1] * acell[0], rprim[0][2] * acell[0])); crystal.setB(new Vector3d(rprim[1][0] * acell[1], rprim[1][1] * acell[1], rprim[1][2] * acell[1])); crystal.setC(new Vector3d(rprim[2][0] * acell[2], rprim[2][1] * acell[2], rprim[2][2] * acell[2]));
@Test public void testRoundTrip() throws Exception { StringWriter sWriter = new StringWriter(); PDBWriter writer = new PDBWriter(sWriter); ICrystal crystal = builder.newInstance(ICrystal.class); crystal.setA(new Vector3d(0, 1, 0)); crystal.setB(new Vector3d(1, 0, 0)); crystal.setC(new Vector3d(0, 0, 2)); IAtom atom = builder.newInstance(IAtom.class, "C"); atom.setPoint3d(new Point3d(0.1, 0.1, 0.3)); crystal.addAtom(atom); writer.write(crystal); writer.close(); String output = sWriter.toString(); Assert.assertNotNull(output); Assert.assertTrue(output.length() > 0); PDBReader reader = new PDBReader(); ChemFile chemFile = (ChemFile) reader.read(new ChemFile()); reader.close(); Assert.assertNotNull(chemFile); Assert.assertEquals(1, chemFile.getChemSequenceCount()); IChemSequence sequence = chemFile.getChemSequence(0); Assert.assertEquals(1, sequence.getChemModelCount()); IChemModel chemModel = sequence.getChemModel(0); Assert.assertNotNull(chemModel); // can't do further testing as the PDBReader does not read // Crystal structures :( }