Ground-state cohesive energy calculated using pymatgen is very different from the one reported in reference. #3770
-
According to the tutorial here, I tried to calculate the ground-state cohesive energy of Au using pymatgen as follows: In [24]: from mp_api.client import MPRester
...:
...: m = MPRester()
...:
...: # Retrieve data for gold (Au)
...: entry = m.get_entries('Au')[0]
...: bulk_energy = entry.energy
...: num_atoms = entry.composition.num_atoms # Get the total number of atoms
...:
...: # Retrieve the energy data for isolated atoms of the elements in the compound
...: elemental_entries = [m.get_entries(element.symbol)[0] for element in entry.composition.elements]
...: isolated_atoms_energy = sum([e.energy * entry.composition[e.composition.elements[0].symbol] for e in elemental_entries])
...:
...: # Calculate the cohesive energy and average it per atom (unit: eV/atom)
...: cohesive_energy_per_atom = (bulk_energy - isolated_atoms_energy) / num_atoms
...: print("Cohesive Energy per Atom (eV/atom):", cohesive_energy_per_atom)
Retrieving ThermoDoc documents: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 199728.76it/s]
Retrieving ThermoDoc documents: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 220752.84it/s]
Cohesive Energy per Atom (eV/atom): 50.582851645 But this result differs greatly from the one reported in the reference mentioned in the above tutorial, as shown below: Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Got it. The MP database provides multiple dataset, so the following method should be used: In [15]: from mp_api.client import MPRester
...: from collections import defaultdict
...:
...: def analyze_material_calculations(material_id):
...: with MPRester() as mpr:
...: entries = mpr.get_entries(material_id)
...:
...: calculations = defaultdict(list)
...:
...: for entry in entries:
...: run_type = entry.parameters.get("run_type", "Unknown")
...: composition = entry.composition
...: num_atoms = sum(composition.values()) # 总原子数
...: energy_per_fu = entry.energy / composition.get_reduced_composition_and_factor()[1] # 每个公式单位的能量
...:
...: calculations[run_type].append({
...: "energy": entry.energy,
...: "energy_per_atom": entry.energy_per_atom,
...: "energy_per_fu": energy_per_fu,
...: "entry_id": entry.entry_id,
...: "num_atoms": num_atoms
...: })
...:
...: print("Calculations by run type:")
...: for run_type, calcs in calculations.items():
...: sorted_calcs = sorted(calcs, key=lambda x: x["energy"])
...: lowest_energy_calc = sorted_calcs[0]
...:
...: print(f"\n Run Type: {run_type}")
...: print(f" Number of calculations: {len(calcs)}")
...: print(f" Lowest energy: {lowest_energy_calc['energy']:.6f} eV")
...: print(f" Energy per atom: {lowest_energy_calc['energy_per_atom']:.6f} eV/atom")
...: print(f" Energy per f.u.: {lowest_energy_calc['energy_per_fu']:.6f} eV/f.u.")
...: print(f" Number of atoms: {lowest_energy_calc['num_atoms']}")
...: print(f" Entry ID: {lowest_energy_calc['entry_id']}")
...:
...: # Run the analysis
...: analyze_material_calculations("mp-81")
Retrieving ThermoDoc documents: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 43389.35it/s]
Calculations by run type:
Run Type: GGA
Number of calculations: 1
Lowest energy: -3.273882 eV
Energy per atom: -3.273882 eV/atom
Energy per f.u.: -3.273882 eV/f.u.
Number of atoms: 1.0
Entry ID: mp-81-GGA
Run Type: R2SCAN
Number of calculations: 2
Lowest energy: -50.584960 eV
Energy per atom: -50.584960 eV/atom
Energy per f.u.: -50.584960 eV/f.u.
Number of atoms: 1.0
Entry ID: mp-81-R2SCAN On the other hand, it seems that MP does not provide energy data for an isolated Au atom, so it still needs to be calculated separately based on the box model. |
Beta Was this translation helpful? Give feedback.
Got it. The MP database provides multiple dataset, so the following method should be used: