Metadata-Version: 2.1
Name: TprParser
Version: 0.1.49
Summary: A reader of gromacs tpr file
Home-page: UNKNOWN
Author: Yujie Liu
Author-email: 
License: GPL
Description: # Description
        
        `TprParser` is a convenient Python module for reading and setting simulation parameters in gromacs `tpr` file.
        
        This module mainly aimed to modify **atom property** of `tpr` and create a new tpr file (named `new.tpr`) after use any one `set_` method. 
        
        The module only supports get atoms coordinates, velocity and force if exist in `tpr` by `module.get_xvf(...)` function. 
        
        However, many properties can be set up by module, such as total simulation time `nsteps`, simulation integrator interval `dt`, output control parameters (`nstxout, nstvout, etc.`) and temperature/pressure coupling parameters.
        
        # Compatibility
        GROMACS tpr version should between `4.0` to `2024`, too old tpr can not be read by this module.
        
        # Install
        
        * Requirements
        
          * `Python >= 3.8`
        
          * `Numpy`
        
          * `C++ compiler` (g++ for Linux, MSVC for Windows) supports `C++ 17` standard
        
        * Install
        
          The module is installed by `pip` method:
        
          ```
          pip install TprParser -i https://pypi.org/simple
          ```
        
          Please **ALWAYS** install Latest version.
        
          Update this module if you have installed:
          ```
          pip install TprParser --upgrade -i https://pypi.org/simple
          ```
        
        # Usage
        
        Write your python program like this:
        
        ```python
        from TprParser.TprReader import TprReader	# import this module
        ```
        
        ## Get atom property
        
        
        ```python
        # get atom coords or velocity
        reader = TprReader("your.tpr")
        coords = reader.get_xvf('x')
        velocity = reader.get_xvf('v')
        
        # get atom charge or mass
        charge = reader.get_mq('q')
        mass = reader.get_mq('m')
        
        # get residue or atom name of each atom
        resnames = reader.get_name('res')
        atomnames = reader.get_name('atom')
        ```
        
        
        ## Get bonds/angles/dihedrals(proper and impropers)
        ```python
        # get all bond pairs (1-based index)
        bonds = reader.get_bonded('bonds')
        
        # get all angles pairs (1-based index)
        angles = reader.get_bonded('angles')
        
        # get all proper dihedrals pairs (1-based index)
        propers = reader.get_bonded('dihedrals')
        
        # get all improper dihedrals pairs (1-based index)
        impropers = reader.get_bonded('impropers')
        
        ```
        
        
        
        ## Modify atom property
        
        ```python
        newcoords = np.array([[1,2,3], [4,5,6], [...]], dtype=np.float32) # shape= N*3
        # The step will create new.tpr that used newcoords
        reader.set_xvf('x', newcoords)
        ```
        
        
        
        # Modify system pressure
        
        you can define a function do this work:
        
        ```Python
        def Pressure(fname):
            reader = TprReader(fname)
            # 100 bar
            ref_p = [
                100, 0, 0,
                0, 100, 0,
                0, 0, 100
            ]
            # compressibility 4.5E-5
            compress = [
                4.5E-5, 0, 0,
                0, 4.5E-5, 0,
                0, 0, 4.5E-5
            ]
            assert len(ref_p) == 9
            assert len(compress) == 9
            # use ParrinelloRahman algorithm and Isotropic pressure coupling method
            reader.set_pressure('ParrinelloRahman', 'Isotropic', 1.0, ref_p, compress)
        
        ```
        
        # Modify system temperature
        ```python
        # set Berendsen algorithm and tau_t=0.2, ref_t=400 K for one temperature coupling group
        reader.set_temperature(etc='Berendsen', tau_t=[0.2], ref_t=[400])
        ```
        
        
        ## Other
        
        Please see `TprReader` module annotation
        
        
        # Cite
        If `TprParser` is utilized in your work, please cite as follows in main text:
        
        > Yujie Liu, TprParser, Version [xxx](), https://pypi.org/project/TprParser/
        
        
        ## TODO
        
        * More parameters can be modified
        * Get More essential parameters 
        
        
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.8
Description-Content-Type: text/markdown
