¶ Xponge.helper
This module is used to provide help functions and classes
¶ subpackages
¶ submodules
¶ functions
¶ xprint
This function is used to print some contents according to the verbose level in GlobalSetting
| parameters |
explanation |
| to_print |
the contents to print |
| verbose |
only print when the verbose level is not less than this value |
¶ debug
This function sets the mode to debug or not
| parameters |
explanation |
| mode |
the value to set the debug mode |
¶ set_unit_transfer_function
This function is used to return a function to add a static method _unit_transfer for a class.
| parameters |
explanation |
| sometype |
the class |
¶ add_unit_transfer_function
This function is used to return a function to add a static method _unit_transfer for a class.
| parameters |
explanation |
| sometype |
the class |
¶ verbose
the gloabl verbose level
¶ add_pdb_residue_name_mapping
This function is used to add the residue name mapping to the property PDBResidueNameMap
| parameters |
explanation |
| place |
head or tail |
| pdb_name |
the residue name in pdb |
| real_name |
the residue name in Python |
¶ set_invisible_bonded_forces
This function is used to disables the types of bonded forces when building.
| parameters |
explanation |
| types |
the types to set |
¶ set_visible_bonded_forces
This function is used to disables the types of bonded forces except named here when building.
| parameters |
explanation |
| types |
the types to set |
¶ classes
¶ Xdict
This class is used to be a dict which can give not_found_message
| parameters |
explanation |
| not_found_method |
the method (function) which will accept the key and return the value when the key is not found. New From 1.2.6.7 |
| not_found_message |
the string to print when the key is not found |
¶ ReasonedBool
This class is a boolean value with a reason
| parameters |
explanation |
| value |
True or False |
| reason |
the reason why the boolean value is given |
¶ Type
This class is the abstract class of the types (atom types, bonded force types and so on).
| parameters |
explanation |
| name |
the name of the type |
| kwargs |
parameters of the type |
¶ add_property
This function is used to add a property to the class
| parameters |
explanation |
| parm_fmt |
a dict mapping the name and the format of the property |
| parm_default |
a dict mapping the name and the default value of the property |
¶ set_property_unit
This function is used to set the unit of the property of the class
| parameters |
explanation |
| prop |
the name of the property |
| unit_type |
the type of the unit |
| base_unit |
the basic unit used in Python |
¶ new_from_string
This function is used to update the types of the class
| parameters |
explanation |
| string |
the string to update |
| skip_lines |
skip the first skip_lines line(s) |
¶ new_from_file
This function is used to update the types of the class
| parameters |
explanation |
| filename |
the name of the file |
| skip_lines |
skip the first skip_lines line(s) |
¶ new_from_dict
This function is used to update the types of the class
| parameters |
explanation |
| dic |
the dict of the parameters |
¶ get_class_name
This function gives the ._name of the class
| return |
the name of the class |
¶ clear_type
This function clears the instance(s) of the class
| parameters |
explanation |
| name |
the instance name to clear. If None, all instances will be cleared |
¶ set_type
This function sets the instance into the class
| parameters |
explanation |
| name |
the instance name |
| toset |
the instance to set |
¶ get_type
This function gets the instance of the class
| parameters |
explanation |
| name |
the instance name |
| return |
the instance to set |
¶ get_all_types
This function gets the all instances of the class
| return |
a dict mapping the name and the instance |
¶ update
This function is used to update the properties of the instance
| parameters |
explanation |
| kwargs |
parameters to update |
¶ AbstractMolecule
This abstract class is used to judge whether a class can be treated as a molecule
¶ AtomType
This class is a subclass of Type, for atom types
| parameters |
explanation |
| name |
the name of the type |
| kwargs |
parameters of the type |
¶ ResidueType
This class is a subclass of Type, for residue types
| parameters |
explanation |
| name |
the name of the type |
| kwargs |
parameters of the type |
¶ head
the name of the first atom in the head
¶ tail
the name of the first atom in the tail
¶ head_next
the name of the second atom in the head
¶ tail_next
the name of the second atom in the tail
¶ head_length
the length of the bond connected to the last residue
¶ tail_length
the length of the bond connected to the next residue
¶ head_link_conditions
the link conditions to the last residue
¶ tail_link_conditions
the link conditions to the next residue
¶ name2atom
This function convert an atom name to an Atom instance
| parameters |
explanation |
| name |
the name |
¶ atom2index
This function convert an Atom instance to its index
| parameters |
explanation |
| atom |
the Atom instance |
¶ atom2name
This function convert an Atom instance to its name
| parameters |
explanation |
| atom |
the Atom instance |
¶ name2index
This function convert an atom name to its index
| parameters |
explanation |
| name |
the name |
¶ add_atom
This function is used to add an atom to the residue type.
| parameters |
explanation |
| name |
the name of the atom |
| atom_type |
the type of the atom |
| x |
the coordinate x |
| y |
the coordinate y |
| z |
the coordinate z |
¶ omit_atoms
This function omits some atoms from the ResidueType
| parameters |
explanation |
| atoms |
the atom(s) to omit |
| charge |
the total charge of the residue type after the omission. None to use the charge sum of the unomitted atoms |
¶ add_connectivity
This function is used to add the connectivity between two atoms to the residue type.
| parameters |
explanation |
| atom0 |
the atom name or the Atom instance |
| atom1 |
the atom name or the Atom instance |
¶ remove_connectivity
This function is used to remove the connectivity between two atoms from the residue type.
| parameters |
explanation |
| atom0 |
the atom name or the Atom instance |
| atom1 |
the atom name or the Atom instance |
¶ remove_periodic_connectivity
This function is used to remove the connectivity between atoms larger than the given cutoff
| parameters |
explanation |
| cutoff |
the cutoff distance to recognize the connectivity as periodic or unperiodic |
| return |
a list of the removed connected atom pair names |
¶ add_bonded_force
This function is used to add the bonded force to the residue type.
| parameters |
explanation |
| bonded_force_entity |
the bonded force instance |
| typename |
the bonded force type name. If None, get_class_name will be used to get the name |
¶ deepcopy
This function is used to deep copy the instance
| parameters |
explanation |
| name |
the new ResidueType name |
| forcopy |
the key to help you find who it is from |
¶ Entity
This class is the abstract class of the entities (atoms, bonded forces, residues and so on).
| parameters |
explanation |
| entity_type |
the type of the entity |
| name |
the name of the entity |
¶ get_class_name
This function gives the name of the class
| return |
the name of the class |
¶ update
This function is used to update the properties of the instance
| parameters |
explanation |
| kwargs |
the properties to update |
¶ Atom
This class is a subclass of Entity, for atoms
| parameters |
explanation |
| entity_type |
a string or a AtomType instance, the type of the entity |
| name |
the name of the entity |
the extra excluded atoms of this atom
¶ deepcopy
This function is used to deep copy the instance
| parameters |
explanation |
| forcopy |
the key to help you find who it is from |
¶ link_atom
This function is used to link atoms for building
| parameters |
explanation |
| link_type |
the type to link |
| atom |
the atom to link |
This function is used to extra exclude one atom
| parameters |
explanation |
| atom |
an Atom instance |
This function is used to extra exclude a list of atoms
| parameters |
explanation |
| atom_list |
the atom list |
¶ Residue
This class is a subclass of Entity, for residues
| parameters |
explanation |
| entity_type |
a string or a ResidueType instance, the type of the entity |
| name |
the name of the entity |
| directly_copy |
if True, directly copy the Residue instance from the ResidueType instance |
¶ set_type
This function is used to change the type of the residue to a new type
| parameters |
explanation |
| new_type |
the instance or the name of the new residue type |
| add_missing_atoms |
whether to add missing atoms after deleting the terminal atoms |
¶ unterminal
This function is used to turn the terminal residue to be unterminal
| parameters |
explanation |
| add_missing_atoms |
whether to add missing atoms after deleting the terminal atoms |
| return |
1 for success, 0 for failure |
¶ name2atom
This function convert an atom name to an Atom instance
| parameters |
explanation |
| name |
the name |
¶ atom2index
This function convert an Atom instance to its index
| parameters |
explanation |
| atom |
the Atom instance |
¶ name2index
This function convert an atom name to its index
| parameters |
explanation |
| name |
the name |
¶ add_atom
This function is used to add an atom to the residue
| parameters |
explanation |
| name |
the name of the atom. If an Atom instance is given, only the name and type are used. |
| atom_type |
the type of the atom. If None, it will copy from the ResidueType. |
| x |
the coordinate x. If None, it will copy from the ResidueType. |
| y |
the coordinate y. If None, it will copy from the ResidueType. |
| z |
the coordinate z. If None, it will copy from the ResidueType. |
¶ add_connectivity
This function is used to add the connectivity between two atoms to the residue entity.
| parameters |
explanation |
| atom0 |
the atom name or the Atom instance |
| atom1 |
the atom name or the Atom instance |
¶ add_bonded_force
This function is used to add the bonded force to the residue entity.
| parameters |
explanation |
| bonded_force_entity |
the bonded force instance |
¶ add_missing_atoms
This function is used to add the missing atoms from the ResidueType to the residue entity.
¶ deepcopy
This function is used to deep copy the instance
| parameters |
explanation |
| forcopy |
the key to help you find who it is from |
¶ ResidueLink
This class is a class for the link between residues
| parameters |
explanation |
| atom1 |
the first atom to link |
| atom2 |
the second atom to link |
¶ get_hash
This function is used to get the hash value of the ResidueLink
| parameters |
explanation |
| one |
one Atom or Residue of the link |
| other |
the other Atom or Residue of the link |
¶ add_bonded_force
This function is used to add the bonded force to the residue link
| parameters |
explanation |
| bonded_force_entity |
the bonded force instance |
¶ deepcopy
This function is used to deep copy the instance
| parameters |
explanation |
| forcopy |
the key to help you find who it is from |
¶ Molecule
This class is a class for molecules
| parameters |
explanation |
| name |
a string, the name of the Molecule or a ResidueType instance |
¶ cast
This function casts a Residue, a ResidueType or a Molecule to a Molecule
| parameters |
explanation |
| other |
a Residue, a ResidueType or a Molecule instance |
| deepcopy |
whether to deepcopy the other instance |
| return |
a Molecule instance |
This function is used to set the function when Save_SPONGE_Input.
| parameters |
explanation |
| keyname |
the file prefix to save |
This function is used to delete the function when Save_SPONGE_Input.
| parameters |
explanation |
| keyname |
the file prefix to save |
¶ set_mindsponge_todo
This function is used to set the function when Save_SPONGE_Input.
| parameters |
explanation |
| keyname |
the file prefix to save |
¶ del_mindsponge_todo
This function is used to delete the function when Save_SPONGE_Input.
| parameters |
explanation |
| keyname |
the file prefix to save |
¶ find_spacious_direction
This function is used to find the most spacious (lowest atom density) direction of the givin point around the atom positions
| parameters |
explanation |
| point |
a list of 3 numbers, the point to find the most spacious direction |
| atom_positions |
the atom positions around the point. If None, this will use the positions of the atoms in this Molecule |
| return |
a numpy array with the shape (3,), the most spacious direction |
¶ add_residue
This function is used to add a residue to the molecule
| parameters |
explanation |
| residue |
the residue to add, either a Residue instance or a ResidueType instance |
¶ add_bonded_force
This function is used to add the bonded force to the residue type.
| parameters |
explanation |
| bonded_force_entity |
the bonded force instance |
¶ add_residue_link
This function is used to add the connectivity between two atoms of two residues in the molecule.
| parameters |
explanation |
| atom1 |
the first atom |
| atom2 |
the second atom |
¶ get_residue_link
This function is used to get the ResidueLink between two residues
| parameters |
explanation |
| one |
one Atom or Residue of the ResidueLink |
| other |
the other Atom or Residue of the ResidueLink |
| return |
the ResidueLink or None if not found |
¶ del_residue_link
This function is used to delete the ResidueLink between two residues
| parameters |
explanation |
| one |
one Atom or Residue of the ResidueLink |
| other |
the other Atom or Residue of the ResidueLink |
| key |
"atom" or "residue", to specify the key |
¶ add_missing_atoms
This function is used to add the missing atoms from the ResidueType instances to the molecule.
¶ set_missing_residues_info
This function is used to set the information about the missing residues
| parameters |
explanation |
| start |
the residue or the residue index where the missing residues start. None for no starting residue. |
| end |
the residue or the residue index where the missing residues end. None for no ending residue. |
| missing_residues |
the missing residues. The parameter can be a string separated by space, or a list of residue names, or a list of ResidueType or None. If None, the information will be deleted between start and end |
| return |
True for success, False for failure to set |
¶ clear_missing_residues_info
This function is used to clear the information about the missing residues
¶ add_missing_residues
This function is used to add the missing residues according to the information of the missing residues.
| parameters |
explanation |
| add_head |
whether to add the missing residues at the head of the chain |
| add_tail |
whether to add the missing residues at the tail of the chain |
¶ deepcopy
This function is used to deep copy the instance
¶ get_atoms
This function is used to get the atoms in the molecule.
¶ get_atom_coordinates
This function is used to get the atom coordinates
| return |
a numpy array, the coordinates of atoms |
¶ divide_into_two_parts
This function is used to divide the molecule into two parts
| parameters |
explanation |
| atom1 |
the first atom |
| atom2 |
the second atom |
| return |
two numpy arrays, the index of the two parts |
¶ restrain_position
This function is used to generate the atoms for restraints
| parameters |
explanation |
| select |
a string of MDAnalysis selection |
| filename |
the name of the output atom index file |
¶ constrain_position
This function is used to generate the mass in file for constraints
| parameters |
explanation |
| select |
a string of MDAnalysis selection |
| filename |
the name of the output atom index file |
¶ BondedForceEntity
This class is a subclass of Entity, for bonded forces
¶ deepcopy
This function is used to deep copy the instance
¶ BondedForceType
This class is a subclass of Type, for bonded force types
¶ same_force
This function receives a list of atoms and output all the same force permutations for the list
| parameters |
explanation |
| atom_list |
|
¶ PairwiseForceType
This class is a subclass of Type, for pairwise force types