-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR on nnlda layer #3237
PR on nnlda layer #3237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start! Made a couple of preliminary comments
deepchem/models/dft/nnxc.py
Outdated
Neural network for xc functional | ||
ninpmode: int | ||
The mode to decide the transformation of the density to NN input. | ||
outmultmode: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a usage example and a returns section to the docstring?
deepchem/models/dft/nnxc.py
Outdated
self, | ||
xcstr: str, | ||
nnmodel: torch.nn.Module, | ||
*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- arguments are a bad pattern imo. We shouldn't use them in the deepchem codebase.
deepchem/models/dft/nnxc.py
Outdated
super().__init__() | ||
# What is type of xc here? | ||
self.xc = get_xc(xcstr) | ||
print(type(self.xc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print statements should be removed before merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting closer! Main issue is we need a lot more documentation to explain what these layers do.
deepchem/models/dft/nnxc.py
Outdated
|
||
class NNLDA(BaseNNXC): | ||
""" | ||
Neural network xc functional of LDA (only receives the density as input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a usage example? There should be an explanation of what LDA is as a DFT method, along with a suitable reference. Aim for at least a few paragraphs of discussion
deepchem/models/dft/nnxc.py
Outdated
nnmodel: torch.nn.Module | ||
Neural network for xc functional | ||
ninpmode: int | ||
The mode to decide the transformation of the density to NN input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the valid values? What does each value mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we only support one mode, so I have removed it. Will add it back in the next iterations.
deepchem/models/dft/nnxc.py
Outdated
Neural network for xc functional | ||
ninpmode: int | ||
The mode to decide the transformation of the density to NN input. | ||
outmultmode: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the valid values for the output? What does each value mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we only support one mode, so I have removed it. Will add it back in the next iterations.
deepchem/models/dft/nnxc.py
Outdated
try: | ||
from dqc.xc.base_xc import BaseXC | ||
from dqc.utils.datastruct import ValGrad, SpinParam | ||
from dqc.api.getxc import get_xc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a utility function. Can you copy this in directly from dqc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we trying to do that in this iteration? If so, I'm not so sure, but I will look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. Just a couple more comment improvements to address and we should be ready to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to go. Have a few more requests for documentation improvement here
deepchem/models/dft/nnxc.py
Outdated
|
||
class BaseNNXC(torch.nn.Module): | ||
""" | ||
Base class for the NNLDA and HybridXC classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add more detail on when we would want to use this base class and what capabilities it provides? A good paragraph of explanation would be my rule of thumb
|
||
Returns | ||
------- | ||
res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the shape of res
?
deepchem/models/dft/nnxc.py
Outdated
class HybridXC(BaseNNXC): | ||
""" | ||
The HybridXC module computes XC energy by summing XC energy computed | ||
from libxc and the trainable neural network with tunable weights. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a brief explanation of what libxc
is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to merge in once CI is clear
The CI is fine. But I don't have merge access, it is blocked. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
PR on nnlda layer