A kernel ridge regression (with Gaussian kernels) approach to predict polarizability tensors, for calculating Raman spectra of molecules and crystals.
Please type python KRR_polar.py --help
for explanation on its usage.
In addition, for molecular crystals, it is possible to calculate the polarizability tensors of its molecular units with a KRR approach, and use them as a baseline for the calculation of the full crystal polarizability.
👴 The whole is different than the sum of its parts.
In the folder molecules_in_crystal/
, you will find the necessary files to do so. The steps to follow are:
- Break down the crystal trajectory into different trajectories for every molecule in the primitive cell:
(you need to adapt it to your system 😶):
split_crystal_into_mol.py
. - Align these individual trajectories to a reference frame (the same you used to train the molecule on),
and store the corresponding rotation matrices:
align-molecules_rot.py
. - Predict the polarizability tensors for every molecule with
KRR_polar.py
. - Rotate these molecular polarizabilities back to their original orientation within the cell:
transform_polar.py
- Sum up all molecular polarizability tensors:
sum_molecular_polar.py
. You can then use this quantity as a baseline (to specify in thecontrol_KRR
file) for the full crystal.
Here's an interactive notebook version where you can play with parameters and directly see the effect on the polarizability time series and Raman spectrum: