Entry API

Introduction

The main class of the ccdc.entry module is ccdc.entry.Entry.

A ccdc.entry.Entry is often a CSD entry. It contains attributes that are beyond the concepts of chemistry and crystallography. An example of such an attribute would be the publication details of a CSD entry.


>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> abebuf = csd_reader.entry('ABEBUF')
>>> print(abebuf.publication)  # doctest: +NORMALIZE_WHITESPACE
Citation(authors='S.W.Gordon-Wylie, E.Teplin, J.C.Morris, M.I.Trombley, S.M.McCarthy, W.M.Cleaver, G.R.Clark',
         journal='Journal(Crystal Growth and Design)',
         volume='4', year=2004, first_page='789',
         doi='10.1021/cg049957u')

However, a ccdc.entry.Entry does not necessarily have to be a CSD entry. If, for example, a sdf file is read in using a ccdc.io.EntryReader then the sdf tags will be added to a dictionary-like object named attributes of the entry. Entries read in from CIF files will also contain attributes with the raw data from the CIF file.

API

Entry

class ccdc.entry.Entry(_entry=None)[source]

A database entry.

class CrossReference(_xr)[source]

A cross-reference between entries in the database.

identifiers

A tuple containing identifiers of the cross-referenced entries.

scope

Whether the cross-reference applies to the individual identifier or the family of related identifiers.

text

The text of the cross-reference.

type

The type of cross-reference.

Available types are ‘Unknown’, ‘Racemate’, ‘Stereoisomer’, ‘Isomer’, ‘Reinterpretation of’, ‘Reinterpretation ref’, and ‘Coordinates ref’.

analogue

Analogue information.

bioactivity

Recorded information about bioactivity if available otherwise None.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aadmpy10 = csd_reader.entry('AADMPY10')
>>> print(aadmpy10.bioactivity)
antineoplastic activity
calculated_density

The density.

ccdc_number

The CCDC deposition number.

>>> from ccdc.io import EntryReader
>>> entry_reader = EntryReader('CSD')
>>> abebuf = entry_reader.entry('ABEBUF')
>>> print(abebuf.ccdc_number)
241370
chemical_name

The chemical name of the entry.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> print(acsala13.chemical_name)
2-acetoxybenzoic acid
chemical_name_as_html

The chemical name of the entry formatted as HTML.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> e = csd_reader.entry('AACRHA')
>>> print(e.chemical_name_as_html)
Tetra-ammonium bis(bis(μ<sub>2</sub>-acetato-O,O')-bromo-rhodium(iv)) dibromide
color

The colour of the crystal if given, otherwise None.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acesor = csd_reader.entry('ACESOR')
>>> print(acesor.color)
yellow
cross_references

The tuple of ccdc.entry.Entry.CrossReference for this entry. These are cross-references between entries of the CSD.

crystal

The ccdc.crystal.Crystal contained in a database entry.

database_name

The name of the source database.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acesor = csd_reader.entry('ACESOR')
>>> print(acesor.database_name)  # doctest: +SKIP
as536be_ASER
deposition_date

The date when this entry was deposited as a datetime.date object or None if the date is not available.

disorder_details

Information about any disorder present if given otherwise None.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> abacir = csd_reader.entry('ABACIR')
>>> print(abacir.disorder_details)
O4 and O4A disordered over two sites with occupancies 0.578:0.422.
disordered_molecule

The ccdc.molecule.Molecule contained in a database entry, including disordered atoms.

formatted_melting_point_range

Get the formatted melting point in default units.

Returns:a three-item tuple containing the minimum value, maximum value and units string. If the melting point is a single value the min and max will be set to the same value.
formatted_melting_point_text

Get the formatted melting point descriptive text.

formula

The published chemical formula in an entry.

If no published chemical formula is available it will be calculated from the molecule.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aacani10 = csd_reader.entry('AACANI10')
>>> print(aacani10.formula)
C10 H18 N2 Ni1 O5,2(H2 O1)
static from_molecule(mol, **attributes)[source]

Construct an entry from a molecule, using the keyword arguments as attributes.

static from_string(s, format='')[source]

Create an entry from a string representation.

The format will be auto-detected if not specified.

Parameters:
  • s – string representation of an entry, crystal or molecule
  • format – one of ‘mol2’, ‘sdf’, ‘mol’ or ‘cif’
Returns:

a ccdc.entry.Entry

Raises:

TypeError if the format string is not ‘’, ‘mol2’, ‘sdf’, ‘mol’, ‘cif’ or ‘smiles’.

Raises:

RuntimeError if the string representation is incorrectly formatted

habit

The crystal habit.

has_3d_structure

Whether the entry has 3d information.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aqefor = csd_reader.entry('AQEFOR')
>>> aqefor.has_3d_structure
False
has_disorder

Whether the structure has disorder.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> abacir = csd_reader.entry('ABACIR')
>>> abacir.has_disorder
True
heat_capacity

Get or set the heat capacity.

Returns:a two-item tuple containing the heat capacity value and units

When setting, pass a tuple with either a single value, or a value and a units string.

>>> from ccdc.entry import Entry
>>> e=Entry.from_string("OCO")
>>> e.heat_capacity=(54.55,)
>>> e.heat_capacity
(54.55, '')
>>> e.heat_capacity=(54.55,'J/K')
>>> e.heat_capacity
(54.55, 'J/K')
heat_capacity_notes

Get or set the notes on the heat capacity

>>> from ccdc.entry import Entry
>>> e=Entry.from_string("OCO")
>>> e.heat_capacity_notes
''
>>> e.heat_capacity_notes='from Wikipedia, at 189.78K'
>>> e.heat_capacity_notes
'from Wikipedia, at 189.78K'
heat_of_fusion

Get or set the heat of fusion

A tuple is required to set this. The first item is a value or lower bound for heat of fusion. The optional second item is an upper bound for heat of fusion, or None. The optional third item is units for the heat of fusion.

>>> from ccdc.entry import Entry
>>> e=Entry.from_string("OCO")
>>> e.heat_of_fusion = (9.019,)
>>> e.heat_of_fusion
(9.019, 9.019, '')
>>> e.heat_of_fusion = (9,9.1)
>>> e.heat_of_fusion
(9.0, 9.1, '')
>>> e.heat_of_fusion = (9,9.1,'KJ/mol')
>>> e.heat_of_fusion
(9.0, 9.1, 'KJ/mol')
heat_of_fusion_notes

Get or set the notes of heat of fusion

identifier

The string identifier of the entry, e.g. ‘ABEBUF’.

input_melting_point_range

Set or get the original input unparsed melting point range.

When setting pass in a tuple e.g. (285,) no max value provided, use the default units. (28.2, None, “deg.C”) single value, use degrees centigrade (28.2, 29.5, “deg.C”) min, max, use degrees centigrade (275, 278) min and max, default units (275, 278, “K”) min and max in Kelvin

input_melting_point_text

Get or set the input melting point text.

is_organic

Whether the structure is organic.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aacani10 = csd_reader.entry('AACANI10')
>>> aacani10.is_organic
False
is_organometallic

Whether the structure is organometallic.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aacani10 = csd_reader.entry('AACANI10')
>>> aacani10.is_organometallic
True
is_polymeric

Whether the structure contains polymeric bonds.

>>> from ccdc.io import EntryReader
>>> csd = EntryReader('CSD')
>>> abacuf = csd.entry('ABACUF')
>>> abacuf.is_polymeric
True
is_powder_study

Whether or not the crystal determination was performed on a powder study

>>> from ccdc.io import EntryReader
>>> csd = EntryReader('csd')
>>> print(csd.entry('AABHTZ').is_powder_study)
False
>>> print(csd.entry('ACATAA').is_powder_study)
True
melting_point

Melting point of the crystal if given otherwise None.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> print(acsala13.melting_point)
135.5deg.C
melting_point_default_units

Return the default melting point units.

melting_point_display_string

The parsed and formatted melting point string.

molecule

The ccdc.molecule.Molecule contained in a database entry.

peptide_sequence

The peptide sequence of the entry if any.

phase_transition

Phase transition of the entry.

polymorph

Polymorphic information about the crystal if given otherwise None.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> print(acsala13.polymorph)
polymorph II
pressure

The experimental pressure of the crystallisation of the entry, where known.

This is a text field. If None the experiment was performed at ambient pressure or not recorded.

>>> from ccdc.io import EntryReader
>>> csd = EntryReader('csd')
>>> print(csd.entry('AABHTZ').pressure)
None
>>> print(csd.entry('ABULIT03').pressure)
at 1.4 GPa
previous_identifier

Previous identifier if any.

>>> from ccdc.io import EntryReader
>>> entry_reader = EntryReader('CSD')
>>> acpret03 = entry_reader.entry('ACPRET03')
>>> print(acpret03.identifier)
ACPRET03
>>> print(acpret03.previous_identifier)
DABHUJ
publication

The first publication of a structure.

This attribute gives the publication details of a CSD entry, expressed as a tuple of (authors, journal, volume, year, first_page, doi).


>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aqefor = csd_reader.entry('AQEFOR')
>>> print(aqefor.publication) # doctest: +NORMALIZE_WHITESPACE
Citation(authors='M.E.Bluhm, M.Ciesielski, H.Gorls, O.Walter, M.Doring',
         journal='Journal(Inorganic Chemistry)', volume='42', year=2003,
         first_page='8878', doi='10.1021/ic034773a')
Return type:Citation
publications

All publications of the entry.

r_factor

Resolution of crystallographic determination, given as a percentage value.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> acsala13.r_factor
16.22
radiation_source

The radiation source of the crystal’s determination.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aabhtz = csd_reader.entry('AABHTZ')
>>> aabhtz.radiation_source
'X-ray'
>>> csd_reader.entry('ABINOR01').radiation_source
'Neutron'
remarks

Any remarks on the entry registered by the editors of the database.

These may include details like a US Patent number:

>>> from ccdc.io import EntryReader
>>> csd = EntryReader('csd')
>>> print(csd.entry('ARISOK').remarks)
U.S. Patent: US 6858644 B2

or reflect editorial decisions:

>>> print(csd.entry('ABAPCU').remarks)
The position of the hydrate is dubious. It has been deleted
solubility_data

Get or set the solubility data, a list of ccdc.entry.SolubilityMeasurement

>>> from ccdc.entry import Entry, SolubilityMeasurement
>>> e=Entry.from_string('CC(C)Cc1ccc(cc1)C(C)C(O)=O')
>>> sol = SolubilityMeasurement('21-22', 25, 'mg/L', 'deg.C', 'from PubChem')
>>> sol.add_solvent('water', 100)
>>> e.solubility_data = [sol]
>>> e.solubility_data
[SolubilityMeasurement(21 - 22, 25.0, "mg/L", "deg.C", from PubChem)]
>>> e.solubility_data[0].solvents
(('water', 100.0),)
solvent

Recrystallisation solvent.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> rechul = csd_reader.entry('REKHUL')
>>> print(rechul.solvent)
pentane
source

The source of the compound(s) in the entry.

>>> from ccdc.io import EntryReader
>>> entry_reader = EntryReader('CSD')
>>> fifdut = entry_reader.entry('FIFDUT')
>>> print(fifdut.source)
dried venom of Chinese toad Ch'an Su
synonyms

List containing any recorded synonyms for the entry.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> print(' '.join(acsala13.synonyms)) # doctest: +NORMALIZE_WHITESPACE
Aspirin
DrugBank: DB00945
synonyms_as_html

Tuple containing any recorded synonyms for the entry formatted as HTML.

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> aalpro = csd_reader.entry('AALPRO')
>>> print(aalpro.synonyms_as_html[0])
α-Allylprodine hydrochloride
temperature

Experimental temperature of the entry

>>> from ccdc.io import EntryReader
>>> csd_reader = EntryReader('CSD')
>>> acsala13 = csd_reader.entry('ACSALA13')
>>> print(acsala13.temperature)
at 100 K
to_string(format='mol2')[source]

Return a string representation of an entry.

Parameters:format – ‘mol2’, ‘sdf’, ‘mol’ or ‘cif’
Return type:string
Raises:TypeError if the format is not ‘mol2’, ‘sdf’, ‘mol’ or ‘cif’

Journals

class ccdc.entry.Journal(_journal)[source]

Information about a journal held in the CSD.

abbreviated_name

The abbreviated name of the journal.

abbreviated_translated_name

The abbreviated translated name of the journal.

eissn

The electronic international sequence number of the journal.

end_year

The date of termination of publication of the journal.

full_name

The full name of the journal.

image_url

The URL of an image of the journal.

international_coden

The ASTM international identifier of the journal.

issn

The international sequence number of the journal.

language_name

The name of the journal’s original language (where possible).

name

The name of the journal.

publisher_name

The name of the publisher of the journal.

start_year

The year of first publication of the journal.

state

Whether or not the journal is current.

translated_name

The translated name of the journal.

url

The URL of the journal on the publisher’s website.

class ccdc.entry.JournalList(database)[source]

The collection of journals read from a database.

by_abbreviated_name(value)[source]

The unique journal with a given abbreviated name or None.

by_full_name(value)[source]

The unique journal with a given full name or None.

match_abbreviated_name(regexp)[source]

Those journals matching a regular expression on the abbreviated name.

match_full_name(regexp)[source]

Those journals whose full name is matched by the regexp.

Those journals any of whose names contain the given pattern.

class ccdc.entry.SolubilityMeasurement(solubility, temperature, solubility_unit='mg/mL', temperature_unit='deg.C', notes='')[source]

A solubility measurement.

Parameters:
  • solubility – a solubilty value, range tuple or string, see ccdc.entry.SolubilityMeasurement.Solubility
  • temperature – a measurement temperature value.
  • solubility_unit – the solubility units, default mg/mL.
  • temperature_unit – the temperature units, default deg.C.
  • notes – notes for this measurement.
class Solubility(solubility)[source]

A solubility value range.

This can be created from a single value. Or from a tuple of (lower, upper) bound values. Or from a string describing the range such as “< 15” or “3 - 8”.

max

The maximum solubility value, or None if there is no maximum value.

min

The minimum solubility value, or None if there is no minimum value.

add_solvent(solvent, ratio)[source]

Add a solvent-ratio to the solubility measurement

Run this method for each solvent.

Parameters:
  • solvent – name of solvent
  • ratio – percentage of solvent
notes

The solubility measurement notes

solubility

The solubility value, a ccdc.entry.SolubilityMeasurement.Solubility

solubility_unit

The solubility unit

solvents

The list of solvents and percentages

Each item is returned as a tuple of (name, percentage).

temperature

The temperature value

temperature_unit

The temperature unit