Use mdapy efficiently

The key point is re-using the neighborlist information.

[1]:
import mdapy as mp
mp.init()
[Taichi] version 1.6.0, llvm 15.0.1, commit f1c6fbbd, win, python 3.8.0
[Taichi] Starting on arch=x64
[2]:
mp.__version__
[2]:
'0.9.9'

Build a FCC lattice with 4,000,000 atoms.

[3]:
FCC = mp.LatticeMaker(3.615, 'FCC', 100, 100, 100)
FCC.compute()

Generate a system class.

[4]:
system = mp.System(pos=FCC.pos, box=FCC.box, boundary=[1, 1, 1])

Check the system information.

[5]:
system
[5]:
Filename: None
Atom Number: 4000000
Simulation Box:
[[361.5   0.    0. ]
 [  0.  361.5   0. ]
 [  0.    0.  361.5]
 [  0.    0.    0. ]]
TimeStep: 0
Boundary: [1, 1, 1]
Particle Information:
shape: (5, 5)
┌─────┬──────┬────────┬────────┬────────┐
│ id  ┆ type ┆ x      ┆ y      ┆ z      │
│ --- ┆ ---  ┆ ---    ┆ ---    ┆ ---    │
│ i32 ┆ i32  ┆ f64    ┆ f64    ┆ f64    │
╞═════╪══════╪════════╪════════╪════════╡
│ 1   ┆ 1    ┆ 0.0    ┆ 0.0    ┆ 0.0    │
│ 2   ┆ 1    ┆ 1.8075 ┆ 1.8075 ┆ 0.0    │
│ 3   ┆ 1    ┆ 1.8075 ┆ 0.0    ┆ 1.8075 │
│ 4   ┆ 1    ┆ 0.0    ┆ 1.8075 ┆ 1.8075 │
│ 5   ┆ 1    ┆ 0.0    ┆ 0.0    ┆ 3.615  │
└─────┴──────┴────────┴────────┴────────┘

If we want to do a series of analysis, we can re-use the neighbor to save time.

Direct calculation.

[6]:
%%time
system.cal_centro_symmetry_parameter(12)
system.cal_ackland_jones_analysis()
system.cal_atomic_entropy()
CPU times: total: 5min 40s
Wall time: 18.5 s
[7]:
system.data.head()
[7]:
shape: (5, 8)
idtypexyzcspajaatomic_entropy
i32i32f64f64f64f64i32f64
110.00.00.03.2952e-261-8.645167
211.80751.80750.01.0984e-261-8.645167
311.80750.01.80751.0984e-261-8.645167
410.01.80751.80751.0984e-261-8.645167
510.00.03.6152.1968e-261-8.645167

Re-use neighborlist information.

[8]:
%%time
system.build_neighbor(rc=5.0, max_neigh=50) # Obtain the neighbor first, the following calculation can use it.
system.cal_atomic_entropy()
system.cal_ackland_jones_analysis()
system.cal_centro_symmetry_parameter(12)
CPU times: total: 4min 25s
Wall time: 10.8 s
[9]:
system.data.head()
[9]:
shape: (5, 8)
idtypexyzcspajaatomic_entropy
i32i32f64f64f64f64i32f64
110.00.00.03.2952e-261-8.645167
211.80751.80750.01.0984e-261-8.645167
311.80750.01.80751.0984e-261-8.645167
410.01.80751.80751.0984e-261-8.645167
510.00.03.6152.1968e-261-8.645167