Q.038 - Can I display my reciprocal lattice in O ?

Category: S.038 - general hkl

Yes. The following solution is due to Morten:

It is easy to display the reciprocal lattice. Here is an awk script that will create an ODL file for you. This one reads a TNT hkl file and outputs an ODL file. If your reflections are in X-PLOR format, replace the /HKL/ in line 2 with /INDE/. Save this in a file hkl2odl.awk:

	BEGIN { print "begin recip" }
	/HKL/ { print "dot",$2,$3,$4 }
	END { print "end_object" }

Then:

	awk -f hkl2odl.awk < input.hkl > output.odl.

If you want to add axes or set the colour, you have to edit those in manually; for example:

 begin recip
 colour cyan
 move 0 0 0
 line -30 0 0
 move 0 0 0
 line 30 0 0
 move 0 0 0
 line 0 30 0
 move 0 0 0
 line 0 30 0
 move 0 0 0
 line 0 0 30
 colour magenta
 text 30 0 0 H=30
 text 0 30 0 K=30
 text 0 0 30 L=30
 colour red
 dot -25 1 19
 dot -25 1 20
 ...
 end_object

NOTE: DATAMAN can also generate an ODL file from a reflection dataset for you.