I am performing some research in Materials Science and am in need of some help. I have a list of about 50 files, each with a column of some 1500 numbers. The numbers in the files pertain to x coordinates for locations of molecules for a number of different rows. A simple example is given below:


In this example, there are four molecules and three rows. In row one, the four molecules have coordinates 1,2,3,4; in row two, 1.1, 2.3, 3.1, 4.5 and so on for row three. This is obviously much simplified, but this is the basic idea. In all, I have 53 of these files, with 30 rows and 50 molecules (x coordinates). These 53 files represent different timesteps for the material. Is there a way to have OpenGL plot these coordinates and then animate them through the 53 timesteps? Any help would be appreciated (I’m just getting started with OpenGL).

Thank you,

Sure its possible. I don’t know what these quantities represent (displacement, activity, coercivity, etc.) but they are seemingly scalars. So you could easily use OpenGL to draw a grid of color coded tiles and vary the color of each tile over time. Then again, this might be easier to do in Maple or Mathematica.


as an aside, have you heard of a program called Visual Molecular Dynamics? (not too sure about the Dynamics part, but it’s called VMD at least It’s some visualisation software to look at molecules. I don’t use it myself, but I’ve helped set it up on our SGI VR suite so the chemists can play with it. Just thought you might be interested to know…

Annnd… to answer your question…

I’m not too sure about the coloured tile theory. From what I gather, all he has is x-coordinates… ie. the position of the molecule over time in one dimension. I gather he’s got a second, static dimension (ie. the number of rows). this to me suggests nothing more complicated than a bar graph.

ie. if you have your dataset encoded like

GLfloat molecules[col][row][time];

then you know the x position for molecule col in row row at time time.
In your example,




where the last index is effectively the file number.

Now, if you wanted to plot this data, well… hmm.

for(i=0; i<3; i++) {
for(j=0; j<4; j++) {
glVertex3f(j, i, molecules[j][i][time]);

or something. hey, i’, just makin’ it up as I go along.

hope this helps!


I prefer the simplest approach to visualization. Since the data is merely a scalar field, it is easiet to visualize it as a density graph. I used to work with something very similar, simulations of coercivity response of thin films in weak magnetic fields. Where we simulated rows and columns of spin domains within the film over time. And we always called the coercivity (actually a related quantity that was proportional to it) x. So from my line of thought, x does not always mean displacement. But that doesn’t really matter. Either way, density graph, bar graph, or anything else that can represent a set of scalars will do just fine.