atomistic-machine-learning/G-SchNet

'AtomwiseWithProcessing' object has no attribute 'stress'

wxx07 opened this issue · 2 comments

wxx07 commented

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 :

self.derivative = None # don't compute derivative w.r.t. inputs

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?

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

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!