Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ rst-substitutions =
gro_file,
log_file,
mdp_file,
trr_file,
Python,
PyPI,
pip,
Expand Down
51 changes: 46 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,73 @@
"autoDocstring.startOnNewLine": true,
"black-formatter.importStrategy": "fromEnvironment",
"cSpell.ignoreWords": [
"Andreas",
"Bagheera",
"DTRJ",
"Gromacs",
"Heuer",
"Münster",
"PREC",
"Parrinello",
"REAMDE",
"Rahman",
"Slurm",
"TFSI",
"Thum",
"afterok",
"argparser",
"autocorr",
"autocorrelations",
"autoupdate",
"barostat",
"binwidth",
"builtins",
"colorama",
"densmap",
"dimethyl",
"discretizations",
"docstrings",
"enquoted",
"foss",
"genindex",
"hpcss",
"infile",
"isort",
"jobname",
"lintf",
"lmod",
"markdownlint",
"mastertoc",
"maxdepth",
"mdtools",
"mksh",
"modindex",
"nblocks",
"nojump",
"noqa",
"numpy",
"optdict",
"opthandler",
"polystat",
"posargs",
"posix",
"pymodules",
"pyproject",
"pytest",
"sbatch",
"shellcheck",
"shfmt",
"slabwidth",
"strng",
"subproc",
"subvolume",
"texlive",
"titlesonly",
"toctree"
"toctree",
"topo",
"trjconv",
"zmax",
"zmin"
],
"cSpell.language": "en",
"cSpell.validateDirectives": true,
Expand Down Expand Up @@ -134,10 +172,13 @@
"markdown.updateLinksOnFileMove.enabled": "prompt",
"markdown.validate.enabled": true,
"[python]": {
"editor.codeActionsOnSave": {
// Format import statements with isort.
"source.organizeImports": true,
},
// Somehow, the ms-python.isort removes blank lines before
// comments everywhere in the code. Therefore, sorting imports
// on file save is disabled for now.
// "editor.codeActionsOnSave": {
// // Format import statements with isort.
// "source.organizeImports": true,
// },
"editor.defaultFormatter": "ms-python.black-formatter",
},
"python.defaultInterpreterPath": "python3",
Expand Down
9 changes: 9 additions & 0 deletions analysis/lintf2_ether/mdt/.cleanup_mdt_analyses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ gather() {
}

mv create_mda_universe_slurm-* create_mda_universe
mv energy_dist_slurm-* energy_dist
mv subvolume_charge_slurm-* subvolume_charge

gather discrete-z
gather lifetime_autocorr

name=attribute_hist
for cmp in Li NBT OBT OE NTf2 ether; do
gather "${name}"_"${cmp}"
done
mkdir "${name}" || exit
mv "${name}"_* "${name}"/

name=axial_hex_dist
for cmp in 1nn 2nn; do
gather "${name}"_"${cmp}"
Expand Down
127 changes: 127 additions & 0 deletions analysis/lintf2_ether/mdt/attribute_hist_Li.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash

#SBATCH --time=7-00:00:00
#SBATCH --job-name="mdt_attribute_hist_Li"
#SBATCH --output="mdt_attribute_hist_Li_slurm-%j.out"
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
# The above options are only default values that can be overwritten by
# command-line arguments

# MIT License
# Copyright (c) 2021, 2022 All authors listed in the file AUTHORS.rst

# This script is meant to be submitted by
# submit_mdt_analyses_lintf2_ether.py

analysis="attribute_hist_Li"
thisfile=$(basename "${BASH_SOURCE[0]}")
echo "${thisfile}"
start_time=$(date --rfc-3339=seconds || exit)
echo "Start time = ${start_time}"

########################################################################
# Argument Parsing #
########################################################################

bash_dir=${1} # Directory containing bash scripts used by this script
py_lmod=${2} # File containing the modules to load Python
py_exe=${3} # Name of the Python executable
mdt_path=${4} # Path to the MDTools installation
system=${5} # The name of the system to analyze
settings=${6} # The used simulation settings
begin=${7} # First frame to read. Frame numbering starts at 0
end=${8} # Last frame to read (exclusive)
every=${9} # Read every n-th frame

echo -e "\n"
echo "Parsed arguments:"
echo "bash_dir = ${bash_dir}"
echo "py_lmod = ${py_lmod}"
echo "py_exe = ${py_exe}"
echo "mdt_path = ${mdt_path}"
echo "system = ${system}"
echo "settings = ${settings}"
echo "begin = ${begin}"
echo "end = ${end}"
echo "every = ${every}"

if [[ ! -d ${bash_dir} ]]; then
echo
echo "ERROR: No such directory: '${bash_dir}'"
exit 1
fi

echo -e "\n"
bash "${bash_dir}/echo_slurm_output_environment_variables.sh"

########################################################################
# Load required executable(s) #
########################################################################

# shellcheck source=/dev/null
source "${bash_dir}/load_python.sh" "${py_lmod}" "${py_exe}" || exit

########################################################################
# Start the Analysis #
########################################################################

