Esempio n. 1
0
"""
atomtools for geometry
"""
import os
import math
import itertools
import numpy as np
from numpy.linalg import norm

import modlog
import chemdata

BASEDIR = os.path.dirname(os.path.abspath(__file__))
EXTREME_SMALL = 1e-5

logger = modlog.getLogger(__name__)


def cos(theta, arc=False):
    factor = 1 if arc else math.pi / 180.0
    return math.cos(theta * factor)


def sin(theta, arc=False):
    factor = 1 if arc else math.pi / 180.0
    return math.sin(theta * factor)


def acos(result, arc=False):
    factor = 1 if arc else 180.0 / math.pi
    return math.acos(result) * factor
Esempio n. 2
0
import os
import re
import argparse
import configparser
import modlog
from . import fileutil

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEFAULT_FILETYPE_REGEXP_CONF = 'default_filetype.conf'
DEFAULT_FILETYPE_REGEXP_CONF = os.path.join(BASE_DIR,
                                            DEFAULT_FILETYPE_REGEXP_CONF)
REG_ANYSTRING = r'[\s\S]*?'
FILETYPE_SECTION_NAME = 'filetype'
MULTIFRAME_NAME = 'multiframe'

logger = modlog.getLogger(__name__)

global FORMATS_REGEXP, MULTIFRAME
FORMATS_REGEXP, MULTIFRAME = dict(), list()

PARTIAL_LENGTH = 100000


def update_config(path=None):
    global FORMATS_REGEXP, MULTIFRAME
    path = path or DEFAULT_FILETYPE_REGEXP_CONF
    if os.path.exists(path):
        conf = configparser.ConfigParser(delimiters=('='))
        conf.optionxform = str
        conf.read(path)
        FORMATS_REGEXP.update(conf._sections[FILETYPE_SECTION_NAME])
Esempio n. 3
0
def set_loglevel(loglevel):
    os.environ[LOGLEVEL_ENV] = str(loglevel)
    main.logger = modlog.getLogger(main.__name__)
Esempio n. 4
0
import modlog

logger = modlog.getLogger(__name__, 'color')

for level in ['debug', 'info', 'warn', 'error', 'critical']:
    getattr(logger, level)(level)