Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulty with PBC #605

Closed
SamTov opened this issue Dec 10, 2021 · 3 comments
Closed

Difficulty with PBC #605

SamTov opened this issue Dec 10, 2021 · 3 comments

Comments

@SamTov
Copy link

SamTov commented Dec 10, 2021

Hello, I am trying to train some torchANI models for periodic systems but struggling to get the PBC to work well. The tensors I give it for cell and pbc are of the form:

cell = torch.eye(3, dtype=torch.double) * 10
pbc = torch.ones(3, dtype=torch.bool)

I have this for each configuration of atoms (ase Atoms objects). My pass to the network looks like this:

_, predicted_energies = self.torch_model(
                        (species, coordinates),
                        cell=cell,
                        pbc=condition
                    )

where in this case cell and condition are of the shape (n_configurations, 3, 3) for the cell and (n_configurations, 3) for condition.

When I run this I find an error like this:

num_repeats = torch.where(pbc, num_repeats, num_repeats.new_zeros(()))
RuntimeError: The size of tensor a (3) must match the size of tensor b (64) at non-singleton dimension 1

I have tried to play around with the shape of the data but struggle to get anything meaningful from it. Any suggestions would be greatly appreciated.

@isayev
Copy link
Member

isayev commented Dec 10, 2021

Your definition of the periodic system is incorrect. This must pass (3, 3) matrix of cell vectors to cell variable and boolean vector of size 3 to pbc if you want to have periodicity in all 3 dimensions.

@zubatyuk
Copy link
Contributor

zubatyuk commented Dec 12, 2021 via email

@SamTov
Copy link
Author

SamTov commented Jan 3, 2022

Perfect, thank you for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants