def getEnergyConfig(X, structEq): import potential from potential import VLJ as V import harmonic as ha # E = 0.5*(random() - 0.5) - 161.895 # energyPerParticle = 0 # E, energyPerParticle = ha.get3DPotNearFirstNeighb(X, V, a1, a2, a3) # # # E = potential.getTotalPotentialEnergy(X, V2) # # E = potential.get3DPotNearFirstNeighb(X, V, a1, a2, a3) # # E = 0.2*(random()-0.5) - 0.56 # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # # print(E) # # E = getEnergyFromStaticMTP(X) # do not relax! <<<<<<<<<<<<<<<<<<<<<<<<<<< import crystal as cr import numpy as np from numpy import linalg as LA import copy # structX = cr.getFccEquilibrium() structX = copy.deepcopy(structEq) for i in range(structEq.num_sites): structX[i] = structX[i].specie, np.array(X[i]) ## X[i] must be in FRACTIONAL COORDINATES!!! # dist = LA.norm(structX[i].frac_coords - np.array(X[i])) # if (dist > -0.1): # Xtemp = cr.getFccEquilibrium() # print(i) # print(Xtemp[i].frac_coords) # print(structX[i].frac_coords) # print(X[i]) # 1.3 radio = 3.3 * structX[0].distance(structX[1]) # for first nearest neighbors dRneighborsFromEachSite = cr.getDRneighborsFromEachSite(structX, radio) assert(len(dRneighborsFromEachSite) != 0) # for i in range(structEq.num_sites): # assert( len(structEq.get_neighbors(structEq[i], radio, include_index=True)) == 12 ) # E = cr.getEnergy(structX, radio, dRneighborsFromEachSite) # print(E) # E = 0.5*(random() - 0.5) - 161.895 # energyPerParticle = 0 # energyPerParticle = 0 # return E, energyPerParticle return E, 0
# Get names and equilibrium positions of atoms: # you will need to find first the equilibrium positions when having `V` # For the project, MTP or DFT?? will give the equilibrium positions. # lAtomsEquilibrium, a1, a2, a3 = potential.getAtomsAtEquilibriumPositions() # Xeq, a1, a2, a3, Emin, forceMatrix = ha.getConfigEquilibrium() # structEq = cr.getStruct() # to be used from cfg of mtp structEq = cr.getFccEquilibrium() radio = 1.1 * structEq[0].distance(structEq[1]) # for first nearest neighbors Emin = cr.getEnergy(structEq, radio, []) indxNeigsFromEachSite = cr.getIndxNeigsFromEachSite(structEq, radio) dRneighborsFromEachSite = cr.getDRneighborsFromEachSite(structEq, radio) forceMatrix = cr.getForceMatrix(structEq, indxNeigsFromEachSite, dRneighborsFromEachSite, radio) Emin # forceMatrix # structEq.num_sites # # structEq[0].coords # structEq[0].y # # structEq[0].coords + structEq[0].coords # # structEq[0].coords = structEq[0].coords + np.array([10,20,30]) # # structEq[1].specie # structEq[0] = structEq[1].specie, structEq[0].coords + np.array([10,20,30]) #