Hi all, I have implemented a function that calculates one iteration of the velocity Verlet algorithm (with velocity tracking)[1] as an m-file and in C++. This algorithm is basic for the computation of molecular dynamics and belong to the class of symplectic integrators [2], in contrast to the standard Runge-Kutta methods.
The C++ code is here http://agora.panocha.org.mx/snippet/LDw1/ The m-file is here http://agora.panocha.org.mx/snippet/gG1h/ Using tic toc, the C++ code runs ~16 times faster. However, either code can be improved (the two codes are not exactly equivalent, C++ takes the interaction function in any format, while m-file only handles). Do you have any suggestions? I will be adding this code to the Mechanics package. Thanks Note: The global error of the algorithm of order two in the time-step for velocities and order four for positions. However, if the system integrated is Hamiltonian the energy of the approximation oscillates around the constant energy of the exactly solved system, with a global error bound of order two. The same goes for all other conserved quantities of the system like linear or angular momentum, that are always preserved or nearly preserved in a symplectic integrator. [1] http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet [2] http://en.wikipedia.org/wiki/Symplectic_integrator -- M. Sc. Juan Pablo Carbajal ----- PhD Student University of Zürich http://ailab.ifi.uzh.ch/carbajal/ ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
