Archive for the 'Physics' Category

Gromacs Workshop

Posted in Activity, Physics 2 months ago

I know some of my readers are deeply interested in high performance computing and computational physics: this is a post for them. The conference I had mentioned in my previous post was the GROMACS Workshop on Advanced Simulation Methods.

Gromacs is a high performance simulation engine primarily for solving Newtonian dynamics (it also does normal mode analysis, structure minimization and mixed molecular mechanics-quantum mechanics simulations.) It was an industry leader in terms of raw single processor performance for many years, until Desmond from D.E. Shaw Research took over with their super-scalable algorithms (I’ve written about this before.) With Gromacs 4.0, they’ve fixed the scalability problems and with a variety of other algorithmic fixes, they are the top dog once again. Disclaimer: these are all claims by relevant parties and I have not verified them myself, though I’d love to do so unencumbered. Though the Gromacs 4.0 paper is published, I’ll only be writing about it when the actual product is released.

The focus of the workshop was on algorithms, though there were some applications too. I’m sure an applications person would have felt out of place, but I felt I had something to contribute in almost every topic that was discussed. I’m archiving the list of topics here for posterity:

  • The new domain decomposition parallelization in Gromacs 4.0, with some tips & tricks to get the most out of your hardware
  • Different methods to perform free energy calculations. Slow-growth, perturbations, Bennett Acceptance Ratio. Which protocol is most efficient, and what new things will be in Gromacs 4.0?
  • QM/MM. How do you mix Quantum Mechanics with Gromacs?
  • Virtual sites for hydrogen motion removal and long time-steps
  • Membrane protein simulations
  • Replica exchange, and extracting kinetic data from it
  • Local pressure extensions to Gromacs
  • Gromacs source code walk-through

The take home message: strong coupling between various pieces of the algorithm is anti-thesis to parallel scalability. The CPU industry seems to have hit a brick wall in terms of improving raw computational speed: the future is in multi-core. Therefore, remove the coupling with better algorithms and you are on your way to highly scalable and by definition superbly fast algorithms.

The timestep used in an integrator while solving a set of equations inherently determines the speed of the algorithm. Big timesteps will make the algorithm unstable as you your trajectory will not be able to follow the phase space manifold accurately (as a side note Euler-type integrators also become unstable as you make the timestep smaller, but this is the least of your worries with a non-symplectic integrator.) The Nyquist theorem determines the sampling rate, so removing fast (or high frequency) degrees of motion such as hydrogen bond vibrations with constraints on them is required for a big timestep. Usual constraints algorithms are coupled leading to undesirable non-scalable algorithms. The Gromacs developers have solved this with a new constraints algorithm called P-LINCS.

Fitting data with Python

Posted in Computing, Physics 6 months, 2 weeks ago

I’ve recently become a heavy user of the numerical capabilities of Python. I’ve written about my experiments before, but now I’m writing production quality code with numpy and matplotlib.

Mobility Temperature Plot

The above is an actual plot that I created for some Hall measurements I was doing. I was supposed for find functional relationships between temperature and majority charge carriers, which in my case were electrons because of the n-type doping. The simple case was a least squares fit: scipy.optimize.leastsq to the rescue. The more complicated part was solving a non-linear equation for roots and then doing a least squares fit. The root-finding module in scientific python provides lots of options. At this point, I can confidently say that this environment has more features than Octave.

Just today, I wanted to use the Fourier method on a differential equation (plug: the advantages of which are here) and numerical python with fft, fftshift and fftfreq are exact substitutes for their Matlab equivalents. You can also put actual LaTeX equations on plots, which is a major plus.

That is all.

Wisdom from Arnold

Posted in Physics 11 months, 3 weeks ago

All mathematics is divided into three parts: cryptography (paid for by CIA, KGB and the like), hydrodynamics (supported by manufacturers of atomic submarines) and celestial mechanics (financed by military and by other institutions dealing with missiles, such as NASA.).

Cryptography has generated number theory, algebraic geometry over finite fields, algebra (the creator of modern algebra, Viete, was the cryptographer of King Henry IV of France), combinatorics and computers.

Hydrodynamics procreated complex analysis, partial derivative equations, Lie groups and algebra theory, cohomology theory and scientific computing.

Celestial mechanics is the origin of dynamical systems, linear algebra, topology, variational calculus and symplectic geometry.

– Vladimir I. Arnold. Polymathematics: is mathematics a single science or a set of arts? In Mathematics: Frontiers and Perspectives. American Mathematical Society, 2000, pp. 403-416.

Vladimir Arnold is one of my favorite authors. He along-with Professor Jerrold E. Marsden must have written some of the best books on mechanics (this one and this one.) I’m writing the section connecting geodesics, metrics and Euler-Lagrange equations and I wasn’t sure how to introduce the material and looked to these books for inspiration.

Random Facts

Posted in Physics 1 year ago

Some random math facts that I came across last week.

Poincaré group

The Special Euclidean group combines rotations and translations in Euclidean space. The SE group is an isometry, which means it preserves angles and distances.

In special relativity, the 4-vectors are three space variables and one time variable. Rotations in this space can be generalized to the Poincaré group. Instead of having sines and cosines in the rotation part as in SE, they have hyperbolic sines and cosines.

The norm of a vector is defined through its inner product:

 ||x|| = \sqrt {\langle x,x \rangle}

which in special relativity is

 \langle (x,y,z,t), (x,y,z,t) \rangle = x^2 + y^2 + z^2 - t^2

A friend pointed out that the Lorentz transformation was only recently proved to be linear.

Geodesics and Metrics

One of the most beautiful things I learnt in the last few weeks is the connection between geodesics (shortest paths) and metrics in that space. If g(t) is a geodesic path and v(t) is the velocity of the path:

v(t) = \frac{d g(t)}{dt}

then the metric is defined by

d^2 = \int ||v(t)||^2 dt

Moreover, the path satisfies the Euler-Lagrange equation. This was first shown by Arnold in a hydrodynamical context, and subsequently borrowed by control systems and computer vision folks.

A Poor Joke

Two functions e^x and x^2 were going in a car. x^2 looked ahead and said, “Oh shit! There comes a differential operator.” e^x says with a smirk, “It can’t do nothing to me!” On approaching the differential operator, it says “Haha! I’m d/dy.”

As narrated to me by a random math major last week…

Best of CiSE

Posted in Physics 1 year, 3 months ago

Computing in Science & Engineering highlights the top 5 articles in honor of their 75th anniversary:

  • The Fast Fourier Transform for Experimentalists - Part I
  • Physlets for Quantum Mechanics
  • The Physical Basis of Computability
  • Ten Good Practices in Scientific Programming
  • The Metropolis Algorithm