soprano.properties.transform.transform#

Implementation of AtomsProperties that transform the instance in some way

Classes

Mirror([name])

Returns an Atoms object with some or all the atoms reflected with either a given center or a given plane.

Rotate([name])

Returns an Atoms object with some or all the atoms rotated by a given quaternion and with a given center.

Translate([name])

Returns an Atoms object with some or all the atoms translated by a given vector.

class soprano.properties.transform.transform.Mirror(name=None, **params)[source]#

Bases: AtomsProperty

Returns an Atoms object with some or all the atoms reflected with either a given center or a given plane. Absolute or scaled coordinates may be used.

Parameters:
selection (AtomSelection): selection object defining which atoms to
act on. By default, all of them.
center ([float]*3): center around which the reflection should take
place. By default the origin of the axes. Can’t be
present at the same time as plane.
plane ([float]*4): plane with respect to which the reflection should
take place, in the form [a, b, c, d] parameters of
the plane equation.
By default is not used. Can’t be present at the
same time as center.
scaled (bool): if True, treat the input vector as expressed in scaled,
not absolute, coordinates.
Returns:
reflected (ase.Atoms): Atoms object with the reflection performed.

Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.

Args:
name (str): a name to give to this specific instance of the
property (will be used to store it as array if
requested)
params: named arguments specific to this type of property
__call__(s, store_array=False)#

Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the given name for this instance

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed

static extract(s, selection, **kwargs)[source]#

Extract the given property with given parameters from an Atoms object.

Args:
s (ase.Atoms): the structure from which to extract the property
params: named arguments specific to this type of property

Returns:
property: the value of the property for the given structure and
parameters

classmethod get(s, store_array=False, **kwargs)#

Extract the given property using the default parameters on an Atoms object s

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the default name for this property

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed

class soprano.properties.transform.transform.Rotate(name=None, **params)[source]#

Bases: AtomsProperty

Returns an Atoms object with some or all the atoms rotated by a given quaternion and with a given center. Absolute or scaled coordinates may be used.

Parameters:
selection (AtomSelection): selection object defining which atoms to
act on. By default, all of them.
center ([float]*3): center around which the rotation should take
place. By default the origin of the axes.
quaternion (ase.quaternions.Quaternion): quaternion expressing the
rotation that should be
applied.
scaled (bool): if True, treat the input vector as expressed in scaled,
not absolute, coordinates.
periodic (bool): if True, always rotate each atom around the minimum
periodic image of the rotation center.
Returns:
rotated (ase.Atoms): Atoms object with the rotation performed.

Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.

Args:
name (str): a name to give to this specific instance of the
property (will be used to store it as array if
requested)
params: named arguments specific to this type of property
__call__(s, store_array=False)#

Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the given name for this instance

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed

static extract(s, selection, **kwargs)[source]#

Extract the given property with given parameters from an Atoms object.

Args:
s (ase.Atoms): the structure from which to extract the property
params: named arguments specific to this type of property

Returns:
property: the value of the property for the given structure and
parameters

classmethod get(s, store_array=False, **kwargs)#

Extract the given property using the default parameters on an Atoms object s

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the default name for this property

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed

class soprano.properties.transform.transform.Translate(name=None, **params)[source]#

Bases: AtomsProperty

Returns an Atoms object with some or all the atoms translated by a given vector. Absolute or scaled coordinates may be used.

Parameters:
selection (AtomSelection): selection object defining which atoms to
act on. By default, all of them.
vector ([float]*3): vector by which to translate the atoms.
scaled (bool): if True, treat the input vector as expressed in scaled,
not absolute, coordinates.
Returns:
translated (ase.Atoms): Atoms object with the translation performed.

Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.

Args:
name (str): a name to give to this specific instance of the
property (will be used to store it as array if
requested)
params: named arguments specific to this type of property
__call__(s, store_array=False)#

Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the given name for this instance

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed

static extract(s, selection, **kwargs)[source]#

Extract the given property with given parameters from an Atoms object.

Args:
s (ase.Atoms): the structure from which to extract the property
params: named arguments specific to this type of property

Returns:
property: the value of the property for the given structure and
parameters

classmethod get(s, store_array=False, **kwargs)#

Extract the given property using the default parameters on an Atoms object s

Args:
s (ase.Atoms or AtomsCollection): the structure or collection
from which to extract the
property
store_array (bool): if s is a collection, whether to store the
resulting data as an array in the collection
using the default name for this property

Returns:
property: the value of the property for the given structure or
a list of values if a collection has been passed