Add init parameters to Unified LJ example
This commit is contained in:
@ -49,7 +49,7 @@ lmp.commands_string(before_loading)
|
|||||||
# Define the model however you like. In this example
|
# Define the model however you like. In this example
|
||||||
# we simply import the unified L-J example from mliap
|
# we simply import the unified L-J example from mliap
|
||||||
from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ
|
from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ
|
||||||
unified = MLIAPUnifiedLJ()
|
unified = MLIAPUnifiedLJ(["Ar"])
|
||||||
|
|
||||||
# You can also load the model from a pickle file.
|
# You can also load the model from a pickle file.
|
||||||
# import pickle
|
# import pickle
|
||||||
|
|||||||
@ -5,5 +5,5 @@ from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unified = MLIAPUnifiedLJ()
|
unified = MLIAPUnifiedLJ(["Ar"])
|
||||||
unified.pickle('mliap_unified_lj_Ar.pkl')
|
unified.pickle('mliap_unified_lj_Ar.pkl')
|
||||||
|
|||||||
@ -5,17 +5,17 @@ import numpy as np
|
|||||||
class MLIAPUnifiedLJ(MLIAPUnified):
|
class MLIAPUnifiedLJ(MLIAPUnified):
|
||||||
"""Test implementation for MLIAPUnified."""
|
"""Test implementation for MLIAPUnified."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, element_types, epsilon=1.0, sigma=1.0, rcutfac=1.25):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.element_types = ["Ar"]
|
self.element_types = element_types
|
||||||
self.ndescriptors = 1
|
self.ndescriptors = 1
|
||||||
self.nparams = 3
|
self.nparams = 3
|
||||||
# Mimicking the LJ pair-style:
|
# Mimicking the LJ pair-style:
|
||||||
# pair_style lj/cut 2.5
|
# pair_style lj/cut 2.5
|
||||||
# pair_coeff * * 1 1
|
# pair_coeff * * 1 1
|
||||||
self.epsilon = 1.0
|
self.epsilon = epsilon
|
||||||
self.sigma = 1.0
|
self.sigma = sigma
|
||||||
self.rcutfac = 1.25
|
self.rcutfac = rcutfac
|
||||||
|
|
||||||
def compute_gradients(self, data):
|
def compute_gradients(self, data):
|
||||||
"""Test compute_gradients."""
|
"""Test compute_gradients."""
|
||||||
|
|||||||
Reference in New Issue
Block a user