Révision 5fb01677 modules/dos_input.py

b/modules/dos_input.py
47 47
import logging
48 48
from configparser import ConfigParser, NoSectionError, NoOptionError, \
49 49
    MissingSectionHeaderError, DuplicateOptionError
50
import numpy as np
50 51
from modules.utilities import try_command
51 52

  
52 53
logger = logging.getLogger('DockOnSurf')
......
457 458

  
458 459

  
459 460
def get_surf_norm_vect():
460
    import numpy as np
461 461
    err = "'surf_norm_vect' must be either a 3 component vector or 'x', 'y' " \
462 462
          "or 'z'"
463
    coords = {'x': [1.0, 0.0, 0.0],
464
              'y': [0.0, 1.0, 0.0],
465
              'z': [0.0, 0.0, 1.0]}
463
    cart_coords = {'x': [1.0, 0.0, 0.0], '-x': [-1.0, 0.0, 0.0],
464
                   'y': [0.0, 1.0, 0.0], '-y': [0.0, -1.0, 0.0],
465
                   'z': [0.0, 0.0, 1.0], '-z': [0.0, 0.0, -1.0]}
466 466
    surf_norm_vect_str = dos_inp.get('Screening', 'surf_norm_vect',
467
                                     fallback="0.0 0.0 1.0")
467
                                     fallback="z")
468 468

  
469
    if len(surf_norm_vect_str) == 1 and surf_norm_vect_str in coords:
470
        surf_norm_vect = coords[surf_norm_vect_str]
469
    if surf_norm_vect_str in cart_coords:
470
        surf_norm_vect = cart_coords[surf_norm_vect_str]
471 471
    else:
472 472
        surf_norm_vect = try_command(str2lst, [(ValueError, err)],
473
                                     surf_norm_vect_str)
473
                                     surf_norm_vect_str, float)
474 474
        if len(surf_norm_vect) != 3:
475 475
            logger.error(err)
476 476
            raise ValueError(err)
......
523 523
    return screen_rmsd
524 524

  
525 525

  
526
def get_coll_bottom():
527
    err_msg = num_error % ('collision_bottom', 'decimal number')
528
    coll_bottom = dos_inp.get('Screening', 'collision_bottom',
529
                              fallback="False")
530
    if coll_bottom.lower() in turn_false_answers:
531
        coll_bottom = False
526
def get_min_coll_height():
527
    err_msg = num_error % ('min_coll_height', 'decimal number')
528
    min_coll_height = dos_inp.get('Screening', 'min_coll_height',
529
                                  fallback="False")
530
    if min_coll_height.lower() in turn_false_answers:
531
        min_coll_height = False
532 532
    else:
533
        coll_bottom = try_command(float, [(ValueError, err_msg)], coll_bottom)
533
        min_coll_height = try_command(float, [(ValueError, err_msg)],
534
                                      min_coll_height)
534 535

  
535
    return coll_bottom
536
    return min_coll_height
536 537

  
537 538

  
538 539
def get_try_disso():
......
678 679
        return_vars['ads_algo'] = get_ads_algo()
679 680
        return_vars['sample_points_per_angle'] = get_pts_per_angle()
680 681
        return_vars['collision_threshold'] = get_coll_thrsld()
681
        return_vars['collision_bottom'] = get_coll_bottom()
682
        return_vars['min_coll_height'] = get_min_coll_height()
683
        cart_coords = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
684
        if return_vars['min_coll_height'] is not False and \
685
                list(map(abs, return_vars['surf_norm_vect'].tolist())) not in \
686
                cart_coords:
687
            logger.warning("'min_coll_height' option is only implemented for "
688
                           "'surf_norm_vect' to be one of the x, y or z axes")
682 689

  
683 690
    # Refinement
684 691
    if refinement:

Formats disponibles : Unified diff