Skip to content

Commit

Permalink
support config setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
link89 committed Apr 9, 2024
1 parent fa6e2d1 commit 45f754a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ TAG=link89/dflow-galaxy:$VERISON-$BRANCH_NAME-$GIT_HASH
docker build -t $TAG .

echo "Run the following command to push the image to Docker Hub:"
echo "docker push $TAG"
echo "docker push $TAG"
27 changes: 22 additions & 5 deletions dflow_galaxy/app/dynacat_tesla/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class DeepmdSettings(BaseModel):
default='dp',
description="Command to run DeepMD, note that it depends on the docker image you used")

setup_script: String = Field(
default='',
format='multi-line',
description="Setup script for DeepMD simulation, note that it depends on the docker image you used")


class LammpsSetting(BaseModel):
system_file: InputFilePath = Field(
Expand Down Expand Up @@ -136,6 +141,11 @@ class LammpsSetting(BaseModel):
default='lmp',
description="Command to run LAMMPS, note that it depends on the docker image you used")

setup_script: String = Field(
default='',
format='multi-line',
description="Setup script for LAMMPS simulation, note that it depends on the docker image you used")


class ModelDeviation(BaseModel):
lo: Float = Field(
Expand Down Expand Up @@ -167,6 +177,15 @@ class Cp2kSettings(BaseModel):
default='mpirun -np 32 cp2k.popt',
description="Script to run CP2K simulation, note that it depends on the docker image")

setup_script: String = Field(
default = '\n'.join([
'# guess cp2k data dir',
'[[ -z "${CP2K_DATA_DIR}" ]] && export CP2K_DATA_DIR="$(dirname "$(which cp2k)")/../../data" || true',
'source /opt/cp2k-toolchain/install/setup',
]),
format='multi-line',
description="Setup script for CP2K simulation, note that it depends on the docker image you used")


class DynacatTeslaArgs(DFlowOptions):

Expand Down Expand Up @@ -281,25 +300,23 @@ def _get_executor_config(args: DynacatTeslaArgs):
},
'dp_cmd': args.deepmd.cmd,
'concurrency': args.deepmd.concurrency,

'setup_script': args.deepmd.setup_script,
},
'lammps': {
'resource': {
'bohrium': args.lammps_resource,
},
'lammps_cmd': args.lammps.cmd,
'concurrency': args.lammps.concurrency,
'setup_script': args.lammps.setup_script,
},
'cp2k': {
'resource': {
'bohrium': args.cp2k_resource,
},
'cp2k_cmd': args.cp2k.cmd,
'concurrency': args.cp2k.concurrency,
'setup_script': '\n'.join([
# guess cp2k data dir
'[[ -z "${CP2K_DATA_DIR}" ]] && export CP2K_DATA_DIR="$(dirname "$(which cp2k)")/../../data" || true',
])
'setup_script': args.cp2k.setup_script,
}
}
}
Expand Down

0 comments on commit 45f754a

Please sign in to comment.