コード例 #1
0
    def __init__(self):

        DATAPATH = os.path.abspath("/home/pycrysfml/hklgen/examples/sxtal")
        observedFile = os.path.join(DATAPATH, r"prnio.int")
        infoFile = os.path.join(DATAPATH, r"prnio.cfl")

        #Read data
        self.spaceGroup, self.crystalCell, self.atomList = H.readInfo(infoFile)

        #Return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
        wavelength, refList, sfs2, error = S.readIntFile(observedFile,
                                                         kind="int",
                                                         cell=self.crystalCell)
        self.wavelength = wavelength
        self.refList = refList
        self.sfs2 = sfs2
        self.error = error
        self.tt = [
            H.twoTheta(H.calcS(self.crystalCell, ref.hkl), wavelength)
            for ref in refList
        ]
        self.backg = None
        self.exclusions = []

        self.observation_space = spaces.MultiBinary(len(self.refList))
        self.action_space = spaces.Discrete(len(self.refList))

        self.episodeNum = 0
        self.reset()
コード例 #2
0
 def test_pcr_reader(self):
     """Test of CrysFML PCR reader"""
     DATAPATH = os.path.dirname(os.path.abspath(__file__))
     pcr = os.path.join(DATAPATH, r"pbso4.pcr")
     spaceGroup, cell, atomList = readInfo(pcr)
     self.assertEqual(np.allclose(np.array([8.478, 5.3967, 6.958]),
                                  np.array(cell.length()),
                                  rtol=0.0001),
                      True,
                      msg="Crystal Cell populated incorrectly (a, b, c)")
     self.assertEqual(
         np.allclose(np.array([90.0, 90.0, 90.0]), np.array(cell.angle())),
         True,
         msg="Crystal Cell populated incorrectly (alpha, beta, gamma)")
     self.assertEqual(spaceGroup.xtalSystem.lower(),
                      "orthorhombic",
                      msg="SpaceGroup error: xtalSystem")
     self.assertEqual(spaceGroup.number, 62, msg="SpaceGroup error: number")
     self.assertEqual(len(atomList),
                      5,
                      msg="AtomList length = " + str(len(atomList)) +
                      " Should be 5")
     atom = atomList[0]
     self.assertEqual(atom.label().lower(),
                      "pb",
                      msg="Wrong atom in atomList")
     self.assertEqual(np.allclose(np.array([0.188, 0.25, 0.167]),
                                  np.array(atom.coords()),
                                  rtol=0.01),
                      True,
                      msg="Atom coordinates wrong")
     self.assertEqual(atom.occupancy(), 0.5, msg="Atom Occupancy wrong")
コード例 #3
0
ファイル: views.py プロジェクト: scattering/BLAND-UI
def upload(request):
    fp = request.FILES['file']
    handle_uploaded_file(fp)
    spaceGroup, cell, atomList = H.readInfo(os.path.join('/tmp/bland',str(fp.name)))
    request.session['sg'] = pyc.getSpaceGroup_spg_symb(spaceGroup)
    ret = [spaceGroup.number, list(cell.length()), list(cell.angle())]
    for atom in atomList:
	for el in periodictable.elements:
	    if(el.symbol == pyc.getAtom_chemsymb(atom)):
		ell = el.number
	ret.append([pyc.getAtom_lab(atom), pyc.getAtom_chemsymb(atom), atom.coords(), atom.occupancy(), atom.BIso(), ell])
    ret = json.dumps(ret)
    return HttpResponse(ret)
コード例 #4
0
 def test_cif_reader(self):
     """ Test of CrysFML cif reader"""
     DATAPATH = os.path.dirname(os.path.abspath(__file__))
     cif = os.path.join(DATAPATH,r"al2o3.cif")
     spaceGroup, cell, atomList = readInfo(cif)
     self.assertEqual(np.allclose(np.array([4.7698, 4.769, 13.024]), np.array(cell.length()), rtol=0.001), True,
                      msg="Crystal Cell populated incorrectly (a, b, c)")
     self.assertEqual(np.allclose(np.array([90.0, 90.0, 120.0]), np.array(cell.angle())), True,
                      msg="Crystal Cell populated incorrectly (alpha, beta, gamma)")
     self.assertEqual(spaceGroup.xtalSystem.lower(), "trigonal", msg="SpaceGroup error: xtalSystem")
     self.assertEqual(spaceGroup.number, 167, msg="SpaceGroup error: number")
     self.assertEqual(len(atomList), 2, msg="AtomList length = "+str(len(atomList))+" Should be 2")
     atom = atomList[0]
     self.assertEqual(atom.label().lower(), "al1", msg="Wrong atom in atomList")
     self.assertEqual(np.allclose(np.array([0.0, 0.00, 0.352]), np.array(atom.coords()), rtol=0.01), True,
                      msg="Atom coordinates wrong")
     self.assertAlmostEqual(atom.occupancy(), 0.3333333, msg="Atom Occupancy wrong")        
