Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: jose gonzalez on February 12, 2012

Title: molecular display
Post by: jose gonzalez on February 12, 2012
I am trying to do a display molecular of pdb files in opengl  any idea?
Title: Re: molecular display
Post by: combatking0 on February 12, 2012
Do you want to read data from the pdb files?

What features of the molecule do you want to display?
Title: Re: molecular display
Post by: jose gonzalez on February 13, 2012
Do you want to read data from the pdb files?    yes

What features of the molecule do you want to display? atoms and  bonds (single, double and triple).  I am a teacher of chemistry in a high school in Mexico.  I want to make a program to display the molecules. I know there are programs that make it, but i want to do for myself.
I did one last weeks in borland C++ Builder but i want some ideas to add it.  My program rotate and zoom the molecule using the right and left mouse and display information about the molecule.

I am sorry for my english (I only speak spanish     >>>>  solo hablo espanol ) and i learn to make programs by selfteaching (autodidacta)   I added a attachment of a captured image of my program

Thanks
   
Title: Re: molecular display
Post by: jose gonzalez on February 13, 2012
I forgot to mention than i could do it thanks a code i got from steve cunningham.  The code of Steve works in glut and use the keyboard  but i change it to not use glut and it can mouse and buttons and run in win7.   (GLUT do not run in win7 >>> at least in my computer)
Title: Re: molecular display
Post by: combatking0 on February 15, 2012
My English is quite bad too.

Good to hear that you have found a solution to the problem.

This might not be what you're looking for this time, but I have been developing some animations of chemical reactions in Flash. I have attached the file. If you want me to, I can translate the labels into Spanish.
Title: Re: molecular display
Post by: jose gonzalez on February 16, 2012
 combatking0 gracias por tus ideas, de hecho estoy "trabajando" (para mi esto es un pasatiempo ) en este momento en un simulador de los estados fisicos de la materia y tu programa me ha dado una nueva manera de presentarlo. 
El programa display molecular que hice lo estoy mejorando para que tambien abra o lea otros formados como cml y mol, y los enlaces quimicos ya nos los quiero mostrar con
       glBegin(GL_LINE_STRIP);
       glVertex3f(atoms[startindex].x+2*DBGAP,atoms[startindex].y+2*DBGAP,
                  atoms[startindex].z+2*DBGAP);
       glVertex3f(atoms[endindex].x+2*DBGAP,atoms[endindex].y+2*DBGAP,
              atoms[endindex].z+2*DBGAP);
    glEnd();

sino con un cilindro que una dos puntos en el espacio
Title: Re: molecular display
Post by: jose gonzalez on February 16, 2012
this is the exe of my program display molecular.  I tried it in my computer in win 7 and works well but i would like to know how work in others computer and windows.    I'll appreciate your help. 
Thanks!!!


    >>>>> mas adelante ya subi la version mejorada que incluye el uso de gluCylinder    !!!!!!!!
Title: Re: molecular display
Post by: combatking0 on February 16, 2012
That's an impressive program. It runs well on my Windows XP laptop, with a 2.6GHz P4 Processor and 512MB of RAM.

It runs faster in Sticks Only mode, but my laptop is old. It will run faster on a newer computer, I'm sure.

I'm afraid I don't know anything about Freebasic, but your code looks like it works.

With your permission, I would like to show your program to our Science department - I work in a school, but I am not a teacher.

If you would like me to add any reactions to my program, please let me know, and I will update it.
Title: Re: molecular display
Post by: jose gonzalez on February 17, 2012
My program was made in C++ , not in Freebasic
Title: Re: molecular display
Post by: combatking0 on February 18, 2012
My fault - I hadn't read the third post fully.

Either way, it's a nice program which illustrates molecules in an easy to understand way.
Title: Re: molecular display
Post by: jose gonzalez on February 20, 2012
this is the exe of my program display molecular.  I tried it in my computer in win 7 and works well but i would like to know how work in others computer and windows.    I'll appreciate your help. 
Thanks!!!


    >>>>> mas adelante ya subi la version mejorada que incluye el uso de gluCylinder    !!!!!!!!

>>>> captured images of my progam DisplayMolecular in http://www.prepafdza1.com/jngv/jngv.html
Title: Re: molecular display
Post by: Kirl on February 20, 2012
Cool program Jose, looks great!  :clap:

It would be cool to visualise some reactions as well like CK0's program.
Title: Re: molecular display
Post by: combatking0 on February 20, 2012
3D reactions would be amazing :o
Title: Re: molecular display
Post by: jose gonzalez on February 21, 2012
I would like to build 3D reactions but I must to consider that theory of colisions and of the activate complex to know a reaction mechanism  of inorganic compounds.
And for for biochemical reaction like respiration, we must to understand the steps to convert glucose in CO2   (glucose->hexosaphosphate->triosephosphate->piruvate->CO2)

And the last step to build a 3D model of the reactions.

(I am sorry for my ugly english  I only speak spanish)

I am working in that direction (I am a Chemist).

Title: Re: molecular display
Post by: combatking0 on February 21, 2012
My program is very simplified, but I could add more detail.

Don't worry about your English - my Spanish is a lot worse by comparison.
Title: Re: molecular display
Post by: jose gonzalez on February 27, 2012
This is the new version of my program DisplayMolecular.

Now you can see the links between atoms in two colors
Title: Re: molecular display
Post by: combatking0 on February 27, 2012
That's quite a difference - may I show this to my Science department?
Title: Re: molecular display
Post by: Kirl on February 28, 2012
Very nice work!
Looks like the pivot point/ center axis for the Cholesterol molecule is a bit off though.

Also the camera rotation is a bit confusing, instead of rotating the model itself, I'd prefer the camera to rotate around it. Meaby you can make it so that the camera rotates around a selected point of the molecule?
Title: Re: molecular display
Post by: jose gonzalez on February 28, 2012
There is a problem with the cholesterol molecule, I am trying to fix it. I Downloaded this and the others molecules of internet and I have found (i think ) that there is not a standard about the position of the molecule (with  respect at the center of axis).

And about of rotating the model itself, I'd not prefer the camera to rotate around it because I am building a program about reaction mechanisms and this program is only one part.  Electrophilic addition,
electrophilic substitution and nucleophilic substitution (unimolecular and bimolecular) are the Reaction Mechanisms that i am trying to animate in 3D (It is a project for some weeks).
Title: Re: molecular display
Post by: Kirl on February 28, 2012
Looking forward to see it, good luck! :)
Title: Re: molecular display
Post by: jose gonzalez on February 29, 2012
Kirl
I resolved the cholesterol problem



ya resolvi el problema con la molecula de colesterol.  El problema era que inusualmente en el archivo de esta todas coordenadas de las posiciones de los atomos de "x" son positivas y las de "y" son negativas, y el codigo que yo tenia no consideraba esta situacion.
Title: Re: molecular display
Post by: spathi on April 06, 2012
GLUT does absolutely run in windows 7.  You have to install the GLUT libraries manually and put them in your link path and your compile command, eg. -lGLUT or the like.