Total time: 358.778 s File: ./md_003.py Function: properties at line 159 Line # Hits Time Per Hit % Time Line Contents ============================================================== 159 @profile 160 def properties(p_num, d_num, pos, vel, mass): 161 162 50 164.0 3.3 0.0 import numpy as np 163 164 165 # compute force, potential, kinetic 166 50 351.0 7.0 0.0 force = np.zeros([ d_num, p_num ]) 167 50 153.0 3.1 0.0 rij = np.zeros(d_num) 168 169 50 30.0 0.6 0.0 potential = 0.0 170 171 25050 14447.0 0.6 0.0 for i in range(0, p_num): 172 173 # Compute the potential energy and forces 174 12525000 7036459.0 0.6 2.0 for j in range(0, p_num): 175 12500000 7730669.0 0.6 2.2 if (i != j): 176 # Compute RIJ, the displacement vector 177 49900000 33530834.0 0.7 9.3 for k in range(0, d_num): 178 37425000 39827594.0 1.1 11.1 rij[k] = pos[k,i] - pos[k,j] 179 # end for 180 181 # Compute D and D2, a distance and a truncated distance 182 12475000 7182783.0 0.6 2.0 d = 0.0 183 49900000 33037923.0 0.7 9.2 for k in range(0, d_num): 184 37425000 39131501.0 1.0 10.9 d = d + rij[k] ** 2 185 # end for 186 12475000 25236413.0 2.0 7.0 d = np.sqrt(d) 187 12475000 13375864.0 1.1 3.7 d2 = min(d, np.pi / 2.0) 188 189 # Attribute half of the total potential energy to particle J 190 12475000 31104186.0 2.5 8.7 potential = potential + 0.5 * np.sin(d2) * np.sin(d2) 191 192 # Add particle J's contribution to the force on particle I. 193 49900000 34782251.0 0.7 9.7 for k in range(0, d_num): 194 37425000 86664317.0 2.3 24.2 force[k,i] = force[k,i] - rij[k] * np.sin(2.0 * d2) / d 195 # end for 196 # end if 197 198 # end for 199 # end for 200 201 # Compute the kinetic energy 202 50 33.0 0.7 0.0 kinetic = 0.0 203 200 147.0 0.7 0.0 for k in range(0, d_num): 204 75150 44048.0 0.6 0.0 for j in range(0, p_num): 205 75000 78144.0 1.0 0.0 kinetic = kinetic + vel[k,j] ** 2 206 # end for 207 # end for 208 209 50 47.0 0.9 0.0 kinetic = 0.5 * mass * kinetic 210 211 50 37.0 0.7 0.0 return force, kinetic, potential