New answers tagged

3 votes
Accepted

Computing LJ force from LJ potential, or not?

Which one is computationally more accutate [sic] and why? The first one is more accurate. It uses the exact derivative of the LJ potential. By contrast, the second one not only uses a numerical ...
jjramsey's user avatar
  • 198
3 votes

How can I write a unit test for this routine?

Divide and conquer refactor your code, so that you have smaller methods with well defined purposes. Give these methods short descriptive names of what they are doing. You make the code more testable ...
MPIchael's user avatar
  • 2,621
4 votes

Understanding leapfrog integration algorithm

The first code is wrong if you have multiple particles that interact. Due to the structure of the loop, the interaction forces with particles at the start of the list are computed with the updated ...
Lutz Lehmann's user avatar
  • 5,249
5 votes
Accepted

Understanding leapfrog integration algorithm

In the second code the full time stepping is given by three lines in main() ...
user9794's user avatar
  • 465

Top 50 recent answers are included