@mat3ra/made 2026.8.7-0 → 2026.8.18-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/Material.d.ts +219 -0
- package/dist/js/Material.js +457 -0
- package/dist/js/basis/basis.d.ts +14 -9
- package/dist/js/basis/basis.js +15 -13
- package/dist/js/basis/constrained_basis.d.ts +9 -7
- package/dist/js/basis/constrained_basis.js +4 -4
- package/dist/js/generated/MaterialSchemaMixin.d.ts +5 -0
- package/dist/js/generated/MaterialSchemaMixin.js +69 -0
- package/dist/js/lattice/lattice.d.ts +4 -3
- package/dist/js/lattice/lattice.js +1 -2
- package/dist/js/made.d.ts +12 -12
- package/dist/js/made.js +38 -5
- package/dist/js/parsers/espresso.d.ts +2 -3
- package/dist/js/parsers/espresso.js +0 -1
- package/dist/js/parsers/native_format_parsers.d.ts +9 -8
- package/dist/js/parsers/native_format_parsers.js +6 -6
- package/dist/js/parsers/parsers.d.ts +6 -6
- package/dist/js/parsers/poscar.d.ts +5 -4
- package/dist/js/parsers/poscar.js +3 -2
- package/dist/js/parsers/xyz.d.ts +3 -5
- package/dist/js/parsers/xyz.js +3 -4
- package/dist/js/parsers/xyz_combinatorial_basis.js +3 -1
- package/dist/js/tools/basis.d.ts +1 -1
- package/dist/js/tools/index.d.ts +7 -7
- package/dist/js/tools/material.d.ts +1 -1
- package/dist/js/tools/material.js +8 -7
- package/dist/js/tools/supercell.d.ts +4 -5
- package/dist/js/tools/supercell.js +2 -4
- package/dist/js/tools/surface.d.ts +4 -4
- package/dist/js/tools/surface.js +2 -7
- package/package.json +12 -8
- package/.babelrc +0 -10
- package/.eslintrc.json +0 -11
- package/.gitattributes +0 -1
- package/.husky/post-checkout +0 -3
- package/.husky/post-commit +0 -3
- package/.husky/post-merge +0 -3
- package/.husky/pre-commit +0 -6
- package/.husky/pre-push +0 -3
- package/.mocharc.json +0 -5
- package/.pre-commit-config.yaml +0 -26
- package/.prettierignore +0 -2
- package/.prettierrc +0 -6
- package/AGENTS.md +0 -133
- package/MANIFEST.in +0 -1
- package/data/constants.json +0 -13
- package/data/reciprocal_paths.json +0 -111
- package/dist/js/material.d.ts +0 -169
- package/dist/js/material.js +0 -362
- package/images/made/tools/tools_diagram_general.png +0 -3
- package/images/made/tools/tools_diagram_interface.png +0 -3
- package/pyproject.toml +0 -123
- package/src/__init__.py +0 -0
- package/src/js/basis/basis.ts +0 -621
- package/src/js/basis/constrained_basis.ts +0 -114
- package/src/js/basis/coordinates.ts +0 -93
- package/src/js/basis/elements.ts +0 -24
- package/src/js/basis/helpers.ts +0 -20
- package/src/js/basis/labels.ts +0 -6
- package/src/js/cell/cell.ts +0 -150
- package/src/js/cell/conventional_cell.ts +0 -86
- package/src/js/cell/primitive_cell.ts +0 -166
- package/src/js/constants/molecule.ts +0 -18
- package/src/js/constants.ts +0 -4
- package/src/js/constraints/constraints.ts +0 -45
- package/src/js/lattice/lattice.ts +0 -306
- package/src/js/lattice/lattice_types.ts +0 -134
- package/src/js/lattice/reciprocal/lattice_reciprocal.ts +0 -193
- package/src/js/lattice/reciprocal/paths.ts +0 -39
- package/src/js/lattice/reciprocal/symmetry_points.ts +0 -886
- package/src/js/lattice/unit_cell.ts +0 -66
- package/src/js/made.ts +0 -62
- package/src/js/material.ts +0 -458
- package/src/js/parsers/cif.ts +0 -25
- package/src/js/parsers/errors.ts +0 -6
- package/src/js/parsers/espresso.ts +0 -30
- package/src/js/parsers/native_format_parsers.ts +0 -51
- package/src/js/parsers/parsers.ts +0 -13
- package/src/js/parsers/poscar.ts +0 -212
- package/src/js/parsers/xyz.ts +0 -187
- package/src/js/parsers/xyz_combinatorial_basis.ts +0 -265
- package/src/js/tools/basis.ts +0 -132
- package/src/js/tools/cell.ts +0 -41
- package/src/js/tools/index.ts +0 -11
- package/src/js/tools/material.ts +0 -62
- package/src/js/tools/supercell.ts +0 -88
- package/src/js/tools/surface.ts +0 -223
- package/src/py/__init__.py +0 -0
- package/src/py/mat3ra/__init__.py +0 -1
- package/src/py/mat3ra/made/__init__.py +0 -7
- package/src/py/mat3ra/made/basis/__init__.py +0 -255
- package/src/py/mat3ra/made/basis/coordinates.py +0 -43
- package/src/py/mat3ra/made/cell/__init__.py +0 -55
- package/src/py/mat3ra/made/cell/primitive_cell.py +0 -156
- package/src/py/mat3ra/made/data_helper.py +0 -5
- package/src/py/mat3ra/made/lattice.py +0 -195
- package/src/py/mat3ra/made/material.py +0 -134
- package/src/py/mat3ra/made/metadata.py +0 -45
- package/src/py/mat3ra/made/reciprocal/__init__.py +0 -5
- package/src/py/mat3ra/made/reciprocal/lattice_reciprocal.py +0 -147
- package/src/py/mat3ra/made/reciprocal/paths.py +0 -30
- package/src/py/mat3ra/made/reciprocal/symmetry_points.py +0 -385
- package/src/py/mat3ra/made/tools/README.md +0 -173
- package/src/py/mat3ra/made/tools/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/analyze/__init__.py +0 -31
- package/src/py/mat3ra/made/tools/analyze/basis/__init__.py +0 -3
- package/src/py/mat3ra/made/tools/analyze/basis/analyzer.py +0 -50
- package/src/py/mat3ra/made/tools/analyze/build_metadata_analyzer.py +0 -32
- package/src/py/mat3ra/made/tools/analyze/build_metadata_analyzer_factory.py +0 -31
- package/src/py/mat3ra/made/tools/analyze/coordination.py +0 -56
- package/src/py/mat3ra/made/tools/analyze/crystal_site/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/analyze/crystal_site/adatom_crystal_site_material_analyzer.py +0 -35
- package/src/py/mat3ra/made/tools/analyze/crystal_site/adatom_material_analyzer.py +0 -49
- package/src/py/mat3ra/made/tools/analyze/crystal_site/crystal_site_analyzer.py +0 -65
- package/src/py/mat3ra/made/tools/analyze/crystal_site/voronoi_crystal_site_analyzer.py +0 -47
- package/src/py/mat3ra/made/tools/analyze/enums.py +0 -33
- package/src/py/mat3ra/made/tools/analyze/fingerprint/__init__.py +0 -4
- package/src/py/mat3ra/made/tools/analyze/fingerprint/layers/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/analyze/fingerprint/layers/layered_fingerprint_along_axis.py +0 -83
- package/src/py/mat3ra/made/tools/analyze/fingerprint/layers/unique_element_string_per_layer.py +0 -9
- package/src/py/mat3ra/made/tools/analyze/interface/__init__.py +0 -20
- package/src/py/mat3ra/made/tools/analyze/interface/commensurate.py +0 -156
- package/src/py/mat3ra/made/tools/analyze/interface/enums.py +0 -60
- package/src/py/mat3ra/made/tools/analyze/interface/grain_boundary.py +0 -80
- package/src/py/mat3ra/made/tools/analyze/interface/simple.py +0 -251
- package/src/py/mat3ra/made/tools/analyze/interface/twisted_nanoribbons.py +0 -91
- package/src/py/mat3ra/made/tools/analyze/interface/utils/__init__.py +0 -77
- package/src/py/mat3ra/made/tools/analyze/interface/utils/holders.py +0 -14
- package/src/py/mat3ra/made/tools/analyze/interface/utils/vector.py +0 -56
- package/src/py/mat3ra/made/tools/analyze/interface/zsl.py +0 -259
- package/src/py/mat3ra/made/tools/analyze/interface_material.py +0 -45
- package/src/py/mat3ra/made/tools/analyze/lattice/__init__.py +0 -2
- package/src/py/mat3ra/made/tools/analyze/lattice/analyzer.py +0 -126
- package/src/py/mat3ra/made/tools/analyze/lattice/helpers.py +0 -31
- package/src/py/mat3ra/made/tools/analyze/lattice_lines.py +0 -30
- package/src/py/mat3ra/made/tools/analyze/lattice_planes.py +0 -192
- package/src/py/mat3ra/made/tools/analyze/lattice_swap_analyzer.py +0 -105
- package/src/py/mat3ra/made/tools/analyze/material.py +0 -276
- package/src/py/mat3ra/made/tools/analyze/other.py +0 -434
- package/src/py/mat3ra/made/tools/analyze/rdf.py +0 -74
- package/src/py/mat3ra/made/tools/analyze/slab.py +0 -76
- package/src/py/mat3ra/made/tools/analyze/solid_solution_analyzer.py +0 -171
- package/src/py/mat3ra/made/tools/analyze/terrace.py +0 -105
- package/src/py/mat3ra/made/tools/analyze/utils.py +0 -162
- package/src/py/mat3ra/made/tools/bond_directions/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/bond_directions/bond_directions.py +0 -150
- package/src/py/mat3ra/made/tools/bond_directions/bond_directions_for_element_list.py +0 -7
- package/src/py/mat3ra/made/tools/bond_directions/bond_directions_templates_enum.py +0 -8
- package/src/py/mat3ra/made/tools/bond_directions/bond_directions_templates_for_element.py +0 -16
- package/src/py/mat3ra/made/tools/build/__init__.py +0 -25
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/helpers.py +0 -59
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/types.py +0 -26
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/heterostructure/utils.py +0 -139
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/__init__.py +0 -47
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/base/__init__.py +0 -11
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/base/build_parameters.py +0 -5
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/base/builder.py +0 -164
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/base/configuration.py +0 -48
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/base/helpers.py +0 -134
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/commensurate/__init__.py +0 -6
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/commensurate/helpers.py +0 -157
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/enums.py +0 -7
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/twisted/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/twisted/configuration.py +0 -13
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/twisted/helpers.py +0 -70
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/utils.py +0 -87
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/zsl/__init__.py +0 -6
- package/src/py/mat3ra/made/tools/build/compound_pristine_structures/two_dimensional/interface/zsl/helpers.py +0 -129
- package/src/py/mat3ra/made/tools/build/defective_structures/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/grain_boundary_linear/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/grain_boundary_linear/build_parameters.py +0 -12
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/grain_boundary_linear/builder.py +0 -17
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/grain_boundary_linear/configuration.py +0 -40
- package/src/py/mat3ra/made/tools/build/defective_structures/one_dimensional/grain_boundary_linear/helpers.py +0 -82
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/__init__.py +0 -1
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/solid_solution/__init__.py +0 -9
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/solid_solution/builder.py +0 -37
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/solid_solution/configuration.py +0 -30
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/solid_solution/enums.py +0 -8
- package/src/py/mat3ra/made/tools/build/defective_structures/three_dimensional/solid_solution/helpers.py +0 -76
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/adatom/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/adatom/builder.py +0 -11
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/adatom/configuration.py +0 -18
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/adatom/helpers.py +0 -137
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/adatom/types.py +0 -22
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/grain_boundary_planar/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/grain_boundary_planar/builder.py +0 -28
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/grain_boundary_planar/configuration.py +0 -55
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/grain_boundary_planar/helpers.py +0 -75
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/island/builder.py +0 -15
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/island/configuration.py +0 -16
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/island/helpers.py +0 -116
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/terrace/build_parameters.py +0 -10
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/terrace/builder.py +0 -30
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/terrace/configuration.py +0 -11
- package/src/py/mat3ra/made/tools/build/defective_structures/two_dimensional/terrace/helpers.py +0 -78
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/pair_defect/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/pair_defect/builder.py +0 -31
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/pair_defect/configuration.py +0 -45
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/pair_defect/helpers.py +0 -80
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/__init__.py +0 -40
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/atom_placement_method_enum.py +0 -14
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/base/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/base/builder.py +0 -42
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/base/configuration.py +0 -27
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/complex_defect_type_enum.py +0 -5
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/factories.py +0 -69
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/helpers.py +0 -92
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/interstitial/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/interstitial/builder.py +0 -8
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/interstitial/configuration.py +0 -29
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/interstitial/helpers.py +0 -48
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/interstitial/interstitial_placement_method_enum.py +0 -8
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/point_defect_type_enum.py +0 -8
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/builder.py +0 -6
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/configuration.py +0 -41
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/helpers.py +0 -43
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/substitution_placement_method_enum.py +0 -7
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/types.py +0 -24
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/vacancy/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/vacancy/builder.py +0 -19
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/vacancy/configuration.py +0 -27
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/vacancy/helpers.py +0 -42
- package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/vacancy/vacancy_placement_method_enum.py +0 -7
- package/src/py/mat3ra/made/tools/build/pristine_structures/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/pristine_structures/three_dimensional/ideal_crystal/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/pristine_structures/three_dimensional/ideal_crystal/builder.py +0 -80
- package/src/py/mat3ra/made/tools/build/pristine_structures/three_dimensional/ideal_crystal/configurations.py +0 -22
- package/src/py/mat3ra/made/tools/build/pristine_structures/three_dimensional/ideal_crystal/helpers.py +0 -40
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanoribbon/__init__.py +0 -29
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanoribbon/build_parameters.py +0 -5
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanoribbon/builders.py +0 -56
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanoribbon/configuration.py +0 -33
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanoribbon/helpers.py +0 -76
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanotape/__init__.py +0 -11
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanotape/build_parameters.py +0 -9
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanotape/builders.py +0 -83
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanotape/configuration.py +0 -35
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/nanotape/helpers.py +0 -62
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/__init__.py +0 -9
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/build_parameters.py +0 -8
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/builder.py +0 -42
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/configuration.py +0 -99
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/helpers.py +0 -95
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/termination_utils.py +0 -14
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab/utils.py +0 -61
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab_strained_supercell/builder.py +0 -22
- package/src/py/mat3ra/made/tools/build/pristine_structures/two_dimensional/slab_strained_supercell/configuration.py +0 -17
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/__init__.py +0 -19
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/analyzer.py +0 -86
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/ase_based/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/ase_based/builder.py +0 -54
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/ase_based/configuration.py +0 -19
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/enums.py +0 -42
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/helpers.py +0 -127
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/merge_based/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/merge_based/builder.py +0 -33
- package/src/py/mat3ra/made/tools/build/pristine_structures/zero_dimensional/nanoparticle/merge_based/configuration.py +0 -16
- package/src/py/mat3ra/made/tools/build/processed_structures/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/analyzers/__init__.py +0 -9
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/analyzers/coordination_based_passivation_material_analyzer.py +0 -112
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/analyzers/passivation_material_analyzer.py +0 -16
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/analyzers/surface_passivation_material_analyzer.py +0 -32
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/builder.py +0 -23
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/configuration.py +0 -31
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/enums.py +0 -7
- package/src/py/mat3ra/made/tools/build/processed_structures/two_dimensional/passivation/helpers.py +0 -151
- package/src/py/mat3ra/made/tools/build_components/__init__.py +0 -10
- package/src/py/mat3ra/made/tools/build_components/entities/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/one_dimensional/miller_indices_2d.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/two_dimensional/miller_indices.py +0 -18
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/two_dimensional/termination.py +0 -33
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/crystal_site/__init__.py +0 -2
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/crystal_site/crystal_site.py +0 -24
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/crystal_site/crystal_site_list.py +0 -9
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/point_defect_site/builder.py +0 -32
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/point_defect_site/configuration.py +0 -14
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/void_region/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/void_region/builder.py +0 -29
- package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/void_region/configuration.py +0 -19
- package/src/py/mat3ra/made/tools/build_components/entities/core/two_dimensional/vacuum/builder.py +0 -48
- package/src/py/mat3ra/made/tools/build_components/entities/core/two_dimensional/vacuum/configuration.py +0 -17
- package/src/py/mat3ra/made/tools/build_components/entities/core/zero_dimensional/atom/builder.py +0 -25
- package/src/py/mat3ra/made/tools/build_components/entities/core/zero_dimensional/atom/configuration.py +0 -8
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/base_builder/__init__.py +0 -16
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/base_builder/base_configuration_pydantic.py +0 -5
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/base_builder/base_single_builder.py +0 -87
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/base_builder/build_parameters.py +0 -5
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines/__init__.py +0 -4
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines/builder.py +0 -46
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines/configuration.py +0 -19
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines/edge_types.py +0 -51
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines/helpers.py +0 -58
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines_unique_repeated/__init__.py +0 -4
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines_unique_repeated/builder.py +0 -42
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/one_dimensional/crystal_lattice_lines_unique_repeated/configuration.py +0 -21
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/three_dimensional/supercell/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/three_dimensional/supercell/configuration.py +0 -11
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/three_dimensional/supercell/helpers.py +0 -38
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/__init__.py +0 -24
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/atomic_layers_unique_repeated/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/atomic_layers_unique_repeated/builder.py +0 -62
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/atomic_layers_unique_repeated/configuration.py +0 -14
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/atomic_layers_unique_repeated/helpers.py +0 -42
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/crystal_lattice_planes/__init__.py +0 -7
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/crystal_lattice_planes/builder.py +0 -39
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/crystal_lattice_planes/configuration.py +0 -24
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/slab_stack/__init__.py +0 -10
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/slab_stack/builder.py +0 -36
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/slab_stack/configuration.py +0 -31
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/two_dimensional/slab_stack/helpers.py +0 -80
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/zero_dimensional/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/entities/reusable/zero_dimensional/coordinates_shape_enum.py +0 -8
- package/src/py/mat3ra/made/tools/build_components/metadata/__init__.py +0 -2
- package/src/py/mat3ra/made/tools/build_components/metadata/build_metadata.py +0 -7
- package/src/py/mat3ra/made/tools/build_components/metadata/material_build_metadata.py +0 -35
- package/src/py/mat3ra/made/tools/build_components/metadata/material_with_build_metadata.py +0 -8
- package/src/py/mat3ra/made/tools/build_components/mixins/__init__.py +0 -2
- package/src/py/mat3ra/made/tools/build_components/mixins/convert_generated_items_ase_atoms_mixin.py +0 -8
- package/src/py/mat3ra/made/tools/build_components/mixins/convert_generated_items_pymatgen_structure_mixin.py +0 -8
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/__init__.py +0 -0
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/enums.py +0 -11
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/merge/__init__.py +0 -6
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/merge/build_parameters.py +0 -18
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/merge/builder.py +0 -93
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/merge/configuration.py +0 -20
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/stack/builder.py +0 -83
- package/src/py/mat3ra/made/tools/build_components/operations/core/combinations/stack/configuration.py +0 -24
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/__init__.py +0 -15
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/build_parameters.py +0 -5
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/builders/base.py +0 -33
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/builders/isometric.py +0 -25
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/configuration.py +0 -24
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/__init__.py +0 -13
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/atomic_mass_dependent_function_holder.py +0 -32
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/function_holder.py +0 -80
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/maxwell_boltzmann.py +0 -39
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/perturbation_function_holder.py +0 -45
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/functions/sine_wave_perturbation_function_holder.py +0 -29
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/perturb/helpers.py +0 -83
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/strain/__init__.py +0 -5
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/strain/builder.py +0 -25
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/strain/configuration.py +0 -23
- package/src/py/mat3ra/made/tools/build_components/operations/core/modifications/strain/helpers.py +0 -49
- package/src/py/mat3ra/made/tools/build_components/utils.py +0 -44
- package/src/py/mat3ra/made/tools/calculate/__init__.py +0 -149
- package/src/py/mat3ra/made/tools/calculate/ase/__init__.py +0 -133
- package/src/py/mat3ra/made/tools/calculate/ase/constraints.py +0 -91
- package/src/py/mat3ra/made/tools/calculate/calculators/__init__.py +0 -4
- package/src/py/mat3ra/made/tools/calculate/calculators/interface_material_calculator.py +0 -70
- package/src/py/mat3ra/made/tools/calculate/calculators/interface_material_calculator_parameters.py +0 -14
- package/src/py/mat3ra/made/tools/calculate/calculators/material_calculator.py +0 -32
- package/src/py/mat3ra/made/tools/calculate/calculators/material_calculator_parameters.py +0 -17
- package/src/py/mat3ra/made/tools/calculate/interaction_functions.py +0 -23
- package/src/py/mat3ra/made/tools/convert/__init__.py +0 -286
- package/src/py/mat3ra/made/tools/convert/interface_parts_enum.py +0 -9
- package/src/py/mat3ra/made/tools/convert/utils.py +0 -96
- package/src/py/mat3ra/made/tools/entities/__init__.py +0 -5
- package/src/py/mat3ra/made/tools/entities/coordinate/__init__.py +0 -14
- package/src/py/mat3ra/made/tools/entities/coordinate/box_coordinate_condition.py +0 -15
- package/src/py/mat3ra/made/tools/entities/coordinate/coordinate_condition.py +0 -16
- package/src/py/mat3ra/made/tools/entities/coordinate/coordinate_functions.py +0 -158
- package/src/py/mat3ra/made/tools/entities/coordinate/cylinder_coordinate_condition.py +0 -17
- package/src/py/mat3ra/made/tools/entities/coordinate/plane_coordinate_condition.py +0 -14
- package/src/py/mat3ra/made/tools/entities/coordinate/sphere_coordinate_condition.py +0 -15
- package/src/py/mat3ra/made/tools/entities/coordinate/triangular_prism_coordinate_condition.py +0 -26
- package/src/py/mat3ra/made/tools/entities/termination_holder.py +0 -12
- package/src/py/mat3ra/made/tools/helpers.py +0 -168
- package/src/py/mat3ra/made/tools/modify.py +0 -627
- package/src/py/mat3ra/made/tools/operations/core/binary.py +0 -106
- package/src/py/mat3ra/made/tools/operations/core/unary.py +0 -170
- package/src/py/mat3ra/made/tools/operations/core/utils.py +0 -138
- package/src/py/mat3ra/made/tools/operations/reusable/unary.py +0 -53
- package/src/py/mat3ra/made/tools/optimize.py +0 -55
- package/src/py/mat3ra/made/tools/third_party.py +0 -69
- package/src/py/mat3ra/made/tools/utils.py +0 -182
- package/src/py/mat3ra/made/utils.py +0 -144
- package/tests/.gitattributes +0 -1
- package/tests/fixtures/AsGe-basis.json +0 -3
- package/tests/fixtures/C2H4-translated.json +0 -3
- package/tests/fixtures/C2H4.json +0 -3
- package/tests/fixtures/FeLiSi-basis.json +0 -3
- package/tests/fixtures/FeO.json +0 -3
- package/tests/fixtures/Ge2-basis.json +0 -3
- package/tests/fixtures/Graphene.json +0 -3
- package/tests/fixtures/Graphene.poscar +0 -3
- package/tests/fixtures/H2+H-final.json +0 -3
- package/tests/fixtures/H2+H-image.json +0 -3
- package/tests/fixtures/H2+H-initial.json +0 -3
- package/tests/fixtures/H2O.poscar +0 -3
- package/tests/fixtures/LiFeSi-basis-labels.json +0 -3
- package/tests/fixtures/LiFeSi-basis.json +0 -3
- package/tests/fixtures/Na.json +0 -3
- package/tests/fixtures/Na4Cl4-cartesian.json +0 -3
- package/tests/fixtures/Na4Cl4.json +0 -3
- package/tests/fixtures/Na4Cl4.poscar +0 -3
- package/tests/fixtures/Ni-hex.json +0 -3
- package/tests/fixtures/Ni-hex.poscar +0 -3
- package/tests/fixtures/OSi-basis.json +0 -3
- package/tests/fixtures/Si-hex.poscar +0 -3
- package/tests/fixtures/Si-pwscf.in +0 -3
- package/tests/fixtures/Si-slab.json +0 -3
- package/tests/fixtures/Si-supercell.json +0 -3
- package/tests/fixtures/Si2-basis-repeated.json +0 -3
- package/tests/fixtures/Si2-basis.json +0 -3
- package/tests/fixtures/Zr1H23Zr1H1.json +0 -3
- package/tests/fixtures/Zr1H23Zr1H1.poscar +0 -3
- package/tests/fixtures/atomic-constraints.json +0 -3
- package/tests/fixtures/hashes.json +0 -3
- package/tests/fixtures/si-slab-100.json +0 -3
- package/tests/fixtures/si-slab-111-0-vacuum.json +0 -3
- package/tests/fixtures/si-slab-111-0.5-vacuum-gamma-120.json +0 -3
- package/tests/fixtures/si-slab-111-0.5-vacuum-ratio.json +0 -3
- package/tests/fixtures/si-standata.json +0 -3
- package/tests/js/basis/basis.ts +0 -247
- package/tests/js/cell/cell.ts +0 -182
- package/tests/js/cell/primitive_cell.ts +0 -21
- package/tests/js/constraints/constraints.ts +0 -11
- package/tests/js/fixtures.ts +0 -120
- package/tests/js/lattice/lattice.ts +0 -43
- package/tests/js/lattice/lattice_reciprocal.ts +0 -104
- package/tests/js/material.test.ts +0 -42
- package/tests/js/parsers/espresso.ts +0 -15
- package/tests/js/parsers/native_formats.ts +0 -35
- package/tests/js/parsers/poscar.ts +0 -89
- package/tests/js/parsers/xyz.ts +0 -33
- package/tests/js/parsers/xyz_combinatorial_basis.ts +0 -156
- package/tests/js/setup.ts +0 -6
- package/tests/js/tools/basis.ts +0 -22
- package/tests/js/tools/supercell.ts +0 -58
- package/tests/js/tools/surface.ts +0 -115
- package/tests/py/conftest.py +0 -34
- package/tests/py/mat3ra/debug_utils.py +0 -75
- package/tests/py/unit/__init__.py +0 -0
- package/tests/py/unit/fixtures/__init__.py +0 -0
- package/tests/py/unit/fixtures/adatom.py +0 -60
- package/tests/py/unit/fixtures/bulk.py +0 -162
- package/tests/py/unit/fixtures/cuts.py +0 -118
- package/tests/py/unit/fixtures/grain_boundary.py +0 -875
- package/tests/py/unit/fixtures/interface/commensurate.py +0 -498
- package/tests/py/unit/fixtures/interface/gaas_dia.py +0 -837
- package/tests/py/unit/fixtures/interface/gr_ni_111_top_hcp.py +0 -123
- package/tests/py/unit/fixtures/interface/simple.py +0 -84
- package/tests/py/unit/fixtures/interface/twisted_nanoribbons.py +0 -131
- package/tests/py/unit/fixtures/interface/zsl.py +0 -756
- package/tests/py/unit/fixtures/island.py +0 -336
- package/tests/py/unit/fixtures/merge.py +0 -147
- package/tests/py/unit/fixtures/monolayer.py +0 -46
- package/tests/py/unit/fixtures/nanoparticle.py +0 -116
- package/tests/py/unit/fixtures/nanoribbon/__init__.py +0 -0
- package/tests/py/unit/fixtures/nanoribbon/armchair.py +0 -102
- package/tests/py/unit/fixtures/nanoribbon/nanoribbon.py +0 -145
- package/tests/py/unit/fixtures/nanoribbon/zigzag.py +0 -54
- package/tests/py/unit/fixtures/pair_defects.py +0 -41
- package/tests/py/unit/fixtures/passivated/nanoribbon.py +0 -69
- package/tests/py/unit/fixtures/passivated/slab.py +0 -58
- package/tests/py/unit/fixtures/point_defects.py +0 -158
- package/tests/py/unit/fixtures/slab.py +0 -606
- package/tests/py/unit/fixtures/strain.py +0 -42
- package/tests/py/unit/fixtures/supercell.py +0 -64
- package/tests/py/unit/fixtures/terrace.py +0 -70
- package/tests/py/unit/fixtures/thrid_party/ase_atoms.py +0 -13
- package/tests/py/unit/test_analyze_lattice_planes.py +0 -131
- package/tests/py/unit/test_cell.py +0 -104
- package/tests/py/unit/test_data_files.py +0 -68
- package/tests/py/unit/test_lattice.py +0 -103
- package/tests/py/unit/test_lattice_type_extended.py +0 -53
- package/tests/py/unit/test_material.py +0 -158
- package/tests/py/unit/test_operations.py +0 -126
- package/tests/py/unit/test_primitive_cell.py +0 -118
- package/tests/py/unit/test_reciprocal_lattice.py +0 -86
- package/tests/py/unit/test_reciprocal_paths.py +0 -64
- package/tests/py/unit/test_symmetry_points.py +0 -151
- package/tests/py/unit/test_tools_analyze.py +0 -219
- package/tests/py/unit/test_tools_analyze_basis.py +0 -105
- package/tests/py/unit/test_tools_analyze_interface.py +0 -223
- package/tests/py/unit/test_tools_analyze_interface_material.py +0 -63
- package/tests/py/unit/test_tools_analyze_interface_zsl.py +0 -187
- package/tests/py/unit/test_tools_analyze_lattice.py +0 -74
- package/tests/py/unit/test_tools_analyze_swap.py +0 -80
- package/tests/py/unit/test_tools_build.py +0 -158
- package/tests/py/unit/test_tools_build_defect/__init__.py +0 -0
- package/tests/py/unit/test_tools_build_defect/test_adatom.py +0 -84
- package/tests/py/unit/test_tools_build_defect/test_island.py +0 -45
- package/tests/py/unit/test_tools_build_defect/test_pair_defect.py +0 -84
- package/tests/py/unit/test_tools_build_defect/test_point_defect.py +0 -196
- package/tests/py/unit/test_tools_build_defect/test_slab_stack.py +0 -30
- package/tests/py/unit/test_tools_build_defect/test_solid_solution.py +0 -90
- package/tests/py/unit/test_tools_build_defect/test_terrace.py +0 -44
- package/tests/py/unit/test_tools_build_grain_boundary.py +0 -133
- package/tests/py/unit/test_tools_build_heterostructure.py +0 -46
- package/tests/py/unit/test_tools_build_interface.py +0 -292
- package/tests/py/unit/test_tools_build_interface_zsl.py +0 -263
- package/tests/py/unit/test_tools_build_maxwell_disorder.py +0 -123
- package/tests/py/unit/test_tools_build_metadata.py +0 -79
- package/tests/py/unit/test_tools_build_monolayer.py +0 -33
- package/tests/py/unit/test_tools_build_nanoparticle.py +0 -42
- package/tests/py/unit/test_tools_build_nanoribbon.py +0 -45
- package/tests/py/unit/test_tools_build_passivation.py +0 -85
- package/tests/py/unit/test_tools_build_perturbation.py +0 -103
- package/tests/py/unit/test_tools_build_slab.py +0 -382
- package/tests/py/unit/test_tools_build_strain.py +0 -36
- package/tests/py/unit/test_tools_build_supercell.py +0 -47
- package/tests/py/unit/test_tools_calculate.py +0 -67
- package/tests/py/unit/test_tools_convert.py +0 -174
- package/tests/py/unit/test_tools_modify.py +0 -248
- package/tests/py/unit/utils.py +0 -142
- package/tsconfig-transpile.json +0 -3
- package/tsconfig.json +0 -3
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import random
|
|
2
|
-
from typing import List, Optional, Union
|
|
3
|
-
|
|
4
|
-
import numpy as np
|
|
5
|
-
from mat3ra.made.material import Material
|
|
6
|
-
|
|
7
|
-
from ..analyze import BaseMaterialAnalyzer
|
|
8
|
-
from ..analyze.utils import minimum_image_distances
|
|
9
|
-
from ..build.defective_structures.three_dimensional.solid_solution.enums import SiteSelectionMethodEnum
|
|
10
|
-
from ..build_components import MaterialWithBuildMetadata
|
|
11
|
-
from ..build_components.entities.reusable.three_dimensional.supercell.helpers import create_supercell
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _most_isotropic_dimensions(total_cells: int) -> List[int]:
|
|
15
|
-
"""
|
|
16
|
-
Find [a, b, c] repeat factors whose product equals total_cells with minimum aspect ratio.
|
|
17
|
-
|
|
18
|
-
Enumerates factor triples with a <= b <= c and returns the triple with the
|
|
19
|
-
smallest spread (c - a).
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
total_cells (int): Target number of unit cells in the supercell.
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
List[int]: Repeat factors [a, b, c] along the three lattice directions.
|
|
26
|
-
"""
|
|
27
|
-
best_dimensions = [1, 1, total_cells]
|
|
28
|
-
best_spread = total_cells - 1
|
|
29
|
-
for a in range(1, total_cells + 1):
|
|
30
|
-
if total_cells % a:
|
|
31
|
-
continue
|
|
32
|
-
for b in range(a, total_cells // a + 1):
|
|
33
|
-
if (total_cells // a) % b:
|
|
34
|
-
continue
|
|
35
|
-
c = total_cells // (a * b)
|
|
36
|
-
if c < b:
|
|
37
|
-
continue
|
|
38
|
-
spread = c - a
|
|
39
|
-
if spread < best_spread:
|
|
40
|
-
best_dimensions = [a, b, c]
|
|
41
|
-
best_spread = spread
|
|
42
|
-
return best_dimensions
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def _select_sites_uniform(
|
|
46
|
-
material: Union[Material, MaterialWithBuildMetadata],
|
|
47
|
-
source_indices: List[int],
|
|
48
|
-
number_to_select: int,
|
|
49
|
-
seed: int = None,
|
|
50
|
-
) -> List[int]:
|
|
51
|
-
"""
|
|
52
|
-
Select number_to_select sites from source_indices using Farthest Point Sampling.
|
|
53
|
-
|
|
54
|
-
Iteratively picks the site whose minimum distance to all already-selected
|
|
55
|
-
sites is largest, producing a maximally dispersed subset under PBC.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
material (Union[Material, MaterialWithBuildMetadata]): Material with lattice and coordinates.
|
|
59
|
-
source_indices (List[int]): Indices of candidate sites in the material basis.
|
|
60
|
-
number_to_select (int): Number of sites to select.
|
|
61
|
-
seed (int, optional): Random seed for the initial site choice.
|
|
62
|
-
|
|
63
|
-
Returns:
|
|
64
|
-
List[int]: Sorted list of selected site indices.
|
|
65
|
-
"""
|
|
66
|
-
if number_to_select <= 0:
|
|
67
|
-
return []
|
|
68
|
-
if number_to_select >= len(source_indices):
|
|
69
|
-
return sorted(source_indices)
|
|
70
|
-
|
|
71
|
-
material.to_crystal()
|
|
72
|
-
fractional_coordinates = np.array(material.basis.coordinates.values)
|
|
73
|
-
lattice_vectors = np.array(material.lattice.vector_arrays)
|
|
74
|
-
pairwise_distances = minimum_image_distances(fractional_coordinates[source_indices], lattice_vectors)
|
|
75
|
-
|
|
76
|
-
random_generator = random.Random(seed)
|
|
77
|
-
first_pick = random_generator.randrange(len(source_indices))
|
|
78
|
-
selected = [first_pick]
|
|
79
|
-
distance_to_selected = pairwise_distances[first_pick].copy()
|
|
80
|
-
is_candidate = np.ones(len(source_indices), dtype=bool)
|
|
81
|
-
is_candidate[first_pick] = False
|
|
82
|
-
|
|
83
|
-
for _ in range(number_to_select - 1):
|
|
84
|
-
farthest_distance = np.max(distance_to_selected[is_candidate])
|
|
85
|
-
tied_candidates = np.where(is_candidate & np.isclose(distance_to_selected, farthest_distance))[0]
|
|
86
|
-
next_pick = int(random_generator.choice(tied_candidates))
|
|
87
|
-
selected.append(next_pick)
|
|
88
|
-
is_candidate[next_pick] = False
|
|
89
|
-
np.minimum(distance_to_selected, pairwise_distances[next_pick], out=distance_to_selected)
|
|
90
|
-
|
|
91
|
-
return sorted(source_indices[i] for i in selected)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
class SolidSolutionAnalyzer(BaseMaterialAnalyzer):
|
|
95
|
-
"""
|
|
96
|
-
Analyzes a unit cell to plan supercell dimensions and select substitution sites.
|
|
97
|
-
|
|
98
|
-
Given a unit cell material and a desired substitution ratio, finds the
|
|
99
|
-
most isotropic supercell matching the target concentration within tolerance,
|
|
100
|
-
then selects specific sites for substitution.
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
source_element: str
|
|
104
|
-
target_element: str
|
|
105
|
-
target_concentration: float
|
|
106
|
-
tolerance: float = 0.01
|
|
107
|
-
max_supercell_cells: int = 128
|
|
108
|
-
seed: Optional[int] = None
|
|
109
|
-
site_selection_method: SiteSelectionMethodEnum = SiteSelectionMethodEnum.UNIFORM
|
|
110
|
-
|
|
111
|
-
@property
|
|
112
|
-
def source_element_count_per_cell(self) -> int:
|
|
113
|
-
return sum(1 for element in self.material.basis.elements.values if element == self.source_element)
|
|
114
|
-
|
|
115
|
-
@property
|
|
116
|
-
def optimal_supercell_dimensions(self) -> List[int]:
|
|
117
|
-
source_count_per_cell = self.source_element_count_per_cell
|
|
118
|
-
if source_count_per_cell == 0:
|
|
119
|
-
raise ValueError(f"No {self.source_element} atoms found in the unit cell.")
|
|
120
|
-
|
|
121
|
-
best_dimensions = None
|
|
122
|
-
best_shape_spread = self.max_supercell_cells
|
|
123
|
-
for cell_count in range(1, self.max_supercell_cells + 1):
|
|
124
|
-
source_atoms = source_count_per_cell * cell_count
|
|
125
|
-
replacement_atoms = min(max(round(self.target_concentration * source_atoms), 0), source_atoms)
|
|
126
|
-
achieved_concentration = replacement_atoms / source_atoms
|
|
127
|
-
if abs(achieved_concentration - self.target_concentration) > self.tolerance:
|
|
128
|
-
continue
|
|
129
|
-
|
|
130
|
-
dimensions = _most_isotropic_dimensions(cell_count)
|
|
131
|
-
shape_spread = dimensions[2] - dimensions[0]
|
|
132
|
-
if shape_spread < best_shape_spread:
|
|
133
|
-
best_dimensions = dimensions
|
|
134
|
-
best_shape_spread = shape_spread
|
|
135
|
-
if shape_spread == 0:
|
|
136
|
-
break
|
|
137
|
-
|
|
138
|
-
if best_dimensions is None:
|
|
139
|
-
raise ValueError(
|
|
140
|
-
f"Cannot achieve concentration {self.target_concentration} "
|
|
141
|
-
f"within tolerance {self.tolerance} for up to {self.max_supercell_cells} cells."
|
|
142
|
-
)
|
|
143
|
-
return best_dimensions
|
|
144
|
-
|
|
145
|
-
@property
|
|
146
|
-
def actual_concentration(self) -> float:
|
|
147
|
-
a, b, c = self.optimal_supercell_dimensions
|
|
148
|
-
source_atoms = self.source_element_count_per_cell * a * b * c
|
|
149
|
-
replacement_atoms = min(max(round(self.target_concentration * source_atoms), 0), source_atoms)
|
|
150
|
-
return replacement_atoms / source_atoms
|
|
151
|
-
|
|
152
|
-
@property
|
|
153
|
-
def selected_site_indices(self) -> List[int]:
|
|
154
|
-
supercell = create_supercell(material=self.material, scaling_factor=self.optimal_supercell_dimensions)
|
|
155
|
-
supercell_material = MaterialWithBuildMetadata.create(supercell.to_dict())
|
|
156
|
-
elements = supercell_material.basis.elements.values
|
|
157
|
-
source_indices = [index for index, element in enumerate(elements) if element == self.source_element]
|
|
158
|
-
replacement_atoms = min(
|
|
159
|
-
max(round(self.actual_concentration * len(source_indices)), 0),
|
|
160
|
-
len(source_indices),
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
if self.site_selection_method == SiteSelectionMethodEnum.UNIFORM:
|
|
164
|
-
keep_atoms = len(source_indices) - replacement_atoms
|
|
165
|
-
if keep_atoms < replacement_atoms:
|
|
166
|
-
kept_indices = _select_sites_uniform(supercell_material, source_indices, keep_atoms, self.seed)
|
|
167
|
-
return sorted(set(source_indices) - set(kept_indices))
|
|
168
|
-
return _select_sites_uniform(supercell_material, source_indices, replacement_atoms, self.seed)
|
|
169
|
-
|
|
170
|
-
random_generator = random.Random(self.seed)
|
|
171
|
-
return sorted(random_generator.sample(source_indices, replacement_atoms))
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
from .slab import SlabMaterialAnalyzer
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TerraceMaterialAnalyzer(SlabMaterialAnalyzer):
|
|
9
|
-
"""
|
|
10
|
-
Used to calculate the adjustment values to make a stepped-surface (terrace) slab
|
|
11
|
-
periodic.
|
|
12
|
-
|
|
13
|
-
Build sequence
|
|
14
|
-
--------------
|
|
15
|
-
1. **Add extra layers** on top of the parent slab.
|
|
16
|
-
2. **Cut** those layers with the crystallographic plane given by
|
|
17
|
-
``cut_direction`` → isolates the terrace step.
|
|
18
|
-
3. **Stack** the step onto the original slab → creates a terrace.
|
|
19
|
-
4. **Stretch lattice** in-plane (``new_lattice_vectors``) so the rotation can be performed inside the unit cell.
|
|
20
|
-
5. **Rotate** the whole slab by ``angle`` around ``rotation_axis`` so the
|
|
21
|
-
crystal structure is matched with the repetition in the PBC.
|
|
22
|
-
|
|
23
|
-
Key outputs
|
|
24
|
-
-----------
|
|
25
|
-
cut_direction_vector : unit Cartesian vector normal to the cut plane
|
|
26
|
-
rotation_axis : axis to rotate the slab around
|
|
27
|
-
angle : rotation angle in degrees
|
|
28
|
-
new_lattice_vectors : stretched lattice vectors used before rotation
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
cut_direction: List[int] = [0, 0, 1]
|
|
32
|
-
number_of_added_layers: float = 1.0
|
|
33
|
-
|
|
34
|
-
@property
|
|
35
|
-
def _lattice_matrix(self) -> np.ndarray:
|
|
36
|
-
return np.array(self.material.lattice.vector_arrays)
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def _height_cartesian(self) -> float:
|
|
40
|
-
return self.layer_thickness * self.number_of_added_layers
|
|
41
|
-
|
|
42
|
-
@property
|
|
43
|
-
def _cut_direction_xy_proj_cart(self) -> float:
|
|
44
|
-
return np.linalg.norm(np.dot(self._lattice_matrix, self.cut_direction_vector))
|
|
45
|
-
|
|
46
|
-
@property
|
|
47
|
-
def _length_increment(self) -> float:
|
|
48
|
-
return (
|
|
49
|
-
np.linalg.norm([self._height_cartesian, self._cut_direction_xy_proj_cart])
|
|
50
|
-
- self._cut_direction_xy_proj_cart
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
@property
|
|
54
|
-
def cut_direction_vector(self) -> np.ndarray:
|
|
55
|
-
"""
|
|
56
|
-
Get the normalized Cartesian vector normal to the terrace cut plane.
|
|
57
|
-
|
|
58
|
-
The terrace is constructed by cutting the material with a crystallographic
|
|
59
|
-
plane defined by `cut_direction`
|
|
60
|
-
"""
|
|
61
|
-
direction = np.dot(self._lattice_matrix, np.array(self.cut_direction))
|
|
62
|
-
return direction / np.linalg.norm(direction)
|
|
63
|
-
|
|
64
|
-
@property
|
|
65
|
-
def rotation_axis(self) -> List[int]:
|
|
66
|
-
"""
|
|
67
|
-
Calculate the axis of rotation to align the terrace with its repetition in the PBC.
|
|
68
|
-
"""
|
|
69
|
-
axis = np.cross(np.array(self.cut_direction), [0, 0, 1])
|
|
70
|
-
return np.round(axis / np.linalg.norm(axis)).astype(int).tolist()
|
|
71
|
-
|
|
72
|
-
@property
|
|
73
|
-
def angle(self) -> float:
|
|
74
|
-
"""
|
|
75
|
-
Calculate the angle of the tilt needed to align the terrace with its repetition in the PBC.
|
|
76
|
-
"""
|
|
77
|
-
return np.degrees(np.arctan(self._height_cartesian / self._cut_direction_xy_proj_cart))
|
|
78
|
-
|
|
79
|
-
@property
|
|
80
|
-
def new_lattice_vectors(self) -> List[List[float]]:
|
|
81
|
-
"""
|
|
82
|
-
Compute updated lattice vectors to accommodate terrace tilt before rotation.
|
|
83
|
-
|
|
84
|
-
The terrace step introduces an additional height, so to match it across PBC,
|
|
85
|
-
the in-plane lattice vectors must be stretched. This method calculates the
|
|
86
|
-
additional in-plane length needed and applies directional scaling to both
|
|
87
|
-
a and b vectors, in proportion to their projection along the terrace normal.
|
|
88
|
-
"""
|
|
89
|
-
direction_vector = self.cut_direction_vector
|
|
90
|
-
length_increment = self._length_increment
|
|
91
|
-
|
|
92
|
-
vector_a = self.material.lattice.vectors.a
|
|
93
|
-
vector_b = self.material.lattice.vectors.b
|
|
94
|
-
|
|
95
|
-
norm_a, norm_b = vector_a.norm, vector_b.norm
|
|
96
|
-
delta_a_cart = np.dot(vector_a.value, direction_vector) * length_increment / norm_a
|
|
97
|
-
delta_b_cart = np.dot(vector_b.value, direction_vector) * length_increment / norm_b
|
|
98
|
-
|
|
99
|
-
scaling_matrix = np.eye(3)
|
|
100
|
-
scaling_matrix[0, 0] += delta_a_cart / norm_a
|
|
101
|
-
scaling_matrix[1, 1] += delta_b_cart / norm_b
|
|
102
|
-
|
|
103
|
-
new_material = self.material.clone()
|
|
104
|
-
new_lattice = new_material.lattice.get_scaled_by_matrix(scaling_matrix.tolist())
|
|
105
|
-
return new_lattice.vector_arrays
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
from functools import wraps
|
|
2
|
-
from typing import TYPE_CHECKING, Union
|
|
3
|
-
|
|
4
|
-
import numpy as np
|
|
5
|
-
from mat3ra.code.array_with_ids import ArrayWithIds, RoundedArrayWithIds
|
|
6
|
-
from mat3ra.made.material import Material
|
|
7
|
-
|
|
8
|
-
if TYPE_CHECKING:
|
|
9
|
-
from .material import MaterialWithCrystalSites
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def decorator_handle_periodic_boundary_conditions(cutoff):
|
|
13
|
-
"""
|
|
14
|
-
Decorator to handle periodic boundary conditions.
|
|
15
|
-
|
|
16
|
-
Copies atoms near boundaries within the cutoff distance beyond the opposite side of the cell
|
|
17
|
-
creating the effect of periodic boundary conditions for edge atoms.
|
|
18
|
-
|
|
19
|
-
Results of the function are filtered to remove atoms or coordinates outside the original cell.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
cutoff (float): The cutoff distance for a border slice in crystal coordinates.
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
Callable: The decorated function.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
def decorator(func):
|
|
29
|
-
@wraps(func)
|
|
30
|
-
def wrapper(material, *args, **kwargs):
|
|
31
|
-
augmented_material, last_id = augment_material_with_periodic_images(material, cutoff)
|
|
32
|
-
|
|
33
|
-
result = func(augmented_material, *args, **kwargs)
|
|
34
|
-
|
|
35
|
-
original_ids = material.basis.coordinates.ids
|
|
36
|
-
if isinstance(result, (ArrayWithIds, RoundedArrayWithIds)):
|
|
37
|
-
result.filter_by_ids(original_ids)
|
|
38
|
-
if isinstance(result, list):
|
|
39
|
-
if all(isinstance(x, int) for x in result):
|
|
40
|
-
result = [id for id in result if id <= last_id]
|
|
41
|
-
elif all(isinstance(x, list) and len(x) == 3 for x in result):
|
|
42
|
-
result = [coord for coord in result if all(0 <= c < 1 for c in coord)]
|
|
43
|
-
return result
|
|
44
|
-
|
|
45
|
-
return wrapper
|
|
46
|
-
|
|
47
|
-
return decorator
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def augment_material_with_periodic_images(material: Union[Material, "MaterialWithCrystalSites"], cutoff: float = 0.25):
|
|
51
|
-
"""
|
|
52
|
-
Augment the material's dataset by adding atoms from periodic images within a cutoff distance
|
|
53
|
-
from the boundaries by copying them to the opposite side of the cell.
|
|
54
|
-
|
|
55
|
-
Args:
|
|
56
|
-
material (Material): The material to augment.
|
|
57
|
-
cutoff (float): The cutoff value for filtering atoms near boundaries, in crystal coordinates.
|
|
58
|
-
|
|
59
|
-
Returns:
|
|
60
|
-
Tuple[Material, int]: The augmented material and the last id of the original material for filtering.
|
|
61
|
-
"""
|
|
62
|
-
augmented_material = material.clone()
|
|
63
|
-
|
|
64
|
-
last_id = material.basis.coordinates.ids[-1]
|
|
65
|
-
original_basis_is_in_cartesian = material.basis.is_in_cartesian_units
|
|
66
|
-
|
|
67
|
-
augmented_material.to_crystal()
|
|
68
|
-
coordinates = np.array(augmented_material.basis.coordinates.values)
|
|
69
|
-
elements = np.array(augmented_material.basis.elements.values)
|
|
70
|
-
|
|
71
|
-
for axis in range(3):
|
|
72
|
-
for direction in [-1, 1]:
|
|
73
|
-
mask = (coordinates[:, axis] < cutoff) if direction == 1 else (coordinates[:, axis] > (1 - cutoff))
|
|
74
|
-
filtered_coordinates = coordinates[mask]
|
|
75
|
-
filtered_elements = elements[mask]
|
|
76
|
-
translation_vector = np.zeros(3)
|
|
77
|
-
translation_vector[axis] = direction
|
|
78
|
-
translated_coordinates = filtered_coordinates + translation_vector
|
|
79
|
-
for coord, elem in zip(translated_coordinates, filtered_elements):
|
|
80
|
-
augmented_material.add_atom(elem, coord)
|
|
81
|
-
|
|
82
|
-
if original_basis_is_in_cartesian:
|
|
83
|
-
augmented_material.to_cartesian()
|
|
84
|
-
|
|
85
|
-
return augmented_material, last_id
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def decorator_perform_operation_in_cartesian_coordinates(func):
|
|
89
|
-
"""
|
|
90
|
-
Decorator to perform operations in Cartesian coordinates.
|
|
91
|
-
|
|
92
|
-
Converts the material to Cartesian coordinates before executing the function
|
|
93
|
-
and converts it back to crystal coordinates after execution.
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
func (Callable): The function to decorate.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
Callable: The decorated function.
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
@wraps(func)
|
|
103
|
-
def wrapper(material, *args, **kwargs):
|
|
104
|
-
original_basis_is_in_cartesian = material.material.basis.is_in_cartesian_units
|
|
105
|
-
if not original_basis_is_in_cartesian:
|
|
106
|
-
material.material.to_cartesian()
|
|
107
|
-
|
|
108
|
-
result = func(material, *args, **kwargs)
|
|
109
|
-
|
|
110
|
-
if not original_basis_is_in_cartesian:
|
|
111
|
-
material.material.to_crystal()
|
|
112
|
-
|
|
113
|
-
return result
|
|
114
|
-
|
|
115
|
-
return wrapper
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def calculate_von_mises_strain(strain_matrix: np.ndarray) -> float:
|
|
119
|
-
"""
|
|
120
|
-
Calculate von Mises strain (%) from a 2D strain transformation matrix (top-left 2x2 of 3x3).
|
|
121
|
-
|
|
122
|
-
Args:
|
|
123
|
-
strain_matrix (np.ndarray): A 2D numpy array representing the strain transformation matrix.
|
|
124
|
-
Returns:
|
|
125
|
-
float: The von Mises strain in percentage.
|
|
126
|
-
"""
|
|
127
|
-
# allow passing a Python list
|
|
128
|
-
strain_matrix_2x2 = np.array(strain_matrix, dtype=float)[:2, :2]
|
|
129
|
-
E = 0.5 * (strain_matrix_2x2.T @ strain_matrix_2x2 - np.eye(2))
|
|
130
|
-
|
|
131
|
-
exx = E[0, 0]
|
|
132
|
-
eyy = E[1, 1]
|
|
133
|
-
exy = 0.5 * (E[0, 1] + E[1, 0])
|
|
134
|
-
|
|
135
|
-
e_von_mises = np.sqrt(exx**2 - exx * eyy + eyy**2 + 3 * exy**2)
|
|
136
|
-
|
|
137
|
-
return abs(e_von_mises) * 100.0
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def minimum_image_distances(frac_coords: np.ndarray, lattice_vectors: np.ndarray) -> np.ndarray:
|
|
141
|
-
"""
|
|
142
|
-
Compute pairwise distances between fractional coordinates under periodic boundary conditions.
|
|
143
|
-
|
|
144
|
-
Applies the minimum image convention: for each pair, the shortest distance
|
|
145
|
-
across all periodic images is returned.
|
|
146
|
-
|
|
147
|
-
Args:
|
|
148
|
-
frac_coords (np.ndarray): Fractional coordinates, shape (N, 3).
|
|
149
|
-
lattice_vectors (np.ndarray): Lattice vectors, shape (3, 3), rows are vectors.
|
|
150
|
-
|
|
151
|
-
Returns:
|
|
152
|
-
np.ndarray: Symmetric distance matrix, shape (N, N), in the same units as lattice_vectors.
|
|
153
|
-
"""
|
|
154
|
-
n = len(frac_coords)
|
|
155
|
-
distances = np.zeros((n, n))
|
|
156
|
-
for i in range(n):
|
|
157
|
-
delta = frac_coords[i] - frac_coords[i + 1 :]
|
|
158
|
-
delta -= np.round(delta)
|
|
159
|
-
dists = np.linalg.norm(delta @ lattice_vectors, axis=1)
|
|
160
|
-
distances[i, i + 1 :] = dists
|
|
161
|
-
distances[i + 1 :, i] = dists
|
|
162
|
-
return distances
|
|
File without changes
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class BondDirections(np.ndarray):
|
|
7
|
-
def __new__(cls, input_array, *args, **kwargs):
|
|
8
|
-
"""
|
|
9
|
-
Create a new instance of BondDirections from an input array.
|
|
10
|
-
|
|
11
|
-
Args:
|
|
12
|
-
input_array (array-like): Input data to initialize the array.
|
|
13
|
-
|
|
14
|
-
Returns:
|
|
15
|
-
BondDirections: A new BondDirections instance.
|
|
16
|
-
"""
|
|
17
|
-
obj = np.asarray(input_array).view(cls)
|
|
18
|
-
return obj
|
|
19
|
-
|
|
20
|
-
def __eq__(self, other):
|
|
21
|
-
if not isinstance(other, BondDirections):
|
|
22
|
-
return False
|
|
23
|
-
if self.shape != other.shape:
|
|
24
|
-
return False # Prevents shape mismatches
|
|
25
|
-
return self.are_bond_directions_similar(self, other)
|
|
26
|
-
|
|
27
|
-
@staticmethod
|
|
28
|
-
def are_bond_directions_similar(directions1: np.ndarray, directions2: np.ndarray, tolerance: float = 0.1) -> bool:
|
|
29
|
-
"""
|
|
30
|
-
Check if two bond direction templates are similar.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
directions1 (np.ndarray): First template of bond vectors.
|
|
34
|
-
directions2 (np.ndarray): Second template of bond vectors.
|
|
35
|
-
tolerance (float): Angle tolerance for comparison.
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
bool: True if the templates are similar, False otherwise.
|
|
39
|
-
"""
|
|
40
|
-
if len(directions1) != len(directions2):
|
|
41
|
-
return False
|
|
42
|
-
|
|
43
|
-
dot_matrix = np.dot(directions1, directions2.T)
|
|
44
|
-
norms1 = np.linalg.norm(directions1, axis=1)
|
|
45
|
-
norms2 = np.linalg.norm(directions2, axis=1)
|
|
46
|
-
cosine_matrix = dot_matrix / np.outer(norms1, norms2)
|
|
47
|
-
angles_matrix = np.arccos(np.clip(cosine_matrix, -1.0, 1.0))
|
|
48
|
-
|
|
49
|
-
unmatched = list(range(len(directions2)))
|
|
50
|
-
for angle_row in angles_matrix:
|
|
51
|
-
matches = np.where(angle_row < tolerance)[0]
|
|
52
|
-
if len(matches) == 0:
|
|
53
|
-
return False
|
|
54
|
-
unmatched.remove(matches.tolist()[0])
|
|
55
|
-
|
|
56
|
-
return True
|
|
57
|
-
|
|
58
|
-
def find_missing_directions(
|
|
59
|
-
self,
|
|
60
|
-
bond_templates: List[np.ndarray],
|
|
61
|
-
angle_tolerance: float = 0.1,
|
|
62
|
-
max_bonds_to_add: int = 1,
|
|
63
|
-
) -> "BondDirections":
|
|
64
|
-
"""
|
|
65
|
-
Reconstruct missing bonds for the atom based on the bond template that matches most of the existing bonds.
|
|
66
|
-
|
|
67
|
-
Args:
|
|
68
|
-
bond_templates (List[np.ndarray]): List of bond templates to match against.
|
|
69
|
-
angle_tolerance (float): Tolerance for comparing angles between bond vectors.
|
|
70
|
-
max_bonds_to_add (int): Maximum number of bonds to add.
|
|
71
|
-
|
|
72
|
-
Returns:
|
|
73
|
-
BondDirections: List of reconstructed bond vectors.
|
|
74
|
-
"""
|
|
75
|
-
max_coordination_number = max(len(template) for template in bond_templates)
|
|
76
|
-
|
|
77
|
-
if len(self) >= max_coordination_number:
|
|
78
|
-
return BondDirections([])
|
|
79
|
-
|
|
80
|
-
best_missing_directions = None
|
|
81
|
-
highest_match_count = -1
|
|
82
|
-
|
|
83
|
-
bond_templates = self._flatten_bond_templates(bond_templates)
|
|
84
|
-
|
|
85
|
-
for bond_template in bond_templates:
|
|
86
|
-
# Check which existing bonds match the template bonds
|
|
87
|
-
is_matched = [
|
|
88
|
-
any(self._are_vectors_similar(existing_bond, candidate_bond, angle_tolerance) for existing_bond in self)
|
|
89
|
-
for candidate_bond in bond_template
|
|
90
|
-
]
|
|
91
|
-
|
|
92
|
-
current_match_count = sum(is_matched)
|
|
93
|
-
missing_directions = [
|
|
94
|
-
candidate_bond for candidate_bond, matched in zip(bond_template, is_matched) if not matched
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
# Select the template with the highest match count
|
|
98
|
-
if current_match_count > highest_match_count:
|
|
99
|
-
highest_match_count = current_match_count
|
|
100
|
-
best_missing_directions = missing_directions
|
|
101
|
-
|
|
102
|
-
if best_missing_directions is not None:
|
|
103
|
-
num_bonds_to_add = min(
|
|
104
|
-
len(best_missing_directions),
|
|
105
|
-
max_bonds_to_add,
|
|
106
|
-
max_coordination_number - len(self),
|
|
107
|
-
)
|
|
108
|
-
return BondDirections(best_missing_directions[:num_bonds_to_add])
|
|
109
|
-
|
|
110
|
-
return BondDirections([])
|
|
111
|
-
|
|
112
|
-
@staticmethod
|
|
113
|
-
def _are_vectors_similar(vector1: np.ndarray, vector2: np.ndarray, tolerance: float = 0.1) -> bool:
|
|
114
|
-
"""
|
|
115
|
-
Check if two bond vectors are similar.
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
vector1 (np.ndarray): First bond vector.
|
|
119
|
-
vector2 (np.ndarray): Second bond vector.
|
|
120
|
-
tolerance (float): Angle tolerance for comparison.
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
bool: True if the bond vectors are similar, False otherwise.
|
|
124
|
-
"""
|
|
125
|
-
dot_product = np.dot(vector1, vector2)
|
|
126
|
-
norms = np.linalg.norm(vector1) * np.linalg.norm(vector2)
|
|
127
|
-
cosine_angle = dot_product / norms if norms != 0 else 0.0
|
|
128
|
-
angle = np.arccos(np.clip(cosine_angle, -1.0, 1.0))
|
|
129
|
-
return angle < tolerance
|
|
130
|
-
|
|
131
|
-
@staticmethod
|
|
132
|
-
def _flatten_bond_templates(bond_templates: List[np.ndarray]) -> List[np.ndarray]:
|
|
133
|
-
"""
|
|
134
|
-
Ensure that bond_templates is a list of np.ndarray with no extra nesting.
|
|
135
|
-
|
|
136
|
-
Args:
|
|
137
|
-
bond_templates (list): List of bond templates to preprocess.
|
|
138
|
-
|
|
139
|
-
Returns:
|
|
140
|
-
list: Flattened list of bond templates (np.ndarray).
|
|
141
|
-
"""
|
|
142
|
-
flattened_templates = []
|
|
143
|
-
for template in bond_templates:
|
|
144
|
-
if isinstance(template, list) and all(isinstance(sub_template, np.ndarray) for sub_template in template):
|
|
145
|
-
# If the template is a list of np.ndarray, extend the flattened list
|
|
146
|
-
flattened_templates.extend(template)
|
|
147
|
-
else:
|
|
148
|
-
# Otherwise, add the template directly
|
|
149
|
-
flattened_templates.append(template)
|
|
150
|
-
return flattened_templates
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class BondDirectionsTemplatesEnum(list, Enum):
|
|
5
|
-
OCTAHEDRAL = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]]
|
|
6
|
-
TETRAHEDRAL = [[1, 1, 1], [-1, -1, 1], [1, -1, -1], [-1, 1, -1]]
|
|
7
|
-
PLANAR = [[1, 0, 0], [-1, 2, 0], [-1, -2, 0]]
|
|
8
|
-
LINEAR = [[1, 0, 0], [-1, 0, 0]]
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
from pydantic import BaseModel, ConfigDict
|
|
5
|
-
|
|
6
|
-
from .bond_directions import BondDirections
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class BondDirectionsTemplatesForElement(BaseModel):
|
|
10
|
-
bond_directions_templates: List[BondDirections]
|
|
11
|
-
element: str
|
|
12
|
-
|
|
13
|
-
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
14
|
-
|
|
15
|
-
def to_ndarray(self):
|
|
16
|
-
return [np.array(template) for template in self.bond_directions_templates]
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from ..build_components.metadata import (
|
|
2
|
-
BuildMetadata,
|
|
3
|
-
MaterialBuildMetadata,
|
|
4
|
-
MaterialWithBuildMetadata,
|
|
5
|
-
)
|
|
6
|
-
from ..build_components import (
|
|
7
|
-
BaseConfigurationPydantic,
|
|
8
|
-
BaseBuilderParameters,
|
|
9
|
-
BaseSingleBuilder,
|
|
10
|
-
TypeConfiguration,
|
|
11
|
-
TypeBuildParameters,
|
|
12
|
-
BaseConfigurationPydanticChild,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"BuildMetadata",
|
|
17
|
-
"MaterialBuildMetadata",
|
|
18
|
-
"MaterialWithBuildMetadata",
|
|
19
|
-
"BaseConfigurationPydantic",
|
|
20
|
-
"BaseBuilderParameters",
|
|
21
|
-
"BaseSingleBuilder",
|
|
22
|
-
"TypeConfiguration",
|
|
23
|
-
"TypeBuildParameters",
|
|
24
|
-
"BaseConfigurationPydanticChild",
|
|
25
|
-
]
|