File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ A utility to automatically prepare structures from the PDB for molecular dynamic
99* [X] Automatically add missing atoms and fix non-standard residues with pdbfixer
1010* [X] Automatically propagate metadata through to finalised structure files
1111* [X] Automatically resolve steric clashes and minimise structures
12+ * [X] Run simple MD simulations for testing, validation and minimisation
13+ * [ ] Create 'morph' trajectories with metadynamics
1214* [ ] AIIDA integration
1315
1416## Installation
Original file line number Diff line number Diff line change @@ -204,11 +204,14 @@ def in_string(substr, text): return text == None or substr in text.lower()
204204 print ("Fixing PDB" )
205205 fix .fix (outmodel , outmodel , fix_missing_atoms = fix_missing_atoms )
206206
207- print ("Restoring metadata..." )
208- if ".pdb" in inmodel :
209- fix .restore_metadata_pdb (inmodel , outmodel )
210- if ".cif" in inmodel or ".mmcif" in inmodel :
211- print ("Metadata restoration not implemented for mmCif (yet)" )
207+ # TODO: why does this output broken pdbs?
208+ # also - this was due for a refactor anyway
209+ # maybe dump the data into another file instead
210+ #print("Restoring metadata...")
211+ #if ".pdb" in inmodel:
212+ # fix.restore_metadata_pdb(inmodel, outmodel)
213+ #if ".cif" in inmodel or ".mmcif" in inmodel:
214+ # print("Metadata restoration not implemented for mmCif (yet)")
212215
213216 print ("Simulating " + code )
214217 run .test_sim (outmodel )
Original file line number Diff line number Diff line change @@ -297,10 +297,29 @@ def run(pdb,
297297 # run simulation
298298 # try and resolve steric clashes with variable langevin integrator
299299 if minimise :
300- print ("Minimising..." )
301- simulation .minimizeEnergy (maxIterations = max_minimise_iterations )
302- curr_state = simulation .context .getState (
303- getPositions = True ).getPositions (asNumpy = True )
300+ try :
301+ print ("Minimising..." )
302+ simulation .minimizeEnergy (maxIterations = max_minimise_iterations )
303+ curr_state = simulation .context .getState (
304+ getPositions = True ).getPositions (asNumpy = True )
305+ except OpenMMException as e :
306+ if integrator != "VariableLangevinIntegrator" :
307+ print ("Minimisation blew up. "
308+ "Trying variable langevin integrator..." )
309+ integrator = VariableLangevinIntegrator (temperature ,
310+ friction_coeff ,
311+ minimise_error )
312+ simulation = Simulation (modeller .topology , system , integrator )
313+ simulation .context .setPositions (modeller .positions )
314+ integrator = "VariableLangevinIntegrator"
315+ simulation .minimizeEnergy (
316+ maxIterations = max_minimise_iterations )
317+ curr_state = simulation .context .getState (
318+ getPositions = True ).getPositions (asNumpy = True )
319+ else :
320+ print ("Could not minimise even with variable langevin "
321+ "integrator." )
322+ raise e
304323 if test_run :
305324 try :
306325 print ("Running test simulation..." )
You can’t perform that action at this time.
0 commit comments