コード例 #5
0
 def test_pcr_reader(self):
     """Test of CrysFML PCR reader"""
     DATAPATH = os.path.dirname(os.path.abspath(__file__))
     pcr = os.path.join(DATAPATH,r"pbso4.pcr")
     spaceGroup, cell, atomList = readInfo(pcr)
     self.assertEqual(np.allclose(np.array([8.478, 5.3967, 6.958]), np.array(cell.length()), rtol=0.0001), True,
                      msg="Crystal Cell populated incorrectly (a, b, c)")
     self.assertEqual(np.allclose(np.array([90.0, 90.0, 90.0]), np.array(cell.angle())), True,
                      msg="Crystal Cell populated incorrectly (alpha, beta, gamma)")
     self.assertEqual(spaceGroup.xtalSystem.lower(), "orthorhombic", msg="SpaceGroup error: xtalSystem")
     self.assertEqual(spaceGroup.number, 62, msg="SpaceGroup error: number")
     self.assertEqual(len(atomList), 5, msg="AtomList length = "+str(len(atomList))+" Should be 5")
     atom = atomList[0]
     self.assertEqual(atom.label().lower(), "pb", msg="Wrong atom in atomList")
     self.assertEqual(np.allclose(np.array([0.188, 0.25, 0.167]), np.array(atom.coords()), rtol=0.01), True,
                      msg="Atom coordinates wrong")
     self.assertEqual(atom.occupancy(), 0.5, msg="Atom Occupancy wrong")
コード例 #6
0
def main():
    
    wavelength = 1.5403
    cell = H.CrystalCell([11.372,10.272,7.359],[108.92,71.07,96.16]) # AABHTZ cell parameters
    uvw = [0.151066141044763,-0.0914698313404034,0.0693509296318546] ## this is for a uvw transformation
    
    
    #H.diffPattern(infoFile=infoFile, wavelength=wavelength,
    #              cell=cell, uvw=uvw, scale=1.40313478468024,
    #              info=True,plot=True)
    # this created the diffraction pattern but relies of the type of atoms
    
    sMin, sMax = getS(0.0, wavelength), getS(180.0, wavelength)
    spaceGroup = None
    infofile = H.readInfo(infoFile)
    if (spaceGroup == None): spaceGroup = infofile[0]
    if (cell == None): cell = infofile[1]
    refList = H.hklGen(spaceGroup, cell, sMin, sMax, True, xtal=False) # generates list of hkl [1,1,1]
    for value in refList:
        print value.hkl
コード例 #7
0
ファイル: views.py プロジェクト: scattering/BLAND-UI
def upload(request):
    fp = request.FILES['file']
    handle_uploaded_file(fp)
    spaceGroup, cell, atomList = H.readInfo(
        os.path.join('/tmp/bland', str(fp.name)))
    request.session['sg'] = pyc.getSpaceGroup_spg_symb(spaceGroup)
    ret = [spaceGroup.number, list(cell.length()), list(cell.angle())]
    for atom in atomList:
        for el in periodictable.elements:
            if (el.symbol == pyc.getAtom_chemsymb(atom)):
                ell = el.number
        ret.append([
            pyc.getAtom_lab(atom),
            pyc.getAtom_chemsymb(atom),
            atom.coords(),
            atom.occupancy(),
            atom.BIso(), ell
        ])
    ret = json.dumps(ret)
    return HttpResponse(ret)
コード例 #8
0
    def __init__(self, observedFile, infoFile, backgFile=None, sxtal=True):

        #Read data
        self.spaceGroup, self.crystalCell, self.atomList = H.readInfo(infoFile)

        # return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
        wavelength, refList, sfs2, error = S.readIntFile(observedFile,
                                                         kind="int",
                                                         cell=self.crystalCell)
        self.wavelength = wavelength
        self.refList = refList
        self.sfs2 = sfs2
        self.error = error
        self.tt = [
            H.twoTheta(H.calcS(self.crystalCell, ref.hkl), wavelength)
            for ref in refList
        ]
        self.backg = None
        self.exclusions = []

        self.reset()
