public void applySymmetryAndSetTrajectory() throws Exception { if (iHaveUnitCell && doCheckUnitCell) { atomSetCollection.setCoordinatesAreFractional(iHaveFractionalCoordinates); atomSetCollection.setNotionalUnitCell( notionalUnitCell, matUnitCellOrientation, unitCellOffset); atomSetCollection.setAtomSetSpaceGroupName(spaceGroup); atomSetCollection.setSymmetryRange(symmetryRange); if (doConvertToFractional || fileCoordinatesAreFractional) { atomSetCollection.setLatticeCells( latticeCells, applySymmetryToBonds, doPackUnitCell, supercell); if (ignoreFileSpaceGroupName || !iHaveSymmetryOperators) { if (!merging || symmetry == null) getSymmetry(); if (symmetry.createSpaceGroup( desiredSpaceGroupIndex, (spaceGroup.indexOf("!") >= 0 ? "P1" : spaceGroup), notionalUnitCell)) { atomSetCollection.setAtomSetSpaceGroupName(symmetry.getSpaceGroupName()); atomSetCollection.applySymmetry(symmetry); } } else { atomSetCollection.applySymmetry(); } } if (iHaveFractionalCoordinates && merging && symmetry != null) { // when merging (with appendNew false), we must return cartesians atomSetCollection.toCartesian(symmetry); atomSetCollection.setCoordinatesAreFractional(false); // We no longer allow merging of multiple-model files // when the file to be appended has fractional coordinates and vibrations addVibrations = false; } } if (isTrajectory) atomSetCollection.setTrajectory(); initializeSymmetry(); }
public void setSymmetryOperator(String xyz) { if (ignoreFileSymmetryOperators) return; atomSetCollection.setLatticeCells( latticeCells, applySymmetryToBonds, doPackUnitCell, supercell); if (!atomSetCollection.addSpaceGroupOperation(xyz)) Logger.warn("Skipping symmetry operation " + xyz); iHaveSymmetryOperators = true; }
public void checkLineForScript() { if (line.indexOf("Jmol") >= 0) { if (line.indexOf("Jmol PDB-encoded data") >= 0) { atomSetCollection.setAtomSetCollectionAuxiliaryInfo("jmolData", line); if (!line.endsWith("#noautobond")) line += "#noautobond"; } if (line.indexOf("Jmol data min") >= 0) { Logger.info(line); // The idea here is to use a line such as the following: // // REMARK 6 Jmol data min = {-1 -1 -1} max = {1 1 1} // unScaledXyz = xyz / {10 10 10} + {0 0 0} // plotScale = {100 100 100} // // to pass on to Jmol how to graph non-molecular data. // The format allows for the actual data to be linearly transformed // so that it fits into the PDB format for x, y, and z coordinates. // This adapter will then unscale the data and also pass on to // Jmol the unit cell equivalent that takes the actual data (which // will be considered the fractional coordinates) to Jmol coordinates, // which will be a cube centered at {0 0 0} and ranging from {-100 -100 -100} // to {100 100 100}. // // Jmol 12.0.RC23 uses this to pass through the adapter a quaternion, // ramachandran, or other sort of plot. float[] data = new float[15]; parseStringInfestedFloatArray( line.substring(10).replace('=', ' ').replace('{', ' ').replace('}', ' '), data); Point3f minXYZ = new Point3f(data[0], data[1], data[2]); Point3f maxXYZ = new Point3f(data[3], data[4], data[5]); fileScaling = new Point3f(data[6], data[7], data[8]); fileOffset = new Point3f(data[9], data[10], data[11]); Point3f plotScale = new Point3f(data[12], data[13], data[14]); if (plotScale.x <= 0) plotScale.x = 100; if (plotScale.y <= 0) plotScale.y = 100; if (plotScale.z <= 0) plotScale.z = 100; if (fileScaling.y == 0) fileScaling.y = 1; if (fileScaling.z == 0) fileScaling.z = 1; setFractionalCoordinates(true); latticeCells = new int[3]; atomSetCollection.setLatticeCells(latticeCells, true, false, supercell); setUnitCell( plotScale.x * 2 / (maxXYZ.x - minXYZ.x), plotScale.y * 2 / (maxXYZ.y - minXYZ.y), plotScale.z * 2 / (maxXYZ.z == minXYZ.z ? 1 : maxXYZ.z - minXYZ.z), 90, 90, 90); /* unitCellOffset = new Point3f(minXYZ); symmetry.toCartesian(unitCellOffset); System.out.println(unitCellOffset); unitCellOffset = new Point3f(maxXYZ); symmetry.toCartesian(unitCellOffset); System.out.println(unitCellOffset); */ unitCellOffset = new Point3f(plotScale); unitCellOffset.scale(-1); symmetry.toFractional(unitCellOffset, false); unitCellOffset.scaleAdd(-1f, minXYZ, unitCellOffset); symmetry.setUnitCellOffset(unitCellOffset); /* Point3f pt = new Point3f(minXYZ); symmetry.toCartesian(pt); System.out.println("ASCR minXYZ " + pt); pt.set(maxXYZ); symmetry.toCartesian(pt); System.out.println("ASCR maxXYZ " + pt); */ atomSetCollection.setAtomSetCollectionAuxiliaryInfo( "jmolDataScaling", new Point3f[] {minXYZ, maxXYZ, plotScale}); } } if (line.endsWith("#noautobond")) { line = line.substring(0, line.lastIndexOf('#')).trim(); atomSetCollection.setNoAutoBond(); } int pt = line.indexOf("jmolscript:"); if (pt >= 0) { String script = line.substring(pt + 11, line.length()); if (script.indexOf("#") >= 0) { script = script.substring(0, script.indexOf("#")); } addJmolScript(script); line = line.substring(0, pt).trim(); } }