huseyin tugrul buyukisik
huseyin tugrul buyukisik

Reputation: 11916

I need help for N-body molecular simulation performance!!(java applet)

I 've done some work on my graduation project and achieved several molecule structures + force calculation under Lennard-Jones potential and Coulomb potential + inter-molecular bonding(as in picture)

(http://img17.imageshack.us/img17/3133/simulasyon.png)

All done with Verlet algorithm in a single thread.

The problem is: i am using "calculations table"-array for quick answers to x^(3.5),x^(1.4), (1/x).... because it is very slow to compute with native methods of java. Array - access time is real high so i tried "unsafe()" methods and still very slow (only %10 performance gain).

Tried IntBuffer and DoubleBuffer and still no good.

Program calculates O(n) bond calculations, O(nlog(n)) Lennard-Jones (+ extra Pauli exclusion principle) and O(nlog(n)) Coulomb force calculations. Poor speed at 1500+ particles (and 7000+ bonds) .

I already checked where is the speed bottleneck(it is Lennard Jones + Coulomb). it takes 4 milliseconds for one time-step calculation at 1500 particles. I need it be 1 milliseconds.

Only if i could use arrays as fast as any other language(safe or not).

Also tried replacing divisions with multiplications and hashmaps and lists(same performance with arrays).

Do you know any other way of decreasing the time for calculation per timestep? Thank you. Computer: 2.0 GHz single-core intel, 1.2GB RAM, windows-XP SP-3 and Eclipse Indigo.

Upvotes: 1

Views: 299

Answers (1)

rocketblast
rocketblast

Reputation: 156

Instead of using a lookup tables, try using Chebyshev polynomials. Remember that you can exponentiate x^k in only ln(k) steps.

It may seem like a lot of operations, but the fact that in can be done without hitting memory (and therefore not affecting the cache) can make it significantly faster than a lookup table.

Upvotes: 1

Related Questions