<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!--**************************************************************************** * * * Viewmol * * * * N O D E 3 3 . H T M L * * * * Copyright (c) Joerg-R. Hill, October 2003 * * * ******************************************************************************** *--> <html> <head> <title>15 Programming Your Own Output Filter</title> <META NAME="description" CONTENT="15 Programming Your Own Output Filter"> <META NAME="keywords" CONTENT="viewmol"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="STYLESHEET" href="viewmol.css"> <link rel="first" href="viewmol.html"> </head> <body> <H1><A NAME="SECTION0001500000000000000000"> 15 Programming Your Own Output Filter</A> </H1> V<SMALL>IEWMOL</SMALL> can be easily adapted to write files in any format. All you have to do is to write a new output filter which formats the data provided by V<SMALL>IEWMOL</SMALL>. These output filters are stand-alone programs and can be written in every programming language you want. Examples in awk are included. <P> The output filter has to accept the following data from its standard input and write them to a file whose name is given as a command line parameter to the filter. V<SMALL>IEWMOL</SMALL> passes the following data groups to the output filter: <UL> <LI>the unit cell (if present) is sent in the following format (a, b, and c in atomic units, the angle in degrees) <dl><dd><pre class="verbatim"> $unitcell a b c alpha beta gamma </pre></dl> </LI> <LI>the cartesian coordinates are sent in the following format (in atomic units) <dl><dd><pre class="verbatim"> $coord x1 y1 z1 symbol1 x2 y2 z2 symbol2 ... </pre></dl> </LI> <LI>the bond information is sent in the following format <dl><dd><pre class="verbatim"> $bonds atom1 atom2 bond_order ... </pre></dl> where <code>atom1</code> and <code>atom2</code> are the numbers of the atoms according to the list in <code>$coord</code> which form the bond. <code>bond_order</code> is the actual order of the bond, -2 if the bond is part of a conjugated system, or -1 if it is a hydrogen bond. </LI> </UL> <code>$end</code> is passed to the output filter as last line. <P> <p><hr> <ADDRESS> <a href="mailto:joehill@users.sourceforge.net"><i>Jörg-Rüdiger Hill</i></a> Fri Oct 31 14:19:21 CET 2003 </ADDRESS> </BODY> </HTML>