Coarse Graining
mlcg.cg contains useful tools for projecting all-atom systems to a coarser resolution.
- mlcg.cg.projection.build_cg_topology(topology, cg_mapping=None, special_terminal=True, bonds=<function add_chain_bonds>, angles=<function add_chain_angles>, dihedrals=<function add_chain_dihedrals>)[source]
Takes an mlcg.geometry.topology.Topology instance and returns another mlcg.geometry.topology.Topology instance conditioned on the supplied CG mapping
- Parameters:
topology (
Topology
) – Original MLCG topology before coarse grainingcg_mapping (
Optional
[Dict
[Tuple
[str
,str
],Tuple
[str
,int
,int
]]]) – A suitable CG mapping. See mclg.cg._mapping.py for examples.special_termini – If True, the first and last CG atoms recieve their own special types
bonds (
Optional
[Callable
]) – Function to enumerate and define bonds in the final CG topologyangles (
Optional
[Callable
]) – Function to enumerate and define angles in the final CG topologydihedrals (
Optional
[Callable
]) – Function to enumerate and define dihedrals in the final CG topology
- Returns:
CG topoology
- Return type:
- mlcg.cg.projection.build_cg_matrix(topology, cg_mapping=None, special_terminal=True)[source]
Function for producing coarse grain types, masses, and mapping matrices using a slicing strategy and a predetermined set of atoms to retain at the coarse grain resolution.
- Parameters:
topology (
Topology
) – System topology instancecg_mapping (
Optional
[Dict
[Tuple
[str
,str
],Tuple
[str
,int
,int
]]]) –Mapping dictionary with the following structure:
{ (residue name, atom name) : (compound name, type, mass) ... }
Eg, a row for an alanine carbon alpha atom would be:
{ ("ALA", "CA") : ("CA_A", 1, 12) ... }
special_termini – If True, special types will be reserved for the first and last CG atoms
- Return type:
Tuple
[ndarray
,ndarray
,ndarray
,OrderedDict
]- Returns:
np.ndarray – Array of CG atom types
np.ndarray – Array of CG masses
np.ndarray – One-hot transformation matrix of shape (n_high_res_atoms, n_cg_atoms) that maps atoms for the high resolution repesentation to the coarse grain representation
OrderedDict – Ordered dictionary mapping each CG atom index (with respect to the CG topology) to a list containing the CG atom name, CG atom type and the CG atom mass