@mat3ra/made 2026.8.13-0 → 2026.8.26-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/package.json +9 -5
- 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/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/scripts/generate-mixins.ts +0 -28
- package/src/__init__.py +0 -0
- package/src/js/Material.ts +0 -618
- package/src/js/basis/basis.ts +0 -634
- package/src/js/basis/constrained_basis.ts +0 -115
- package/src/js/basis/coordinates.ts +0 -92
- 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 -149
- 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/generated/MaterialSchemaMixin.ts +0 -79
- package/src/js/lattice/lattice.ts +0 -308
- package/src/js/lattice/lattice_types.ts +0 -134
- package/src/js/lattice/reciprocal/lattice_reciprocal.ts +0 -206
- 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/parsers/cif.ts +0 -25
- package/src/js/parsers/errors.ts +0 -6
- package/src/js/parsers/espresso.ts +0 -29
- package/src/js/parsers/native_format_parsers.ts +0 -52
- package/src/js/parsers/parsers.ts +0 -13
- package/src/js/parsers/poscar.ts +0 -218
- package/src/js/parsers/xyz.ts +0 -190
- package/src/js/parsers/xyz_combinatorial_basis.ts +0 -268
- package/src/js/tools/basis.ts +0 -131
- package/src/js/tools/cell.ts +0 -40
- package/src/js/tools/index.ts +0 -11
- package/src/js/tools/material.ts +0 -64
- package/src/js/tools/supercell.ts +0 -89
- package/src/js/tools/surface.ts +0 -213
- 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 -135
- 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 -123
- package/tests/js/lattice/lattice.ts +0 -43
- package/tests/js/lattice/lattice_reciprocal.ts +0 -104
- package/tests/js/material/material.ts +0 -161
- package/tests/js/parsers/espresso.ts +0 -12
- 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/register-esse-schemas.cjs +0 -10
- 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 -111
- 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,268 +0,0 @@
|
|
|
1
|
-
import { BasisSchema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
-
import { Utils } from "@mat3ra/utils";
|
|
3
|
-
import { chain, last, map } from "lodash";
|
|
4
|
-
import * as s from "underscore.string";
|
|
5
|
-
|
|
6
|
-
import { ElementsAndCoordinatesConfig } from "../basis/basis";
|
|
7
|
-
import { AtomicCoordinateValue } from "../basis/coordinates";
|
|
8
|
-
import { AtomicElementValue } from "../basis/elements";
|
|
9
|
-
import { Cell } from "../cell/cell";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @summary Combinatorial XYZ basis class and related. Create and get all information about basis and elements in it.
|
|
13
|
-
* Constructor accepts string in extended XYZ format. Extended XYZ format is as follows:
|
|
14
|
-
*
|
|
15
|
-
* 1. Regular XYZ
|
|
16
|
-
* ```
|
|
17
|
-
* Si 0.0 0.0 0.0
|
|
18
|
-
* Li 0.5 0.5 0.5
|
|
19
|
-
* ```
|
|
20
|
-
* 2. Permutation (slash-separated)
|
|
21
|
-
* ```
|
|
22
|
-
* Si/Ge/As 0.0 0.0 0.0
|
|
23
|
-
* Si/Ge 0.5 0.5 0.0
|
|
24
|
-
* ```
|
|
25
|
-
* 3. Combination (comma-separated)
|
|
26
|
-
* ```
|
|
27
|
-
* Si,Ge,As 0.0 0.0 0.0
|
|
28
|
-
* Si,Ge 0.5 0.5 0.0
|
|
29
|
-
* ```
|
|
30
|
-
* More at: https://exabyte.atlassian.net/wiki/display/PD/Combinatorial+materials+set
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Regular expression for basis line.
|
|
35
|
-
* @type {RegExp}
|
|
36
|
-
*/
|
|
37
|
-
// eslint-disable-next-line max-len
|
|
38
|
-
const LINE_REGEX =
|
|
39
|
-
/^([A-Z][a-z]?\/?,?)+\s+(-?\d+\.?\d*|\.\d+)\s+(-?\d+\.?\d*|\.\d+)\s+(-?\d+\.?\d*|\.\d+)\s*$/gi;
|
|
40
|
-
// vacancy characters will be used to create vacancies on basis generation
|
|
41
|
-
const VACANCY_CHARACTER = "Vac";
|
|
42
|
-
const COMBINATION_DELIMITER = ",";
|
|
43
|
-
const PERMUTATION_DELIMITER = "/";
|
|
44
|
-
/**
|
|
45
|
-
* Basis validation error codes.
|
|
46
|
-
* @type {{MIXING_IN_SINGLE_LINE: number, MIXING_IN_MULTI_LINES: number, REGEX_NOT_PASSED: number}}
|
|
47
|
-
*/
|
|
48
|
-
const ERROR_CODES = {
|
|
49
|
-
MIXING_IN_SINGLE_LINE: 1,
|
|
50
|
-
MIXING_IN_MULTI_LINES: 2,
|
|
51
|
-
REGEX_NOT_PASSED: 3,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// TODO: rename `coordinates` to `coordinate`
|
|
55
|
-
export type ElementWithCoordinate = {
|
|
56
|
-
element: AtomicElementValue;
|
|
57
|
-
coordinate: AtomicCoordinateValue;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export class WrongBasisFormat extends Error {
|
|
61
|
-
xyz: string;
|
|
62
|
-
|
|
63
|
-
constructor(xyz: string, message: string, code: number) {
|
|
64
|
-
super(message);
|
|
65
|
-
this.xyz = xyz;
|
|
66
|
-
console.log(`Wrong basis format: ${message}, code: ${code}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export class CombinatorialBasis {
|
|
71
|
-
_xyz: string;
|
|
72
|
-
|
|
73
|
-
_lines: any[];
|
|
74
|
-
|
|
75
|
-
_hasPermutationLine: boolean;
|
|
76
|
-
|
|
77
|
-
_hasCombinationLine: boolean;
|
|
78
|
-
|
|
79
|
-
constructor(eXYZ: string) {
|
|
80
|
-
this._xyz = eXYZ;
|
|
81
|
-
this._lines = s
|
|
82
|
-
.lines(eXYZ)
|
|
83
|
-
.map((x) => x.trim())
|
|
84
|
-
.filter((x) => x !== "")
|
|
85
|
-
.map(this._parseBasisLine);
|
|
86
|
-
|
|
87
|
-
this._hasPermutationLine = this._lines.reduce((mem, a) => {
|
|
88
|
-
return mem || a.isPermutation;
|
|
89
|
-
}, false);
|
|
90
|
-
this._hasCombinationLine = this._lines.reduce((mem, a) => {
|
|
91
|
-
return mem || a.isCombination;
|
|
92
|
-
}, false);
|
|
93
|
-
|
|
94
|
-
if (this._hasPermutationLine && this._hasCombinationLine) {
|
|
95
|
-
throw new WrongBasisFormat(
|
|
96
|
-
this._xyz,
|
|
97
|
-
"Basis contains mixed permutation and combination.",
|
|
98
|
-
ERROR_CODES.MIXING_IN_MULTI_LINES,
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Parses combinatorial basis line and returns result as Object. Throws exception if line is not valid:
|
|
105
|
-
* - does not meet RegExp
|
|
106
|
-
* - mixes permutation and combination
|
|
107
|
-
* @param str {String} Combinatorial basis' line
|
|
108
|
-
* @param index {Number} order of the
|
|
109
|
-
* @return {{displayName: string, isCombination: boolean, isPermutation: boolean, elements: Array, coordinates: *[]}}
|
|
110
|
-
* @private
|
|
111
|
-
*/
|
|
112
|
-
_parseBasisLine(str: string, index: number) {
|
|
113
|
-
if (!str.match(LINE_REGEX)) {
|
|
114
|
-
throw new WrongBasisFormat(
|
|
115
|
-
this._xyz,
|
|
116
|
-
`Line #${index + 1}: "${str}" contains errors. ` +
|
|
117
|
-
'Allowed formats: "Si 0 0 0", "Si/Li 0.5 0.5 0.5", "Si,Ge 0.7 0.7 0.8"',
|
|
118
|
-
ERROR_CODES.REGEX_NOT_PASSED,
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const containsPermutation = str.indexOf(PERMUTATION_DELIMITER) > -1;
|
|
123
|
-
const containsCombination = str.indexOf(COMBINATION_DELIMITER) > -1;
|
|
124
|
-
|
|
125
|
-
if (containsCombination && containsPermutation) {
|
|
126
|
-
throw new WrongBasisFormat(
|
|
127
|
-
this._xyz,
|
|
128
|
-
`Line #${index} contains mixed permutation and combination.`,
|
|
129
|
-
ERROR_CODES.MIXING_IN_SINGLE_LINE,
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
let elements = [];
|
|
134
|
-
|
|
135
|
-
const words = s
|
|
136
|
-
.words(str)
|
|
137
|
-
.map((x) => x.trim())
|
|
138
|
-
.filter((x) => x != null);
|
|
139
|
-
|
|
140
|
-
if (containsCombination) {
|
|
141
|
-
elements = words[0].split(COMBINATION_DELIMITER).map((x) => x.trim());
|
|
142
|
-
} else if (containsPermutation) {
|
|
143
|
-
elements = words[0].split(PERMUTATION_DELIMITER).map((x) => x.trim());
|
|
144
|
-
} else {
|
|
145
|
-
elements = [words[0]];
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const coordinate = [parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3])];
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
// TODO: define as a type
|
|
152
|
-
displayName: `ELEMENT_${index}`,
|
|
153
|
-
isCombination: containsCombination,
|
|
154
|
-
isPermutation: containsPermutation,
|
|
155
|
-
elements,
|
|
156
|
-
coordinate,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Returns array of ALL unique elements used in basis.
|
|
162
|
-
* @return {String[]}
|
|
163
|
-
*/
|
|
164
|
-
get uniqueElements() {
|
|
165
|
-
return chain(this._lines)
|
|
166
|
-
.map((line) => line.elements)
|
|
167
|
-
.flatten()
|
|
168
|
-
.uniq()
|
|
169
|
-
.value()
|
|
170
|
-
.sort();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
static toBasisConfigForElementsAndCoordinates(
|
|
174
|
-
array: ElementWithCoordinate[],
|
|
175
|
-
units = "crystal" as BasisSchema["units"],
|
|
176
|
-
cell = new Cell(),
|
|
177
|
-
): ElementsAndCoordinatesConfig {
|
|
178
|
-
return {
|
|
179
|
-
elements: map(array, "element"),
|
|
180
|
-
coordinates: map(array, "coordinate"),
|
|
181
|
-
units,
|
|
182
|
-
cell,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Returns array of regular bases extracted from current combinatorial basis.
|
|
188
|
-
* @return {Basis[]|Object[]}
|
|
189
|
-
*/
|
|
190
|
-
get allBasisConfigs() {
|
|
191
|
-
let result: ElementWithCoordinate[][] = [];
|
|
192
|
-
if (this._hasPermutationLine) {
|
|
193
|
-
result = this._permutation();
|
|
194
|
-
} else if (this._hasCombinationLine) {
|
|
195
|
-
result = this._combination();
|
|
196
|
-
} else {
|
|
197
|
-
const items: ElementWithCoordinate[] = [];
|
|
198
|
-
this._lines.forEach((line) => {
|
|
199
|
-
items.push({
|
|
200
|
-
element: line.elements[0],
|
|
201
|
-
coordinate: line.coordinate,
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
result = [items];
|
|
205
|
-
}
|
|
206
|
-
return result.map((x) => CombinatorialBasis.toBasisConfigForElementsAndCoordinates(x));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Returns array of regular bases extracted from current combinatorial basis with combinations.
|
|
211
|
-
* @private
|
|
212
|
-
*/
|
|
213
|
-
_combination(): ElementWithCoordinate[][] {
|
|
214
|
-
const dimensions: ElementWithCoordinate[][] = [];
|
|
215
|
-
this._lines.forEach((line) => {
|
|
216
|
-
const itemsSet: ElementWithCoordinate[] = [];
|
|
217
|
-
line.elements.forEach((element: AtomicElementValue) => {
|
|
218
|
-
// omit vacancy characters
|
|
219
|
-
itemsSet.push({
|
|
220
|
-
element,
|
|
221
|
-
coordinate: line.coordinate,
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
dimensions.push(itemsSet);
|
|
225
|
-
});
|
|
226
|
-
// @ts-ignore // We're multiplying objects with math, not numbers. No type casting will help.
|
|
227
|
-
const basisSet = Utils.math.cartesianProduct.apply(
|
|
228
|
-
null,
|
|
229
|
-
// @ts-ignore
|
|
230
|
-
dimensions,
|
|
231
|
-
) as ElementWithCoordinate[][];
|
|
232
|
-
return basisSet.map((basis: ElementWithCoordinate[]) =>
|
|
233
|
-
basis.filter((entry) => entry.element !== VACANCY_CHARACTER),
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Returns array of regular bases extracted from current combinatorial basis with permutations.
|
|
239
|
-
* @return {Basis[]}
|
|
240
|
-
* @private
|
|
241
|
-
*/
|
|
242
|
-
_permutation() {
|
|
243
|
-
const maxLen = Math.max(...this._lines.map((x) => x.elements.length));
|
|
244
|
-
const bases = [];
|
|
245
|
-
for (let i = 0; i < maxLen; i++) {
|
|
246
|
-
const items: ElementWithCoordinate[] = [];
|
|
247
|
-
this._lines.forEach((line) => {
|
|
248
|
-
const element = line.elements.length <= i ? last(line.elements) : line.elements[i];
|
|
249
|
-
if (element !== VACANCY_CHARACTER) {
|
|
250
|
-
items.push({
|
|
251
|
-
element,
|
|
252
|
-
coordinate: line.coordinate,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
bases.push(items);
|
|
257
|
-
}
|
|
258
|
-
return bases;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Returns true if current combinatorial basis contains more than one regular basis.
|
|
263
|
-
* @return {Boolean}
|
|
264
|
-
*/
|
|
265
|
-
isCombinatorial() {
|
|
266
|
-
return this._hasCombinationLine || this._hasPermutationLine;
|
|
267
|
-
}
|
|
268
|
-
}
|
package/src/js/tools/basis.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { Coordinate3DSchema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
-
import { Utils } from "@mat3ra/utils";
|
|
3
|
-
import { chunk, flatten } from "lodash";
|
|
4
|
-
|
|
5
|
-
import { Basis } from "../basis/basis";
|
|
6
|
-
import { AtomicCoordinateValue, Coordinate } from "../basis/coordinates";
|
|
7
|
-
|
|
8
|
-
const ADD = Utils.math.add;
|
|
9
|
-
const MULT = Utils.math.multiply;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns a repeated basis of a crystal.
|
|
13
|
-
* @param basis {Basis} Original basis.
|
|
14
|
-
* @param repetitions{Number[]} Repetition vector `[x, y, z]`, in each spatial dimension.
|
|
15
|
-
* @return {Basis} New Basis.
|
|
16
|
-
*/
|
|
17
|
-
function repeat(basis: Basis, repetitions: number[]): Basis {
|
|
18
|
-
let i, j, k;
|
|
19
|
-
let shiftI = 0;
|
|
20
|
-
let shiftJ = 0;
|
|
21
|
-
let shiftK = 0;
|
|
22
|
-
|
|
23
|
-
// clone original basis and assert it is in cartesian coordinates
|
|
24
|
-
const newBasis = basis.clone();
|
|
25
|
-
const basisCloneInCrystalCoordinates = basis.clone();
|
|
26
|
-
|
|
27
|
-
newBasis.toCrystal();
|
|
28
|
-
basisCloneInCrystalCoordinates.toCrystal();
|
|
29
|
-
|
|
30
|
-
for (i = 1; i <= repetitions[0]; i += 1) {
|
|
31
|
-
for (j = 1; j <= repetitions[1]; j += 1) {
|
|
32
|
-
for (k = 1; k <= repetitions[2]; k += 1) {
|
|
33
|
-
// for each atom in original basis add one with a repetition
|
|
34
|
-
// eslint-disable-next-line no-loop-func
|
|
35
|
-
basisCloneInCrystalCoordinates.elements.forEach((element, index) => {
|
|
36
|
-
const coord = basisCloneInCrystalCoordinates.getCoordinateValueByIndex(index);
|
|
37
|
-
// only add atoms if shifts are non-zero
|
|
38
|
-
if (shiftI || shiftJ || shiftK) {
|
|
39
|
-
const coordinateInstance = Coordinate.fromValueAndId(coord);
|
|
40
|
-
const translatedCoordinateInstance = coordinateInstance.translateByVector([
|
|
41
|
-
shiftI,
|
|
42
|
-
shiftJ,
|
|
43
|
-
shiftK,
|
|
44
|
-
]);
|
|
45
|
-
newBasis.addAtom({
|
|
46
|
-
element: element.value,
|
|
47
|
-
coordinate: translatedCoordinateInstance.value,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
shiftK += 1;
|
|
52
|
-
}
|
|
53
|
-
shiftK = 0;
|
|
54
|
-
shiftJ += 1;
|
|
55
|
-
}
|
|
56
|
-
shiftJ = 0;
|
|
57
|
-
shiftI += 1;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (basis.isInCartesianUnits) newBasis.toCartesian();
|
|
61
|
-
|
|
62
|
-
return newBasis;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Calculates linear function `y = kx + b` for vectors. Isolated for modularity.
|
|
67
|
-
* @param initialCoordinate {Array} - b.
|
|
68
|
-
* @param delta {Array} - x.
|
|
69
|
-
* @param normalizedStepIndex {Number} - k.
|
|
70
|
-
* @return {Basis[]} List of all bases.
|
|
71
|
-
*/
|
|
72
|
-
function _linearInterpolation(
|
|
73
|
-
initialCoordinate: AtomicCoordinateValue,
|
|
74
|
-
delta: Coordinate3DSchema,
|
|
75
|
-
normalizedStepIndex: number,
|
|
76
|
-
): number[] {
|
|
77
|
-
return ADD(initialCoordinate, MULT(delta, normalizedStepIndex)) as number[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Returns a set of Bases for a crystal interpolated from initial to final crystal.
|
|
82
|
-
* Can be used to generate atomic configurations along a chemical reaction path, for example.
|
|
83
|
-
* @param initialBasis {Basis} Original initialBasis.
|
|
84
|
-
* @param finalBasis {Basis} Final initialBasis.
|
|
85
|
-
* @param numberOfSteps{Number} Number of intermediate steps.
|
|
86
|
-
* @return {Basis[]} List of all bases.
|
|
87
|
-
*/
|
|
88
|
-
function interpolate(initialBasis: Basis, finalBasis: Basis, numberOfSteps = 1) {
|
|
89
|
-
// check that initial and final basis have the same cell
|
|
90
|
-
if (!initialBasis.hasEquivalentCellTo(finalBasis))
|
|
91
|
-
throw new Error("basis.interpolate: Basis cells are not equal");
|
|
92
|
-
|
|
93
|
-
// clone original initialBasis and assert it is in cartesian coordinates
|
|
94
|
-
const initialBasisCopy = initialBasis.clone();
|
|
95
|
-
const finalBasisCopy = finalBasis.clone();
|
|
96
|
-
|
|
97
|
-
initialBasisCopy.toCrystal();
|
|
98
|
-
finalBasisCopy.toCrystal();
|
|
99
|
-
|
|
100
|
-
const initialCoordinates = flatten(initialBasisCopy.coordinatesAsArray);
|
|
101
|
-
const finalCoordinates = flatten(finalBasisCopy.coordinatesAsArray);
|
|
102
|
-
const delta = ADD(finalCoordinates, MULT(initialCoordinates, -1));
|
|
103
|
-
const resultingListOfBases = [];
|
|
104
|
-
|
|
105
|
-
for (let i = 1; i <= numberOfSteps; i++) {
|
|
106
|
-
const normalizedStepIndex = i / (numberOfSteps + 1);
|
|
107
|
-
const intermediateCoordinates: number[] = _linearInterpolation(
|
|
108
|
-
initialCoordinates as AtomicCoordinateValue,
|
|
109
|
-
delta as AtomicCoordinateValue,
|
|
110
|
-
normalizedStepIndex,
|
|
111
|
-
);
|
|
112
|
-
const vectorSize = 3;
|
|
113
|
-
const intermediateCoordinatesAsNestedArray = chunk(intermediateCoordinates, vectorSize);
|
|
114
|
-
const intermediateBasis = initialBasis.clone();
|
|
115
|
-
intermediateBasis.coordinates = intermediateCoordinatesAsNestedArray.map(
|
|
116
|
-
(coordinate, index) => ({
|
|
117
|
-
id: index,
|
|
118
|
-
value: coordinate as AtomicCoordinateValue,
|
|
119
|
-
}),
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
resultingListOfBases.push(intermediateBasis);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return resultingListOfBases;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default {
|
|
129
|
-
repeat,
|
|
130
|
-
interpolate,
|
|
131
|
-
};
|
package/src/js/tools/cell.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Coordinate3DSchema, Matrix3X3Schema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
-
import { Utils } from "@mat3ra/utils";
|
|
3
|
-
|
|
4
|
-
import { Cell } from "../cell/cell";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns the list of points on the original lattice contained in the supercell in fractional coordinates.
|
|
8
|
-
* Source: https://pymatgen.org/_modules/pymatgen/util/coord.html
|
|
9
|
-
*/
|
|
10
|
-
function latticePointsInSupercell(supercellMatrix: Matrix3X3Schema) {
|
|
11
|
-
const supercell = Cell.fromVectorsArray(supercellMatrix);
|
|
12
|
-
const diagonals = [
|
|
13
|
-
[0, 0, 0],
|
|
14
|
-
[0, 0, 1],
|
|
15
|
-
[0, 1, 0],
|
|
16
|
-
[0, 1, 1],
|
|
17
|
-
[1, 0, 0],
|
|
18
|
-
[1, 0, 1],
|
|
19
|
-
[1, 1, 0],
|
|
20
|
-
[1, 1, 1],
|
|
21
|
-
];
|
|
22
|
-
const d_points = diagonals.map((point) =>
|
|
23
|
-
supercell.convertPointToCartesian(point as Coordinate3DSchema),
|
|
24
|
-
);
|
|
25
|
-
const mins = [0, 1, 2].map((i) => Utils.math.min(...d_points.map((p) => p[i])));
|
|
26
|
-
const maxes = [0, 1, 2].map((i) => Utils.math.max(...d_points.map((p) => p[i])) + 1);
|
|
27
|
-
const points = [];
|
|
28
|
-
for (let i = mins[0]; i <= maxes[0]; i++) {
|
|
29
|
-
for (let j = mins[1]; j <= maxes[1]; j++) {
|
|
30
|
-
for (let k = mins[2]; k <= maxes[2]; k++) {
|
|
31
|
-
points.push(supercell.convertPointToCrystal([i, j, k]));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return points;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
latticePointsInSupercell,
|
|
40
|
-
};
|
package/src/js/tools/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import BasisTools from "./basis";
|
|
2
|
-
import MaterialTools from "./material";
|
|
3
|
-
import SupercellTools from "./supercell";
|
|
4
|
-
import SurfaceTools from "./surface";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
surface: SurfaceTools,
|
|
8
|
-
supercell: SupercellTools,
|
|
9
|
-
material: MaterialTools,
|
|
10
|
-
basis: BasisTools,
|
|
11
|
-
};
|
package/src/js/tools/material.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { LatticeSchema, Vector3DSchema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
-
import { Utils } from "@mat3ra/utils";
|
|
3
|
-
|
|
4
|
-
import { ATOMIC_COORD_UNITS } from "../constants";
|
|
5
|
-
import { Lattice } from "../lattice/lattice";
|
|
6
|
-
import Material from "../Material";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Scales one lattice vector for the given material
|
|
10
|
-
* @param material {Material} The material acted upon.
|
|
11
|
-
* @param key {String} Lattice vector key.
|
|
12
|
-
* @param factor {Number} Float scaling factor.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function scaleOneLatticeVector(material: Material, key: "a" | "b" | "c" = "a", factor = 1.0) {
|
|
16
|
-
const lattice = { ...material.lattice };
|
|
17
|
-
if (lattice.vectors === undefined) {
|
|
18
|
-
throw new Error("Lattice vectors are undefined");
|
|
19
|
-
}
|
|
20
|
-
lattice.vectors[key] = lattice.vectors[key].map((v) => v * factor) as Vector3DSchema;
|
|
21
|
-
|
|
22
|
-
material.setLattice(Lattice.fromVectors(lattice.vectors).toJSON());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Updates the size of a materials lattice using the minimumLatticeSize function.
|
|
27
|
-
* The new size of the material is calculated based on the materials basis.
|
|
28
|
-
* @param material {Material}
|
|
29
|
-
*/
|
|
30
|
-
function scaleLatticeToMakeNonPeriodic(material: Material) {
|
|
31
|
-
material.setLattice(
|
|
32
|
-
Lattice.fromConfigPartial({
|
|
33
|
-
a: material.getBasis().getMinimumLatticeSize(),
|
|
34
|
-
type: "CUB",
|
|
35
|
-
} as LatticeSchema).toJSON(),
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Updates the basis of a material by translating the coordinates
|
|
41
|
-
* so that the center of the material and lattice are aligned.
|
|
42
|
-
* @param material {Material}
|
|
43
|
-
* */
|
|
44
|
-
function translateAtomsToCenter(material: Material) {
|
|
45
|
-
const basis = material.getBasis();
|
|
46
|
-
const originalUnits = basis.units;
|
|
47
|
-
material.toCartesian();
|
|
48
|
-
const updatedBasis = basis.toCartesian();
|
|
49
|
-
const centerOfCoordinates = updatedBasis.centerOfCoordinatesPoint;
|
|
50
|
-
const centerOfLattice = Utils.math.multiply(
|
|
51
|
-
0.5,
|
|
52
|
-
material.getLattice().vectorArrays.reduce((a, b) => Utils.math.add(a, b) as Vector3DSchema),
|
|
53
|
-
);
|
|
54
|
-
const translationVector = Utils.math.subtract(centerOfLattice, centerOfCoordinates);
|
|
55
|
-
updatedBasis.translateByVector(translationVector as Vector3DSchema);
|
|
56
|
-
material.setBasis(updatedBasis.toJSON());
|
|
57
|
-
if (originalUnits !== ATOMIC_COORD_UNITS.cartesian) material.toCrystal();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default {
|
|
61
|
-
scaleOneLatticeVector,
|
|
62
|
-
scaleLatticeToMakeNonPeriodic,
|
|
63
|
-
translateAtomsToCenter,
|
|
64
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Coordinate3DSchema, Matrix3X3Schema } from "@mat3ra/esse/dist/js/types";
|
|
2
|
-
import { Utils } from "@mat3ra/utils";
|
|
3
|
-
|
|
4
|
-
import { Basis } from "../basis/basis";
|
|
5
|
-
import { ConstrainedBasis } from "../basis/constrained_basis";
|
|
6
|
-
import { Cell } from "../cell/cell";
|
|
7
|
-
import { Lattice } from "../lattice/lattice";
|
|
8
|
-
import type { MaterialSchemaMap } from "../Material";
|
|
9
|
-
import type Material from "../Material";
|
|
10
|
-
import cellTools from "./cell";
|
|
11
|
-
|
|
12
|
-
const ADD = Utils.math.add;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Generates new basis for a supercell. For each site from basis generates shifts that are within supercell.
|
|
16
|
-
*/
|
|
17
|
-
function generateNewBasisWithinSupercell(
|
|
18
|
-
basis: Basis | ConstrainedBasis,
|
|
19
|
-
cell: Cell,
|
|
20
|
-
supercell: Cell,
|
|
21
|
-
supercellMatrix: Matrix3X3Schema,
|
|
22
|
-
): Basis {
|
|
23
|
-
const oldBasis = basis.clone();
|
|
24
|
-
const newBasis = basis.clone();
|
|
25
|
-
newBasis.removeAllAtoms();
|
|
26
|
-
|
|
27
|
-
oldBasis.toCrystal();
|
|
28
|
-
newBasis.toCrystal();
|
|
29
|
-
|
|
30
|
-
oldBasis.elements.forEach((element) => {
|
|
31
|
-
const coordinate = oldBasis.getCoordinateValueById(element.id);
|
|
32
|
-
const cartesianCoordinate = cell.convertPointToCartesian(coordinate);
|
|
33
|
-
const shifts = cellTools.latticePointsInSupercell(supercellMatrix);
|
|
34
|
-
shifts.forEach((combination) => {
|
|
35
|
-
// "combination" is effectively a point in fractional coordinates here, hence the below
|
|
36
|
-
const newPoint = ADD(
|
|
37
|
-
cartesianCoordinate,
|
|
38
|
-
supercell.convertPointToCartesian(combination),
|
|
39
|
-
);
|
|
40
|
-
if (supercell.isPointInsideCell(newPoint as Coordinate3DSchema)) {
|
|
41
|
-
newBasis.addAtom({
|
|
42
|
-
element: element.value,
|
|
43
|
-
coordinate: supercell.convertPointToCrystal(
|
|
44
|
-
newPoint as Coordinate3DSchema,
|
|
45
|
-
) as Coordinate3DSchema,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return newBasis as Basis;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @summary Generates supercell config for the specified material.
|
|
56
|
-
*/
|
|
57
|
-
function generateConfig<Schemas extends MaterialSchemaMap = MaterialSchemaMap>(
|
|
58
|
-
material: Material<Schemas>,
|
|
59
|
-
supercellMatrix: Matrix3X3Schema,
|
|
60
|
-
) {
|
|
61
|
-
const det = Utils.math.det(supercellMatrix);
|
|
62
|
-
if (det === 0) {
|
|
63
|
-
throw new Error("Scaling matrix is degenerate.");
|
|
64
|
-
}
|
|
65
|
-
const cell = material.getLattice().vectors;
|
|
66
|
-
const supercell = cell.cloneAndScaleByMatrix(supercellMatrix);
|
|
67
|
-
const newBasis = generateNewBasisWithinSupercell(
|
|
68
|
-
material.getBasis(),
|
|
69
|
-
cell,
|
|
70
|
-
supercell,
|
|
71
|
-
supercellMatrix,
|
|
72
|
-
);
|
|
73
|
-
const newLattice = Lattice.fromVectors({
|
|
74
|
-
a: supercell.a,
|
|
75
|
-
b: supercell.b,
|
|
76
|
-
c: supercell.c,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
name: `${material.name} - supercell ${JSON.stringify(supercellMatrix)}`,
|
|
81
|
-
basis: newBasis.toJSON(),
|
|
82
|
-
lattice: newLattice.toJSON(),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default {
|
|
87
|
-
generateConfig,
|
|
88
|
-
generateNewBasisWithinSupercell,
|
|
89
|
-
};
|