Skip to content
Merged
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
10 changes: 5 additions & 5 deletions matdeeplearn/common/ase_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def calculate(self, atoms: Atoms, properties=implemented_properties, system_chan
forces = torch.stack([entry["pos_grad"] for entry in out_list]).mean(dim=0)
stresses = torch.stack([entry["cell_grad"] for entry in out_list]).mean(dim=0)

self.results['energy'] = energy.detach().cpu().numpy()
self.results['forces'] = forces.detach().cpu().numpy()
self.results['stress'] = stresses.squeeze().detach().cpu().numpy()
self.results['energy'] = energy.detach().cpu().numpy().squeeze()
self.results['forces'] = forces.detach().cpu().numpy().squeeze()
self.results['stress'] = stresses.squeeze().detach().cpu().numpy().squeeze()

@staticmethod
def data_to_atoms_list(data: Data) -> List[Atoms]:
Expand Down Expand Up @@ -148,7 +148,7 @@ def _load_model(config: dict, rank: str) -> List[BaseModel]:
model_config = config['model']

model_list = []
model_name = 'matdeeplearn.models.' + model_config["name"]
model_name = model_config["name"]
logging.info(f'MDLCalculator: setting up {model_name} for calculation')
# Obtain node, edge, and output dimensions for model initialization
for _ in range(model_config["model_ensemble"]):
Expand Down Expand Up @@ -181,4 +181,4 @@ def _load_model(config: dict, rank: str) -> List[BaseModel]:
except ValueError:
logging.warning(f"MDLCalculator: No checkpoint.pt file is found for model No.{i+1}, and an untrained model is used for prediction.")

return model_list
return model_list