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

importance sampling #31

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions espaloma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Extensible Surrogate Potential of Ab initio Learned and Optimized by Message-passing Algorithm
"""

import dgl
import torch

import espaloma.data
from . import metrics, units
import espaloma.app
Expand Down
2 changes: 2 additions & 0 deletions espaloma/mm/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def harmonic(x, k, eq, order=[2]):
if isinstance(order, list):
order = torch.tensor(order)

order = order.to(device=x.device)

return k * ((x - eq)).pow(order[:, None, None]).permute(1, 2, 0).sum(
dim=-1
)
Expand Down
Binary file modified scripts/.DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions scripts/force/train_bonded_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def run(args):
level='g'
),


esp.metrics.GraphMetric(
base_metric=torch.nn.L1Loss(),
between=['u', 'u_ref'],
Expand All @@ -85,12 +86,11 @@ def run(args):
between=['u', 'u_ref'],
level='g'
)
]


'''
metrics_te = [
esp.metrics.GraphMetric(
esp.metrics.GraphDerivativeMetric(
base_metric=base_metric,
between=[param, param + '_ref'],
level=term
Expand All @@ -109,8 +109,8 @@ def run(args):
metrics_tr=metrics_tr,
metrics_te=metrics_te,
n_epochs=args.n_epochs,
normalize=esp.data.normalize.PositiveNotNormalize,
device=torch.device('cuda:0'),
normalize=esp.data.normalize.ESOL100LogNormalNormalize,
optimizer=torch.optim.Adam(net.parameters(), 1e-2),
)

results = exp.run()
Expand Down
Loading