avgScalarField = 0.5*(scalarField + scalarFieldShifted) avgGaugeField = FieldTools.linearAverage(gaugeField, gaugeFieldShifted) interpScalarVals = tf.gather_nd(avgScalarField, inputIndices) interpGaugeVals = tf.gather_nd(avgGaugeField, inputIndices) outputIndexVectorsEven = inputIndexVectors.copy() outputIndexVectorsEven[axis] = 2*inputIndexVectors[axis] outputIndicesEven = tf.stack(tf.meshgrid(outputIndexVectorsEven[0], outputIndexVectorsEven[1], outputIndexVectorsEven[2], indexing="ij"), -1) outputScalarField = tf.tensor_scatter_nd_update(outputScalarField, outputIndicesEven, interpScalarVals) outputGaugeField = tf.tensor_scatter_nd_update(outputGaugeField, outputIndicesEven, interpGaugeVals) return outputScalarField, outputGaugeField B = 9 smallMagneticField = FieldTools.constantMagneticField( inputR, inputY, inputZ, 0, -B ) inputGaugeField = FieldTools.linearSuperpose( inputGaugeField, smallMagneticField ) outputScalarField, outputGaugeField = interp1d(inputScalarField, inputGaugeField, 0, theory) outputScalarField, outputGaugeField = interp1d(outputScalarField, outputGaugeField, 1, theory) outputScalarField, outputGaugeField = interp1d(outputScalarField, outputGaugeField, 2, theory) outputLatShape = tf.shape(outputScalarField)[0:3] outputParams = inputParams outputParams["vev"] /= 2 outputParams["latShape"] = outputLatShape r = tf.cast(
for ii in range(shiftNumRight): rightGaugeField = singlePoleTheory.shiftGaugeField(rightGaugeField, 0, +1) rightScalarField = singlePoleTheory.shiftScalarField( rightScalarField, 0, +1) gaugeField = FieldTools.linearSuperpose(leftGaugeField, rightGaugeField) scalarField = 0.5 * (leftScalarField + rightScalarField) # Shift once more to centre the pair gaugeField = tf.roll(gaugeField, -1, 0) scalarField = tf.roll(scalarField, -1, 0) numFluxQuanta = args.externalField # Negative flux quanta results in lowering of energy (dipole points along # negative x axis) magField = FieldTools.constantMagneticField(X, Y, Z, 0, -numFluxQuanta) gaugeField = FieldTools.linearSuperpose(gaugeField, magField) gaugeFieldVar = tf.Variable(gaugeField, trainable=True) scalarFieldVar = tf.Variable(scalarField, trainable=True) params = params = { "vev": args.vev, "selfCoupling": args.selfCoupling, "gaugeCoupling": args.gaugeCoupling, "boundaryConditions": [0, 0, 0] } theory = GeorgiGlashowSu2TheoryUnitary(params)
inputPath = args.inputPath inputR = tf.constant(np.load(inputPath + "/R.npy", allow_pickle=True)) inputY = tf.constant(np.load(inputPath + "/Y.npy", allow_pickle=True)) inputZ = tf.constant(np.load(inputPath + "/Z.npy", allow_pickle=True)) inputScalarField = np.load(inputPath + "/scalarField.npy", allow_pickle=True) inputGaugeField = np.load(inputPath + "/gaugeField.npy", allow_pickle=True) inputParams = np.load(inputPath + "/params.npy", allow_pickle=True).item() inputLatShape = inputParams["latShape"] yzPaddings = [[0, 0], [1, 1], [1, 1], [0, 0], [0, 0]] outputScalarField = inputScalarField outputGaugeField = inputGaugeField B = 10 smallMagneticField = FieldTools.constantMagneticField(inputR, inputY, inputZ, 0, -B) # Subtract the original field so the padding works; this will be added back outputGaugeField = FieldTools.linearSuperpose(outputGaugeField, smallMagneticField) for ii in range(inputLatShape[1] // 2): outputScalarField = tf.pad(outputScalarField, yzPaddings, "symmetric") outputGaugeFieldR = tf.pad(outputGaugeField[:, :, :, 0, :, :], yzPaddings, "symmetric") outputGaugeFieldY = tf.pad(outputGaugeField[:, :, :, 1, :, :], yzPaddings, "symmetric") outputGaugeFieldZ = tf.pad(outputGaugeField[:, :, :, 2, :, :], yzPaddings, "symmetric") outputGaugeField = tf.stack( [outputGaugeFieldR, outputGaugeFieldY, outputGaugeFieldZ], -3)