6.1 magn

library(ggplot2)

\[ m_i=\frac{1}{V} \left|\sum_x \phi_i(x)\right|=\frac{1}{V} \sqrt{\sum_x \phi_i^\dagger (x)\sum_y \phi_i(y) } \]

#fs <- list.files(path="./data",pattern="mag*")
T=20
L=20
m0s<- c(0:100)*0.4-7.0
m1s<- c(0:100)*0.4-7.0
g<- 0.0
l0<- 0
l1<- 0
mu<- 0

df<- data.frame("m0"=c(0),"m1"=c(0), "chi0"=c(0), "chi0err"=c(0),
                 "chi1"=c(0), "chi1err"=c(0))
df<- df[-1,]
count=0
for (m0 in m0s){
for (m1 in m1s){  
  
  dir<-paste("../g0/magnetization/data")
  file=sprintf("%s/mes_T%d_L%d_msq0%.6f_msq1%.6f_l0%.6f_l1%.6f_mu%.6f_g%.6f_rep0",dir,T,L,m0,m1,l0,l1,mu,g)
  if(file.exists(file)){
    dfi<- read.table(file)
    
    df[count+1,]<- list(m0,m1, mean(dfi[,1]), sd(dfi[,1]),
                             mean(dfi[,2]), sd(dfi[,2]))
    count=count+1
  }
}}# m0s, m1s 
df$k<-1/(df$m0+8)
library(Rose)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
gg<- myggplot(fill=F)
#gg<- ggplot(df)+theme_bw()
gg<- gg+ geom_point( aes(df$k,df$chi0 ))
gg<- gg+ geom_errorbar( aes(df$k,ymin=df$chi0-df$chi0err,ymax=df$chi0+df$chi0err))
gg<- gg+ geom_vline( xintercept=0.148522)
gg<- gg+ geom_vline( xintercept=0.134228)
#gg<- gg+ geom_point( aes(m0,chi1, color="1"))
#gg<- gg+ geom_errorbar( aes(m0,ymin=chi1-chi1err,ymax=chi1+chi1err, color="1"))

myplotly(gg,"","$\\kappa$","$m$", to_print = FALSE)
## Warning: `gather_()` was deprecated in tidyr 1.2.0.
## Please use `gather()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.