Commit ca47b225 authored by Gao, Xiang's avatar Gao, Xiang Committed by Farhad Ramezanghorbani
Browse files

Fix force shape when only 1 atom (#409)

parent 987711c7
...@@ -73,7 +73,7 @@ class Calculator(ase.calculators.calculator.Calculator): ...@@ -73,7 +73,7 @@ class Calculator(ase.calculators.calculator.Calculator):
if 'forces' in properties: if 'forces' in properties:
forces = -torch.autograd.grad(energy.squeeze(), coordinates)[0] forces = -torch.autograd.grad(energy.squeeze(), coordinates)[0]
self.results['forces'] = forces.squeeze().to('cpu').numpy() self.results['forces'] = forces.squeeze(0).to('cpu').numpy()
if 'stress' in properties: if 'stress' in properties:
volume = self.atoms.get_volume() volume = self.atoms.get_volume()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment