Skip to content

Schema for ASE input

The schema to configure the ASE input file to perform atomistic simulations.

The sections of the schema are:

  1. Define the atomic structure.

    • structure (dict): Define the atomic structure.
  2. Define the calculator with following keys.

    • gpaw_calc (dict): Define the GPAW calculator.
    • dftd3_calc (dict): Define the DFTD3 calculator for Van der Waals correction
    • ase_calc (dict): Define a custom ASE calculator.
  3. Define the simulation

    • md (dict): Define parameters for the molecular dynamics simulation.
    • optimize (dict): Define parameters for the optimization.

Schema:

### Schema for YAML configuration to run CLI script

structure:                ### ANCHOR: Define atomic structure
  type: dict
  required: True
  schema:
    from_extxyz:          # the path to the EXTXYZ file for input structure
      type: string
      required: True
    pbc:                  # set periodic bounday condition. This will overwrite the PBC in the EXTXYZ file. eg. [1, 1, 1]
      type: [list, boolean]

calc:                     ### SECTION Parameters of multiple calculators
  type: dict
  required: True
  schema:
    gpaw:                 ### ANCHOR: GPAW calculator. Accept all GPAW parameters: https://gpaw.readthedocs.io/documentation/basic.html
      type: dict
      allow_unknown: True
      schema:
        mode:             # calculation mode. Default is "fd".
          type: dict
          schema:
            name:         # name of the mode. Choices: "fd", "lcao", "pw".
              type: string
            ecut:         # energy cutoff in eV for plane wave mode. Default is 500 eV
              type: float
        xc:               # exchange-correlation functional
          type: string
        kpts:             # if not set `kpts`, then only Gamma-point is used
          type: dict
        convergence:      # convergence criteria
          type: dict
        occupations:      # occupation method. Default is "fermi-dirac"
          type: dict
        txt:              # output file name. Default is "gpaw_out.txt"
          type: string
        symmetry:         # use symmetry.
          type: string
        parallel:         # parallelization
          type: dict

    dftd3:                ### ANCHOR: DFT-D3 calculator for Van der Waals correction
      type: dict
      schema:
        damping:          # use DFT-D3 damping. Default is "d3zero" (zero-damping). Choices: "d3bj","d3zero","d3bjm","d3zerom","d3op".
          type: string
                          ### ANCHOR: Define ASE's calculator by two ways: using 'pyfile' or 'pyscript'.
    py_file:              # python file that defines ASE's calculator. Python script must return the variable `calc`.
      type: string
    py_script:            # list[str] of python-code to directly define ASE's calculator. Python script must return the variable `calc`. Example:
      type: list          # py_script:
                              #   - "from sevenn.calculator import SevenNetCalculator"
                              #   - "sevenn_args = {'file_type: 'checkpoint'}"
                              #   - "calc = SevenNetCalculator('sevenn_model.pth', **sevenn_args)"
                          ### !SECTION

optimize:                 ### ANCHOR: Parameters to run optimization the structure
  type: dict
  schema:
    fmax:                 # force convergence criteria. Default is 0.05 eV/Ang
      type: float
    mask:                 # 1x6 array of booleans: 1 for relax, 0 for fixed; indicating which of the six independent components of the strain are relaxed. Default is: pbc + [1,1,1]
      type: list
    max_steps:            # maximum number of steps for optimization. Default is 10000
      type: integer


md:                       ### ANCHOR: Parameters to run AIMD/MD simulation
                          ## Supported: NVE, NVT, NPT
                          ## NVT with thermostat: 'Langevin', 'nose_hoover', 'nose_hoover_chain'
                          ## NPT with: - 'parrinello_rahman' barostat + 'nose_hoover' thermostat
                          #            - 'iso_nose_hoover_chain' barostat and thermostat
  type: dict
  schema:
    ensemble:             # ensemble name. Choices: NVE, NVT, NPT. Default is NVE
      type: string
    dt:                   # timestep in fs. Default is 1.0 fs
      type: float
    traj_freq:            # dump frames every `traj_freq` steps. Default is 1.
      type: integer
    num_frames:           # number of frames to be collected. Then total MD nsteps = (num_frames * traj_freq)
      type: integer
    equil_steps:          # number of equilibration steps before running production. Default is 0.
      type: integer

    ### temperature control
    temp:                 # temperature in K. Default is 300 K
      type: float
    thermostat:           # thermostat. Default is 'nose_hoover_chain'. Choices: 'langevin', 'nose_hoover', 'nose_hoover_chain'
      type: string
      allowed: ['langevin', 'nose_hoover', 'nose_hoover_chain']
    tdamp:                # damping timesteps for nose_hoover thermostat. Default is 100.
      type: integer
    langevin_friction:    # friction coefficient for Langevin thermostat. Default is 0.002 fs^-1
      type: float

    ### pressure control
    press:                # external stress in GPa. Default is None if not set. Accept: float, 6-vector, or 3x3 matrix.
      type: [float, list]
    barostat:             # barostat. Default is 'parrinello_rahman'. Choices: 'parrinello_rahman', 'iso_nose_hoover_chain'
      type: string
      allowed: ['parrinello_rahman', 'iso_nose_hoover_chain', 'aniso_nose_hoover_chain']
    pfactor:              # pressure factor for 'parrinello_rahman' barostat. Default is 2e6 GPa.
      type: float
    pdamp:                # damping timesteps for 'iso_nose_hoover_chain' barostat. Default is 1000.
      type: integer
    mask:                 # dimensions to relax computational box. Set to (1,1,1) to allow fully flexible box. Set to (1,1,0) to disallow elongations along the z-axis, etc. If not set, then only relax the periodic dimensions. Only available for 'parrinello_rahman' barostat.
      type: [list, boolean]  # None or 3-tuple

