Hi @bastonero
I am finally able to complete the aaida-vibroscopy run on my input.
(aiidaENV) rkarkee@ch-fe2:~> verdi process status 1080
IRamanSpectraWorkChain<1080> Finished [0] [2:if_(should_run_average)]
└── HarmonicWorkChain<1082> Finished [0] [4:if_(should_run_phonopy)]
├── generate_preprocess_data<1083> Finished [0]
├── PhononWorkChain<1088> Finished [0] [7:if_(should_run_phonopy)]
│ ├── generate_preprocess_data<1093> Finished [0]
│ ├── get_supercell<1098> Finished [0]
│ ├── PwBaseWorkChain<1101> Finished [0] [3:results]
│ │ └── PwCalculation<1107> Finished [0]
│ ├── get_supercells_with_displacements<1114> Finished [0]
│ ├── PwBaseWorkChain<1128> Finished [0] [3:results]
│ │ └── PwCalculation<1153> Finished [0]
│ ├── PwBaseWorkChain<1130> Finished [0] [3:results]
│ │ └── PwCalculation<1156> Finished [0]
│ ├── PwBaseWorkChain<1132> Finished [0] [3:results]
│ │ └── PwCalculation<1159> Finished [0]
│ ├── PwBaseWorkChain<1134> Finished [0] [3:results]
│ │ └── PwCalculation<1162> Finished [0]
│ ├── PwBaseWorkChain<1136> Finished [0] [3:results]
│ │ └── PwCalculation<1165> Finished [0]
│ ├── PwBaseWorkChain<1138> Finished [0] [3:results]
│ │ └── PwCalculation<1168> Finished [0]
│ ├── PwBaseWorkChain<1140> Finished [0] [3:results]
│ │ └── PwCalculation<1171> Finished [0]
│ ├── PwBaseWorkChain<1142> Finished [0] [3:results]
│ │ └── PwCalculation<1174> Finished [0]
│ ├── PwBaseWorkChain<1144> Finished [0] [3:results]
│ │ └── PwCalculation<1177> Finished [0]
│ ├── PwBaseWorkChain<1146> Finished [0] [3:results]
│ │ └── PwCalculation<1180> Finished [0]
│ ├── PwBaseWorkChain<1148> Finished [0] [3:results]
│ │ └── PwCalculation<1183> Finished [0]
│ ├── PwBaseWorkChain<1150> Finished [0] [3:results]
│ │ └── PwCalculation<1186> Finished [0]
│ └── generate_phonopy_data<1276> Finished [0]
├── DielectricWorkChain<1092> Finished [0] [11:results]
│ ├── PwBaseWorkChain<1096> Finished [0] [3:results]
│ │ └── PwCalculation<1104> Finished [0]
│ ├── PwBaseWorkChain<1205> Finished [0] [3:results]
│ │ └── PwCalculation<1208> Finished [0]
│ ├── compute_critical_electric_field<1230> Finished [0]
│ ├── get_accuracy_from_critical_field<1232> Finished [0]
│ ├── get_electric_field_step<1234> Finished [0]
│ ├── PwBaseWorkChain<1238> Finished [0] [3:results]
│ │ └── PwCalculation<1241> Finished [0]
│ ├── PwBaseWorkChain<1284> Finished [0] [3:results]
│ │ └── PwCalculation<1302> Finished [0]
│ ├── PwBaseWorkChain<1287> Finished [0] [3:results]
│ │ └── PwCalculation<1305> Finished [0]
│ ├── PwBaseWorkChain<1290> Finished [0] [3:results]
│ │ └── PwCalculation<1308> Finished [0]
│ ├── PwBaseWorkChain<1293> Finished [0] [3:results]
│ │ └── PwCalculation<1311> Finished [0]
│ ├── PwBaseWorkChain<1296> Finished [0] [3:results]
│ │ └── PwCalculation<1314> Finished [0]
│ ├── PwBaseWorkChain<1299> Finished [0] [3:results]
│ │ └── PwCalculation<1317> Finished [0]
│ ├── subtract_residual_forces<1350> Finished [0]
│ └── NumericalDerivativesWorkChain<1357> Finished [0] [None]
│ ├── generate_preprocess_data<1358> Finished [0]
│ ├── compute_nac_parameters<1360> Finished [0]
│ ├── compute_susceptibility_derivatives<1362> Finished [0]
│ └── join_tensors<1365> Finished [0]
├── elaborate_tensors<1367> Finished [0]
└── generate_vibrational_data_from_phonopy<1369> Finished [0]
I am following the tutorial about analyzing the results from aiida-vibroscopy tutorial.
from aiida_vibroscopy.utils.plotting import get_spectra_plot
vibro = calc.outputs.vibrational_data.numerical_accuracy_4
polarized_intensities, unpolarized_intensities, frequencies_pbesol, labels = vibro.run_powder_raman_intensities(frequency_laser=532, temperature=300)
total_intensities_pbesol = polarized_intensities + unpolarized_intensities
plt = get_spectra_plot(frequencies_pbesol, total_intensities_pbesol)
plt.show()
I have a few more questions.
- How do I link the completed results so as run
vibro = calc.outputs.vibrational_data.numerical_accuracy_4
polarized_intensities, unpolarized_intensities, frequencies_pbesol, labels = vibro.run_powder_raman_intensities(frequency_laser=532, temperature=300)
- How do I plot polarized Raman, as you have done in your paper (Fig 3)
I am following your example file and using overrides.yaml and submit.py from github, which has following
calc=submit(builder)
as opposed to tutorial
results, calc = run_get_node(builder)
Thanks
Rijan
Hello,
Happy it finally worked out! So, it is actually very simple. You can watch all the outputs of the workchain by doing verdi process show 1080
, where 1080 is the PK of the workchain. You should see that this node has a vibrational_data
namespace output, and numerical_accuracy_2
which is a VibrationalData
node that contains tensors computed using a numerical derivative of order 2 (this can be either chosen on the fly, or it can be overridden).
So, you can load the vibrational data via the following:
vibro = load_node(1080).outputs.vibrational_data.numerical_accuracy_2 # note 2 here, but it can be different as well
Then you can use the rest of the script to get the spectra (this you can do in a jupyter notebook for instance).
Then, if you want to get the single-crystal spectra, I recommend to update to the latest version (v1.1.0) of aiida-vibroscopy. You can find how to get the single-crystal spectra in the “How To” section: Post-process data — aiida-vibroscopy 1.1.0 documentation
Hi @bastonero
Thanks for the reply.
I got this error
Traceback (most recent call last):
File "/lustre/scratch5/.mdt0/rkarkee/plot_results.py", line 4, in <module>
vibro = load_node(1080).outputs.vibrational_data.numerical_accuracy_2
^^^^^^^^^
NameError: name 'load_node' is not defined. Did you mean: 'load_code'?
which I need to import something but I am not sure which one. My input is this:
from aiida_vibroscopy.utils.plotting import get_spectra_plot
from aiida.orm import load_code
vibro = load_node(1080).outputs.vibrational_data.numerical_accuracy_2
polarized_intensities, unpolarized_intensities, frequencies_pbesol, labels = vibro.run_powder_raman_intensities(frequency_laser=532, temperature=300)
total_intensities_pbesol = polarized_intensities + unpolarized_intensities
plt = get_spectra_plot(frequencies_pbesol, total_intensities_pbesol)
plt.show()
Also, I went through the link, just to make sure [0,0,1] means polarization of light in z? right?
You can import it via from aiida.orm import load_code, load_node
Yes, please also check the documentation and the docstrings of the methods. There is a pretty extended explanation of each method. You can also look here: aiida_vibroscopy.data.vibro_mixin — aiida-vibroscopy 1.1.0 documentation
Sorry to bother again. I am still getting error for post processing. I updated from aiida.orm import load_code, load_node
in the code above.
(aiidaENV) rkarkee@ch-fe2:/lustre/scratch5/rkarkee> python plot_results.py
Traceback (most recent call last):
File "/lustre/scratch5/.mdt0/rkarkee/plot_results.py", line 4, in <module>
vibro = load_node(1080).outputs.vibrational_data.numerical_accuracy_2
^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/utils/loaders.py", line 206, in load_node
return load_entity(
^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/utils/loaders.py", line 92, in load_entity
return entity_loader.load_entity(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/utils/loaders.py", line 390, in load_entity
builder, query_parameters = cls.get_query_builder(identifier, identifier_type, sub_classes, query_with_dashes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/utils/loaders.py", line 350, in get_query_builder
builder = cls._get_query_builder_id_identifier(identifier, classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/utils/loaders.py", line 292, in _get_query_builder_id_identifier
builder = QueryBuilder()
^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/querybuilder.py", line 140, in __init__
self._backend = backend or get_manager().get_profile_storage()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/manage/manager.py", line 254, in get_profile_storage
raise ConfigurationError(
aiida.common.exceptions.ConfigurationError: Could not determine the current profile. Consider loading a profile using `aiida.load_profile()`.
Right, so if you are using a python script or notebook you should also load the profile:
from aiida import load_profile
load_profile()
Thanks @bastonero
I am getting less number of peaks in my result compared to DFPT or exp. I guess this has to do with convergence and many other factors leading to more accurate calculations.
In general, do we expect more k-grid , ecutoff, etc for this method?
Are there other parameters in aiida-vibroscopy I need to tune for better accuracy?
Thanks again.
Best
Rijan
Very hard to tell w/o more information. For sure the finite-difference approach and DFPT must coincide within numerical noise.
If I remember correctly, you were studying a 2D material, so also the finite step size of the displacement can be a sensitive parameter. You may try something like 0.005 Angstrom. You can tweak it by putting the following in the overrides:
phonon:
displacement_generator:
distance: 0.005 # in Angstrom
You might also try to decrease the convergence threshold of the scf (in ELECTRONS --> conv_thr
to something like 1e-12-1e-15
).
Usually if you use the same paramters between DFPT and finite-differences you should not have so much discrepancy. But again, I can’t tell w/o more information (e.g. DFPT output, aiida inputs, …)
Well its a 2D layered material in its bulk form, so literally not a 2D material. I will try with that. I once worked on using ph.x, and shifting the atomic coordinates and obtaining the dielectric matrix to solve for Raman tensor. That needed much higher k-grid to converge, which is kind of finite difference method so I was wondering if this is the case here as well.
Also, how do I update to latest version? I have recently installed aiida-vibroscopy.
But when I try to run single crystal raman intensity, I got this error, which is I guess hinting me to update.
(aiidaENV) rkarkee@ch-fe2:/lustre/scratch5/rkarkee> python plot_results.py
Traceback (most recent call last):
File "/lustre/scratch5/.mdt0/rkarkee/plot_results.py", line 19, in <module>
intensities_p, frequencies_p, labels = vibro.run_single_crystal_raman_intensities(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/nodes/node.py", line 730, in __getattr__
raise AttributeError(name)
AttributeError: run_single_crystal_raman_intensities
Yes, indeed usually the number of k-points should be higher for the Raman tensor (note: already highlighted in the tutorial), but the number of phonon peaks (i.e. number of modes) should be the same as for DFPT. Moreover, usually relative intensities converge quite fast, so no need to extremely converge the tensors.
You can update as with any PyPI package: pip install --upgrade aiida-vibroscopy
Very hard to say why you get that error.
Apparently, it is not related to not being updated. This is the input I am using to plot.
from aiida_vibroscopy.utils.plotting import get_spectra_plot
from aiida.orm import load_code, load_node
from aiida import load_profile
import numpy as np
load_profile()
vibro=load_node(1080)
incoming = [0,0,1] # light polatization of the incident laser beam
outgoing = [0,0,1] # light polatization of the emitted laser beam
intensities_p, frequencies_p, labels = vibro.run_single_crystal_raman_intensities(
pol_incoming=incoming,
pol_outgoing=outgoing,
frequency_laser=532,
temperature=300,
)
plt = get_spectra_plot(frequencies_p, intensities_p)
Also,
I got the similar error for run_active_modes
(aiidaENV) rkarkee@ch-fe1:/lustre/scratch5/rkarkee> python plot_results.py
Traceback (most recent call last):
File "/lustre/scratch5/.mdt0/rkarkee/plot_results.py", line 27, in <module>
frequencies, _, labels=vibro.run_active_modes(selection_rules='raman')
^^^^^^^^^^^^^^^^^^^^^^
File "/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/nodes/node.py", line 730, in __getattr__
raise AttributeError(name)
AttributeError: run_active_modes
I ran with this code
from aiida_vibroscopy.utils.plotting import get_spectra_plot
from aiida.orm import load_code, load_node
from aiida import load_profile
import numpy as np
load_profile()
vibro=load_node(1080)
frequencies, _, labels=vibro.run_active_modes(selection_rules='raman')
Also, in the website Post-process data — aiida-vibroscopy 1.1.0 documentation
Is it really selectrion_rules or selection_rules? It may be a typo but I could not check since it failed in detecting run_active_modes calculation.
I have also the updated version of aiida-vibroscopy
(aiidaENV) rkarkee@ch-fe1:/lustre/scratch5/rkarkee> pip show aiida-vibroscopy
Name: aiida-vibroscopy
Version: 1.1.0
Summary: AiiDA plugin for vibrational spectoscopy using Quantum ESPRESSO.
Home-page:
Author:
Author-email: Lorenzo Bastonero <bastonero.lorenzo@gmail.com>
License:
Location: /users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages
Requires: aiida-core, aiida-phonopy, aiida-quantumespresso, phonopy
Required-by:
You need to use the VibrationalData output node, not the node of the workchain. Substitute your line with the following and it should work
Hi @bastonero
I have few other questions.
Is there something we need to take care of for working with 2D materials (with vacuum along z lets say) or molecules?
Or is it enough to just supply correct structure?
I am not a 2D experts, but for sure you need to converge the vacuum level to the properties of interest, and/or apply some special techniques, such as the cutoff of the coulomb potential etc. However, these are Quantum ESPRESSO related questions, so please refer to their documentation and to their forum for these specific queries.
Hi @bastonero
Could you please add a code in get_spectra_plot to save the actual data?
Or is there a way to extract the data and plot later using other software for example.
I did this but it only list data without broadening, which means I need to do some work to add broadening. It would be great if you have option to save data that was being plotted with broadening.
data=np.column_stack((frequencies_pbesol, unpolarized_intensities))
np.savetxt('unpolarizedraman.txt', data, header='frequency unpolarized_intensity',comments='', delimiter='\t')
Hello,
It is not directly in the documentation, but an easy way would be the following:
import numpy as np
from aiida_vibroscopy.utils.broadenings import multilorentz
polarized_intensities, depolarized_intensities, frequencies, labels = vibro.run_powder_raman_intensities(frequency_laser=532, temperature=300)
total = polarized_intensities + depolarized_intensities
x = np.arange(0,1200,1) # range [0,1200) with steps of size 1
y = multilorentz(x, frequencies, total, gammas=10.0) #
gammas
are the broadenings in cm^-1
. You can set them via a list, having the same length of frequencies
, or just a constant float value, as in the previous snippet.
You can reuse this script for any intensities and frequencies. You can even choose other broadening (e.g. multivoigt). Or make up your own, if something is missing in the utility module.
Also a question about the paper, while using hybrid functional like PBE0, how did you do structural optimization?
Would simply vc-relax in QE do relaxation on hybrid functionals?
I have been trying vc-relax on PBE0, but I am not seeing structural optimizations as one would observe in normal vc-relax calculations.