예제 #1
0
def MolecularDynamics(topology_file="ioned_topol",
                      input_structure="em",
                      output_name="t_0",
                      seed=1993,
                      steps=100,
                      pcoupling="semiisotropic"):
    if debug_status:
        replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                      "runfile.mdp")
    elif pcoupling == "semiisotropic":
        replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                     "seeded.mdp", seed)
        replace_steps("seeded.mdp", "runfile.mdp", steps)
    elif pcoupling == "anistropic":
        replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                     "seeded.mdp", seed)
        replace_pcoupling("seeded.mdp",
                          "aniso_pcouple.mdp",
                          coupling="anisotropic")
        replace_steps("aniso_pcouple.mdp", "runfile.mdp", steps)
    #os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
    #os.system(gromacs+"mdrun -deffnm " + output_name)
    UserDefSimulation(topology_file,
                      input_structure,
                      output_name,
                      "runfile.mdp",
                      wallclock=True)
예제 #2
0
def PRMolecularDynamics(topology_file="ioned_topol",input_structure="em",output_name="t_0",seed=1993,steps=100):
	if debug_status:
		replace_steps(configuration['mdp_files'] + "cg-pr.mdp","runfile.mdp")
	else:
		replace_seed(configuration['mdp_files'] + "cg-pr.mdp","runfile.mdp",seed)
	#os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
	#os.system(gromacs+"mdrun -deffnm " + output_name)
	UserDefSimulation(topology_file,input_structure,output_name,"runfile.mdp")
예제 #3
0
def PMFMolecularDynamics(topology_file="ioned_topol",input_structure="pr",output_name="t_0",seed=1993,steps=2500000):
	if debug_status:
		replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","runfile.mdp")
	else:
		replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
		replace_steps("seeded.mdp","runfile.mdp",steps)
	os.system(gromacs+"grompp -f runfile -n pull_system.ndx -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
	os.system(gromacs+"mdrun -pi umbrella.ppa -po umbrella.gmx.ppa -pd pull.pdo -pn pull_system.ndx -deffnm " + output_name)
예제 #4
0
def MolecularDynamics(topology_file="ioned_topol",input_structure="em",output_name="t_0",seed=1993,steps=100,pcoupling="semiisotropic"):
	if debug_status:
		replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","runfile.mdp")
	elif pcoupling == "semiisotropic":
		replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
		replace_steps("seeded.mdp","runfile.mdp",steps)
	elif pcoupling == "anistropic":
		replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
		replace_pcoupling("seeded.mdp","aniso_pcouple.mdp",coupling="anisotropic")
		replace_steps("aniso_pcouple.mdp","runfile.mdp",steps)
	#os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
	#os.system(gromacs+"mdrun -deffnm " + output_name)
	UserDefSimulation(topology_file,input_structure,output_name,"runfile.mdp",wallclock=True)
예제 #5
0
def PRMolecularDynamics(topology_file="ioned_topol",
                        input_structure="em",
                        output_name="t_0",
                        seed=1993,
                        steps=100):
    if debug_status:
        replace_steps(configuration['mdp_files'] + "cg-pr.mdp", "runfile.mdp")
    else:
        replace_seed(configuration['mdp_files'] + "cg-pr.mdp", "runfile.mdp",
                     seed)
    #os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
    #os.system(gromacs+"mdrun -deffnm " + output_name)
    UserDefSimulation(topology_file, input_structure, output_name,
                      "runfile.mdp")
예제 #6
0
def PMFMolecularDynamics(topology_file="ioned_topol",
                         input_structure="pr",
                         output_name="t_0",
                         seed=1993,
                         steps=2500000):
    if debug_status:
        replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                      "runfile.mdp")
    else:
        replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                     "seeded.mdp", seed)
        replace_steps("seeded.mdp", "runfile.mdp", steps)
    os.system(gromacs + "grompp -f runfile -n pull_system.ndx -c " +
              input_structure + " -p " + topology_file + " -o " + output_name +
              " >& grompp_" + output_name + ".log")
    os.system(
        gromacs +
        "mdrun -pi umbrella.ppa -po umbrella.gmx.ppa -pd pull.pdo -pn pull_system.ndx -deffnm "
        + output_name)
