3 # Copyright (C) 2009-2012 W. Trevor King <wking@tremily.us>
5 # This file is part of unfold_protein.
7 # unfold_protein is free software: you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or (at your option) any
12 # unfold_protein is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 # You should have received a copy of the GNU General Public License along with
18 # unfold_protein. If not, see <http://www.gnu.org/licenses/>.
20 """Run a mechanical protein unfolding experiment."""
25 import numpy as _numpy
27 from pyafm.storage import load_afm as _load_afm
28 from pyafm.config import Kelvin as _Kelvin
29 from unfold_protein import __version__
30 from unfold_protein.unfolder import Unfolder
31 from unfold_protein.scan import UnfoldScanner
32 import unfold_protein.config as _config
35 if __name__ == '__main__':
36 from argparse import ArgumentParser
38 parser = ArgumentParser(
39 description=__doc__, version=__version__)
42 help='Path to a song to play when the experiment is complete')
44 args = parser.parse_args()
46 unfold_config = _config.UnfoldCycleConfig()
47 unfold_config['approach'] = _config.ApproachConfig()
48 unfold_config['unfold'] = _config.UnfoldConfig()
49 unfold_config['unfold']['distance'] = 900e-9
50 unfold_config['save'] = _config.SaveConfig()
51 scan_config = _config.ScanConfig()
52 scan_config['velocity'] = _config.VelocityScanConfig()
53 #scan_config['velocity']['unfolding velocities'] = _numpy.array([1e-6])
54 scan_config['velocity']['num loops'] = 500
55 scan_config['position'] = _config.PositionScanConfig()
60 afm.load_from_config(devices=devices)
62 unfolder = Unfolder(config=unfold_config, afm=afm)
63 scanner = UnfoldScanner(config=scan_config, unfolder=unfolder)
66 afm.move_away_from_surface()
68 for device in devices:
71 song = os.path.abspath(os.path.expanduser(args.song))
72 os.system("aplay '%s'" % song)