@@ -199,49 +199,6 @@ function calculateKineticEnergy(velocities: Float64Array, masses: Float64Array,
199199 return { ke, temp }
200200}
201201
202- // Velocity Verlet position update
203- function velocityVerletPositions (
204- positions : Float64Array ,
205- velocities : Float64Array ,
206- forces : Float64Array ,
207- masses : Float64Array ,
208- numAtoms : number ,
209- dt : number
210- ) : void {
211- // r(t+dt) = r(t) + v(t)*dt + 0.5*a(t)*dt^2
212- // a = F/m with conversion factor
213- for ( let i = 0 ; i < numAtoms ; i ++ ) {
214- const mass = masses [ i ]
215- const accelFactor = EV_A_AMU_TO_A_FS2 / mass
216- for ( let j = 0 ; j < 3 ; j ++ ) {
217- const idx = i * 3 + j
218- const accel = forces [ idx ] * accelFactor // A/fs^2
219- positions [ idx ] += velocities [ idx ] * dt + 0.5 * accel * dt * dt
220- }
221- }
222- }
223-
224- // Velocity Verlet velocity update
225- function velocityVerletVelocities (
226- velocities : Float64Array ,
227- forcesOld : Float64Array ,
228- forcesNew : Float64Array ,
229- masses : Float64Array ,
230- numAtoms : number ,
231- dt : number
232- ) : void {
233- // v(t+dt) = v(t) + 0.5*(a(t) + a(t+dt))*dt
234- for ( let i = 0 ; i < numAtoms ; i ++ ) {
235- const mass = masses [ i ]
236- const accelFactor = EV_A_AMU_TO_A_FS2 / mass
237- for ( let j = 0 ; j < 3 ; j ++ ) {
238- const idx = i * 3 + j
239- const accelOld = forcesOld [ idx ] * accelFactor
240- const accelNew = forcesNew [ idx ] * accelFactor
241- velocities [ idx ] += 0.5 * ( accelOld + accelNew ) * dt
242- }
243- }
244- }
245202
246203// Berendsen thermostat velocity scaling
247204function berendsenThermostat (
@@ -494,7 +451,7 @@ function calculateMaxStress(stress: Float64Array): number {
494451// The cell gradient is: dE/dh = -V * stress * (h^-T) where h is the cell matrix
495452// For simplicity, we use: cell_force = -V * stress (works for orthogonal cells)
496453// Stress in eV/A^3, cell in A, so cell_force is in eV/A^2
497- function stressToCellForce ( stress : Float64Array , cell : Float64Array , volume : number ) : Float64Array {
454+ function stressToCellForce ( stress : Float64Array , _cell : Float64Array , volume : number ) : Float64Array {
498455 // Convert Voigt [xx, yy, zz, yz, xz, xy] to 3x3 symmetric tensor
499456 // Then multiply by -volume to get the "force" on the cell
500457 // For a general cell, the gradient is more complex, but this approximation works
0 commit comments