# Path: dnacc/units.py
# _GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS = 1.660538782e-27  # kg
# _GSL_CONST_MKSA_ELECTRON_CHARGE = 1.602176487e-19  # A s
# _GSL_CONST_NUM_AVOGADRO = 6.02214199e23  # 1 / mol
# _GSL_CONST_MKSA_GAUSS = 1e-4  # kg / A s^2
# _GSL_CONST_MKSA_BAR = 1e5  # kg / m s^2
# _GSL_CONST_MKSA_STD_ATMOSPHERE = 1.01325e5  # kg / m s^2
# _GSL_CONST_MKSA_TORR = 1.33322368421e2  # kg / m s^2
# _GSL_CONST_MKSA_METER_OF_MERCURY = 1.33322368421e5  # kg / m s^2
# K = 1.0
#     A = Ampere
# N = kg * m / s ** 2
# J = N * m
# W = J / s
# C = Ampere * s
# V = J / C
# F = C / V
# S = 1 / Ohm
# T = Wb / m ** 2
# H = Wb / Ampere
# L = dm ** 3
# G = _GSL_CONST_MKSA_GAUSS * T
# P = 1 * g / (cm * s)
# AA = 1e-10 * m
# M = mol / L
# def add_amperes_unit():
# def _add_prefixes(name, realname=None):


import numpy as np
import subprocess
import scipy.interpolate
import dnacc
from math import pi, sqrt
from dnacc.units import nm
    # Record original positions
    for i in ids:
        plates.tethers[i]['orig_pos'] = plates.tethers[i]['pos']

    return plates


def calc_explicit_potential(plates, beta_DeltaG0, h, d):
    plates.separation = h
    plates.beta_DeltaG0['alpha', 'alphap'] = beta_DeltaG0

    for tether in plates.tethers:
        if tether['plate'] == 'upper':
            tether['pos'] = tether['orig_pos'] + np.array((d, 0.0))

    plates.update()

    return plates.free_energy


def run(L, sigma, beta_DeltaG0, patch_radii, skip=False, plates=None):

    if plates is None:
        plates = setup_explicit(L, sigma, patch_radii)
    max_patch_radii = max(patch_radii.itervalues())

    if skip:
        return plates

    filename = ("patch_results_L%gnm_S%g_dg%gkT_upperR%gnm_lowerR%gnm.dat" %

# Path: dnacc/units.py
# _GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS = 1.660538782e-27  # kg
# _GSL_CONST_MKSA_ELECTRON_CHARGE = 1.602176487e-19  # A s
# _GSL_CONST_NUM_AVOGADRO = 6.02214199e23  # 1 / mol
# _GSL_CONST_MKSA_GAUSS = 1e-4  # kg / A s^2
# _GSL_CONST_MKSA_BAR = 1e5  # kg / m s^2
# _GSL_CONST_MKSA_STD_ATMOSPHERE = 1.01325e5  # kg / m s^2
# _GSL_CONST_MKSA_TORR = 1.33322368421e2  # kg / m s^2
# _GSL_CONST_MKSA_METER_OF_MERCURY = 1.33322368421e5  # kg / m s^2
# K = 1.0
#     A = Ampere
# N = kg * m / s ** 2
# J = N * m
# W = J / s
# C = Ampere * s
# V = J / C
# F = C / V
# S = 1 / Ohm
# T = Wb / m ** 2
# H = Wb / Ampere
# L = dm ** 3
# G = _GSL_CONST_MKSA_GAUSS * T
# P = 1 * g / (cm * s)
# AA = 1e-10 * m
# M = mol / L
# def add_amperes_unit():
# def _add_prefixes(name, realname=None):


# Path: examples/explicit_patches_plates/explicit_patches_plates.py
import numpy as np
import subprocess
import scipy.interpolate
import dnacc
from math import pi, sqrt
from dnacc.units import nm

    # Record original positions
    for i in ids:
        plates.tethers[i]['orig_pos'] = plates.tethers[i]['pos']

    return plates


def calc_explicit_potential(plates, beta_DeltaG0, h, d):
    plates.separation = h
    plates.beta_DeltaG0['alpha', 'alphap'] = beta_DeltaG0

    for tether in plates.tethers:
        if tether['plate'] == 'upper':
            tether['pos'] = tether['orig_pos'] + np.array((d, 0.0))

    plates.update()

    return plates.free_energy


def run(L, sigma, beta_DeltaG0, patch_radii, skip=False, plates=None):

    if plates is None:
        plates = setup_explicit(L, sigma, patch_radii)
    max_patch_radii = max(patch_radii.itervalues())

    if skip:
        return plates

    filename = ("patch_results_L%gnm_S%g_dg%gkT_upperR%gnm_lowerR%gnm.dat" %

                (L / nm, sqrt(1 / sigma) / L, beta_DeltaG0,