ai2_kit.domain.lasp module#

class ai2_kit.domain.lasp.CllLaspContext(path_prefix: str, resource_manager: ai2_kit.core.resource_manager.ResourceManager, config: ai2_kit.domain.lasp.CllLaspContextConfig)[source]#

Bases: BaseCllContext

config: CllLaspContextConfig#
pydantic model ai2_kit.domain.lasp.CllLaspContextConfig[source]#

Bases: BaseModel

Show JSON schema
{
   "title": "CllLaspContextConfig",
   "type": "object",
   "properties": {
      "lasp_cmd": {
         "default": "lasp",
         "title": "Lasp Cmd",
         "type": "string"
      },
      "script_template": {
         "$ref": "#/$defs/BashTemplate"
      },
      "concurrency": {
         "default": 5,
         "title": "Concurrency",
         "type": "integer"
      }
   },
   "$defs": {
      "BashTemplate": {
         "additionalProperties": false,
         "properties": {
            "shebang": {
               "default": "#!/bin/bash",
               "title": "Shebang",
               "type": "string"
            },
            "header": {
               "default": "",
               "title": "Header",
               "type": "string"
            },
            "setup": {
               "default": "",
               "title": "Setup",
               "type": "string"
            },
            "teardown": {
               "default": "",
               "title": "Teardown",
               "type": "string"
            }
         },
         "title": "BashTemplate",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "script_template"
   ]
}

Config:
  • extra: str = forbid

Fields:
field concurrency: int = 5#
field lasp_cmd: str = 'lasp'#
field script_template: BashTemplate [Required]#
class ai2_kit.domain.lasp.CllLaspInput(config: ai2_kit.domain.lasp.CllLaspInputConfig, type_map: List[str], mass_map: List[float], models: List[ai2_kit.core.artifact.Artifact], new_system_files: List[ai2_kit.core.artifact.Artifact])[source]#

Bases: object

config: CllLaspInputConfig#
mass_map: List[float]#
models: List[Artifact]#
new_system_files: List[Artifact]#
type_map: List[str]#
pydantic model ai2_kit.domain.lasp.CllLaspInputConfig[source]#

Bases: BaseModel

Show JSON schema
{
   "title": "CllLaspInputConfig",
   "type": "object",
   "properties": {
      "input_template": {
         "title": "Input Template",
         "type": "object"
      },
      "potential": {
         "$ref": "#/$defs/Potential"
      },
      "system_files": {
         "items": {
            "type": "string"
         },
         "title": "System Files",
         "type": "array"
      }
   },
   "$defs": {
      "LammpsPotential": {
         "additionalProperties": false,
         "properties": {
            "input_template": {
               "default": "units           metal\nboundary        p p p\natom_style      atomic\natom_modify map yes\n\n$$read_data_section\n\n$$force_field_section\n\ncompute peratom all pressure NULL virial\n",
               "title": "Input Template",
               "type": "string"
            }
         },
         "title": "LammpsPotential",
         "type": "object"
      },
      "Potential": {
         "additionalProperties": false,
         "properties": {
            "lammps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/LammpsPotential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Potential",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "input_template",
      "potential",
      "system_files"
   ]
}

Config:
  • extra: str = forbid

Fields:
field input_template: dict [Required]#

Input template for LASP

field potential: Potential [Required]#
field system_files: List[str] [Required]#

Initial system files to explore

pydantic model Potential[source]#

Bases: BaseModel

Show JSON schema
{
   "title": "Potential",
   "type": "object",
   "properties": {
      "lammps": {
         "anyOf": [
            {
               "$ref": "#/$defs/LammpsPotential"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "LammpsPotential": {
         "additionalProperties": false,
         "properties": {
            "input_template": {
               "default": "units           metal\nboundary        p p p\natom_style      atomic\natom_modify map yes\n\n$$read_data_section\n\n$$force_field_section\n\ncompute peratom all pressure NULL virial\n",
               "title": "Input Template",
               "type": "string"
            }
         },
         "title": "LammpsPotential",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

Fields:
  • lammps (ai2_kit.domain.lasp.CllLaspInputConfig.Potential.LammpsPotential | None)

field lammps: LammpsPotential | None = None#
pydantic model LammpsPotential[source]#

Bases: BaseModel

Show JSON schema
{
   "title": "LammpsPotential",
   "type": "object",
   "properties": {
      "input_template": {
         "default": "units           metal\nboundary        p p p\natom_style      atomic\natom_modify map yes\n\n$$read_data_section\n\n$$force_field_section\n\ncompute peratom all pressure NULL virial\n",
         "title": "Input Template",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

Fields:
  • input_template (str)

field input_template: str = 'units           metal\nboundary        p p p\natom_style      atomic\natom_modify map yes\n\n$$read_data_section\n\n$$force_field_section\n\ncompute peratom all pressure NULL virial\n'#
class ai2_kit.domain.lasp.CllLaspOutput(output_dirs: List[ai2_kit.core.artifact.Artifact])[source]#

Bases: ICllExploreOutput

get_model_devi_dataset() List[Artifact][source]#
output_dirs: List[Artifact]#
class ai2_kit.domain.lasp.LammpsInputTemplate(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)#
async ai2_kit.domain.lasp.cll_lasp(input: CllLaspInput, ctx: CllLaspContext)[source]#
ai2_kit.domain.lasp.make_lasp_task_dirs(systems: List[ArtifactDict], lasp_in_data: dict, base_dir: str, type_map: List[str], mass_map: List[float], dp_models: List[str], lammps_input_template: str | None) List[ArtifactDict][source]#
ai2_kit.domain.lasp.process_lasp_output(task_dir: str, file_name='structures.xyz')[source]#

Align lasp output with model_devi records.

As allstr.arc contains all the structures generated by LASP, we need to use the result of lasp.out for alignment.

The following code is copy from ChecMate, may need to be refactored

ai2_kit.domain.lasp.process_lasp_outputs(task_dirs: List[str], workers: int = 4)[source]#