CP2K workflows

Parameters

This module uses the following paramters:

Parameter Default Note
publish cp2k default publish folder
cp2k_cmd cp2k.psmp command to run CP2K
cp2k_aux null path to auxiliary files

cp2k

The cp2k process is specified with an input file, and the set of auxiliary files.

Channels

Channel i/o[idx] Type Note
name in[0] val an id to identify the process
input in[1] file CP2k input file
aux in[2] file auxiliary files
name out.*[0] file same as input
traj out.traj[1] file trajectory (pos, frc, ener, cell, stress)
log out.log[1] file CP2K log
restart out.restart[1] file CP2K restart file

cp2kMD

This is a proxy to run cp2k from a given initial geometry, by taking an input file. The file will be inserted to the input as the initial gemoetry. The geometry must be recognizable by tips.io. In case that a multi-frame trajectry is used, the last frame will be used.

Channels

Channel i/o[idx] Type Note
name in[0] val an id to identify the process
input in[1] file CP2k input file
aux in[2] file auxiliary files
name out.*[0] file same as input
traj out.traj[1] file trajectory (pos, frc, ener, cell, stress)
log out.log[1] file CP2K log
restart out.restart[1] file CP2K restart file
Source code
nextflow.enable.dsl=2

params.publish = 'cp2k'
params.cp2k_cmd = 'cp2k'
params.cp2k_aux = null

process cp2k {
  tag "$name"
  label 'cp2k'
  publishDir "$params.publish/$name"

  input:
    tuple val(name), path(input), path(aux)

  output:
    tuple val(name), path('cp2k.log'), emit:logs
    tuple val(name), path('*.{ener,xyz,stress,cell}'), emit:traj, optional: true
    tuple val(name), path('*.restart'), emit:restart, optional:true

  script:
    """
    #!/bin/bash
    $params.cp2k_cmd -i $input | tee cp2k.log
    """
}


process cp2kGenInp {
  tag "$name"
  label 'tips'
  publishDir "$params.publish/$name"

  input:
    tuple val(name), path(input,stageAs: 'cp2k_skel.inp'), path(ds), val(flags)

  output:
    tuple val(name), path('*.inp')

  script:
  """
  tips cp2kinp $input $ds $flags
  """
}


workflow md {
  take:
    ch // [name, input, init, flags]

  main:
    ch | cp2kGenInp // -> [name, inp] \
       | map {name, inp -> [name, inp, file(params.cp2k_aux)]} \
       | cp2k

  emit:
    traj = cp2k.out.traj
    logs = cp2k.out.logs
    restart = cp2k.out.restart
}

workflow sp {
  take:
    ch // [name, inp, geo]

  main:
    ch | map {name, inp, geo -> \
              [name, inp, geo, '-f asetraj']} \
       | cp2kGenInp \
       | map {name, inp -> [name, inp, file(params.cp2k_aux)]} \
       | cp2k

  emit:
    cp2k.out.logs
}
« Previous
Next »