from ase.io import read, write from gocia.utils import conv_formula2list import sys import numpy as np from ase.db import connect import random fn_substrate = sys.argv[1] nsamples = int(sys.argv[2]) s = read(fn_substrate) mycell = np.array(s.get_cell(complete=True)) myLim = np.array([[0, mycell[0][0]], [0, mycell[0][0]], [7.0, 11.0]]) surf = Interface(s, s, zLim=myLim[2]) surf.print() with connect('%s-rand.db' % (fn_substrate.split('.')[0]), append=False) as db: for i in range(nsamples): nB = random.randint(2, 8) nO = random.randint(int(nB / 2), nB) nH = random.randint(1, int(nO / 2) + 1) adatoms = ['B'] * nB + ['O'] * nO + ['H'] * nH print('%i\t%s' % (i, ''.join(adatoms)), end='\t') genAds = boxSample_adatom(surf, adatoms, myLim, toler_BLmin=-0.2, toler_BLmax=0.2, toler_CNmin=1, toler_CNmax=3,
from gocia.interface import Interface import sys, os from gocia.ga.crossover import crossover_snsSurf_2d_GC subs = sys.argv[1] surf1 = sys.argv[2] surf2 = sys.argv[3] #surf0 = Interface(subAtoms=subs, allAtoms=subs) surf1 = Interface(allAtoms=surf1, subAtoms=subs) surf2 = Interface(allAtoms=surf2, subAtoms=subs) surf1.print() surf1.draw('CPK') os.system('mv Ga47N51-cpk.png mom.png') surf2.print() surf2.draw('CPK') os.system('mv Ga47N51-cpk.png dad.png') #print(surf1.get_fixBufPos()) #print(surf1.get_fixBufAtoms()) nova = crossover_snsSurf_2d_GC(surf1, surf2) nova.print() nova.write('nova.vasp') nova.draw('CPK') os.system('mv Ga47N51-cpk.png kid.png') tmp = nova.copy() nova = tmp.copy()