Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
Overlay line clipped to the near plane
A 3D line cut at the camera's near plane and projected to screen points for the 2D overlay.
cut at depth 1.01 × near: a′ = a + (b − a) × (near′ − da) ÷ (db − da)
3D view drawing m3d/view3d.js32-bit, display only- CadCraft
- ModelCraft
-
Unit constants
The Boltzmann constant, Coulomb constant, acceleration factor and pressure factor for reduced and real units.
real: kB = 0.0019872041 kcal/mol/K; ke = 332.0637; accel = 418.4; pressure = 68568.4 atm per kcal/mol/ų
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Complementary error function
erfc(x), used for the real-space part of the Ewald sum.
erfc(x) ≈ t × exp(−x² + P₉(t)), t = 1 ÷ (1 + |x| ÷ 2); 2 − that for x < 0
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Pair parameters and the cutoff shift
σ and ε for each pair of atom types and the energy subtracted so the pair energy is zero at the cutoff.
σᵢⱼ = (σᵢ + σⱼ) ÷ 2; εᵢⱼ = √(εᵢ εⱼ); shift = 4 εᵢⱼ (s² − s), s = (σᵢⱼ ÷ r_c)⁶
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Kinetic energy
The kinetic energy of the system in its energy unit.
KE = ½ Σ mᵢ (vx² + vy² + vz²) ÷ accel
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Temperature
The instantaneous temperature from the kinetic energy.
T = 2 KE ÷ (dof × kB), dof = max(1, 3N − 3 − constraints)
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Pair forces and energies
The Lennard-Jones and real-space Coulomb force, energy and virial of one pair of atoms.
U = 4ε(s⁶² − s⁶) − shift, s⁶ = (σ² ÷ r²)³; Coulomb: ke qᵢqⱼ erfc(αr) ÷ r; excluded pairs: −ke qᵢqⱼ erf(αr) ÷ r
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Bond stretch
The energy, force and virial of each harmonic bond.
U = ½ k (r − r₀)²; F = −k (r − r₀) ÷ r along the bond
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Bond angles
The energy, forces and virial of each harmonic angle.
θ = acos(a·b ÷ (|a||b|)); U = ½ k (θ − θ₀)²; dU/dcos = −k (θ − θ₀) ÷ sin θ
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Dihedral angles
The energy and forces of each periodic dihedral.
φ = atan2(|b₂| b₁·n₂, n₁·n₂); U = k_d (1 + cos(nφ − δ))
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Ewald reciprocal sum and self term
The long-range part of the Coulomb energy and force.
E = (2π ke ÷ V) Σ_k exp(−k² ÷ 4α²) ÷ k² × |S(k)|², |n|² ≤ kmax²; self = −ke α ÷ √π × Σ q²
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Pressure
The virial pressure of the box.
P = (2 KE + W) ÷ (3V) × unit factor
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Time stepping, thermostats and barostat
Advances the system by velocity Verlet, with optional temperature and pressure coupling.
v += ½ dt a; x += dt v; forces; v += ½ dt a; Berendsen λ = √(1 + dt÷τ (T₀÷T − 1)); μ = ∛(max(0.5, 1 − dt÷τ_p κ (P₀ − P)))
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Radial distribution function
g(r): how many atoms sit at each distance, relative to an ideal gas of the same density.
g(b) = count(b) ÷ (frames × shell × N_A × (N_B, or N_A − 1 for one type) ÷ V), shell = 4⁄3 π ((b+1)³ − b³) dr³
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Mean-square displacement and diffusion
The mean-square displacement over time and the diffusion coefficient from its slope.
D = (n Σtm − Σt Σm) ÷ (n Σt² − (Σt)²) ÷ 6 over the chosen part of the samples
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Mass density
The density of the box in g/cm³ (real units).
ρ = Σm ÷ 0.602214076 ÷ V (amu per ų to g/cm³)
Molecular dynamics molecular/md.js64-bit- CadCraft
- BimCraft
-
Fast Fourier transform
The in-place radix-2 transform used on each axis of the charge mesh.
Molecular dynamics molecular/pme.js64-bit- CadCraft
- BimCraft
-
Cardinal B-spline
The weight of a charge on a mesh point.
M₂(u) = 1 − |u − 1|; Mₙ(u) = u ÷ (n−1) × Mₙ₋₁(u) + (n−u) ÷ (n−1) × Mₙ₋₁(u−1)
Molecular dynamics molecular/pme.js64-bit- CadCraft
- BimCraft
-
B-spline moduli
The correction 1 ÷ |b(m)|² applied to each mesh wave vector.
Molecular dynamics molecular/pme.js64-bit- CadCraft
- BimCraft
-
Particle-mesh Ewald energy and forces
The reciprocal Coulomb energy and the force on every charge from a mesh instead of the plain sum.
E = ½ Σ_m G(m) |Q̂(m)|², G = ke ÷ (πV) × exp(−π² m² ÷ α²) ÷ m² × B(m)
Molecular dynamics molecular/pme.js64-bit- CadCraft
- BimCraft
-
Rigid bonds
Moves atoms after a step so each constrained bond has its set length, and corrects the velocities.
g = (d² − r²) ÷ (2 (1÷mᵢ + 1÷mⱼ) r·s); stop when |d² − r²| ≤ 2 × tol × d²
Molecular dynamics molecular/pme.js64-bit- CadCraft
- BimCraft
-
Mean and standard error of a run
The mean of the samples and its standard error by block averaging.
mean = Σx ÷ n; error = √(Σ(blockᵢ − m)² ÷ (nb − 1) ÷ nb), nb = min(5, n) blocks of ⌊n ÷ nb⌋ samples
Molecular dynamics molecular/props.js64-bit- CadCraft
- BimCraft
-
Run results as component properties
The liquid density and diffusion coefficient of a run in SI units for a process component.
ρ (kg/m³) = ρ (g/cm³) × 1000; D (m²/s) = D (Ų/ps) × 1e-8
Molecular dynamics molecular/props.js64-bit- CadCraft
- BimCraft
-
Linear solve
x from A x = b for a small dense system.
Gaussian elimination with row exchange on the largest pivot, then back substitution
Solvers shared by the process engine process/numeric.js64-bit- CadCraft
- BimCraft
-
Newton iteration
The solution of a set of nonlinear equations F(x) = 0.
J Δx = −F, Jᵢⱼ ≈ (Fᵢ(x + h eⱼ) − Fᵢ(x)) ÷ h, h = 1e-7 × max(|xⱼ|, 1e-6); x ← x + λ Δx, λ halved until |F| falls
Solvers shared by the process engine process/numeric.js64-bit- CadCraft
- BimCraft
-
Adaptive Runge–Kutta integration
y(x₁) for a system of ordinary differential equations, with the accepted points along the way.
Dormand–Prince 5(4): error = max |h Σ(b₅ − b₄)k| ÷ (atol + rtol × max(|y|, |y_new|)) ≤ 1; h ← h × clamp(0.9 × error^(−0.2), 0.2, 5)
Solvers shared by the process engine process/numeric.js64-bit- CadCraft
- BimCraft
-
Bracketed root
A root of one equation between two points where the function changes sign.
c = (f_a b − f_b a) ÷ (f_a − f_b); the retained end's value is halved when the same side is kept twice
Solvers shared by the process engine process/numeric.js64-bit- CadCraft
- BimCraft
-
Temperature form of the parameters
The interaction parameter of each pair at a temperature.
pᵢⱼ = aᵢⱼ + bᵢⱼ ÷ T; 0 on the diagonal
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
NRTL
ln γ of every component by the NRTL model.
ln γᵢ = Cᵢ ÷ Sᵢ + Σⱼ xⱼ Gᵢⱼ ÷ Sⱼ × (τᵢⱼ − Cⱼ ÷ Sⱼ), Gᵢⱼ = exp(−αᵢⱼ τᵢⱼ), Sⱼ = Σ xₖ Gₖⱼ, Cⱼ = Σ xₘ τₘⱼ Gₘⱼ
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
Wilson
ln γ of every component by the Wilson model.
ln γᵢ = 1 − ln(Σⱼ xⱼ Λᵢⱼ) − Σₖ xₖ Λₖᵢ ÷ Σⱼ xⱼ Λₖⱼ
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
UNIQUAC
ln γ of every component by the UNIQUAC model.
ln γᵢ = ln(φᵢ÷xᵢ) + z⁄2 qᵢ ln(θᵢ÷φᵢ) + lᵢ − φᵢ÷xᵢ Σ xⱼlⱼ + qᵢ (1 − ln Σ θⱼτⱼᵢ − Σ θⱼτᵢⱼ ÷ Σ θₖτₖⱼ)
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
Infinite-dilution limits
The closed-form ln γ of each component of a binary when it is infinitely dilute.
NRTL: ln γ₁^∞ = τ₂₁ + τ₁₂ exp(−α τ₁₂); Wilson: ln γ₁^∞ = 1 − ln Λ₁₂ − Λ₂₁
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
Henry's constant at temperature
Henry's constant of a dissolved gas in pascals at a temperature.
H(T) = H₂₉₈ (bar) × 1e5 × exp(slope × (1 ÷ T − 1 ÷ 298.15))
Activity coefficients and Henry's law process/activity.js64-bit- CadCraft
- BimCraft
-
Model constants
The constants of the two equations of state and the correlation for κ(ω).
PR: Ω_a = 0.45724, Ω_b = 0.07780, σ = 1 + √2, ε = 1 − √2; SRK: Ω_a = 0.42748, Ω_b = 0.08664
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Real roots of a cubic
The real roots of z³ + c₂z² + c₁z + c₀ = 0 in ascending order.
p = c₁ − c₂² ÷ 3; q = 2c₂³ ÷ 27 − c₂c₁ ÷ 3 + c₀; disc = q² ÷ 4 + p³ ÷ 27; one root: ∛(−q⁄2 + √disc) + ∛(−q⁄2 − √disc) − c₂⁄3; three: 2√(−p⁄3) cos((acos(arg) − 2πk) ÷ 3) − c₂⁄3
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Attraction parameter of each component
a(T) and its temperature derivative for every pure component.
aᵢ = a_c,ᵢ (1 + κᵢ (1 − √(T ÷ T_c,ᵢ)))²; daᵢ/dT = −a_c,ᵢ κᵢ (1 + κᵢ(1 − √(T÷T_c))) ÷ √(T T_c,ᵢ)
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Mixture parameters
a, da/dT and b of a mixture of given composition.
a = Σᵢ Σⱼ yᵢ yⱼ √(aᵢ aⱼ) (1 − kᵢⱼ); b = Σ yᵢ bᵢ
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Compressibility roots
The physical compressibility factors of a mixture at a temperature and pressure.
β = bP ÷ RT; A = aP ÷ (RT)²; Z³ + c₂Z² + c₁Z + c₀ = 0 with c from β, A, ε, σ; keep Z > β (1 + 1e-12)
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Fugacity coefficients
ln φ of every component for one compressibility root.
ln φᵢ = bᵢ⁄b (Z − 1) − ln(Z − β) − a ÷ (bRT) × (2 Σⱼ yⱼ aᵢⱼ ÷ a − bᵢ⁄b) × I, I = ln((Z + σβ) ÷ (Z + εβ)) ÷ (σ − ε)
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Enthalpy and entropy departures
How far a real phase's enthalpy and entropy are from the ideal gas at the same temperature and pressure.
H − H_ig = RT (Z − 1) + (T da/dT − a) ÷ b × I; S − S_ig = R ln(Z − β) + (da/dT) ÷ b × I
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Vapor pressure of a pure component
The pressure at which the liquid and vapor roots of one component have equal fugacity.
P ← P × exp(ln φ_L − ln φ_V) until |ln φ_L − ln φ_V| < 1e-12
Cubic equations of state process/eos.js64-bit- CadCraft
- BimCraft
-
Ideal-gas enthalpy
The ideal-gas enthalpy of a component, with its formation enthalpy, at a temperature.
H = h_f + R (A (T − T₀) + B⁄2 (T² − T₀²) + C⁄3 (T³ − T₀³) − D (1⁄T − 1⁄T₀))
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Ideal-gas entropy
The ideal-gas entropy of a component at a temperature, relative to 298.15 K.
S = R (A ln(T ÷ T₀) + B (T − T₀) + C⁄2 (T² − T₀²) − D⁄2 (1⁄T² − 1⁄T₀²))
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Vapor pressure for the ideal and activity models
The vapor pressure of a component from its Antoine constants, or an estimate when it has none.
P = exp(A − B ÷ (T + C)); without Antoine: P = P_c exp(5.373 (1 + ω)(1 − T_c ÷ T))
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Heat of vaporization
The heat of vaporization of a component at a temperature.
ΔH(T) = ΔH(T_b) × ((1 − T⁄T_c) ÷ (1 − T_b⁄T_c))^0.38
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Liquid molar volume
The saturated liquid volume of a component for the ideal and activity models.
V = R T_c ÷ P_c × Z_ra^(1 + (1 − T_r)^(2⁄7)), Z_ra = 0.29056 − 0.08775 ω
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Enthalpy, entropy and volume of one phase
The molar enthalpy, entropy and volume of a liquid or vapor of given composition.
EOS: H = Σ xᵢ H_ig,ᵢ + departure; V = ZRT ÷ P. Activity liquid: H = Σ xᵢ (H_ig,ᵢ − ΔH_vap,ᵢ) + H^E, H^E = −RT² Σ xᵢ ∂ln γᵢ⁄∂T
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
K-values
ln K of every component between a liquid and a vapor composition.
EOS: ln Kᵢ = ln φᵢ(liquid) − ln φᵢ(vapor); activity: ln Kᵢ = ln γᵢ + ln(P_sat,ᵢ ÷ P), or ln(Hᵢ ÷ P) for a Henry solute
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Vapor fraction (Rachford–Rice)
The vapor fraction that balances a feed for given K-values.
Σ zᵢ (Kᵢ − 1) ÷ (1 + V (Kᵢ − 1)) = 0, 0 ≤ V ≤ 1
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
-
Phase stability test
Whether a mixture at a temperature and pressure stays one phase or splits.
Yᵢ ← exp(ln zᵢ + ln φᵢ(z) − ln φᵢ(y)); unstable when ΣY > 1 + 1e-8
Property package and flashes process/thermo.js64-bit- CadCraft
- BimCraft
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.