/** * gets atomIds as list. * * @return the atomIds (null if no atomRefs3) */ public List<String> getAtomIds() { List<String> idList = null; String[] atomRefs3 = getAtomRefs3(); if (atomRefs3 != null) { idList = new ArrayList<String>(); for (String s : atomRefs3) { idList.add(s); } } return idList; }
/** create key from atomRefs3 attribute and atomHash * * @return the hash null if no atomRefs3 */ public String atomHash() { String[] a = this.getAtomRefs3(); return (a == null) ? null : atomHash(a[0], a[1], a[2]); }
/** * gets a Map of angles indexed by atoms. the map has the keys of atomHashs * for the angles * * @param angleList * list of the angles * @return the indexed table (keyed on atomHash) */ public static Map<String, CMLAngle> getIndexedAngles(List<CMLAngle> angleList) { Map<String, CMLAngle> angleTable = new HashMap<String, CMLAngle>(); for (CMLAngle angle : angleList) { String[] id = angle.getAtomRefs3(); String key = atomHash(id[0], id[1], id[2]); angleTable.put(key, angle); } return angleTable; }
/** * gets atoms as array of atoms. * * @param molecule * @return the atoms (null if no atomRefs3) */ public List<CMLAtom> getAtoms(CMLMolecule molecule) { List<CMLAtom> atomList = new ArrayList<CMLAtom>(); for (String atomRef : getAtomRefs3()) { CMLAtom atom = molecule.getAtomById(atomRef); if (atom == null) { throw new RuntimeException("cannot find atom: "+atomRef); } if (atomList.contains(atom)) { throw new RuntimeException("duplicate atom in angle: "+atomRef); } atomList.add(atom); } return atomList; }
CMLAngle getNewAngle(CMLAngle ang) { String[] a = ang.getAtomRefs3(); CMLAngle angle = new CMLAngle(ang); if (finalAtomSet.contains(a[2])) { String[] aa = new String[3]; aa[0] = a[2]; aa[1] = a[1]; aa[2] = a[0]; angle.setAtomRefs3(aa); } return angle; }
/** get string. * * @return the string */ public String getString() { String s = S_EMPTY; String[] a = getAtomRefs3(); if (a != null) { s += Util.concatenate(a, S_MINUS); } s += S_SPACE; s += this.getXMLContent(); return s; } }
int i2 = -1; if (CMLBond.atomHash(length0.getAtomRefs2()).equals(CMLBond.atomHash( angle.getAtomRefs3()[0], angle.getAtomRefs3()[1]))) { i0 = 0; i2 = 2; } else if (CMLBond.atomHash(length0.getAtomRefs2()).equals(CMLBond.atomHash( angle.getAtomRefs3()[2], angle.getAtomRefs3()[1]))) { i0 = 2; i2 = 0; throw new RuntimeException("Cannot match lengths to angle"); String id = angle.getAtomRefs3()[i0]; CMLAtom atom0 = molecule.getAtomById(id); if (atom0 == null) { throw new RuntimeException("Cannot find atom: "+id); id = angle.getAtomRefs3()[1]; CMLAtom atom1 = molecule.getAtomById(id); if (atom1 == null) { throw new RuntimeException("Cannot find atom: "+id); id = angle.getAtomRefs3()[i2]; CMLAtom atom2 = molecule.getAtomById(id); atom0.setXYZ3(new Point3(0, 0, 0));