Skip to content

Commit

Permalink
Initial commit of the monolayer analysis code.
Browse files Browse the repository at this point in the history
Contains the code to extract 2d rdf functions as well as face and film statistics using the planar geometry submodule
  • Loading branch information
Reshief committed Feb 29, 2024
1 parent 7af43ed commit 999547e
Show file tree
Hide file tree
Showing 27 changed files with 3,344 additions and 0 deletions.
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.10)
project(monolayer_film_tools)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

# Include GROMACS libraries
message(STATUS "Locating GROMACS package...")
if (WIN32)
else ()
find_package(GROMACS 2021 REQUIRED)
gromacs_check_compiler(CXX)
message(STATUS "GROMACS package at:${GROMACS_INCLUDE_DIRS}")
endif ()

# To build, we need gromacs. For some trajectory analysis functions, we require headers only available in the submodule
include_directories(${GROMACS_INCLUDE_DIRS} submodules/gromacs/src/)

#Include OpenMP capabilities
find_package(OpenMP)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../planar_bin)

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/../planar_bin")

add_subdirectory(src)
54 changes: 54 additions & 0 deletions run/2d_rdf/extract_distribution
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash


echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=( 200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

bin_counts=(201 201 201 401 401)


# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=6
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=6

for i in "${!temperatures[@]}"
do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}
bin_count=${bin_counts[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

trajectory_src=${indir}/nvt.xtc
period_out=${partialsdir}/pbc.period
cation_partial_xtc=${partialsdir}/cation_com.xtc
cation_partial_traj=${partialsdir}/cation_com.traj
anion_partial_xtc=${partialsdir}/anion_com.xtc
anion_partial_traj=${partialsdir}/anion_com.traj


echo "Processing trajectories in ${indir} and outputting to ${output_dir} ..."

output_dir="./results/2d_rdf/${temperature}K_${il_pair_count}A/"
mkdir -p ${output_dir}


# Calcualte 2d distribution of anions with respect to cation
./planar_bin/extractPlanarDistribution ${cation_partial_xtc} ${anion_partial_xtc} ${output_dir}/cation_anion_ ${il_pair_count} ${il_pair_count} 0 0 -b ${bin_count}

# Calcualte 2d distribution of anions with respect to cation
./planar_bin/extractPlanarDistribution ${cation_partial_xtc} ${cation_partial_xtc} ${output_dir}/cation_cation_ ${il_pair_count} ${il_pair_count} 0 0 -s 1 -b ${bin_count}
done

exit 0
51 changes: 51 additions & 0 deletions run/2d_rdf/plot_distribution
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

max_scale_adjusts=(0.34 0.34 0.34 0.16 0.16)
rescale_adjusts=(0.31 0.295 0.335 0.32 0.40)
grid_sizes=(60 60 51 51 51)
vmaxs=(0.4 0.4 0.4 0.5 0.6)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=6
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=6

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}
max_scale_adjust=${max_scale_adjusts[i]}
rescale_adjust=${rescale_adjusts[i]}
grid_size=${grid_sizes[i]}
vmax=${vmaxs[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

trajectory_src=${indir}/nvt.xtc
period_out=${partialsdir}/pbc.period
cation_partial_xtc=${partialsdir}/cation_com.xtc
cation_partial_traj=${partialsdir}/cation_com.traj
anion_partial_xtc=${partialsdir}/anion_com.xtc
anion_partial_traj=${partialsdir}/anion_com.traj

output_dir="./results/2d_rdf/${temperature}K_${il_pair_count}A/"

echo "Processing 2d distributions in ${output_dir} ..."

# Calcualte 2d distribution of anions with respect to cation
./scripts/film/plot_2d_distribution_colored.py -i ${output_dir}/cation_cation_ -i ${output_dir}/cation_anion_ -o ${output_dir} -cx ${max_scale_adjust} -cy ${max_scale_adjust} -g ${grid_size} -rx ${rescale_adjust} -a -m ${vmax}
done

exit 0
12 changes: 12 additions & 0 deletions run/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The run script directory

This directory contains certain bash scripts to perform analysis and create plots for various systems

# 2d_rdf

Has sample scripts to extract 2d relative density distribution functions from a trajectory


# morphology

Has sample scripts to area, perimeter and face statistics from the 2d planar graph being constructed from a trajectory
43 changes: 43 additions & 0 deletions run/morphology/extract_area_perimeter
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=1.3
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=5

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

trajectory_src=${indir}/nvt.xtc
period_out=${partialsdir}/pbc.period
cation_partial_xtc=${partialsdir}/cation_com.xtc
cation_partial_traj=${partialsdir}/cation_com.traj
anion_partial_xtc=${partialsdir}/anion_com.xtc
anion_partial_traj=${partialsdir}/anion_com.traj

output_dir="./results/morphology/${temperature}K_${il_pair_count}A/"
mkdir -p ${output_dir}

echo "Processing trajectories in ${indir} and outputting to ${output_dir} ..."

# Calcualte area and perimeter statistics of the film
./planar_bin/extractFilmParams -i1 ${cation_partial_xtc} -i2 ${anion_partial_xtc} -o ${output_dir}/film_ -c ${cutoff_distance} -hl ${minimal_hole_vertex_count} &
done

exit 0
45 changes: 45 additions & 0 deletions run/morphology/extract_graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)
frame_indices=(0 1500 0 0 0)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=1.3
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=5

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}
frame_index=${frame_indices[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

trajectory_src=${indir}/nvt.xtc
period_out=${partialsdir}/pbc.period
cation_partial_xtc=${partialsdir}/cation_com.xtc
cation_partial_traj=${partialsdir}/cation_com.traj
anion_partial_xtc=${partialsdir}/anion_com.xtc
anion_partial_traj=${partialsdir}/anion_com.traj

output_dir="./results/morphology/${temperature}K_${il_pair_count}A/"
mkdir -p ${output_dir}

echo "Processing trajectories in ${indir} and outputting dumped graphs to ${output_dir} ..."

# Calcualte area and perimeter statistics of the film
./planar_bin/extractFilmParams -i1 ${cation_partial_xtc} -i2 ${anion_partial_xtc} -o ${output_dir}/film_ -c ${cutoff_distance} -hl ${minimal_hole_vertex_count} -d 1 -df ${frame_index} &
done

exit 0
37 changes: 37 additions & 0 deletions run/morphology/extract_line_surface_tension
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=2
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=6

morph_dir="./results/morphology"

SYSTEM_AGGR_OPTS=(-og "${morph_dir}/")

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

output_dir="${morph_dir}/${temperature}K_${il_pair_count}A/"

SYSTEM_AGGR_OPTS+=(-i ${output_dir}/film_outline_area.dat -ie ${indir}/nvt_fee.xvg -n "T=${temperature}K")
SYSTEM_AGGR_OPTS+=(-m ${il_pair_count} -o ${output_dir}/)
done

echo "Running: ./scripts/film/extract_line_surface_tension.py ${SYSTEM_AGGR_OPTS[@]}"
./scripts/film/extract_line_surface_tension.py "${SYSTEM_AGGR_OPTS[@]}"
exit 0
39 changes: 39 additions & 0 deletions run/morphology/plot_face_statistics
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=2
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=3

morph_dir="./results/morphology"

SYSTEM_AGGR_OPTS=(-og "${morph_dir}/" -c ${minimal_hole_vertex_count})

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

output_dir="${morph_dir}/${temperature}K_${il_pair_count}A/"

SYSTEM_AGGR_OPTS+=(-i ${output_dir}/film_face_statistics.dat -n "T=${temperature}K")
SYSTEM_AGGR_OPTS+=(-m ${il_pair_count} -o ${output_dir}/)
done

echo "Running: ./scripts/film/plot_hole_statistics_comparison.py ${SYSTEM_AGGR_OPTS[@]}"
./scripts/film/plot_hole_statistics_comparison.py "${SYSTEM_AGGR_OPTS[@]}"
exit 0
39 changes: 39 additions & 0 deletions run/morphology/plot_hole_statistics
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

echo "Trajectories should be put in subdirectories 'film_trajectories/<T>K_<pairs>A'"

temperatures=(200 250 300 350 400)
il_pair_counts=(54 54 54 154 154)
alu_count=(14592 14952 14952 58368 58368)
oxy_count=(20736 20736 20736 82944 82944)
ohy_count=(2304 2304 2304 9216 9216)

# IL type: C2Mim NTF2
cation_atoms=19
anion_atoms=15

# distance in nanometer for particles to be considered touching
cutoff_distance=2
# minimal number of vertices a hole needs to have to be considered a hole and not a face of the film
minimal_hole_vertex_count=5

morph_dir="./results/morphology"

SYSTEM_AGGR_OPTS=(-og "${morph_dir}/" -c ${minimal_hole_vertex_count})

for i in "${!temperatures[@]}"; do
temperature=${temperatures[i]}
il_pair_count=${il_pair_counts[i]}

indir=film_trajectories/${temperature}K_${il_pair_count}A
partialsdir=${indir}/partial/

output_dir="${morph_dir}/${temperature}K_${il_pair_count}A/"

SYSTEM_AGGR_OPTS+=(-i ${output_dir}/film_holes_statistics.dat -n "T=${temperature}K")
SYSTEM_AGGR_OPTS+=(-m ${il_pair_count} -o ${output_dir}/)
done

echo "Running: ./scripts/film/plot_hole_morphology.py ${SYSTEM_AGGR_OPTS[@]}"
./scripts/film/plot_hole_morphology.py "${SYSTEM_AGGR_OPTS[@]}"
exit 0
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(monolayer)
20 changes: 20 additions & 0 deletions src/monolayer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

include_directories(.)

add_library(planar_geometry STATIC GraphConstructor.cpp PlanarGeometry.cpp Utils.cpp)

# Executable to get area and perimeter statistics of film
add_executable(extractFilmParams extractFilmParams.cpp)
target_link_libraries(extractFilmParams PUBLIC planar_geometry OpenMP::OpenMP_CXX ${GROMACS_LIBRARIES})

# Executable to get 2Drdf distribution from one trajectory with both kinds of particles
add_executable(extractPlanarDistribution extractPlanarDistribution.cpp)
target_link_libraries(extractPlanarDistribution PUBLIC planar_geometry OpenMP::OpenMP_CXX ${GROMACS_LIBRARIES})

# Test for the graph2d library
add_executable(GraphTest GraphTest.cpp)
target_link_libraries(GraphTest PUBLIC planar_geometry OpenMP::OpenMP_CXX)

# Test for the graph2d library with 400K data
add_executable(GraphTest400K GraphTest400K.cpp)
target_link_libraries(GraphTest400K PUBLIC planar_geometry OpenMP::OpenMP_CXX)
Loading

0 comments on commit 999547e

Please sign in to comment.