📄 atomplacer3d.java
字号:
* @param id2 Description of the Parameter * @param id3 Description of the Parameter * @return The angleKey value * @exception Exception Description of the Exception */ public double getAngleValue(String id1, String id2, String id3) throws Exception { String akey = ""; if (pSet.containsKey(("angle" + id1 + ";" + id2 + ";" + id3))) { akey = "angle" + id1 + ";" + id2 + ";" + id3; } else if (pSet.containsKey(("angle" + id3 + ";" + id2 + ";" + id1))) { akey = "angle" + id3 + ";" + id2 + ";" + id1; } else if (pSet.containsKey(("angle" + id2 + ";" + id1 + ";" + id3))) { akey = "angle" + id2 + ";" + id1 + ";" + id3; } else if (pSet.containsKey(("angle" + id1 + ";" + id3 + ";" + id2))) { akey = "angle" + id1 + ";" + id3 + ";" + id2; } else if (pSet.containsKey(("angle" + id3 + ";" + id1 + ";" + id2))) { akey = "angle" + id3 + ";" + id1 + ";" + id2; } else if (pSet.containsKey(("angle" + id2 + ";" + id3 + ";" + id1))) { akey = "angle" + id2 + ";" + id3 + ";" + id1; } else { //logger.debug("KEYErrorAngle:Unknown angle key in pSet: " +id2 + " ; " + id3 + " ; " + id1+" take default angle:"+DEFAULT_ANGLE); return -1; } return ((Double) (((Vector) pSet.get(akey)).get(0))).doubleValue(); } /** * Gets the nextUnplacedHeavyAtomWithAliphaticPlacedNeighbour from an atom container or molecule * * @return The nextUnplacedHeavyAtomWithAliphaticPlacedNeighbour value * author: steinbeck,cho */ public IAtom getNextUnplacedHeavyAtomWithAliphaticPlacedNeighbour(IAtomContainer molecule) { Iterator bonds = molecule.bonds(); while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); if (bond.getAtom(0).getFlag(CDKConstants.ISPLACED) & !(bond.getAtom(1).getFlag(CDKConstants.ISPLACED))) { if (bond.getAtom(1).getFlag(CDKConstants.ISALIPHATIC) & !bond.getAtom(1).getSymbol().equals("H")) { return bond.getAtom(1); } } if (bond.getAtom(1).getFlag(CDKConstants.ISPLACED) & !(bond.getAtom(0).getFlag(CDKConstants.ISPLACED))) { if (bond.getAtom(0).getFlag(CDKConstants.ISALIPHATIC) & !bond.getAtom(0).getSymbol().equals("H")) { return bond.getAtom(0); } } } return null; } /** * Gets the nextPlacedHeavyAtomWithAliphaticPlacedNeigbor from an atom container or molecule * * @return The nextUnplacedHeavyAtomWithUnplacedAliphaticNeigbor * author: steinbeck,cho */ public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour(IAtomContainer molecule) { Iterator bonds = molecule.bonds(); while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); IAtom atom0 = bond.getAtom(0); IAtom atom1 = bond.getAtom(1); if (atom0.getFlag(CDKConstants.ISPLACED) & !(atom1.getFlag(CDKConstants.ISPLACED))) { if (atom1.getFlag(CDKConstants.ISALIPHATIC) & !atom0.getSymbol().equals("H") & !atom1.getSymbol().equals("H")) { return atom0; } } if (atom1.getFlag(CDKConstants.ISPLACED) & !(atom0.getFlag(CDKConstants.ISPLACED))) { if (atom0.getFlag(CDKConstants.ISALIPHATIC) & !atom1.getSymbol().equals("H") & !atom0.getSymbol().equals("H")) { return atom1; } } } return null; } /** * Gets the nextPlacedHeavyAtomWithUnplacedRingNeighbour attribute of the AtomPlacer3D object * * @return The nextPlacedHeavyAtomWithUnplacedRingNeighbour value */ public IAtom getNextPlacedHeavyAtomWithUnplacedRingNeighbour(IAtomContainer molecule) {// IBond[] bonds = molecule.getBonds(); Iterator bonds = molecule.bonds(); while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); IAtom atom0 = bond.getAtom(0); IAtom atom1 = bond.getAtom(1); if (atom0.getFlag(CDKConstants.ISPLACED) & !(atom1.getFlag(CDKConstants.ISPLACED))) { if (atom1.getFlag(CDKConstants.ISINRING) & !atom0.getSymbol().equals("H") & !atom1.getSymbol().equals("H")) { return atom0; } } if (atom1.getFlag(CDKConstants.ISPLACED) & !(atom0.getFlag(CDKConstants.ISPLACED))) { if (atom0.getFlag(CDKConstants.ISINRING) & !atom1.getSymbol().equals("H") & !atom0.getSymbol().equals("H")) { return atom1; } } } return null; } /** * Gets the farthestAtom attribute of the AtomPlacer3D object * * @param refAtomPoint Description of the Parameter * @param ac Description of the Parameter * @return The farthestAtom value */ public IAtom getFarthestAtom(Point3d refAtomPoint, IAtomContainer ac) { double distance = 0; IAtom atom = null; for (int i = 0; i < ac.getAtomCount(); i++) { if (ac.getAtom(i).getPoint3d() != null) { if (Math.abs(refAtomPoint.distance(ac.getAtom(i).getPoint3d())) > distance) { atom = ac.getAtom(i); distance = Math.abs(refAtomPoint.distance(ac.getAtom(i).getPoint3d())); } } } return atom; } /** * Gets the unplacedRingHeavyAtom attribute of the AtomPlacer3D object * * @param atom Description of the Parameter * @return The unplacedRingHeavyAtom value */ public IAtom getUnplacedRingHeavyAtom(IAtomContainer molecule, IAtom atom) { java.util.List bonds = molecule.getConnectedBondsList(atom); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atom); if (!connectedAtom.getFlag(CDKConstants.ISPLACED) && !connectedAtom.getSymbol().equals("H") && connectedAtom.getFlag(CDKConstants.ISINRING)) { return connectedAtom; } } return connectedAtom; } /** * Calculates the geometric center of all placed atoms in the atomcontainer * * @return Point3d the geometric center */ public Point3d geometricCenterAllPlacedAtoms(IAtomContainer molecule) { IAtomContainer allPlacedAtoms = getAllPlacedAtoms(molecule); return GeometryToolsInternalCoordinates.get3DCenter(allPlacedAtoms); } /** * Returns an unplaced atom connected to a given atom * * @param atom The Atom whose unplaced bonding partners are to be returned * @return an unplaced heavy atom connected to a given atom * author: steinbeck,cho */ public IAtom getUnplacedHeavyAtom(IAtomContainer molecule, IAtom atom) { java.util.List bonds = molecule.getConnectedBondsList(atom); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atom); if (!connectedAtom.getFlag(CDKConstants.ISPLACED) & !connectedAtom.getSymbol().equals("H")) { return connectedAtom; } } return connectedAtom; } /** * Returns a placed atom connected to a given atom * * @param atom The Atom whose placed bonding partners are to be returned * @return a placed heavy atom connected to a given atom * author: steinbeck */ public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atom) { java.util.List bonds = molecule.getConnectedBondsList(atom); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atom); if (connectedAtom.getFlag(CDKConstants.ISPLACED) & !connectedAtom.getSymbol().equals("H")) { return connectedAtom; } } return connectedAtom; } /** * Gets the placedAtom attribute of the AtomPlacer3D object * * @param atomA Description of the Parameter * @param atomB Description of the Parameter * @return The placedAtom value */ public IAtom getPlacedAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) { java.util.List bonds = molecule.getConnectedBondsList(atomA); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atomA); if (connectedAtom.getFlag(CDKConstants.ISPLACED) && connectedAtom != atomB) { return connectedAtom; } } return connectedAtom; } /** * Gets the placedHeavyAtom attribute of the AtomPlacer3D object * * @param atomA Description of the Parameter * @param atomB Description of the Parameter * @return The placedHeavyAtom value */ public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) { java.util.List bonds = molecule.getConnectedBondsList(atomA); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atomA); if (connectedAtom.getFlag(CDKConstants.ISPLACED) && !connectedAtom.getSymbol().equals("H") && connectedAtom != atomB) { return connectedAtom; } } return connectedAtom; } /** * Gets the placedHeavyAtoms attribute of the AtomPlacer3D object * * @param atom Description of the Parameter * @return The placedHeavyAtoms value */ public IAtomContainer getPlacedHeavyAtoms(IAtomContainer molecule, IAtom atom) { java.util.List bonds = molecule.getConnectedBondsList(atom); IAtomContainer connectedAtoms = new org.openscience.cdk.AtomContainer(); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atom); if (connectedAtom.getFlag(CDKConstants.ISPLACED) & !(connectedAtom.getSymbol().equals("H"))) { connectedAtoms.addAtom(connectedAtom); } } return connectedAtoms; } /** * Gets all unplacedAtoms around a atom * * @param molecule AtomContainer * @param atom atom: center of search * @return AtomContainer of unplaced atoms */ public IAtomContainer getUnplacedAtoms(IAtomContainer molecule, IAtom atom) { java.util.List bonds = molecule.getConnectedBondsList(atom); IAtomContainer connectedAtoms = new org.openscience.cdk.AtomContainer(); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond)bonds.get(i)).getConnectedAtom(atom); if (!connectedAtom.getFlag(CDKConstants.ISPLACED)) { connectedAtoms.addAtom(connectedAtom); } } return connectedAtoms; } /** * Gets numberOfUnplacedHeavyAtoms (no Flag ISPLACED, no Hydrogens) * * @param ac AtomContainer * @return int #UnplacedAtoms */ public int numberOfUnplacedHeavyAtoms(IAtomContainer ac) { int nUnplacedHeavyAtoms=0; for (int i = 0; i < ac.getAtomCount(); i++) { if (!ac.getAtom(i).getFlag(CDKConstants.ISPLACED) && !ac.getAtom(i).equals("H")) { nUnplacedHeavyAtoms+=1; } } return nUnplacedHeavyAtoms; } /** * Gets the allPlacedAtoms attribute of the AtomPlacer3D object * * @return The allPlacedAtoms value */ public IAtomContainer getAllPlacedAtoms(IAtomContainer molecule) { IAtomContainer placedAtoms = new org.openscience.cdk.AtomContainer(); for (int i = 0; i < molecule.getAtomCount(); i++) { if (molecule.getAtom(i).getFlag(CDKConstants.ISPLACED)) { placedAtoms.addAtom(molecule.getAtom(i)); } } return placedAtoms; } /** * True is all the atoms in the given AtomContainer have been placed * * @param ac The AtomContainer to be searched * @return True is all the atoms in the given AtomContainer have been placed */ public boolean allHeavyAtomsPlaced(IAtomContainer ac) { for (int i = 0; i < ac.getAtomCount(); i++) { if (!ac.getAtom(i).getFlag(CDKConstants.ISPLACED) & !(ac.getAtom(i).getSymbol().equals("H"))) { return false; } } return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -