Benoît Jacob ([info]bjacob) wrote,
@ 2006-11-17 10:23:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Entry tags:kalzium 3d eigen kde

First benefits of using Eigen for Kalzium
In Kalzium's 3D viewer, a problem was that when you loaded a molecule, the default viewpoint was not always optimal, sometimes totally unreadable. For instance, look at this molecule of L-tryptophan :
L-tryptophan, bad viewpoint
Of course, Kalzium always allowed to freely rotate around the molecule, so after some mouse effort, you could get that:
L-tryptophan, bad double bonds orientation
But then, a second problem appears: depending on the viewing angle, double bonds can look like single bonds. In the above pic, one should see 6 double bonds. This even mislead some people into believing that our molecule files were wrong! So I sat down and figured that the first thing to do was to perform a linear regression to compute the best-fitting plane for the molecule. Once we know that plane, elementary geometry allows to find a nice viewpoint and to orient the multiple bonds in a convenient way. So I implemented linear regression and a computeFittingHyperplane function in Eigen, and reworked Kalzium's 3D viewer to make use of it. Result:
L-tryptophan, nice viewpoint, nice double bonds :)
I haven't had to do any manual rotation for this screenshot, this is the exact viewpoint you get when you load the molecule. Also note that now the 6 double bonds clearly appear. Maximizing the window, I got this.

About speed: for these screenies, I take the high-quality mode, and get 56 FPS on my software-only (no hardware acceleration) 1.66 GHz Intel Core 1. In low-quality mode, I get 178 FPS, and at this window size, the visual difference is not too big. Even on Carsten's laptop, it runs OK ;)

Update: as a comment pointed out, the molecule file is wrong, there is one hydrogen atom missing and one double bond too much. This was a bug in the (very old) molecule file that I used, and has been fixed since in the BlueObelisk project.



(Post a new comment)

My Laptop
[info]cniehaus
2006-11-17 09:31 am UTC (link)
To put it into perspective: My laptop has only 256mb RAM and 1200MHz and no 3D-stuff at all. The 3D-stuff in Kalzium still runs nicely!

(Reply to this)(Thread)

Re: My Laptop
(Anonymous)
2006-11-17 10:15 am UTC (link)
i still wonder if it would be possible to do something about the jagged lines... some anti-aliasing wouldn't hurt?!? is that even possible? even beryl/compiz look bad because of those lines.

anyway, kalzium doesn't compile for me, hasn't since a long time. i get:
[ 71%] Generating solver.o
/bin/sh: -output-obj: command not found
make[2]: *** [kalzium/src/solver.o] Error 127

this is with the latest cmake cvs, latest openbabel svn, latest kalzium svn, etcetera... i use kdesvn-build, running cmake directly always leads to a:
CMake Error: Error in cmake code at
/home/kde4/kdesvn/kdeedu/kalzium/src/CMakeLists.txt:68:
Unknown CMake command "kde4_automoc"

any idea what is wrong?!? i can't find anything...

(Reply to this)(Parent)(Thread)

Re: My Laptop
[info]bjacob
2006-11-17 10:27 am UTC (link)
Carsten, can you answer this one?

(Reply to this)(Parent)

Re: My Laptop
[info]cniehaus
2006-11-17 10:27 am UTC (link)
the kde4_automoc-error looks like a kdelibs-thing. Perhaps it is outdated or not installed?

the solver.o-thing looks a lot like a missing OCaml-binary. Of course FindOCaml.cmake should report that, but perhaps there is a bug in the macro... I just tested if Kalzium compiles here and it does.
Please check the cmake-messages and report back.

(Reply to this)(Parent)(Thread)

Re: My Laptop
(Anonymous)
2006-11-17 10:40 am UTC (link)
well, the automoc error is weird, i guess if you install kde 4 with kdesvn-build, and go to one of the folders withs source, "mkdir build && cd build && cmake .." should work. anyway, this is not such a bad thing, kdesvn-build at least compiles stuff...

about the solver.o thing, I have ocaml 3.09.3, guess that's not the problem. this prob has been here for a long time, btw, my kalzium trunk never compiled for me with openbabel 2.1 and the 3d stuff... always bailed out on the solver.o thingy.

