henriquemiranda / phononwebsite

Visualise lattice vibrations
http://henriquemiranda.github.io/phononwebsite/
BSD 3-Clause "New" or "Revised" License
83 stars 32 forks source link

Bonding selection #5

Open JohnKendrick opened 7 years ago

JohnKendrick commented 7 years ago

Thanks for addressing the unit cell display so quickly. I have been using your website/code to look at some phonon modes at the gamma point for molecular systems and came across things could perhaps be improved. I attach two yaml files to illustrate what I was trying to do.

band.yaml has the gamma point modes for cysteine. In typical VASP fashion the POSCAR file has atoms in it which break up the molecular bonding in the unit cell. There should be just four molecules in the unit cell.

I generated a cif file from the POSCAR I used and read it into mercury which I used to give 4 molecular structures. Saving this as a cif file I was then able to change the band.yaml file to band_mercury.yaml which now has 4 whole molecule in it. As long as the atom numbering stays the same as in the original then the displacements are still correct.

However, the current method you use for identifying bonds does not identify all of the bonds in this system. I modified vibcrystal.js slightly to accommodate a slightly more flexible bonding algorithm.

 // scale_factor added by JK 
        scale_factor = 1.3
        for (i=0;i<combinations.length;i++) {
            a = combinations[i][0];
            b = combinations[i][1];
            ad = a.position;
            bd = b.position;

            //if the separation is smaller than the sum of the bonding radius create a bond
            length = ad.distanceTo(bd)
            if (length < scale_factor*(covalent_radii[a.atom_number]+covalent_radii[b.atom_number]) || length < this.nndist + 0.2 ) {
                this.bonds.push( [ad,bd,length] );
 // scale_factor added by JK 
        scale_factor = 1.3
        for (i=0;i<combinations.length;i++) {
            a = combinations[i][0];
            b = combinations[i][1];
            ad = a.position;
            bd = b.position;

            //if the separation is smaller than the sum of the bonding radius create a bond
            length = ad.distanceTo(bd)
            if (length < scale_factor*(covalent_radii[a.atom_number]+covalent_radii[b.atom_number]) || length < this.nndist + 0.2 ) {
                this.bonds.push( [ad,bd,length] );

The factor of 1.3 might be a bit large, but it had the correct behaviour for the case I was looking at.

I realise that you probably envisioned looking at phonons for materials with smaller unit cells. But It seemed to me that there are two changes that would benefit the package for molecular systems. 1) A covalent radius scaling factor to capture bonds that aren't being identified using the standard covalent radii. 2) An algorithm for identifying whole molecules. This would require more effort and I'm not sure of the best algorithm. As you can see I have a work around at the moment, but it is a bit error prone.

I hope you don't mind these comments. My interest stems from some work I am doing on Infrared and THz absorption in molecular systems. Please have a look at https://github.com/JohnKendrick/PDielec

cysteine.zip

JohnKendrick commented 7 years ago

Sorry I uploaded the wrong files..... cysteine.zip

henriquemiranda commented 1 year ago

Have a look at the current version of the website after #21 Now you can choose the covalent radii of each species that is used to draw the bonds. The strategy is a bit different from what you suggest but it should fix your problem as well.