SBConformation#
This class describes a structural conformation, i.e. a set of positions of atoms (samson.SBAtom
).
You can get a node indexer of atoms in the conformation:
# get all conformation in the active document
conformationIndexer = SAMSON.getNodes('node.type conformation')
if len(conformationIndexer):
# get the first conformation
conformation = conformationIndexer[0]
# get an indexer of atoms in the conformation
atomIndexer = conformation.getAtomIndexer()
You can restore a conformation:
# make the operation undoable
SAMSON.beginHolding("Restore conformation")
conformation.restore()
# stop holding the undoable operation
SAMSON.endHolding()
You can add, insert, and remove atoms using samson.SBConformation.addAtom()
, samson.SBConformation.insertAtom()
, and samson.SBConformation.removeAtom()
functions respectively.
You can also get and set positions, velocities, and forces for all atoms in a conformation or for a particular atom.
See also
SAMSON SDK: SBMStructuralModelConformation
- class samson.SBConformation(*args, **kwargs)#
Bases:
SBNode
This class describes a structural conformation.
Overloaded function.
__init__(self: samson.SBConformation) -> None
Constructs a structural conformation
__init__(self: samson.SBConformation, name: str, nodeIndexer: samson.SBNodeIndexer) -> None
Constructs a structural conformation with the given name from the nodes in nodeIndexer.
- Parameters:
name (str) – A name of the conformation
nodeIndexer (samson.SBNodeIndexer) – An indexer with structural nodes.
- addAtom(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom, atomPosition: samson.SBPhysicalVector3) bool #
Adds a atom with position atomPosition
- createStructuralModels(self: samson.SBConformation) samson.SBNodeIndexer #
Create structural models corresponding to all steps
- getAtomIndexer(self: samson.SBConformation) samson.SBNodeIndexer #
Returns the indexer of atoms for which a position is saved.
- Returns:
A node indexer with the associated atoms.
- Return type:
- getEnergy(self: samson.SBConformation) samson.SBQuantity.unitsSI #
Returns the energy data
- getForce(*args, **kwargs)#
Overloaded function.
getForce(self: samson.SBConformation, atomIndex: int) -> samson.SBPhysicalVector3
Retrieves the force of atom with atomIndex
getForce(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom) -> samson.SBPhysicalVector3
Retrieves the force of atom
- getForceData(self: samson.SBConformation) list[samson.SBPhysicalVector3] #
Returns the force data
- getNextConformation(self: samson.SBConformation) samson.SBConformation #
Returns the next conformation in the document
- getPosition(*args, **kwargs)#
Overloaded function.
getPosition(self: samson.SBConformation, atomIndex: int) -> samson.SBPhysicalVector3
Retrieves the position of atom with atomIndex
getPosition(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom) -> samson.SBPhysicalVector3
Retrieves the position of atom
- getPositionData(self: samson.SBConformation) list[samson.SBPhysicalVector3] #
Returns the position data
- getPreviousConformation(self: samson.SBConformation) samson.SBConformation #
Returns the previous conformation in the document
- getTime(self: samson.SBConformation) samson.SBQuantity.unitsSI #
Returns the time data
- getVelocity(*args, **kwargs)#
Overloaded function.
getVelocity(self: samson.SBConformation, atomIndex: int) -> samson.SBPhysicalVector3
Retrieves the velocity of atom with atomIndex
getVelocity(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom) -> samson.SBPhysicalVector3
Retrieves the velocity of atom
- getVelocityData(self: samson.SBConformation) list[samson.SBPhysicalVector3] #
Returns the velocity data
- insertAtom(self: samson.SBConformation, atomIndex: int, atom: SBMStructuralModelNodeAtom, atomPosition: samson.SBPhysicalVector3) bool #
Inserts an atom with position atomPosition at index atomIndex
- removeAtom(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom) bool #
Removes an atom from the conformation
- restore(self: samson.SBConformation) None #
Restores the conformation
- setEnergy(self: samson.SBConformation, energy: samson.SBQuantity.unitsSI) None #
Sets the energy data
- setForce(*args, **kwargs)#
Overloaded function.
setForce(self: samson.SBConformation, atomIndex: int, atomForce: samson.SBPhysicalVector3) -> None
Sets the force of atom with atomIndex
setForce(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom, atomForce: samson.SBPhysicalVector3) -> None
Sets the force of atom
- setForceData(self: samson.SBConformation, forceData: list[samson.SBPhysicalVector3]) None #
Sets the force data; forceData is a vector of forces
- setPosition(*args, **kwargs)#
Overloaded function.
setPosition(self: samson.SBConformation, atomIndex: int, atomPosition: samson.SBPhysicalVector3) -> None
Sets the position of atom with atomIndex
setPosition(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom, atomPosition: samson.SBPhysicalVector3) -> None
Sets the position of atom
- setPositionData(self: samson.SBConformation, positionData: list[samson.SBPhysicalVector3]) None #
Sets the position data; positionData is a vector of positions
- setTime(self: samson.SBConformation, time: samson.SBQuantity.unitsSI) None #
Sets the time data
- setVelocity(*args, **kwargs)#
Overloaded function.
setVelocity(self: samson.SBConformation, atomIndex: int, atomVelocity: samson.SBPhysicalVector3) -> None
Sets the velocity of atom with atomIndex
setVelocity(self: samson.SBConformation, atom: SBMStructuralModelNodeAtom, atomVelocity: samson.SBPhysicalVector3) -> None
Sets the velocity of atom
- setVelocityData(self: samson.SBConformation, velocityData: list[samson.SBPhysicalVector3]) None #
Sets the velocity data; velocityData is a vector of velocities
- property numberOfStructuralParticles#
Returns the number of atoms for which a position is saved