Module libcif
[show private | hide private]
[frames | no frames]

Module libcif

Classes
XMLWriter  

Function Summary
  AbsStructEN(html, cif)
Adds some text to the English report about the absolute configuration of the molecule
  AsymetricCellContents(cif)
tries to find the contents of the asymetric cell
  AtomicCoord(html, table)
This function appends a table with label, y, y, z and U to the html file
tupple AtomPositions(cif)
Extract the atome name, position and U(eq) fropm the CIF.
dictionnary BondAngle(cif)
Returns a dictionnary with all the bond/valence angles between heavy atoms Datas have to be already in the CIF
dictionnary BondLength(cif)
Returns a dictionnary with all the bond lengths between heavy atoms.
  CellVol(cif)
calculate the cell volume and return it as a real (in ų)
  ChechForCSD(cif, name)
check in the CIF data if all the data needed to generate a RST report are present.
  ChechForRST(cif)
check in the CIF data if all the data needed to generate a RST report are present.
string CheckSym(cif, fix)
Checks the symetry of a CIF file based on the symmetry operations
  cif2str(cif)
converts a cif dictionnary to a string according to the CIF syntax
  Density(cif)
calculate the density in Mg/m³, for information : 10^30/Na/10^6=1.66054018667
string dot2virg(text)
Substitute the english dots with french virgules
  encode(s, encoding)
  encode_entity(text, pattern)
  escape_attrib(s, encoding, replace)
  escape_cdata(s, encoding, replace)
boolean exists(cif, key)
Check if the key exists in the CIF.
float floatp(txt)
Removes the () from the text and convert to a float
  formula2chem(txt)
return a HTML representatin of the chemical formula
  Html2table(html, BL, X, Y)
This function appends a table element to the html file with the X and Y headers
dictionnary LoadCIF(filename)
Load the CIF file and returns the dictionnary
  MainreportEN(html, cif)
This function generates the report in ENGLISH and add it to the HTML file
  MainreportFR(html, cif)
this function generates the report in FRENCH to the HTML file
dictionnary mergeplaton(cif, acc)
Merge cif and acc and returns a completed CIF-object.
dictionnary MergeSg(name, kcd, sg)
Merge 2 cif objects : add from sg the missing values in kcd
  MolForm(cif, zp)
count the atoms and returns the molecular formula.
  MolWeight(formula)
calculate the molecular weight of a compound using its formula
tupple oneloop(fields, start)
Processes one loop in the data extraction of the CIF file
dictionnary parsecif(text)
-Parses the text of a CIF file
dictionnary platon(filename)
process the data throught PLATON
string readcif(filename)
-Check if the filename exists
  renamefile(infile, namelist)
The CSD database has only room for 8 char to define the reference of the molecule.
  SaveCIF(cif, filename)
transforms the CIF object in string and write it into the given file
list splitcif(text)
Separate the text in fields as defined in the CIF
string stringmulti(text, value)
Convert a string to a real, multiplies by the value and returns a string
  structureImage(basename, structure)
lauch PLATON and let the user chose the structural (or the ortep or powder) representation of the molecule
string symop(cif)
Lists all the symetricaly equivalent positions @param cif: CIF object of the Xtal structure
  WriteReport(filename, cif, Lang)
This function writes out an X-Ray structure report as an HTML file in the given language with the data taken from the CIF dictionnary
  XraySummary(html, cif)
This function appends a table summarizing the Xray analysis, usually in Annexe as table 1
  Zprime(cif)
Calculate Z' = Z/nop if the latice is primitive zp=2*Z/nop if the latice is centered ...

Function Details

AbsStructEN(html, cif)

Adds some text to the English report about the absolute configuration of the molecule
Parameters:
html - HTML object where the text will be added to.
           (type=XMLWrite object.)
cif - The CIF-object of the structure
           (type=CIF-like Dictionnary)
Returns:
None, le test is simply added to the HTML file

AsymetricCellContents(cif)

tries to find the contents of the asymetric cell

AtomicCoord(html, table)

This function appends a table with label, y, y, z and U to the html file

AtomPositions(cif)

Extract the atome name, position and U(eq) fropm the CIF. Each table contents the atome label + x, y and z coordinate and the U(eq)
Parameters:
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
tupple of 2 tables, the first with the heavy atoms, the second with the hydrogens
           (type=tupple)

BondAngle(cif)

Returns a dictionnary with all the bond/valence angles between heavy atoms Datas have to be already in the CIF
Parameters:
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
dictionnary with all the "A1 - A2 - A3":"Angle"
           (type=dictionnary)

BondLength(cif)

Returns a dictionnary with all the bond lengths between heavy atoms. Datas have to be already in the CIF
Parameters:
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
a dictionnary with all the "A1 - A2": "distance"
           (type=dictionnary)

CellVol(cif)

calculate the cell volume and return it as a real (in ų)

ChechForCSD(cif, name='None')

check in the CIF data if all the data needed to generate a RST report are present. If not it will ask many anoying questions

ChechForRST(cif)

check in the CIF data if all the data needed to generate a RST report are present. If not it will ask many anoying questions

CheckSym(cif, fix=False)

Checks the symetry of a CIF file based on the symmetry operations
Parameters:
cif - the CIF dictionnary of a Xtal structure
fix - True if you want a corrected version of the CIF to be returned
Returns:
the warning if the symmetry is not coherent inside the CIF data
           (type=string)

cif2str(cif)

converts a cif dictionnary to a string according to the CIF syntax
Parameters:
cif - the CIF dictionnary correspondinf to a Xtal structure @return : a sting that corresponds to the content of the CIF-file.

