Top page

tklib.tkcrystal.tkCrystal

機能: 

使用例:

from tkcrystal.tkcif import tkCIF
from tkcrystal.tkcrystal import tkCrystal


infile = 'NaCl.cif'

cif = tkCIF()
cifdata = cif.ReadCIF(infile)
cif.Close()

cifdata.Print()

cry = cifdata.GetCrystal()
cry.PrintInf()

outfile = 'a.cif'
cifdata.WriteSimpleCIFFile(outfile)

outfile = 'b.cif'
cifdata.CreateCIFFileFromCCrystal(cry, outfile)
cout.Close()

よく使う関数:

print("CrystalName = ", cry.CrystalName(Create = 1))
print("SampleName = ", cry.SampleName(Create = 1))
print("Symmetry:")
ls = cry.LatticeSystem()
print("Lattice system: ", ls)
la = cry.LatticeAxis()
print("Lattice axis: ", la)
SPGName, iSPG, iSet = cry.GetSpaceGroupInf()

print("")
print("Space group: [{}] #{} set {}".format(SPGName, iSPG, iSet))
for i in range(self.nSymmetryOperation()):
  sym = self.SymmetryOperation(i)
  print(" {}: {}".format(i,sym))

print("")
print("Real space:")
a, b, c, alpha, beta, gamma = cry.LatticeParameters()
print("cell: {:12.8f} {:12.8f} {:12.8f} A {:10.6f} {:10.6f} {:10.6f}".format(a, b, c, alpha, beta, gamma))
gij, Rgij = cry.Metrics()
print("Metrics gij:", gij)
aij = cry.LatticeVectors()
print("Lattice vectors aij:", aij)
V = cry.Volume()
print("Volume: {} A^3".format(V))

print("")
print("Reciprocal space:")
ra, rb, rc, ralpha, rbeta, rgamm = cry.ReciprocalLatticeParameters()
print("cell: {:12.6f} {:12.6f} {:12.6f} A^-1 {} {} {}".format(ra, rb, rc, ralpha, rbeta, rgamm))
print("Metrics Rgij (A):", Rgij)
Raij = cry.ReciprocalLatticeVectors()
print("Lattice vectors Raij (A^-1):", Raij)
RV = cry.ReciprocalVolume()
print("Volume: {} A^-3".format(RV))

print("")
print("Properties:")
cc = cry.ChemicalComposition()
sumcc = cry.SumChemicalComposition()
fu = cry.FormulaUnit()
MW = round(cry.UnitcellWeight(), 6)
d = cry.Density()
ad = cry.AtomDensity()
print(" Chemical composition: ", cc)
print(" Sum chemical composition: ", sumcc)
print(" Formula unit: ", fu)
print(" Unit cell weight: ", MW)
print(" Density: ", d, "g/cm3")
print(" Atom density: {:12.6e} /cm3".format(ad))

print("")
print("Atom types:")
AtomTypes = self.AtomTypeList()
for t in AtomTypes:
  typea = t.AtomType()
  typeo = t.AtomTypeOnly()
  charge = t.Charge()
  AN = t.AtomicNumber()
  M = t.AtomicMass()
  print(" %4s (%2s) charge=%8.4f [Z=%3d M=%6.4f]" % (typea, typeo, charge, AN, M))

print("")
print("Asymmetric atom sites:")
AtomSites = self.AtomSiteList()
for atom in AtomSites:
  label = atom.Label()
  atomname = atom.AtomName()
  atomname0 = atom.AtomNameOnly()
  charge = atom.Charge()
  pos = atom.Position()
  occ = atom.Occupancy()
  id = atom.IdAsymmetricAtomSite() 
  m = atom.Multiplicity()
  print(" %3d: %5s: %4s charge=%6.3f (%6.3f, %6.3f, %6.3f) occ=%8.4f m=%d" % (id, label, atomname, charge, pos[0], pos[1], pos[2], occ, m))

print("")
print("Expanded atom sites:")
AtomSites = self.ExpandedAtomSiteList()
for atom in AtomSites:
  label = atom.Label()
  atomname = atom.AtomName()
  atomname0 = atom.AtomNameOnly()
  charge = atom.Charge()
  pos = atom.Position()
  occ = atom.Occupancy()
  id = atom.IdAsymmetricAtomSite()
  m = atom.Multiplicity()
  print(" %3d: %5s: %4s charge=%6.3f (%6.3f, %6.3f, %6.3f) occ=%8.4f m=%d"  % (id, label, atomname, charge, pos[0], pos[1], pos[2], occ, m))