@@ -116,13 +116,19 @@ from pymatgen.ext.matproj import MPRester
116116
117117mpr = MPRester()
118118si = mpr.get_structure_by_material_id(" mp-149" )
119- c = mtc.ElasticityCalc(" TensorNet-PES-MatPES-PBE-2025.2" , relax_structure = True )
119+ c = mtc.ElasticityCalc(" TensorNet-PES-MatPES-PBE-2025.2" , relax_structure = True , units_GPa = True )
120120props = c.calc(si)
121- print (f " K_VRH = { props[' bulk_modulus_vrh' ] * 160.2176621 } GPa " )
121+ print (f " K_VRH = { props[' bulk_modulus_vrh' ]} GPa " )
122122```
123123
124124The calculated ` K_VRH ` is about 102 GPa, in reasonably good agreement with the experimental and DFT values.
125125
126+ By default, ` ElasticityCalc ` returns the elastic tensor and moduli in pymatgen's native units of
127+ eV/ų. Pass ` units_GPa=True ` (as above) to have ` elastic_tensor ` , ` bulk_modulus_vrh ` ,
128+ ` shear_modulus_vrh ` , ` youngs_modulus ` , and ` residuals_sum ` returned directly in GPa, avoiding manual
129+ unit conversion. The returned dict also carries a ` _units ` entry mapping each numeric output to its
130+ unit string.
131+
126132You can list all supported universal calculators using the ` UNIVERSAL_CALCULATORS ` enum:
127133
128134``` python
@@ -193,6 +199,7 @@ elast_calc = mtc.ElasticityCalc(
193199 use_equilibrium = True ,
194200 relax_structure = False , # Skip re-relaxation since we already relaxed above.
195201 relax_deformed_structures = True ,
202+ units_GPa = True , # Report moduli in GPa rather than eV/A^3.
196203)
197204prop_calc = mtc.ChainedCalc([relax_calc, energetics_calc, elast_calc])
198205results = prop_calc.calc(structure)
0 commit comments