Elements.java

  1. /*
  2.  * Copyright 2021 Dominik Kopczynski, Nils Hoffmann.
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package org.lifstools.jgoslin.domain;

  17. import java.util.ArrayList;
  18. import java.util.List;
  19. import java.util.Map;
  20. import static java.util.Map.entry;

  21. /**
  22.  * Utility class to look up element names, masses, shortcut names, and ordering.
  23.  *
  24.  * @author Dominik Kopczynski
  25.  * @author Nils Hoffmann
  26.  */
  27. public final class Elements {

  28.     public static final double ELECTRON_REST_MASS = 0.00054857990946;

  29.     public static final Map<String, Element> ELEMENT_POSITIONS = Map.ofEntries(
  30.             entry("C", Element.C),
  31.             entry("D", Element.H2),
  32.             entry("H", Element.H),
  33.             entry("N", Element.N),
  34.             entry("O", Element.O),
  35.             entry("P", Element.P),
  36.             entry("P'", Element.P32),
  37.             entry("S", Element.S),
  38.             entry("F", Element.F),
  39.             entry("Cl", Element.Cl),
  40.             entry("Br", Element.Br),
  41.             entry("I", Element.I),
  42.             entry("As", Element.As),
  43.             entry("S'", Element.S34),
  44.             entry("S''", Element.S33),
  45.             entry("H'", Element.H2),
  46.             entry("C'", Element.C13),
  47.             entry("N'", Element.N15),
  48.             entry("O'", Element.O17),
  49.             entry("O''", Element.O18),
  50.             entry("2H", Element.H2),
  51.             entry("13C", Element.C13),
  52.             entry("15N", Element.N15),
  53.             entry("17O", Element.O17),
  54.             entry("18O", Element.O18),
  55.             entry("32P", Element.P32),
  56.             entry("34S", Element.S34),
  57.             entry("33S", Element.S33),
  58.             entry("H2", Element.H2),
  59.             entry("C13", Element.C13),
  60.             entry("N15", Element.N15),
  61.             entry("O17", Element.O17),
  62.             entry("O18", Element.O18),
  63.             entry("P32", Element.P32),
  64.             entry("S34", Element.S34),
  65.             entry("S33", Element.S33)
  66.     );

  67.     public static final Map<Element, Double> ELEMENT_MASSES = Map.ofEntries(
  68.             entry(Element.C, 12.0),
  69.             entry(Element.H, 1.007825035),
  70.             entry(Element.N, 14.0030740),
  71.             entry(Element.O, 15.99491463),
  72.             entry(Element.P, 30.973762),
  73.             entry(Element.S, 31.9720707),
  74.             entry(Element.H2, 2.014101779),
  75.             entry(Element.C13, 13.0033548378),
  76.             entry(Element.N15, 15.0001088984),
  77.             entry(Element.O17, 16.9991315),
  78.             entry(Element.O18, 17.9991604),
  79.             entry(Element.P32, 31.973907274),
  80.             entry(Element.S33, 32.97145876),
  81.             entry(Element.S34, 33.96786690),
  82.             entry(Element.F, 18.9984031),
  83.             entry(Element.Cl, 34.968853),
  84.             entry(Element.Br, 78.918327),
  85.             entry(Element.I, 126.904473),
  86.             entry(Element.As, 74.921595)
  87.     );

  88.     public static final Map<Element, String> ELEMENT_SHORTCUT = Map.ofEntries(
  89.             entry(Element.C, "C"),
  90.             entry(Element.D, "H'"),
  91.             entry(Element.H, "H"),
  92.             entry(Element.N, "N"),
  93.             entry(Element.O, "O"),
  94.             entry(Element.P, "P"),
  95.             entry(Element.S, "S"),
  96.             entry(Element.F, "F"),
  97.             entry(Element.Cl, "Cl"),
  98.             entry(Element.Br, "Br"),
  99.             entry(Element.I, "I"),
  100.             entry(Element.As, "As"),
  101.             entry(Element.H2, "H'"),
  102.             entry(Element.C13, "C'"),
  103.             entry(Element.N15, "N'"),
  104.             entry(Element.O17, "O'"),
  105.             entry(Element.O18, "O''"),
  106.             entry(Element.P32, "P'"),
  107.             entry(Element.S33, "S'"),
  108.             entry(Element.S34, "S''")
  109.     );

  110.     public static final Map<Element, String> HEAVY_SHORTCUT = Map.ofEntries(
  111.             entry(Element.C, "C"),
  112.             entry(Element.D, "H2"),
  113.             entry(Element.H, "H"),
  114.             entry(Element.N, "N"),
  115.             entry(Element.O, "O"),
  116.             entry(Element.P, "P"),
  117.             entry(Element.S, "S"),
  118.             entry(Element.F, "F"),
  119.             entry(Element.Cl, "Cl"),
  120.             entry(Element.Br, "Br"),
  121.             entry(Element.I, "I"),
  122.             entry(Element.As, "As"),
  123.             entry(Element.H2, "[2]H"),
  124.             entry(Element.C13, "[13]C"),
  125.             entry(Element.N15, "[15]N"),
  126.             entry(Element.O17, "[17]O"),
  127.             entry(Element.O18, "[18]O"),
  128.             entry(Element.P32, "[32]P"),
  129.             entry(Element.S33, "[33]S"),
  130.             entry(Element.S34, "[34]S")
  131.     );

  132.     public static final Map<Element, Element> HEAVY_TO_REGULAR = Map.ofEntries(
  133.             entry(Element.H2, Element.H),
  134.             entry(Element.D, Element.H),
  135.             entry(Element.C13, Element.C),
  136.             entry(Element.N15, Element.N),
  137.             entry(Element.O17, Element.O),
  138.             entry(Element.O18, Element.O),
  139.             entry(Element.P32, Element.P),
  140.             entry(Element.S33, Element.S),
  141.             entry(Element.S34, Element.S)
  142.     );
  143.    
  144.    
  145.    

  146.     public static final Map<String, Element> HEAVY_ELEMENT_TABLE = Map.ofEntries(
  147.             entry("[2]H", Element.H2),
  148.             entry("[13]C", Element.C13),
  149.             entry("[15]N", Element.N15),
  150.             entry("[17]O", Element.O17),
  151.             entry("[18]O", Element.O18),
  152.             entry("[32]P", Element.P32),
  153.             entry("[33]S", Element.S33),
  154.             entry("[34]S", Element.S34)
  155.     );
  156.    

  157.     public static final ArrayList<Element> ELEMENT_ORDER = new ArrayList<Element>(List.of(Element.C, Element.H, Element.As, Element.Br, Element.Cl, Element.F, Element.I, Element.N, Element.O, Element.P, Element.S, Element.H2, Element.C13, Element.N15, Element.O17, Element.O18, Element.P32, Element.S33, Element.S34));
  158. }