Use Mdapy Efficiently

The key point is re-using the neighborlist information.

[1]:
import mdapy as mp
mp.__version__
[1]:
'1.0.5a2'

Build a Copper system with 4,000,000 atoms.

[2]:
system = mp.build_crystal('Cu', 'fcc', 3.615, nx=100, ny=100, nz=100)

Check the system information.

[3]:
system
[3]:
Atom Number: 4000000
Box information:
[[361.5   0.    0. ]
 [  0.  361.5   0. ]
 [  0.    0.  361.5]]
Origin: [0. 0. 0.]
Triclinic: False
Boundary: [1 1 1]
Particle Information:
shape: (4_000_000, 4)
┌──────────┬──────────┬──────────┬─────────┐
│ x        ┆ y        ┆ z        ┆ element │
│ ---      ┆ ---      ┆ ---      ┆ ---     │
│ f64      ┆ f64      ┆ f64      ┆ str     │
╞══════════╪══════════╪══════════╪═════════╡
│ 0.0      ┆ 0.0      ┆ 0.0      ┆ Cu      │
│ 1.8075   ┆ 1.8075   ┆ 0.0      ┆ Cu      │
│ 0.0      ┆ 1.8075   ┆ 1.8075   ┆ Cu      │
│ 1.8075   ┆ 0.0      ┆ 1.8075   ┆ Cu      │
│ 0.0      ┆ 0.0      ┆ 3.615    ┆ Cu      │
│ …        ┆ …        ┆ …        ┆ …       │
│ 359.6925 ┆ 357.885  ┆ 356.0775 ┆ Cu      │
│ 357.885  ┆ 357.885  ┆ 357.885  ┆ Cu      │
│ 359.6925 ┆ 359.6925 ┆ 357.885  ┆ Cu      │
│ 357.885  ┆ 359.6925 ┆ 359.6925 ┆ Cu      │
│ 359.6925 ┆ 357.885  ┆ 359.6925 ┆ Cu      │
└──────────┴──────────┴──────────┴─────────┘

Direct calculation.

[4]:
%%time
system.cal_centro_symmetry_parameter(12)
system.cal_ackland_jones_analysis()
system.cal_structure_entropy(rc=5.0, sigma=0.2)
CPU times: user 1min 36s, sys: 9.58 s, total: 1min 45s
Wall time: 8.72 s
[5]:
system.data.head()
[5]:
shape: (5, 7)
xyzelementcspajaentropy
f64f64f64strf64i32f64
0.00.00.0"Cu"3.2952e-261-8.645166
1.80751.80750.0"Cu"1.0984e-261-8.645166
0.01.80751.8075"Cu"1.0984e-261-8.645166
1.80750.01.8075"Cu"1.0984e-261-8.645166
0.00.03.615"Cu"2.1968e-261-8.645166

Re-use neighborlist information.

[6]:
%%time
system.build_neighbor(rc=5.0, max_neigh=50) # Obtain the neighbor first, the following calculation can use it.
system.cal_structure_entropy(rc=5.0, sigma=0.2)
system.cal_ackland_jones_analysis()
system.cal_centro_symmetry_parameter(12)
CPU times: user 1min 17s, sys: 891 ms, total: 1min 18s
Wall time: 6.39 s
[7]:
system.data.head()
[7]:
shape: (5, 7)
xyzelementcspajaentropy
f64f64f64strf64i32f64
0.00.00.0"Cu"3.2952e-261-8.645166
1.80751.80750.0"Cu"1.0984e-261-8.645166
0.01.80751.8075"Cu"1.0984e-261-8.645166
1.80750.01.8075"Cu"1.0984e-261-8.645166
0.00.03.615"Cu"2.1968e-261-8.645166