コード例 #9
0
 def test_cif_reader(self):
     """ Test of CrysFML cif reader"""
     DATAPATH = os.path.dirname(os.path.abspath(__file__))
     cif = os.path.join(DATAPATH, r"al2o3.cif")
     spaceGroup, cell, atomList = readInfo(cif)
     self.assertEqual(np.allclose(np.array([4.7698, 4.769, 13.024]),
                                  np.array(cell.length()),
                                  rtol=0.001),
                      True,
                      msg="Crystal Cell populated incorrectly (a, b, c)")
     self.assertEqual(
         np.allclose(np.array([90.0, 90.0, 120.0]), np.array(cell.angle())),
         True,
         msg="Crystal Cell populated incorrectly (alpha, beta, gamma)")
     self.assertEqual(spaceGroup.xtalSystem.lower(),
                      "trigonal",
                      msg="SpaceGroup error: xtalSystem")
     self.assertEqual(spaceGroup.number,
                      167,
                      msg="SpaceGroup error: number")
     self.assertEqual(len(atomList),
                      2,
                      msg="AtomList length = " + str(len(atomList)) +
                      " Should be 2")
     atom = atomList[0]
     self.assertEqual(atom.label().lower(),
                      "al1",
                      msg="Wrong atom in atomList")
     self.assertEqual(np.allclose(np.array([0.0, 0.00, 0.352]),
                                  np.array(atom.coords()),
                                  rtol=0.01),
                      True,
                      msg="Atom coordinates wrong")
     self.assertAlmostEqual(atom.occupancy(),
                            0.3333333,
                            msg="Atom Occupancy wrong")
コード例 #10
0
ファイル: CeO2.py プロジェクト: KasparSnashall/pycrysfml
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import fswig_hklgen as H
import hkl_model as Mod
np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = os.path.join(DATAPATH, "ce1.bac")
observedFile = os.path.join(DATAPATH, "ceo2.dat")
infoFile = os.path.join(DATAPATH, "ce1.pcr")

(spaceGroup, crystalCell, atoms) = H.readInfo(infoFile)
wavelength = 1.540560  #+1.544330
backg = H.LinSpline(None)
ttMin = 25.0
ttMax = 143.0
ttStep = 0.0249947045118
exclusions = None
tt, observed, error = H.readIllData(observedFile, "", backgFile)


def fit():
    # PYTHONPATH=. bumps Al2O3.py --fit=dream --store=M1 --burn=100 --steps=500
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem())
    cell.a.pm(0.5)
    m = Mod.Model(tt,
                  observed,
                  backg,
                  0,
                  0,
コード例 #11
0
ファイル: LuFeO3.py プロジェクト: KasparSnashall/pycrysfml
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import os
from copy import copy
import numpy as np
import fswig_hklgen as H
import hkl_model as Mod

np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = None
observedFile = os.path.join(DATAPATH, r"Mn025_4K.dat")
infoFile = os.path.join(DATAPATH, r"LFO.cfl")
(spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile)
atomList = H.readInfo(infoFile)[2]
wavelength = 1.540000
ttMin = 3.0
ttMax = 167.750
ttStep = 0.05
exclusions = [[0.00, 5.00], [38.25, 39.00], [44.00, 45.50], [64.75, 65.75],
              [77.5, 79.00], [81.75, 83.10], [97.00, 100.00], [111.50, 113.00],
              [116.00, 118.00], [135.50, 139.50], [161.00, 169.00]]
tt, observed = H.readData(observedFile,
                          kind="y",
                          skiplines=3,
                          start=ttMin,
                          stop=ttMax,
                          step=ttStep,
                          exclusions=exclusions,
                          colstep=2)
コード例 #12
0
ファイル: Al2O3.py プロジェクト: jlesniewski/pycrysfml
import os,sys;sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import fswig_hklgen as H
import hkl_model as Mod
np.seterr(divide="ignore", invalid="ignore")    

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = os.path.join(DATAPATH,"Al2O3 Background.BGR")
observedFile = os.path.join(DATAPATH,"Al2O3.dat")
infoFile = os.path.join(DATAPATH,"Al2O3.cif")

(spaceGroup, crystalCell, atoms) = H.readInfo(infoFile)
wavelength = 1.5403
backg = H.LinSpline(backgFile)
ttMin = 3
ttMax = 167.75
ttStep = 0.05
exclusions = None
tt, observed = H.readData(observedFile, kind="y", skiplines=1, start=ttMin,
                          stop=ttMax, step=ttStep)
def fit():
    # PYTHONPATH=. bumps Al2O3.py --fit=dream --store=M1 --burn=100 --steps=500
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem())
    cell.a.pm(0.5)
    cell.c.pm(0.5)
    m = Mod.Model(tt, observed, backg, 0, 0, 1, wavelength, spaceGroup, cell,
                atoms, exclusions)
    m.u.range(0,2)
    m.v.range(-2,0)
    m.w.range(0,2)
    m.eta.range(0,1)
