Add init parameters to Unified LJ example

This commit is contained in:
Steven Ray Anaya
2022-09-01 02:43:16 -06:00
parent 44f97c916e
commit a17e3e2350
3 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ lmp.commands_string(before_loading)
# Define the model however you like. In this example
# we simply import the unified L-J example from mliap
from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ
unified = MLIAPUnifiedLJ()
unified = MLIAPUnifiedLJ(["Ar"])
# You can also load the model from a pickle file.
# import pickle

View File

@ -5,5 +5,5 @@ from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ
if __name__ == '__main__':
unified = MLIAPUnifiedLJ()
unified = MLIAPUnifiedLJ(["Ar"])
unified.pickle('mliap_unified_lj_Ar.pkl')

View File

@ -5,17 +5,17 @@ import numpy as np
class MLIAPUnifiedLJ(MLIAPUnified):
"""Test implementation for MLIAPUnified."""
def __init__(self):
def __init__(self, element_types, epsilon=1.0, sigma=1.0, rcutfac=1.25):
super().__init__()
self.element_types = ["Ar"]
self.element_types = element_types
self.ndescriptors = 1
self.nparams = 3
# Mimicking the LJ pair-style:
# pair_style lj/cut 2.5
# pair_coeff * * 1 1
self.epsilon = 1.0
self.sigma = 1.0
self.rcutfac = 1.25
self.epsilon = epsilon
self.sigma = sigma
self.rcutfac = rcutfac
def compute_gradients(self, data):
"""Test compute_gradients."""