Constructor of the ParticleIdentifier
- symbol (str) – The chemical symbol of the particle type.
- tag (str | sequence of str | None) – The tag name this particle type should be associated with.
Add a tag to this particle identifier.
If this particle identifier already contains this tag, a RuntimeError is raised.
Parameters: tag (str) – The tag(s) that belong to this particle identifier.
Create and return a ParticleIdentifier object from a variety of different object types. Possible inputs are:
- A ParticleType object. In this case, the ParticleIdentifier that is stored in the ParticleType is returned.
- A ParticleIdentifier object. In this case, a deep copy of the ParticleIdentifier is returned.
- A string. A new ParticleIdentifier is build by using the content of the string as the symbol of the Particle Identifier. The tags are set to None.
Parameters: input (str | ParticleType | ParticleIdentifier) – The input the particle identifier should be generate from.
Return the symbol of this object.
Returns: The symbol of this particle type (without any tags). Return type: str
Return the tags associated with this object as a list of str. The tags are sorted ascending.
Return a string that uniquely describes this particle identifier. The string is created by adding the tags to the particle symbol, separated by a fixed tag separator string.
Set the tag(s).
Parameters: tag (str | sequence of str | None) – The tag(s) that belong to this particle identifier.
Use a ParticleIdentifier to distinguish between different atom types of the same element, e.g. hydrogen in a methyl- and hydroxyl-group in a methanol molecule.
This is how ParticleIdentifiers can be used without tags:
# Set up a new TremoloXPotentialSet potential_set = TremoloXPotentialSet(name='Methanol_bonded') # Add particle types. potential_set.addParticleType( ParticleType.fromElement(Carbon, charge=0.1166*elementary_charge) ) potential_set.addParticleType( ParticleType.fromElement(Oxygen, charge=-0.6497*elementary_charge) ) # Set up a new bond potential for C-H bonds and add it to the potential set. bond_potential = HarmonicBondPotential( particleType1=ParticleIdentifier('C'), particleType2=ParticleIdentifier('O'), k=13.87651*eV/Ang**2, r_0=1.410*Ang, ) potential_set.addPotential(bond_potential)
# Add particle types. potential_set.addParticleType( ParticleType.fromElement(Carbon, charge=0.1166*elementary_charge) ) # Add particle types for hydroxyl hydrogen (with HO-tag). potential_set.addParticleType( ParticleType.fromElement(Hydrogen, charge=0.4215*elementary_charge, tags='HO') ) # Set up a new bond potential for C-H bonds and add it to the potential set. bond_potential = HarmonicBondPotential( particleType1=ParticleIdentifier('H', tag='HO'), particleType2=ParticleIdentifier('O'), k=23.9803*eV/Ang**2, r_0=0.960*Ang, ) potential_set.addPotential(bond_potential)
The full script can be found found in the file
- ParticleIdentifiers can be used instead of atomic symbols to specify which particle types a potential should act on. This is helpful when dealing with different particle types of the same element, which are only distinguished by tags. As shown in the usage example, such a situation is very common in biomolecular force fields, where elements in different hybridization states or chemical environments can have different types with different potential parameters.
- The tagged particle type needs to be created by giving the tag name in ParticleType. Then this particle type refers only to those atoms of the given element which have this tag. All remaining atoms of this element then correspond to another ParticleType which has been created without tag. Tag names that are not used with any ParticleType are ignored in this TremoloXPotentialSet.