Skip to content

Tutorials_and_problems

Oliver Stueker edited this page May 11, 2015 · 3 revisions

<<toc></toc>>


    • Warning:** a number of old tutorials which have not been checked recently but which may contain important information can be found at old_-_Tutorials_and_problems.

Table of Contents

First of all

You will need to have the following components installed to use the Quixote infrastructure:

 * [[http://www.oracle.com/technetwork/java/javase/downloads/index.html|Java]] JDK
 You can check if you have the jdk installed by running the following command at the command-line: **javac -version**
 If that gives a **command not found** type error, you need to install the Java Development Kit.
 * [[http://quixote.wikispot.org/Tutorials_and_problems#Maven|Maven]] for resolving Java dependencies. Check [[Maven]] for a basic tutorial and known problems.
 * [[http://mercurial.selenic.com/|Mercurial]] for interacting with software repositories. Check [[Mercurial]] for a basic tutorial and known problems.
 * [[http://sourceforge.net/projects/avogadro/files/avogadro/1.0.1/|Avogadro]] for visualizing the parsed output. Check [[Avogadro]] for instructions about how to install it.
 * A source code editor ([[http://www.jedit.org/|jEdit]], [[http://www.gnu.org/software/emacs/|Emacs]], etc.) or IDE (such as [[http://www.eclipse.org/|Eclipse]]).
 * A command-line window where to enter commands (Windows, Mac and Linux, all have it). The commands may, alternatively, be run from the IDE.

Some tricks of the trade

Conventions:

 * The root folder for the cloned project code will be identified by //&lt;project&#45;root&gt;//.

Useful commands:

 * Use a name of your choice for the folder that will contain the cloned project code:
 * Obtain source code changes from the original cloned repository; then compile, test and install everything again. Run from //&amp;lt;project&amp;#45;root&amp;gt;&amp;lt;/project&amp;#45;root&amp;gt&amp;lt;//:

at&gt;</project-root>the moment, the developing environment is a bit unstable, so, if you happen to have some problems with the tutorials here, it is sometimes a good idea to "restart" your environment before trying anything out. Some possible "restarting steps" are:

 * Delete your  folder and clone again:
 * Issue. If running the examples seems to be using an old version of the project software, try the following (from //&lt;project&#45;root&gt;//):

and Delete the hidden folder in your home.

JUMBO-Converters basic compiling and setup

Clone the JUMBO-converters repository with the command (be patient; it may take several minutes):

A jumbo-converters directory (this will be the //&lt;project&#45;root&gt;&lt;/project&#45;root&gt&lt;//)&gt;</project-root>will be created in the directory where you issued the command to clone the repository. Enter into this directory with:

Run the command:

This will download the java jar files required by the converters into your local maven repository (~/.m2/repository on unix), compile, test and install the code into your local maven repository. Everything will then be ready for using the JUMBO-Converters software.

Running JUMBO-Converters for NWChem and Gaussian

Gaussian

To use the Gaussian parser, cd into the //<project-root>/jumbo-converters-compchem/jumbo-converters-compchem-gaussian// directory.

and run the converter. With the command:

where **logfile.out** is the path to a gaussian logfile you wish to convert. This will then create a cml file named **logfile.cml** in the directory that the command was executed.

    • mvn exec:java** takes care of setting up the Java environment (the classpath) so as to locate all compiled files needed for the execution. For this to happen, the previous command must be executed at the jumbo-converters-compchem-gaussian folder.
The argument **-Dexec.mainClass** states the Java class to execute (in this case, the Gaussian converter), and the **-Dexec.args** argument passes the space-separated strings in the argument as arguments to the main class.

NWChem

To use the NWChem converter, go into the jumbo-converters-compchem-nwchem folder:

and run the converter (it will use a test file, and it will create as output the file :

This will take one of the nwchem output files in **jumbo-converters-compchem-nwchem/src/test/resources/compchem/nwchem/log/in/** and create cml file in the directory **jumbo-converters-compchem-nwchem/test** folder (for details of what happens, see the file src/main/java/org/xmlcml/cml/converters/compchem/nwchem/log/NWChemLog2CompchemConverter.java.

Status

Use this section to indicate if the tutorial works for you, if it doesn't, if you needed to do something differently, etc.:

 * Pablo Echenique, success&#33; MacOSX 10.6, 2011&#45;03&#45;22.
 * This tutorial has been checked on 2011&#45;05&#45;10 (Linux, Java 1.6, JUMBO&#45;Converters changeset 332:1db5c3ee0b74).
 * Bert, mostly success&#33; Windows7, 2011&#45;05&#45;11. When building the Quantum Expresso build fails.

How to run tutorial 1

"Tutorial 1" (which can be found at your local cloned //&lt;project&#45;root&gt;&lt;/project&#45;root&gt&lt;/jumbo-converters-core/tutorial/tutorial1.html//),&gt;</project-root>needs the following setup:

 * Go to the jumbo-converters-core folder:
 * Create an examples folder:
 * Copy the tutorial files there:
 * Run the tutorial program:

The result of the execution will be found at **examples/amber.out.xml**.

When modifying the template used, or when using a different input file, you should run the tutorial program with 3 arguments (in **-Dexec.args**) as follows:

First argument is the name of the template file, second one is the name of the input file, and the third and last one is the name of the output file.

Writing a small parser

At present, the JUMBO-Converters for compchem work in a declarative manner, i.e., you don't need to know Java to write a parser; you just need to know the output of your favourite compchem code, a bit of regular expressions and some very basic XPath (both of which you could even infer from already made examples). Then you edit some XML files that tell the JUMBO-Converters what they have to do and you are done.

Here, I will describe a small bit of Gaussian parsing and how to develop it. For more details, check JUMBO-Converters and the rest of tutorials in this page.

Also, see Declarative_parsing_syntax for a complete list of the rules followed by the parsers and their relations to the template XML files.

The first thing to know is that Gaussian runs are separated into **links**, which seem to be some kind of internal modules, each of which is in charge of a more or less conceptually bounded task. The important issue for us is that, if the calculation has been run with the #P level of verbosity, as in

then the points at which Gaussian enters or exits a link are clearly printed into the logfile; which is a very helpful feature for parsing.

For example, at the middle of the logfile that we will use in this tutorial,

you can read:

However, we will not try to parse now this obscure information about the 1-electron integrals. Instead, we will go for the molecular formula, which can be found in link 202, in the middle of it, in a line which begins by a space (as all lines in the logfile do) and the word **Stoichiometry**:

The minimal set of declarative XML files needed to parse this is as follows:

First you need a file called and located at

It contains the following code:

I.e., it includes a list of subtemplates which, in this example, contains only one item, , whose task is to capture and parse link 202, which is located at

and whose contents are:

The first two lines tell the JUMBO-Converters, through regular expressions, where link 202 begins and ends, respectively, and everything between those two matches is available for parsing in this file. Then, we see another templateList containing, again, only one item for this example, the file , which is located in the same folder as and contains:

In this case, we have no further lists of subtemplates and we just take the molecular formula. We detect the piece of text where it lies using and as before, and this leaves the lines between the two matches available for parsing. The tag parses the first line using another regular expression, and stores the formula string in a variable identified by .

If you now run the maven command in the previous tutorial:

from

this produces the file

which now contains the expected XML tagging:

Machine-specific known problems

 * If you are behind a proxy server, see [[Maven]] and [[Mercurial]].

MacOS

 * Pablo Echenique: I installed Maven and Mercurial from [[http://www.macports.org/|MacPorts]]
 * Pablo Echenique: You may have to include this line in your , or issue it in command line:
 * Pablo Echenique: [[http://www.redleopard.com/2009/04/macroman-encoding-creeps-into-maven/|It seems]] that MacOS is stupid enough as not to use UTF-8 as default encoding, which may cause problems. Therefore, you might want to add these lines to your  file at the top of your maven repository folder:

25/08/2011 meeting usecase

Machine

 * Desktop iMac
 * Running Mac OS X 10.7.1 "Lion"
 * Processor: 2.66 GHz Intel Core 2 Duo
 * Memory: 4 GB 1067 MHz DDR3

Preliminaries

 * I installed Maven, Mercurial and dos2unix from [[http://www.macports.org/|MacPorts]].
 * I included this line in my  to inform the compiling system where the proper path to Java is:

Installing jumbo-converters-compchem

 * I moved to a folder of my choice ( in my case, but this is not relevant) and cloned from the [[https://bitbucket.org/wwmm/jumbo-converters|wwmm BitBucket repository]]:
 * I removed all project artifacts that had been installed into my local maven repository (just in case):
 * I moved into the compchem part of jumbo-converters and issued the command for a clean installation:
 * This produces a lot of output, a final report with SUCCESS in all components

and it ends the installation of jumbo-converters-compchem in my machine.

Installing lensfield

 * I moved to  and cloned from the [[http://bitbucket.org/petermr/lensfieldjumbo|petermr BitBucket repository]]:
 * I got into the newly created folder, unpacked lensfield and fixed linebreaks and permissions of the main  script:
 * I placed a link to the  exectutable in my path:
 * I updated lensfield, finishing its instalation:
Clone this wiki locally