From: <ha...@us...> - 2006-09-13 18:49:07
|
Revision: 5518 http://svn.sourceforge.net/jmol/?rev=5518&view=rev Author: hansonr Date: 2006-09-13 11:48:59 -0700 (Wed, 13 Sep 2006) Log Message: ----------- bug fix checking for duplicate atoms in applySymmetry() Modified Paths: -------------- branches/v10_9/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java Modified: branches/v10_9/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java =================================================================== --- branches/v10_9/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-09-13 18:17:06 UTC (rev 5517) +++ branches/v10_9/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-09-13 18:48:59 UTC (rev 5518) @@ -385,11 +385,13 @@ SymmetryOperation[] finalOperations = spaceGroup.getFinalOperations(atoms, atomIndex, count); for (int i = 0; i < count; i++) atoms[i + atomIndex].bsSymmetry = new BitSet(); + int operationCount = finalOperations.length; + cartesians = new Point3f[count * operationCount * maxX * maxY * maxZ]; + int pt = 0; for (int tx = 0; tx < maxX; tx++) for (int ty = 0; ty < maxY; ty++) for (int tz = 0; tz < maxZ; tz++) - symmetryAddAtoms(finalOperations, atomIndex, count, tx, ty, tz); - int operationCount = finalOperations.length; + pt = symmetryAddAtoms(finalOperations, atomIndex, count, tx, ty, tz, pt); if (operationCount > 0) { String[] symmetryList = new String[operationCount]; for (int i = 0; i < operationCount; i++) @@ -407,20 +409,20 @@ } Point3f[] cartesians; - void symmetryAddAtoms(SymmetryOperation[] finalOperations, int atomIndex, - int count, int transX, int transY, int transZ) { + int symmetryAddAtoms(SymmetryOperation[] finalOperations, int atomIndex, + int count, int transX, int transY, int transZ, int pt) { boolean isBaseCell = (transX == 0 && transY == 0 && transZ == 0); int nOperations = finalOperations.length; - cartesians = new Point3f[count * nOperations]; - int pt = 0; if (isBaseCell) + pt = 0; for (; pt < count; pt++) { Atom atom = atoms[atomIndex + pt]; cartesians[pt] = new Point3f(atom); finalOperations[0].transform(cartesians[pt]); atom.bsSymmetry.set(0); } - for (int iSym = 0; iSym < nOperations; iSym++) + for (int iSym = 0; iSym < nOperations; iSym++) { + int pt0 = pt; if (!isBaseCell || !finalOperations[iSym].getXyz().equals("x,y,z")) { int i1 = atomIndex; int i2 = i1 + count; @@ -430,40 +432,44 @@ .newPoint(atoms[i], atom, transX, transY, transZ); Point3f cartesian = new Point3f(atom); unitCell.toCartesian(cartesian); + /* - System.out.println((Point3f) atoms[i] + " " + (Point3f) atom + " " - + transX + " " + transY + " " + transZ + " " + cartesian - + finalOperations[iSym].getXyz()); - */ + System.out.println((Point3f) atoms[i] + " " + (Point3f) atom + " " + + transX + " " + transY + " " + transZ + " " + cartesian + + finalOperations[iSym].getXyz()); + */ + Atom special = null; - for (int j = pt; --j >= 0;) + for (int j = pt0; --j >= 0;) { +// System.out.println(j + ": " + cartesians[j] + " ?cart? " + cartesian + " d=" + cartesian.distance(cartesians[j])); + if (cartesian.distance(cartesians[j]) < 0.01) { special = atoms[atomIndex + j]; break; } - if (special != null) { + } + if (special == null) { + Atom atom1 = newCloneAtom(atoms[i]); + atom1.x = atom.x; + atom1.y = atom.y; + atom1.z = atom.z; + // System.out.println(cartesian + " " + (Point3f)atom + "X" + finalOperations[iSym].getXyz() + " " + transX+" "+transY+" "+transZ); + atom1.atomSite = atoms[i].atomSite; + atom1.bsSymmetry = new BitSet(); + atom1.bsSymmetry.set(iSym); + cartesians[pt++] = cartesian; + } else { special.bsSymmetry.set(iSym); /* System.out.println(iSym + " " + finalOperations[iSym].getXyz() + " special set: " + i + " " + " " + special.bsSymmetry); */ - continue; + // System.out.println(cartesian+"Y" + "X" + finalOperations[iSym].getXyz() + " " + transX+" "+transY+" "+transZ); } - Atom atom1 = newCloneAtom(atoms[i]); - atom1.x = atom.x; - atom1.y = atom.y; - atom1.z = atom.z; - atom1.atomSite = atoms[i].atomSite; - atom1.bsSymmetry = new BitSet(); - atom1.bsSymmetry.set(iSym); - cartesians[pt++] = cartesian; - /* - System.out.println(iSym + " " + finalOperations[iSym].getXyz() - + " setting: " + i + " " + " " + atom.atomName + " " - + atom1.atomName + " " + atom1.bsSymmetry); - */ } } + } + return pt; } void setCollectionName(String collectionName) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |