@@ -60,30 +60,24 @@ def save_calc_results(atoms, *, prefix, properties):
6060 if prefix + p in atoms .arrays :
6161 del atoms .arrays [prefix + p ]
6262
63- # Make note of implemented properties, if applicable
64- if isinstance (atoms .calc , SinglePointCalculator ):
65- calc_implemented_properties = None
66- else :
67- calc_implemented_properties = atoms .calc .implemented_properties
68-
6963 # copy per-config and per-atom results
7064 config_results = {}
7165 atoms_results = {}
7266 for prop_name in properties :
73- # Sometimes a property is in `calc.results`, but not in ` calc.implemented_properties`
74- # and `calc.get_property` fails later. Skip those.
75- if calc_implemented_properties is not None and prop_name not in calc_implemented_properties :
76- continue
67+ if prop_name not in atoms . calc .results :
68+ from ase . calculators . calculator import PropertyNotPresent
69+ raise PropertyNotPresent ( f" { prop_name } is not one of the calculated properties "
70+ f"( { atoms . calc . results . keys () } )." )
7771 if prop_name == 'energy' :
7872 try :
7973 config_results ['energy' ] = atoms .get_potential_energy (force_consistent = True )
8074 except PropertyNotImplementedError :
8175 config_results ['energy' ] = atoms .get_potential_energy ()
8276 continue
8377 if prop_name in per_config_properties :
84- config_results [prop_name ] = atoms .calc .get_property (prop_name , allow_calculation = False )
78+ config_results [prop_name ] = atoms .calc .results . get (prop_name )
8579 if prop_name in per_atom_properties :
86- atoms_results [prop_name ] = atoms .calc .get_property (prop_name , allow_calculation = False )
80+ atoms_results [prop_name ] = atoms .calc .results . get (prop_name )
8781 try :
8882 if prefix is not None :
8983 config_results ['converged' ] = atoms .calc .converged
0 commit comments