Use mdapy efficiently

The key point is re-using the neighborlist information.

[1]:
import mdapy as mp
mp.init()
[Taichi] version 1.7.1, llvm 15.0.1, commit 0f143b2f, win, python 3.10.14
[Taichi] Starting on arch=x64
[2]:
mp.__version__
[2]:
'0.11.1'

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: (4_000_000, 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    │
│ …       ┆ …    ┆ …        ┆ …        ┆ …        │
│ 3999996 ┆ 1    ┆ 357.885  ┆ 359.6925 ┆ 356.0775 │
│ 3999997 ┆ 1    ┆ 357.885  ┆ 357.885  ┆ 357.885  │
│ 3999998 ┆ 1    ┆ 359.6925 ┆ 359.6925 ┆ 357.885  │
│ 3999999 ┆ 1    ┆ 359.6925 ┆ 357.885  ┆ 359.6925 │
│ 4000000 ┆ 1    ┆ 357.885  ┆ 359.6925 ┆ 359.6925 │
└─────────┴──────┴──────────┴──────────┴──────────┘

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: 2min 15s
Wall time: 10.3 s
[7]:
system.data.head()
[7]:
shape: (5, 8)
idtypexyzcspajaatomic_entropy
i32i32f64f64f64f64i32f64
110.00.00.03.2952e-261-8.645166
211.80751.80750.01.0984e-261-8.645166
311.80750.01.80751.0984e-261-8.645166
410.01.80751.80751.0984e-261-8.645166
510.00.03.6152.1968e-261-8.645166

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: 1min 32s
Wall time: 6.99 s
[9]:
system.data.head()
[9]:
shape: (5, 8)
idtypexyzcspajaatomic_entropy
i32i32f64f64f64f64i32f64
110.00.00.03.2952e-261-8.645166
211.80751.80750.01.0984e-261-8.645166
311.80750.01.80751.0984e-261-8.645166
410.01.80751.80751.0984e-261-8.645166
510.00.03.6152.1968e-261-8.645166