コード例 #13
0
ファイル: prnio.py プロジェクト: scattering/pycrysfml
from copy import copy
import numpy as np
import fswig_hklgen as H
import hkl_model as Mod
import sxtal_model as S
#import bumps.parameter
#def dont(self, *args, **kw): raise Exception("don't")
#bumps.parameter.OperatorAdd.__init__ = dont

np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = None#os.path.join(DATAPATH,r"hobk_bas.bac")
observedFile = os.path.join(DATAPATH,r"prnio.int")
infoFile = os.path.join(DATAPATH,r"prnio.cfl")
spaceGroup, crystalCell, atomList = H.readInfo(infoFile)
exclusions = []
# return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=crystalCell)
tt = [H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in refList]
backg = None

def fit():
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem)
    #cell.a.pm(5.0)
    #cell.c.pm(5.0)
    m = S.Model(tt, sfs2, backg, wavelength, spaceGroup, cell,
                [atomList], exclusions,
                 scale=0.06298, error=error, hkls=refList, extinction=[0.0001054])
    m.scale.range(0,100)
    #m.base.pm(1000)
コード例 #14
0
ファイル: epGreedy.py プロジェクト: scattering/crystal-eg
DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = None
observedFile = os.path.join(DATAPATH,r"../simulation.int")
infoFile = os.path.join(DATAPATH,r"../mote2.cfl")

inFile = open(observedFile, "r")
inFile.readline()
inFile.readline()
inFile.readline()
line = inFile.readline().split()
A = float(line[1])
B = float(line[2])
C = float(line[3])

#Read data
spaceGroup, crystalCell, atomList = H.readInfo(infoFile)
# return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=crystalCell)
tt = [H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in refList]
backg = None
exclusions = []

#Make a dictionary of the indices of each HKL value for the given crystal
d = {}
for i in range(len(refList)):
    d[str(refList[i].hkl).replace("[","").replace("]","").replace(",","")] = i


def setInitParams():
    #Make a cell
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem)
コード例 #15
0
from copy import copy

import numpy as np
import fswig_hklgen as H
import hkl_model as Mod

np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
print DATAPATH
backgFile = os.path.join(DATAPATH,r"background_ge.BGR")
observedFile = os.path.join(DATAPATH,r"lufmo001.gsas")
infoFile = os.path.join(DATAPATH,r"LuFeMnO3_BT1fit.cfl")

(spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile)
atomList = H.readInfo(infoFile)[2]

wavelength = 2.07750
ttMin = 3.0
ttMax = 166.3
ttStep = 0.05
exclusions = [[52,54],[60.5,62.5],[92.5,95],[115.0,117],[125.0,126]]
tt, observed = H.readData(observedFile, kind="y", skiplines=3,
                          start=ttMin, stop=ttMax, step=ttStep,
                          exclusions=exclusions, colstep=2)
backg = H.LinSpline(backgFile)

basisSymmetry = copy(symmetry)
#basisSymmetry = symmetry
if (basisSymmetry.centerType() == 2):
    # change to acentric
