Commit a856848a authored by Carl Poelking's avatar Carl Poelking
Browse files

Mods for notebook integration.

parent 87851431
......@@ -19,7 +19,7 @@ class PeriodicTable(object):
"H","He",
"Li","Be","B","C","N","O","F","Ne",
"Na","Mg","Al","Si","P","S","Cl","Ar",
"K ","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge", "As","Se","Br","Kr",
"K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge", "As","Se","Br","Kr",
"Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn", "Sb","Te","I","Xe",
"Cs","Ba",
"La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu",
......
......@@ -232,7 +232,7 @@ class KernelAdaptorGlobalSpecific(object):
def adaptScalar(self, atomic):
xnklab_atomic = Xnklab(atomic, self.types)
X = xnklab_atomic.reduce()
x_norm = X/np.dot(X,X)**0.5
X_norm = X/np.dot(X,X)**0.5
return X, X_norm
class KernelAdaptorGeneric(object):
......
......@@ -696,10 +696,11 @@ class ParticleGraph(object):
return P, positions
def mp_create_graph(config, options, log):
soap.soapy.util.MP_LOCK.acquire()
log << log.item << "Graph('%s') PID=%d" % (\
config.config_file, mp.current_process().pid) << log.endl
soap.soapy.util.MP_LOCK.release()
if log:
soap.soapy.util.MP_LOCK.acquire()
log << log.item << "Graph('%s') PID=%d" % (\
config.config_file, mp.current_process().pid) << log.endl
soap.soapy.util.MP_LOCK.release()
graph = ParticleGraph(config.config_file, config.atoms, options)
return graph
......
......@@ -6,19 +6,21 @@ import kernel as kern
import lagraph
def compare_graphs_average(g1, g2, options):
P1 = g1.P
# TODO Use KernelFunctionFactory here
xi = options['basekernel']['kernel.xi']
P1_avg = np.average(g1.P, axis=0)
P1_avg = P1_avg / np.dot(P1_avg, P1_avg)**0.5
P2 = g2.P
P2_avg = np.average(g2.P, axis=0)
P2_avg = P2_avg / np.dot(P2_avg, P2_avg)**0.5
print P1.shape, P2.shape, P1_avg.shape, P2_avg.shape
return np.dot(P1_avg, P2_avg)
#print P1.shape, P2.shape, P1_avg.shape, P2_avg.shape
return np.dot(P1_avg, P2_avg)**xi
def compare_graphs_global(g1, g2, options):
# TODO Use KernelFunctionFactory here
xi = options['basekernel']['kernel.xi']
assert g1.P.shape[0] == 1 # Global descriptor computed?
assert g2.P.shape[0] == 1 # Global descriptor computed?
return np.dot(g1.P[0], g2.P[0])
return np.dot(g1.P[0], g2.P[0])**xi
def compare_graphs_rematch(g1, g2, options):
if options['graph']['hierarchical']:
......
......@@ -4,7 +4,10 @@ import commands
import argparse
import time
import numpy as np
from lxml import etree
try:
from lxml import etree
except ImportError:
pass
boolean_dict = \
{'true' : True, '1' : True, 'yes' : True,
......
import numpy as np
import numpy.linalg
from momo import osio, endl, flush
from ..soapy import momo
osio = momo.osio
endl = momo.endl
flush = momo.flush
class Xnklab(object):
def __init__(self, atomic, types_global):
......
import numpy as np
import numpy.linalg
from momo import osio, endl, flush
from ..soapy import momo
osio = momo.osio
endl = momo.endl
flush = momo.flush
def compute_X(Qr):
# Q is N x (2*L+1) real-valued matrix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment