def test_number_density_units(self):
     builder = MaterialBuilder()
     builder.setName('Bizarre oxide').setFormula('Al2 O3').setNumberDensity(
         0.23)
     builder.setNumberDensityUnit(NumberDensityUnit.FormulaUnits)
     material = builder.build()
     self.assertEqual(material.numberDensity, 0.23 * (2. + 3.))
Example #2
0
 def test_number_density_units(self):
     builder = MaterialBuilder()
     builder.setName(NAME).setFormula(FORMULA).setNumberDensity(NUMBER_DENSITY)
     builder.setNumberDensityUnit(NumberDensityUnit.FormulaUnits)
     material = builder.build()
     self.assertEqual(material.numberDensity, NUMBER_DENSITY * (2. + 3.))
     self.assertEqual(material.numberDensityEffective, NUMBER_DENSITY * (2. + 3.))
     self.assertEqual(material.packingFraction, 1.)
 def test_build_material(self):
     builder = MaterialBuilder()
     material = builder.setName('Bizarre oxide').setFormula('Al2 O3').setNumberDensity(0.23).build()
     self.assertEqual(material.name(), 'Bizarre oxide')
     formula = material.chemicalFormula()
     self.assertEqual(len(formula), 2)
     atoms = formula[0]
     multiplicities = formula[1]
     self.assertEqual(len(atoms), 2)
     self.assertEqual(atoms[0].symbol, 'Al')
     self.assertEqual(atoms[1].symbol, 'O')
     self.assertEqual(len(multiplicities), 2)
     self.assertEqual(multiplicities[0], 2)
     self.assertEqual(multiplicities[1], 3)
     self.assertEqual(material.numberDensity, 0.23)
 def test_build_material(self):
     builder = MaterialBuilder()
     material = builder.setName('Bizarre oxide').setFormula(
         'Al2 O3').setNumberDensity(0.23).build()
     self.assertEqual(material.name(), 'Bizarre oxide')
     formula = material.chemicalFormula()
     self.assertEqual(len(formula), 2)
     atoms = formula[0]
     multiplicities = formula[1]
     self.assertEqual(len(atoms), 2)
     self.assertEqual(atoms[0].symbol, 'Al')
     self.assertEqual(atoms[1].symbol, 'O')
     self.assertEqual(len(multiplicities), 2)
     self.assertEqual(multiplicities[0], 2)
     self.assertEqual(multiplicities[1], 3)
     self.assertEqual(material.numberDensity, 0.23)
Example #5
0
    def test_build_material(self):
        builder = MaterialBuilder()
        material = builder.setName(NAME).setFormula(FORMULA).setNumberDensity(NUMBER_DENSITY).build()
        self.assertEqual(material.name(), NAME)
        self.assertEqual(material.numberDensity, NUMBER_DENSITY)
        self.assertEqual(material.numberDensityEffective, NUMBER_DENSITY)
        self.assertEqual(material.packingFraction, 1.)

        formula = material.chemicalFormula()
        self.assertEqual(len(formula), 2)
        atoms = formula[0]
        multiplicities = formula[1]
        self.assertEqual(len(atoms), 2)
        self.assertEqual(atoms[0].symbol, 'Al')
        self.assertEqual(atoms[1].symbol, 'O')
        self.assertEqual(len(multiplicities), 2)
        self.assertEqual(multiplicities[0], 2)
        self.assertEqual(multiplicities[1], 3)
        self.assertEqual(material.numberDensity, NUMBER_DENSITY)
 def test_number_density_units(self):
     builder = MaterialBuilder()
     builder.setName('Bizarre oxide').setFormula('Al2 O3').setNumberDensity(0.23)
     builder.setNumberDensityUnit(NumberDensityUnit.FormulaUnits)
     material = builder.build()
     self.assertEqual(material.numberDensity, 0.23 * (2. + 3.))