예제 #1
0
    def findCellMatches(self, a, b, c, alpha, beta, gamma):
        """
        TODO: docs
        :param a:
        :param b:
        :param c:
        :param alpha:
        :param beta:
        :param gamma:
        :return:
        """
        #Validate input
        arguments = locals()
        logger.info('The following arguments were passed: ' +
                    ', '.join(k
                              for k, v in arguments.items() if v is not None))

        cellAngles = crystal.CellAngles(alpha, beta, gamma)
        logger.info("Created cell angles" + str(cellAngles))

        cellLengths = crystal.CellLengths(a, b, c)
        logger.info("Created cell lengths" + str(cellLengths))

        #Tmp kept as Primitive
        centring = ChemistryLib.Spacegroup_centring_text().text(1)
        logger.info("Set to centering" + str(centring))

        self.searchHits = self._unitCellQuery(cellAngles=cellAngles,
                                              cellLengths=cellLengths,
                                              centring=centring)
        logger.info("Success in running request for find cell matches")
        displayHits(self.searchHits)

        return True
예제 #2
0
def gatherSpaceGroups():
    """
    The order of these responds to the order desired.
    Someone like a enum when pass in the optitions.
    This could for example be dynamically loaded into a combo box and selected from that.
    :return: ordered enum of spaceGroups with corresponding text
    """
    spaceGroupsOps = ChemistryLib.Spacegroup_centring_text()
    #Split of text
    return spaceGroupsOps
예제 #3
0
    def __init__(self):
        #Hit results from search
        self.searchHits = []

        #Config for search
        self.overallQuery = None
        self.searchCrystal = crystal.Crystal

        self.entryReader = io.EntryReader('CSD')
                    #TODO: tmp just set default centring
        self.searchCrystal.lattice_centring =  ChemistryLib.Spacegroup_centring_text().text(1)


        #Lattice Params
        self.cellAngles = None #crystal.CellAngles()
        self.cellLengths = None #     crystal.CellLengths()
        self.angTol = None
        self.lengthTol = None

        #Filtering After Search
        self.refcode = None
        self.ccdcNumber = None
        self.atomicElements = []

        """
        Functional Assignment
        """
        self._unitCellQuery = unitCellQuery

        self._searchCellVals = searchCellVals

        #self.cifQueryPath = cellLib.extractCrystalCif

        self._strDetails = query

        """
        Filtering that can be performed on the hits
        """
        self.filterOnSpacegroup = None
예제 #4
0
def playgroundQuery():

    query('ABEBUF')

    #Just wanted a diagram genereted
    #generateDiagram("ARAVIZ", "/tmp/")


    pathSaved = reportGenerator("/tmp/","ARAVIZ")
    print("Generated diagram for ARAVIZ :"+ pathSaved)
    
    
    saveRefcodeCif("/tmp/","ARAVIZ")
    
    cry = extractCrystalCif("/scratch/CCDC_playground/CCDCPlay/referenceCode/testsCCDC/testdata/CACDOA01");

    isActive = True

    #XXX: cant create own crystal so will just be settign the first entry...
    firstEntry = entryReader[0]
    meCrystal = firstEntry.crystal
    #searchCrystal(meCrystal)
    logger.info(meCrystal.formula)

    #TMP JUST NEED SAMPLE DATA
    a = 5.4311946
    b = 5.4311946
    c = 5.4311946
    alp = 90
    beta = 90
    gamma = 90
#     11.1991
#     11.8541
#     14.0985
#     93.606
#     113.098
#     103.500
    
    
    logger.info("Seraching Unit Cell")
    logger.info("Lenths: " + str(a) + "," + str(b) + ","  + str(c))
    logger.info("Angles: " + str(alp) + ","  +str(beta) + ","  + str(gamma))
    #logger.info("Lattice Centering: " + ChemistryLib.Spacegroup_centring_text().text(1))

    #Example search
    centring = ChemistryLib.Spacegroup_centring_text().text(1) #Primitive
    cellAngles = crystal.CellAngles(alp,beta,gamma)
    cellLengths = crystal.CellLengths(a,b,c)


    displayHits(searchCellVals(a,b,c))



    attemptCry = crystal.Crystal
    attemptCry.lattice_centring =  ChemistryLib.Spacegroup_centring_text().text(1)
    attemptCry.cell_angles = cellAngles
    attemptCry.cell_lengths = cellLengths
    logger.info(attemptCry.cell_angles)
    hits = searchCrystal(attemptCry)

    displayHits(hits)

    logger.info("\n\nRestraining crystal on formula");
    logger.info(attemptCry.molecule)
    #
    mol = molecule.Molecule
    mol.formula = "C1 H6 Cl1 N3 O4"
    attemptCry.molecule = mol

    hits = searchCrystal(attemptCry)
    displayHits(hits)
    #
    # logger.info("\n\nRestraining crystal on spacegroup");
    # attemptCry.crystal_system = "cubic"


    hits = searchCrystal(attemptCry)
    displayHits(hits)

    logger.info("\n\nTurning tolerance off hack");

    absAngleTol = 180
    perLenTol = 100

    hits = searchCrystalTols(attemptCry,absAngleTol,perLenTol)
    displayCrystal(hits[-1].crystal)