jarvist / Julia-Phonons

Julia codes to play with Phonons
MIT License
22 stars 11 forks source link

Inner product between phonon eigenvectors of two structures #2

Open lucydot opened 6 years ago

lucydot commented 6 years ago

I'd like to use JuliaPhonons to do a similar analysis as found in part V of this paper. The inner product between the eigenvectors of a defect cell and a defect-free cell is calculated to give a distribution function which quantifies to what extent the defect phonon modes are bulk-like or defect-like.

I'm happy to write the code which will calculate and plot the distribution function, and can submit this as a PR, if you think it would be useful to have in JuliaPhonons?

jarvist commented 6 years ago

Yeah, defo - sounds cool! I haven't read the paper.

A minimum working example of calculated overlaps between two sets of eigenvectors should be trivial:-

evecA,eigsA=read_meshyaml(open("meshA.yaml"),P)
evecB,eigsB=read_meshyaml(open("meshB.yaml"),P)

[ dot(evecA[a],evecB[b]) for a in 1:3N, b in 1:3N ] 

For the case of identical phonons (i.e. same mesh.yaml) you should get the identity matrix. Doing it in this 2D way catches the re-ordering of the eigenvectors (they come out ordered by the eigenvalues).

You might then want to think about collapsing down the info from 3Nx3N to just N, by taking the trace of the x,y,z components, or perhaps the L2 norm.

The scientific gotcha is that you have to do this with an identical basis. (For the phonons the basis is the atomic locations.) So it's fine if you're doing substitional defects, from the prior work here it appears Phonopy just sensibly constructs a basis in the order it is specified in the POSCAR. If you are planning to do interstitions / vacancies, you need to do some work to make it the same (atomic) basis. Somewhere along the line you need to inject a dummy atom; in Gaussian (a vacuum electronic structure code) these are simply called 'ghost atoms'. I'm not sure whether there is an equivalent in VASP, there probably is. Or you could inject an extra fictitious FORCE-SET or similar.

Generally the Julia-Phonons code is pretty terrible! It was just hacked together on the fly as I understood the form of the eigenvectors returned from Phonopy; and then hacked some more to get some specific observables out for specific projects, but never really cleanly refactored! It may do stupid stuff like set global variables; it can read multiple mesh.yaml files, but I've never really computed on two things at once!