On Mon, Feb 20, 2017 at 01:27:22PM -0800, Iuri Segtovich wrote:
...
> 1) in my case, the resulting box has a carbon atom coordinated by 12
> hydrogen atoms (see badMETHANE.png) where there should be a methane
> molecule - i believe this means the code placed hydrogen atoms in every
> position where there might be a hydrogen atom, neglecting fractional
> occupancy,
Hi Yuri, Indeed. In an expanded unit cell the C1 site is coordinated
with 12 symmetry-equivalent H7 sites with an occupancy of 1/3 each -
producing a total stoichiometry "C1" 1 "H7" 4. The hydrogen occupancy
is lost when writing the xyz format, as xyz to my knowledge has no
support for occupancy information. To restore the correct
stoichiometry you'd need to come up with some rule to pick 4 out of 12
hydrogen neighbors at each C1 site and remove the excess sites. This
seems somewhat tricky because the 12 hydrogens are roughly at
icosahedral sites and do not form tetrahedron.
Here is a snippet to identify the 12-atom hydrogen neighborhood and
the H7-C1-H7 angles, however to design some selection rule is
up to you. :)
# --------------------------------------------------------------------
import numpy as np
from diffpy.srreal.bondcalculator import BondCalculator
from diffpy.Structure import loadStructure, Lattice
cs = loadStructure('CS1.cif')
c1sites = np.flatnonzero(cs.label.startswith('C1'))
# c1sites = array([230, 231])
ic1 = c1sites[0] # here ic1 = 230
bc = BondCalculator(rmax=1.3)
bc.setPairMask(ic1, 'all', True, others=False)
bc(cs)
# bonds are calculated in both directions.
# get indices of bonds that start at the explored C1 site
bidx = np.flatnonzero(bc.sites0 == ic1)
# Cartesian directions of the (C1-H7) vectors
chvec = bc.directions[bidx]
# get angles between the first C1-H7 vector an all others:
lat = Lattice()
print lat.angle(chvec[0], chvec)
# --------------------------------------------------------------------
> 2) I want to run simulations using a software that will apply "periodic
> boundary conditions", therefore I also need to make a box that has no
> atoms in a given boundary wall that would overlap with other boundary wall.
> (see good2d.png vs bad2d.png)
That is already done with the supercell function. All atoms should
have fractional coordinates in the [0, 1) semi-open interval in the
final-box structure. You can also verify if composition is correct
by checking `outstru.composition`; it would be noticeably off if
the boundary atoms were repeated.
> 3) I don't yet understand the logic behind a cif to xyz conversion under
> some space group and I would really like directions to some book for some
> theoretical reference.
diffpy.Structure expands the asymmetric unit in the CIF file to
a full unit cell with all the core and symmetry-related sites;
in other words it converts it to a P1 symmetry. The xyz output
then writes out the sites in Cartesian coordinates. Of
course, a plenty of fields (occupancies, ADPs, cell parameters,
space group) from the CIF file gets lost as there is no equivalent
for them in xyz format. Perhaps someone else in this group
might be aware of a book that deals with xyz format.
Hope this helps,
Pavol
--
Dr. Pavol Juhas
Computational Science Initiative
Brookhaven National Laboratory
P.O. Box 5000
Upton, NY 11973-5000