Example configuration:

structure:  # atomic structure information
  from_extxyz: MoS2_triangular.extxyz   # The EXTXYZ file for input structure
  pbc: [1, 1, 1]                          # set this will overwrite the PBC in the EXTXYZ file. eg. [1, 1, 1]

calc:
  gpaw:               # accept GPAW parameters
    mode:
      name: 'pw'          # use PlaneWave method energy cutoff in eV
      ecut: 500
    xc: "PBE"             # exchange-correlation functional
    kpts: {"density": 10, "gamma": False, 'even': True}  # if not set `kpts`, then only Gamma-point is used

  dftd3:           # DFT-D3 method for Van der Waals correction
    damping: "d3zero"   # use DFT-D3 damping. Default is "d3zero" (zero-damping). Choices: "d3bj","d3zero","d3bjm","d3zerom","d3op".

  ase:           # define ASE's calculator by two ways: pyfile or pyscript. Script must define variable `calc`
    pyfile:  ase_calculator.py    # python file that defines ASE's calculator
    # pyscript:      # list[str], directly define ASE's calculator in form of python code.
    #   - "from sevenn.calculator import SevenNetCalculator"
    #   - "sevenn_args = {'file_type': 'checkpoint'}"
    #   - "calc = SevenNetCalculator('sevenn_model.pth', **sevenn_args)"

optimize:                   # run DFT to optimize the structure
  fmax: 0.05                # force convergence criteria. Default is 0.05 eV/Ang
  relax_dim: [1,1,1,1,1,1]  # 1x6 array, 1 for relax, 0 for fixed. Default is; pbc + [1,1,1]
  max_steps: 10000          # maximum number of steps for optimization. Default is 10000

md:                     # run AIMD/MD simulation
  ### Supported: NVE, NVT, NPT
  ### NVT with thermostat: Langevin, nose_hoover, nose_hoover_chain
  ### NPT with:
      # - parrinello_rahman barostat + nose_hoover thermostat
      # - iso_nose_hoover_chain barostat and thermostat

  ensemble: 'NPT'       # ensemble type. Choices: NVE, NVT, NPT. Default is NVE
  dt: 1.0               # time step in fs. Default is 1.0 fs
  temperature: 300      # temperature in K. Default is 300 K
  stress: 0             # external stress in GPa. Default is None if not set. Accept float, 6-vector, or 3x3 matrix.
  num_frames: 5         # number of frames to be collected. Then total MD nsteps = collect_frames * traj_freq
  traj_freq: 3          # dump the frames every `traj_freq` steps
  equil_steps: 0        # number of equilibration steps before production run. Default is 0 steps

  thermostat:           # thermostat type. Default is nose_hoover_chain. Choices: Langevin, nose_hoover, nose_hoover_chain
    name: 'nose_hoover_chain'
    tdamp: 100              # damping timesteps for nose_hoover thermostat. Default is 50.
    # tchain: 3             # number of nose_hoover chain for nose_hoover_chain thermostat. Default is 3.
    friction: 0.002         # friction coefficient for Langevin thermostat. Default is 0.002 fs^-1
  barostat:             # barostat type. Default is parrinello_rahman. Choices: parrinello_rahman, iso_nose_hoover_chain
    name: 'iso_nose_hoover_chain'
    pfactor: 2000000        # pressure for parrinello_rahman barostat. Default is 2e6 GPa.
    pdamp: 1000             # damping timesteps for parrinello_rahman barostat. Default is 1000.
    # pchain: 3             # number of nose_hoover chain for iso_nose_hoover_chain barostat. Default is 3.