attributes="velocities forces positions"
components="x y z xyz norm"
for attr in ${attributes}; do
echo -e "\n"
echo "Attribute: ${attr}"
echo "============================================================="
${py_exe} -u \
"${mdt_path}/scripts/other/attribute_hist.py" \
-f "${settings}_out_${system}.trr" \
-s "${settings}_${system}.tpr" \
-o "${settings}_${system}_${analysis}_${attr}" \
-b "${begin}" \
-e "${end}" \
--every "${every}" \
--sel "type Li" \
--attribute "${attr}" ||
exit
echo "============================================================="
echo -e "\n"
for comp in ${components}; do
gzip --best --verbose \
"${settings}_${system}_${analysis}_${attr}_${comp}.txt"
done
done

########################################################################
# Cleanup #
########################################################################

save_dir="${analysis}_slurm-${SLURM_JOB_ID}"
if [[ ! -d ${save_dir} ]]; then
echo -e "\n"
mkdir -v "${save_dir}" || exit
for attr in ${attributes}; do
for comp in ${components}; do
f="${settings}_${system}_${analysis}_${attr}_${comp}.txt.gz"
mv -v "${f}" "${save_dir}"
done
done
mv -v \
"${settings}_${system}_${analysis}_slurm-${SLURM_JOB_ID}.out" \
"${save_dir}"
bash "${bash_dir}/cleanup_analysis.sh" \
"${system}" \
"${settings}" \
"${save_dir}" \
"mdt"
fi

end_time=$(date --rfc-3339=seconds)
elapsed_time=$(bash \
"${bash_dir}/date_time_diff.sh" \
-s "${start_time}" \
-e "${end_time}")
echo -e "\n"
echo "End time = ${end_time}"
echo "Elapsed time = ${elapsed_time}"
echo "${thisfile} done"
127 changes: 127 additions & 0 deletions analysis/lintf2_ether/mdt/attribute_hist_NBT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash

#SBATCH --time=7-00:00:00
#SBATCH --job-name="mdt_attribute_hist_NBT"
#SBATCH --output="mdt_attribute_hist_NBT_slurm-%j.out"
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
# The above options are only default values that can be overwritten by
# command-line arguments

# MIT License
# Copyright (c) 2021, 2022 All authors listed in the file AUTHORS.rst

# This script is meant to be submitted by
# submit_mdt_analyses_lintf2_ether.py

analysis="attribute_hist_NBT"
thisfile=$(basename "${BASH_SOURCE[0]}")
echo "${thisfile}"
start_time=$(date --rfc-3339=seconds || exit)
echo "Start time = ${start_time}"

########################################################################
# Argument Parsing #
########################################################################

bash_dir=${1} # Directory containing bash scripts used by this script
py_lmod=${2} # File containing the modules to load Python
py_exe=${3} # Name of the Python executable
mdt_path=${4} # Path to the MDTools installation
system=${5} # The name of the system to analyze
settings=${6} # The used simulation settings
begin=${7} # First frame to read. Frame numbering starts at 0
end=${8} # Last frame to read (exclusive)
every=${9} # Read every n-th frame

echo -e "\n"
echo "Parsed arguments:"
echo "bash_dir = ${bash_dir}"
echo "py_lmod = ${py_lmod}"
echo "py_exe = ${py_exe}"
echo "mdt_path = ${mdt_path}"
echo "system = ${system}"
echo "settings = ${settings}"
echo "begin = ${begin}"
echo "end = ${end}"
echo "every = ${every}"

if [[ ! -d ${bash_dir} ]]; then
echo
echo "ERROR: No such directory: '${bash_dir}'"
exit 1
fi

echo -e "\n"
bash "${bash_dir}/echo_slurm_output_environment_variables.sh"

########################################################################
# Load required executable(s) #
########################################################################

# shellcheck source=/dev/null
source "${bash_dir}/load_python.sh" "${py_lmod}" "${py_exe}" || exit

########################################################################
# Start the Analysis #
########################################################################

attributes="velocities forces positions"
components="x y z xyz norm"
for attr in ${attributes}; do
echo -e "\n"
echo "Attribute: ${attr}"
echo "============================================================="
${py_exe} -u \
"${mdt_path}/scripts/other/attribute_hist.py" \
-f "${settings}_out_${system}.trr" \
-s "${settings}_${system}.tpr" \
-o "${settings}_${system}_${analysis}_${attr}" \
-b "${begin}" \
-e "${end}" \
--every "${every}" \
--sel "type NBT" \
--attribute "${attr}" ||
exit
echo "============================================================="
echo -e "\n"
for comp in ${components}; do
gzip --best --verbose \
"${settings}_${system}_${analysis}_${attr}_${comp}.txt"
done
done

########################################################################
# Cleanup #
########################################################################

save_dir="${analysis}_slurm-${SLURM_JOB_ID}"
if [[ ! -d ${save_dir} ]]; then
echo -e "\n"
mkdir -v "${save_dir}" || exit
for attr in ${attributes}; do
for comp in ${components}; do
f="${settings}_${system}_${analysis}_${attr}_${comp}.txt.gz"
mv -v "${f}" "${save_dir}"
done
done
mv -v \
"${settings}_${system}_${analysis}_slurm-${SLURM_JOB_ID}.out" \
"${save_dir}"
bash "${bash_dir}/cleanup_analysis.sh" \
"${system}" \
"${settings}" \
"${save_dir}" \
"mdt"
fi

end_time=$(date --rfc-3339=seconds)
elapsed_time=$(bash \
"${bash_dir}/date_time_diff.sh" \
-s "${start_time}" \
-e "${end_time}")
echo -e "\n"
echo "End time = ${end_time}"
echo "Elapsed time = ${elapsed_time}"
echo "${thisfile} done"
Loading