-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 06102024 add optimizer/ with batch FIRE algorithm implemented with pytorch also a hippynn wrapper under __init__.py * 06282024 update optimizer * 08052024@macbook: update HippyNNBatchOptimizer for pull request * update optimizer codebase to better match rest of library * remove unneeded pt files * update changes and authors --------- Co-authored-by: Shuhao Zhang <[email protected]> Co-authored-by: Nicholas Lubbers <[email protected]>
- Loading branch information
1 parent
013f7eb
commit d565b18
Showing
10 changed files
with
1,174 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ __pycache__/ | |
*.pyc | ||
build/ | ||
hippynn.egg-info/* | ||
|
||
**/*.ipynb_checkpoints/ | ||
**/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
from ..graphs import Predictor | ||
from .BatchOptimizer import * | ||
""" | ||
Functionality for Batch optimization of configurations under a potential energy surface.. | ||
class HippyNNBatchOptimizer(): | ||
def __init__(self, model, optimizer=BatchFIRE(), dump_traj=False): | ||
|
||
# assume model is a hippynn model, and there will be 'Grad' in its output | ||
self.predictor = Predictor.from_graph(model) | ||
self.optimizer = optimizer | ||
self.dump_traj = dump_traj | ||
Contributed by Shuhao Zhang (CMU, LANL) | ||
""" | ||
|
||
def __call__(self, Z, R): | ||
coords = R.clone() | ||
self.optimizer.reset(coords) | ||
while not self.optimizer.stop_signal: | ||
ret = self.predictor(Z=Z, R=coords) | ||
forces = -ret['Grad'] | ||
self.optimizer(forces) | ||
coords = self.optimizer.coords | ||
return coords | ||
|
||
def dump_step(self, Z, R): | ||
# need to figure out how to dump a batch of structures | ||
pass | ||
from .algorithms import BFGSv1, BFGSv2, BFGSv3, FIRE, NewtonRaphson | ||
from .batch_optimizer import Optimizer |
Oops, something went wrong.