@@ -201,9 +201,7 @@ def from_lammps(
201
201
)
202
202
203
203
def get_init_dimension (self ) -> np .ndarray :
204
- """
205
- Returns the initial box dimension.
206
- """
204
+ """Returns the initial box dimension."""
207
205
return self .wrapped_run .trajectory [0 ].dimensions
208
206
209
207
def get_equilibrium_dimension (self , npt_range : int , period : int = 200 ) -> np .ndarray :
@@ -234,9 +232,7 @@ def get_equilibrium_dimension(self, npt_range: int, period: int = 200) -> np.nda
234
232
return np .mean (np .array (d ), axis = 0 )
235
233
236
234
def get_nvt_dimension (self ) -> np .ndarray :
237
- """
238
- Returns the box dimension at the last frame.
239
- """
235
+ """Returns the box dimension at the last frame."""
240
236
return self .wrapped_run .trajectory [- 1 ].dimensions
241
237
242
238
def get_cond_array (self ) -> np .ndarray :
@@ -249,15 +245,14 @@ def get_cond_array(self) -> np.ndarray:
249
245
nvt_run = self .unwrapped_run
250
246
cations = nvt_run .select_atoms (self .select_dict .get ("cation" ))
251
247
anions = nvt_run .select_atoms (self .select_dict .get ("anion" ))
252
- cond_array = calc_cond_msd (
248
+ return calc_cond_msd (
253
249
nvt_run ,
254
250
anions ,
255
251
cations ,
256
252
self .nvt_start ,
257
253
self .cation_charge ,
258
254
self .anion_charge ,
259
255
)
260
- return cond_array
261
256
262
257
def choose_cond_fit_region (self ) -> tuple :
263
258
"""
@@ -358,10 +353,9 @@ def get_conductivity(self, start: int = -1, end: int = -1) -> float:
358
353
print (f"Start of linear fitting regime: { start } ({ self .time_array [start ]} { time_units } )" )
359
354
print (f"End of linear fitting regime: { end } ({ self .time_array [end ]} { time_units } )" )
360
355
print (f"Beta value (fit to MSD = t^\u03B2 ): { beta } (\u03B2 = 1 in the diffusive regime)" )
361
- cond = conductivity_calculator (
356
+ return conductivity_calculator (
362
357
self .time_array , self .cond_array , self .nvt_v , self .name , start , end , self .temp , self .units
363
358
)
364
- return cond
365
359
366
360
def coord_num_array_single_species (
367
361
self ,
@@ -386,7 +380,7 @@ def coord_num_array_single_species(
386
380
nvt_run = self .wrapped_run
387
381
distance_dict = {species : distance }
388
382
center_atoms = nvt_run .select_atoms (self .select_dict .get (center_atom ))
389
- num_array = concat_coord_array (
383
+ return concat_coord_array (
390
384
nvt_run ,
391
385
num_of_neighbor ,
392
386
center_atoms ,
@@ -395,7 +389,6 @@ def coord_num_array_single_species(
395
389
run_start ,
396
390
run_end ,
397
391
)["total" ]
398
- return num_array
399
392
400
393
def coord_num_array_multi_species (
401
394
self ,
@@ -418,7 +411,7 @@ def coord_num_array_multi_species(
418
411
"""
419
412
nvt_run = self .wrapped_run
420
413
center_atoms = nvt_run .select_atoms (self .select_dict .get (center_atom ))
421
- num_array_dict = concat_coord_array (
414
+ return concat_coord_array (
422
415
nvt_run ,
423
416
num_of_neighbor ,
424
417
center_atoms ,
@@ -427,7 +420,6 @@ def coord_num_array_multi_species(
427
420
run_start ,
428
421
run_end ,
429
422
)
430
- return num_array_dict
431
423
432
424
def coord_num_array_specific (
433
425
self ,
@@ -453,7 +445,7 @@ def coord_num_array_specific(
453
445
"""
454
446
nvt_run = self .wrapped_run
455
447
center_atoms = nvt_run .select_atoms (self .select_dict .get (center_atom ))
456
- num_array_dict = concat_coord_array (
448
+ return concat_coord_array (
457
449
nvt_run ,
458
450
num_of_neighbor_specific ,
459
451
center_atoms ,
@@ -463,7 +455,6 @@ def coord_num_array_specific(
463
455
run_end ,
464
456
counter_atom = counter_atom ,
465
457
)
466
- return num_array_dict
467
458
468
459
def write_solvation_structure (
469
460
self ,
@@ -475,7 +466,7 @@ def write_solvation_structure(
475
466
write_path : str ,
476
467
center_atom : str = "cation" ,
477
468
):
478
- """Writes out a series of desired solvation structures as ``*.xyz`` files
469
+ """Writes out a series of desired solvation structures as ``*.xyz`` files.
479
470
480
471
Args:
481
472
distance_dict: A dict of coordination cutoff distance of the neighbor species.
@@ -528,7 +519,7 @@ def coord_type_array(
528
519
nvt_run = self .wrapped_run
529
520
distance_dict = {counter_atom : distance }
530
521
center_atoms = nvt_run .select_atoms (self .select_dict .get (center_atom ))
531
- num_array = concat_coord_array (
522
+ return concat_coord_array (
532
523
nvt_run ,
533
524
num_of_neighbor_simple ,
534
525
center_atoms ,
@@ -537,7 +528,6 @@ def coord_type_array(
537
528
run_start ,
538
529
run_end ,
539
530
)["total" ]
540
- return num_array
541
531
542
532
def angle_array (
543
533
self ,
@@ -567,8 +557,8 @@ def angle_array(
567
557
nvt_run = self .wrapped_run
568
558
center_atoms = nvt_run .select_atoms (self .select_dict .get (center_atom ))
569
559
assert len (distance_dict ) == 2 , "Only distance a->c, b->c shoud be specified in the distance_dict."
570
- distance_dict [center_atom ] = list ( distance_dict .values ())[ 0 ]
571
- ang_array = concat_coord_array (
560
+ distance_dict [center_atom ] = next ( iter ( distance_dict .values ()))
561
+ return concat_coord_array (
572
562
nvt_run ,
573
563
angular_dist_of_neighbor ,
574
564
center_atoms ,
@@ -578,7 +568,6 @@ def angle_array(
578
568
run_end ,
579
569
cip = cip ,
580
570
)["total" ]
581
- return ang_array
582
571
583
572
def coordination (
584
573
self ,
@@ -612,8 +601,7 @@ def coordination(
612
601
item_list .append (str (int (combined [i , 0 ])))
613
602
percent_list .append (f"{ (combined [i , 1 ] / combined [:, 1 ].sum () * 100 ):.4f} %" )
614
603
df_dict = {item_name : item_list , "Percentage" : percent_list }
615
- df = pd .DataFrame (df_dict )
616
- return df
604
+ return pd .DataFrame (df_dict )
617
605
618
606
def rdf_integral (
619
607
self ,
@@ -644,8 +632,7 @@ def rdf_integral(
644
632
item_list .append (kw )
645
633
cn_list .append (cn )
646
634
df_dict = {item_name : item_list , "CN" : cn_list }
647
- df = pd .DataFrame (df_dict )
648
- return df
635
+ return pd .DataFrame (df_dict )
649
636
650
637
def coordination_type (
651
638
self ,
@@ -655,7 +642,7 @@ def coordination_type(
655
642
center_atom : str = "cation" ,
656
643
counter_atom : str = "anion" ,
657
644
) -> pd .DataFrame :
658
- """Tabulates the percentage of each solvation structures (CIP/SSIP/AGG)
645
+ """Tabulates the percentage of each solvation structures (CIP/SSIP/AGG).
659
646
660
647
Args:
661
648
distance: The coordination cutoff distance.
@@ -683,8 +670,7 @@ def coordination_type(
683
670
item_list .append (item_dict .get (item ))
684
671
percent_list .append (f"{ (combined [i , 1 ] / combined [:, 1 ].sum () * 100 ):.4f} %" )
685
672
df_dict = {item_name : item_list , "Percentage" : percent_list }
686
- df = pd .DataFrame (df_dict )
687
- return df
673
+ return pd .DataFrame (df_dict )
688
674
689
675
def coordination_specific (
690
676
self ,
@@ -695,7 +681,7 @@ def coordination_specific(
695
681
counter_atom : str = "anion" ,
696
682
) -> pd .DataFrame :
697
683
"""Calculates the integral of the coordiantion number of selected species
698
- in each type of solvation structures (CIP/SSIP/AGG)
684
+ in each type of solvation structures (CIP/SSIP/AGG).
699
685
700
686
Args:
701
687
distance_dict: A dict of coordination cutoff distance of the neighbor species.
@@ -727,8 +713,7 @@ def coordination_specific(
727
713
else :
728
714
agg_list .append (cn )
729
715
df_dict = {item_name : item_list , "CN in SSIP" : ssip_list , "CN in CIP" : cip_list , "CN in AGG" : agg_list }
730
- df = pd .DataFrame (df_dict )
731
- return df
716
+ return pd .DataFrame (df_dict )
732
717
733
718
def get_msd_all (
734
719
self ,
@@ -758,7 +743,7 @@ def get_msd_all(
758
743
"""
759
744
selection = self .select_dict .get (species )
760
745
assert selection is not None
761
- msd_array = total_msd (
746
+ return total_msd (
762
747
self .unwrapped_run ,
763
748
start = start ,
764
749
end = end ,
@@ -768,7 +753,6 @@ def get_msd_all(
768
753
built_in = built_in ,
769
754
center_of_mass = center_of_mass ,
770
755
)
771
- return msd_array
772
756
773
757
def get_msd_partial (
774
758
self ,
@@ -861,7 +845,7 @@ def get_neighbor_corr(
861
845
def get_residence_time (
862
846
self , times : np .ndarray , acf_avg_dict : dict [str , np .ndarray ], cutoff_time : int
863
847
) -> dict [str , np .floating ]:
864
- """Calculates the residence time of selected species around cation
848
+ """Calculates the residence time of selected species around cation.
865
849
866
850
Args:
867
851
times: The time series.
@@ -882,7 +866,7 @@ def get_neighbor_trj(
882
866
center_atom : str = "cation" ,
883
867
index : int = 0 ,
884
868
) -> dict [str , np .ndarray ]:
885
- """Returns the distance between one center atom and neighbors as a function of time
869
+ """Returns the distance between one center atom and neighbors as a function of time.
886
870
887
871
Args:
888
872
run_start: Start frame of analysis.
@@ -1063,12 +1047,12 @@ def get_heat_map(
1063
1047
hopping_cutoff : float ,
1064
1048
floating_atom : str = "cation" ,
1065
1049
cartesian_by_ref : np .ndarray = None ,
1066
- sym_dict : dict [str , list [np .ndarray ]] = None ,
1050
+ sym_dict : dict [str , list [np .ndarray ]] | None = None ,
1067
1051
sample : int | None = None ,
1068
1052
smooth : int = 51 ,
1069
1053
dim : str = "xyz" ,
1070
1054
) -> np .ndarray :
1071
- """Calculates the heatmap matrix of floating ion around a cluster
1055
+ """Calculates the heatmap matrix of floating ion around a cluster.
1072
1056
1073
1057
Args:
1074
1058
run_start: Start frame of analysis.
@@ -1133,7 +1117,7 @@ def get_heat_map(
1133
1117
def get_cluster_distance (
1134
1118
self , run_start : int , run_end : int , neighbor_cutoff : float , cluster_center : str = "center"
1135
1119
) -> np .floating :
1136
- """Calculates the average distance of the center of clusters/molecules
1120
+ """Calculates the average distance of the center of clusters/molecules.
1137
1121
1138
1122
Args:
1139
1123
run_start: Start frame of analysis.
0 commit comments