Skip to content

Commit

Permalink
parity bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mkphuthi committed Jan 10, 2025
1 parent c990fce commit b24fa2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 6 additions & 5 deletions asimtools/asimmodules/benchmarking/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ def calc_parity_data(
spvals = []
for i, atoms in enumerate(subset):
calc = load_calc(calc_id)
patoms = atoms.copy()
patoms.calc = calc
n_atoms = len(atoms)
if 'energy' in properties:
prop = 'energy'
ervals = np.hstack(
[ervals, atoms.get_potential_energy()/n_atoms]
)
epvals = np.hstack(
[epvals, float(calc.get_potential_energy(atoms)/n_atoms)]
[epvals, float(patoms.get_potential_energy()/n_atoms)]
)

if 'forces' in properties:
Expand All @@ -71,17 +73,16 @@ def calc_parity_data(
)

fpvals = np.hstack(
[fpvals, np.array(calc.get_forces(atoms)).flatten()]
[fpvals, np.array(patoms.get_forces()).flatten()]
)

if 'stress' in properties:
prop = 'stress'
srvals = np.hstack(
[srvals, np.array(atoms.get_stress(voigt=False)).flatten()]
[srvals, np.array(atoms.get_stress(voigt=True)).flatten()]
)

spvals = np.hstack(
[spvals, np.array(calc.get_stress(atoms)).flatten()]
[spvals, np.array(patoms.get_stress(voigt=True)).flatten()]
)
res[prop] = {'ref': srvals, 'pred': spvals}

Expand Down
2 changes: 0 additions & 2 deletions tests/asimmodules/workflows/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,3 @@ def test_batch_distributed(env_input, calc_input, sim_input, tmp_path, request):
uj = load_job_from_directory(d)
print('job_info:', uj.workdir, uj.get_status())
assert uj.get_status()[1] == statuses[d_ind]

# assert distjob.get_status(descend=False) == (True, 'complete')

0 comments on commit b24fa2a

Please sign in to comment.