def get_available_platforms(): from simtk.openmm import Platform platform_names = [] for i in range(Platform.getNumPlatforms()): p = Platform.getPlatform(i) name = p.getName() platform_names.append(name) return platform_names
'CUDA': [ 'Cuda_Device_Index', 'Cuda_Precision', 'Cuda_Use_Cpu_Pme', 'Cuda_Cuda_Compiler', 'Cuda_Temp_Directory', 'Cuda_Use_Blocking_Sync', 'Cuda_Deterministic_Forces' ], 'OpenCL': [ 'OpenCL_Device_Index', 'OpenCL_Precision', 'OpenCL_Use_Cpu_Pme', 'OpenCL_OpenCL_Platform_Index' ], 'CPU': ['CPU_Threads'], 'Reference': [] } platform_names = [ Platform.getPlatform(no_platform).getName() for no_platform in range(Platform.getNumPlatforms()) ] parser = argparse.ArgumentParser( description='Run an MD simulation using OpenMM') parser.add_argument('output', metavar='output/', help='the output directory', type=str) parser.add_argument('-l', '--length', dest='length', type=int, default=100,
funcs = {'get_platform': [get_platform, platform], 'get_pdbfile': [get_pdbfile, pdbfile], 'get_system': [get_xml, system], 'get_integrator': [get_xml, integrator]} kfuncs = list(funcs.keys()) random.shuffle(kfuncs) returns = dict() while kfuncs: op_name = kfuncs.pop(0) func, arg = funcs[op_name] returns.update({op_name: func(arg)}) return [returns[nxt] for nxt in return_order] platformNames = [Platform.getPlatform(i).getName() for i in range(Platform.getNumPlatforms())] print(platformNames) parser = argparse.ArgumentParser() parser.add_argument('--save_traj',dest='save_traj',required=True,type=str) parser.add_argument('--md_steps',dest='md_steps',required=True,type=int) parser.add_argument('--trajstride',dest='trajstride', required=False, type=int, default=10) parser.add_argument('--idxstart',dest='idxstart',required=True,type=int) parser.add_argument('--idxend',dest='idxend',required=True,type=int) parser.add_argument('--iter',dest='iter',required=True,type=int) parser.add_argument('--path',dest='path',required=True,type=str) args = parser.parse_args() #grofile_name='start2.gro #pdb=mdtraj.load(grofile_name)
exit(1) pdb_in = sys.argv[1] mol_in = sys.argv[2] output_complex = sys.argv[3] + '_complex.pdb' output_traj_pdb = sys.argv[3] + '_traj.pdb' output_traj_dcd = sys.argv[3] + '_traj.dcd' output_min = sys.argv[3] + '_minimised.pdb' num_steps = int(sys.argv[4]) print('Processing', pdb_in, 'and', mol_in, 'with', num_steps, 'steps generating outputs', output_complex, output_min, output_traj_pdb, output_traj_dcd) # check whether we have a GPU platform and if so set the precision to mixed speed = 0 for i in range(Platform.getNumPlatforms()): p = Platform.getPlatform(i) # print(p.getName(), p.getSpeed()) if p.getSpeed() > speed: platform = p speed = p.getSpeed() if platform.getName() == 'CUDA' or platform.getName() == 'OpenCL': platform.setPropertyDefaultValue('Precision', 'mixed') print('Set precision for platform', platform.getName(), 'to mixed') # Read the molfile into RDKit, add Hs and create an openforcefield Molecule object print('Reading ligand') rdkitmol = Chem.MolFromMolFile(mol_in) print('Adding hydrogens') rdkitmolh = Chem.AddHs(rdkitmol, addCoords=True)
""" Houses all of the "extra" test cases to run for OpenMM """ __all__ = ['testhewl', 'available_platforms'] import testhewl # Construct the list of available platforms available_platforms = [] from simtk.openmm import Platform for i in range(Platform.getNumPlatforms()): available_platforms.append(Platform.getPlatform(i).getName()) # Cleanup the namespace a bit del i, Platform