def test_clusterStrain(self): '''Cluster with positive isotropic strain (using default)''' infile = self.get_input('h2o.gen') reffile = self.get_input('h2o.isostrain.gen') outfile = self.get_output('h2o.isostrain.gen') cmdargs = ['-o', outfile, infile, '10'] straingen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_periodic_relcoords(self): '''Periodic structure with relative coordinates''' infile = self.get_input('gaas-frac.gen') reffile = self.get_input('gaas-frac.234.gen') outfile = self.get_output('gaas-frac.234.gen') cmdargs = ['-o', outfile, infile, '2', '3', '4'] repeatgen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_clusterStrainXZ(self): '''Cluster with xz strain''' infile = self.get_input('h2o.gen') reffile = self.get_input('h2o.xz.gen') outfile = self.get_output('h2o.xz.gen') cmdargs = ['-o', outfile, '-c', 'xz', infile, '10'] straingen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_clusterStrainNegOpt(self): '''Cluster with negative isotropic strain (using explicit component)''' infile = self.get_input('h2o.gen') reffile = self.get_input('h2o.negisostrain.gen') outfile = self.get_output('h2o.negisostrain.gen') cmdargs = ['-o', outfile, '-c', 'I', infile, '-10'] straingen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_cluster(self): '''Absolute coordinates without external lattice vectors''' infile = self.get_input('h2o.234.xyz') reffile = self.get_input('h2o.234.gen') outfile = self.get_output('h2o.234.gen') cmdargs = ['-o', outfile, infile] xyz2gen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_cluster(self): '''Cluster with external lattice vector''' infile = self.get_input('h2o.gen') latticefile = self.get_input('h2o.latvecs') reffile = self.get_input('h2o.234.gen') outfile = self.get_output('h2o.234.gen') cmdargs = ['-o', outfile, '-l', latticefile, infile, '2', '3', '4'] repeatgen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_fraccoords_lattice(self): '''Fractional coordinates with external lattice vectors''' infile = self.get_input('gaas-frac.xyz') latticefile = self.get_input('gaas-frac.latvecs') reffile = self.get_input('gaas-frac.gen') outfile = self.get_output('gaas-frac.gen') cmdargs = ['-o', outfile, '-l', latticefile, '-f', infile] xyz2gen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_periodicabs_lattice(self): '''Absolute coordinates with external lattice vectors''' infile = self.get_input('h2o.xyz') latticefile = self.get_input('h2o.latvecs') reffile = self.get_input('h2o.gen') outfile = self.get_output('h2o.gen') cmdargs = ['-l', latticefile, '-o', outfile, infile] xyz2gen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_FracSuperStrain(self): '''Supercell (fractional) with positive isotropic strain (using default)''' infile = self.get_input('gaas-frac.gen') reffile = self.get_input('gaas-frac.isostrain.gen') outfile = self.get_output('gaas-frac.isostrain.gen') cmdargs = ['-o', outfile, infile, '10'] straingen.main(cmdargs) self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_stdout(self): '''When output goes to stdout instead of file.''' infile = self.get_input('gaas.gen') reffile = self.get_input('gaas.234.gen') outfile = self.get_output('gaas.234.gen') cmdargs = [infile, '2', '3', '4'] with common.OutputCatcher() as output: repeatgen.main(cmdargs) outfile = output.get_as_stringio() self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_stdout(self): '''When output goes to stdout instead of file.''' infile = self.get_input('h2o.gen') reffile = self.get_input('h2o.isostrain.gen') outfile = self.get_output('h2o.isostrain.gen') cmdargs = [infile, '10'] with common.OutputCatcher() as output: straingen.main(cmdargs) outfile = output.get_as_stringio() self.assertTrue(common.gen_file_equals(outfile, reffile))