How to use the matscipy.logger.screen function in matscipy

To help you get started, we’ve selected a few matscipy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libAtoms / matscipy / scripts / fracture_mechanics / optimize_crack_tip.py View on Github external
import sys
sys.path += ['.', '..']
import params

###

Optimizer = ase.optimize.FIRE

# Atom types used for outputting the crack tip position.
ACTUAL_CRACK_TIP = 'Au'
FITTED_CRACK_TIP = 'Ag'

###

logger = screen

###

a, cryst, crk, k1g, tip_x, tip_y, bond1, bond2, boundary_mask, \
    boundary_mask_bulk, tip_mask = setup_crack(logger=logger)
ase.io.write('notch.xyz', a, format='extxyz')

# Get general parameters

basename = parameter('basename', 'crack_tip')
calc = parameter('calc')
fmax = parameter('fmax', 0.01)

# Get parameter used for fitting crack tip position

residual_func = parameter('residual_func', crack.displacement_residual)
github libAtoms / matscipy / matscipy / distributed_computation.py View on Github external
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
# ======================================================================

import multiprocessing
import multiprocessing.managers

try:
    import argparse
except ImportError:
    from matscipy.logger import screen
    screen.pr('argparse module not availability, some functionality disabled')

import abc
import datetime
import sys


class BaseResultManager(object):
    """
    Baseclass for job distribution servers. User needs to implement the method process
    """
    __metaclass__ = abc.ABCMeta
    def __init__(self, port, key):
        """

        Keyword Arguments:
        port    -- listening port
github libAtoms / matscipy / matscipy / socketcalc.py View on Github external
def __init__(self, client_id, exe, env=None, npj=1, ppn=1,
                 block=None, corner=None, shape=None,
                 jobname='socketcalc', rundir=None,
                 fmt='REFTRAJ', parmode=None, mpirun='mpirun',
                 mpirun_args=['-np'], logger=screen,
                 max_pos_diff=MAX_POS_DIFF,
                 max_cell_diff=MAX_CELL_DIFF,
                 param_files=None):
        Client.__init__(self, client_id, exe, env, npj, ppn,
                        block, corner, shape, jobname, rundir, fmt, parmode,
                        mpirun, mpirun_args, logger, max_pos_diff,
                        max_cell_diff)
        self.param_files = param_files
github libAtoms / matscipy / scripts / fracture_mechanics / quasistatic_crack.py View on Github external
from setup_crack import setup_crack

###

sys.path += ['.', '..']
import params

###

# Atom types used for outputting the crack tip position.
ACTUAL_CRACK_TIP = 'Au'
FITTED_CRACK_TIP = 'Ag'

###

logger = screen

###

a, cryst, crk, k1g, tip_x0, tip_y0, bond1, bond2, boundary_mask, \
    boundary_mask_bulk, tip_mask = setup_crack(logger=logger)
ase.io.write('notch.xyz', a, format='extxyz')   

# Global parameters
basename = parameter('basename', 'quasistatic_crack')
calc = parameter('calc')
fmax = parameter('fmax', 0.01)

# Determine simulation control
k1_list = parameter('k1')
old_k1 = k1_list[0]
nsteps = len(k1_list)
github libAtoms / matscipy / scripts / fracture_mechanics / neb_crack_tip.py View on Github external
import sys
sys.path += ['.', '..']
import params

###

Optimizer = ase.optimize.FIRE
#Optimizer = ase.optimize.precon.LBFGS

# Atom types used for outputting the crack tip position.
ACTUAL_CRACK_TIP = 'Au'
FITTED_CRACK_TIP = 'Ag'

###

logger = screen

###

# Get general parameters

residual_func = parameter('residual_func', crack.displacement_residual)
_residual_func = residual_func

basename = parameter('basename', 'neb')
calc = parameter('calc')
fmax_neb = parameter('fmax_neb', 0.1)
maxsteps_neb = parameter('maxsteps_neb', 100)
Nimages = parameter('Nimages', 7)
k_neb = parameter('k_neb', 1.0)

a, cryst, crk, k1g, tip_x, tip_y, bond1, bond2, boundary_mask, \
github libAtoms / matscipy / matscipy / __init__.py View on Github external
def parameter(name, default=None, logger=screen):
    """
    Read parameter from params.py control file.

    Parameters
    ----------
    name : str
        Name of the parameter.
    default : optional
        Default value. Will be returned if parameter is not present.

    Returns
    -------
    value
        Value of the parameter.
    """
    import sys
github libAtoms / matscipy / scripts / fracture_mechanics / energy_barrier.py View on Github external
def todict(self):
        return {'name': 'FixBondLength',
                'kwargs': {'a1': self.indices[0], 'a2': self.indices[1]}}

###

Optimizer = ase.optimize.LBFGS
Optimizer_steps_limit = 1000

# Atom types used for outputting the crack tip position.
ACTUAL_CRACK_TIP = 'Au'
FITTED_CRACK_TIP = 'Ag'

###

logger = screen

###

a, cryst, crk, k1g, tip_x, tip_y, bond1, bond2, boundary_mask, \
    boundary_mask_bulk, tip_mask = setup_crack(logger=logger)
ase.io.write('notch.xyz', a, format='extxyz')

# Get general parameters

basename = parameter('basename', 'energy_barrier')
calc = parameter('calc')
fmax = parameter('fmax', 0.01)

# Get parameter used for fitting crack tip position

optimize_tip_position = parameter('optimize_tip_position', False)
github libAtoms / matscipy / scripts / fracture_mechanics / setup_crack.py View on Github external
def setup_crack(logger=screen):
    calc = parameter('calc')
    
    cryst = parameter('cryst').copy()
    cryst.set_pbc(True)
    
    # Double check elastic constants. We're just assuming this is really a periodic
    # system. (True if it comes out of the cluster routines.)
    
    compute_elastic_constants = parameter('compute_elastic_constants', False)
    elastic_fmax = parameter('elastic_fmax', 0.01)
    elastic_symmetry = parameter('elastic_symmetry', 'triclinic')
    elastic_optimizer = parameter('elastic_optimizer', ase.optimize.FIRE)

    if compute_elastic_constants:
        cryst.set_calculator(calc)
        log_file = open('elastic_constants.log', 'w')