/** * Get the covalent radius for an element. * * @param symbol the symbol of the element * @return the covalent radius */ public static Double getCovalentRadius(String symbol) { return Elements.ofString(symbol).covalentRadius(); }
if (!isLower(c2)) { elem = Elements.ofString("" + c1); if (c2 != '\0') iter.pos--; } else { elem = Elements.ofString("" + c1 + c2); IIsotope isotope = mf.getBuilder().newInstance(IIsotope.class, elem.symbol()); isotope.setAtomicNumber(elem.number()); if (mass != 0) isotope.setMassNumber(mass); else if (setMajor) { try { IIsotope major = Isotopes.getInstance().getMajorIsotope(elem.number()); if (major != null) isotope.setMassNumber(major.getMassNumber());
@Test public void testAliphaticSymbols() { for (Elements e : Elements.values()) { int len = e.symbol().length(); if (len == 1 || len == 2) { String smarts = "[" + e.symbol() + "]"; QueryAtomContainer mol = new QueryAtomContainer(null); assertTrue(smarts, Smarts.parse(mol, smarts)); Expr expr = getAtomExpr(mol.getAtom(0)); assertThat(expr, anyOf(is(new Expr(ELEMENT, e.number())), is(new Expr(ALIPHATIC_ELEMENT, e.number())))); } } }
private static List<IAtom> getRgrps(IAtomContainer container, Elements reversed) { List<IAtom> res = new ArrayList<>(); for (IAtom atom : container.atoms()) { if (atom.getAtomicNumber() == 0) { res.add(atom); } else if (atom.getAtomicNumber() == reversed.number()) { return Collections.emptyList(); } } return res; }
switch (Elements.ofNumber(element)) { case Boron: if (charge == 0 && valence <= 2) return true;
/** * Get the CAS ID for an element. * * @param symbol the symbol of the element * @return the CAS ID */ public static String getCASId(String symbol) { return casIds().get(Elements.ofString(symbol)); }
/** * Returns the molecular mass of the IAtomContainer. For the calculation it * uses the masses of the isotope mixture using natural abundances. * * @param atomContainer * @cdk.keyword mass, molecular * @see #getMolecularWeight(IAtomContainer) */ public static double getNaturalExactMass(IAtomContainer atomContainer) { try { Isotopes isotopes = Isotopes.getInstance(); double hydgrogenMass = isotopes.getNaturalMass(Elements.HYDROGEN); double mass = 0.0; for (final IAtom atom : atomContainer.atoms()) { if (atom.getAtomicNumber() == null) throw new IllegalArgumentException("an atom had with unknown (null) atomic number"); if (atom.getImplicitHydrogenCount() == null) throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens"); mass += isotopes.getNaturalMass(Elements.ofNumber(atom.getAtomicNumber()).toIElement()); mass += hydgrogenMass * atom.getImplicitHydrogenCount(); } return mass; } catch (IOException e) { throw new RuntimeException("Isotopes definitions could not be loaded", e); } }
/** * Get the Pauling electronegativity of an element. * * @param symbol the symbol of the element * @return the Pauling electronegativity */ public static Double getPaulingElectronegativity(String symbol) { return Elements.ofString(symbol).electronegativity(); }
@Test public void testGroupNull() { Expr expr = new Expr(PERIODIC_GROUP, Elements.Chlorine.group()); IAtom atom = mock(IAtom.class); when(atom.getAtomicNumber()).thenReturn(null); assertFalse(expr.matches(atom)); }
@Test public void unknownAtomTypeDoesNotModifyProperties() { IAtom atom = new Atom(Elements.CARBON); IAtomType atomType = new AtomType(Elements.Unknown.toIElement()); atomType.setAtomTypeName("X"); AtomTypeManipulator.configure(atom, atomType); assertThat(atom.getSymbol(), is("C")); assertThat(atom.getAtomicNumber(), is(6)); }