neumannrf / electronic-structure-experiment

Uses the CP2K software package to run DFT simulations on nanoporous materials.
Apache License 2.0
2 stars 0 forks source link

Manually calculate the Raman Intensities #13

Open lipelopesoliveira opened 7 months ago

lipelopesoliveira commented 7 months ago

This PR introduces the new code to manually calculate the Raman intensity (total, perpendicular and parallel) using the small displacements approach and the polarizability tensor as a result of #4.

The code uses the Phono3py package to generate the dynamical matrix from the atomic forces and deal with the symmetry analysis.

There is now two scripts necessary to calculate the vibrational modes:

All the displacements generated by the first script are saved separately and can be executed independently.

Below there is an example of two scripts that can execute the workflow completely.

#!/bin/bash

# Define environment variables
export PATH=$PATH:/home/felipe/Github/electronic-structure-experiment/bin

export CP2K_DIR=/home/felipe/lib/cp2k-2023.2
export CP2K_DATA_DIR=${CP2K_DIR}/data

export OMP_NUM_THREADS=1

# Define specific variables
FrameworkName='HKUST_1'
OutputFolder=$PWD
NProcs=25

# Load the CP2K setup script
source ${CP2K_DIR}/tools/toolchain/install/setup

# First ensure that the CIF file has all atoms explicitly defined in a P1 primitive cell
echo -e "\nCreating primitive P1 cell..."
mv -v ${OutputFolder}/${FrameworkName}.cif ${OutputFolder}/${FrameworkName}_original.cif
pmg structure --convert --filename ${OutputFolder}/${FrameworkName}_original.cif ${OutputFolder}/${FrameworkName}_prim.cif
mv -v ${OutputFolder}/${FrameworkName}_prim.cif ${OutputFolder}/${FrameworkName}.cif

echo -e "\nCreating CP2K input file..."
generate_shift.py --FrameworkName ${FrameworkName} \
                  --Functional "PBE" \
                  --DispersionCorrection "DFTD3(BJ)" \
                  --PWCutoff 1200 \
                  --BasisSet "TZV2P" \
                  --UnitCell "1,1,1" \
                  --dR 0.0005 \
                  --UseOT \
                  --CalculateRaman \
                  --CalculateIR \
                  ${OutputFolder}

FOLDER_LIST=$(ls -d */)

# List the folders in the current directory and iterate over it
for folder in $FOLDER_LIST; do
    echo "Running the cp2k program for the folder $folder"
    # Change to the folder
    cd $folder
    # Remove the \ from the folder name
    folder=$(echo $folder | tr -d '/')
    # Run the cp2k program
    mpirun -np 25 $CP2K_DIR/exe/local/cp2k.psmp -i ${FrameworkName}_${folder}.inp -o ${FrameworkName}_${folder}.out
    # Return to the parent directory
    cd ..
done
#!/bin/bash

# Define environment variables
export PATH=$PATH:/home/felipe/Github/electronic-structure-experiment/bin

export CP2K_DIR=/home/felipe/lib/cp2k-2023.2
export CP2K_DATA_DIR=${CP2K_DIR}/data

export OMP_NUM_THREADS=1

# Define specific variables
FrameworkName='HKUST_1'
OutputFolder=$PWD
NProcs=25

# Load the CP2K setup script
source ${CP2K_DIR}/tools/toolchain/install/setup

echo -e "\nCreating RASPA P1 cell input file..."
parse_phonon.py --FrameworkName ${FrameworkName} \
        --UnitCell "1,1,1" \
                --dR 0.0005 \
                --CalculateRaman \
                --CalculateIR \
                --SaveVecs \
                ${OutputFolder}

The first script generate the inputs and execute the simulations for all displacements. The line containing the command to execute CP2K can be replaced by a command to submit a job on a HPC cluster.

The second script parse de results and generate the files with the Raman information:

Closes #4

lipelopesoliveira commented 7 months ago

@pcostacarvalho can you test this new workflow for Raman simulations with the HKUST-1 structure on CCC? In case you need some help just let me know and we can schedule a meeting.

neumannrf commented 7 months ago

@lipelopesoliveira Which of these packages need to be added to environment.yml: phono3py or phonopy?

Even though you cited phono3py in the text above, the imports all point to phonopy.

neumannrf commented 2 months ago

@lipelopesoliveira Is it time already to merge this branch, or are you still working on it?

lipelopesoliveira commented 1 month ago

@lipelopesoliveira Is it time already to merge this branch, or are you still working on it?

I'm still working on this.