Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lambench/metrics/vishelper/metrics_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def calculate_generalizability_downstream_score(self) -> tuple[dict, dict]:
) # drop models with missing domain results

# # Now aggregate all domains to get the final generalizability metrics for each model
return domain_results.to_dict(orient="index"), domain_results.mean(axis=1).to_dict()
return domain_results.to_dict(orient="index"), domain_results.mean(
axis=1
).to_dict()

def calculate_stability_results(self) -> dict[str, float]:
"""This calculates the stability score for a given LAM."""
Expand Down
5 changes: 3 additions & 2 deletions lambench/tasks/calculator/elastic/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ def get_elastic_for_one(
"""
atoms = read(StringIO(atom_info["poscar"]), format="vasp")

calc = model.calc
relaxed_atoms = model.run_ase_relaxation(
atoms=atoms,
calc=model.calc,
calc=calc,
fmax=fmax,
steps=max_steps,
fix_symmetry=False,
Expand All @@ -119,7 +120,7 @@ def get_elastic_for_one(
stresses = []
for deformed_structure in deformed_structure_set:
atoms = deformed_structure.to_ase_atoms()
atoms.calc = model.calc
atoms.calc = calc
stresses.append(atoms.get_stress(voigt=False))

strains = [
Expand Down
4 changes: 3 additions & 1 deletion lambench/tasks/calculator/torsionnet/torsionnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def run_torsionnet(
result = {} # predicted energy
label = {} # label energy

calc = model.calc

# 500 fragments from Torsionnet500 dataset
for fragment in tqdm(test_data.iterdir()):
if not fragment.is_dir():
Expand All @@ -40,7 +42,7 @@ def run_torsionnet(
for frame in dpdata.LabeledSystem(file_name=fragment, fmt="deepmd/raw"):
assert len(frame) == 1
atoms: Atoms = frame.to_ase_structure()[0] # type: ignore
atoms.calc = model.calc
atoms.calc = calc
pred_energy = atoms.get_potential_energy() * 23.0609 # eV to kcal/mol
result[fragment.name].append(pred_energy)
label_energy = frame.data["energies"][0]
Expand Down
Loading