Density(cif)

calculate the density in Mg/m³, for information : 10^30/Na/10^6=1.66054018667

dot2virg(text)

Substitute the english dots with french virgules
Parameters:
text - input test
           (type=string)
Returns:
modified text
           (type=string)

exists(cif, key)

Check if the key exists in the CIF.
Parameters:
cif - CIF dictionnary
key - CIF kay
           (type=string)
Returns:
True if the key exists in the CIF dictionnary and is non empty
           (type=boolean)

floatp(txt)

Removes the () from the text and convert to a float
Parameters:
txt - the input test
           (type=string)
Returns:
the value of the txt
           (type=float)

formula2chem(txt)

return a HTML representatin of the chemical formula

Html2table(html, BL, X, Y)

This function appends a table element to the html file with the X and Y headers

LoadCIF(filename)

Load the CIF file and returns the dictionnary
Parameters:
filename - the name of the file to open
           (type=string)
Returns:
the CIF object corresponding to the Xtal structure
           (type=dictionnary)

MainreportEN(html, cif)

This function generates the report in ENGLISH and add it to the HTML file
Parameters:
html - HTML file represented as an XML object
           (type=XML object)
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
None

MainreportFR(html, cif)

this function generates the report in FRENCH to the HTML file

mergeplaton(cif, acc)

Merge cif and acc and returns a completed CIF-object. Special care is taken to select the most usefull data generated by platon
Parameters:
cif - the initial CIF-object
           (type=dictionnary)
acc - the CIF-object generated by platon
           (type=dictionnary)
Returns:
merged CIF-object
           (type=dictionnary)

MergeSg(name, kcd, sg)

Merge 2 cif objects : add from sg the missing values in kcd
Parameters:
name - the name of the molecule, used only if the value exist in kcd
           (type=string)
kcd - The CIF-object of the Xtal structure
           (type=dictionnary)
sg - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
a new cif-object
           (type=dictionnary)

MolForm(cif, zp)

count the atoms and returns the molecular formula. Zp is the number of molecule per asymetric cell

MolWeight(formula)

calculate the molecular weight of a compound using its formula

oneloop(fields, start)

Processes one loop in the data extraction of the CIF file
Parameters:
fields - list of all the words contained in the cif file
           (type=list)
start - the starting index corresponding to the "loop_" key
           (type=integer)
Returns:
the list of loop dictionnaries, the length of the data extracted from the fields and the list of all the keys of the loop.
           (type=tupple)

parsecif(text)

-Parses the text of a CIF file

-Cut it in fields

-Find all the loops and process

-Find all the keys and values
Parameters:
text - the content of the CIF-file
           (type=string)
Returns:
An CIF dictionnary
           (type=dictionnary)

platon(filename)

process the data throught PLATON
Parameters:
filename - name of the CIF (or .res ....) file
           (type=string)
Returns:
the CIF data generated by PLATON
           (type=dictionnary)

readcif(filename)

-Check if the filename exists

-read the cif file

-removes the comments
Parameters:
filename - the name of the CIF file
           (type=string)
Returns:
a string containing the raw data
           (type=string)

renamefile(infile, namelist)

The CSD database has only room for 8 char to define the reference of the molecule. This function just tries to find a coherent name for the molecule in the database : it uses the 6 first numbers of the molecule name then "-" or a letter depending if the Xtal is a base or a salt (the letter corresponding to the number of the salt) The 8th position is for the polymorph or the data-acquisition.

Afterwars it asks the user for the name, provinding a suggestion.
Parameters:
infile - name of the CIF file
           (type=string)
namelist - list of all the files that already exists
           (type=list)
Returns:
the name of the reference suggested by the program @rtype:string

SaveCIF(cif, filename='test.cif')

transforms the CIF object in string and write it into the given file

splitcif(text)

Separate the text in fields as defined in the CIF
Parameters:
text - the content of the CIF-file
           (type=string)
Returns:
list of all the fields of the CIF
           (type=list)

stringmulti(text, value)

Convert a string to a real, multiplies by the value and returns a string
Parameters:
text - input text
           (type=string)
value
           (type=float or integer)
Returns:
txt*value
           (type=string)

structureImage(basename, structure='structure')

lauch PLATON and let the user chose the structural (or the ortep or powder) representation of the molecule
Parameters:
basename - the name of the CIF-file without the extention
           (type=string)
structure - can be "powder" and "ortep", if not a simple structure is chosen @return None
           (type=string)

symop(cif)

Lists all the symetricaly equivalent positions @param cif: CIF object of the Xtal structure
Parameters:
cif
           (type=dictionnary)
Returns:
";" separated list of xyz equivalent positions
           (type=string)

WriteReport(filename, cif, Lang='En')

This function writes out an X-Ray structure report as an HTML file in the given language with the data taken from the CIF dictionnary
Parameters:
filename - Name of the file (usually .cif or .html)
           (type=string)
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Lang - The language in which the repport has to be written, the default is English
           (type=string)

XraySummary(html, cif)

This function appends a table summarizing the Xray analysis, usually in Annexe as table 1
Parameters:
html - HTML file represented as an XML-object
           (type=XML object)
cif - The CIF-object of the Xtal structure
           (type=dictionnary)
Returns:
None

Zprime(cif)

Calculate Z' = Z/nop if the latice is primitive zp=2*Z/nop if the latice is centered ...

Generated by Epydoc 2.1 on Sun May 22 14:27:15 2005 http://epydoc.sf.net