ai2_kit.domain.cp2k module#
- class ai2_kit.domain.cp2k.CllCp2kContext(path_prefix: str, resource_manager: ai2_kit.core.resource_manager.ResourceManager, config: ai2_kit.domain.cp2k.CllCp2kContextConfig)[source]#
Bases:
BaseCllContext
- config: CllCp2kContextConfig#
- class ai2_kit.domain.cp2k.CllCp2kContextConfig(*, script_template: BashTemplate, cp2k_cmd: str = 'cp2k', post_cp2k_cmd: str = 'echo "no post_cp2k_cmd"', concurrency: int = 5)[source]#
Bases:
BaseModel
- concurrency: int#
- cp2k_cmd: str#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'concurrency': FieldInfo(annotation=int, required=False, default=5), 'cp2k_cmd': FieldInfo(annotation=str, required=False, default='cp2k'), 'post_cp2k_cmd': FieldInfo(annotation=str, required=False, default='echo "no post_cp2k_cmd"'), 'script_template': FieldInfo(annotation=BashTemplate, required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- post_cp2k_cmd: str#
- script_template: BashTemplate#
- class ai2_kit.domain.cp2k.CllCp2kInput(config: ai2_kit.domain.cp2k.CllCp2kInputConfig, mode: Literal['default', 'dpff', 'fep-redox', 'fep-pka'], system_files: List[ai2_kit.core.artifact.Artifact], type_map: List[str], initiated: bool = False)[source]#
Bases:
object
- config: CllCp2kInputConfig#
- initiated: bool = False#
- mode: Literal['default', 'dpff', 'fep-redox', 'fep-pka']#
- type_map: List[str]#
- class ai2_kit.domain.cp2k.CllCp2kInputConfig(*, init_system_files: List[str] = [], wfn_warmup_template: Optional[str] = None, input_template: Optional[str] = None, template_vars: Mapping[str, Any] = {}, limit: int = 50, limit_method: Literal['even', 'random', 'truncate'] = 'even', ignore_error: bool = False)[source]#
Bases:
BaseModel
- ignore_error: bool#
Ignore error when running cp2k.
- init_system_files: List[str]#
- input_template: Optional[str]#
Input template for cp2k. Could be a dict or content of a cp2k input file.
- limit: int#
Limit of the number of systems to be labeled.
- limit_method: Literal['even', 'random', 'truncate']#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'ignore_error': FieldInfo(annotation=bool, required=False, default=False), 'init_system_files': FieldInfo(annotation=List[str], required=False, default=[]), 'input_template': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'limit': FieldInfo(annotation=int, required=False, default=50), 'limit_method': FieldInfo(annotation=Literal['even', 'random', 'truncate'], required=False, default='even'), 'template_vars': FieldInfo(annotation=Mapping[str, Any], required=False, default={}), 'wfn_warmup_template': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- template_vars: Mapping[str, Any]#
Template variables for input_template and wfn_warmup_template.
Those vars can be referenced in the LAMMPS input template as $$VAR_NAME.
- wfn_warmup_template: Optional[str]#
Warmup template for cp2k. Could be a dict or content of a cp2k input file. This template will be used to generate input files for warmup runs. The warmup runs can be used to generate wave function files for the main runs.
- class ai2_kit.domain.cp2k.Cp2kInputTemplate(template)[source]#
Bases:
Template
- delimiter = '$$'#
- pattern = re.compile('\n \\$\\$(?:\n (?P<escaped>\\$\\$) | # Escape sequence of two delimiters\n (?P<named>(?a:[_a-z][_a-z0-9]*)) | # delimiter and a Python identifier\n , re.IGNORECASE|re.VERBOSE)#
- class ai2_kit.domain.cp2k.GenericCp2kOutput(cp2k_outputs: List[ai2_kit.core.artifact.Artifact])[source]#
Bases:
ICllLabelOutput
- async ai2_kit.domain.cp2k.cll_cp2k(input: CllCp2kInput, ctx: CllCp2kContext) GenericCp2kOutput [source]#
- ai2_kit.domain.cp2k.lammps_efield_to_cp2k(efield: Iterable[float])[source]#
IN CP2K, the efield is defined as INTENSITY and POLARIZATION (direction of the electric field)
- Parameters:
efield – list of 3 floats, the electric field in lammps unit
- Returns:
intensity, polarization
- ai2_kit.domain.cp2k.make_cp2k_task_dirs(system_files: List[ArtifactDict], type_map: List[str], input_template: Optional[str], template_vars: Mapping[str, Any], base_dir: str, mode: Literal['default', 'dpff', 'fep-redox', 'fep-pka'], limit: int = 0, wfn_warmup_template: Optional[str] = None, limit_method: Literal['even', 'random', 'truncate'] = 'even', input_file_name: str = 'input.inp', warmup_file_name: str = 'wfn_warmup.inp') List[ArtifactDict] [source]#
Generate CP2K input files from LAMMPS dump files or XYZ files.