Skip to content

Commit

Permalink
update doc for macro average
Browse files Browse the repository at this point in the history
  • Loading branch information
robinzyb committed Dec 14, 2024
1 parent dc8b28b commit be0f396
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cp2kdata/cube/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ def get_pav(self, axis='z', interpolate=False):
return points, vals

def get_mav(self, l1, l2=0, ncov=1, interpolate=False, axis="z"):
"""
Get marcoaverage of the cube file
"""

cell_length = {
"x": self.cell.get_cell_lengths()[0],
"y": self.cell.get_cell_lengths()[1],
Expand Down
7 changes: 4 additions & 3 deletions docs/cube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ pav_x, pav = mycube.get_pav(axis="z", interpolate=True)
```

## Macro Averaging
The `get_mav()` method allows you to compute macro average data with or without interpolation. Specify the length of the first and second periodicity (l1 and l2) and the system type (ncov) as parameters:
The `get_mav()` method allows you to compute macro average data with or without interpolation.
The method `get_mav()` is usually used for determining the electrostatic potential difference across two materials.cite`{Junquera.Rabe.2007.10.1088/0953-8984/19/21/213203}` Assume you have an atomic model of a heterojunction with SiO2 and Si with the interface normal to the `z` axis. You can specify the length of the first and second periodicity (l1 and l2) for SiO2 and Si. The periodicity can be determined from their interlayer distances normal to the `z` axis. In practice, it is recommended to set periodicity to double minimum interlayer distances to obtain better plateau in the bulk regions of the materials. The `ncov` means the types of systems. `ncov=1` indicates one material with vacuum. In this case, `l2` can be None. `ncov=2` indicates two materials in the box, for example, the SiO2 and Si heterojunction. `l1` and `l2` are set to the periodicity of the two materials, respectively.

```python
# Get macro average data without interpolation
mav_x, mav = mycube.get_mav(l1=4.8, l2=4.8, ncov=1, interpolate=False)
mav_x, mav = mycube.get_mav(l1=4.8, l2=4.8, ncov=1, interpolate=False, axis='z')

# Get macro average data with interpolation
mav_x, mav = mycube.get_mav(l1=4.8, l2=4.8, ncov=2, interpolate=True)
mav_x, mav = mycube.get_mav(l1=4.8, l2=4.8, ncov=2, interpolate=True, axis='z')

```

Expand Down
15 changes: 15 additions & 0 deletions jupyter-book/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@ @article{wong2010points
pages={573},
year={2010},
publisher={Nature Publishing Group}
}


@article{Junquera.Rabe.2007.10.1088/0953-8984/19/21/213203,
year = {2007},
title = {{Nanoscale smoothing and the analysis of interfacial charge and dipolar densities}},
author = {Junquera, Javier and Cohen, Morrel H and Rabe, Karin M},
journal = {Journal of Physics: Condensed Matter},
issn = {0953-8984},
doi = {10.1088/0953-8984/19/21/213203},
eprint = {cond-mat/0701146},
pages = {213203},
number = {21},
volume = {19},
keywords = {},
}

0 comments on commit be0f396

Please sign in to comment.