コード例 #1
0
class MofParse_TestCase(unittest.TestCase):
    def setUp(self):
        """do MOF full cell"""

        #first replace the deuterium with a hydrogen molecule: 0.741/6.8354 = 0.108406238
        # so each H atom is located 0.054203119 above and below the deuterium center

        self.cifParser = CifParser('MOF74_neutron_4K_a-2H.cif')

    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)
        #assert coords==[['C', '0.00000', '0.00000', '0.00000'],
        #                ['C', '0.33333', '0.66667', '0.00000']]

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        #this is risky because of round off error problems
        print coords
        print len(coords)
        print cell
        sc = Supercell(coords, cell)  #, 1, 1, 1)#, coordType='cartesian')
        sc.i.m = 1
        sc.i.n = 1
        sc.i.l = 2
        sc.create()
        sc.writeSupCellXYZFile('MOF74_neutron_4K_a-2H-112.xyz')
コード例 #2
0
class MofParse_TestCase(unittest.TestCase):

    def setUp(self):
        """do MOF full cell"""
        
        #first replace the deuterium with a hydrogen molecule: 0.741/6.8354 = 0.108406238
        # so each H atom is located 0.054203119 above and below the deuterium center
        
        self.cifParser=CifParser('MOF74_neutron_4K_a-2H.cif')
        
    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)
        #assert coords==[['C', '0.00000', '0.00000', '0.00000'], 
        #                ['C', '0.33333', '0.66667', '0.00000']]

    def testAllCoords(self):
        coords=self.cifParser.generateAllCoordinates()
        cell=self.cifParser.getUnitCellAsVectors()
        #this is risky because of round off error problems
        print coords 
        print len(coords)
        print cell
        sc = Supercell(coords, cell)#, 1, 1, 1)#, coordType='cartesian')
        sc.i.m=1
        sc.i.n=1
        sc.i.l=2
        sc.create()
        sc.writeSupCellXYZFile('MOF74_neutron_4K_a-2H-112.xyz')
コード例 #3
0
class Li2B12H12Parse_TestCase(unittest.TestCase):
    def setUp(self):
        """do Li2B12H12 full cell"""
        self.cifParser = CifParser(os.getcwd() + os.sep + 'li2b12h12.cif')

    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        print 'li2b12h12'
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)
        sc.writeSupCellXYZFile(os.getcwd() + os.sep + 'li2b12h12.xyz')
コード例 #4
0
class Li2B12H12Parse_TestCase(unittest.TestCase):

    def setUp(self):
        """do Li2B12H12 full cell"""
        self.cifParser=CifParser(os.getcwd()+os.sep+'li2b12h12.cif')
        
    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        print 'li2b12h12' 
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)
        sc.writeSupCellXYZFile(os.getcwd()+os.sep+'li2b12h12.xyz')
コード例 #5
0
class LiBH4HexParse_TestCase(unittest.TestCase):
    def setUp(self):
        """do LiBH4 full cell"""
        #self.cifParser=CifParser(home+'/liBH4/hexagonal.cif')
        self.cifParser = CifParser(os.getcwd() + os.sep + 'hexagonal.cif')

    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        print 'hexagonal'
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)
        sc.writeSupCellXYZFile(os.getcwd() + os.sep + 'hexagonal.xyz')
コード例 #6
0
class LiBH4HexParse_TestCase(unittest.TestCase):

    def setUp(self):
        """do LiBH4 full cell"""
        #self.cifParser=CifParser(home+'/liBH4/hexagonal.cif')
        self.cifParser=CifParser(os.getcwd()+os.sep+'hexagonal.cif')
        
    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        #print coords
        #print len(coords)

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        print 'hexagonal'
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)
        sc.writeSupCellXYZFile(os.getcwd()+os.sep+'hexagonal.xyz')
コード例 #7
0
class LiBH4OrthoParse_TestCase(unittest.TestCase):
    def setUp(self):
        """do LiBH4 full cell"""

        self.cifParser = CifParser(os.getcwd() + os.sep + 'orthorhombic.cif')

    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        print "cif coords:"
        pprintCoords(coords)

    def testAllCoords(self):
        coords = self.cifParser.generateAllCoordinates()
        cell = self.cifParser.getUnitCellAsVectors()
        #this is risky because of round off error problems
        print "all coords:"
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)  #, coordType='cartesian')
        sc.writeSupCellXYZFile(os.getcwd() + os.sep + 'orthorhombic.xyz')
コード例 #8
0
class NaAlH4_TestCase(unittest.TestCase):

    def setUp(self):
        """do NaAlH4 full cell"""
        
        self.cifParser=CifParser(os.getcwd()+os.sep+'naalh4.cif')
        
    def testCoords(self):
        coords = self.cifParser.cifToAtomAndCoordinateList()
        print "cif coords:"
        pprintCoords(coords)

    def testAllCoords(self):
        coords=self.cifParser.generateAllCoordinates()
        cell=self.cifParser.getUnitCellAsVectors()
        #this is risky because of round off error problems
        print "all coords:"
        pprintCoords(coords)
        print len(coords)
        print cell
        sc = Supercell(coords, cell, 1, 1, 1)#, coordType='cartesian')
        sc.writeSupCellXYZFile(os.getcwd()+os.sep+'naalh4.xyz')