Compile nequip.zip #551
Answered
by
cw-tan
HaoWan2025
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
cw-tan
Oct 3, 2025
Replies: 1 comment
-
|
@HaoWan2025 sorry, it looks like I made a mistake and didn't spot what was wrong with the ASE script -- the from ase.build import bulk
import numpy as np
import matplotlib.pyplot as plt
from nequip.ase import NequIPCalculator
# Initialize the nequip calculator
calculator = NequIPCalculator.from_compiled_model(
compile_path="mir-group__NequIP-OAM-L__0.1.nequip.pth",
# NO `chemical_symbols`
device="cuda",
)
# Range of scaling factors for lattice constant
scaling_factors = np.linspace(0.8, 1.2, 30) # zoomed
lats = []
energies = []
# Loop through scaling factors, calculate energy, and collect volumes and energies
for scale in scaling_factors:
lattice_constant = 5.5 * scale
scaled_si = bulk("Si", crystalstructure="diamond", a=lattice_constant, cubic=True)
scaled_si.calc = calculator
volume = scaled_si.get_volume()
energy = scaled_si.get_potential_energy()
lats.append(lattice_constant)
energies.append(energy)
# Plot the energy-volume curve
plt.figure(figsize=(8, 6))
plt.plot(lats, energies, marker="o")
plt.xlabel("Lattice constant (Å)", fontsize=14)
plt.ylabel("Energy (eV)", fontsize=14)
plt.title("Binding Curve for Cubic Diamond Silicon", fontsize=16)
plt.grid()
plt.show()
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cw-tan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

@HaoWan2025 sorry, it looks like I made a mistake and didn't spot what was wrong with the ASE script -- the
chemical_symbolsshould correspond to the full list used for training the model. One can just not provide it to get the right behavior, with the equilibirum lattice constant close to what's expected. The original simulation is probably using some other element such that cubic diamond (maybe hydrogen) was likely never seen in the dataset I'm guessing.