#!/usr/bin/env python # coding: utf-8 # ## Building Surfaces and Slabs Part 4: Molecular Crystals and Water # # A crystal can contain finite molecules, an extended bonded network, or both. A plane chosen by atomic coordinates alone may divide a molecule between the two slab faces. By default, `Surface.from_bulk()` recognizes finite bonded components and maps each one continuously before removing periodicity normal to the surface. from collections import Counter from scm.base import ChemicalSystem from scm.plams import plot_image_grid, view from scm.structures import Surface # ## Monoclinic molecular crystal: naphthalene # # A plane through a molecular crystal can cut through molecules. Inspect each # resulting slab before using it in a calculation. We make both `(001)` and # `(100)` cuts from the same naphthalene bulk cell. naphthalene_bulk = ChemicalSystem( """\ System Atoms C -0.87388368 0.11073012 2.36589887 C 0.15273024 3.05568012 4.76889870 C 4.17013024 5.77916988 4.76889870 C 3.14351632 2.83421988 2.36589887 H -1.09410897 0.35103804 3.23705766 H 0.37295554 3.29598804 3.89773991 H 4.39035554 5.53886196 3.89773991 H 2.92329103 2.59391196 3.23705766 C -0.12579372 0.96653259 1.59034638 C -0.59535971 3.91148259 5.54445119 C 3.42204029 4.92336741 5.54445119 C 3.89160628 1.97841741 1.59034638 H 0.15997330 1.77874980 1.94280538 H -0.88112673 4.72369980 5.19199219 H 3.13627327 4.11115020 5.19199219 H 4.17737330 1.16620020 1.94280538 C 0.21357858 0.61726152 0.25185835 C -0.93473202 3.56221152 6.88293921 C 3.08266798 5.27263848 6.88293921 C 4.23097858 2.32768848 0.25185835 C -3.75675609 1.48307682 6.55901941 C 3.03560266 4.42802682 0.57577816 C 7.05300266 4.40682318 0.57577816 C 0.26064391 1.46187318 6.55901941 H -3.47488266 2.30353989 6.89435489 H 2.75372923 5.24848989 0.24044268 H 6.77112923 3.58636011 0.24044268 H 0.54251734 0.64141011 6.89435489 C 6.72508585 4.75845021 1.84862605 C 0.58856072 1.81350021 5.28617152 C -3.42883928 1.13144979 5.28617152 C 2.70768585 4.07639979 1.84862605 H 6.21662119 4.18477395 2.37588759 H 1.09702538 1.23982395 4.75890998 H -2.92037462 1.70512605 4.75890998 H 2.19922119 4.65007605 2.37588759 End Lattice 8.03480000 0.00000000 0.00000000 0.00000000 5.88990000 0.00000000 -4.73855343 0.00000000 7.13479757 End End""" ) view(naphthalene_bulk, guess_bonds=True, direction="tilt_z", picture_path="picture1.png") # The naphthalene (100) surface can be cut directly without cutting through any molecules. The result is exactly what you would expect: bulk = naphthalene_bulk miller = (1, 0, 0) surf = Surface.from_bulk(bulk, miller, num_layers=3) system = surf.system system.guess_bonds() plot_image_grid({ f"Naphthalene{miller}; top": view(system, direction="along_z"), f"Naphthalene{miller}; tilted": view(system, direction="tilt_x"), }, rows=1, save_path="picture2.png"); # For naphthalene(001), no matter where the cutting plane is it will cut through a naphthalene molecule. The default `Surface.from_bulk()` algorithm will correct this by mapping a molecule onto the other side of the slab: bulk = naphthalene_bulk miller = (0, 0, 1) # make supercell the help visualization surf = Surface.from_bulk(bulk, miller, num_layers=3).make_supercell((1, 4)) system = surf.system system.guess_bonds() print("Atoms per molecule:", sorted(Counter(system.molecule_indices()).values())) plot_image_grid({ f"Naphthalene{miller}; top": view(system, direction="along_z"), f"Naphthalene{miller}; tilted": view(system, direction="tilt_x"), }, rows=1, save_path="picture3.png"); # Above, "Atoms per molecule" shows that each molecule is intact in the resulting slab. However, the surface is "grooved". # ## Hydrated α-MnO₂: water inside a three-dimensional oxide network # # α-MnO₂ has a three-dimensional Mn–O framework with tunnels. Water can occupy these tunnels. We use the published [framework positions](https://www.sciencedirect.com/science/article/abs/pii/S1567173915300729) and a [reported tunnel-water oxygen site](https://www.osti.gov/servlets/purl/373809). The experimental water is partly occupied and disordered; this small ordered model has one water oxygen per framework cell. hydrated_alpha_mno2_bulk = ChemicalSystem("""System Atoms Mn 3.43525000 1.66855000 0.00000000 Mn 6.37975000 8.14645000 0.00000000 Mn 8.14645000 3.43525000 0.00000000 Mn 1.66855000 6.37975000 0.00000000 Mn 8.34275000 6.57605000 1.42350000 Mn 1.47225000 3.23895000 1.42350000 Mn 3.23895000 8.34275000 1.42350000 Mn 6.57605000 1.47225000 1.42350000 O 1.57040000 2.01207500 0.00000000 O 8.24460000 7.80292500 0.00000000 O 7.80292500 1.57040000 0.00000000 O 2.01207500 8.24460000 0.00000000 O 6.47790000 6.91957500 1.42350000 O 3.33710000 2.89542500 1.42350000 O 2.89542500 6.47790000 1.42350000 O 6.91957500 3.33710000 1.42350000 O 1.57040000 4.49527000 0.00000000 O 8.24460000 5.31973000 0.00000000 O 5.31973000 1.57040000 0.00000000 O 4.49527000 8.24460000 0.00000000 O 6.47790000 9.40277000 1.42350000 O 3.33710000 0.41223000 1.42350000 O 0.41223000 6.47790000 1.42350000 O 9.40277000 3.33710000 1.42350000 O 4.901356112136004 4.951951509087557 1.961006469638274 region=water H 4.26084657537029 5.732092895387114 1.802527202379229 region=water H 4.329990160937592 4.119392794777925 1.837363739100606 region=water End Lattice 9.815 0 0 0 9.815 0 0 0 2.847 End End""") hydrated_alpha_mno2_bulk.guess_bonds() print("Bulk component sizes:", sorted(Counter(hydrated_alpha_mno2_bulk.molecule_indices()).values())) view(hydrated_alpha_mno2_bulk, direction="tilt_z", show_regions=True, picture_path="picture4.png") # When building the slab, the water molecule will be kept intact: bulk = hydrated_alpha_mno2_bulk miller = (0, 0, 1) surf = Surface.from_bulk(bulk, miller, num_layers=2).make_supercell((2, 2)) system = surf.system system.guess_bonds() print("Slab component sizes:", sorted(Counter(system.molecule_indices()).values())) plot_image_grid({ f"Hydrated alpha-MnO2{miller}; top": view(system, direction="along_z"), f"Hydrated alpha-MnO2{miller}; tilted": view(system, direction="tilt_x"), }, rows=1, save_path="picture5.png");