Hello.
I need to optimize amino acids located 5A from the ligand for this purpose I use this code:
#residues to optimize:
select=selection(mdl1)
select1=select.only_het_residues()
select2=select1.select_sphere(5)
select3=select2.only_std_residues()
select4=select3.by_residue()
mdl1.restraints.unpick_all()
mdl1.restraints.pick(select4)
select4.energy()
select4.randomize_xyz(deviation=4.0)
mdl1.env.edat.nonbonded_sel_atoms=2
optimize(select4, sched)
mdl1.env.edat.nonbonded_sel_atoms=1
optimize(select4, sched)
select4.energy()
mdl1.write(file=model_name+'_docked_opt'+str(i)+'.pdb')
This works for most structures but for a few I have this error:
mdl.restraints.pick(select4)
File "C:\Program Files (x86)\Modeller9.21\modlib\modeller\restraints.py", line 94, in pick
raise ValueError("selection refers to a different model")
ValueError: selection refers to a different model