/** * {@inheritDoc} */ @Override public String getSymbol() { return atom.getSymbol(); }
/** * The matches implementation of the QueryAtom interface. * *@param atom The atom to be matched by this QueryAtom *@return true if Atom matched */ @Override public boolean matches(IAtom atom) { return !symbols.contains(atom.getSymbol()); }
/** * Determine if the atom is heavy (non-hydrogen). * * @param atom The atom to be checked * @return True if the atom is non-hydrogen */ boolean isHeavyAtom(IAtom atom) { return !atom.getSymbol().equals("H"); } }
private int countExplicitHydrogens(IAtom atom, List<IBond> connectedBonds) { int count = 0; for (IBond bond : connectedBonds) { IAtom aAtom = bond.getOther(atom); if (aAtom.getSymbol().equals("H")) { count++; } } return count; }
public boolean matches(IBond bond) { IAtom atom1 = bond.getBegin(); IAtom atom2 = bond.getEnd(); if ((atom1.getSymbol().equalsIgnoreCase(symbol1) && atom2.getSymbol().equalsIgnoreCase(symbol2)) || (atom1.getSymbol().equalsIgnoreCase(symbol2) && atom2.getSymbol().equalsIgnoreCase(symbol1))) { if (bond.getOrder().compareTo(bondOrder) == 0) { return true; } } return false; } }
private static boolean containsPatom(PharmacophoreQuery q, String id) { for (IAtom queryAtom : q.atoms()) { if (queryAtom.getSymbol().equals(id)) return true; } return false; }
private int getConnectedHCount(IAtomContainer atomContainer, IAtom atom) { List<IAtom> connectedAtoms = atomContainer.getConnectedAtomsList(atom); int n = 0; for (IAtom anAtom : connectedAtoms) if (anAtom.getSymbol().equals("H")) n++; return n; }
private int countExplicitHydrogens(IAtom atom, List<IBond> connectedBonds) { int count = 0; for (IBond bond : connectedBonds) { IAtom aAtom = bond.getOther(atom); if (aAtom.getSymbol().equals("H")) { count++; } } return count; }
/** * Is an atom a hydrogen atom. * * @param atom an atom * @return the atom is a hydrogen */ private static boolean isHydrogen(IAtom atom) { if (atom.getAtomicNumber() != null) return atom.getAtomicNumber() == 1; return "H".equals(atom.getSymbol()); }
private boolean matchSymbol(IAtom atom) { if (getAtomSymbol() == null) { return false; } return getAtomSymbol().equals(atom.getSymbol()); }
private boolean isThioAmide(IAtom atom, IAtomContainer atomContainer, List<IBond> connectedBonds) { if (connectedBonds.size() < 1) return false; for (IBond bond : connectedBonds) { IAtom neighbor = bond.getOther(atom); if (neighbor.getSymbol().equals("C")) { if (countAttachedDoubleBonds(atomContainer.getConnectedBondsList(neighbor), neighbor, "S") == 1) return true; } } return false; }
private boolean isAmide(IAtom atom, IAtomContainer atomContainer, List<IBond> connectedBonds) { if (connectedBonds.size() < 1) return false; for (IBond bond : connectedBonds) { IAtom neighbor = bond.getOther(atom); if (neighbor.getSymbol().equals("C")) { if (countAttachedDoubleBonds(atomContainer.getConnectedBondsList(neighbor), neighbor, "O") == 1) return true; } } return false; }
private IAtomType perceiveThorium(IAtomContainer atomContainer, IAtom atom) throws CDKException { if ("Th".equals(atom.getSymbol())) { if (atom.getFormalCharge() == 0 && atomContainer.getConnectedBondsCount(atom) == 0) { IAtomType type = getAtomType("Th"); if (isAcceptable(atom, atomContainer, type)) { return type; } } } return null; }
@Override public boolean matches(IAtom atom) { int requiredCharge = this.getFormalCharge() == null ? 0 : this.getFormalCharge(); int foundCharge = atom.getFormalCharge() == null ? 0 : atom.getFormalCharge(); return this.getSymbol().equals(atom.getSymbol()) && requiredCharge == foundCharge; };
private boolean isMajorIsotope(IAtom atom) { if (atom.getMassNumber() == null) return false; try { IIsotope major = Isotopes.getInstance().getMajorIsotope(atom.getSymbol()); return major != null && major.getMassNumber().equals(atom.getMassNumber()); } catch (IOException ex) { return false; } }
@Test public void symbol_C() throws Exception { IAtom atom = reader.readAtomFast(" 7.8089 -1.3194 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0", builder, 1); assertThat(atom.getSymbol(), is("C")); }
@Test public void testExpectedValues() throws Exception { IAtom hydrogen = new ImmutableHydrogen(); Assert.assertEquals("H", hydrogen.getSymbol()); Assert.assertEquals(1, hydrogen.getAtomicNumber().intValue()); Assert.assertEquals(1, hydrogen.getMassNumber().intValue()); }
/** * Method to test the Atom(String symbol) method. */ @Test public void testAtom_String() { IAtom a = new Atom("C"); Assert.assertEquals("C", a.getSymbol()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testDebugAtom_String_Point3d() { Point3d point3d = new Point3d(1.0, 2.0, 3.0); IAtom a = new DebugAtom("C", point3d); Assert.assertEquals("C", a.getSymbol()); Assert.assertEquals(point3d, a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }