@@ -779,9 +779,17 @@ def test_property(
779779 tuple[list[np.ndarray], list[int]]
780780 arrays with results and their shapes
781781 """
782- data .add ("property" , dp .task_dim , atomic = False , must = True , high_prec = True )
782+ var_name = dp .get_var_name ()
783+ assert isinstance (var_name , str )
784+ data .add (var_name , dp .task_dim , atomic = False , must = True , high_prec = True )
783785 if has_atom_property :
784- data .add ("atom_property" , dp .task_dim , atomic = True , must = False , high_prec = True )
786+ data .add (
787+ f"atom_{ var_name } " ,
788+ dp .task_dim ,
789+ atomic = True ,
790+ must = False ,
791+ high_prec = True ,
792+ )
785793
786794 if dp .get_dim_fparam () > 0 :
787795 data .add (
@@ -832,12 +840,12 @@ def test_property(
832840 aproperty = ret [1 ]
833841 aproperty = aproperty .reshape ([numb_test , natoms * dp .task_dim ])
834842
835- diff_property = property - test_data ["property" ][:numb_test ]
843+ diff_property = property - test_data [var_name ][:numb_test ]
836844 mae_property = mae (diff_property )
837845 rmse_property = rmse (diff_property )
838846
839847 if has_atom_property :
840- diff_aproperty = aproperty - test_data ["atom_property " ][:numb_test ]
848+ diff_aproperty = aproperty - test_data [f"atom_ { var_name } " ][:numb_test ]
841849 mae_aproperty = mae (diff_aproperty )
842850 rmse_aproperty = rmse (diff_aproperty )
843851
@@ -854,7 +862,7 @@ def test_property(
854862 detail_path = Path (detail_file )
855863
856864 for ii in range (numb_test ):
857- test_out = test_data ["property" ][ii ].reshape (- 1 , 1 )
865+ test_out = test_data [var_name ][ii ].reshape (- 1 , 1 )
858866 pred_out = property [ii ].reshape (- 1 , 1 )
859867
860868 frame_output = np .hstack ((test_out , pred_out ))
@@ -868,7 +876,7 @@ def test_property(
868876
869877 if has_atom_property :
870878 for ii in range (numb_test ):
871- test_out = test_data ["atom_property " ][ii ].reshape (- 1 , 1 )
879+ test_out = test_data [f"atom_ { var_name } " ][ii ].reshape (- 1 , 1 )
872880 pred_out = aproperty [ii ].reshape (- 1 , 1 )
873881
874882 frame_output = np .hstack ((test_out , pred_out ))
0 commit comments