summaryrefslogtreecommitdiff
path: root/sim/src/tests/floppy_organics/CreateTests.py
blob: a96fe319ff57019966e9a5663437a4d8f3fe8246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python

import os
import sys
import MmpFile
import XyzFile

damianFiles = filter(lambda x: x,
                     os.popen("ls C*.mmp").read().split("\n"))

for df in damianFiles:
    prefix = df[:df.index(".")]
    testPrefix = "test_" + prefix
    damianMmp = MmpFile.MmpFile()
    damianMmp.read(df)

    # Generate the xyzcmp file
    xyzcmpFilename = testPrefix + ".xyzcmp"
    outf = open(xyzcmpFilename, "w")
    xyzcmp = damianMmp.convertToXyz()
    xyzcmp.write(df, outf)
    outf.close()

    # Make a perturbed copy of the MMP, use it for test_{foo}.mmp
    dmClone = damianMmp.clone()
    dmClone.perturb()
    testMmpFilename = testPrefix + ".mmp"
    outf = open(testMmpFilename, "w")
    dmClone.write(outf)
    outf.close()

    # Create test_{foo}.test
    testTestFilename = testPrefix + ".test"
    outf = open(testTestFilename, "w")
    outf.write("TYPE struct\n")
    outf.close()

    print "Test input files generated for " + testPrefix