Skip to content

feature/SOF-7676 #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2c9fb7b
chore: update gitignore
VsevolodX Jul 18, 2025
6ce09ef
update: slab nb
VsevolodX Jul 18, 2025
22ddd4a
update: import materials as MAterial or Material with build metadata
VsevolodX Jul 18, 2025
7aedb7f
update: area vs strain
VsevolodX Jul 19, 2025
dd67089
update: adataom nb
VsevolodX Jul 19, 2025
ea4b9cc
update: nanoparticles nbs
VsevolodX Jul 20, 2025
5d32a4c
update: gb nbs
VsevolodX Jul 20, 2025
0821a33
update: island nbs
VsevolodX Jul 20, 2025
0fa2f7a
update: nanoribbon nanowire nbs
VsevolodX Jul 20, 2025
b5140f3
update: terrace nb
VsevolodX Jul 20, 2025
8927cd4
update: pair defect nb
VsevolodX Jul 20, 2025
c163253
update: gb nb
VsevolodX Jul 22, 2025
9776990
update: simple interface nb
VsevolodX Jul 22, 2025
bba6509
chore: improt mde
VsevolodX Jul 22, 2025
36172f0
update: nanoribbon nb
VsevolodX Jul 22, 2025
fc593e6
update: zsl nb
VsevolodX Jul 22, 2025
b9b7dc7
update: cleanups
VsevolodX Jul 22, 2025
720f196
update: cleanups 2
VsevolodX Jul 22, 2025
44d796c
update: heterostructure nb
VsevolodX Jul 22, 2025
93d422c
update: nanoribbon interface nb
VsevolodX Jul 22, 2025
28c5075
update: comm lat interface nb
VsevolodX Jul 22, 2025
933a4bf
update: passivate slab surface nb
VsevolodX Jul 22, 2025
eda18c8
update: passivate edge nb
VsevolodX Jul 22, 2025
2a9c86a
update: point defects nb
VsevolodX Jul 22, 2025
7243990
update: made
VsevolodX Jul 22, 2025
9c792e8
update: adatom defects multiple nb
VsevolodX Jul 22, 2025
f41ccb4
update: cluster nb
VsevolodX Jul 22, 2025
7074206
update: monolayer nb
VsevolodX Jul 22, 2025
90a28e1
update: island cylinder nb
VsevolodX Jul 22, 2025
99b3235
update: island custom nb
VsevolodX Jul 22, 2025
721dd68
chore: improt made
VsevolodX Jul 22, 2025
5081375
chore: adjsut to see
VsevolodX Jul 22, 2025
ab821b9
update: use latest made + adatom nb
VsevolodX Jul 28, 2025
df96679
update: interfaces nb
VsevolodX Jul 28, 2025
eff8248
chore: made from gh commit
VsevolodX Jul 28, 2025
c09a222
update: small adjustments
VsevolodX Jul 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ celerybeat-schedule

