-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenMDMembConfg.py
106 lines (90 loc) · 5.32 KB
/
GenMDMembConfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- coding: utf-8 -*-
#//*****************************************************************************************//#
# GenSMDMembProtocol: Este módulo escreve o protcolo do smd para realizar simulações de #
# moléculas, em membrana, tais como: Proteínas ou proteina e ligando #
# #
# autor : Ropón-Palacios G., BSc - MSc estudante em Física Biomolecular. #
# afiliação : Departamento de Física, IBILCE/UNESP, São Jośe do Rio Preto, São Paulo. #
# e-mail : [email protected] #
# data : Quarta-feira 3 de Julho do 2024. #
# $rev$ : Rev Quarta-feira 3 de Julho de 2024 #
#//*****************************************************************************************//#
#// ****************************************************************************************//#
# Log mudanças no código: #
# 1. Adicionando uma classe para preparar los sistemas - Quarta feira 3 de Julho 2024. #
#// ****************************************************************************************//#
import os
import sys
import optparse
from datetime import datetime
import warnings
import time
warnings.filterwarnings("ignore")
#// ****************************************************************************************//#
# Importando meus módulos #
#// ****************************************************************************************//#
from LIB.Utils import UnixMessage
from LIB.MDProtocols.MDMembProtocol import MDProtocolMemb
#// ****************************************************************************************//#
# Configurando a informação das opções #
#// ****************************************************************************************//#
disclaimer="GenMDMembConfg Module from MSTBx"
parser = optparse.OptionParser(description=disclaimer)
inputs_group = optparse.OptionGroup(parser, "Input Options")
inputs_group.add_option("--psf", help="PSF file of your system", type=str)
inputs_group.add_option("--pdb", help="PDB file of your system", type=str)
inputs_group.add_option("--lparm", help="File in str or prm format of the ligand. Optional.", action="store",
dest="ligandparm", default=None)
parser.add_option_group(inputs_group)
outputs_group = optparse.OptionGroup(parser, "Output Options")
outputs_group.add_option("--temperature", help="Select temperature to perform the simulation in Kelvin units. Default 310 K.",
type=float, default=310, dest="temperature")
outputs_group.add_option("--mdtime", help="Select the time in nanoseconds to perform the md production.",
type=float, default=100, dest="mdtime")
parser.add_option_group(outputs_group)
options, args = parser.parse_args()
#// ****************************************************************************************//#
# Cá chamamos a MDProtocolMemb #
#// ****************************************************************************************//#
md = MDProtocolMemb(psf=options.psf, pdb=options.pdb, temperature=options.temperature, mdtime=options.mdtime)
listdirs = ["01build", "02nvt", "03npt1", "04npt2", "05md"]
uxm = UnixMessage()
UnixMessage().message(message=f"Writing the configuration files to running molecular dynamics.", type="info")
uxm.makedir(dirs=listdirs)
os.system("rm -rf 02mineq")
os.system("rm -rf 03prod")
md.copytoppar()
md.nvt()
md.npt1()
md.npt2()
md.md()
md.restraint()
time.sleep(3)
os.system("clear")
ligand = options.ligandparm
if ligand:
UnixMessage().message(message=f"Your ligand parmaters is %s" % (options.ligandparm), type="info")
os.system("cp -rv %s toppar/" % (options.ligandparm))
#if options.hmr != True: #! Então é False, como se fora off.
#hmrbool = 0
UnixMessage().message(message=f"Check out all files generates before running your simulation.", type="warning")
UnixMessage().message(message=f"Good luck with your simulation!.", type="info")
#else:
# hmrbool = 1
# sol.build(psf=options.psf, pdb=options.pdb, salt=options.salt, ofile=options.ofile, hmr=hmrbool)
# uxm = UnixMessage()
# listdirs = ["01build", "02mineq", "03prod"]
# uxm.makedir(dirs=listdirs)
# os.chdir("01build")
# os.system("cp ../*psf .")
# os.system("cp ../*pdb .")
# os.system("mv ../PSFGenSol.tcl .")
# dirt = os.path.abspath(".")
# UnixMessage().message(message=f"Working inside: {dirt}", type="info")
# os.system("vmd -dispdev text -e PSFGenSol.tcl 2>&1 | tee psfgen.log")
# time.sleep(3)
# os.system("clear")
# UnixMessage().message(message=f"The system is ready to use.", type="info")
# UnixMessage().message(message=f"Check out the psfgen.log to get more details.", type="info")
# UnixMessage().message(message=f"Review the log carefully to make sure your system has no errors.", type="warning")
# time.sleep(3)