From d4be3957906c181e4bb195ec8a1532538b0243e5 Mon Sep 17 00:00:00 2001 From: Aditya Wibawa Sakti Date: Tue, 5 Jul 2022 06:49:33 +0700 Subject: [PATCH] Fix the cmmde_solution --- bin/cmmde.py | 4 +- lib/__pycache__/cmmde_hubbard.cpython-39.pyc | Bin 804 -> 820 bytes lib/__pycache__/cmmde_orca.cpython-39.pyc | Bin 2233 -> 2331 bytes lib/cmmde_hubbard.py | 4 +- lib/cmmde_orca.py | 16 ++++--- lib/cmmde_solution.py | 45 ++++++++++--------- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/bin/cmmde.py b/bin/cmmde.py index 35850ae..90c5f64 100755 --- a/bin/cmmde.py +++ b/bin/cmmde.py @@ -60,6 +60,8 @@ parser.add_argument('-l', '--lapang', type=float, default=5, help='Panjang tamba parser.add_argument('-gen','--generate_dftbinp',type=str,default='false',help='Apakah ingin mengkonversi ke dalam format koordinat xyz?') parser.add_argument('-mp', '--pelarut', type=str, help='Nama file molekul pelarut dalam format .xyz (ditulis tanpa ekstensi).') parser.add_argument('-nequil','--nequil',type=int, default=50000, help='Jumlah step pada saat ekuilibrasi.') +parser.add_argument('-nnpt','--nnpt',type=int, default=50000, help='Jumlah step pada saat ekuilibrasi NPT.') +parser.add_argument('-comp','--compress',type=float, default=4.5e-6, help='Nilai kompresibilitas. Default=4.5e-6.') parser.add_argument('-nprod','--nprod',type=int, default=400000, help='Jumlah step pada saat production.') parser.add_argument('-prod', '--production', type=str, default='None', help='Ensembel yang digunakan dalam production run. Pilihan:nve,npt,nvt.') parser.add_argument('-cp', '--c_pelarut', type=int, default=0, help='Muatan bersih molekul pelarut') @@ -373,7 +375,7 @@ if opt.software == 'gromacs': #SBATCH --time=168:0:0 export OMP_NUM_THREADS={} cd $PWD -$GROMACS_COMMAND -mt {} -mp {} -ct {} -pt {} -pp {} -l {} -cat {} -gen {} -Nump {} -prod {} -nprod {} -nequil {} -dt {} -ctype {}""".format(opt.nproc, opt.terlarut,opt.pelarut,opt.c_terlarut,opt.persen_terlarut,opt.persen_pelarut,opt.lapang,opt.cation,opt.generate_dftbinp,opt.NumPelarut,opt.production,opt.nprod,opt.nequil,opt.deltat,opt.charge_type),file=fout) +$GROMACS_COMMAND -mt {} -mp {} -ct {} -pt {} -pp {} -l {} -cat {} -gen {} -Nump {} -prod {} -nprod {} -nequil {} -dt {} -ctype {} -nnpt {} -comp {}""".format(opt.nproc, opt.terlarut,opt.pelarut,opt.c_terlarut,opt.persen_terlarut,opt.persen_pelarut,opt.lapang,opt.cation,opt.generate_dftbinp,opt.NumPelarut,opt.production,opt.nprod,opt.nequil,opt.deltat,opt.charge_type,opt.nnpt,opt.compress),file=fout) os.system('sbatch run.sh') if opt.job == 'proprep' and opt.software == 'gmx': diff --git a/lib/__pycache__/cmmde_hubbard.cpython-39.pyc b/lib/__pycache__/cmmde_hubbard.cpython-39.pyc index 0cbf36280328201dbd93a14f7929c17306b1f937..a6d71b5be601093d85c3bdb943b0f51dabe8a787 100644 GIT binary patch delta 96 zcmZ3&wuOx^k(ZZ?0SHV>_9gK#Pvmpw5(n~}fwMlm_(PkfrpW&qO2JUM_-b#go-8}lnRiOm&2^^CHU?=rbD$^ZcFtOLGY;Hp=S>s`xgjaMEuU=r|z&j?|nbt_htrWKZf30fhT^ykKuX# z?Q_X84+0N(?qI#ts7RC89=9vRrGJ^#xeOp@_G{!LI#-<8N7AKzN6>>>4{7}aa!coK zou5e$ar8Tr-p(9u&+v^ZAC1aLS=i^u$BtQpMjfu@h#W5)Exzlbh>Z542^HBU%#+$R zET_r>N?I?&;J>36YDa1*M0Ohf>0?I2o!;H5{r2YI*l%yI)li|{p%PIR>z7rzjLVBn zY~bx_Jytbjf@1R08-p{%N%*+K2b9ZDjJ`sCbHCGZOk z^7YTGuOe#++Xb8g9;5LA>eI!-o(H`J8l?%Eq%cjv%K=H&q%$9MMdx98Je)_M1d delta 843 zcmYk5v2W8*5XRrx#W6{oCQi~MZIc>EDFp)ASWtyfgFr$>D3xd`m5S;ONLj#*DikgR zsWXr&Ba6MFZbe8S!5_fDz`)qQftdmE`NhGuW#7H;_ubulO8nmboXb41tfauz+4;8j zDs_~(ONFCHd&8$pGJQh~NLnlog!=;Pj9MFN?a2hw0lA(u!#F#M@MQxZ7i6xhyPvSO zJ;4Q^lvW`4p3uP^v`= zTfynj_7rvp%;F5s`uenjvmyTiehxg#IbZuv?U4QiJr8R8bVzFSg^6cKg44>Rxi?{| zPfL+6PjgOty1eMqy4WcXY9K3URf{$`(w--whArdm(LEn_--6>3>he(?l;J9*89u{$ zbS9~O`H|+nh2b)|!3j2F{7Uf806zx53VxQ8(V1l6m7BE9DmSnRr-eW;8}08-8VK`w;PBFXOf)MXZ})i zTgR&3SjIbvXScPnzPr`gzH{$>%Xv9a(q=oRoIEs6Y2`ThF32I1%6Q^;pqZ3WdVT!Z G{Q3{#Y1k|P diff --git a/lib/cmmde_hubbard.py b/lib/cmmde_hubbard.py index c134ab4..49375e8 100644 --- a/lib/cmmde_hubbard.py +++ b/lib/cmmde_hubbard.py @@ -19,6 +19,8 @@ def azimuth(element): 'B' : '2', 'Au' : '3', 'Rh' : '3', + 'Ni' : '3', + 'Co' : '3', 'Ti' : '3', 'C' : '2' } @@ -26,4 +28,4 @@ def azimuth(element): def hubbard(element): U = {'Br':'-0.0573','C':'-0.1492','Ca':'-0.0340','Cl':'-0.0697','F':'-0.1623','H':'-0.1857','I':'-0.0433','K':'-0.0339','Mg':'-0.02','N':'-0.1535','Na':'-0.0454','O':'-0.1575','P':'-0.14','S':'-0.11','Zn':'-0.03','Li': '-0.04548','B':'-0.145'} - return U[element] \ No newline at end of file + return U[element] diff --git a/lib/cmmde_orca.py b/lib/cmmde_orca.py index b517b26..c261592 100644 --- a/lib/cmmde_orca.py +++ b/lib/cmmde_orca.py @@ -5,10 +5,14 @@ def orca(job,method,nproc,geom,charge,mult,scalfreq,temperature,pressure,nroots, method += ' Numfreq' if 'irc' in job: method += ' IRC' - if 'ts' in job: + if 'ts' in job and 'neb' not in job: method += ' OptTS' - if 'NEB-TS' in job: - method += ' NEB-TS' + if 'neb-ts' in job: + method += ' NEB-TS Freq' + if 'neb' in job and 'ts' not in job: + method += ' NEB' + if 'neb-ci' in job: + method += ' NEB-CI' if 'freq' in job and ('XTB2' not in method and 'XTB' not in method and 'XTBFF' not in method): method += ' freq' if disp != 'None': @@ -66,10 +70,10 @@ end""".format(scalfreq,temperature,pressure),file=f) nroots {} tda {} end""".format(nroots,tda),file=f) - if 'NEB' in job: + if 'neb' in job: print("""%NEB -NEB_END_XYZFILE {} -NEB_TS_XYZFILE {} +NEB_END_XYZFILE "{}" +NEB_TS_XYZFILE "{}" END""".format(product,ts),file=f) if 'irc' in job: print("""%irc diff --git a/lib/cmmde_solution.py b/lib/cmmde_solution.py index 201bf11..0c2bf58 100755 --- a/lib/cmmde_solution.py +++ b/lib/cmmde_solution.py @@ -22,20 +22,23 @@ parser.add_argument('-cat','--cation',type=str, default='none',help='Kation yang parser.add_argument('-p', '--pressure', default=1.0, type=float, help='Tekanan dalam satuan bar') parser.add_argument('-t', '--temperature', default=298.15, type=float, help='Suhu yang digunakan dalam simulasi.') parser.add_argument('-nequil','--nequil',type=int, default=50000, help='Jumlah step pada saat ekuilibrasi.') +parser.add_argument('-nnpt','--nnpt',type=int, default=50000, help='Jumlah step pada saat ekuilibrasi NPT.') parser.add_argument('-nprod','--nprod',type=int, default=400000, help='Jumlah step pada saat production.') parser.add_argument('-dt','--dt',type=float, default=1, help='Step simulasi dinamika molekul yang dilakukan.') +parser.add_argument('-comp','--compress',type=float, default=4.5e-6, help='Nilai kompresibilitas. Default=4.5e-6.') parser.add_argument('--packmol', type=str, default='/home/adit/opt/oldpackmol/packmol') parser.add_argument('-l','--lapang',type=float, default=5, help='Ruang lapang untuk atom-atom bergerak di dalam kotak larutan (angstrom).') parser.add_argument('-gen','--generate_dftbinp',type=str,default='false',help='Apakah ingin mengkonversi ke dalam format koordinat xyz?') parser.add_argument('-prod','--production',type=str,default='None',help='Jenis production run yang ingin dilakukan. Pilihan: NPT (recommended), NVE, dan NVT.') + opt=parser.parse_args(sys.argv[1:]) # Input file minimisasi energi dalam GROMACS minim_mdp = """ -integrator = steep ; Algorithm (steep = steepest descent minimization) -emtol = 100.0 ; Stop minimization when the maximum force < 1000.0 kJ/mol/nm +integrator = cg ; Algorithm (steep or cg) +emtol = 1 ; Stop minimization when the maximum force < 1 kJ/mol/nm emstep = 0.01 ; Minimization step size nsteps = 50000 ; Maximum number of (minimization) steps to perform @@ -50,7 +53,7 @@ pbc = xyz ; Periodic Boundary Conditions in all 3 dimensions """ nve_mdp = """ define = -DFLEXIBLE -integrator = md ; leap-frog integrator +integrator = md nsteps = {} ; 1 * 500000 = 50 ps dt = 0.001 ; 0.5 fs nstxout = 100 ; save coordinates every 1.0 ps @@ -81,21 +84,21 @@ pcoupl = no ; no pressure coupling in NVE ; Periodic boundary conditions pbc = xyz ; 3-D PBC ; Velocity generation -gen_vel = no ; Velocity generation is off +gen_vel = yes ; Velocity generation is off """ # Input file simulasi menggunakan ensembel kanonik (NVT) dalam GROMACS nvt_mdp=""" define = -DFLEXIBLE integrator = md ; leap-frog integrator -nsteps = {} ; 1 * 500000 = 50 ps +nsteps = {} dt = 0.001 ; 1 fs nstxout = 100 ; save coordinates every 1.0 ps ;nstenergy = 100 ; save energies every 1.0 ps ;nstlog = 100 ; update log file every 1.0 ps ; Bond parameters -continuation = no ; first dynamics run +continuation = yes ; first dynamics run constraint_algorithm = lincs ; holonomic constraints constraints = h-bonds ; bonds involving H are constrained lincs_iter = 1 ; accuracy of LINCS @@ -114,16 +117,14 @@ fourierspacing = 0.16 ; grid spacing for FFT ; Temperature coupling is on tcoupl = V-rescale ; modified Berendsen thermostat tc-grps = System ; two coupling groups - more accurate -tau_t = 0.1 ; time constant, in ps +tau_t = 0.01 ; time constant, in ps ref_t = {} ; reference temperature, one for each group, in K ; Pressure coupling is off pcoupl = no ; no pressure coupling in NVT ; Periodic boundary conditions pbc = xyz ; 3-D PBC ; Velocity generation -gen_vel = yes ; assign velocities from Maxwell distribution -gen_temp = {} ; temperature for Maxwell distribution -gen_seed = -1 ; generate a random seed +gen_vel = no ; assign velocities from Maxwell distribution """ # Input file simulasi isoterm-isobarik (NPT) dalam GROMACS. Harapannya, setelah dilakukan NPT, akan diperoleh sistem dengan massa jenis yang optimal. @@ -131,8 +132,8 @@ npt_mdp = """ title = NPT equilibration ; Run parameters integrator = md ; leap-frog integrator -nsteps = {} ; 2 * 50000 = 100 ps -dt = 0.002 ; 2 fs +nsteps = {} +dt = 0.001 ; 1 fs ; Output control nstxout = 500 ; save coordinates every 1.0 ps nstvout = 500 ; save velocities every 1.0 ps @@ -143,7 +144,7 @@ continuation = yes ; first dynamics run constraint_algorithm = lincs ; holonomic constraints constraints = h-bonds ; bonds involving H are constrained lincs_iter = 1 ; accuracy of LINCS -lincs_order = 4 ; also related to accuracy +lincs_order = 6 ; also related to accuracy ; Neighborsearching cutoff-scheme = Verlet ns_type = grid ; search neighboring grid cells @@ -162,9 +163,9 @@ ref_t = {} ; reference temperature, one for each group, in K ; Pressure coupling is on pcoupl = Berendsen ; Pressure coupling on in NPT pcoupltype = isotropic ; uniform scaling of box vectors -tau_p = 2.0 ; time constant, in ps +tau_p = 2 ; time constant, in ps ref_p = {} ; reference pressure, in bar -compressibility = 4.5e-5 ; isothermal compressibility of water, bar^-1 +compressibility = {} ; isothermal compressibility of water, bar^-1 refcoord_scaling = com ; Periodic boundary conditions pbc = xyz ; 3-D PBC @@ -204,10 +205,10 @@ tau_t = 0.1 ; time constant, in ps ref_t = {} ; reference temperature, one for each group, in K ; Pressure coupling is on pcoupl = Berendsen ; Pressure coupling on in NPT -pcoupltype = isotropic ; uniform scaling of box vectors -tau_p = 2.0 ; time constant, in ps +pcoupltype = isotropic ; uniform scaling of box vectors +tau_p = 10 ; time constant, in ps +compressibility = {} ; isothermal compressibility of water, bar^-1 ref_p = {} ; reference pressure, in bar -compressibility = 4.5e-5 ; isothermal compressibility of water, bar^-1 refcoord_scaling = com ; Periodic boundary conditions pbc = xyz ; 3-D PBC @@ -556,16 +557,18 @@ quit""",file=fout) # Menuliskan semua input file yang dibutuhkan, meliputi simulasi NVE, NVT, dan NPT nequil = opt.nequil + nnpt = opt.nnpt nprod = opt.nprod + compress = opt.compress with open('minim.mdp', 'w') as f: print(minim_mdp.format(half_box, half_box), file=f) with open('nve.mdp', 'w') as f: print(nve_mdp.format(nequil,half_box,half_box), file=f) with open('nvt.mdp', 'w') as f: - print(nvt_mdp.format(nequil,half_box, half_box,temperature,temperature), file=f) + print(nvt_mdp.format(nequil,half_box, half_box,temperature), file=f) with open('npt.mdp', 'w') as f: - print(npt_mdp.format(nequil,half_box, half_box,temperature,pressure), file=f) + print(npt_mdp.format(nnpt,half_box, half_box,temperature,pressure,compress), file=f) gmxscript.grompp(f="minim.mdp", c="system_box.pdb", o="mini.tpr", p="system_GMX.top", maxwarn=2) gmxscript.mdrun(deffnm="mini",ntmpi=1) @@ -579,7 +582,7 @@ quit""",file=fout) if prod == 'npt': with open('nptp.mdp', 'w') as f: - print(nptp_mdp.format(nprod,opt.dt/2000,half_box,half_box,temperature,pressure), file=f) + print(nptp_mdp.format(nprod,opt.dt/2000,half_box,half_box,temperature,compress,pressure), file=f) gmxscript.grompp(f="nptp.mdp", c="npt.gro", p="system_GMX.top", o="nptp.tpr",maxwarn=2) gmxscript.mdrun(deffnm="nptp", v=True, ntmpi=1) gmxscript.trjconv(f="nptp.trr", s="nptp.tpr", n="mini.ndx", o="finalsystem.pdb")