.parseDouble(st.nextToken()), Double.parseDouble(st.nextToken()))); } else if (elementTitle.equals("c")) { ((ICrystal) currentMolecule).setC(new Vector3d(Double.parseDouble(st.nextToken()), Double .parseDouble(st.nextToken()), Double.parseDouble(st.nextToken())));
.parseDouble(st.nextToken()), Double.parseDouble(st.nextToken()))); } else if (elementTitle.equals("c")) { ((ICrystal) currentMolecule).setC(new Vector3d(Double.parseDouble(st.nextToken()), Double .parseDouble(st.nextToken()), Double.parseDouble(st.nextToken())));
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.setC(axes[2]); } else if (command.equalsIgnoreCase("ZERR")) { } else if (command.equalsIgnoreCase("LATT")) {
crystal.setC(axes[2]); } else if (command.equalsIgnoreCase("ZERR")) { } else if (command.equalsIgnoreCase("LATT")) {
((ICrystal) currentMolecule).setC(axes[2]); } else { logger.error("Could not find crystal unit cell parameters");
((ICrystal) currentMolecule).setC(axes[2]); } else { logger.error("Could not find crystal unit cell parameters");
line = readLine(); st = new StringTokenizer(line, " "); crystal.setC(new Vector3d(Double.parseDouble(st.nextToken()), Double.parseDouble(st .nextToken()), Double.parseDouble(st.nextToken()))); } else if (line.startsWith("%%Space Group")) {
line = readLine(); st = new StringTokenizer(line, " "); crystal.setC(new Vector3d(Double.parseDouble(st.nextToken()), Double.parseDouble(st .nextToken()), Double.parseDouble(st.nextToken()))); } else if (line.startsWith("%%Space Group")) {
logger.debug((lineNumber++) + ": ", line); axis.z = FortranFormat.atof(line); crystal.setC(axis); logger.debug("Crystal: ", crystal); a = crystal.getA();
@Test public void testGetC() { ICrystal crystal = (ICrystal) newChemObject(); crystal.setC(new Vector3d(1.0, 2.0, 3.0)); Vector3d a = crystal.getC(); Assert.assertNotNull(a); }
@Test public void testSetC_Vector3d() { ICrystal crystal = (ICrystal) newChemObject(); crystal.setC(new Vector3d(1.0, 2.0, 3.0)); Vector3d c = crystal.getC(); Assert.assertEquals(1.0, c.x, 0.001); Assert.assertEquals(2.0, c.y, 0.001); Assert.assertEquals(3.0, c.z, 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.setC(new Vector3d(rprim[2][0] * acell[2], rprim[2][1] * acell[2], rprim[2][2] * acell[2])); for (int i = 0; i < atomType.length; i++) { String symbol = "Du";
@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 :( }