Ejemplo n.º 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
Ejemplo n.º 2
0
def searchCellAngles(alpha, beta, gamma):
    """
    @deprecated:
    :param alpha: float
    :param beta: float
    :param gamma: float
    :return: ccdc.search.SearchHit
    """
    cellAngles = crystal.CellAngles(alpha, beta, gamma)
    query = ReducedCellSearch.Query(angles=cellAngles)
    searcher = ReducedCellSearch(query)
    return retrieveHits(searcher)
Ejemplo n.º 3
0
    def setLatticeParameters(self, a, b, c, alpha, beta, gamma):
        """
        :param a:
        :param b:
        :param c:
        :param alpha:
        :param beta:
        :param gamma:
        :return:
        """
        self.cellAngles = crystal.CellAngles(alpha, beta, gamma)
        self.cellLengths = crystal.CellLengths(a, b, c)

        #Crystal set
        self.searchCrystal.cell_angles = self.cellAngles
        self.searchCrystal.cell_lengths = self.cellLengths

        logger.info("Set crystal: ")
        logger.info(self.searchCrystal.cell_angles)
        logger.info(self.searchCrystal.cell_lengths)

        return True
Ejemplo n.º 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)