Hello. I am relatively new to pymatgen. I am trying to compare two atoms belonging to two different verisons of the same structure. The coordinates of these sites are as follows:
atom1 -> PeriodicSite: Co (17.8204, 24.9218, 54.8488) [2.9850, 3.5300, 7.4060]
atom2 -> PeriodicSite: Co (17.8204, 24.9218, 0.0000) [2.9850, 3.5300, 0.0000]
and my lattice parameters are:
abc: 5.97 7.06 7.406
I extract the site information regarding these atoms from corresponding structures like this:
atom1_fc = str_1.sites[4].frac_coords
atom2_fc = str_2.sites[1].frac_coords
I calculate the pbc_dist between these atoms:
pbc_diff(atom1_fc, atom2_fc)
and this gives:
array([0. , 0. , 0.406001])
I don’t understand why this function does not give an array of zeros. As you see the fractional coords of atom_1 indicate that the c coordinate is the lattice length in that direction. I would expect the pbc_diff of these atoms to be 0, meaning that they are located at the same point on the lattice. I visualise these atoms with VMD and indeed that’s the case.
I checked the source code of this function and it seems this function does not take the lattice params as input, therefore it really shouldn’t be able to give me an array of all zeros…
I would like to understand how this function works because it is used in is_periodic_image, which therefore gives me False…
So my question is:
how does pbc_diff() work? maybe it is different than what I am expecting it to be.