Note
Go to the end to download the full example code.
Pair distribution functions¶
Basic usage¶
In the following example, we will show how to calculate the two-dimensional planar pair distribution functions.
In the following, we will give an example of a trajectory of water confined by graphene
sheets simulated via GROMACS. We assume that the GROMACS topology is given by
graphene_water.tpr and the trajectory is given by graphene_water.xtc. Both can be
downloaded under topology
and
trajectory
, respectively.
From these files you can create a MDAnalysis universe object.
We begin by importing the necessary modules.
import matplotlib.pyplot as plt
import MDAnalysis as mda
import numpy as np
import maicos
Next, we proceed with the creation of a MDAnalysis universe object, from which we further select the water molecules using the resname selector.
u = mda.Universe("./graphene_water.tpr", "graphene_water.xtc")
This universe object can then be passed to maicos.modules.pdfplanar.PDFPlanar
analysis object.
It expects you to pass the atom groups you want to perform the analysis for.
In our example, we have graphene walls and SPC/E water confined between them,
where we are interested in the dielectric behavior of the fluid.
Thus, we will first select the water as an MDAnalysis atom group using
MDAnalysis.core.groups.AtomGroup.select_atoms()
. In this case we select
the water by filtering for the residue named SOL
.
water = u.select_atoms("resname SOL")
ana_obj = maicos.PDFPlanar(
water,
water,
dzheight=0.25,
dim=2,
pdf_bin_width=0.2,
refgroup=water,
zmin=-5.0,
zmax=0,
)
Next, we can run the analysis over the trajectory.
To this end we call the member function
run
.
We may set the verbose
keyword to True
to get additional information
such a a progress bar.
Here you also have the chance to set start
and stop
keywords to
specify which frames the analysis should start at and where to end.
One can also specify a step
keyword to only analyze every step
frames.
ana_obj.run(verbose=True, step=1)
0%| | 0/2001 [00:00<?, ?it/s]
0%| | 5/2001 [00:00<00:46, 43.01it/s]
0%| | 10/2001 [00:00<00:46, 42.94it/s]
1%| | 15/2001 [00:00<00:46, 42.86it/s]
1%| | 20/2001 [00:00<00:46, 42.88it/s]
1%| | 25/2001 [00:00<00:46, 42.83it/s]
1%|▏ | 30/2001 [00:00<00:45, 42.87it/s]
2%|▏ | 35/2001 [00:00<00:45, 42.86it/s]
2%|▏ | 40/2001 [00:00<00:45, 42.79it/s]
2%|▏ | 45/2001 [00:01<00:45, 42.72it/s]
2%|▏ | 50/2001 [00:01<00:45, 42.77it/s]
3%|▎ | 55/2001 [00:01<00:45, 42.72it/s]
3%|▎ | 60/2001 [00:01<00:45, 42.76it/s]
3%|▎ | 65/2001 [00:01<00:45, 42.77it/s]
3%|▎ | 70/2001 [00:01<00:45, 42.78it/s]
4%|▎ | 75/2001 [00:01<00:45, 42.77it/s]
4%|▍ | 80/2001 [00:01<00:44, 42.78it/s]
4%|▍ | 85/2001 [00:01<00:44, 42.74it/s]
4%|▍ | 90/2001 [00:02<00:44, 42.85it/s]
5%|▍ | 95/2001 [00:02<00:44, 42.74it/s]
5%|▍ | 100/2001 [00:02<00:44, 42.81it/s]
5%|▌ | 105/2001 [00:02<00:44, 42.80it/s]
5%|▌ | 110/2001 [00:02<00:44, 42.80it/s]
6%|▌ | 115/2001 [00:02<00:44, 42.72it/s]
6%|▌ | 120/2001 [00:02<00:43, 42.79it/s]
6%|▌ | 125/2001 [00:02<00:43, 42.74it/s]
6%|▋ | 130/2001 [00:03<00:43, 42.74it/s]
7%|▋ | 135/2001 [00:03<00:43, 42.84it/s]
7%|▋ | 140/2001 [00:03<00:43, 42.90it/s]
7%|▋ | 145/2001 [00:03<00:43, 42.93it/s]
7%|▋ | 150/2001 [00:03<00:43, 42.88it/s]
8%|▊ | 155/2001 [00:03<00:43, 42.85it/s]
8%|▊ | 160/2001 [00:03<00:42, 42.89it/s]
8%|▊ | 165/2001 [00:03<00:42, 42.95it/s]
8%|▊ | 170/2001 [00:03<00:42, 42.95it/s]
9%|▊ | 175/2001 [00:04<00:42, 42.91it/s]
9%|▉ | 180/2001 [00:04<00:42, 42.84it/s]
9%|▉ | 185/2001 [00:04<00:42, 42.77it/s]
9%|▉ | 190/2001 [00:04<00:42, 42.83it/s]
10%|▉ | 195/2001 [00:04<00:42, 42.82it/s]
10%|▉ | 200/2001 [00:04<00:41, 42.88it/s]
10%|█ | 205/2001 [00:04<00:41, 42.93it/s]
10%|█ | 210/2001 [00:04<00:41, 42.83it/s]
11%|█ | 215/2001 [00:05<00:41, 42.65it/s]
11%|█ | 220/2001 [00:05<00:41, 42.63it/s]
11%|█ | 225/2001 [00:05<00:41, 42.71it/s]
11%|█▏ | 230/2001 [00:05<00:41, 42.77it/s]
12%|█▏ | 235/2001 [00:05<00:41, 42.66it/s]
12%|█▏ | 240/2001 [00:05<00:41, 42.62it/s]
12%|█▏ | 245/2001 [00:05<00:41, 42.65it/s]
12%|█▏ | 250/2001 [00:05<00:41, 42.64it/s]
13%|█▎ | 255/2001 [00:05<00:40, 42.79it/s]
13%|█▎ | 260/2001 [00:06<00:40, 42.82it/s]
13%|█▎ | 265/2001 [00:06<00:40, 42.73it/s]
13%|█▎ | 270/2001 [00:06<00:40, 42.82it/s]
14%|█▎ | 275/2001 [00:06<00:40, 42.81it/s]
14%|█▍ | 280/2001 [00:06<00:40, 42.87it/s]
14%|█▍ | 285/2001 [00:06<00:40, 42.79it/s]
14%|█▍ | 290/2001 [00:06<00:40, 42.64it/s]
15%|█▍ | 295/2001 [00:06<00:40, 42.63it/s]
15%|█▍ | 300/2001 [00:07<00:39, 42.70it/s]
15%|█▌ | 305/2001 [00:07<00:39, 42.69it/s]
15%|█▌ | 310/2001 [00:07<00:39, 42.67it/s]
16%|█▌ | 315/2001 [00:07<00:39, 42.74it/s]
16%|█▌ | 320/2001 [00:07<00:39, 42.76it/s]
16%|█▌ | 325/2001 [00:07<00:39, 42.90it/s]
16%|█▋ | 330/2001 [00:07<00:38, 42.96it/s]
17%|█▋ | 335/2001 [00:07<00:38, 43.06it/s]
17%|█▋ | 340/2001 [00:07<00:38, 43.07it/s]
17%|█▋ | 345/2001 [00:08<00:38, 42.96it/s]
17%|█▋ | 350/2001 [00:08<00:38, 42.90it/s]
18%|█▊ | 355/2001 [00:08<00:38, 42.82it/s]
18%|█▊ | 360/2001 [00:08<00:38, 42.90it/s]
18%|█▊ | 365/2001 [00:08<00:38, 42.90it/s]
18%|█▊ | 370/2001 [00:08<00:38, 42.89it/s]
19%|█▊ | 375/2001 [00:08<00:37, 42.82it/s]
19%|█▉ | 380/2001 [00:08<00:37, 42.82it/s]
19%|█▉ | 385/2001 [00:08<00:37, 42.82it/s]
19%|█▉ | 390/2001 [00:09<00:37, 42.87it/s]
20%|█▉ | 395/2001 [00:09<00:37, 42.97it/s]
20%|█▉ | 400/2001 [00:09<00:37, 42.91it/s]
20%|██ | 405/2001 [00:09<00:37, 42.94it/s]
20%|██ | 410/2001 [00:09<00:37, 42.89it/s]
21%|██ | 415/2001 [00:09<00:36, 43.01it/s]
21%|██ | 420/2001 [00:09<00:36, 42.96it/s]
21%|██ | 425/2001 [00:09<00:36, 42.88it/s]
21%|██▏ | 430/2001 [00:10<00:36, 42.81it/s]
22%|██▏ | 435/2001 [00:10<00:36, 42.79it/s]
22%|██▏ | 440/2001 [00:10<00:36, 42.71it/s]
22%|██▏ | 445/2001 [00:10<00:36, 42.76it/s]
22%|██▏ | 450/2001 [00:10<00:36, 42.75it/s]
23%|██▎ | 455/2001 [00:10<00:36, 42.76it/s]
23%|██▎ | 460/2001 [00:10<00:36, 42.73it/s]
23%|██▎ | 465/2001 [00:10<00:35, 42.81it/s]
23%|██▎ | 470/2001 [00:10<00:35, 42.79it/s]
24%|██▎ | 475/2001 [00:11<00:35, 42.70it/s]
24%|██▍ | 480/2001 [00:11<00:35, 42.63it/s]
24%|██▍ | 485/2001 [00:11<00:35, 42.67it/s]
24%|██▍ | 490/2001 [00:11<00:35, 42.67it/s]
25%|██▍ | 495/2001 [00:11<00:35, 42.70it/s]
25%|██▍ | 500/2001 [00:11<00:35, 42.75it/s]
25%|██▌ | 505/2001 [00:11<00:35, 42.74it/s]
25%|██▌ | 510/2001 [00:11<00:34, 42.86it/s]
26%|██▌ | 515/2001 [00:12<00:34, 42.88it/s]
26%|██▌ | 520/2001 [00:12<00:34, 42.85it/s]
26%|██▌ | 525/2001 [00:12<00:34, 42.81it/s]
26%|██▋ | 530/2001 [00:12<00:34, 42.82it/s]
27%|██▋ | 535/2001 [00:12<00:34, 42.84it/s]
27%|██▋ | 540/2001 [00:12<00:34, 42.92it/s]
27%|██▋ | 545/2001 [00:12<00:33, 42.85it/s]
27%|██▋ | 550/2001 [00:12<00:33, 42.91it/s]
28%|██▊ | 555/2001 [00:12<00:33, 42.86it/s]
28%|██▊ | 560/2001 [00:13<00:33, 42.88it/s]
28%|██▊ | 565/2001 [00:13<00:33, 42.93it/s]
28%|██▊ | 570/2001 [00:13<00:33, 43.02it/s]
29%|██▊ | 575/2001 [00:13<00:33, 42.90it/s]
29%|██▉ | 580/2001 [00:13<00:33, 42.87it/s]
29%|██▉ | 585/2001 [00:13<00:33, 42.81it/s]
29%|██▉ | 590/2001 [00:13<00:33, 42.69it/s]
30%|██▉ | 595/2001 [00:13<00:32, 42.88it/s]
30%|██▉ | 600/2001 [00:14<00:32, 42.83it/s]
30%|███ | 605/2001 [00:14<00:32, 42.84it/s]
30%|███ | 610/2001 [00:14<00:32, 42.76it/s]
31%|███ | 615/2001 [00:14<00:32, 42.73it/s]
31%|███ | 620/2001 [00:14<00:32, 42.70it/s]
31%|███ | 625/2001 [00:14<00:32, 42.79it/s]
31%|███▏ | 630/2001 [00:14<00:32, 42.78it/s]
32%|███▏ | 635/2001 [00:14<00:31, 42.78it/s]
32%|███▏ | 640/2001 [00:14<00:31, 42.74it/s]
32%|███▏ | 645/2001 [00:15<00:31, 42.76it/s]
32%|███▏ | 650/2001 [00:15<00:31, 42.90it/s]
33%|███▎ | 655/2001 [00:15<00:31, 42.91it/s]
33%|███▎ | 660/2001 [00:15<00:31, 42.91it/s]
33%|███▎ | 665/2001 [00:15<00:31, 42.87it/s]
33%|███▎ | 670/2001 [00:15<00:31, 42.88it/s]
34%|███▎ | 675/2001 [00:15<00:30, 42.89it/s]
34%|███▍ | 680/2001 [00:15<00:30, 42.90it/s]
34%|███▍ | 685/2001 [00:15<00:30, 42.79it/s]
34%|███▍ | 690/2001 [00:16<00:30, 42.95it/s]
35%|███▍ | 695/2001 [00:16<00:30, 42.91it/s]
35%|███▍ | 700/2001 [00:16<00:30, 42.85it/s]
35%|███▌ | 705/2001 [00:16<00:30, 42.92it/s]
35%|███▌ | 710/2001 [00:16<00:30, 42.83it/s]
36%|███▌ | 715/2001 [00:16<00:30, 42.86it/s]
36%|███▌ | 720/2001 [00:16<00:29, 42.76it/s]
36%|███▌ | 725/2001 [00:16<00:29, 42.74it/s]
36%|███▋ | 730/2001 [00:17<00:29, 42.77it/s]
37%|███▋ | 735/2001 [00:17<00:29, 42.79it/s]
37%|███▋ | 740/2001 [00:17<00:29, 42.82it/s]
37%|███▋ | 745/2001 [00:17<00:29, 42.81it/s]
37%|███▋ | 750/2001 [00:17<00:29, 42.77it/s]
38%|███▊ | 755/2001 [00:17<00:29, 42.72it/s]
38%|███▊ | 760/2001 [00:17<00:29, 42.65it/s]
38%|███▊ | 765/2001 [00:17<00:28, 42.62it/s]
38%|███▊ | 770/2001 [00:17<00:28, 42.69it/s]
39%|███▊ | 775/2001 [00:18<00:28, 42.65it/s]
39%|███▉ | 780/2001 [00:18<00:28, 42.62it/s]
39%|███▉ | 785/2001 [00:18<00:28, 42.77it/s]
39%|███▉ | 790/2001 [00:18<00:28, 42.85it/s]
40%|███▉ | 795/2001 [00:18<00:28, 42.89it/s]
40%|███▉ | 800/2001 [00:18<00:28, 42.80it/s]
40%|████ | 805/2001 [00:18<00:27, 42.84it/s]
40%|████ | 810/2001 [00:18<00:27, 42.86it/s]
41%|████ | 815/2001 [00:19<00:27, 42.98it/s]
41%|████ | 820/2001 [00:19<00:27, 42.94it/s]
41%|████ | 825/2001 [00:19<00:27, 42.99it/s]
41%|████▏ | 830/2001 [00:19<00:27, 42.84it/s]
42%|████▏ | 835/2001 [00:19<00:27, 42.85it/s]
42%|████▏ | 840/2001 [00:19<00:27, 42.95it/s]
42%|████▏ | 845/2001 [00:19<00:26, 42.96it/s]
42%|████▏ | 850/2001 [00:19<00:26, 42.86it/s]
43%|████▎ | 855/2001 [00:19<00:26, 42.89it/s]
43%|████▎ | 860/2001 [00:20<00:26, 42.90it/s]
43%|████▎ | 865/2001 [00:20<00:26, 42.90it/s]
43%|████▎ | 870/2001 [00:20<00:26, 42.77it/s]
44%|████▎ | 875/2001 [00:20<00:26, 42.74it/s]
44%|████▍ | 880/2001 [00:20<00:26, 42.75it/s]
44%|████▍ | 885/2001 [00:20<00:26, 42.88it/s]
44%|████▍ | 890/2001 [00:20<00:25, 42.82it/s]
45%|████▍ | 895/2001 [00:20<00:25, 42.85it/s]
45%|████▍ | 900/2001 [00:21<00:25, 42.92it/s]
45%|████▌ | 905/2001 [00:21<00:25, 42.82it/s]
45%|████▌ | 910/2001 [00:21<00:25, 42.82it/s]
46%|████▌ | 915/2001 [00:21<00:25, 42.92it/s]
46%|████▌ | 920/2001 [00:21<00:25, 42.94it/s]
46%|████▌ | 925/2001 [00:21<00:25, 42.86it/s]
46%|████▋ | 930/2001 [00:21<00:25, 42.73it/s]
47%|████▋ | 935/2001 [00:21<00:25, 42.60it/s]
47%|████▋ | 940/2001 [00:21<00:24, 42.65it/s]
47%|████▋ | 945/2001 [00:22<00:24, 42.75it/s]
47%|████▋ | 950/2001 [00:22<00:24, 42.84it/s]
48%|████▊ | 955/2001 [00:22<00:24, 42.74it/s]
48%|████▊ | 960/2001 [00:22<00:24, 42.71it/s]
48%|████▊ | 965/2001 [00:22<00:24, 42.74it/s]
48%|████▊ | 970/2001 [00:22<00:24, 42.77it/s]
49%|████▊ | 975/2001 [00:22<00:23, 42.81it/s]
49%|████▉ | 980/2001 [00:22<00:23, 42.87it/s]
49%|████▉ | 985/2001 [00:23<00:23, 42.86it/s]
49%|████▉ | 990/2001 [00:23<00:23, 42.86it/s]
50%|████▉ | 995/2001 [00:23<00:23, 42.85it/s]
50%|████▉ | 1000/2001 [00:23<00:23, 42.91it/s]
50%|█████ | 1005/2001 [00:23<00:23, 42.74it/s]
50%|█████ | 1010/2001 [00:23<00:23, 42.70it/s]
51%|█████ | 1015/2001 [00:23<00:23, 42.76it/s]
51%|█████ | 1020/2001 [00:23<00:22, 42.74it/s]
51%|█████ | 1025/2001 [00:23<00:22, 42.63it/s]
51%|█████▏ | 1030/2001 [00:24<00:22, 42.46it/s]
52%|█████▏ | 1035/2001 [00:24<00:22, 42.41it/s]
52%|█████▏ | 1040/2001 [00:24<00:22, 42.54it/s]
52%|█████▏ | 1045/2001 [00:24<00:22, 42.73it/s]
52%|█████▏ | 1050/2001 [00:24<00:22, 42.64it/s]
53%|█████▎ | 1055/2001 [00:24<00:22, 42.64it/s]
53%|█████▎ | 1060/2001 [00:24<00:22, 42.76it/s]
53%|█████▎ | 1065/2001 [00:24<00:21, 42.79it/s]
53%|█████▎ | 1070/2001 [00:24<00:21, 42.94it/s]
54%|█████▎ | 1075/2001 [00:25<00:21, 43.03it/s]
54%|█████▍ | 1080/2001 [00:25<00:21, 42.99it/s]
54%|█████▍ | 1085/2001 [00:25<00:21, 42.86it/s]
54%|█████▍ | 1090/2001 [00:25<00:21, 42.80it/s]
55%|█████▍ | 1095/2001 [00:25<00:21, 42.75it/s]
55%|█████▍ | 1100/2001 [00:25<00:21, 42.73it/s]
55%|█████▌ | 1105/2001 [00:25<00:20, 42.73it/s]
55%|█████▌ | 1110/2001 [00:25<00:20, 42.65it/s]
56%|█████▌ | 1115/2001 [00:26<00:20, 42.67it/s]
56%|█████▌ | 1120/2001 [00:26<00:20, 42.80it/s]
56%|█████▌ | 1125/2001 [00:26<00:20, 42.86it/s]
56%|█████▋ | 1130/2001 [00:26<00:20, 42.73it/s]
57%|█████▋ | 1135/2001 [00:26<00:20, 42.73it/s]
57%|█████▋ | 1140/2001 [00:26<00:20, 42.72it/s]
57%|█████▋ | 1145/2001 [00:26<00:20, 42.74it/s]
57%|█████▋ | 1150/2001 [00:26<00:19, 42.67it/s]
58%|█████▊ | 1155/2001 [00:26<00:19, 42.67it/s]
58%|█████▊ | 1160/2001 [00:27<00:19, 42.70it/s]
58%|█████▊ | 1165/2001 [00:27<00:19, 42.63it/s]
58%|█████▊ | 1170/2001 [00:27<00:19, 42.52it/s]
59%|█████▊ | 1175/2001 [00:27<00:19, 42.53it/s]
59%|█████▉ | 1180/2001 [00:27<00:19, 42.51it/s]
59%|█████▉ | 1185/2001 [00:27<00:19, 42.42it/s]
59%|█████▉ | 1190/2001 [00:27<00:19, 42.40it/s]
60%|█████▉ | 1195/2001 [00:27<00:19, 42.33it/s]
60%|█████▉ | 1200/2001 [00:28<00:18, 42.37it/s]
60%|██████ | 1205/2001 [00:28<00:18, 42.26it/s]
60%|██████ | 1210/2001 [00:28<00:18, 42.38it/s]
61%|██████ | 1215/2001 [00:28<00:18, 42.58it/s]
61%|██████ | 1220/2001 [00:28<00:18, 42.74it/s]
61%|██████ | 1225/2001 [00:28<00:18, 42.84it/s]
61%|██████▏ | 1230/2001 [00:28<00:18, 42.79it/s]
62%|██████▏ | 1235/2001 [00:28<00:17, 42.80it/s]
62%|██████▏ | 1240/2001 [00:28<00:17, 42.96it/s]
62%|██████▏ | 1245/2001 [00:29<00:17, 43.01it/s]
62%|██████▏ | 1250/2001 [00:29<00:17, 42.97it/s]
63%|██████▎ | 1255/2001 [00:29<00:17, 42.97it/s]
63%|██████▎ | 1260/2001 [00:29<00:17, 42.93it/s]
63%|██████▎ | 1265/2001 [00:29<00:17, 42.76it/s]
63%|██████▎ | 1270/2001 [00:29<00:17, 42.80it/s]
64%|██████▎ | 1275/2001 [00:29<00:16, 42.79it/s]
64%|██████▍ | 1280/2001 [00:29<00:16, 42.76it/s]
64%|██████▍ | 1285/2001 [00:30<00:16, 42.84it/s]
64%|██████▍ | 1290/2001 [00:30<00:16, 42.85it/s]
65%|██████▍ | 1295/2001 [00:30<00:16, 42.78it/s]
65%|██████▍ | 1300/2001 [00:30<00:16, 42.84it/s]
65%|██████▌ | 1305/2001 [00:30<00:16, 42.77it/s]
65%|██████▌ | 1310/2001 [00:30<00:16, 42.81it/s]
66%|██████▌ | 1315/2001 [00:30<00:16, 42.83it/s]
66%|██████▌ | 1320/2001 [00:30<00:15, 42.79it/s]
66%|██████▌ | 1325/2001 [00:30<00:15, 42.70it/s]
66%|██████▋ | 1330/2001 [00:31<00:15, 42.66it/s]
67%|██████▋ | 1335/2001 [00:31<00:15, 42.54it/s]
67%|██████▋ | 1340/2001 [00:31<00:15, 42.61it/s]
67%|██████▋ | 1345/2001 [00:31<00:15, 42.79it/s]
67%|██████▋ | 1350/2001 [00:31<00:15, 42.78it/s]
68%|██████▊ | 1355/2001 [00:31<00:15, 42.75it/s]
68%|██████▊ | 1360/2001 [00:31<00:15, 42.71it/s]
68%|██████▊ | 1365/2001 [00:31<00:14, 42.65it/s]
68%|██████▊ | 1370/2001 [00:32<00:14, 42.78it/s]
69%|██████▊ | 1375/2001 [00:32<00:14, 42.74it/s]
69%|██████▉ | 1380/2001 [00:32<00:14, 42.62it/s]
69%|██████▉ | 1385/2001 [00:32<00:14, 42.58it/s]
69%|██████▉ | 1390/2001 [00:32<00:14, 42.71it/s]
70%|██████▉ | 1395/2001 [00:32<00:14, 42.65it/s]
70%|██████▉ | 1400/2001 [00:32<00:14, 42.51it/s]
70%|███████ | 1405/2001 [00:32<00:14, 42.54it/s]
70%|███████ | 1410/2001 [00:32<00:13, 42.63it/s]
71%|███████ | 1415/2001 [00:33<00:13, 42.78it/s]
71%|███████ | 1420/2001 [00:33<00:13, 42.76it/s]
71%|███████ | 1425/2001 [00:33<00:13, 42.73it/s]
71%|███████▏ | 1430/2001 [00:33<00:13, 42.81it/s]
72%|███████▏ | 1435/2001 [00:33<00:13, 42.87it/s]
72%|███████▏ | 1440/2001 [00:33<00:13, 42.86it/s]
72%|███████▏ | 1445/2001 [00:33<00:12, 42.78it/s]
72%|███████▏ | 1450/2001 [00:33<00:12, 42.66it/s]
73%|███████▎ | 1455/2001 [00:34<00:12, 42.52it/s]
73%|███████▎ | 1460/2001 [00:34<00:12, 42.69it/s]
73%|███████▎ | 1465/2001 [00:34<00:12, 42.69it/s]
73%|███████▎ | 1470/2001 [00:34<00:12, 42.66it/s]
74%|███████▎ | 1475/2001 [00:34<00:12, 42.64it/s]
74%|███████▍ | 1480/2001 [00:34<00:12, 42.61it/s]
74%|███████▍ | 1485/2001 [00:34<00:12, 42.60it/s]
74%|███████▍ | 1490/2001 [00:34<00:11, 42.70it/s]
75%|███████▍ | 1495/2001 [00:34<00:11, 42.82it/s]
75%|███████▍ | 1500/2001 [00:35<00:11, 42.78it/s]
75%|███████▌ | 1505/2001 [00:35<00:11, 42.75it/s]
75%|███████▌ | 1510/2001 [00:35<00:11, 42.81it/s]
76%|███████▌ | 1515/2001 [00:35<00:11, 42.88it/s]
76%|███████▌ | 1520/2001 [00:35<00:11, 42.98it/s]
76%|███████▌ | 1525/2001 [00:35<00:11, 43.00it/s]
76%|███████▋ | 1530/2001 [00:35<00:10, 42.98it/s]
77%|███████▋ | 1535/2001 [00:35<00:10, 42.95it/s]
77%|███████▋ | 1540/2001 [00:35<00:10, 42.95it/s]
77%|███████▋ | 1545/2001 [00:36<00:10, 42.95it/s]
77%|███████▋ | 1550/2001 [00:36<00:10, 43.04it/s]
78%|███████▊ | 1555/2001 [00:36<00:10, 43.14it/s]
78%|███████▊ | 1560/2001 [00:36<00:10, 43.10it/s]
78%|███████▊ | 1565/2001 [00:36<00:10, 43.16it/s]
78%|███████▊ | 1570/2001 [00:36<00:09, 43.13it/s]
79%|███████▊ | 1575/2001 [00:36<00:09, 42.93it/s]
79%|███████▉ | 1580/2001 [00:36<00:09, 42.93it/s]
79%|███████▉ | 1585/2001 [00:37<00:09, 43.04it/s]
79%|███████▉ | 1590/2001 [00:37<00:09, 43.10it/s]
80%|███████▉ | 1595/2001 [00:37<00:09, 42.84it/s]
80%|███████▉ | 1600/2001 [00:37<00:09, 42.77it/s]
80%|████████ | 1605/2001 [00:37<00:09, 42.71it/s]
80%|████████ | 1610/2001 [00:37<00:09, 42.73it/s]
81%|████████ | 1615/2001 [00:37<00:09, 42.72it/s]
81%|████████ | 1620/2001 [00:37<00:08, 42.73it/s]
81%|████████ | 1625/2001 [00:37<00:08, 42.67it/s]
81%|████████▏ | 1630/2001 [00:38<00:08, 42.57it/s]
82%|████████▏ | 1635/2001 [00:38<00:08, 42.67it/s]
82%|████████▏ | 1640/2001 [00:38<00:08, 42.63it/s]
82%|████████▏ | 1645/2001 [00:38<00:08, 42.67it/s]
82%|████████▏ | 1650/2001 [00:38<00:08, 42.71it/s]
83%|████████▎ | 1655/2001 [00:38<00:08, 42.70it/s]
83%|████████▎ | 1660/2001 [00:38<00:07, 42.83it/s]
83%|████████▎ | 1665/2001 [00:38<00:07, 42.93it/s]
83%|████████▎ | 1670/2001 [00:39<00:07, 42.88it/s]
84%|████████▎ | 1675/2001 [00:39<00:07, 42.80it/s]
84%|████████▍ | 1680/2001 [00:39<00:07, 42.71it/s]
84%|████████▍ | 1685/2001 [00:39<00:07, 42.78it/s]
84%|████████▍ | 1690/2001 [00:39<00:07, 42.76it/s]
85%|████████▍ | 1695/2001 [00:39<00:07, 42.78it/s]
85%|████████▍ | 1700/2001 [00:39<00:07, 42.74it/s]
85%|████████▌ | 1705/2001 [00:39<00:06, 42.62it/s]
85%|████████▌ | 1710/2001 [00:39<00:06, 42.73it/s]
86%|████████▌ | 1715/2001 [00:40<00:06, 42.61it/s]
86%|████████▌ | 1720/2001 [00:40<00:06, 42.67it/s]
86%|████████▌ | 1725/2001 [00:40<00:06, 42.73it/s]
86%|████████▋ | 1730/2001 [00:40<00:06, 42.62it/s]
87%|████████▋ | 1735/2001 [00:40<00:06, 42.57it/s]
87%|████████▋ | 1740/2001 [00:40<00:06, 42.67it/s]
87%|████████▋ | 1745/2001 [00:40<00:05, 42.77it/s]
87%|████████▋ | 1750/2001 [00:40<00:05, 42.85it/s]
88%|████████▊ | 1755/2001 [00:41<00:05, 42.99it/s]
88%|████████▊ | 1760/2001 [00:41<00:05, 42.95it/s]
88%|████████▊ | 1765/2001 [00:41<00:05, 42.91it/s]
88%|████████▊ | 1770/2001 [00:41<00:05, 42.87it/s]
89%|████████▊ | 1775/2001 [00:41<00:05, 42.76it/s]
89%|████████▉ | 1780/2001 [00:41<00:05, 42.74it/s]
89%|████████▉ | 1785/2001 [00:41<00:05, 42.69it/s]
89%|████████▉ | 1790/2001 [00:41<00:04, 42.69it/s]
90%|████████▉ | 1795/2001 [00:41<00:04, 42.70it/s]
90%|████████▉ | 1800/2001 [00:42<00:04, 42.66it/s]
90%|█████████ | 1805/2001 [00:42<00:04, 42.82it/s]
90%|█████████ | 1810/2001 [00:42<00:04, 42.84it/s]
91%|█████████ | 1815/2001 [00:42<00:04, 42.77it/s]
91%|█████████ | 1820/2001 [00:42<00:04, 42.83it/s]
91%|█████████ | 1825/2001 [00:42<00:04, 42.93it/s]
91%|█████████▏| 1830/2001 [00:42<00:03, 42.94it/s]
92%|█████████▏| 1835/2001 [00:42<00:03, 42.93it/s]
92%|█████████▏| 1840/2001 [00:43<00:03, 43.09it/s]
92%|█████████▏| 1845/2001 [00:43<00:03, 43.05it/s]
92%|█████████▏| 1850/2001 [00:43<00:03, 43.00it/s]
93%|█████████▎| 1855/2001 [00:43<00:03, 42.97it/s]
93%|█████████▎| 1860/2001 [00:43<00:03, 42.89it/s]
93%|█████████▎| 1865/2001 [00:43<00:03, 42.81it/s]
93%|█████████▎| 1870/2001 [00:43<00:03, 42.88it/s]
94%|█████████▎| 1875/2001 [00:43<00:02, 42.85it/s]
94%|█████████▍| 1880/2001 [00:43<00:02, 42.86it/s]
94%|█████████▍| 1885/2001 [00:44<00:02, 42.82it/s]
94%|█████████▍| 1890/2001 [00:44<00:02, 42.73it/s]
95%|█████████▍| 1895/2001 [00:44<00:02, 42.73it/s]
95%|█████████▍| 1900/2001 [00:44<00:02, 42.61it/s]
95%|█████████▌| 1905/2001 [00:44<00:02, 42.63it/s]
95%|█████████▌| 1910/2001 [00:44<00:02, 42.72it/s]
96%|█████████▌| 1915/2001 [00:44<00:02, 42.75it/s]
96%|█████████▌| 1920/2001 [00:44<00:01, 42.88it/s]
96%|█████████▌| 1925/2001 [00:44<00:01, 42.86it/s]
96%|█████████▋| 1930/2001 [00:45<00:01, 42.73it/s]
97%|█████████▋| 1935/2001 [00:45<00:01, 42.64it/s]
97%|█████████▋| 1940/2001 [00:45<00:01, 42.52it/s]
97%|█████████▋| 1945/2001 [00:45<00:01, 42.45it/s]
97%|█████████▋| 1950/2001 [00:45<00:01, 42.29it/s]
98%|█████████▊| 1955/2001 [00:45<00:01, 42.32it/s]
98%|█████████▊| 1960/2001 [00:45<00:00, 42.35it/s]
98%|█████████▊| 1965/2001 [00:45<00:00, 42.45it/s]
98%|█████████▊| 1970/2001 [00:46<00:00, 42.52it/s]
99%|█████████▊| 1975/2001 [00:46<00:00, 42.40it/s]
99%|█████████▉| 1980/2001 [00:46<00:00, 42.42it/s]
99%|█████████▉| 1985/2001 [00:46<00:00, 42.48it/s]
99%|█████████▉| 1990/2001 [00:46<00:00, 42.43it/s]
100%|█████████▉| 1995/2001 [00:46<00:00, 42.52it/s]
100%|█████████▉| 2000/2001 [00:46<00:00, 42.42it/s]
100%|██████████| 2001/2001 [00:46<00:00, 42.77it/s]
<maicos.modules.pdfplanar.PDFPlanar object at 0x70f40e1c34d0>
We also calculate the density profile of the water molecules in order to compare the different slabs with the layering visible in the density.
dana_obj = maicos.DensityPlanar(
water, dim=2, refgroup=water, bin_width=0.1, sym=True, zmin=-7, zmax=7
)
dana_obj.run(step=10)
<maicos.modules.densityplanar.DensityPlanar object at 0x70f40f223d90>
The results of the analysis are stored in the results
member variable.
As per the documentation of PDFPlanar
, we get three different arrays:
bin_pos
, bins
, and pdf
.
Here, bin_pos
is the position of the center of the slices in the
z-direction, bins
contains the bin positions of the pair distribution,
which are shared by all slices and correspondingly pdf
contains each
profile that our code produced.
In the following, we loop over all the pdf slices and plot each of them. Furthermore, in a separate subplot, we also show the density profile of the water molecules and highlight the slices that each pdf is calculated for. Hence, the same color in both plots corresponds to the same slice for the pair distribution function and the density profile. %%
# u per cubic angstrom to kg per cubic meter factor
u2kg = 1660.5390665999998
fig, ax = plt.subplots(1, 2)
print(ax)
tax = ax[1].twinx()
shift = 0
shift_amount = 2
for i in range(0, len(ana_obj.results.pdf[0])):
bin_pos = ana_obj.results.bin_pos[i]
pdf_prof = ana_obj.results.pdf[:, i]
mean_bulk = np.mean(pdf_prof[ana_obj.results.bins > 10])
line = ax[0].plot(
ana_obj.results.bins, ana_obj.results.pdf[:, i] / mean_bulk + shift
)
tax.vlines(
7 + bin_pos, 0, 3500, alpha=0.7, color=line[0].get_color(), linestyles="dashed"
)
tax.axvspan(
7 + bin_pos - 0.25 * 2,
7 + bin_pos + 0.25 * 2,
color=line[0].get_color(),
alpha=0.3,
)
shift += shift_amount
ax[0].set_ylabel(r"$g(r)$")
ax[0].set_xlabel(r"$r$ [$\AA$]")
ax[0].set_xlim((0, 15))
ax[0].hlines(1, 0, 15, color="black", linestyles="dashed", alpha=0.5)
tax.plot(
7 + dana_obj.results.bin_pos,
dana_obj.results.profile * u2kg,
color="black",
label="Density",
)
tax.set_xlim((1, 7))
ax[1].set_yticks(tax.get_yticks())
ax[1].set_yticklabels([])
tax.set_ylabel(r"$\rho(z)$ [kg/m$^3$]")
ax[1].set_xlabel(r"$z$ [$\AA$]")
# Set the padding between the axis to zero
plt.tight_layout()
fig.subplots_adjust(wspace=0, hspace=0)
fig.dpi = 200

[<Axes: > <Axes: >]