what info could help fix this? i did find this in ~/kdesvn/build/kdeedu/kalzium/src/CMakeFiles/kalzium.dir/build.make
kalzium/src/solver.o: kalzium/src/calc.cmx
$(CMAKE_COMMAND) -E cmake_progress_report /home/kde4/kdesvn/build/kdeedu/CMakeFiles $(CMAKE_PROGRESS_33)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold "Generating solver.o"
cd /home/kde4/kdesvn/build/kdeedu/kalzium/src && -output-obj -o /home/kde4/kdesvn/build/kdeedu/kalzium/src/solver.o /usr/lib/ocaml/facile/facile.cmxa /home/kde4/kdesvn/build/kdeedu/kalzium/src/chemset.cmx /home/kde4/kdesvn/build/kdeedu/kalzium/src/parser.cmx /home/kde4/kdesvn/build/kdeedu/kalzium/src/lexer.cmx /home/kde4/kdesvn/build/kdeedu/kalzium/src/datastruct.cmx /home/kde4/kdesvn/build/kdeedu/kalzium/src/chem.cmx /home/kde4/kdesvn/build/kdeedu/kalzium/src/calc.cmx

guess -output-obj won't work indeed, something must be missing, right?

(Reply to this)(Parent)(Thread)

Re: My Laptop
[info]cniehaus
2006-11-17 02:49 pm UTC (link)
make[2]: Betrete Verzeichnis '/home/kde4/build/kdeedu'
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 28%] Generating chemset.cmi
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlc -o /home/kde4/build/kdeedu/kalzium/src/chemset.cmi -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/chemset.mli
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 28%] Generating chemset.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/chemset.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/chemset.ml
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles 8
[ 42%] Generating parser.cmi
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlc -o /home/kde4/build/kdeedu/kalzium/src/parser.cmi -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/parser.mli
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating parser.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/parser.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/parser.ml
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating lexer.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/lexer.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/lexer.ml
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating datastruct.cmi
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlc -o /home/kde4/build/kdeedu/kalzium/src/datastruct.cmi -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/datastruct.mli
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating datastruct.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/datastruct.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/datastruct.ml
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating chem.cmi
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlc -o /home/kde4/build/kdeedu/kalzium/src/chem.cmi -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/chem.mli
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating chem.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/chem.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/chem.ml
File "/home/carsten/svn/trunk/kdeedu/kalzium/src/solver/chem.ml", line 54, characters 43-54:
Warning Y: unused variable nb_elements.
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating calc.cmi
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlc -o /home/kde4/build/kdeedu/kalzium/src/calc.cmi -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/calc.mli
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating calc.cmx
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -o /home/kde4/build/kdeedu/kalzium/src/calc.cmx -I +facile -c /home/carsten/svn/trunk/kdeedu/kalzium/src/solver/calc.ml
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating solver.o
cd /home/kde4/build/kdeedu/kalzium/src && /usr/bin/ocamlopt -output-obj -o /home/kde4/build/kdeedu/kalzium/src/solver.o /usr/lib/ocaml/3.09.2/facile/facile.cmxa /home/kde4/build/kdeedu/kalzium/src/chemset.cmx /home/kde4/build/kdeedu/kalzium/src/parser.cmx /home/kde4/build/kdeedu/kalzium/src/lexer.cmx /home/kde4/build/kdeedu/kalzium/src/datastruct.cmx /home/kde4/build/kdeedu/kalzium/src/chem.cmx /home/kde4/build/kdeedu/kalzium/src/calc.cmx
/usr/bin/cmake -E cmake_progress_report /home/kde4/build/kdeedu/CMakeFiles
[ 42%] Generating modwrap.o

(Reply to this)(Parent)(Thread)

Re: My Laptop
(Anonymous)
2006-11-17 06:23 pm UTC (link)
i did use cmake 2.4.3, now i use cvs - still no go. it seems in my cmake buildfile (i have no idea if it's a log of what it did, or if it's what it is GOING to do) /usr/bin/ocamlopt is missing before the -output-obj.

i know nothing of how cmake works, and how/when it creates this file... i've tried to fix it, which works, but now modwrap.o went wrong. i added /usr/bin/ocamlopt there too (similair problem) and kalzium is compiling right now.

but i now wonder how this file got generated wrongly?!? i do have the file /usr/bin/ocamlopt but it's not where it should be. i already removed the kalzium source folder, and the buildfolder, and restarted ksvn-build, but the same mistake came up. must be a bug in some cmake file, right? tough it's weird you don't get nor see it...

(Reply to this)(Parent)(Thread)