# Environments
.env
.venv
.venv*
env/
venv/
ENV/
Expand Down
101 changes: 37 additions & 64 deletions other/materials_designer/create_adatom_defect.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,32 @@
"id": "5e43ff288847b784"
},
{
"metadata": {},
"cell_type": "code",
"source": [
"from mat3ra.made.tools.build.defect.enums import AdatomPlacementMethodEnum\n",
"from mat3ra.made.tools.build.slab.termination_utils import select_slab_termination\n",
"\n",
"ELEMENT = \"Si\" # Chemical element of the adatom\n",
"DEFECT_CONFIGS = [\n",
" {\n",
" \"defect_type\": \"adatom\",\n",
" \"placement_method\": \"equidistant\",\n",
" \"chemical_element\": \"Si\",\n",
" \"position_on_surface\": [0.5, 0.5],\n",
" \"distance_z\": 2.0,\n",
" \"use_cartesian_coordinates\": False\n",
" },\n",
" \"type\": \"adatom\",\n",
" \"coordinate\": [0.5, 0.5], # Crystal coordinates on the surface (x, y)\n",
" \"distance_z\": 1.0, # Method to place the adatom\n",
" \"element\": ELEMENT,\n",
" }\n",
"]\n",
"PLACEMENT_METHOD = AdatomPlacementMethodEnum.NEW_CRYSTAL_SITE # Method to place the adatom, e.g., \"NEW_CRYSTAL_SITE\", \"EQUIDISTANT\", \"EXACT_COORDINATE\"\n",
"\n",
"\n",
"# Slab parameters\n",
"MILLER_INDICES = (1, 1, 1) # Miller indices of the surface\n",
"SLAB_THICKNESS = 3 # Thickness of the slab in unit cells\n",
"VACUUM = 6 # Vacuum thickness in Angstrom\n",
"SUPERCELL_MATRIX = [[2, 0, 0], [0, 2, 0], [0, 0, 1]] # Supercell matrix for the slab"
"VACUUM = 5.0 # Vacuum thickness in Angstrom\n",
"XY_SUPERCELL_MATRIX = [[2, 0], [0, 2]] # Supercell matrix for the slab\n",
"TERMINATION_FORMULA = None # Stoichiometric formula of the slab termination to be used."
],
"metadata": {
"collapsed": false
},
"id": "9d8b1890b34d850a",
"id": "b28e2fb6a4ea857f",
"outputs": [],
"execution_count": null
},
Expand Down Expand Up @@ -142,24 +146,24 @@
"cell_type": "code",
"source": [
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
"from mat3ra.made.tools.build.slab.helpers import create_slab\n",
"from mat3ra.made.tools.build.slab.helpers import create_slab, get_slab_terminations\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"material = materials[0]\n",
"# Create analyzer to get terminations\n",
"analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material, miller_indices=MILLER_INDICES)\n",
"slab_terminations = analyzer.terminations\n",
"# Get termination from analyzer\n",
"terminations = analyzer.terminations\n",
"termination = terminations[0] # Use first termination\n",
"terminations = get_slab_terminations(material, MILLER_INDICES)\n",
"termination = select_slab_termination(terminations, TERMINATION_FORMULA)\n",
"\n",
"slab = create_slab(\n",
" crystal=material,\n",
" termination=termination,\n",
" miller_indices=MILLER_INDICES,\n",
" number_of_layers=1,\n",
" vacuum=0,\n",
" xy_supercell_matrix=[[1, 0], [0, 1]],\n",
" number_of_layers=SLAB_THICKNESS,\n",
" vacuum=VACUUM,\n",
" xy_supercell_matrix=XY_SUPERCELL_MATRIX,\n",
" use_orthogonal_c=True,\n",
" use_conventional_cell=True\n",
")\n",
Expand All @@ -172,50 +176,19 @@
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## 2. Create the Defect\n",
"### 2.1. Set adatom parameters"
],
"source": "## 2. Create the Defect",
"id": "b386c06587b2f843"
},
{
"metadata": {},
"cell_type": "code",
"source": [
"from mat3ra.made.tools.build.defect import AdatomSlabPointDefectConfiguration\n",
"\n",
"defect_configurations = [\n",
" AdatomSlabPointDefectConfiguration(\n",
" crystal=slab,\n",
" defect_type=defect[\"defect_type\"],\n",
" placement_method=defect[\"placement_method\"],\n",
" chemical_element=defect[\"chemical_element\"],\n",
" position_on_surface=defect[\"position_on_surface\"],\n",
" distance_z=defect[\"distance_z\"],\n",
" use_cartesian_coordinates=defect[\"use_cartesian_coordinates\"]\n",
" ) for defect in DEFECT_CONFIGS\n",
"]"
],
"id": "3727ba76ad5101c0",
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### 2.2. Create the adatom"
],
"metadata": {
"collapsed": false
},
"id": "489b51f0ee122c48"
},
{
"cell_type": "code",
"source": [
"from mat3ra.made.tools.build.defect import create_defects\n",
"from mat3ra.made.tools.build.defect.adatom.helpers import create_multiple_adatom_defects\n",
"\n",
"slab_with_adatom = create_defects(defect_configurations)"
"slab_with_adatom = create_multiple_adatom_defects(\n",
" slab=slab,\n",
" defect_dicts=DEFECT_CONFIGS,\n",
" placement_method=PLACEMENT_METHOD.value,\n",
")"
],
"metadata": {
"collapsed": false
Expand All @@ -226,9 +199,7 @@
},
{
"cell_type": "markdown",
"source": [
"## 3. Visualize the Slabs with Adatom"
],
"source": "## 3. Visualize the Slab with Adatom",
"metadata": {
"collapsed": false
},
Expand All @@ -240,10 +211,12 @@
"source": [
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_adatom, \"title\": f\"Material with adatom defects\"}],\n",
" viewer=\"wave\"\n",
" )"
"visualize([\n",
" {\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_adatom, \"title\": f\"Material with adatom defects\"}\n",
"],\n",
" viewer=\"wave\"\n",
")"
],
"id": "256b07fb2dd39ae2",
"outputs": [],
Expand Down
70 changes: 7 additions & 63 deletions other/materials_designer/create_cluster_custom_shape.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"source": [
"RADIUS = 0.3 # in crystal units\n",
"VACUUM = 10.0 # in Angstroms on each side\n",
"SUPERCELL_SIZE = 10 # in crystal units\n",
"Z_ORIENTATION = (0, 0, 1) # Miller indices of the slab orientation along the z-axis for the cluster\n",
"USE_CARTESIAN_COORDINATES = False\n",
"NAME = \"Icosahedron\" # Name of the cluster"
],
"metadata": {
Expand Down Expand Up @@ -115,7 +115,7 @@
"class CustomCoordinateCondition(CoordinateCondition):\n",
" \"\"\"Creates a regular polyhedron shape using SciPy's ConvexHull\"\"\"\n",
" radius: float = 1\n",
" center: List[float] = [0.5, 0.5, 0.5]\n",
" center_coordinate: List[float] = [0.5, 0.5, 0.5]\n",
"\n",
" @property\n",
" def _hull_planes(self):\n",
Expand All @@ -129,12 +129,12 @@
"\n",
" def condition(self, coordinate: List[float]) -> bool:\n",
" \"\"\"Returns True if point is inside the polyhedron\"\"\"\n",
" point = np.array(coordinate) - self.center\n",
" point = np.array(coordinate) - self.center_coordinate\n",
" return all(np.dot(plane[:3], point) + plane[3] <= 0\n",
" for plane in self._hull_planes)\n",
"\n",
" \n",
"condition = CustomCoordinateCondition(radius=RADIUS).condition"
"condition = CustomCoordinateCondition(radius=RADIUS)"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -181,13 +181,9 @@
{
"cell_type": "code",
"source": [
"from mat3ra.made.tools.build.nanoparticle import SlabBasedNanoparticleConfiguration\n",
"\n",
"config = SlabBasedNanoparticleConfiguration(\n",
" material=materials[0],\n",
" condition_builder=condition,\n",
" supercell_size=SUPERCELL_SIZE,\n",
")"
"from mat3ra.made.tools.build.nanoparticle.helpers import create_nanoparticle_from_material\n",
"material = materials[0]\n",
"cluster = create_nanoparticle_from_material(material=material,condition=condition, orientation_z=Z_ORIENTATION, vacuum_padding=VACUUM, use_cartesian_coordinates=USE_CARTESIAN_COORDINATES)"
],
"metadata": {
"collapsed": false
Expand All @@ -196,58 +192,6 @@
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"#### 2.2. Create the cluster"
],
"metadata": {
"collapsed": false
},
"id": "10799f3efede924d"
},
{
"cell_type": "code",
"source": [
"from mat3ra.made.tools.build.nanoparticle import create_nanoparticle\n",
"\n",
"cluster = create_nanoparticle(config)"
],
"metadata": {
"collapsed": false
},
"id": "a990fa35742d7269",
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### 2.2. Set lattice to Cubic"
],
"metadata": {
"collapsed": false
},
"id": "a01018588e6e55fc"
},
{
"cell_type": "code",
"source": [
"from mat3ra.made.lattice import Lattice\n",
"\n",
"current_vector_1, current_vector_2, current_vector_3 = cluster.lattice.vectors\n",
"cubic_vector_1 = [current_vector_1[0], 0, 0]\n",
"cubic_vector_2 = [0, current_vector_2[1], 0]\n",
"cubic_vector_3 = [0, 0, current_vector_3[2]]\n",
"cluster.lattice = Lattice.from_vectors_array([cubic_vector_1, cubic_vector_2, cubic_vector_3], type=\"CUB\")"
],
"metadata": {
"collapsed": false
},
"id": "4f78c4743b370c3b",
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
Expand Down
Loading