atomistic-machine-learning / G-SchNet

G-SchNet - a generative model for 3d molecular structures
MIT License
129 stars 24 forks source link

'AtomwiseWithProcessing' object has no attribute 'stress' #3

Closed wxx07 closed 3 years ago

wxx07 commented 3 years ago

Hi,

When I run the model, it raised an error: AttributeError: 'AtomwiseWithProcessing' object has no attribute 'stress'

I look into schnetpack.atomistic.AtomisticModel and it will check stress tensor when called :

# For stress tensor
self.requires_stress = any([om.stress for om in self.output_modules])

So I add self.stress = None in class AtomwiseWithProcessing after the following line and it works : https://github.com/atomistic-machine-learning/G-SchNet/blob/74cea9b00bf27e62f7c324e4e6f3a7b6f1f45e23/nn_classes.py#L73

Is it caused by an update from schnetpack side? Is the stress tensor expected to be None, since it seems to have somethings to do with NPT simulations and not so relevant here?

NiklasGebauer commented 3 years ago

Hey, yes, this seems to be a problem caused by a newer SchNetPack version. The G-SchNet code base in this repository currently only supports SchNetPack 0.3. I definitely would suggest to use a conda environment with that version of SchNetPack. Usually, there are several things in SchNetPack that are changed over time and cause conflicts when using it with G-SchNet, so I would be surprised if the error you mentioned is the only thing that does not work correctly when using a different version than 0.3.

Concerning your second question: I guess setting it to None should be fine, but as I said, I suppose that more things than that require adaptations to make things work a expected, so I don't recommend to use other versions than 0.3.

wxx07 commented 3 years ago

You are right. I installed my SchNetPack from source, which is of version 0.3.1. Now I switch back to 0.3 and everything looks good. Thanks!