Re: My Laptop
[info]cniehaus
2006-11-17 07:00 pm UTC (link)
Well, I somehow guess your kdeedu/cmake/modules/* are outdated... The code works for at least 3 persons (including me), on 3 distros (Gentoo, Kubuntu, Debian SID).

(Reply to this)(Parent)

Re: My Laptop
[info]cniehaus
2006-11-17 02:51 pm UTC (link)
I hope my other post helps? You are using CMake 2.4.3? Did you read this page?

http://developer.kde.org/build/trunk.html

(Reply to this)(Parent)(Thread)

Re: My Laptop
(Anonymous)
2006-11-17 06:26 pm UTC (link)
every other kde app compiles and works, well, of course not all the time, but mostly. so i think it's some kalzium or cmake problem...

(Reply to this)(Parent)(Thread)

Re: My Laptop
[info]cniehaus
2006-11-17 06:56 pm UTC (link)
Kalzium is the only app which uses Eigen and OpenBabel and OCaml, so this is well possible... :(

(Reply to this)(Parent)

Jagged lines
[info]bjacob
2006-11-17 10:43 am UTC (link)
About the jagged lines: it is easy to turn on full-scene antialiasing, but that would be too slow on a software-only system. But yes, we might provide this as an option.

(Reply to this)(Parent)(Thread)

Re: Jagged lines
(Anonymous)
2006-11-17 03:35 pm UTC (link)
another option? Applications should be intelligent enough to decide whether to switch on/off feature xyz. In this case: If you have hardware acceleration, turn it on. If you have software but the pc is fast, turn it on. Otherwise: off :)

(Reply to this)(Parent)(Thread)

Re: Jagged lines
[info]bjacob
2006-11-17 04:13 pm UTC (link)
There is no reliable, letting alone portable, way of detecting whether there is OpenGL hardware acceleration.

I think I'll add another quality level, "Highest", with FSAA enabled.

(Reply to this)(Parent)

VutVXdlZeuvVd
(Anonymous)
2008-06-22 11:11 pm UTC (link)
hHpUuX df1zv853gvrvb7gv94gmlas

(Reply to this)(Parent)

Double bonds...
(Anonymous)
2006-11-17 10:14 am UTC (link)
Wouldn't it be possible to make the double-bonds always "face" the camera? That way, you could rorate the molecule in any direction you wanted and you'd always see the double bonds correctly...

(Reply to this)(Thread)

Re: Double bonds...
[info]bjacob
2006-11-17 10:23 am UTC (link)
I see what you mean. We have considered that, but in the end we thought that it would look a bit strange. Another drawback would be that it would force to recompute the geometry on every redraw, while we're currently caching it in a OpenGL display list for better performance.

(Reply to this)(Parent)

Re: Double bonds...
(Anonymous)
2006-11-17 01:07 pm UTC (link)
Even better: Let the bonds rotate at 10 to 20 degrees per second.

(Reply to this)(Parent)(Thread)

Re: Double bonds...
[info]alanhorkan
2006-11-17 01:14 pm UTC (link)
Let the bonds rotate at 10 to 20 degrees per second.

I was also going to suggest a very slow rotation might help users disambiguate double bonds from overlapping pieces in the background.

(Reply to this)(Parent)

Awesome!
(Anonymous)
2006-11-17 10:16 am UTC (link)
It's in the little things Benoît. Keep up the good work! Too bad I know squat about chemistry and slept my way through chemistry classes in highschool :)

Aron Stansvik

(Reply to this)(Thread)

Re: Awesome!
[info]bjacob
2006-11-17 10:24 am UTC (link)
Thanks! Btw, I also slept during the chemistry classes. I'm doing only the math here, the chemistry is being done by Carsten and the OpenBabel library.

(Reply to this)(Parent)

Double bond
(Anonymous)
2006-11-17 10:24 am UTC (link)
Looks nice, but I think there are too many double bonds in the -COOH group. One of the CO bonds should be a single bond.

(Reply to this)(Thread)

Re: Double bond
[info]bjacob
2006-11-17 10:26 am UTC (link)
I don't know much in chemistry, but I think that there is no COOH group in this molecule. Look, no hydrogen atom is bound to an oxygen atom.

(Reply to this)(Parent)(Thread)

Woops!
[info]bjacob
2006-11-17 10:33 am UTC (link)
Actually, I think that you are right that there is a problem: The C has 5 bonds, I think that's impossible !

So yes, there's probably an error in this molecule file. I'll report it upstream. Many thanks for finding it!

(Reply to this)(Parent)(Thread)

Re: Woops!
[info]bjacob
2006-11-17 10:35 am UTC (link)
And looking at the wikipedia article, Tryptophan indeed has a COOH group. I'll report that upstream (we got our files from the BlueObelisk project).

(Reply to this)(Parent)(Thread)

Re: Woops!
(Anonymous)
2006-11-17 05:10 pm UTC (link)
The CML file is right. You can check it on line:
http://chem-file.sourceforge.net/amino_acids/2S-2-amino-3-1H-indol-3-yl_propanoic_acid_fr.html

The cml file is right:
<atom id="a5" elementType="O" x3="1.119617" y3="1.899386" z3="-4.118769"/>
<atom id="a27" elementType="H" x3="1.188957" y3="1.739266" z3="-5.054960"/>
<bond atomRefs2="a5 a27" order="1"/>

The mol file as the same information.

Can you send me the content of your structure file ?

Jerome Pansanel

(Reply to this)(Parent)(Thread)

Re: Woops!
[info]cniehaus
2006-11-17 05:18 pm UTC (link)
Or svn up BlueObelisk and try again. I guess you used an old version of the file with a bug in it...

(Reply to this)(Parent)(Thread)

Re: Woops!
[info]bjacob
2006-11-17 06:16 pm UTC (link)
Yes, I used the cml archive you sent me long ago. I'll get the latest files from blueobelisk and try again.

Jerome: I update my blog entry.

(Reply to this)(Parent)

Re: Woops!
[info]bjacob
2006-11-17 07:06 pm UTC (link)
OK, I have downloaded the latest files from BlueObelisk, and now it's fixed. Blog updated. Thanks !

(Reply to this)(Parent)

pharma best top
(Anonymous)
2007-10-09 01:55 am UTC (link)
Hello

G'night

(Reply to this)

Hello
(Anonymous)
2007-10-27 10:56 am UTC (link)
Hello!
How are you?

(Reply to this)

Viagra For Stamina: A Soldier's Best Friend?
(Anonymous)
2007-11-19 08:43 pm UTC (link)
Why you should buy vagra?
First of all, if you buy us gneric viagra you get quality service and great discounts!
Why would you need vigra sale?
Viagra in the first place make a uverenost, most of the problems are solved in the privacy of using our products. We will help you learn infinite possibilities in the intimate lives.
Why do you have to use our shop?
You pay only real value of the goods, without deductions resellers percent! Ordering viagr pharmacy us, you get free delivery and discounts on other products.
On our site you can order viagra onlie. The lowest price. Large discounts. Full anonymity. Free shipping.
More info about viagra onine you can be found on our website http://buy-viagra-for-love.info/index116.html

(Reply to this)

(Reply from suspended user)
My blog about pharma care
(Anonymous)
2008-01-25 06:02 pm UTC (link)
Why you should buy viaga info?
First of all, if you buy us viagra alternatve you get quality service and great discounts!
Why would you need pfizer viara?
Viagra in the first place make a uverenost, most of the problems are solved in the privacy of using our products. We will help you learn infinite possibilities in the intimate lives.
Why do you have to use our shop?
You pay only real value of the goods, without deductions resellers percent! Ordering cheap vagra us, you get free delivery and discounts on other products.
On our site you can order viagra oline. The lowest price. Large discounts. Full anonymity. Free shipping.
More info about viagra oline you can be found on our website http://buy-viagra-online-pharmacy-in-canada.info/buy-cheap-viagra-online-now/cheap-price-viagra.php

(Reply to this)

Help needed...
(Anonymous)
2008-02-23 06:20 am UTC (link)
Hi, nice post. Thanks.
Continue writing...

(Reply to this)

xrumer is the BEST!
(Anonymous)
2008-03-14 10:30 pm UTC (link)
X-Rumer is the BEST!

[img]http://upload.wikimedia.org/wikipedia/en/thumb/6/6b/XRumer_screenshot.gif/200px-XRumer_screenshot.gif[/img]

;)

(Reply to this)

My favourite pharma supermarket world-pharma.pillsfm.com
(Anonymous)
2008-03-22 05:46 pm UTC (link)
Go with me
Here is a few words about pharma business
http://world-pharma.pillsfm.com
My favourite pharma supermarket
WBR,
Alex

(Reply to this)

UIXlvnvvVvCLATRtF
(Anonymous)
2008-06-05 06:25 am UTC (link)
tickets_3.txt;2;2

(Reply to this)

eSLMVLYrcTzJXZO
(Anonymous)
2008-06-09 05:14 pm UTC (link)
great work great site thanks http://groups.google.us/group/linkmaps bye see you

(Reply to this)

jJEQNwVxNMsHRnNVz
(Anonymous)
2008-06-14 09:00 am UTC (link)
hi nice site thx http://google.us/group/nteens teen twink galleries >:(((

(Reply to this)

czdqbFguFSbDcWdyA
(Anonymous)
2008-06-14 09:06 am UTC (link)
Thanks funny site http://google.us/group/jteens teen quotes 931494

(Reply to this)

Free Unlimited Qualified Web Traffic
(Anonymous)
2008-06-20 11:53 am UTC (link)
Turn any website into an instant success with this powerful new software!
Mind-Blowing Technology Delivers An Endless Flood Of Traffic
To Your website automatically at the push of a button!
This software is real counter killer!
Your hits counter will explode! Traffic Add is a killer application.
If you are a serious webmaster - forget about other free or paid traffic generation methods.
Enjoy unlimited hits for life!

http://trafficadd.net

(Reply to this)

CUyJDyrUxUyroi
(Anonymous)
2008-06-23 06:47 am UTC (link)
umd9GI dfv078fnw8f934ndvkg2l

(Reply to this)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…