deepmodeling / dpgen

The deep potential generator to generate a deep-learning based model of interatomic potential energy and force field
https://docs.deepmodeling.com/projects/dpgen/
GNU Lesser General Public License v3.0
307 stars 175 forks source link

[Feature Request] Support for model type "linear_ener" and other similar models #1666

Closed draneyj closed 1 day ago

draneyj commented 1 day ago

Summary

When using model type "linear_ener" with DPGEN there is an error, since the model type does not have a "descriptor" field. This prevents the use of this model type with DPGEN.

Detailed Description

Here is the "default_training_param" field in my param.json file

"default_training_param": {
    "model": {
        "type": "linear_ener",
        "weights": "sum",
        "models": [
            {
                "type_map": ["C", "H"],
                "descriptor" :{
                    "type":     "se_e2_a",
                    "sel":      [128, 128],
                    "rcut_smth":    0.50,
                    "rcut":         5.0,
                    "neuron":       [25, 50, 100],
                    "resnet_dt":    false,
                    "axis_neuron":  16,
                    "seed":     11111,
                    "_comment":     " that's all"
                },
                "fitting_net" : {
                    "neuron":       [120, 120, 120],
                    "resnet_dt":    false,
                    "seed":     11111,
                    "_comment":     " that's all"
                }
            },
            {
                "type": "pairtab",
                "tab_file": "/scratch/gpfs/jd6157/dp_data/tabulation/tab2.txt",
                "rcut": 2.0,
                "sel": [64]
            }
        ]
    },
    "learning_rate": {
        "start_lr": 0.0002,
        "decay_steps": 5000
    },
    "loss": {
        "start_pref_e": 0.02,
        "limit_pref_e": 8,
        "start_pref_f": 1000,
        "limit_pref_f": 1,
        "start_pref_v": 0.0,
        "limit_pref_v": 0.0
    },
    "training": {
        "set_prefix": "set",
        "stop_batch": 1000000,
        "batch_size": 1,
        "disp_file": "lcurve.out",
        "disp_freq": 2000,
        "numb_test": 5,
        "save_freq": 400000,
        "save_ckpt": "model.ckpt",
        "disp_training": true,
        "time_training": true,
        "profiling": false,
        "profiling_file": "timeline.json",
        "_comment": "that's all"
    }
  },

and the resulting error / trace:

Traceback (most recent call last): File "/scratch/gpfs/AZP/software/shared-conda/deepmd/bin/dpgen", line 10, in sys.exit(main()) ^^^^^^ File "/scratch/gpfs/AZP/software/shared-conda/deepmd/lib/python3.12/site-packages/dpgen/main.py", line 255, in main args.func(args) File "/scratch/gpfs/AZP/software/shared-conda/deepmd/lib/python3.12/site-packages/dpgen/generator/run.py", line 5394, in gen_run run_iter(args.PARAM, args.MACHINE) File "/scratch/gpfs/AZP/software/shared-conda/deepmd/lib/python3.12/site-packages/dpgen/generator/run.py", line 4722, in run_iter make_train(ii, jdata, mdata) File "/scratch/gpfs/AZP/software/shared-conda/deepmd/lib/python3.12/site-packages/dpgen/generator/run.py", line 559, in make_train if jinput["model"]["descriptor"]["type"] == "hybrid":


KeyError: 'descriptor'

Further Information, Files, and Links

No response

draneyj commented 1 day ago

Forgot to mention this is with dpgen version 0.12.1

njzjz commented 1 day ago

I think this has been fixed by #1584

draneyj commented 1 day ago

Indeed it has. Thank you very much.