/** * Get the symbol for the specified atomic number. * * @param atomicNumber the atomic number of the element * @return the corresponding symbol */ public static String getSymbol(int atomicNumber) { return Elements.ofNumber(atomicNumber).symbol(); }
/** * Get the symbol for the specified atomic number. * * @param atomicNumber the atomic number of the element * @return the corresponding symbol */ public static String getSymbol(int atomicNumber) { return Elements.ofNumber(atomicNumber).symbol(); }
/** * Access the default position of the hydrogen label when the atom has no * bonds. * * @param atom hydrogens will be labelled * @return the position */ static HydrogenPosition usingDefaultPlacement(final IAtom atom) { if (PREFIXED_H.contains(Elements.ofNumber(atom.getAtomicNumber()))) return Left; return Right; } }
/** * Returns the element symbol of this element. * * @return The element symbol of this element. Null if unset. * * @see #setSymbol */ @Override public String getSymbol() { if (atomicNumber == null) return null; if (atomicNumber == 0) return "R"; return Elements.ofNumber(atomicNumber).symbol(); }
/** * Returns the element symbol of this element. * * @return The element symbol of this element. Null if unset. * * @see #setSymbol */ @Override public String getSymbol() { if (atomicNumber == null) return null; if (atomicNumber == 0) return "R"; return Elements.ofNumber(atomicNumber).symbol(); }
/** * Returns the element symbol of this element. * * @return The element symbol of this element. Null if unset. * * @see #setSymbol */ @Override public String getSymbol() { if (atomicNumber == null) return null; if (atomicNumber == 0) return "R"; return Elements.ofNumber(atomicNumber).symbol(); }
/** * Returns the element symbol of this element. * * @return The element symbol of this element. Null if unset. * * @see #setSymbol */ @Override public String getSymbol() { if (atomicNumber == null) return null; if (atomicNumber == 0) return "R"; return Elements.ofNumber(atomicNumber).symbol(); }
private String newSymbol(int atomnum, int hcount, boolean prefix) { StringBuilder sb = new StringBuilder(); Elements elem = Elements.ofNumber(atomnum); if (elem == Elements.Carbon && hcount == 3) return "Me"; if (prefix) { if (hcount > 0) { sb.append('H'); if (hcount > 1) sb.append(hcount); } sb.append(elem.symbol()); } else { sb.append(elem.symbol()); if (hcount > 0) { sb.append('H'); if (hcount > 1) sb.append(hcount); } } return sb.toString(); }
private String newSymbol(int atomnum, int hcount, boolean prefix) { StringBuilder sb = new StringBuilder(); Elements elem = Elements.ofNumber(atomnum); if (elem == Elements.Carbon && hcount == 3) return "Me"; if (prefix) { if (hcount > 0) { sb.append('H'); if (hcount > 1) sb.append(hcount); } sb.append(elem.symbol()); } else { sb.append(elem.symbol()); if (hcount > 0) { sb.append('H'); if (hcount > 1) sb.append(hcount); } } return sb.toString(); }
/** * Access the atom symbol to write. * * @param atom atom * @param elem atomic number * @return atom symbol */ private String getSymbol(IAtom atom, int elem) { if (atom instanceof IPseudoAtom) return ((IPseudoAtom) atom).getLabel(); String symbol = Elements.ofNumber(elem).symbol(); if (symbol.isEmpty()) symbol = atom.getSymbol(); if (symbol == null) symbol = "*"; if (symbol.length() > 3) symbol = symbol.substring(0, 3); return symbol; }
Elements elem = Elements.ofNumber(atom.getAtomicNumber());
/** * Create a new atom with of the specified element, hydrogen count, and formal charge. * * @param elem atomic number * @param hcnt hydrogen count * @param fchg formal charge */ public Atom(int elem, int hcnt, int fchg) { super((String)null); setAtomicNumber(elem); setSymbol(Elements.ofNumber(elem).symbol()); setImplicitHydrogenCount(hcnt); setFormalCharge(fchg); }
public boolean visible(IAtom atom, List<IBond> bonds, RendererModel model) { final Elements element = Elements.ofNumber(atom.getAtomicNumber());
/** * Create a new atom with of the specified element, hydrogen count, and formal charge. * * @param elem atomic number * @param hcnt hydrogen count * @param fchg formal charge */ public Atom(int elem, int hcnt, int fchg) { super((String)null); setAtomicNumber(elem); setSymbol(Elements.ofNumber(elem).symbol()); setImplicitHydrogenCount(hcnt); setFormalCharge(fchg); }
/** * Create a new atom with of the specified element, hydrogen count, and formal charge. * * @param elem atomic number * @param hcnt hydrogen count * @param fchg formal charge */ public Atom(int elem, int hcnt, int fchg) { super((String)null); setAtomicNumber(elem); setSymbol(Elements.ofNumber(elem).symbol()); setImplicitHydrogenCount(hcnt); setFormalCharge(fchg); }
/** * Create a new atom with of the specified element, hydrogen count, and formal charge. * * @param elem atomic number * @param hcnt hydrogen count * @param fchg formal charge */ public Atom(int elem, int hcnt, int fchg) { super((String)null); setAtomicNumber(elem); setSymbol(Elements.ofNumber(elem).symbol()); setImplicitHydrogenCount(hcnt); setFormalCharge(fchg); }
/** * 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); } }
private static String getBasicElementSymbol(IAtom atom) { if (atom.getFormalCharge() != null && atom.getFormalCharge() != 0) return null; if (atom.getMassNumber() != null && atom.getMassNumber() != 0) return null; if (atom.getAtomicNumber() == null || atom.getAtomicNumber() < 1) return null; Integer hcnt = atom.getImplicitHydrogenCount(); if (hcnt == null) return null; Elements elem = Elements.ofNumber(atom.getAtomicNumber()); final String hsym = (hcnt > 0) ? ((hcnt > 1) ? ("H" + hcnt) : "H") : ""; // see HydrogenPosition for canonical list switch (elem) { case Oxygen: case Sulfur: case Selenium: case Tellurium: case Fluorine: case Chlorine: case Bromine: case Iodine: return hsym + elem.symbol(); default: return elem.symbol() + hsym; } }
private static String getBasicElementSymbol(IAtom atom) { if (atom.getFormalCharge() != null && atom.getFormalCharge() != 0) return null; if (atom.getMassNumber() != null && atom.getMassNumber() != 0) return null; if (atom.getAtomicNumber() == null || atom.getAtomicNumber() < 1) return null; Integer hcnt = atom.getImplicitHydrogenCount(); if (hcnt == null) return null; Elements elem = Elements.ofNumber(atom.getAtomicNumber()); final String hsym = (hcnt > 0) ? ((hcnt > 1) ? ("H" + hcnt) : "H") : ""; // see HydrogenPosition for canonical list switch (elem) { case Oxygen: case Sulfur: case Selenium: case Tellurium: case Fluorine: case Chlorine: case Bromine: case Iodine: return hsym + elem.symbol(); default: return elem.symbol() + hsym; } }