@@ -545,9 +545,8 @@ def _extract_computes_snap(
545
545
np.ndarray: Output of the LAMMPS compute command
546
546
"""
547
547
lmp_atom_ids = lmp .numpy .extract_atom_iarray ("id" , num_atoms ).flatten ()
548
- assert np .all (lmp_atom_ids == 1 + np .arange (num_atoms )), (
549
- "LAMMPS seems to have lost atoms"
550
- )
548
+ cond = np .all (lmp_atom_ids == 1 + np .arange (num_atoms ))
549
+ assert cond , "LAMMPS seems to have lost atoms"
551
550
552
551
# Extract types
553
552
lmp_types = lmp .numpy .extract_atom_iarray (name = "type" , nelem = num_atoms ).flatten ()
@@ -569,16 +568,14 @@ def _extract_computes_snap(
569
568
570
569
lmp_dbarr = _extract_compute_np (lmp , "db" , 1 , 2 , (num_atoms , num_types , 3 , n_coeff ))
571
570
lmp_dbsum = _extract_compute_np (lmp , "db_sum" , 0 , 1 , (num_types , 3 , n_coeff ))
572
- assert np .allclose (lmp_dbsum , lmp_dbarr .sum (axis = 0 ), rtol = 1e-12 , atol = 1e-12 ), (
573
- "db_sum doesn't match sum of db"
574
- )
571
+ cond = np .allclose (lmp_dbsum , lmp_dbarr .sum (axis = 0 ), rtol = 1e-12 , atol = 1e-12 )
572
+ assert cond , "db_sum doesn't match sum of db"
575
573
db_atom = np .transpose (lmp_dbarr , (0 , 2 , 1 , 3 ))
576
574
577
575
lmp_vbarr = _extract_compute_np (lmp , "vb" , 1 , 2 , (num_atoms , num_types , 6 , n_coeff ))
578
576
lmp_vbsum = _extract_compute_np (lmp , "vb_sum" , 0 , 1 , (num_types , 6 , n_coeff ))
579
- assert np .allclose (lmp_vbsum , lmp_vbarr .sum (axis = 0 ), rtol = 1e-12 , atol = 1e-12 ), (
580
- "vb_sum doesn't match sum of vb"
581
- )
577
+ cond = np .allclose (lmp_vbsum , lmp_vbarr .sum (axis = 0 ), rtol = 1e-12 , atol = 1e-12 )
578
+ assert cond , "vb_sum doesn't match sum of vb"
582
579
vb_sum = np .transpose (lmp_vbsum , (1 , 0 , 2 )) / lmp_volume * eV_div_A3_to_bar
583
580
584
581
dbatom_shape = db_atom .shape
0 commit comments