The attached files implement support for importing and exporting CAR files in NanoLanguage for ATK 2008.10.
There are two versions of CAR files, as seen from the header (first line), which will say "!BIOSYM archive 3" for version 3 and archive 1 for version 1. The script handles both. I'm not sure if there's a version 2, let me know if you come across it.
A simple usage example would be:
from ATK.KohnSham import *
from car import *
imported_configuration = importCARfile('testfile.car')
There is also an export function, which takes 4 parameters:
exportCARfile(filename, configuration, CARversion, configname)
where
CARversion and
configname are optional (default version is 3).
I wish to point out that this is a rather experimental first effort. I didn't have too many CAR files to test with... In particular, I don't know if the conversion of the unit cell shape works in all cases. Therefore, please do let me know of any problems you have using this tool (and naturally attach any CAR files that fail to import properly).
There is an explicit assumption that the first unit cell vector A lies along X, that A and B span the X/Y plane and that the angle between them is [tex]\gamma[/tex]. The third vector C follows from the definition of [tex]\alpha[/tex] and [tex]\beta[/tex] as the angles between B and C, and A and C, respectively.