예제 #7
0
def RobustMolecularDynamics(topology_file="ioned_topol",input_structure="em",output_name="t_0",seed=1993,steps=100,pcoupling="semiisotropic",wallclock=24,epsilon=20,temperature=None,apolar=True,pme=False,umbrella_name=None):
	if debug_status:
		replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","runfile.mdp")
	elif pcoupling == "semiisotropic":
		replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
		replace_epsilon("seeded.mdp","epsilon-correct.mdp",epsilon)
		replace_temperature("epsilon-correct.mdp","retemp.mdp",temperature)
		replace_steps("retemp.mdp","runfile.mdp",steps)
		#replace_steps("seeded.mdp","runfile.mdp",steps)
	elif pcoupling == "anisotropic":
		replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
		replace_pcoupling("seeded.mdp","aniso_pcouple.mdp",coupling="anisotropic")
		replace_epsilon("aniso_pcouple.mdp","epsilon-correct.mdp",epsilon)
		replace_temperature("epsilon-correct.mdp","retemp.mdp",temperature)
		replace_steps("retemp.mdp","runfile.mdp",steps)
		#replace_steps("aniso_pcouple.mdp","runfile.mdp",steps)
		#replace_steps("epsilon-correct.mdp","runfile.mdp",steps)
	else:
		print "Error- pcoupling type not recognised"
		sys.exit()
	if not apolar:
		print "Polar martini parameters in use: changing the appropriate parameters"
		pmartini_update("runfile.mdp")
		#This is a special change- so that all CG systems can have a common wallclock we specifically increase it for PMARTINI
		wallclock *= 4
	if pme:
		print "Turning on PME. Unknown effects. Here be dragons"
		pme_update("runfile.mdp")
		#This is a special change- so that all CG systems can have a common wallclock we specifically increase it for PMARTINI
		wallclock *= 4
		
	#os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
	#os.system(gromacs+"mdrun -deffnm " + output_name)
	UserDefSimulation(topology_file,input_structure,output_name,"runfile",wallclock=wallclock,wallclock_lifetime=wallclock,umbrella=umbrella_name)
	
	default_timestep = 0.02
	reducer=1
	
	reduce_values = ("dt")
	increase_values = ("nstxout","nstvout","nstlog","nstenergy","nstxtcout")
	
	if output_name + ".gro" not in os.listdir("."):
			reducer *= 0.5
			#if reducer >= 0.25: 
			timestep = reducer * default_timestep
			restart_name = "restart_" + str(timestep)
			#Determine last frame
			logfile = open(output_name+".log")
			logcontents = logfile.readlines()
			for i in range(len(logcontents)):
				line = logcontents[i]
				contents = line.split()
				if len(contents) == 3:
					if contents[0] == "Step":
						if len (logcontents[i+1].split()) == 3:
							lasttime = float(logcontents[i+1].split()[1])
			logfile.close()
			#final time is the final 2-thousandth frame 
			finaltime = int(lasttime/2000)*2000 
			if finaltime < 0: finaltime = 0
			os.system("echo '0\n' | " + gromacs + "trjconv -s " + output_name + ".tpr -f " + output_name + ".trr -dump " + str(finaltime) + " -o " + restart_name + "_ini.gro")
			
			#read the runfile and write out updated lines (with smaller timestep etc) to restart.mdp
			restart_mdp = open(restart_name + ".mdp","w")
			old_mdp = open("runfile.mdp","r")
			for line in old_mdp:
				contents = line.split()
				if len(contents) == 0 or len(contents) == 1:
					print >> restart_mdp, line
				elif contents[0] in reduce_values:
					for_restart = contents[0] + " = " + str(float(contents[2]) * reducer)
					print >> restart_mdp, for_restart
				elif contents[0] in increase_values:
					for_restart = contents[0] + " = " + str(float(contents[2]) / reducer)
					print >> restart_mdp, for_restart
				elif contents[0] == "tinit":
					print >> restart_mdp, "tinit                    = " + str(finaltime)
				elif contents[0] == "nsteps":
					#The number of steps should be the new total number of steps minus the number that would have been done
					previous_steps = float(finaltime)/timestep
					new_total_steps = steps / reducer -  previous_steps
					print >> restart_mdp, "nsteps                   = " + str(new_total_steps)
				elif contents[0] == "gen_vel":
					print >> restart_mdp, "gen_vel = no"
				else:
					print >> restart_mdp, line
			restart_mdp.close()
			old_mdp.close()
			#Run
			UserDefSimulation(topology_file,restart_name+"_ini.gro",restart_name,restart_name+".mdp",umbrella=umbrella_name)
			#Remove broken frames from the trajectory, after the time point
			os.system(gromacs + "trjconv -f " + output_name + ".xtc -e "+ str(finaltime) + " -o " + output_name + ".xtc")
			#concatenated output_name.xtc and restart.xtc to output_name.xtc
			os.system(gromacs + "trjcat -f " + output_name + ".xtc " + restart_name + ".xtc -o " + output_name + ".xtc") 
			#move restart.gro to output_name.gro
			os.rename(restart_name + ".gro", output_name + ".gro")
