gromacs_py.gmx package
Submodules
gromacs_py.gmx.gmxsys module
- class gromacs_py.gmx.gmxsys.GmxSys(name=None, coor_file=None, top_file=None, tpr=None)
Bases:
object
Gromacs system encapsulation class.
This class can be used to launch most of gromacs commands (pdb2gmx, grompp, mdrun, trjconv, editconf, genconf, …). After each steps, outputs file paths of gromacs commands are store in the class variable, like
corr_file
,top_file
, tpr … Most function will need thecorr_file
and/ortop_file
variable to be defined.The GmxSys object can be considered as a md simulation system. Each operation on the object will affect the object variables.
The variables
nt
,ntmpi
andgpu_id
are only used by functions which run simulationsrun_simulation()
likeem()
orproduction()
.- Parameters
name (str) – generic name of the system
sim_name (str, optional) – name of the simulation (used to create .tpr .log .edr …)
coor_file (str, optional) – path of the coordinate file (.pdb, .gro)
top_file (str, optional) – path of the .top file
tpr (str, optional) – path of the .tpr file
mdp (str, optional) – path of the .mdp file
xtc (str, optional) – path of the .xtc file
edr (str, optional) – path of the .edr file
log (str, optional) – path of the .log file
ndx (str, optional) – path of the .ndx file
nt (int, default=0) – Total number of threads to start
ntmpi (int, default=0) – Number of thread-MPI threads to start
gpu_id (str, default=None) – List of GPU device id-s to use, specifies the per-node PP rank to GPU mapping
sys_history (list of GmxSys()) – List of previous GmxSys() states
- Example
> show_log() > TEST_OUT = str(getfixture('tmpdir')) > prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') > ################################### > #### Create the topologie: ### > ################################### > prot.prepare_top(out_folder=os.path.join(TEST_OUT, 'top_SH3'), vsite='hydrogens') #doctest: +ELLIPSIS Succeed to read file .../test_files/1y0m.pdb , 648 atoms found Succeed to read file .../test_files/1y0m.pdb , 648 atoms found Succeed to save file tmp_pdb2pqr.pdb pdb2pqr30... --ff CHARMM --ffout CHARMM --keep-chain --titration-state-method=propka --with-ph=7.00 tmp_pdb2pqr.pdb 00_1y0m.pqr Succeed to read file 00_1y0m.pqr , 996 atoms found Chain: A Residue: 0 to 60 Succeed to save file 01_1y0m_good_his.pdb - Create topologie gmx pdb2gmx -f 01_1y0m_good_his.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 -ignh -vsite hydrogens Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top > ################################### > #### Add water and ions: ### > ################################### > prot.solvate_add_ions(out_folder=os.path.join(TEST_OUT, 'top_sys')) #doctest: +ELLIPSIS - Create pbc box gmx editconf -f .../top_SH3/1y0m_pdb2gmx.pdb -o .../top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.1 - Solvate the pbc box Copy topologie file and dependancies Copy topologie file and dependancies - Create the tpr file genion_1y0m_water_ion.tpr gmx grompp -f .../template/mini.mdp -c 1y0m_water.pdb -r 1y0m_water.pdb -p 1y0m_water_ion.top -po out_mini.mdp -o genion_1y0m_water_ion.tpr -maxwarn 1 - Add ions to the system with an ionic concentration of 0.15 M , sytem charge = 0.0 water num= 4775 Add ions : NA : 13 CL : 13 gmx genion -s genion_1y0m_water_ion.tpr -p 1y0m_water_ion.top -o 1y0m_water_ion.gro -np 13 -pname NA -nn 13 -nname CL > ################################### > #### Minimize the system ### > ################################### > prot.em(out_folder=os.path.join(TEST_OUT, 'em_SH3'), nsteps=10, constraints='none') - Create the tpr file 1y0m.tpr gmx grompp -f 1y0m.mdp -c ../top_sys/1y0m_water_ion.gro -r ../top_sys/1y0m_water_ion.gro -p ../top_sys/1y0m_water_ion.top -po out_1y0m.mdp -o 1y0m.tpr -maxwarn 1 - Launch the simulation 1y0m.tpr gmx mdrun -s 1y0m.tpr -deffnm 1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright > ################################### > #### Create a D peptide ### > ################################### > pep = GmxSys(name='D') > pep.create_peptide(sequence='D', out_folder=os.path.join(TEST_OUT, 'top_D'), em_nsteps=10, equi_nsteps=0, vsite='hydrogens') -Make peptide: D residue name:X residue name:D Succeed to save file .../top_D/D.pdb - Create topologie gmx pdb2gmx -f ../D.pdb -o D_pdb2gmx.pdb -p D_pdb2gmx.top -i D_posre.itp -water tip3p -ff charmm36-jul2017 -ignh -ter -vsite hydrogens Molecule topologie present in D_pdb2gmx.top , extract the topologie in a separate file: D_pdb2gmx.itp Protein_chain_P - ITP file: D_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_P Rewrite topologie: D_pdb2gmx.top - Create pbc box gmx editconf -f .../top_D/00_top/D_pdb2gmx.pdb -o .../top_D/00_top/D_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 - Create the tpr file D.tpr gmx grompp -f D.mdp -c ../00_top/D_pdb2gmx_box.pdb -r ../00_top/D_pdb2gmx_box.pdb -p ../00_top/D_pdb2gmx.top -po out_D.mdp -o D.tpr -maxwarn 1 - Launch the simulation D.tpr gmx mdrun -s D.tpr -deffnm D -nt 0 -ntmpi 0 -nsteps -2 -nocopyright > ####################################################### > ### Insert 4 copy of the peptide in the SH3 system: ### > ####################################################### > prot.insert_mol_sys(mol_gromacs=pep, mol_num=4, new_name='SH3_D', out_folder=os.path.join(TEST_OUT, 'top_D_SH3')) #doctest: +ELLIPSIS - Convert trj/coor gmx trjconv -f ...D.gro -o ...D_compact.pdb -s ...D.gro -ur compact -pbc none Succeed to read file ...D_compact.pdb , 22 atoms found - Copy pbc box using genconf Succeed to read file ...D_compact_copy_box.pdb , 88 atoms found Succeed to save file ...D_compact_copy_box.pdb Res num: 8 - Convert trj/coor gmx trjconv -f ../em_SH3/1y0m.gro -o ../em_SH3/1y0m_compact.pdb -s ../em_SH3/1y0m.tpr -ur compact -pbc mol Concat files: ['../em_SH3/1y0m_compact.pdb', '../top_D/01_mini/D_compact_copy_box.pdb'] Succeed to save concat file: SH3_D_pre_mix.pdb Succeed to read file SH3_D_pre_mix.pdb , 15425 atoms found Insert mol in system Residue list = [4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843] Insert 4 mol of 2 residues each insert mol 1, water mol ..., time=0... Warning atom 1MCH mass could not be founded Warning atom 2MCH mass could not be founded Warning atom 1HH3 mass could not be founded Warning atom 2HH3 mass could not be founded Warning atom 3HH3 mass could not be founded insert mol 2, water mol ..., time=0... Warning atom 1MCH mass could not be founded Warning atom 2MCH mass could not be founded Warning atom 1HH3 mass could not be founded Warning atom 2HH3 mass could not be founded Warning atom 3HH3 mass could not be founded insert mol 3, water mol ..., time=0... Warning atom 1MCH mass could not be founded Warning atom 2MCH mass could not be founded Warning atom 1HH3 mass could not be founded Warning atom 2HH3 mass could not be founded Warning atom 3HH3 mass could not be founded insert mol 4, water mol ..., time=0... Warning atom 1MCH mass could not be founded Warning atom 2MCH mass could not be founded Warning atom 1HH3 mass could not be founded Warning atom 2HH3 mass could not be founded Warning atom 3HH3 mass could not be founded Delete ... overlapping water atoms Succeed to save file SH3_D.pdb Ligand Add 4 mol ...D_pdb2gmx.itp Succeed to read file SH3_D.pdb , 15... atoms found Water num: 47... [{'name': 'Protein_chain_A', 'num': '1'}, {'name': 'SOL', ... {'name': 'Ligand', 'num': '4'}] CHARGE: -4.0 Should neutralize the system Copy topologie file and dependancies - Create the tpr file genion_SH3_D_neutral.tpr gmx grompp -f .../template/mini.mdp -c SH3_D.pdb -r SH3_D.pdb -p SH3_D_neutral.top -po out_mini.mdp -o genion_SH3_D_neutral.tpr -maxwarn 1 - Add ions to the system with an ionic concentration of 0 M , sytem charge = -4.0 water num= 47... Add ions : NA : 4 CL : 0 gmx genion -s genion_SH3_D_neutral.tpr -p SH3_D_neutral.top -o SH3_D_neutral.gro -np 4 -pname NA -nn 0 -nname CL > ################################ > #### Minimize the system ### > ################################ > prot.em_2_steps(out_folder=os.path.join(TEST_OUT, 'top_D_SH3'), no_constr_nsteps=10, constr_nsteps=10) - Create the tpr file Init_em_1y0m.tpr gmx grompp -f Init_em_1y0m.mdp -c SH3_D_neutral.gro -r SH3_D_neutral.gro -p SH3_D_neutral.top -po out_Init_em_1y0m.mdp -o Init_em_1y0m.tpr -maxwarn 1 - Launch the simulation Init_em_1y0m.tpr gmx mdrun -s Init_em_1y0m.tpr -deffnm Init_em_1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright - Create the tpr file 1y0m.tpr gmx grompp -f 1y0m.mdp -c Init_em_1y0m.gro -r Init_em_1y0m.gro -p SH3_D_neutral.top -po out_1y0m.mdp -o 1y0m.tpr -maxwarn 1 - Launch the simulation 1y0m.tpr gmx mdrun -s 1y0m.tpr -deffnm 1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright > ################################## > #### Show system history ### > ################################## > prot.display_history() #doctest: +ELLIPSIS State -3: <BLANKLINE> name : 1y0m sim_name : genion_1y0m_water_ion coor_file : .../top_sys/1y0m_water_ion.gro top_file : .../top_sys/1y0m_water_ion.top tpr : .../top_sys/genion_1y0m_water_ion.tpr mdp : ...template/mini.mdp nt : 0 ntmpi : 0 sys_history : 0 <BLANKLINE> State -2: <BLANKLINE> name : 1y0m sim_name : genion_SH3_D_neutral coor_file : .../top_D_SH3/SH3_D_neutral.gro top_file : .../top_D_SH3/SH3_D_neutral.top tpr : .../top_D_SH3/genion_SH3_D_neutral.tpr mdp : ...template/mini.mdp xtc : .../em_SH3/1y0m.trr edr : .../em_SH3/1y0m.edr log : .../em_SH3/1y0m.log nt : 0 ntmpi : 0 sys_history : 0 <BLANKLINE> State -1: <BLANKLINE> name : 1y0m sim_name : Init_em_1y0m coor_file : .../top_D_SH3/Init_em_1y0m.gro top_file : .../top_D_SH3/SH3_D_neutral.top tpr : .../top_D_SH3/Init_em_1y0m.tpr mdp : .../top_D_SH3/Init_em_1y0m.mdp xtc : .../top_D_SH3/Init_em_1y0m.trr edr : .../top_D_SH3/Init_em_1y0m.edr log : .../top_D_SH3/Init_em_1y0m.log nt : 0 ntmpi : 0 sys_history : 0 <BLANKLINE> > ################################### > #### Equilibrate the system ### > ################################### > equi_template_mdp = os.path.join(GROMACS_MOD_DIRNAME, "template/equi_vsites.mdp") > mdp_options = {'nsteps': 100, 'define': '-DPOSRES', 'dt': 0.001} > prot.run_md_sim(out_folder=os.path.join(TEST_OUT, 'equi_HA_D_SH3'), name="equi_HA_D_SH3", mdp_template=equi_template_mdp, mdp_options=mdp_options) - Create the tpr file equi_HA_D_SH3.tpr gmx grompp -f equi_HA_D_SH3.mdp -c ../top_D_SH3/1y0m.gro -r ../top_D_SH3/1y0m.gro -p ../top_D_SH3/SH3_D_neutral.top -po out_equi_HA_D_SH3.mdp -o equi_HA_D_SH3.tpr -maxwarn 0 - Launch the simulation equi_HA_D_SH3.tpr gmx mdrun -s equi_HA_D_SH3.tpr -deffnm equi_HA_D_SH3 -nt 0 -ntmpi 0 -nsteps -2 -nocopyright > prot.get_simulation_time() #doctest: +ELLIPSIS - Get simulation time from : .../equi_HA_D_SH3/equi_HA_D_SH3.cpt gmx check -f .../equi_HA_D_SH3/equi_HA_D_SH3.cpt 0.1 > prot.convert_trj(traj=False) #doctest: +ELLIPSIS - Convert trj/coor gmx trjconv -f .../equi_HA_D_SH3/equi_HA_D_SH3.gro -o .../equi_HA_D_SH3/equi_HA_D_SH3_compact.pdb -s .../equi_HA_D_SH3/equi_HA_D_SH3.tpr -ur compact -pbc mol > prot.display() #doctest: +ELLIPSIS name : 1y0m sim_name : equi_HA_D_SH3 coor_file : .../equi_HA_D_SH3/equi_HA_D_SH3_compact.pdb top_file : .../top_D_SH3/SH3_D_neutral.top tpr : .../equi_HA_D_SH3/equi_HA_D_SH3.tpr mdp : .../equi_HA_D_SH3/equi_HA_D_SH3.mdp xtc : .../equi_HA_D_SH3/equi_HA_D_SH3.xtc edr : .../equi_HA_D_SH3/equi_HA_D_SH3.edr log : .../equi_HA_D_SH3/equi_HA_D_SH3.log nt : 0 ntmpi : 0 sys_history : 4 > ######################################### > ### Extract Potential Energy and Temp ### > ######################################### > ener_pd = prot.get_ener(['Potential', 'Temp']) #doctest: +ELLIPSIS - Extract energy gmx energy -f .../equi_HA_D_SH3/equi_HA_D_SH3.edr -o tmp_edr.xvg > ener_pd['Potential'].mean() #doctest: +ELLIPSIS -2... > rmsd_pd = prot.get_rmsd(['C-alpha', 'Protein']) #doctest: +ELLIPSIS - Extract RMSD - Create the ndx file ...equi_HA_D_SH3.ndx gmx make_ndx -f ...equi_HA_D_SH3_compact.pdb -o ...equi_HA_D_SH3.ndx gmx rms -s ...equi_HA_D_SH3.tpr -f ...equi_HA_D_SH3.xtc -n ... equi_HA_D_SH3.ndx -o tmp_rmsd.xvg -fit rot+trans -ng 1 -pbc no > rmsd_pd #doctest: +ELLIPSIS time ...Protein 0 0.0... > rmsf_pd = prot.get_rmsf(['Protein'], res="yes") #doctest: +ELLIPSIS - Extract RMSF gmx rmsf -s ...equi_HA_D_SH3.tpr -f ...equi_HA_D_SH3.xtc -n ... equi_HA_D_SH3.ndx -o tmp_rmsf.xvg -fit no -res yes > rmsf_pd #doctest: +ELLIPSIS Residue RMSF 0 791 ...
Note
An history of all command used could be saved.
- add_disulfide_bonds(res_list, out_folder, name=None, check_file_out=True, ff='charmm36-jul2017')
Add disulfide bonds to a single protein topologie. Topologie has to be computed before using this function. Set specifically which cystein residues need to be bonded: Example of res_list = [[4, 7], [10, 20]], will connect cystein residues 4 to 7 and 10 to 20.
- Parameters
res_list – list of list of cystein residues to be bonded
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
ff (str, optional, default="charmm36-jul2017") – forcefield.
Object requirement(s):
self.coor_file
self.top_file
Object field(s) changed:
self.coor_file
self.top_file
Add the following terms:
1 Bond
SG-SG
2 Angle
SG-SG-CB
CB-SG-SG
7 Dihed
CA-CB-SG-SG
HB1-CB-SG-SG
HB2-CB-SG-SG
CB-SG-SG-CB
SG-SG-CB-HB1
SG-SG-CB-HB2
SG-SG-CB-CA
- Example
>>> show_log() >>> TEST_OUT = getfixture('tmpdir') >>> >>> # Measure s-s bond length: >>> ss_coor = pdb_manip.Coor(TEST_PATH+'/1dn3_cys.pdb') Succeed to read file .../1dn3_cys.pdb , 144 atoms found >>> cystein_s_index = ss_coor.get_index_selection({'name': ['SG'], 'res_name' : ['CYS']}) >>> print(cystein_s_index) [85, 118] >>> distance = pdb_manip.Coor.atom_dist(ss_coor.atom_dict[cystein_s_index[0]], ss_coor.atom_dict[cystein_s_index[1]]) >>> print('S-S distance = {:.2f} Å'.format(distance)) S-S distance = 6.38 Å >>> no_ss_pep = GmxSys(name='1dn3_cys', coor_file=TEST_PATH+'/1dn3_cys.pdb') >>> >>> #Basic usage : >>> no_ss_pep.prepare_top(out_folder=os.path.join(str(TEST_OUT),'1dn3/top')) Succeed to read file .../1dn3_cys.pdb , 144 atoms found Succeed to read file .../1dn3_cys.pdb , 144 atoms found Succeed to save file tmp_pdb2pqr.pdb pdb2pqr30... --ff CHARMM --ffout CHARMM --keep-chain --titration-state-method=propka --with-ph=7.00 tmp_pdb2pqr.pdb 00_1dn3_cys.pqr Succeed to read file 00_1dn3_cys.pqr , 231 atoms found Chain: A Residue: 0 to 14 Succeed to save file 01_1dn3_cys_good_his.pdb - Create topologie gmx pdb2gmx -f 01_1dn3_cys_good_his.pdb -o 1dn3_cys_pdb2gmx.pdb -p 1dn3_cys_pdb2gmx.top -i 1dn3_cys_posre.itp -water tip3p -ff charmm36-jul2017 -ignh -vsite none Molecule topologie present in 1dn3_cys_pdb2gmx.top , extract the topologie in a separate file: 1dn3_cys_pdb2gmx.itp Protein_chain_A - ITP file: 1dn3_cys_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1dn3_cys_pdb2gmx.top >>> no_ss_pep.add_disulfide_bonds(res_list=[[9, 12]], out_folder=os.path.join(str(TEST_OUT),'1dn3/top_ss')) Succeed to read file .../1dn3/top/1dn3_cys_pdb2gmx.pdb , 231 atoms found Succeed to save file .../1dn3/top_ss/1dn3_cys_ss_bond.pdb Read rtp file : .../charmm36-jul2017.ff/merged.rtp Correct residue CYS2 atom SG atom type S to SM ... Correct residue CYS2 atom SG atom type S to SM ... Protein_chain_A >>> no_ss_pep.em(out_folder=TEST_OUT+'/1dn3/em_ss/', nsteps=10, create_box_flag=True) - Create pbc box gmx editconf -f ...1dn3/top_ss/1dn3_cys_ss_bond.pdb -o .../1dn3/top_ss/1dn3_cys_ss_bond_box.pdb -bt dodecahedron -d 1.0 - Create the tpr file 1dn3_cys.tpr gmx grompp -f 1dn3_cys.mdp -c ../top_ss/1dn3_cys_ss_bond_box.pdb -r ../top_ss/1dn3_cys_ss_bond_box.pdb -p ../top_ss/1dn3_cys_ss_bond.top -po out_1dn3_cys.mdp -o 1dn3_cys.tpr -maxwarn 1 - Launch the simulation 1dn3_cys.tpr gmx mdrun -s 1dn3_cys.tpr -deffnm 1dn3_cys -nt 0 -ntmpi 0 -nsteps -2 -nocopyright >>> # Need to convert the gro to pdb: >>> no_ss_pep.convert_trj(traj=False) - Convert trj/coor gmx trjconv -f .../em_ss/1dn3_cys.gro -o .../em_ss/1dn3_cys_compact.pdb -s .../em_ss/1dn3_cys.tpr -ur compact -pbc mol >>> # Measure s-s bond length: >>> ss_coor = pdb_manip.Coor(no_ss_pep.coor_file) Succeed to read file .../em_ss/1dn3_cys_compact.pdb , 229 atoms found >>> cystein_s_index = ss_coor.get_index_selection({'name': ['SG'], 'res_name' : ['CYS']}) >>> print(cystein_s_index) [135, 189] >>> distance = pdb_manip.Coor.atom_dist(ss_coor.atom_dict[cystein_s_index[0]], ss_coor.atom_dict[cystein_s_index[1]]) >>> print('S-S distance = {:.2f} Å'.format(distance)) S-S distance = 2.0... Å
Note
No options are allowed (water model, termini capping) except for vsites.
- add_ions(out_folder, name=None, ion_C=0.15, pname='NA', nname='CL', solv_name='SOL', maxwarn=1, check_file_out=True)
Add ion in a system to neutralise the sys_charge and to reach the ionic concentration
ion_C
.Ion number are computed using the water number and the charge of the system:
With \(cation_{num} = {int(C_{ion} * water_{num}) \over 55.5}\)
if \(cation_{num} + sys_{charge} >= 0\) then \(anion_{num} = cation_{num} + sys_{charge}\) else \(cation_{num} = -sys_{charge}\)
- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
ion_C (float, optional, default=0.15) – ionic concentraton (Molar)
pname (str, optional, default="SOL") – cation name
pname – anion name
pname – solvant name
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
self.top_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/add_ions/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.create_box() - Create pbc box gmx editconf -f .../add_ions/top_SH3/1y0m_pdb2gmx.pdb -o .../add_ions/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 >>> prot.solvate_box(out_folder=TEST_OUT+'/add_ions/top_SH3_water/') - Solvate the pbc box Copy topologie file and dependancies >>> prot.add_ions(out_folder=TEST_OUT+'/add_ions/top_SH3_water_ions/') Copy topologie file and dependancies - Create the tpr file genion_1y0m_ion.tpr gmx grompp -f .../template/mini.mdp -c ../top_SH3_water/1y0m_water.pdb -r ../top_SH3_water/1y0m_water.pdb -p 1y0m_ion.top -po out_mini.mdp -o genion_1y0m_ion.tpr -maxwarn 1 - Add ions to the system with an ionic concentration of 0.15 M , sytem charge = 0.0 water num= 56... Add ions : NA : 15 CL : 15 gmx genion -s genion_1y0m_ion.tpr -p 1y0m_ion.top -o 1y0m_ion.gro -np 15 -pname NA -nn 15 -nname CL >>> prot.em(out_folder=TEST_OUT+'/add_ions/em_SH3_water_ions/', nsteps=10, constraints="none") - Create the tpr file 1y0m.tpr gmx grompp -f 1y0m.mdp -c ../top_SH3_water_ions/1y0m_ion.gro -r ../top_SH3_water_ions/1y0m_ion.gro -p ../top_SH3_water_ions/1y0m_ion.top -po out_1y0m.mdp -o 1y0m.tpr -maxwarn 1 - Launch the simulation 1y0m.tpr gmx mdrun -s 1y0m.tpr -deffnm 1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright
Note
If
name
is not defined, the command will create a new .pdb and .top file name after the object name and adding “_ion”.Note
There might be some charge issues with amber forcefield for example. There is a discrepency between the atom charge and the total charge column with amber. In the itp charge is chown with a 2 decimal precision as in the rtp file it can be up to 5 decimals. Should consider using the total charge to deduce the atom charge and avoid errors. Up to now it has been fixed using round function instead of int for system charge
- add_mdp(mdp_template, mdp_options, folder_out='', check_file_out=True)
Create the MD simulation input mdp file from a template.
Read a template mdp file and replace define fields in mdp_options with the new value. In case the field name has a ‘-’ , repalce it by : ‘_’.
- Parameters
mdp_template (str) – mdp file template
mdp_options (dict) – New parameters to use
folder_out (str, default="") – Path for output file
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.sim_name
Object field(s) changed:
self.mdp
- add_ndx(ndx_cmd_input, ndx_name=None, folder_out='', check_file_out=True)
Create a ndx file using
gmx make_ndx
- Parameters
ndx_cmd_input (str) – Input arguments for
gmx make_ndx
ndx_name (str, default=None) – output name for the index file
folder_out (str, default="") – Path for output file
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
Object field(s) changed:
self.ndx
Note
If name is not defined, will use the name of the object.
- add_top(out_folder, name=None, ff='charmm36-jul2017', water='tip3p', check_file_out=True, pdb2gmx_option_dict={}, input_pdb2gmx='', posre_post='')
Launch the pdb2gmx command.
The objet variable self.coor_file has to be defined before launching this function.
pdb2gmx
will create a new coordinate filename+"_pdb2gmx.pdb"
, a topologiename+"_pdb2gmx.top"
and several molecule itp and posre files. If name is not defined, it will use the object name.- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
ff (str, optional, default="charmm36") – forcefield
water (str, optional, default="tip3p") – water model
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
pdb2gmx_option_dict (dict, optional, default=None) – dictionnary of option for pdb2gmx, for example if you want to ignore input hydrogens use:
{'ignh': None}
. The ‘-’ before the option is to avoid.input_pdb2gmx (str, optional, default=None) – input for pdb2gmx request
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> #Basic usage : >>> prot.add_top(out_folder=TEST_OUT+'/add_top/top_SH3') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> ######################################### >>> # Use of different options for pdb2gmx: # >>> ######################################### >>> # Ignore hydrogens: 'ignh': None >>> # Define amino acid termini: 'ter': None >>> # Needs to answer pdb2gmx request concerning termini >>> # with: input_pdb2gmx ="1 \n 0" >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/add_top/top_SH3_2/', ... pdb2gmx_option_dict={'ignh': None, 'ter': None}, ... input_pdb2gmx="1 \n 0") - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 -ignh -ter Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top
Note
To avoid conflict with focefields, the environment variable
$GMXLIB
is change toGROMACS_MOD_DIRNAME+"/template/"
where curently only charmm36 is present, if you want to use another forcefield, copy your forcefield folder inGROMACS_MOD_DIRNAME+"/template/"
, or change the current code.
- add_tpr(name, r=None, po=None, folder_out='', check_file_out=True, **grompp_options)
Create a tpr file using
gmx grompp
.- Parameters
name (str) – name of the simulation
r (str, default=None) – reference coordinate file for position restraints
po (str, default=None) – output file for the mdp file
folder_out (str, default="") – Path for output file
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
**grompp_options – Optional arguments for
gmx grompp
Object requirement(s):
self.mdp
self.coor_file
self.top_file
Object optional requirement(s):
self.ndx
Object field(s) changed:
self.tpr
- center_mol_box(sele_dict={'name': ['N', 'C', 'O', 'CA', 'CB', 'CG', 'CG1', 'CG2', 'SG', 'OG', 'OG1', 'CD', 'CD1', 'CD2', 'OD1', 'OD2', 'SD', 'ND1', 'CE', 'CE1', 'CE2', 'CE3', 'OE1', 'OE2', 'NE', 'NE1', 'NE2', 'OH', 'CZ', 'CZ2', 'CZ3', 'NZ', 'NH1', 'NH2', "O5'", "C5'", "C4'", "O4'", "C1'", 'N1', 'C6', 'CG2', 'C5', 'C4', 'N4', 'N3', 'C2', 'O2', "C3'", "C2'", "O3'", 'P', 'O1P', 'O2P', 'N9', 'C8', 'N7', 'O6', 'N2', 'C7', 'N6', 'O4'], 'res_name': ['GLY', 'HIS', 'HSP', 'HSE', 'HSD', 'HIP', 'HIE', 'HID', 'ARG', 'LYS', 'ASP', 'ASPP', 'ASN', 'GLU', 'GLUP', 'GLN', 'SER', 'THR', 'ASN', 'GLN', 'CYS', 'SEC', 'PRO', 'ALA', 'ILE', 'PHE', 'TYR', 'TRP', 'VAL', 'LEU', 'MET', 'DA5', 'DA3', 'DAN', 'DA', 'DT5', 'DT3', 'DTN', 'DT', 'DC5', 'DC3', 'DCN', 'DC', 'DG5', 'DG3', 'DGN', 'DG', 'RA5', 'RA3', 'RAN', 'RA', 'RU5', 'RU3', 'RUN', 'RU', 'RC5', 'RC3', 'RCN', 'RC', 'RG5', 'RG3', 'RGN', 'RG']}, traj=False, ref_coor=None, **cmd_args)
Center a sytem on a selection of residue
- Parameters
res_list (str) – List of residues
- static concat_coor(*coor_in_files, pdb_out, check_file_out=True)
Concat a list of coordinates file in one coordinate file:
- Parameters
coor_in_files (list of str) – list of pdb/gro files
pdb_out (str) – file to save the concat structure
- Returns
name of the new pdb file
- Return type
str
Note
This function does not use or affect the GmxSys object.
- concat_edr(*edr_files_list, concat_edr_out, check_file_out=True)
Concat a list of energy file in one energy file:
- Parameters
xtc_in_files (list of str) – list of edr files
concat_edr_out (str) – file to save the concat energy
Object field(s) changed:
self.edr
- concat_traj(*xtc_files_list, concat_traj_out, check_file_out=True)
Concat a list of trajectory file in one trajectory file:
- Parameters
xtc_in_files (list of str) – list of xtc files
concat_traj_out (str) – file to save the concat trajectory
Object field(s) changed:
self.xtc
- convert_selection_to_index(selection_list)
Convert selection list with selection name eg. [“System”] to the index number eg. [“0”].
- Parameters
selection_list (list) – List of selection names
- Returns
list of selection numbers
- Return type
list
- convert_trj(name=None, ur='compact', pbc='mol', select='System', traj=True, specific_coor_out=None, check_file_out=True, tpr=None, **cmd_args)
Convert a trajectory or coordinate file using the commande
gmx trjconv
.This is specially usefull when the protein is break across pbc. Using
convert_trj()
with default parameters will fix it.- Parameters
name (str, optional, default=None) – generic name of the system
ur (str, default="compact") – unit-cell representation (“rect”, “tric”, “compact”)
pbc (str, default="mol") – PBC treatment (“none”, “mol”, “res”, “atom”, “nojump”, “cluster”, “whole”)
select (str, default="System") – group for output
specific_coor_out (str, optional, default=None) – specific output file
traj (bool, default=True) – Flag to convert trajectory or coordinates
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
cmd_args – Optional arguments for
gmx trjconv
Object requirement(s):
self.tpr
self.coor_file or self.xtc
Object field(s) changed:
self.coor_file or self.xtc
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/convert_trj/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.create_box() - Create pbc box gmx editconf -f .../convert_trj/top_SH3/1y0m_pdb2gmx.pdb -o .../convert_trj/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 >>> prot.solvate_box(out_folder=TEST_OUT+'/convert_trj/top_SH3_water/') - Solvate the pbc box Copy topologie file and dependancies >>> prot.em(out_folder=TEST_OUT+'/convert_trj/em_SH3_water/', nsteps=10, constraints="none") - Create the tpr file 1y0m.tpr gmx grompp -f 1y0m.mdp -c ../top_SH3_water/1y0m_water.pdb -r ../top_SH3_water/1y0m_water.pdb -p ../top_SH3_water/1y0m_water.top -po out_1y0m.mdp -o 1y0m.tpr -maxwarn 1 - Launch the simulation 1y0m.tpr gmx mdrun -s 1y0m.tpr -deffnm 1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright >>> prot.convert_trj(traj=False) - Convert trj/coor gmx trjconv -f .../convert_trj/em_SH3_water/1y0m.gro -o .../convert_trj/em_SH3_water/1y0m_compact.pdb -s .../convert_trj/em_SH3_water/1y0m.tpr -ur compact -pbc mol
Note
If
name
is not defined, the command will create a new pdb file name after the input one and adding “_compact.pdb” or “_compact.xtc”. Ifname
is defined the pdb filed will be saved in the same directory as input file, the “_compact.pdb” or “_compact.xtc” will be added toname
.
- property coor_file
- copy_box(nbox, name=None, check_file_out=True, renumber=False, **cmd_args)
Copy images of a given corrdinates in x, y, and z directions using
gmx genconf
.nbox needs a list of 3 string for number x,y,z dimensions copy
This is specially usefull when the protein is break across pbc. Using
convert_trj()
with default parameters will fix it.- Parameters
nbox (list of string) – list of 3 string for number of x, y, z dimensions copy
name (str, optional, default=None) – generic name of the system
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
cmd_args – Optional arguments for
gmx genconf
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/copy_box/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.create_box() - Create pbc box gmx editconf -f .../copy_box/top_SH3/1y0m_pdb2gmx.pdb -o .../copy_box/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 >>> prot.copy_box(nbox=[4,1,1]) - Copy pbc box using genconf
Note
If
name
is not defined, the command will create a new pdb file name after the input one and adding “_copy_box.pdb”. Ifname
is defined the pdb filed will be saved in the same directory as input file, “_copy_box.pdb” will be added toname
.
- create_box(name=None, dist=1.0, box_type='dodecahedron', check_file_out=True)
Create pbc box using
gmx editconf
- Parameters
name (str, optional, default=None) – generic name of the system
dist (float, default=1.0) – Distance between the solute and the box (nm)
box_type (str, default="dodecahedron") – Box type (“triclinic”, “cubic”, “dodecahedron”, “octahedron”)
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/create_box/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.create_box() - Create pbc box gmx editconf -f .../create_box/top_SH3/1y0m_pdb2gmx.pdb -o .../create_box/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.0
Note
If
name
is not defined, the command will create a new pdb file name after the input one and adding “_box.pdb”. Ifname
is defined the pdb filed will be saved in the same directory as input file, the “_box.pdb” will be added toname
.
- create_itp_atomtype_ion_octa_dummy(atomtypes, ion_name=['MN', 'ZN'])
Forcefield A and B values taken from : Duarte et al. 2014 J. Phys. Chem. B
https://en.wikipedia.org/wiki/Lennard-Jones_potential
\(A = 4 \epsilon \sigma^{12}\)
\(B = 4 \epsilon \sigma^6\)
\(\sigma = \sqrt[6]{\frac{A}{B}}\)
\(\epsilon = \frac{B^2}{4A}\)
ion_name=[‘NI’, ‘CO’, ‘ZN’, ‘MN’, ‘FE’, ‘MG’, ‘CA’]
; MM 171 35 ; D 0.05 0 ; ; MN ; C12, C6 = 171**2, 35**2 ; sigma = (C12/C6)**(1/6) = 1.697 A = 0.1697 nm ; eps = C6**2/(4*C12) = 12.829 Kcal mol-1 = 418.4 KJ mol -1 ; ; DMN ; C12, C6 = 0, 35**2
; MN 25 36.938000 0.000 A 0.1697 12.829 ; Gromacs unit is : kJ mol−1 nm−2 kb = kb_cal_A * 4.184 * 100
; Aqvist and Warshel JACS 1990 ; ; MM 145 25 ; D 0 0 ; Kb = 1600 (kcal mol−1Å−2) and Kθ = 250 (kcal mol−1rad−2) and ; no bond between dummies. ; C12, C6 = 145**2, 25**2 ; sigma = (C12/C6)**(1/6) = 1.7967 A = 0.17967 nm ; eps = C6**2/(4*C12) = 4.645 Kcal mol-1 = 19.4337 KJ mol -1 ; MN 25 36.938000 0.000 A 0.17967 19.4337
- create_itp_ion_octa_dummy(atomtypes, ion_name=['MN', 'ZN'])
- create_mdp(mdp_options, folder_out='', check_file_out=True)
Create the MD simulation input mdp file.
- Parameters
mdp_options (dict) – New parameters to use
folder_out (str, default="") – Path for output file
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.sim_name
Object field(s) changed:
self.mdp
- create_peptide(sequence, out_folder, N_ter='None', C_ter='COOH', em_nsteps=1000, equi_nsteps=10000, posre_post='_pep', vsite='none')
Create a linear peptide structure and topologie:
- Create a peptide with pymol with one more residue G at the
beginning of the peptide. This residue will then be change to an ACE. NH2 terminaison raise some issue with virtual sites and cannot be used.
Create the topologie using
add_top()
Minimise the structure using
em()
Do a vacuum equilibration of the peptide using
run_md_sim()
- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
ion_C (float, optional, default=0.15) – ionic concentraton (Molar)
vsite (str, optional, default="none") – option for topologie’s bonds constraints (“none”, “hydrogens”, “all”)
Object requirement(s):
None
Object field(s) changed:
self.coor_file
self.top_file
- Example
> pep = GmxSys(name='SAM_pep') > pep.create_peptide(sequence='SAM', out_folder=os.path.join(str(TEST_OUT), 'peptide'), em_nsteps=10, equi_nsteps=10, vsite='hydrogens') -Make peptide: SAM residue name:X residue name:S residue name:A residue name:M Succeed to save file .../peptide/SAM.pdb - Create topologie gmx pdb2gmx -f ../SAM.pdb -o SAM_pdb2gmx.pdb -p SAM_pdb2gmx.top -i SAM_posre.itp -water tip3p -ff charmm36-jul2017 -ignh -ter -vsite hydrogens Molecule topologie present in SAM_pdb2gmx.top , extract the topologie in a separate file: SAM_pdb2gmx.itp Protein_chain_P - ITP file: SAM_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_P Rewrite topologie: SAM_pdb2gmx.top - Create pbc box gmx editconf -f .../peptide/00_top/SAM_pdb2gmx.pdb -o .../peptide/00_top/SAM_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 - Create the tpr file SAM_pep.tpr gmx grompp -f SAM_pep.mdp -c ../00_top/SAM_pdb2gmx_box.pdb -r ../00_top/SAM_pdb2gmx_box.pdb -p ../00_top/SAM_pdb2gmx.top -po out_SAM_pep.mdp -o SAM_pep.tpr -maxwarn 1 - Launch the simulation SAM_pep.tpr gmx mdrun -s SAM_pep.tpr -deffnm SAM_pep -nt 0 -ntmpi 0 -nsteps -2 -nocopyright - Create the tpr file equi_vacuum_SAM.tpr gmx grompp -f equi_vacuum_SAM.mdp -c ../01_mini/SAM_pep.gro -r ../01_mini/SAM_pep.gro -p ../00_top/SAM_pdb2gmx.top -po out_equi_vacuum_SAM.mdp -o equi_vacuum_SAM.tpr -maxwarn 1 - Launch the simulation equi_vacuum_SAM.tpr gmx mdrun -s equi_vacuum_SAM.tpr -deffnm equi_vacuum_SAM -nt 0 -ntmpi 0 -nsteps -2 -nocopyright
Warning
The peptide function won’t work with gromacs version above 2018. There is issues with COOH C-temini, see: https://redmine.gromacs.org/issues/3301 Use another C-ter or use a previous version of gromacs.
- cyclic_peptide_top(out_folder, name=None, check_file_out=True, ff='charmm36-jul2017')
Prepare a topologie for a cyclic peptide
1. Create a peptide topologie with NH3+ Cter and COO- Nter using
add_top()
. 2. Delete useless termini atoms. 3. Change atom types, names and charges. 4. Add backbone bonds, angle and dihedral parameters. 5. Finally compute the topologie with pdb2gmx add_top()- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
Note
No options are allowed (water model, termini capping) except for vsites.
Warning
Has not been tested with special residues like GLY or PRO !!
- display()
Display defined attribute of the GmxSys object.
- display_history()
Show all history
- property edr
- em(out_folder, name=None, posres='', create_box_flag=False, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, maxwarn=1, **mdp_options)
Minimize a system.
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
nsteps (int, default=1000) – number of minimisation steps
posres (str, default="") – option for the
define
variable in the mdp file, need to be define to have postion restraints.create_box_flag – flag to create or not a box to the input coor file.
maxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionmdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- em_2_steps(out_folder, name=None, no_constr_nsteps=1000, constr_nsteps=1000, posres='', create_box_flag=False, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, maxwarn=1, **mdp_options)
Minimize a system in two steps:
minimisation without bond constraints
minimisation using bond constraint for bonds involving hydrogen
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
no_constr_nsteps (int, default=1000) – number of minimisation steps in the first step
constr_nsteps (int, default=1000) – number of minimisation steps in the second step
posres (str, default="") – option for the
define
variable in the mdp file, need to be define to have postion restraints.create_box_flag (bool, optional, default=False) – flag to create or not a box to the input coor file.
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionmaxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
mdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- em_CG(out_folder, name=None, nsteps=500000, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, **mdp_options)
Equilibrate a system a CG system:
1. equilibration of nsteps_HA with position restraints on Heavy Atoms with dt = dt_HA 2. equilibration of nsteps_CA with position restraints on Carbon Alpha with dt = dt 3. equilibration of nsteps_CA_LOW with position restraints on Carbon Alpha with Low restraints with dt = dt
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
pdb_restr (str, default=None) – reference coordinate file for position restraints
nsteps (int, default=100000) – number of equilibration steps with BB constraints
dt (float, default=0.002) – integration time step for BB equilibration
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionmdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- em_equi_three_step_iter_error(out_folder, name=None, no_constr_nsteps=1000, constr_nsteps=1000, pdb_restr=None, nsteps_HA=100000, nsteps_CA=200000, nsteps_CA_LOW=400000, dt=0.002, dt_HA=0.001, maxwarn=0, iter_num=3, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, vsite='none', **mdp_options)
Minimize a system in 2 steps:
minimisation without bond constraints
minimisation using bond constraint for bonds involving hydrogen
Equilibrate a system in 3 steps:
1. equilibration of nsteps_HA with position restraints on Heavy Atoms with dt = dt_HA 2. equilibration of nsteps_CA with position restraints on Carbon Alpha with dt = dt 3. equilibration of nsteps_CA_LOW with position restraints on Carbon Alpha with Low restraints with dt = dt
In case this process will crash (eg. LINCS WARNING …), the process will be rerun for iter_num time.
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
no_constr_nsteps (int, default=1000) – number of minimisation steps in the first step
constr_nsteps (int, default=1000) – number of minimisation steps in the second step
pdb_restr (str, default=None) – reference coordinate file for position restraints
nsteps_HA (int, default=100000) – number of equilibration steps with HA constraints
nsteps_CA (int, default=200000) – number of equilibration steps with CA constraints
nsteps_CA_LOW (int, default=400000) – number of equilibration steps with CA_LOW constraints
dt_HA (float, default=0.001) – integration time step for HA equilibration
dt (float, default=0.002) – integration time step for CA and CA_LOW equilibration
maxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionvsite (str, optional, default="none") – option for bonds constraints (“none”)
mdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- equi_CG(out_folder, name=None, pdb_restr=None, nsteps=500000, dt=0.02, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, **mdp_options)
Equilibrate a system a CG system:
1. equilibration of nsteps_HA with position restraints on Heavy Atoms with dt = dt_HA 2. equilibration of nsteps_CA with position restraints on Carbon Alpha with dt = dt 3. equilibration of nsteps_CA_LOW with position restraints on Carbon Alpha with Low restraints with dt = dt
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
pdb_restr (str, default=None) – reference coordinate file for position restraints
nsteps (int, default=100000) – number of equilibration steps with BB constraints
dt (float, default=0.002) – integration time step for BB equilibration
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionmdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- equi_three_step(out_folder, name=None, pdb_restr=None, nsteps_HA=100000, nsteps_CA=200000, nsteps_CA_LOW=400000, dt=0.002, dt_HA=0.001, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, vsite='none', **mdp_options)
Equilibrate a system in 3 steps:
1. equilibration of nsteps_HA with position restraints on Heavy Atoms with dt = dt_HA 2. equilibration of nsteps_CA with position restraints on Carbon Alpha with dt = dt 3. equilibration of nsteps_CA_LOW with position restraints on Carbon Alpha with Low restraints with dt = dt
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
pdb_restr (str, default=None) – reference coordinate file for position restraints
nsteps_HA (int, default=100000) – number of equilibration steps with HA constraints
nsteps_CA (int, default=200000) – number of equilibration steps with CA constraints
nsteps_CA_LOW (int, default=400000) – number of equilibration steps with CA_LOW constraints
dt_HA (float, default=0.001) – integration time step for HA equilibration
dt (float, default=0.002) – integration time step for CA and CA_LOW equilibration
maxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionvsite (str, optional, default="none") – option for bonds constraints (“none”)
mdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
Note
In case of LINCS warning or segmentation fault, try to center the protein in the box using the center_mol_box() function.
- extend_sim(tpr_file=None, nsteps=200000, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>})
Extend a simulation run.
- Parameters
tpr_file – path of the tpr file
nsteps (int, default=200000) – number of steps
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the function
Object requirement(s):
self.tpr
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.tpr
self.sim_name
self.coor_file
self.xtc
Warning
The simulation can only run nsteps more steps. Should be improved to check how many steps have been run, and give a total number of step to compute.
- extract_mol_sys(out_folder, res_name)
Extract a molecule topologie and coordinates from a system:
- Parameters
out_folder (str) – path of the output file folder
res_name (str) – Molecule residue name to extract
- Returns
The GmxSys of the molecule alone
- Return type
Note
This function does not use or affect the GmxSys object.
- get_all_output()
In a case of a simulation restart, outputs edr, log, gro, xvg and xtc files are called for example as
self.sim_name+".partXXXX.edr"
where XXXX is the iteration number of restart (eg. first restart: XXXX=0002).This function return a dictionnary of all edr, log, coor_file, xvg and xtc list.
Object requirement(s):
self.sim_name
- Returns
return dict containing edr, log, xtc, xvg and coor_file file list
- Return type
dict
- get_angle(angle_list, output_xvg='tmp_angle.xvg', keep_ener_file=False, improper=False)
Get angle of a traj using
gmx angle
.- Parameters
angle_list (list) – List of atom triplet
output_xvg (str, default='tmp_angle.xvg') – output .xvg file name
keep_ener_file (bool, default=False) – flag to keep or not output .xvg file.
improper (bool, default=False) – flag to compute improper angles.
- Returns
Distance table
- Return type
pd.DataFrame
- get_dist(distance_list, output_xvg='tmp_dist.xvg', keep_ener_file=False)
Get distances as a function of time for a trajectory using
gmx distance
.- Parameters
distance_list (list) – List of atom couple
output_xvg (str, default='tmp_dist.xvg') – output .xvg file name
keep_ener_file (bool, default=False) – flag to keep or not output .xvg file.
- Returns
Distance table
- Return type
pd.DataFrame
- get_ener(selection_list, output_xvg='tmp_edr.xvg', check_file_out=True, keep_ener_file=False)
Get energy of a system using
gmx energy
.- Parameters
selection_list (list) – List of selection names or number
output_xvg (str, default='tmp_edr.xvg') – output .xvg file name
check_file_out (bool, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
keep_ener_file (bool, default=False) – flag to keep or not output .xvg file.
- Returns
Energy table
- Return type
pd.DataFrame
- get_index_dict()
Read and .ndx file and return and dictionnary with keys being the group name, nad value the index.
- get_last_output()
In a case of a simulation restart, outputs edr, log, gro and xtc files are called for example as
self.sim_name+".partXXXX.edr"
where XXXX is the iteration number of restart (eg. first restart: XXXX=0002).This function actualise the edr, log, coor_file and xtc variable.
Object requirement(s):
self.sim_name
Object field(s) changed:
self.edr
self.log
self.coor_file
self.xtc
- get_mdp_dict(mdp_file=None)
Extract mdp file’s parameters and return it as a dict. By default read self.coor, but if mdp_file option is defined, it will read it.
- Parameters
mdp_file (str, default=None) – mdp file
Object requirement(s):
self.mdp
- get_rmsd(selection_list=['C-alpha', 'Protein'], output_xvg='tmp_rmsd.xvg', fit='rot+trans', pbc='no', ref_sys=None, keep_ener_file=False)
Get RMSD of a system using
gmx rms
.- Parameters
selection_list (list, default=['C-alpha', 'Protein']) – List of selection names or number
output_xvg (str, default='tmp_rmsd.xvg') – output .xvg file name
fit (str, default="rot+trans") – Coordinates Fitting Method
pbc (str, default="no") – Peridic Boundary condition treatment
keep_ener_file (bool, default=False) – flag to keep or not output .xvg file.
ref_sys (GmxSys, default=None) – reference system for RMSD calculation
- Returns
RMSD table
- Return type
pd.DataFrame
- get_rmsf(selection_list, output_xvg='tmp_rmsf.xvg', fit='no', res='no', keep_ener_file=False)
Get RMSF of a system using
gmx rmsf
.- Parameters
selection_list (list) – List of selection names or number
output_xvg (str, default='tmp_rmsf.xvg') – output .xvg file name
fit (str, default="no") – Flag for fitting before computing RMSF
res (str, default="no") – Residue averaging flag
keep_ener_file (bool, default=False) – flag to keep or not output .xvg file.
- Returns
RMSF table
- Return type
pd.DataFrame
- get_simulation_time()
In a case of a simulation restart simulation, one would like to know how much simulation time has already been computed to reach a certain amount of time in the restart simulation. The command will check the cpt file using
gmx check -f file.cpt
.Object requirement(s):
self.tpr
Object field(s) changed:
None
- Returns
return simulation time (ns)
- Return type
float
- insert_mol_sys(mol_gromacs, mol_num, new_name, out_folder, check_file_out=True)
Insert a new molecule in a system:
Insert structure and topologie of
mol_num
copy ofmol_gromacs
molecule, in the system with 6 successive steps:Copy the molecule
mol_num
time.- Change the chain ID of mol_gromacs to “Y”, this step is necessary
for vmd to recognize the inserted mol.
Concat the two structure.
Insert the molecule in the solvant with a vmd script.
Update the topologie with the molecule and new water number.
If the charge is not null add ions to neutralize the system.
- Parameters
mol_gromacs (GmxSys object) – molecule object to be inserted
mol_num (int) – molecule number to be inserted
new_name (str) – generic name of the system
out_folder (str) – path of the output file folder
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
self.top_file
Object field(s) changed:
self.coor_file
self.top_file
Note
VMD don’t need anymore to be installed to run the peptide creation
- property log
- property mdp
- property ndx
- prepare_top(out_folder, name=None, vsite='none', ignore_ZN=True, ff='charmm36-jul2017', ph=7.0, res_prot_dict=None, include_mol={})
Prepare the topologie of a protein:
compute hisdine protonation with
pdb2pqr
.Change Histidine resname according to the protonation.
Correct cystein resname.
Correct chain ID’s.
- Zinc Finger: Add Zinc in the pdb and change residue type of
CYS and HIS coordinating the Zinc.
Finally compute the topologie with pdb2gmx add_top().
- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
vsite (str, optional, default="none") – option for topologie’s bonds constraints (“none”, “hydrogens”, “aromatics”)
ignore_ZN (bool, optional, default=False) – option for not adding parameters to ZINC finger
ff (str, optional, default="charmm36-jul2017") – forcefield
ph (float, optional, default=7.0) – pH to assign AA protonation (using pdb2pqr)
res_prot_dict (dict, optional, default=None) – option to define manually protonation
include_mol (list, optional, default=[]) – list of ligand’s residue name to include
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> # Create the topologie of a protein and do a minimisation: >>> dna_lig = GmxSys(name='1D30', coor_file=TEST_PATH+'/1D30.pdb') >>> dna_lig.prepare_top(out_folder=TEST_OUT+'/prepare_top/top_dna/', ff='amber99sb-ildn', include_mol={'DAP':'NC(=N)c1ccc(cc1)c2[nH]c3cc(ccc3c2)C(N)=N'}) Succeed to read file .../test_files/1D30.pdb , 532 atoms found Succeed to read file .../test_files/1D30.pdb , 532 atoms found Succeed to read file .../test_files/1D30.pdb , 532 atoms found Succeed to save file 00_1D30.pqr Succeed to read file 00_1D30.pqr , 486 atoms found Succeed to read file .../test_files/1D30.pdb , 532 atoms found Succeed to save file DAP.pdb Succeed to read file DAP.pdb , 21 atoms found Succeed to save file DAP_0.pdb Succeed to read file DAP_0.pdb , 21 atoms found Succeed to read file DAP_0_h.pdb , 36 atoms found Succeed to save file DAP_0_h.pdb Succeed to read file DAP_0_h.pdb , 36 atoms found Succeed to save file DAP_0_h.pdb Succeed to save concat file: DAP_h.pdb Succeed to read file DAP_h.pdb , 36 atoms found Succeed to save file DAP_h_unique.pdb acpype... -i DAP_h_unique.pdb -b DAP -c bcc -a gaff -o gmx -n 0 Succeed to save file 01_1D30_good_his.pdb - Create topologie gmx pdb2gmx -f 01_1D30_good_his.pdb -o 1D30_pdb2gmx.pdb -p 1D30_pdb2gmx.top -i 1D30_posre.itp -water tip3p -ff amber99sb-ildn -ignh -vsite none Add Molecule: DAP Add 1 mol .../top_dna/DAP.acpype/DAP_GMX.itp Concat files: ['1D30_pdb2gmx.pdb', '.../top_dna/DAP_h.pdb'] Succeed to save concat file: 1D30_pdb2gmx_mol.pdb >>> dna_lig.em(out_folder=TEST_OUT + '/prepare_top/em_dna', nsteps=10, create_box_flag=True, maxwarn=1) - Create pbc box gmx editconf -f .../top_dna/1D30_pdb2gmx_mol.pdb -o .../top_dna/1D30_pdb2gmx_mol_box.pdb -bt dodecahedron -d 1.0 - Create the tpr file 1D30.tpr gmx grompp -f 1D30.mdp -c .../top_dna/1D30_pdb2gmx_mol_box.pdb -r .../top_dna/1D30_pdb2gmx_mol_box.pdb -p .../top_dna/1D30_pdb2gmx_mol.top -po out_1D30.mdp -o 1D30.tpr -maxwarn 1 - Launch the simulation 1D30.tpr gmx mdrun -s 1D30.tpr -deffnm 1D30 -nt 0 -ntmpi 0 -nsteps -2 -nocopyright >>> lig = dna_lig.extract_mol_sys(out_folder=TEST_OUT+'/prepare_top/top_DAP/', res_name='DAP') - Convert trj/coor gmx trjconv -f ...1D30.gro -o ...1D30_compact.pdb -s ...1D30.tpr -ur compact -pbc mol Succeed to read file ...1D30_compact.pdb , 794 atoms found Succeed to save file ...DAP_only.pdb Forcefield include : amber99sb-ildn - ITP file: DAP_GMX_atomtypes - molecules defined in the itp file: - ITP file: tip3p - molecules defined in the itp file: * SOL - ITP file: DAP_GMX - molecules defined in the itp file: * DAP Mol List: * 1 DAP Mol Name: Protein >>> lig.create_box() - Create pbc box gmx editconf -f ...DAP_only.pdb -o ...DAP_only_box.pdb -bt dodecahedron -d 1.0 >>> lig.solvate_box(out_folder=TEST_OUT + '/prepare_top/water_lig_top') - Solvate the pbc box Copy topologie file and dependancies >>> lig.em(out_folder=TEST_OUT + '/prepare_top/em_water_DAP', nsteps=10, maxwarn=1) - Create the tpr file DAP.tpr gmx grompp -f DAP.mdp -c ...DAP_water.pdb -r ...DAP_water.pdb -p ...DAP_water.top -po out_DAP.mdp -o DAP.tpr -maxwarn 1 - Launch the simulation DAP.tpr gmx mdrun -s DAP.tpr -deffnm DAP -nt 0 -ntmpi 0 -nsteps -2 -nocopyright
Note
No options are allowed (forcefield, water model, termini capping) except for vsites.
- prepare_top_ligand(out_folder, name=None, ff='amber99sb-ildn', water_model='tip3p', include_mol={})
Prepare the topologie of a ligand:
- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
ff (str, optional, default="amber99sb-ildn") – forcefield
include_mol (list, optional, default=[]) – list of ligand’s residue name to include
Object requirement(s):
self.coor_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> # Create the topologie of a protein and do a minimisation: >>> lig = GmxSys(name='1D30', coor_file=TEST_PATH+'/1D30.pdb')
Note
Starting file need to be a pdb, this should be changed.
- prod_CG(out_folder, name=None, nsteps=5000000, dt=0.02, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, **mdp_options)
Equilibrate a system a CG system:
1. equilibration of nsteps_HA with position restraints on Heavy Atoms with dt = dt_HA 2. equilibration of nsteps_CA with position restraints on Carbon Alpha with dt = dt 3. equilibration of nsteps_CA_LOW with position restraints on Carbon Alpha with Low restraints with dt = dt
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
nsteps (int, default=100000) – number of equilibration steps with BB constraints
dt (float, default=0.002) – integration time step for BB equilibration
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionmdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- production(out_folder, name=None, nsteps=400000, dt=0.002, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>}, vsite='none', **mdp_options)
Run a production run.
- Parameters
out_folder (str) – path of the output file folder
name (str, default=None) – name of the simulation to run
nsteps (int, default=400000) – number of minimisation steps
dt (float, default=0.002) – number of minimisation steps
maxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the functionvsite (str, optional, default="none") – option for topologie’s bonds constraints (“none”, “hydrogens”, “all”)
mdp_options (dict) – Additional mdp parameters to use
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- run_md_sim(out_folder, name, mdp_template, mdp_options, pdb_restr=None, maxwarn=0, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>})
Run a simulation using 3 steps:
Create a mdp file
Create a tpr file using
gmx grompp
Launch the simulation using
gmx mdrun
- Parameters
out_folder (str) – path of the output file folder
name (str) – name of the simulation to run
mdp_template (str) – mdp file template
mdp_options (dict) – New parameters to use
pdb_restr (str, default=None) – reference coordinate file for position restraints
maxwarn (int, default=0) – Maximum number of warnings when using
gmx grompp
monitor (dict, default=None) – option to monitor a simulation, if not none monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the function
Object requirement(s):
self.coor_file
self.top_file
self.nt
self.ntmpi
self.gpu_id
Object field(s) changed:
self.mdp
self.tpr
self.coor_file
self.xtc
- run_simulation(check_file_out=True, cpi=None, nsteps=-2, rerun=False, monitor_tool={'file_check_ext': 'log', 'function': <function progress_bar>})
Launch the simulation using
gmx mdrun
- Parameters
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
cpi (str, default=None) – checkpoint file, if defined, it will restart a simulation and run
nsteps
.nsteps (int, default=-2) – Number of steps to run, (-2 : will use mdp parameter)
rerun (bool, default=False) – option to rerun a simulation (eg. recompute energy)
monitor_tool (dict, default=None) – option to monitor a simulation, if not None, monitor should contains two values:
function
the function to be ran while simulation is running andinput
parameters for the function.
Object requirement(s):
self.tpr
self.sim_name
self.nt
self.ntmpi
self.gpu_id
Additional requirement(s) for rerun:
self.xtc
Object field(s) changed:
self.coor_file
self.xtc
self.edr
self.log
Note
The function must be launched in the path where the tpr is present.
Note
If cpi file is defined the simulation will restart with the
-noappend
option, if cpi is not defined, but the .cpt file exist, it will restart with “append”.
- save_state()
Save last state
- static set_coor_aa_prot(coor_in, res_prot_dict, ff)
Set manually residue protonation.
- Parameters
coor_in (Coor) – coordinate to update
res_prot_dict (dict) – Dictionary of protonated residues
ff (str) – forcefield
- solvate_add_ions(out_folder, name=None, ion_C=0.15, create_box_flag=True, box_dist=1.1, radius=0.25, maxwarn=1)
Solvate a system with three succesive steps:
Create box using
create_box()
Add water using
solvate_box()
Add ions using
add_ions()
- Parameters
out_folder (str) – path of the output file folder
name (str, optional, default=None) – generic name of the system
ion_C (float, optional, default=0.15) – ionic concentraton (Molar)
Object requirement(s):
self.coor_file
self.top_file
Object field(s) changed:
self.coor_file solvate_box
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/solvate_add_ions/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.solvate_add_ions(out_folder=TEST_OUT+'/solvate_add_ions/top_SH3_water_ions/') - Create pbc box gmx editconf -f .../solvate_add_ions/top_SH3/1y0m_pdb2gmx.pdb -o .../solvate_add_ions/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.1 - Solvate the pbc box Copy topologie file and dependancies Copy topologie file and dependancies - Create the tpr file genion_1y0m_water_ion.tpr gmx grompp -f .../template/mini.mdp -c 1y0m_water.pdb -r 1y0m_water.pdb -p 1y0m_water_ion.top -po out_mini.mdp -o genion_1y0m_water_ion.tpr -maxwarn 1 - Add ions to the system with an ionic concentration of 0.15 M , sytem charge = 0.0 water num= 62... Add ions : NA : 17 CL : 17 gmx genion -s genion_1y0m_water_ion.tpr -p 1y0m_water_ion.top -o 1y0m_water_ion.gro -np 17 -pname NA -nn 17 -nname CL >>> prot.em(out_folder=TEST_OUT+'/solvate_add_ions/em_SH3_water_ions/', nsteps=10, constraints = "none") - Create the tpr file 1y0m.tpr gmx grompp -f 1y0m.mdp -c ../top_SH3_water_ions/1y0m_water_ion.gro -r ../top_SH3_water_ions/1y0m_water_ion.gro -p ../top_SH3_water_ions/1y0m_water_ion.top -po out_1y0m.mdp -o 1y0m.tpr -maxwarn 1 - Launch the simulation 1y0m.tpr gmx mdrun -s 1y0m.tpr -deffnm 1y0m -nt 0 -ntmpi 0 -nsteps -2 -nocopyright
Note
If
name
is not defined, it will use the object name.
- solvate_box(out_folder, name=None, radius=0.21, cs='share/gromacs/top/spc216.gro', check_file_out=True)
Solvate the pbc box with water or another mol defined with
cs
using thegmx solvate
command.- Parameters
out_folder (str) – path of the output file folder
name (float, optional, default=0.21) – generic name of the system
radius – default van der Waals distance (nm)
cs (str, optional, default=``WATER_GRO``) – solvant coordinate file
check_file_out (bool, optional, default=True) – flag to check or not if file has already been created. If the file is present then the command break.
Object requirement(s):
self.coor_file
self.top_file
Object field(s) changed:
self.coor_file
self.top_file
- Example
>>> TEST_OUT = getfixture('tmpdir') >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> prot.add_top(out_folder=TEST_OUT+'/solv_box/top_SH3/') - Create topologie gmx pdb2gmx -f .../test_files/1y0m.pdb -o 1y0m_pdb2gmx.pdb -p 1y0m_pdb2gmx.top -i 1y0m_posre.itp -water tip3p -ff charmm36-jul2017 Molecule topologie present in 1y0m_pdb2gmx.top , extract the topologie in a separate file: 1y0m_pdb2gmx.itp Protein_chain_A - ITP file: 1y0m_pdb2gmx.itp - molecules defined in the itp file: * Protein_chain_A Rewrite topologie: 1y0m_pdb2gmx.top >>> prot.create_box() - Create pbc box gmx editconf -f .../solv_box/top_SH3/1y0m_pdb2gmx.pdb -o .../solv_box/top_SH3/1y0m_pdb2gmx_box.pdb -bt dodecahedron -d 1.0 >>> prot.solvate_box(out_folder=TEST_OUT+'/solv_box/top_SH3_water/') - Solvate the pbc box Copy topologie file and dependancies
Note
If
name
is not defined, the command will create a new .pdb and .top file name after the object name and adding “_water”.
- switch_ion_octa_dummy(ion_name=['MN', 'ZN'])
- property top_file
- property tpr
- view_coor()
Return a nglview object to view the object coordinates in a jupyter notebook with the module
nglview
.- Example
>>> import nglview as nv >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> view = prot.view_coor() >>> view
- view_traj()
Return a nglview object to view the object trajectorie in a jupyter notebook with the module
nglview
.- Example
>>> import nglview as nv >>> prot = GmxSys(name='1y0m', coor_file=TEST_PATH+'/1y0m.pdb') >>> view = prot.view_traj() >>> view
Note
This function has a dependencies with the
simpletraj
a lightweight coordinate-only trajectory reader. Install it usingpip install simpletraj
orconda install simpletraj
.
- property xtc
- property xvg
- gromacs_py.gmx.gmxsys.show_debug(pdb_manip_log=True)
To use only with Doctest !!! Redirect logger output to sys.stdout
- gromacs_py.gmx.gmxsys.show_log(pdb_manip_log=True)
To use only with Doctest !!! Redirect logger output to sys.stdout
gromacs_py.gmx.itp module
- class gromacs_py.gmx.itp.Itp(name, fullname, path)
Bases:
object
Itp topologie in gromacs format May contain several molecule definition, so itp class is a collection of top_mol object which are indivudial molecule topologies
- add_posre(mol_name, posre_name, selec_dict, fc, replace=True)
- change_mol_name(old_name, new_name)
- charge(mol_name)
- display()
- get_include_file_list()
- read_file()
- res_num(mol_name)
- set_top_mol_name(new_name)
- write_file(itp_file)
- gromacs_py.gmx.itp.show_log()
To use only with Doctest !!! Redirect logger output to sys.stdout
- gromacs_py.gmx.itp.write_index_posre_file(atom_index_list, posre_file, type_val=1, fc=[1000, 1000, 1000])
Write a pos restraint file based on atom index list
gromacs_py.gmx.rtp module
gromacs_py.gmx.topmol module
- class gromacs_py.gmx.topmol.TopMol(name, nrexcl)
Bases:
object
Individual molecule topologie
- add_atoms(index, atom_list)
Add a list of atoms in atom_dict at an index position. Correct all indexes in bond, pairs, …
- Parameters
index (int) – index for insertion
atom_list (list) – list of atoms to add
- correct_charge_type(forcefield, index_list=None)
Correct the charge and atom type of an itp object, base on a ff .rtp file. This is specially usefull, to correct charge of termini resiudes of a cyclicized peptide.
if index_list is None, will correct all atom charges, if not, only atoms listed in index_list.
- delete_atom(index_list)
- get_charge()
- get_res_num()
- get_selection_index(selec_dict={'atom_name': ['CA']})
Return the atom index to add posre
- write_file(filout)
- gromacs_py.gmx.topmol.show_debug()
To use only with Doctest !!! Redirect logger output to sys.stdout
- gromacs_py.gmx.topmol.show_log()
To use only with Doctest !!! Redirect logger output to sys.stdout
gromacs_py.gmx.topsys module
- class gromacs_py.gmx.topsys.TopSys(top_in)
Bases:
object
Topologie base on gromacs .top : #include forcefield
All name and full path of itp are save [ system ] -> Name [ molecules ] -> Composition
- Parameters
path (str) – topologie file path
forcefield (str) – name of the focefield
itp_list (list) – list of the itp object
mol_comp (list) – molecular composition
name – name of the system
folder (str) – path of the top file folder
include_itp (bool) – Flag indicating if the topologie include a molecule topologie
- add_atomtypes(new_atomtypes)
Add atomtypes in a topologie.
- Parameters
new_atomtypes (str) – path of the atomtype itp file
- add_atomtypes_2(atomtypes_dict)
Add atomtypes in a topologie.
- Parameters
atomtypes_dict (str) – atom types dict
- add_intermolecular_restr(bond_list=[], angle_list=[], dihed_list=[])
Add inter molecular restraints in topologie file
- add_mol(mol_name, mol_itp_file, mol_num)
Add a molecule in the topologie (composition and itp_list)
- add_mol_itp(mol_itp_file)
Add a molecule itp in the topologie itp_list.
- add_posre(posre_name='POSRE_CA', selec_dict={'atom_name': ['CA']}, fc=[1000, 1000, 1000])
Add position restraint based on the selection for each itp
- change_mol_name(old_name, new_name)
- change_mol_num(mol_name, mol_num)
Update molecule number. And remove multiple molecule definition if they are consecutive.
- charge()
Get the charge of the system
- copy_dependancies(dest_folder)
- copy_top_and_dependancies(dest_file)
- display()
- get_include_file_list()
- get_include_no_posre_file_list()
- mol_num(name)
Get the number of the molecule “name”
- prot_res_num(selection='Protein')
Compute the residue number of a selection
- read_file(top_in)
- remove_ion(ion_name_list)
Remove a molecule from the topologie (composition and itp_list)
- write_file(top_out)
- gromacs_py.gmx.topsys.show_debug(pdb_manip_log=True)
To use only with Doctest !!! Redirect logger output to sys.stdout
- gromacs_py.gmx.topsys.show_log()
To use only with Doctest !!! Redirect logger output to sys.stdout
Module contents
gmx library include the gromacs system class GmxSys
, as well as
topologie TopSys
and itp.
- gromacs_py.gmx.show_debug(pdb_manip_log=True)
- gromacs_py.gmx.show_log(pdb_manip_log=True)