def get_vectors(self, atoms): if self.movemode == 2: deloc = Delocalizer(atoms, periodic=True, dense=True) coords = PC(deloc.x_ref.flatten(), deloc.masses, atoms=deloc.atoms, ic=deloc.ic, Li=deloc.u) else: deloc = Delocalizer(atoms) tu = deloc.u if self.constr: e = deloc.constrainStretches() deloc.constrain(e) tu = deloc.u2 if not self.ads: coords = DC(deloc.x_ref.flatten(), deloc.masses, atoms=deloc.atoms, ic=deloc.ic, u=tu) else: cell = self.atoms.get_cell() * self.cell_scale coords = CDC(deloc.x_ref.flatten(), deloc.masses, unit=1.0, atoms=deloc.atoms, ic=deloc.ic, u=tu, cell=cell) return coords.get_vectors()
def initialize(self): #initialize curvilinear coordinates d = Delocalizer(self.atoms,periodic=self.is_periodic,dense=True, weighted=False) if self.is_periodic: #NOT IMPLEMENTED YET pass else: self.coords = DC(d.x_ref.flatten(), d.masses, internal=True, atoms=d.atoms, ic=d.ic, L=None, Li=None, u=d.get_U(), biArgs={'RIIS': 4, 'RIIS_maxLength': 6, 'maxStep':0.5,}) #setup model Hessian self.init_hessian()
from ase.io import read from winak.globaloptimization.delocalizer import * from winak.curvilinear.Coordinates import DelocalizedCoordinates as DC m = read('../testsystems/rea.xyz') e = Delocalizer(m, dense=True) d = [] n = 17 #c_vec = e.constrainStretches() #e.constrain(c_vec) coords=DC(e.x_ref.flatten(), e.masses, internal=True, atoms=e.atoms, \ #ic=e.ic, L=None, Li=None,u=e.get_constrained_U(), ic=e.ic, L=None, Li=None,u=e.get_U(), biArgs={'maxiter':100,'RIIS': True, #'col_constraints':e.constraints_cart, #'row_constraints':e.constraints_int, }) coords.write_jmol('cdol') #constrained delocalizing out loud """ The next loop prints the C-C distance after displacing along a delocalized internal. It varies by about 10%. """ #tmp=read('../testsystems/clethen.xyz') #for i in coords.get_vectors(): #tmp.set_positions(e.x_ref+i) ##view(m) #print np.linalg.norm(tmp[1].get_position()-tmp[0].get_position())
from winak.globaloptimization.delocalizer import * m = read('../testsystems/clethen.xyz') #TEST ICLIST iclist = [ 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 2, 5, 1, 2, 6, 2, 1, 5, 2, 2, 2, 4, 1, 2, 3, 4, 1, 2, 5, 6, 2, 2, 2, 3, 1, 2, 1, 6, 2, 3, 3, 1, 2, 5, 3, 3, 1, 2, 6, 3, 4, 1, 2, 6, 3, 4, 1, 2, 5, 4, 2, 3, 4, 1, 4, 6, 1, 5, 2, 0 ] #DENSE d = Delocalizer(m, icList=iclist, periodic=False, dense=True, weighted=True) #, weighted=True) coords=DC(d.x_ref.flatten(), d.masses, internal=True, atoms=d.atoms, \ ic=d.ic, L=None, Li=None,u=d.get_U())#, biArgs={'iclambda' :0.0001}) coords.write_jmol('dol') #delocalizing out loud coords.s[:] = 2.000 coords.s2x() X1 = coords.x print coords.getS(X1) print X1 #SPARSE d = Delocalizer(m, icList=iclist, periodic=False, dense=False, weighted=False) #, weighted=True) coords=DC(d.x_ref.flatten(), d.masses, internal=True, atoms=d.atoms, \ ic=d.ic, L=None, Li=None,u=d.get_U(), biArgs={'iclambda':0.000001}) coords.write_jmol('dol2') #delocalizing out loud
unit=1.0, atoms=d.atoms, ic=d.ic, u=d.u, cell=cell) coords_s1.write_jmol('s1.jmol') #subsystem2 Surface subsystem2 = system[2:] d = Delocalizer(subsystem2) cell = subsystem1.get_cell() #*[1.0,1.0,1.0] coords_s2 = DC(d.x_ref.flatten(), d.masses, unit=1.0, atoms=d.atoms, ic=d.ic, u=d.u) #atoms=d.atoms,ic=d.ic,u=d.u,cell=cell) coords_s2.write_jmol('s2.jmol') #put together coords = Set_of_CDCs([coords_s1, coords_s2]) print coords.masses print len(coords.masses) print coords.x0.reshape(-1, 3) s = coords.getS(coords.x0) print s
from ase.all import * from winak.globaloptimization.delocalizer import * from winak.curvilinear.Coordinates import DelocalizedCoordinates as DC m = read('../testsystems/clethen.xyz') e = Delocalizer(m) d = [] n = 17 e.constrainStretches() coords=DC(e.x_ref.flatten(), e.masses, internal=True, atoms=e.atoms, \ ic=e.ic, L=None, Li=None,u=e.get_U()) coords.write_jmol('cdol') #constrained delocalizing out loud """ The next loop prints the C-C distance after displacing along a delocalized internal. It varies by about 10%. """ tmp = read('../testsystems/clethen.xyz') for i in coords.get_vectors(): tmp.set_positions(e.x_ref + i) #view(m) print np.linalg.norm(tmp[1].get('position') - tmp[0].get('position'))
dyn.run(0.001) print 'Cartesian optimization finished...' #TEST ICLIST iclist = [1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 2, 5, 1, 2, 6, 2, 1, 5, 2, 2, 2, 4, 1, 2, 3, 4, 1, 2, 5, 6, 2, 2, 2, 3, 1, 2, 1, 6, 2, 3, 3, 1, 2, 5, 3, 3, 1, 2, 6, 3, 4, 1, 2, 6, 3, 4, 1, 2, 5, 4, 2, 3, 4, 1, 4, 6, 1, 5, 2, 0] #DENSE d=Delocalizer(m, icList=iclist, periodic=False, dense=True, weighted=True)#, weighted=True) coords=DC(d.x_ref.flatten(), d.masses, internal=True, atoms=d.atoms, \ ic=d.ic, L=None, Li=None,u=d.get_U(), #)#, biArgs={'iclambda' :0.0001}) biArgs={'RIIS': True, 'maxiter': 900, 'eps': 1e-6, 'maxEps':1e-7, # 'iclambda' : 1e-6, 'RIIS_dim': 4, 'RIIS_maxLength':6, 'maxStep':0.5,}) coords.write_jmol('dol') #delocalizing out loud print 'constructed DI coordinates' # view(m) mlist = [m.copy()] for ss in np.linspace(0,100,10): #transform from DCs to CC displacements coords.s[:] = 0.0