예제 #8
0
파일: CGAuto.py 프로젝트: hallba/Sidekick
		charge_flag = "-np"
		charge = -int(charge)
		ion_name = "NA+"
	os.system("echo '13\n' | " + gromacs+"genion -s solvated.tpr -o ioned.pdb " + charge_flag + " " + str(charge))
	ion_topology.write("DPPC        " + str(lipids) + "\nW         " + str(water-charge) + "\n")
	ion_topology.write(ion_name + " "*7 + str(charge))
	ion_topology.flush()
	ion_topology.close()

os.system(gromacs+"grompp -f " + configuration['mdp_files'] + "cg-em_extended -c ioned.pdb -p ioned_topol -o em >& grompp_em.log")
os.system(gromacs+"mdrun -deffnm em")

if debug_status:
	replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","runfile.mdp")
else:
	replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp","seeded.mdp",seed)
	replace_steps("seeded.mdp","runfile.mdp",10000000)

os.system(gromacs+"grompp -f runfile -c em -p ioned_topol -o t_0 >& grompp_md.log")
os.system(gromacs+"mdrun -deffnm t_0")

#analyse

length = len(initial_sequence)

if length %2 == 0:
	middle_residues = str(length/2 - 1) + "-" + str(length/2 +2)
else:
	middle_residues = str(length/2 - 1) + "-" + str(length/2 +1)

if charge != 0:
예제 #9
0
파일: CGAuto.py 프로젝트: hallba/Sidekick
              str(charge))
    ion_topology.write("DPPC        " + str(lipids) + "\nW         " +
                       str(water - charge) + "\n")
    ion_topology.write(ion_name + " " * 7 + str(charge))
    ion_topology.flush()
    ion_topology.close()

os.system(gromacs + "grompp -f " + configuration['mdp_files'] +
          "cg-em_extended -c ioned.pdb -p ioned_topol -o em >& grompp_em.log")
os.system(gromacs + "mdrun -deffnm em")

if debug_status:
    replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                  "runfile.mdp")
else:
    replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                 "seeded.mdp", seed)
    replace_steps("seeded.mdp", "runfile.mdp", 10000000)

os.system(gromacs +
          "grompp -f runfile -c em -p ioned_topol -o t_0 >& grompp_md.log")
os.system(gromacs + "mdrun -deffnm t_0")

#analyse

length = len(initial_sequence)

if length % 2 == 0:
    middle_residues = str(length / 2 - 1) + "-" + str(length / 2 + 2)
else:
    middle_residues = str(length / 2 - 1) + "-" + str(length / 2 + 1)
예제 #10
0
def RobustMolecularDynamics(topology_file="ioned_topol",
                            input_structure="em",
                            output_name="t_0",
                            seed=1993,
                            steps=100,
                            pcoupling="semiisotropic",
                            wallclock=24,
                            epsilon=20,
                            temperature=None,
                            apolar=True,
                            pme=False,
                            umbrella_name=None):
    if debug_status:
        replace_steps(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                      "runfile.mdp")
    elif pcoupling == "semiisotropic":
        replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                     "seeded.mdp", seed)
        replace_epsilon("seeded.mdp", "epsilon-correct.mdp", epsilon)
        replace_temperature("epsilon-correct.mdp", "retemp.mdp", temperature)
        replace_steps("retemp.mdp", "runfile.mdp", steps)
        #replace_steps("seeded.mdp","runfile.mdp",steps)
    elif pcoupling == "anisotropic":
        replace_seed(configuration['mdp_files'] + "cg-mdrun-50ns_sts.mdp",
                     "seeded.mdp", seed)
        replace_pcoupling("seeded.mdp",
                          "aniso_pcouple.mdp",
                          coupling="anisotropic")
        replace_epsilon("aniso_pcouple.mdp", "epsilon-correct.mdp", epsilon)
        replace_temperature("epsilon-correct.mdp", "retemp.mdp", temperature)
        replace_steps("retemp.mdp", "runfile.mdp", steps)
        #replace_steps("aniso_pcouple.mdp","runfile.mdp",steps)
        #replace_steps("epsilon-correct.mdp","runfile.mdp",steps)
    else:
        print "Error- pcoupling type not recognised"
        sys.exit()
    if not apolar:
        print "Polar martini parameters in use: changing the appropriate parameters"
        pmartini_update("runfile.mdp")
        #This is a special change- so that all CG systems can have a common wallclock we specifically increase it for PMARTINI
        wallclock *= 4
    if pme:
        print "Turning on PME. Unknown effects. Here be dragons"
        pme_update("runfile.mdp")
        #This is a special change- so that all CG systems can have a common wallclock we specifically increase it for PMARTINI
        wallclock *= 4

    #os.system(gromacs+"grompp -f runfile -c " + input_structure + " -p " + topology_file + " -o " + output_name + " >& grompp_" + output_name + ".log")
    #os.system(gromacs+"mdrun -deffnm " + output_name)
    UserDefSimulation(topology_file,
                      input_structure,
                      output_name,
                      "runfile",
                      wallclock=wallclock,
                      wallclock_lifetime=wallclock,
                      umbrella=umbrella_name)

    default_timestep = 0.02
    reducer = 1

    reduce_values = ("dt")
    increase_values = ("nstxout", "nstvout", "nstlog", "nstenergy",
                       "nstxtcout")

    if output_name + ".gro" not in os.listdir("."):
        reducer *= 0.5
        #if reducer >= 0.25:
        timestep = reducer * default_timestep
        restart_name = "restart_" + str(timestep)
        #Determine last frame
        logfile = open(output_name + ".log")
        logcontents = logfile.readlines()
        for i in range(len(logcontents)):
            line = logcontents[i]
            contents = line.split()
            if len(contents) == 3:
                if contents[0] == "Step":
                    if len(logcontents[i + 1].split()) == 3:
                        lasttime = float(logcontents[i + 1].split()[1])
        logfile.close()
        #final time is the final 2-thousandth frame
        finaltime = int(lasttime / 2000) * 2000
        if finaltime < 0: finaltime = 0
        os.system("echo '0\n' | " + gromacs + "trjconv -s " + output_name +
                  ".tpr -f " + output_name + ".trr -dump " + str(finaltime) +
                  " -o " + restart_name + "_ini.gro")

        #read the runfile and write out updated lines (with smaller timestep etc) to restart.mdp
        restart_mdp = open(restart_name + ".mdp", "w")
        old_mdp = open("runfile.mdp", "r")
        for line in old_mdp:
            contents = line.split()
            if len(contents) == 0 or len(contents) == 1:
                print >> restart_mdp, line
            elif contents[0] in reduce_values:
                for_restart = contents[0] + " = " + str(
                    float(contents[2]) * reducer)
                print >> restart_mdp, for_restart
            elif contents[0] in increase_values:
                for_restart = contents[0] + " = " + str(
                    float(contents[2]) / reducer)
                print >> restart_mdp, for_restart
            elif contents[0] == "tinit":
                print >> restart_mdp, "tinit                    = " + str(
                    finaltime)
            elif contents[0] == "nsteps":
                #The number of steps should be the new total number of steps minus the number that would have been done
                previous_steps = float(finaltime) / timestep
                new_total_steps = steps / reducer - previous_steps
                print >> restart_mdp, "nsteps                   = " + str(
                    new_total_steps)
            elif contents[0] == "gen_vel":
                print >> restart_mdp, "gen_vel = no"
            else:
                print >> restart_mdp, line
        restart_mdp.close()
        old_mdp.close()
        #Run
        UserDefSimulation(topology_file,
                          restart_name + "_ini.gro",
                          restart_name,
                          restart_name + ".mdp",
                          umbrella=umbrella_name)
        #Remove broken frames from the trajectory, after the time point
        os.system(gromacs + "trjconv -f " + output_name + ".xtc -e " +
                  str(finaltime) + " -o " + output_name + ".xtc")
        #concatenated output_name.xtc and restart.xtc to output_name.xtc
        os.system(gromacs + "trjcat -f " + output_name + ".xtc " +
                  restart_name + ".xtc -o " + output_name + ".xtc")
        #move restart.gro to output_name.gro
        os.rename(restart_name + ".gro", output_name + ".gro")