Tommi wrote: >> Can you tell me a little about the ghemical? > > It's a molecular modelling program written in C++. Currently it is split > in 2 parts: > > libghemical : only contains the core functionality (no graphics [snip] > ghemical : contains a GUI part for gnome.
So, there is no 'command line' version. A actually assumed that it was a command-line tool. >> What is the input format? > > There is a native file format, and many other file formats are > accessible through file import/export capabilities that depend on > OpenBabel. > > However, I think none of the file formats directly fit into the plugin > use, and a new communication protocol is needed. Since it has a native file format, I would recommend using exactly that format to send the data over the wire. - you can be assured of having full access to ghemical functionality - we have to format the data some way to send it over the wire - you can easily grab the code the IO code from the ghemical UI side - you can start development on the server cgi today ... just redirect stdin to come from a standard ghemical file - Egon might make an argument to send it over the wire in CML - later on you may want to change the file format that you send of the wire, but you should take the simplest approach to get started. >> > I'll learn about cgi and web servers before I start anything at the >> server side. >> >> Good. > > Yesterday evening I read a few tutorials about CGI, so here is the > current plan (please correct if needed). > > Indeed using CGI we can achieve more or less the situation where > inputs/outputs of the plugin and the server are connected; the only > limitation seems to be that plugin can only send a single request and > only after the server has received it, it can send a single reply. But > this is not too bad, especially since it makes the server quite simple. Correct. > So the server would read standard input and write into standard output. > Now I see that it doesn't make sense to use the gnome/bonobo > ghemical-server, but instead a completely separate server is needed. > Let's call it "ghemical-cgi"; it will be a rather simple C++ console > program that uses resources from libghemical. You should also make *sure* that it works from the command line. The cgi can detect whether or not it was launched from a web server. If it was not launched from the web server, then it should function properly ... use command line arguments or something. That way, you can do 95% of your development and debugging without involving the web server ... directly from the command line. > Later it could be > optimized into this purpose (say smaller size and on-demand loading of > parameter files). Correct. Including a daemon process that is automatically launched by the cgi and stays loaded in memory. But that is for down the road ... once you have the system fully operational. Then you can do some performance measuring to determine what kind of impact this would have. > So a web server should be installed and set functional, and the > ghemcal-cgi program should be copied into the cgi-bin directory. Then > the web server would launch it for each request separately, and connect > it into the plugin. Correct. > The plugin should ask user for server URL, say > > http://www.something.net or > http://www.something.net:80 > Well ... not really. The plugin will never ask to open a socket. > Then internally it should add to URL a path to the cgi program: > > http://www.something.net:80/cgi-bin/ghemical-cgi The plugin will simply ask java to open this URL, with the POST data. > Now if such a request is sent to the web server, it should launch the > ghemical-cgi program, right? Absolutely correct. Here is another big advantage of using a CGI and using the ghemical file format ... You can do *all* of your testing from a web browser. Your cgi will not be able to distinguish the JmolApplet from a web browser. You can write a 10 line .html file that will use the POST method to upload the contents of the form. Just Copy/Past a small ghemical file into the form and hit submit ... your cgi will receive the data and then send the results back to your web browser. If you do not understand this then *please* ask ... because it is very important. /* note that this is *not* using web-browser file-upload ... that would be a little more complicated and probably not worth doing */ > Ok then the web-server launches ghemical-cgi so that some environmental > variables are set. Now the request form plugin should be sent to the > ghemical-cgi program. Since the request can be a large one (it could > contain the structure of a peptide or a whole protein molecule perhaps) > the simple means are not enough; by this I mean ghemical-cgi should get > the request from standard input. That is correct ... ghemical-cgi will receive the data via stdin > How to do that then? My docs say that this the way it works if the html > request the plugin makes is of type POST. This is what I was referring to with the 'web browser'. You want to do something like this: [html] [body] [h1]ghemical-cgi test[h1] [form action='/cgi-bin/ghemical-cgi' method='post'] [input type='submit' value="submit to ghemical-cgi"][br /] [textarea name='datafile' rows='30' cols='70'][/textarea] [/form] [/body] [/html] > How this is done, is still a > bit unclear, and I'm studying it. Basically a socket should be opened to > > http://www.something.net:80 You never worry about opening sockets. The only thing you do is fetch URLs. Q: can you write simple shell scripts? Q: can you write perl? Before you start writing any C++ code I think that you should write a very simple cgi and make use it to configure your web server. Use google to search for printenv.sh Install this on your web server and test it from a web browser. Let me know when you get this done. > and a proper html request string should be sent that accesses > /cgi-bin/ghemical-cgi file using the POST method. The data to be sent is > included in this html request. The data should contain a description of > atoms and bonds, The data should be a ghemical file > and instructions to ghemical-cgi what to do with them. The instructions should be other parameters to the cgi. Also command line switches for command-line use. > The protocol could be something like this: > > -a header part for checking protocol versions etc. > "hello, I have a job for you" > > -descriptions of atoms/bonds etc. > "there a x atoms and y bonds ; atom0 = ... atom1 = ..." > > -the comp.chem. method to be used and related settings. > "use molecular mechanics" > "use a semi-empirical QM method, AM1, with total charge = 0" > > -instructions about the operation to be done. > "just calculate the energy" > "do a geom-optimization and send structures after each x steps" It is good that you are thinking of the operations that you need to perform. > At this stage ghemical-cgi knows what to do, and can start working. It > should add only a simple header to the data it sends using stdout to the > web server, and then it can send data directly to the plugin; the start > of the reply to web-server and finally to plugin is > > Content-type: text/plain > > this is the first line of reply to the plugin. correct > Then the plugin just reads and interprets the reply stream until it > ends. The ghemical-cgi process is shut down and the operation is ready. > > Any comments or enhancements? Sounds good. Let us know if you get stuck. Miguel ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Jmol-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jmol-developers
