Monomer
- class Monomer(topology: Topology, junctions: Junctions | List[Junction])[source]
Bases:
objectRepresents a monomer with its properties in a molecular system.
- Parameters:
topology (Topology) – the Topology object used to create this Monomer.
junctions (Union[Junctions, List[Junction]]) – a list of Junction objects or Junctions object containing all Junctions which will be present in this Monomer.
- copy() Monomer[source]
Method to duplicate a Monomer, which leverages the Topology.copy() function.
- Raises:
ValueError – if the monomer atom in one of the Polymer’s Junctions is not present.
ValueError – if the residue atom in one of the Polymer’s Junctions is not present.
- Returns:
a new Monomer which has the same attributes as this Monomer.
- Return type:
- classmethod from_Polymer(polymer: Polymer) Monomer[source]
Convert a Polymer object to a Monomer object. Useful for creating Polymeric branches of a set size and converting them back to a Monomer so that they can be polymerised onto another Polymer.
- Parameters:
polymer (Polymer) – a Polymer to convert.
- Raises:
ValueError – if the monomer atom in one of the Polymer’s Junctions is not present.
ValueError – if the residue atom in one of the Polymer’s Junctions is not present.
- Returns:
a new Monomer which has the same attributes (Topology and Junctions) as the provided Polymer.
- Return type:
- classmethod from_dict(data: dict) Monomer[source]
Create a new Monomer from a dictionary, such as that created with Monomer.to_dict().
The structure of the dictionary is as below: {“topology”: self.topology.to_dict(), “junctions”: self.junctions.to_dict()}
- classmethod load(file_path: str) Monomer[source]
Load a JSON text dump of a Monomer, generated with Monomer.save(), to a new Monomer.
- renumber_atoms(start: int)[source]
Renumber the ids of Atoms in the Topology starting from a given number. Each atom’s new id number is equal to its current id number plus the value of start.
- E.g. an atom with and id of 1 renumbered with a start value of 10 will
have a new id of 11.
- Parameters:
start (int) – value that will be added to the atom’s existing ids to renumber them.
- save(file_path: str)[source]
Save and export the Monomer to a JSON text dump.
- Parameters:
file_path (str) – path to and desired name of output file.
- to_dict() dict[source]
Convert this Monomer to a dictionary representation.
The structure of the dictionary is as below: {“topology”: self.topology.to_dict(), “junctions”: self.junctions.to_dict()}
- Returns:
a dictionary containing references to the dictionary representations of this Monomer’s Topology and Junctions attributes.
- Return type: