Enable compute metatomic#46
Conversation
| } else { | ||
| error->all(FLERR, "the model requested an unsupported dtype '{}'", mta_data->capabilities->dtype()); | ||
| } | ||
| auto system = this->system_adaptor->system_from_lmp( |
There was a problem hiding this comment.
this should deal with requested inputs directly
There was a problem hiding this comment.
idk if the current version is what you want
|
Will be ready when #49 is merged |
Temp2 A (at least) compilable versiron of `compute metatomic`
| } else if (strcmp(arg[iarg], "shape") == 0) { | ||
| iarg += 1; | ||
| if (iarg == narg) { | ||
| error->one(FLERR, "expected <scalar/vector> after 'shape' in compute metatomic, got nothing"); | ||
| } else if (strcmp(arg[iarg], "scalar") == 0) { | ||
| shape = arg[iarg]; | ||
| shape_is_set = true; | ||
| iarg += 1; | ||
| } else if (strcmp(arg[iarg], "vector") == 0) { | ||
| shape = arg[iarg]; | ||
| shape_is_set = true; | ||
| iarg += 1; | ||
| if (iarg == narg) { | ||
| error->one(FLERR, "expected <size> after 'vector' in compute metatomic, got nothing"); | ||
| } | ||
| output_size = std::stoi(arg[iarg]); | ||
| output_size_is_set = true; | ||
| iarg += 1; | ||
| } else { | ||
| error->one(FLERR, "expected <scalar/vector> after 'shape' in compute metatomic, got '{}'", arg[iarg]); | ||
| } |
There was a problem hiding this comment.
This was not used in the example intputs, is it still relevant?
| "the model requested an unsupported dtype '" + capabilities->dtype() + "'" | ||
| ); | ||
| } | ||
| auto model_outputs = capabilities->outputs(); |
There was a problem hiding this comment.
should this automatically pick a variant? Like we do for energy & co
There was a problem hiding this comment.
I just found that we can specify the variant in the requested output name, see the updated example input
| if (result_kind == RESULT_GLOBAL_VECTOR) { | ||
| memory->destroy(vector); | ||
| } else if (result_kind == RESULT_PERATOM_SCALAR) { | ||
| memory->destroy(vector_atom); | ||
| } else if (result_kind == RESULT_PERATOM_VECTOR) { | ||
| memory->destroy(array_atom); |
There was a problem hiding this comment.
I guess these are defined by LAMMPS in the Compute class?
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
|
Hm after removing the system energy output, we currently don't have a test for the global scalar output, what can be suitable? |
Summary
This PR aims to allow lammps to use
AtomisticModelsto compute propertiesUsage
compute <ID> <group-ID> metatomic <model_path> <property_name/[variant]> unit <unit> device <device> check_consistency <on/off> extensions_directory <extensions_directory> shape <scalar or vector> <vector_shape if shape == vector> types <type1> <type2> ...Example
lmp -i in.compute_metatomicRegarding determining the output shape
It is no longer feasible to determine it with a dummy system, because different outputs have different requirements on the system... e.g. heat flux need a system with PBC on, and the box size must be larger than the model's interactive range. Thus here I require the user to specify the shape (scalar/vector) and the size (if it's a vector) of their required properties. For users' convenience, we can later have a registry for standard outputs, so that users don't need to input the shape and size for standard outputs.