Example #1
0
def test_sqs_finds_correct_endmember_symmetry():
    """SQS shouldd correctly find endmember symmetry."""
    fcc_l12 = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    assert fcc_l12.get_endmember_space_group_info()[0] == 'Pm-3m'

    rocksalt_b1 = lat_in_to_sqs(ATAT_ROCKSALT_B1_LATTICE_IN)
    assert rocksalt_b1.get_endmember_space_group_info()[0] == 'Fm-3m'
Example #2
0
def test_enumerating_sqs_with_lower_order_subl_raises():
    """If a lower order sublattice model is passed be enumerated in an SQS, it should raise."""
    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Fe'], ['Al']])
    assert len(structures) == 1

    structure = lat_in_to_sqs(ATAT_FCC_A1_LEV3_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Fe', 'Ni']])
    assert len(structures) == 4
def test_sqs_is_properly_enumerated_for_a_higher_order_sublattice_model():
    """Tests that a sublattice model of higher order than an SQS properly enumerated"""
    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Al', 'Ni'], ['Fe', 'Cr']])
    assert len(structures) == 6

    structure = lat_in_to_sqs(ATAT_ROCKSALT_B1_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Al', 'Ni', 'Fe'], ['Fe', 'Ni', 'Cr']])
    assert len(structures) == 36
Example #4
0
def test_sqs_is_properly_enumerated_for_a_multiple_solution_sublattice_model():
    """Tests that a sublattice model with multiple solution sublattices is properly enumerated"""
    structure = lat_in_to_sqs(ATAT_ROCKSALT_B1_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Al', 'Ni'], ['Fe', 'Cr']])
    assert len(structures) == 9

    structure = lat_in_to_sqs(ATAT_ROCKSALT_B1_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Al', 'Ni'], ['Fe', 'Cr']])
    assert len(structures) == 9
    assert all([isinstance(s, PRLStructure) for s in structures])
def test_abstract_sqs_scales_volume_when_made_concrete():
    """SQS should scale in volume by default, but optionally not when made concrete"""

    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    concrete_structure = structure.get_concrete_sqs([['Fe', 'Ni'], ['Al']])
    assert np.isclose(concrete_structure.volume, 445.35213050176463)
    assert np.isclose(concrete_structure.density, 4.12275)

    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    concrete_structure = structure.get_concrete_sqs([['Fe', 'Ni'], ['Al']], scale_volume=False)
    assert np.isclose(concrete_structure.volume, 8.0)
def test_abstract_sqs_is_properly_substituted_with_sublattice_model():
    """Test that an abstract SQS can correctly be make concrete."""
    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)

    concrete_structure = structure.get_concrete_sqs([['Fe', 'Ni'], ['Al']])
    assert {s.symbol for s in concrete_structure.types_of_specie} == {'Al', 'Fe', 'Ni'}
    assert np.all(concrete_structure.espei_sublattice_occupancies == [[0.5, 0.5] ,1])
    assert np.all(concrete_structure.sublattice_site_ratios == [2, 6])

    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    concrete_structure = structure.get_concrete_sqs([['Al', 'Al'], ['Al']])
    assert np.all(concrete_structure.sublattice_configuration == [['Al'], ['Al']])
    assert np.all(concrete_structure.espei_sublattice_configuration == ['Al', 'Al'])
    assert np.all(concrete_structure.espei_sublattice_occupancies == [1 ,1])
    assert {s.symbol for s in concrete_structure.types_of_specie} == {'Al'}
def test_atat_bestsqs_is_correctly_parsed_to_sqs():
    """lattice.in files in the ATAT format should be converted to SQS correctly."""
    structure = lat_in_to_sqs(ATAT_FCC_L12_LATTICE_IN)
    specie_types = {specie.symbol for specie in structure.types_of_specie}
    assert specie_types == {'Xaa', 'Xab', 'Xca'}
    assert np.all(structure.sublattice_model == [['a', 'b'], ['a']])
    assert structure.normalized_sublattice_site_ratios == [[0.125, 0.125], [0.75]]
    assert structure.sublattice_site_ratios == [[1, 1], [6]]
    assert np.all(structure._sublattice_names == ['a', 'c'])

    structure = lat_in_to_sqs(ATAT_ROCKSALT_B1_LATTICE_IN)
    specie_types = {specie.symbol for specie in structure.types_of_specie}
    assert specie_types == {'Xaa', 'Xab', 'Xba', 'Xbb'}
    assert np.all(structure.sublattice_model == [['a', 'b'], ['a', 'b']])
    assert structure.normalized_sublattice_site_ratios == [[0.25, 0.25], [0.25, 0.25]]
    assert structure.sublattice_site_ratios == [[1, 1], [1, 1]]
    assert np.all(structure._sublattice_names == ['a', 'b'])
def test_atat_bestsqs_is_correctly_parsed_to_sqs_with_multicharacter_sublattice():
    """lattice.in files in the ATAT format should be converted to SQS correctly."""
    structure = lat_in_to_sqs(ATAT_GA3PT5_LATTICE_IN)
    specie_types = {specie.symbol for specie in structure.types_of_specie}
    assert specie_types == {'Xaeja', 'Xbha'}
    assert np.all(structure.sublattice_model == [['a'], ['a']])
    assert structure.normalized_sublattice_site_ratios == [[0.625], [0.375]]
    assert structure.sublattice_site_ratios == [[5], [3]]
    assert np.all(structure._sublattice_names == ['aej', 'bh'])
    concrete_structure = structure.get_concrete_sqs([['Fe'], ['Ni']])
    assert np.all(concrete_structure.sublattice_configuration == [['Fe'], ['Ni']])
Example #9
0
def test_enumerating_sqs_without_symmetry():
    structure = lat_in_to_sqs(ATAT_GAMMA_L12_LATTICE_IN)
    structures = enumerate_sqs(structure, [['Fe', 'Ni', 'Al'], ['Al']])
    assert len(structures) == 9