Commit 2c7d97c9 authored by cmaffeo2's avatar cmaffeo2
Browse files

Expose enrg_md_steps option in mrdna and enrgmd scripts and in...

Expose enrg_md_steps option in mrdna and enrgmd scripts and in mrdna.simulate.multiresolution_simulation(); thanks to Elija Feigl for the suggestion
parent 43f77f77
......@@ -27,6 +27,9 @@ parser.add_argument('--crossover-to-intrahelical-cutoff', type=float, default=-1
parser.add_argument('--backbone-scale', type=float, default=1.0,
help='Factor to scale DNA backbone in atomic model; try 0.25 to avoid clashes for atomistic simulations')
parser.add_argument('--enrg-md-steps', type=int, default=1e6,
help='Number of ENRG-MD steps')
parser.add_argument('input_file', type=str,
help="""Any of the following:
(1) a cadnano JSON file;
......@@ -97,7 +100,7 @@ http://dx.doi.org/10.1093/nar/gkw155
os.makedirs('output')
except FileExistsError:
...
model.atomic_simulate( output_name = prefix, dry_run=True )
model.atomic_simulate( output_name = prefix, num_steps=args.enrg_md_steps, dry_run=True )
except:
raise
......
......@@ -68,6 +68,9 @@ parser.add_argument('--backbone-scale', type=float, default=1.0,
parser.add_argument('--run-enrg-md', action='store_true',
help='Perform the ENRG-MD simulation?')
parser.add_argument('--enrg-md-steps', type=int, default=1e6,
help='Number of ENRG-MD steps')
parser.add_argument('--debug', action='store_true',
help='Run through the python debugger?')
......@@ -183,6 +186,7 @@ def main():
backbone_scale = args.backbone_scale,
oxdna_steps = args.oxdna_steps,
oxdna_output_period = args.oxdna_output_period,
enrg_md_steps = args.enrg_md_steps,
run_enrg_md = args.run_enrg_md
)
......
......@@ -1368,10 +1368,17 @@ component "data" value 3
## TODO: cache coordinates using numpy arrays for quick min/max
raise(NotImplementedError)
def write_namd_configuration( self, output_name, num_steps = 1e6,
def write_namd_configuration( self, output_name, minimization_steps=4800, num_steps = 1e6,
output_directory = 'output',
update_dimensions=True, extrabonds=True ):
num_steps = int(num_steps//12)*12
minimization_steps = int(minimization_steps//24)*24
if num_steps < 12:
raise ValueError("Must run with at least 12 steps")
if minimization_steps < 24:
raise ValueError("Must run with at least 24 minimization steps")
format_data = self.__dict__.copy() # get parameters from System object
format_data['extrabonds'] = """extraBonds on
......@@ -1396,7 +1403,8 @@ tclForcesScript $prefix.forces.tcl
format_data['cell'+k] = v
format_data['prefix'] = output_name
format_data['num_steps'] = int(num_steps//12)*12
format_data['minimization_steps'] = int(minimization_steps//2)
format_data['num_steps'] = num_steps
format_data['output_directory'] = output_directory
filename = '{}.namd'.format(output_name)
......@@ -1483,9 +1491,9 @@ if {{$nLast == 0}} {{
fixedAtomsForces on
fixedAtomsFile $prefix.fixed.pdb
fixedAtomsCol B
minimize 2400
minimize {minimization_steps:d}
fixedAtoms off
minimize 2400
minimize {minimization_steps:d}
}} else {{
bincoordinates {output_directory}/$prefix-$nLast.restart.coor
binvelocities {output_directory}/$prefix-$nLast.restart.vel
......@@ -1494,7 +1502,8 @@ if {{$nLast == 0}} {{
run {num_steps:d}
""".format(**format_data))
def atomic_simulate(self, output_name, output_directory='output', dry_run = False, namd2=None, log_file=None, num_procs=None, gpu=None, copy_ff_from=get_resource_path("charmm36.nbfix") ):
def atomic_simulate(self, output_name, output_directory='output', dry_run = False, namd2=None, log_file=None, num_procs=None, gpu=None, minimization_steps=4800, num_steps=1e6, write_pqr=False, copy_ff_from=get_resource_path("charmm36.nbfix") ):
if self.cacheUpToDate == False: # TODO: remove cache?
self._countParticleTypes()
self._updateParticleOrder()
......@@ -1503,7 +1512,7 @@ run {num_steps:d}
self.writePdb( output_name + ".pdb" )
self.writePdb( output_name + ".fixed.pdb", beta_from_fixed=True )
self.writePsf( output_name + ".psf" )
self.write_namd_configuration( output_name, output_directory = output_directory )
self.write_namd_configuration( output_name, output_directory = output_directory, minimization_steps=minimization_steps, num_steps=num_steps )
if copy_ff_from is not None and copy_ff_from != '':
try:
......
......@@ -89,6 +89,7 @@ def multiresolution_simulation( model, output_name,
oxdna_steps = None,
oxdna_output_period = None,
run_enrg_md = False,
enrg_md_steps = 1e6,
arbd = None
):
......@@ -203,7 +204,7 @@ def multiresolution_simulation( model, output_name,
except FileExistsError:
pass
model.atomic_simulate( output_name = output_prefix, dry_run = not run_enrg_md )
model.atomic_simulate( output_name = output_prefix, num_steps=enrg_md_steps, dry_run = not run_enrg_md )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment