diff --git a/deepmd/infer/deep_pot.py b/deepmd/infer/deep_pot.py index 1e7ed52c39..3c5fb28f6e 100644 --- a/deepmd/infer/deep_pot.py +++ b/deepmd/infer/deep_pot.py @@ -26,6 +26,18 @@ class DeepPot(DeepEval): default_tf_graph : bool If uses the default tf graph, otherwise build a new tf graph for evaluation + Examples + -------- + >>> from deepmd.infer import DeepPot + >>> import numpy as np + >>> dp = DeepPot('graph.pb') + >>> coord = np.array([[1,0,0], [0,0,1.5], [1,0,3]]).reshape([1, -1]) + >>> cell = np.diag(10 * np.ones(3)).reshape([1, -1]) + >>> atype = [1,0,1] + >>> e, f, v = dp.eval(coord, cell, atype) + + where `e`, `f` and `v` are predicted energy, force and virial of the system, respectively. + Warnings -------- For developers: `DeepTensor` initializer must be called at the end after diff --git a/deepmd/infer/model_devi.py b/deepmd/infer/model_devi.py index 2f8ea83335..74f33322a6 100644 --- a/deepmd/infer/model_devi.py +++ b/deepmd/infer/model_devi.py @@ -110,6 +110,17 @@ def calc_model_devi(coord, model_devi : numpy.ndarray, `n_frames x 7` Model deviation results. The first column is index of steps, the other 6 columns are max_devi_v, min_devi_v, avg_devi_v, max_devi_f, min_devi_f, avg_devi_f. + + Examples + -------- + >>> from deepmd.infer import calc_model_devi + >>> from deepmd.infer import DeepPot as DP + >>> import numpy as np + >>> coord = np.array([[1,0,0], [0,0,1.5], [1,0,3]]).reshape([1, -1]) + >>> cell = np.diag(10 * np.ones(3)).reshape([1, -1]) + >>> atype = [1,0,1] + >>> graphs = [DP("graph.000.pb"), DP("graph.001.pb")] + >>> model_devi = calc_model_devi(coord, cell, atype, graphs) ''' if nopbc: box = None