Skip to content

Commit

Permalink
Merge branch 'cgnr'
Browse files Browse the repository at this point in the history
  • Loading branch information
zerothi committed Nov 22, 2023
2 parents 0329255 + b741ac2 commit 0c80505
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ we hit release version 1.0.0.
- enabled `Grid.to|new` with the most basic stuff
str|Path|Grid|pyamg
- `Shape.translate`, to easily translate entire shape constructs, #655
- Creation of chiral GNRs (`kind=chiral` in `sisl.geom.nanoribbon`/`sisl.geom.graphene_nanoribbon`
as well as `sisl.geom.cgnr`)
- Creation of [n]-triangulenes (`sisl.geom.triangulene`)

### Fixed
- enabled slicing in matrix assignments, #650
- changed `Shape.volume()` to `Shape.volume`

### Changed
- `vacuum` is now an optional parameter for all ribbon structures


## [0.14.3] - 2023-11-07
Expand Down
12 changes: 10 additions & 2 deletions docs/api/default_geom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ Surfaces (slabs)
fcc_slab
rocksalt_slab

0D materials
============

.. autosummary::
:toctree: generated/

honeycomb_flake
graphene_flake
triangulene

1D materials
============
Expand All @@ -52,6 +61,7 @@ Surfaces (slabs)
nanoribbon
agnr
zgnr
cgnr
graphene_nanoribbon
nanotube
heteroribbon
Expand All @@ -67,8 +77,6 @@ Surfaces (slabs)
honeycomb
bilayer
graphene
honeycomb_flake
graphene_flake


Helpers
Expand Down
43 changes: 40 additions & 3 deletions src/sisl/geom/flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

from ._common import geometry_define_nsc

__all__ = ["honeycomb", "graphene", "honeycomb_flake", "graphene_flake"]
__all__ = ["honeycomb", "graphene", "honeycomb_flake", "graphene_flake", "triangulene"]


@set_module("sisl.geom")
def honeycomb(bond: float, atoms, orthogonal: bool = False):
def honeycomb(bond: float, atoms, orthogonal: bool = False) -> Geometry:
"""Honeycomb lattice with 2 or 4 atoms per unit-cell, latter orthogonal cell
This enables creating BN lattices with ease, or graphene lattices.
Expand Down Expand Up @@ -65,7 +65,7 @@ def honeycomb(bond: float, atoms, orthogonal: bool = False):


@set_module("sisl.geom")
def graphene(bond: float = 1.42, atoms=None, orthogonal: bool = False):
def graphene(bond: float = 1.42, atoms=None, orthogonal: bool = False) -> Geometry:
"""Graphene lattice with 2 or 4 atoms per unit-cell, latter orthogonal cell
Parameters
Expand Down Expand Up @@ -204,3 +204,40 @@ def graphene_flake(
if atoms is None:
atoms = Atom(Z=6, R=bond * 1.01)
return honeycomb_flake(shells, bond, atoms, vacuum)


@set_module("sisl.geom")
def triangulene(
n: int, bond: float = 1.42, atoms=None, vacuum: float = 20.0
) -> Geometry:
"""Construction of an [n]-triangulene geometry
Parameters
----------
n :
size of the triangulene
bond :
bond length between atoms (*not* lattice constant)
atoms :
the atom (or atoms) that the honeycomb lattice consists of.
Default to Carbon atom.
vacuum:
Amount of vacuum to add to the cell on all directions
"""
if atoms is None:
atoms = Atom(Z=6, R=bond * 1.01)
geom = graphene(bond=bond, atoms=atoms) * (n + 1, n + 1, 1)
idx = np.where(geom.xyz[:, 0] <= geom.cell[0, 0] + 0.01)[0]
geom = geom.sub(idx[1:])

# Set the cell according to the requested vacuum
size = geom.xyz.max(axis=0) - geom.xyz.min(axis=0)
geom.cell[:] = np.diag(size + vacuum)

# Center the molecule in cell
geom = geom.move(geom.center(what="cell") - geom.center())

# Set boundary conditions
geometry_define_nsc(geom, [False, False, False])

return geom
Loading

0 comments on commit 0c80505

Please sign in to comment.