SingleChainStructureFactor¶
- class mdhelper.analysis.polymer.SingleChainStructureFactor(group: AtomGroup, grouping: str = 'atoms', n_points: int = 32, *, n_chains: int = None, n_monomers: int = None, dimensions: ndarray[float] | Quantity | Quantity = None, unwrap: bool = False, parallel: bool = False, verbose: bool = True, **kwargs)[source]¶
Bases:
DynamicAnalysisBase
Serial and parallel implementations to calculate the single-chain structure factor \(S_\mathrm{sc}(q)\) of a homopolymer.
It is defined as
\[S_{\mathrm{sc}}(\mathbf{q})=\frac{1}{MN_\mathrm{p}} \sum_{m=1}^M\sum_{i,j=1}^{N_\mathrm{p}}\left\langle \exp{[i\mathbf{q}\cdot(\mathbf{r}_i-\mathbf{r}_j)]}\right\rangle\]where \(M\) is the number of chains, \(N_\mathrm{p}\) is the chain length, \(\mathbf{q}\) is the scattering wavevector, and \(\mathbf{r}_i\) is the position of the \(i\)-th monomer.
The single-chain structure factor reveals information about the characteristic length scales of the polymer:
In the Guinier regime (\(qR_g\ll1\)), \(S_{\mathrm{sc}}(q)^{-1}\approx N_\mathrm{p}(1-(qR_g)^2/3)\) can be used to determine the radius of gyration \(R_g\).
In the Porod regime (\(qR_g\gg1\)), \(S_{\mathrm{sc}}(q)=1\) since the only contribution is the self-scattering of the monomers.
In the intermediate regime, the slope \(s\) of the log-log plot of \(S_{\mathrm{sc}}(q)\) is related to the scaling exponent \(\nu\) via \(\nu=-1/s\).
- Parameters:
- groupMDAnalysis.AtomGroup
Group of polymers to be analyzed. All polymers in the group must have the same chain length.
- groupingstr, default:
"atoms"
Determines whether the centers of mass are used in lieu of individual atom positions.
Note
In a standard trajectory file, segments (or chains) contain residues (or molecules), and residues contain atoms. This heirarchy must be adhered to for this analysis module to function correctly. If your trajectory file does not contain the correct segment or residue information, provide the number of chains and chain lengths in n_chains and n_monomers, respectively.
Valid values:
"atoms"
: Atom positions (for coarse-grained polymer simulations)."residues"
: Residues’ centers of mass (for atomistic polymer simulations).
- n_pointsint, default:
32
Number of points to sample the wavevector space.
- n_chainsint, optional
Number of chains in group. Must be provided if the topology does not contain segment information.
- n_monomersint, optional
Number of monomers per chain. Must be provided if the topology does not contain segment information.
- dimensionsnumpy.ndarray or openmm.unit.Quantity, optional
System dimensions. If the
MDAnalysis.core.universe.Universe
object that group belongs to does not contain dimensionality information, provide it here.Shape: \((3,)\).
Reference unit: \(\textrm{Å}\).
- unwrapbool, keyword-only, default:
False
Determines whether atom positions are unwrapped.
- parallelbool, keyword-only, default:
False
Determines whether the analysis is performed in parallel.
- verbosebool, keyword-only, default:
True
Determines whether detailed progress is shown.
- **kwargs
Additional keyword arguments to pass to
MDAnalysis.analysis.base.AnalysisBase
.
Notes
In a standard trajectory file, segments (or chains) contain residues, and residues contain atoms. This heirarchy must be adhered to for this analysis module to function correctly. If your trajectory file does not contain the correct segment or residue information, provide the number of chains and chain lengths in n_chains and n_monomers, respectively.
- Attributes:
- universeMDAnalysis.Universe
MDAnalysis.core.universe.Universe
object containing all information describing the system.- results.unitsdict
Reference units for the results. For example, to get the reference units for
results.wavenumbers
, callresults.units["results.wavenumbers"]
.- results.wavenumbersnumpy.ndarray
Unique wavenumbers.
Shape: \((N_q,)\).
Reference unit: \(\textrm{Å}^{-1}\).
- results.scsfnumpy.ndarray
Single-chain structure factors for the unique wavenumbers.
Shape: \((N_q,)\).
Methods
- run(start: int = None, stop: int = None, step: int = None, frames: slice | ndarray[int] = None, verbose: bool = None, **kwargs) SerialAnalysisBase | ParallelAnalysisBase ¶
Performs the calculation.
See also
For parallel-specific keyword arguments, see
ParallelAnalysisBase.run()
.- Parameters:
- startint, optional
Starting frame for analysis.
- stopint, optional
Ending frame for analysis.
- stepint, optional
Number of frames to skip between each analyzed frame.
- framesslice or array-like, optional
Index or logical array of the desired trajectory frames.
- verbosebool, optional
Determines whether detailed progress is shown.
- **kwargs
Additional keyword arguments to pass to
MDAnalysis.lib.log.ProgressBar
.
- Returns:
- selfSerialAnalysisBase or ParallelAnalysisBase
Analysis object with results.
- save(file: str | TextIO, archive: bool = True, compress: bool = True, **kwargs) None ¶
Saves results to a binary or archive file in NumPy format.
- Parameters:
- filestr or file
Filename or file-like object where the data will be saved. If file is a str, the
.npy
or.npz
extension will be appended automatically if not already present.- archivebool, default:
True
Determines whether the results are saved to a single archive file. If True, the data is stored in a
.npz
file. Otherwise, the data is saved to multiple.npy
files.- compressbool, default:
True
Determines whether the
.npz
file is compressed. Has no effect whenarchive=False
.- **kwargs
Additional keyword arguments to pass to
numpy.save()
,numpy.savez()
, ornumpy.savez_compressed()
, depending on the values of archive and compress.