1 // ******************************************************************************
2 //
3 // Title: Force Field X.
4 // Description: Force Field X - Software for Molecular Biophysics.
5 // Copyright: Copyright (c) Michael J. Schnieders 2001-2025.
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 /**
56 * The default constructor is private.
57 */
58 private Constants() {
59 // Empty.
60 }
61
62 // The first seven constants the defining constants of SI as of May 20, 2019 (BIPM).
63 /**
64 * Hyperfine transition frequency of cesium in Hertz, defining the second.
65 * <p>
66 * <code>DEL_V_Cs_SI = 9192631770L</code>
67 */
68 public static final long DEL_V_Cs_SI = 9192631770L;
69 /**
70 * Speed of light in m/s, defining the meter.
71 * <p>
72 * <code>SPEED_OF_LIGHT_SI = 299792458</code>
73 */
74 public static final int SPEED_OF_LIGHT_SI = 299792458;
75 /**
76 * Planck constant in J*s, defining the kilogram (by defining the derived Joule).
77 * <p>
78 * <code>PLANCK_CONSTANT_SI = 6.62607015E-34d</code>
79 */
80 public static final double PLANCK_CONSTANT_SI = 6.62607015E-34d;
81 /**
82 * Elementary charge in Coulombs, defining the Coulomb.
83 * <p>
84 * <code>ELEMENTARY_CHARGE_SI = 1.602176634E-19d</code>
85 */
86 public static final double ELEMENTARY_CHARGE_SI = 1.602176634E-19d;
87 /**
88 * Boltzmann's constant in J/K, defining the Kelvin.
89 * <p>
90 * <code>BOLTZMANN_SI = 1.380649E-23d</code>
91 */
92 public static final double BOLTZMANN_SI = 1.380649E-23d;
93 /**
94 * Avogadro's number, defining the mol.
95 * <p>
96 * <code>AVOGADRO = 6.02214076E23d</code>
97 */
98 public static final double AVOGADRO = 6.02214076E23d;
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-27</code>
107 */
108 public static final double LITERS_PER_CUBIC_ANGSTROM = 1E-27;
109 /**
110 * Constant <code>ATM_TO_BAR=1.01325</code>
111 */
112 public static final double ATM_TO_BAR = 1.01325;
113 /**
114 * Constant <code>KCAL_TO_KJ=4.184</code>
115 */
116 public static final double KCAL_TO_KJ = 4.184;
117 /**
118 * Constant <code>KJ_TO_KCAL=1.0 / KCAL_TO_KJ</code>
119 */
120 public static final double KJ_TO_KCAL = 1.0 / KCAL_TO_KJ;
121 /**
122 * Constant <code>METERS_TO_ANG=1E10</code>
123 */
124 public static final double METERS_TO_ANG = 1E10;
125 /**
126 * Constant <code>NM_TO_ANG=10</code>
127 */
128 public static final double NM_TO_ANG = 10;
129 /**
130 * Constant <code>ANG_TO_NM=0.1</code>
131 */
132 public static final double ANG_TO_NM = 0.1;
133 /**
134 * Constant <code>SEC_TO_PSEC=1E12</code>
135 */
136 public static final double SEC_TO_PSEC = 1E12;
137 /**
138 * Constant <code>KG_TO_GRAMS=1000</code>
139 */
140 public static final double KG_TO_GRAMS = 1000;
141 /**
142 * Constant <code>PSEC_TO_FSEC=1000</code>
143 */
144 public static final double PSEC_TO_FSEC = 1000;
145 /**
146 * Constant <code>FSEC_TO_PSEC=0.001</code>
147 */
148 public static final double FSEC_TO_PSEC = 0.001;
149 /**
150 * Ideal gas constant in kcal/(mol*K)
151 * <code>R = BOLTZMANN_SI * AVOGADRO * 0.001 * KJ_TO_KCAL</code>
152 * <code>R = 0.0019872042586408316</code>
153 */
154 public static final double R = BOLTZMANN_SI * AVOGADRO * 0.001 * KJ_TO_KCAL;
155 /**
156 * Ideal gas constant in units of g*Ang^2/(mol*psec^2*K).
157 * <code> kB = BOLTZMANN_SI * KG_TO_GRAMS * METERS_TO_ANG * METERS_TO_ANG * AVOGADRO / (SEC_TO_PSEC * SEC_TO_PSEC)</code>
158 * <code>kB = 0.831446261815324</code>
159 */
160 public static final double kB = BOLTZMANN_SI * KG_TO_GRAMS * METERS_TO_ANG * METERS_TO_ANG * AVOGADRO / (SEC_TO_PSEC * SEC_TO_PSEC);
161 /**
162 * Conversion from kcal/mol/Ang^3 to Atm. <code>PRESCON=6.85684112e4</code>
163 */
164 public static final double PRESCON = 6.85684112e4;
165 /**
166 * Permittivity of water at STP. <code>dWater=78.3</code>
167 */
168 public static final double dWater = 78.3;
169 /**
170 * Convert nanoseconds to seconds. <code>NS2SEC=1e-9</code>
171 */
172 public static final double NS2SEC = 1e-9;
173 /**
174 * Room temperature ~= 298.15 Kelvins. <code>ROOM_TEMPERATURE=298.15</code>
175 */
176 public static final double ROOM_TEMPERATURE = 298.15;
177 /**
178 * Coulomb constant in units of kcal*Ang/(mol*electron^2), as derived from CODATA 2018 permittivity
179 * of free space measured at 8.8541878128*10^-12 F/m <code>
180 * ELECTRIC_CODATA_2018=332.063713299</code>
181 */
182 public static final double ELECTRIC_CODATA_2018 = 332.063713299;
183 /**
184 * Coulomb constant in units of kcal*Ang/(mol*electron^2)
185 *
186 * <p>Note -- this value varies slightly between force field definitions and can be set using the
187 * ELECTRIC property. As such, it's not updated to SI/CODATA standards, but rather kept up-to-date
188 * with the coulomb parameter in Tinker/source/units.f. At present, the Tinker value is a truncated
189 * version of the Coulomb constant derived from CODATA 2018.<code>
190 * DEFAULT_ELECTRIC=332.0637133</code>
191 */
192 public static final double DEFAULT_ELECTRIC = 332.0637133;
193 /**
194 * Conversion from electron-Angstroms to Debye. <code>ELEC_ANG_TO_DEBYE=4.80321</code>
195 */
196 public static final double ELEC_ANG_TO_DEBYE = 4.80321;
197 /**
198 * Conversion from electron-Angstroms^2 to Buckinghams. <code> ELEC_ANG2_TO_BUCKINGHAMS =
199 * ELEC_ANG_TO_DEBYE * ELEC_ANG_TO_DEBYE</code>
200 */
201 public static final double ELEC_ANG2_TO_BUCKINGHAMS = ELEC_ANG_TO_DEBYE * ELEC_ANG_TO_DEBYE;
202 /**
203 * Conversion from kcal/mole to g*Ang**2/ps**2. <code>KCAL_TO_GRAM_ANG2_PER_PS2=4.1840e2</code>
204 */
205 public static final double KCAL_TO_GRAM_ANG2_PER_PS2 = 4.1840e2;
206 /**
207 * Conversion from Bohr to Angstroms. <code>BOHR=0.529177210903</code>
208 */
209 public static final double BOHR = 0.529177210903;
210 /**
211 * Conversion from Bohr^2 to Angstroms^2. <code>BOHR2 = BOHR * BOHR</code>
212 */
213 public static final double BOHR2 = BOHR * BOHR;
214 /**
215 * Convert Hartree to kcal/mol.
216 */
217 public static final double HARTREE_TO_KCAL_PER_MOL = 627.5094738898777;
218 /**
219 * Degrees per radian.
220 */
221 public static final double DEGREES_PER_RADIAN = 180.0 / PI;
222 }