View Javadoc
1   // ******************************************************************************
2   //
3   // Title:       Force Field X.
4   // Description: Force Field X - Software for Molecular Biophysics.
5   // Copyright:   Copyright (c) Michael J. Schnieders 2001-2024.
6   //
7   // This file is part of Force Field X.
8   //
9   // Force Field X is free software; you can redistribute it and/or modify it
10  // under the terms of the GNU General Public License version 3 as published by
11  // the Free Software Foundation.
12  //
13  // Force Field X is distributed in the hope that it will be useful, but WITHOUT
14  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16  // details.
17  //
18  // You should have received a copy of the GNU General Public License along with
19  // Force Field X; if not, write to the Free Software Foundation, Inc., 59 Temple
20  // Place, Suite 330, Boston, MA 02111-1307 USA
21  //
22  // Linking this library statically or dynamically with other modules is making a
23  // combined work based on this library. Thus, the terms and conditions of the
24  // GNU General Public License cover the whole combination.
25  //
26  // As a special exception, the copyright holders of this library give you
27  // permission to link this library with independent modules to produce an
28  // executable, regardless of the license terms of these independent modules, and
29  // to copy and distribute the resulting executable under terms of your choice,
30  // provided that you also meet, for each linked independent module, the terms
31  // and conditions of the license of that module. An independent module is a
32  // module which is not derived from or based on this library. If you modify this
33  // library, you may extend this exception to your version of the library, but
34  // you are not obligated to do so. If you do not wish to do so, delete this
35  // exception statement from your version.
36  //
37  // ******************************************************************************
38  package ffx.utilities;
39  
40  import static org.apache.commons.math3.util.FastMath.PI;
41  
42  /**
43   * Library class containing constants such as Avogadro's number.
44   * <p>
45   * SI units: kg, m, s, C, K, mol, lm
46   * <p>
47   * Our typical units: g/mol, Angstrom, psec, elementary charges (+1 proton charge), K, mol, N/A
48   *
49   * @author Jacob M. Litman
50   * @author Michael J. Schnieders
51   * @since 1.0
52   */
53  public class Constants {
54  
55    // The first seven constants the defining constants of SI as of May 20, 2019 (BIPM).
56  
57    /**
58     * Hyperfine transition frequency of cesium in Hertz, defining the second.
59     * <p>
60     * <code>DEL_V_Cs_SI = 9192631770L</code>
61     */
62    public static final long DEL_V_Cs_SI = 9192631770L;
63  
64    /**
65     * Speed of light in m/s, defining the meter.
66     * <p>
67     * <code>SPEED_OF_LIGHT_SI = 299792458</code>
68     */
69    public static final int SPEED_OF_LIGHT_SI = 299792458;
70  
71    /**
72     * Planck constant in J*s, defining the kilogram (by defining the derived Joule).
73     * <p>
74     * <code>PLANCK_CONSTANT_SI = 6.62607015E-34d</code>
75     */
76    public static final double PLANCK_CONSTANT_SI = 6.62607015E-34d;
77  
78    /**
79     * Elementary charge in Coulombs, defining the Coulomb.
80     * <p>
81     * <code>ELEMENTARY_CHARGE_SI = 1.602176634E-19d</code>
82     */
83    public static final double ELEMENTARY_CHARGE_SI = 1.602176634E-19d;
84  
85    /**
86     * Boltzmann's constant in J/K, defining the Kelvin.
87     * <p>
88     * <code>BOLTZMANN_SI = 1.380649E-23d</code>
89     */
90    public static final double BOLTZMANN_SI = 1.380649E-23d;
91  
92    /**
93     * Avogadro's number, defining the mol.
94     * <p>
95     * <code>AVOGADRO = 6.02214076E23d</code>
96     */
97    public static final double AVOGADRO = 6.02214076E23d;
98  
99    /**
100    * Luminous efficacy in lm/W, defining the lumen.
101    * <p>
102    * <code>K_CD_SI = 683</code>
103    */
104   public static final int K_CD_SI = 683;
105 
106   /** Constant <code>LITERS_PER_CUBIC_ANGSTROM=1E-30</code> */
107   public static final double LITERS_PER_CUBIC_ANGSTROM = 1E-30;
108   /** Constant <code>ATM_TO_BAR=1.01325</code> */
109   public static final double ATM_TO_BAR = 1.01325;
110   /** Constant <code>KCAL_TO_KJ=4.184</code> */
111   public static final double KCAL_TO_KJ = 4.184;
112   /** Constant <code>KJ_TO_KCAL=1.0 / KCAL_TO_KJ</code> */
113   public static final double KJ_TO_KCAL = 1.0 / KCAL_TO_KJ;
114   /** Constant <code>METERS_TO_ANG=1E10</code> */
115   public static final double METERS_TO_ANG = 1E10;
116   /** Constant <code>SEC_TO_PSEC=1E12</code> */
117   public static final double SEC_TO_PSEC = 1E12;
118   /** Constant <code>KG_TO_GRAMS=1000</code> */
119   public static final double KG_TO_GRAMS = 1000;
120   /** Constant <code>PSEC_TO_FSEC=1000</code> */
121   public static final double PSEC_TO_FSEC = 1000;
122   /** Constant <code>FSEC_TO_PSEC=0.001</code> */
123   public static final double FSEC_TO_PSEC = 0.001;
124   /**
125    * Ideal gas constant in kcal/(mol*K) <code>R = BOLTZMANN_SI * AVOGADRO * 0.001 * KJ_TO_KCAL
126    * </code>
127    */
128   public static final double R = BOLTZMANN_SI * AVOGADRO * 0.001 * KJ_TO_KCAL;
129   /**
130    * Boltzmann/ideal gas constant in units of g*Ang^2/(mol*psec^2*K). <code> kB = BOLTZMANN_SI *
131    * KG_TO_GRAMS * METERS_TO_ANG * METERS_TO_ANG * AVOGADRO / (SEC_TO_PSEC * SEC_TO_PSEC)</code>
132    */
133   public static final double kB =
134       BOLTZMANN_SI * KG_TO_GRAMS * METERS_TO_ANG * METERS_TO_ANG * AVOGADRO / (SEC_TO_PSEC
135           * SEC_TO_PSEC);
136   /** Conversion from kcal/mol/Ang^3 to Atm. <code>PRESCON=6.85684112e4</code> */
137   public static final double PRESCON = 6.85684112e4;
138   /** Permittivity of water at STP. <code>dWater=78.3</code> */
139   public static final double dWater = 78.3;
140   /** Convert nanoseconds to seconds. <code>NS2SEC=1e-9</code> */
141   public static final double NS2SEC = 1e-9;
142   /** Room temperature ~= 298.15 Kelvins. <code>ROOM_TEMPERATURE=298.15</code> */
143   public static final double ROOM_TEMPERATURE = 298.15;
144   /**
145    * Coulomb constant in units of kcal*Ang/(mol*electron^2), as derived from CODATA 2018 permittivity
146    * of free space measured at 8.8541878128*10^-12 F/m <code>
147    * ELECTRIC_CODATA_2018=332.063713299</code>
148    */
149   public static final double ELECTRIC_CODATA_2018 = 332.063713299;
150   /**
151    * Coulomb constant in units of kcal*Ang/(mol*electron^2)
152    *
153    * <p>Note -- this value varies slightly between force field definitions and can be set using the
154    * ELECTRIC property. As such, it's not updated to SI/CODATA standards, but rather kept up-to-date
155    * with the coulomb parameter in Tinker/source/units.f. At present, the Tinker value is a truncated
156    * version of the Coulomb constant derived from CODATA 2018.<code>
157    * DEFAULT_ELECTRIC=332.063713</code>
158    */
159   public static final double DEFAULT_ELECTRIC = 332.063713;
160   /** Conversion from electron-Angstroms to Debye. <code>ELEC_ANG_TO_DEBYE=4.80321</code> */
161   public static final double ELEC_ANG_TO_DEBYE = 4.80321;
162   /**
163    * Conversion from electron-Angstroms^2 to Buckinghams. <code> ELEC_ANG2_TO_BUCKINGHAMS =
164    * ELEC_ANG_TO_DEBYE * ELEC_ANG_TO_DEBYE</code>
165    */
166   public static final double ELEC_ANG2_TO_BUCKINGHAMS = ELEC_ANG_TO_DEBYE * ELEC_ANG_TO_DEBYE;
167   /**
168    * Conversion from kcal/mole to g*Ang**2/ps**2. <code>KCAL_TO_GRAM_ANG2_PER_PS2=4.1840e2</code>
169    */
170   public static final double KCAL_TO_GRAM_ANG2_PER_PS2 = 4.1840e2;
171   /** Conversion from Bohr to Angstroms. <code>BOHR=0.52917720859</code> */
172   public static final double BOHR = 0.52917720859;
173   /** Conversion from Bohr^2 to Angstroms^2. <code>BOHR2 = BOHR * BOHR</code> */
174   public static final double BOHR2 = BOHR * BOHR;
175   /**
176    * Convert Hartree to kcal/mol.
177    */
178   public static final double HARTREE_TO_KCAL_PER_MOL = 627.5094738898777;
179   /**
180    * Degrees per radian.
181    */
182   public static final double DEGREES_PER_RADIAN = 180.0 / PI;
183 
184   // Library class: make the default constructor private to ensure it's never constructed.
185   private Constants() {
186   }
187 }