Public API#

View Module Index

class sire.base.PropertyMap#

This is the class that holds the collection of user-supplied optional properties and their locations to functions.

This class allows the following code to be written;

cljff.add( mol, Property::set(charges,chgs) + Property::set(ljs,ljparams) );

The PropertyMapPropertyName classes provide a kwargs like interface for the C++ classes - indeed the python wrappers should allow code to be written like;

cljff.add( mol, {charges : chgs, ljs : ljparams} )

or

cljff.add( mol, charges=charges, ljs=ljparams )

Author: Christopher Woods

assign((PropertyMap)arg1, (PropertyMap)other) PropertyMap :#
C++ signature :

SireBase::PropertyMap {lvalue} assign(SireBase::PropertyMap {lvalue},SireBase::PropertyMap)

clone((PropertyMap)arg1) PropertyMap :#
C++ signature :

SireBase::PropertyMap clone(SireBase::PropertyMap)

is_default()#
isDefault( (PropertyMap)arg1) -> bool :

Return whether or not this map is default - if it is, then it doesnt specify any properties

C++ signature :

bool isDefault(SireBase::PropertyMap {lvalue})

merge((PropertyMap)arg1, (PropertyMap)other) PropertyMap :#
Return a PropertyMap that is the combination of this and other.

Keys set in other take precedence over keys in this.

C++ signature :

SireBase::PropertyMap merge(SireBase::PropertyMap {lvalue},SireBase::PropertyMap)

specified((PropertyMap)arg1, (str)name) bool :#
Return whether or not this map specifies the source or value

of the property called name

C++ signature :

bool specified(SireBase::PropertyMap {lvalue},char const*)

specified( (PropertyMap)arg1, (object)name) -> bool :

Return whether or not this map specifies the source or value of the property called name

C++ signature :

bool specified(SireBase::PropertyMap {lvalue},QString)

specified( (PropertyMap)arg1, (PropertyName)name) -> bool :

Return whether or not this map specifies the source or value of the property called name

C++ signature :

bool specified(SireBase::PropertyMap {lvalue},SireBase::PropertyName)

to_dict()#
toDict( (PropertyMap)arg1) -> object :

Return the raw underlying dictionary of the map

C++ signature :

QHash<QString, SireBase::PropertyName> toDict(SireBase::PropertyMap {lvalue})

to_string()#
toString( (PropertyMap)arg1) -> object :

Return a string representation of this PropertyMap

C++ signature :

QString toString(SireBase::PropertyMap {lvalue})

typename()#

typeName() -> str :

C++ signature :

char const* typeName()

what((PropertyMap)arg1) str :#
C++ signature :

char const* what(SireBase::PropertyMap {lvalue})

sire.base.create_map(values)[source]#

Construct a PropertyMap from the passed values. A PropertyMap is a class that lets you either provide extra options to some of the C++ functions, or to map the default keys used to find properties to your own keys

You normally wouldn’t use the class yourself. Instead, objects of this class will be created automatically from dictionaries, e.g.

>>> mol.energy(map={"cutoff": 5*angstrom})

would automatically create a PropertyMap, and is equivalent to writing

>>> mol.energy(map=create_map({"cutoff": 5*angstrom}))

In the above case you are providing an extra “cutoff” option, and are passing the value “5*angstrom”.

You can also use the map to change the keys used to find properties, e.g.

>>> mol.energy(map={"coordinates": "my_coords"})

would map the default “coordinates” property to your “my_coords” property. This means that the coordinates for the energy would be found at “my_coords” rather than “coordinates”.

You can map as many properties, and provide as many extra options as you want.

sire.base.wrap(value)[source]#

Wrap the passed value into a Property object. This works recursively, wrapping all items in a container, such that the returned value is derived from Property and can be passed to the C++ code in sire. Note that you normally don’t need to call this yourself, as wrapping is handled automatically.