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