deepmd.pt.model.descriptor package
- deepmd.pt.model.descriptor.BaseDescriptor
alias of
BD
- class deepmd.pt.model.descriptor.DescriptorBlock(*args, **kwargs)[source]
Bases:
Module,ABC,PRThe building block of descriptor. Given the input descriptor, provide with the atomic coordinates, atomic types and neighbor list, calculate the new descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate DescriptorBlock.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- abstract forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate DescriptorBlock.
- local_cluster = False
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptBlockHybrid(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
dim_embReturns the output dimension of embedding.
dim_emb_listReturns the output dimension list of embeddings.
dim_outReturns the output dimension of this descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_stats()Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the output dimension of embedding.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate decoded embedding for each atom.
Args: - extended_coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - nlist: Tell atom types with shape [nframes, natoms[1]]. - atype: Tell atom count and element count. Its shape is [2+self.ntypes]. - nlist_type: Tell simulation box with shape [nframes, 9]. - atype_tebd: Tell simulation box with shape [nframes, 9]. - nlist_tebd: Tell simulation box with shape [nframes, 9].
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptBlockRepformers(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate DescriptorBlock.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension g2.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the embedding dimension g2.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate DescriptorBlock.
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
- class deepmd.pt.model.descriptor.DescrptBlockSeA(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
reinit_exclude
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate decoded embedding for each atom.
Args: - coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - atype: Tell atom types with shape [nframes, natoms[1]]. - natoms: Tell atom count and element count. Its shape is [2+self.ntypes]. - box: Tell simulation box with shape [nframes, 9].
- Returns
- torch.Tensor:
descriptormatrixwithshape[nframes,natoms[0]*self.filter_neuron[-1]*self.axis_neuron].
- torch.Tensor:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
- class deepmd.pt.model.descriptor.DescrptBlockSeAtten(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension of embedding.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the output dimension of embedding.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None) List[Tensor][source]
Calculate decoded embedding for each atom.
Args: - coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - atype: Tell atom types with shape [nframes, natoms[1]]. - natoms: Tell atom count and element count. Its shape is [2+self.ntypes]. - box: Tell simulation box with shape [nframes, 9].
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
- class deepmd.pt.model.descriptor.DescrptDPA1(*args, **kwargs)[source]
Bases:
BD,Module- Attributes
- dim_emb
- dim_out
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
Deserialize from a dict.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, extended_atype, nlist)Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension of g2.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize() DescrptDPA1[source]
Deserialize from a dict.
- property dim_emb
- property dim_out
- forward(extended_coord: Tensor, extended_atype: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
h2The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
swThe smooth switch function. shape: nf x nloc x nnei
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptDPA2(*args, **kwargs)[source]
Bases:
Module,BD- Attributes
dim_embReturns the embedding dimension g2.
- dim_out
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
Deserialize from a dict.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, extended_atype, nlist)Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension of this descriptor.
Returns the output dimension of this descriptor.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize() DescrptDPA2[source]
Deserialize from a dict.
- property dim_emb
Returns the embedding dimension g2.
- property dim_out
- forward(extended_coord: Tensor, extended_atype: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, mapps extended region index to local region.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
h2The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
swThe smooth switch function. shape: nf x nloc x nnei
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptGaussianLcc(*args, **kwargs)[source]
Bases:
Module,BD- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Update mean and stddev for descriptor elements.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, nlist, atype, nlist_type)Calculate the atomic and pair representations of this descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
get_dim_emb()Returns the embedding dimension of g2.
get_dim_out()Returns the output descriptor dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the total number of selected neighboring atoms in the cut-off radius.
get_ntypes()Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected neighboring atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.mixed_types()Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
serialize()Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]
Update mean and stddev for descriptor elements.
- property dim_emb
Returns the output dimension of pair representation.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of atomic representation.
- forward(extended_coord, nlist, atype, nlist_type, nlist_loc=None, atype_tebd=None, nlist_tebd=None, seq_input=None)[source]
Calculate the atomic and pair representations of this descriptor.
Args: - extended_coord: Copied atom coordinates with shape [nframes, nall, 3]. - nlist: Neighbor list with shape [nframes, nloc, nnei]. - atype: Atom type with shape [nframes, nloc]. - nlist_type: Atom type of neighbors with shape [nframes, nloc, nnei]. - nlist_loc: Local index of neighbor list with shape [nframes, nloc, nnei]. - atype_tebd: Atomic type embedding with shape [nframes, nloc, tebd_dim]. - nlist_tebd: Type embeddings of neighbor with shape [nframes, nloc, nnei, tebd_dim]. - seq_input: The sequential input from other descriptor with
shape [nframes, nloc, tebd_dim] or [nframes * nloc, 1 + nnei, tebd_dim]
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
- class deepmd.pt.model.descriptor.DescrptHybrid(*args, **kwargs)[source]
Bases:
BD,ModuleConcate a list of descriptors to form a new descriptor.
- Parameters
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Update mean and stddev for descriptor elements.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the total number of selected neighboring atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]
Update mean and stddev for descriptor elements.
- classmethod deserialize(data: dict) DescrptHybrid[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3. This descriptor returns None
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function. this descriptor returns None
- mixed_types()[source]
Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptSeA(*args, **kwargs)[source]
Bases:
BD,Module- Attributes
dim_outReturns the output dimension of this descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.reinit_exclude([exclude_types])Update the type exclusions.
requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
set_stat_mean_and_stddev
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize(data: dict) DescrptSeA[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- property dim_out
Returns the output dimension of this descriptor.
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function.
- mixed_types()[source]
Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.DescrptSeR(*args, **kwargs)[source]
Bases:
BD,ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
set_stat_mean_and_stddev
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize(data: dict) DescrptSeR[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function.
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- deepmd.pt.model.descriptor.prod_env_mat(extended_coord, nlist, atype, mean, stddev, rcut: float, rcut_smth: float, radial_only: bool = False)[source]
Generate smooth environment matrix from atom coordinates and other context.
Args: - extended_coord: Copied atom coordinates with shape [nframes, nall*3]. - atype: Atom types with shape [nframes, nloc]. - mean: Average value of descriptor per element type with shape [len(sec), nnei, 4 or 1]. - stddev: Standard deviation of descriptor per element type with shape [len(sec), nnei, 4 or 1]. - rcut: Cut-off radius. - rcut_smth: Smooth hyper-parameter for pair force & energy. - radial_only: Whether to return a full description or a radial-only descriptor.
- Returns
- env_mat:
Shapeis[nframes,natoms[1]*nnei*4].
- env_mat:
Submodules
deepmd.pt.model.descriptor.base_descriptor module
deepmd.pt.model.descriptor.descriptor module
- class deepmd.pt.model.descriptor.descriptor.DescriptorBlock(*args, **kwargs)[source]
Bases:
Module,ABC,PRThe building block of descriptor. Given the input descriptor, provide with the atomic coordinates, atomic types and neighbor list, calculate the new descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate DescriptorBlock.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- abstract forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate DescriptorBlock.
- local_cluster = False
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
deepmd.pt.model.descriptor.dpa1 module
- class deepmd.pt.model.descriptor.dpa1.DescrptDPA1(*args, **kwargs)[source]
Bases:
BD,Module- Attributes
- dim_emb
- dim_out
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
Deserialize from a dict.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, extended_atype, nlist)Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension of g2.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize() DescrptDPA1[source]
Deserialize from a dict.
- property dim_emb
- property dim_out
- forward(extended_coord: Tensor, extended_atype: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
h2The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
swThe smooth switch function. shape: nf x nloc x nnei
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
deepmd.pt.model.descriptor.dpa2 module
- class deepmd.pt.model.descriptor.dpa2.DescrptDPA2(*args, **kwargs)[source]
Bases:
Module,BD- Attributes
dim_embReturns the embedding dimension g2.
- dim_out
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
Deserialize from a dict.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, extended_atype, nlist)Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension of this descriptor.
Returns the output dimension of this descriptor.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize() DescrptDPA2[source]
Deserialize from a dict.
- property dim_emb
Returns the embedding dimension g2.
- property dim_out
- forward(extended_coord: Tensor, extended_atype: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, mapps extended region index to local region.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
h2The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
swThe smooth switch function. shape: nf x nloc x nnei
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
deepmd.pt.model.descriptor.env_mat module
- deepmd.pt.model.descriptor.env_mat.prod_env_mat(extended_coord, nlist, atype, mean, stddev, rcut: float, rcut_smth: float, radial_only: bool = False)[source]
Generate smooth environment matrix from atom coordinates and other context.
Args: - extended_coord: Copied atom coordinates with shape [nframes, nall*3]. - atype: Atom types with shape [nframes, nloc]. - mean: Average value of descriptor per element type with shape [len(sec), nnei, 4 or 1]. - stddev: Standard deviation of descriptor per element type with shape [len(sec), nnei, 4 or 1]. - rcut: Cut-off radius. - rcut_smth: Smooth hyper-parameter for pair force & energy. - radial_only: Whether to return a full description or a radial-only descriptor.
- Returns
- env_mat:
Shapeis[nframes,natoms[1]*nnei*4].
- env_mat:
deepmd.pt.model.descriptor.gaussian_lcc module
- class deepmd.pt.model.descriptor.gaussian_lcc.DescrptGaussianLcc(*args, **kwargs)[source]
Bases:
Module,BD- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Update mean and stddev for descriptor elements.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(extended_coord, nlist, atype, nlist_type)Calculate the atomic and pair representations of this descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
get_dim_emb()Returns the embedding dimension of g2.
get_dim_out()Returns the output descriptor dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the total number of selected neighboring atoms in the cut-off radius.
get_ntypes()Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected neighboring atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.mixed_types()Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
serialize()Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]
Update mean and stddev for descriptor elements.
- property dim_emb
Returns the output dimension of pair representation.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of atomic representation.
- forward(extended_coord, nlist, atype, nlist_type, nlist_loc=None, atype_tebd=None, nlist_tebd=None, seq_input=None)[source]
Calculate the atomic and pair representations of this descriptor.
Args: - extended_coord: Copied atom coordinates with shape [nframes, nall, 3]. - nlist: Neighbor list with shape [nframes, nloc, nnei]. - atype: Atom type with shape [nframes, nloc]. - nlist_type: Atom type of neighbors with shape [nframes, nloc, nnei]. - nlist_loc: Local index of neighbor list with shape [nframes, nloc, nnei]. - atype_tebd: Atomic type embedding with shape [nframes, nloc, tebd_dim]. - nlist_tebd: Type embeddings of neighbor with shape [nframes, nloc, nnei, tebd_dim]. - seq_input: The sequential input from other descriptor with
shape [nframes, nloc, tebd_dim] or [nframes * nloc, 1 + nnei, tebd_dim]
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
deepmd.pt.model.descriptor.hybrid module
- class deepmd.pt.model.descriptor.hybrid.DescrptBlockHybrid(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
dim_embReturns the output dimension of embedding.
dim_emb_listReturns the output dimension list of embeddings.
dim_outReturns the output dimension of this descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_stats()Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the output dimension of embedding.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate decoded embedding for each atom.
Args: - extended_coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - nlist: Tell atom types with shape [nframes, natoms[1]]. - atype: Tell atom count and element count. Its shape is [2+self.ntypes]. - nlist_type: Tell simulation box with shape [nframes, 9]. - atype_tebd: Tell simulation box with shape [nframes, 9]. - nlist_tebd: Tell simulation box with shape [nframes, 9].
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.descriptor.hybrid.DescrptHybrid(*args, **kwargs)[source]
Bases:
BD,ModuleConcate a list of descriptors to form a new descriptor.
- Parameters
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Update mean and stddev for descriptor elements.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the total number of selected neighboring atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]
Update mean and stddev for descriptor elements.
- classmethod deserialize(data: dict) DescrptHybrid[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3. This descriptor returns None
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function. this descriptor returns None
- mixed_types()[source]
Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
- nlist_cut_idx: List[torch.Tensor]
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
deepmd.pt.model.descriptor.repformer_layer module
- class deepmd.pt.model.descriptor.repformer_layer.Atten2EquiVarApply(ni: int, nh: int)[source]
Bases:
ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(AA, h2)Define the computation performed at every call.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_extra_state()Return any extra state to include in the module's state_dict.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- forward(AA: Tensor, h2: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class deepmd.pt.model.descriptor.repformer_layer.Atten2Map(ni: int, nd: int, nh: int, has_gate: bool = False, smooth: bool = True, attnw_shift: float = 20.0)[source]
Bases:
ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(g2, h2, nlist_mask, sw)Define the computation performed at every call.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_extra_state()Return any extra state to include in the module's state_dict.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- forward(g2: Tensor, h2: Tensor, nlist_mask: Tensor, sw: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class deepmd.pt.model.descriptor.repformer_layer.Atten2MultiHeadApply(ni: int, nh: int)[source]
Bases:
ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(AA, g2)Define the computation performed at every call.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_extra_state()Return any extra state to include in the module's state_dict.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- forward(AA: Tensor, g2: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class deepmd.pt.model.descriptor.repformer_layer.LocalAtten(ni: int, nd: int, nh: int, smooth: bool = True, attnw_shift: float = 20.0)[source]
Bases:
ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(g1, gg1, nlist_mask, sw)Define the computation performed at every call.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_extra_state()Return any extra state to include in the module's state_dict.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- forward(g1: Tensor, gg1: Tensor, nlist_mask: Tensor, sw: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class deepmd.pt.model.descriptor.repformer_layer.RepformerLayer(rcut, rcut_smth, sel: int, ntypes: int, g1_dim=128, g2_dim=16, axis_dim: int = 4, update_chnnl_2: bool = True, do_bn_mode: str = 'no', bn_momentum: float = 0.1, update_g1_has_conv: bool = True, update_g1_has_drrd: bool = True, update_g1_has_grrg: bool = True, update_g1_has_attn: bool = True, update_g2_has_g1g1: bool = True, update_g2_has_attn: bool = True, update_h2: bool = False, attn1_hidden: int = 64, attn1_nhead: int = 4, attn2_hidden: int = 16, attn2_nhead: int = 4, attn2_has_gate: bool = False, activation_function: str = 'tanh', update_style: str = 'res_avg', set_davg_zero: bool = True, smooth: bool = True)[source]
Bases:
ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(g1_ext, g2, h2, nlist, nlist_mask, sw)- Parameters
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_extra_state()Return any extra state to include in the module's state_dict.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
cal_1_dim
list_update
list_update_res_avg
list_update_res_incr
- forward(g1_ext: Tensor, g2: Tensor, h2: Tensor, nlist: Tensor, nlist_mask: Tensor, sw: Tensor)[source]
- Parameters
- g1_ext
nfxnallxng1extendedsingle-atomchanel - g2
nfxnlocxnneixng2pair-atomchannel,invariant - h2
nfxnlocxnneix3 pair-atomchannel,equivariant - nlist
nfxnlocxnneineighborlist(paddedneisaresetto0) - nlist_mask
nfxnlocxnneimasksoftheneighborlist.realnei1otherwise0 - sw
nfxnlocxnneiswitchfunction
- g1_ext
- Returns
- g1:
nfxnlocxng1updatedsingle-atomchanel - g2:
nfxnlocxnneixng2updatedpair-atomchannel,invariant - h2:
nfxnlocxnneix3updatedpair-atomchannel,equivariant
- g1:
deepmd.pt.model.descriptor.repformers module
- class deepmd.pt.model.descriptor.repformers.DescrptBlockRepformers(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate DescriptorBlock.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the embedding dimension g2.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the embedding dimension g2.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate DescriptorBlock.
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
deepmd.pt.model.descriptor.se_a module
- class deepmd.pt.model.descriptor.se_a.DescrptBlockSeA(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
reinit_exclude
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None)[source]
Calculate decoded embedding for each atom.
Args: - coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - atype: Tell atom types with shape [nframes, natoms[1]]. - natoms: Tell atom count and element count. Its shape is [2+self.ntypes]. - box: Tell simulation box with shape [nframes, 9].
- Returns
- torch.Tensor:
descriptormatrixwithshape[nframes,natoms[0]*self.filter_neuron[-1]*self.axis_neuron].
- torch.Tensor:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
- class deepmd.pt.model.descriptor.se_a.DescrptSeA(*args, **kwargs)[source]
Bases:
BD,Module- Attributes
dim_outReturns the output dimension of this descriptor.
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.reinit_exclude([exclude_types])Update the type exclusions.
requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
set_stat_mean_and_stddev
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize(data: dict) DescrptSeA[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- property dim_out
Returns the output dimension of this descriptor.
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function.
- mixed_types()[source]
Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.
deepmd.pt.model.descriptor.se_atten module
- class deepmd.pt.model.descriptor.se_atten.DescrptBlockSeAtten(*args, **kwargs)[source]
Bases:
DescriptorBlock- Attributes
Methods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(nlist, extended_coord, extended_atype)Calculate decoded embedding for each atom.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension of embedding.
Returns the output dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- property dim_emb
Returns the output dimension of embedding.
- property dim_in
Returns the atomic input dimension of this descriptor.
- property dim_out
Returns the output dimension of this descriptor.
- forward(nlist: Tensor, extended_coord: Tensor, extended_atype: Tensor, extended_atype_embd: Optional[Tensor] = None, mapping: Optional[Tensor] = None) List[Tensor][source]
Calculate decoded embedding for each atom.
Args: - coord: Tell atom coordinates with shape [nframes, natoms[1]*3]. - atype: Tell atom types with shape [nframes, natoms[1]]. - natoms: Tell atom count and element count. Its shape is [2+self.ntypes]. - box: Tell simulation box with shape [nframes, 9].
- Returns
- result:
descriptorwithshape[nframes,nloc,self.filter_neuron[-1] *self.axis_neuron].
- result:
- ret:
environmentmatrixwithshape[nframes,nloc,self.neei,out_size]
- ret:
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
deepmd.pt.model.descriptor.se_r module
- class deepmd.pt.model.descriptor.se_r.DescrptSeR(*args, **kwargs)[source]
Bases:
BD,ModuleMethods
add_module(name, module)Add a child module to the current module.
apply(fn)Apply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16()Casts all floating point parameters and buffers to
bfloat16datatype.buffers([recurse])Return an iterator over module buffers.
children()Return an iterator over immediate children modules.
compile(*args, **kwargs)Compile this Module's forward using
torch.compile().compute_input_stats(merged[, path])Compute the input statistics (e.g.
cpu()Move all model parameters and buffers to the CPU.
cuda([device])Move all model parameters and buffers to the GPU.
deserialize(data)Deserialize the model.
double()Casts all floating point parameters and buffers to
doubledatatype.eval()Set the module in evaluation mode.
extra_repr()Set the extra representation of the module.
float()Casts all floating point parameters and buffers to
floatdatatype.forward(coord_ext, atype_ext, nlist[, mapping])Compute the descriptor.
get_buffer(target)Return the buffer given by
targetif it exists, otherwise throw an error.get_class_by_type(class_type)Get the class by the plugin type.
Returns the output dimension.
Returns the input dimension.
Returns the output dimension.
get_extra_state()Return any extra state to include in the module's state_dict.
get_nnei()Returns the total number of selected neighboring atoms in the cut-off radius.
get_nsel()Returns the number of selected atoms in the cut-off radius.
Returns the number of element types.
get_parameter(target)Return the parameter given by
targetif it exists, otherwise throw an error.get_plugins()Get all the registered plugins.
get_rcut()Returns the cut-off radius.
get_sel()Returns the number of selected atoms for each type.
Get the statistics of the descriptor.
get_submodule(target)Return the submodule given by
targetif it exists, otherwise throw an error.half()Casts all floating point parameters and buffers to
halfdatatype.ipu([device])Move all model parameters and buffers to the IPU.
load_state_dict(state_dict[, strict, assign])Copy parameters and buffers from
state_dictinto this module and its descendants.If true, the discriptor 1.
modules()Return an iterator over all modules in the network.
named_buffers([prefix, recurse, ...])Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_children()Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modules([memo, prefix, remove_duplicate])Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parameters([prefix, recurse, ...])Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parameters([recurse])Return an iterator over module parameters.
register(key)Register a descriptor plugin.
register_backward_hook(hook)Register a backward hook on the module.
register_buffer(name, tensor[, persistent])Add a buffer to the module.
register_forward_hook(hook, *[, prepend, ...])Register a forward hook on the module.
register_forward_pre_hook(hook, *[, ...])Register a forward pre-hook on the module.
register_full_backward_hook(hook[, prepend])Register a backward hook on the module.
register_full_backward_pre_hook(hook[, prepend])Register a backward pre-hook on the module.
register_load_state_dict_post_hook(hook)Register a post hook to be run after module's
load_state_dictis called.register_module(name, module)Alias for
add_module().register_parameter(name, param)Add a parameter to the module.
register_state_dict_pre_hook(hook)Register a pre-hook for the
load_state_dict()method.requires_grad_([requires_grad])Change if autograd should record operations on parameters in this module.
Serialize the obj to dict.
set_extra_state(state)Set extra state contained in the loaded state_dict.
share_memory()See
torch.Tensor.share_memory_().share_params(base_class, shared_level[, resume])Share the parameters of self to the base_class with shared_level during multitask training.
state_dict(*args[, destination, prefix, ...])Return a dictionary containing references to the whole state of the module.
to(*args, **kwargs)Move and/or cast the parameters and buffers.
to_empty(*, device[, recurse])Move the parameters and buffers to the specified device without copying storage.
train([mode])Set the module in training mode.
type(dst_type)Casts all parameters and buffers to
dst_type.update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
xpu([device])Move all model parameters and buffers to the XPU.
zero_grad([set_to_none])Reset gradients of all model parameters.
__call__
set_stat_mean_and_stddev
- compute_input_stats(merged: Union[Callable[[], List[dict]], List[dict]], path: Optional[DPPath] = None)[source]
Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.
- Parameters
- merged
Union[Callable[[],List[dict]],List[dict]] - List[dict]: A list of data samples from various data systems.
Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.
- Callable[[], List[dict]]: A lazy function that returns data samples in the above format
only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.
- path
Optional[DPPath] The path to the stat file.
- merged
- classmethod deserialize(data: dict) DescrptSeR[source]
Deserialize the model.
- Parameters
- data
dict The serialized data
- data
- Returns
BDThe deserialized descriptor
- forward(coord_ext: Tensor, atype_ext: Tensor, nlist: Tensor, mapping: Optional[Tensor] = None)[source]
Compute the descriptor.
- Parameters
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
g2The rotationally invariant pair-partical representation. this descriptor returns None
h2The rotationally equivariant pair-partical representation. this descriptor returns None
swThe smooth switch function.
- mixed_types() bool[source]
If true, the discriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.
If false, the discriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.