コード例 #16
0
ファイル: views.py プロジェクト: scattering/BLAND-UI
def diffPattern(infoFile=None, backgroundFile=None, wavelength=1.5403,
                ttMin=0, ttMax=180, ttStep=0.05, exclusions=None,
                spaceGroup=None, cell=None, atomList=None,
                symmetry=None, basisSymmetry=None, magAtomList=None,
                uvw=[0,0,1], scale=1,
                magnetic=False, info=False, plot=False, saveFile=None,
                observedData=(None,None), labels=None, base=0, residuals=False, error=None, muR=None):
    background = H.LinSpline(backgroundFile)
    sMin, sMax = H.getS(ttMin, wavelength), H.getS(ttMax, wavelength)
    if magnetic:
        if (infoFile != None):
            infofile = H.readMagInfo(infoFile)
            if (spaceGroup == None): spaceGroup = infofile[0]
            if (cell == None): cell = infofile[1]
            if (magAtomList == None): magAtomList = infofile[2]
            if (symmetry == None): symmetry = infofile[3]
        if (basisSymmetry == None): basisSymmetry = symmetry
        ## magnetic peaks
        # convert magnetic symmetry to space group
        latt = H.getMagsymmK_latt(basisSymmetry)
        if basisSymmetry.get_magsymm_k_mcentred() == 1: 
            latt+= " -1" 
        else:
            latt += " 1"
        spg = _SpaceGroup()
        FortFuncs().set_spacegroup(latt, spg)
        refList = H.hklGen(spaceGroup, cell, sMin, sMax, True, xtal=False)
        refList2 = H.hklGen(spg, cell, sMin, np.sin(179.5/2)/wavelength, True, xtal=True)
        magRefList = H.satelliteGen(cell, symmetry, sMax, hkls=refList2)#satelliteGen_python(cell, sMax, None)#
        print "length of reflection list " + str(len(magRefList))
        magIntensities = H.calcIntensity(magRefList, magAtomList, basisSymmetry,
                                       wavelength, cell, True, muR=muR)
        # add in structural peaks
        if (atomList == None): atomList = H.readInfo(infoFile)[2]
        #refList = hklGen(spaceGroup, cell, sMin, sMax, True, xtal=xtal)
        intensities = H.calcIntensity(refList, atomList, spaceGroup, wavelength, muR=muR)
        reflections = magRefList[:] + refList[:]
        intensities = np.append(magIntensities, intensities)
    else:
        if (infoFile != None):
            infofile = H.readInfo(infoFile)
            if (spaceGroup == None): spaceGroup = infofile[0]
            if (cell == None): cell = infofile[1]
            if (atomList == None): atomList = infofile[2]     
        print "length of atom list is", len(atomList)
        print(spaceGroup.number)
        refList = H.hklGen(spaceGroup, cell, sMin, sMax, True, xtal=False)
        reflections = refList[:]
        intensities = H.calcIntensity(refList, atomList, spaceGroup, wavelength, muR=muR)
    peaks = H.makePeaks(reflections, uvw, intensities, scale, wavelength, base=base)
    numPoints = int(floor((ttMax-ttMin)/ttStep)) + 1
    tt = np.linspace(ttMin, ttMax, numPoints)
    intensity = H.getIntensity(peaks, background, tt, base=base)

    if info:
        if magnetic:
            H.printInfo(cell, spaceGroup, (atomList, magAtomList), (refList, magRefList),
                      wavelength, basisSymmetry, muR=muR)
        else:
            H.printInfo(cell, spaceGroup, atomList, refList, wavelength, muR=muR)
    if plot:
        H.plotPattern(peaks, background, observedData[0], observedData[1],
                    ttMin, ttMax, ttStep, exclusions, labels=labels, base=base, residuals=residuals, error=error)
        H.pylab.show()
        H.pylab.savefig(os.path.join('/tmp/bland',str('plot.jpg')), dpi=2000)
    if saveFile:
        np.savetxt(saveFile, (tt, intensity), delimiter=" ")
    tt1 = ["%.3f" % H.twoTheta(ref.s, wavelength) for ref in refList]   
    for atom in atomList:
            print atom.label(), "element:", atom.element(), "iso:", atom.BIso(), "multip:", atom.multip(), "coords:", atom.coords(), "occupancy:", atom.occupancy()    
    h, k, l = tuple([str(ref.hkl[i]) for ref in refList] for i in xrange(3))
    return (tt1, tt, intensities, [h,k,l], peaks, background)
コード例 #17
0
ファイル: views.py プロジェクト: scattering/BLAND-UI
def diffPattern(infoFile=None,
                backgroundFile=None,
                wavelength=1.5403,
                ttMin=0,
                ttMax=180,
                ttStep=0.05,
                exclusions=None,
                spaceGroup=None,
                cell=None,
                atomList=None,
                symmetry=None,
                basisSymmetry=None,
                magAtomList=None,
                uvw=[0, 0, 1],
                scale=1,
                magnetic=False,
                info=False,
                plot=False,
                saveFile=None,
                observedData=(None, None),
                labels=None,
                base=0,
                residuals=False,
                error=None,
                muR=None):
    background = H.LinSpline(backgroundFile)
    sMin, sMax = H.getS(ttMin, wavelength), H.getS(ttMax, wavelength)
    if magnetic:
        if (infoFile != None):
            infofile = H.readMagInfo(infoFile)
            if (spaceGroup == None): spaceGroup = infofile[0]
            if (cell == None): cell = infofile[1]
            if (magAtomList == None): magAtomList = infofile[2]
            if (symmetry == None): symmetry = infofile[3]
        if (basisSymmetry == None): basisSymmetry = symmetry
        ## magnetic peaks
        # convert magnetic symmetry to space group
        latt = H.getMagsymmK_latt(basisSymmetry)
        if basisSymmetry.get_magsymm_k_mcentred() == 1:
            latt += " -1"
        else:
            latt += " 1"
        spg = _SpaceGroup()
        FortFuncs().set_spacegroup(latt, spg)
        refList = H.hklGen(spaceGroup, cell, sMin, sMax, True, xtal=False)
        refList2 = H.hklGen(spg,
                            cell,
                            sMin,
                            np.sin(179.5 / 2) / wavelength,
                            True,
                            xtal=True)
        magRefList = H.satelliteGen(
            cell, symmetry, sMax,
            hkls=refList2)  #satelliteGen_python(cell, sMax, None)#
        print "length of reflection list " + str(len(magRefList))
        magIntensities = H.calcIntensity(magRefList,
                                         magAtomList,
                                         basisSymmetry,
                                         wavelength,
                                         cell,
                                         True,
                                         muR=muR)
        # add in structural peaks
        if (atomList == None): atomList = H.readInfo(infoFile)[2]
        #refList = hklGen(spaceGroup, cell, sMin, sMax, True, xtal=xtal)
        intensities = H.calcIntensity(refList,
                                      atomList,
                                      spaceGroup,
                                      wavelength,
                                      muR=muR)
        reflections = magRefList[:] + refList[:]
        intensities = np.append(magIntensities, intensities)
    else:
        if (infoFile != None):
            infofile = H.readInfo(infoFile)
            if (spaceGroup == None): spaceGroup = infofile[0]
            if (cell == None): cell = infofile[1]
            if (atomList == None): atomList = infofile[2]
        print "length of atom list is", len(atomList)
        print(spaceGroup.number)
        refList = H.hklGen(spaceGroup, cell, sMin, sMax, True, xtal=False)
        reflections = refList[:]
        intensities = H.calcIntensity(refList,
                                      atomList,
                                      spaceGroup,
                                      wavelength,
                                      muR=muR)
    peaks = H.makePeaks(reflections,
                        uvw,
                        intensities,
                        scale,
                        wavelength,
                        base=base)
    numPoints = int(floor((ttMax - ttMin) / ttStep)) + 1
    tt = np.linspace(ttMin, ttMax, numPoints)
    intensity = H.getIntensity(peaks, background, tt, base=base)

    if info:
        if magnetic:
            H.printInfo(cell,
                        spaceGroup, (atomList, magAtomList),
                        (refList, magRefList),
                        wavelength,
                        basisSymmetry,
                        muR=muR)
        else:
            H.printInfo(cell,
                        spaceGroup,
                        atomList,
                        refList,
                        wavelength,
                        muR=muR)
    if plot:
        H.plotPattern(peaks,
                      background,
                      observedData[0],
                      observedData[1],
                      ttMin,
                      ttMax,
                      ttStep,
                      exclusions,
                      labels=labels,
                      base=base,
                      residuals=residuals,
                      error=error)
        H.pylab.show()
        H.pylab.savefig(os.path.join('/tmp/bland', str('plot.jpg')), dpi=2000)
    if saveFile:
        np.savetxt(saveFile, (tt, intensity), delimiter=" ")
    tt1 = ["%.3f" % H.twoTheta(ref.s, wavelength) for ref in refList]
    for atom in atomList:
        print atom.label(), "element:", atom.element(), "iso:", atom.BIso(
        ), "multip:", atom.multip(), "coords:", atom.coords(
        ), "occupancy:", atom.occupancy()
    h, k, l = tuple([str(ref.hkl[i]) for ref in refList] for i in xrange(3))
    return (tt1, tt, intensities, [h, k, l], peaks, background)