Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repulsions again #236

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tools/domain_sectioner/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
divide_inrtamat.sh takes as input the atom defining the division between two domains and divide the second input (intramat) into four blocks setting to 0 all the inter-domain interaction
##Workflow:

1) Use divide_intramat.sh (or domain_intramat.py) on the md intramat. This will generate an intramat (split_intramat.ndx) divided in blocks (0 for inter-domain contact) to be used for the inter-domain random coil
2) Use the rc intramat and the split_intramat.ndx to generate a mego ff with the intra-domain interaction on and the inter-domain interaction off. This will be the simulation of the inter-domain random coil.
3) Calculate the intramat of the inter-domain random coil
4) Use group_intramats.sh with rc intramat and inter-domain rc intramat. This will generate a new rc intramat with off diagonal blocks obtained from the inter-domain rc
5) Use the new rc_intramat and the full md intramat for multi-eGO to generate a new ff for multi-domain proteins


##Scrits:

divide_intramat.sh takes as input the atom defining the division between two domains and divide the second input (intramat) into four blocks setting to 0 all the inter-domain interaction

> bash divide_intramat.sh num(int) path_to_md_intramat

group_inrtamat.sh takes as input the atom defining the division between two domains, the path of the random_coil intramat and the path of the inter-domain random coil. The script regroups the intramat so that the intra-domain matrix blocks are the random_coil ones and the inter_domain matrix blocks are the inter-domain "random coil" ones

> bash group_intrmat.sh num(int) path_to_random_coil_intramat path_to_inter_domain_rc_intramat

Alternatively the python code can be used in the same way
Alternatively the python code (domain_intramat.py) can be used in the same way
4 changes: 2 additions & 2 deletions tools/domain_sectioner/divide_intramat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ mat=$2
echo "Dividing $2 at atom i = $i_block"
echo

awk -v i=$i_block '{if(($2<=i && $4<=i) || ($2>i && $4>i)){print $0} else{print $1,$2,$3,$4,0.000000,0.000000,0.000000,0.000000 ,$9}}' $2 > split_intramat.ndx
awk -v i=$i_block '{if(($2<=i && $4<=i) || ($2>i && $4>i)){print $0} else{print $1,$2,$3,$4,"0.000000","0.000000+e00" ,$7}}' $2 > split_intramat.ndx

echo "finished job"
echo "Finished job"
24 changes: 9 additions & 15 deletions tools/domain_sectioner/domains_intramat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
exit()

elif len(sys.argv)==3:
print("reading")
intra_md = np.loadtxt(sys.argv[2], unpack=True)
print("read")
print(f"Dividing {intra_md} at atom {i_block}")
dim = int(np.sqrt(len(intra_md[0])))

map_i = np.array([ True if i <= i_block - 1 else False for i in range(dim)])
Expand All @@ -19,22 +18,20 @@
map_j = map_j * map_j[:,np.newaxis]
map = np.logical_or(map_j,map_i)
map = map.reshape(dim**2)
intra_md[4] = np.where(map, intra_md[4], 0)
intra_md[5] = np.where(map, intra_md[5], 0)
intra_md[6] = np.where(map, intra_md[6], 0)
intra_md[7] = np.where(map, intra_md[7], 0)
#intra_md[8] = np.where(map, intra_md[8], 0)

np.savetxt("split_intramat.ndx",intra_md.T, delimiter=" ", fmt = ['%4i', '%4i', '%4i', '%4i', '%2.6f', '%2.6f', '%2.6f', '%2.6f', '%2.6f'])
intra_md[4] = np.where(map, intra_md[4], 0.)
intra_md[5] = np.where(map, intra_md[5], 0.)

np.savetxt("split_intramat.ndx",intra_md.T, delimiter=" ", fmt = ['%i', '%i', '%i', '%i', '%2.6f', '%.6e', '%2.6f' ])
print(f"Finished job ")

elif len(sys.argv)==4:
print("reading")
intra_rc = np.loadtxt(sys.argv[2], unpack=True)
intra_domain_rc = np.loadtxt(sys.argv[3], unpack=True)
print("Group {intra_rc} with {intra_domain_rc} at atom {i_block}")
if(intra_rc.shape != intra_domain_rc.shape):
print("input intramats have different dimensions")
exit()
print("read")
dim = int(np.sqrt(len(intra_rc[0])))

map_i = np.array([ True if i <= i_block - 1 else False for i in range(dim)])
Expand All @@ -47,10 +44,7 @@
intra_rc[4] = np.where(map, intra_rc[4], intra_domain_rc[4])
intra_rc[5] = np.where(map, intra_rc[5], intra_domain_rc[5])
intra_rc[6] = np.where(map, intra_rc[6], intra_domain_rc[6])
intra_rc[7] = np.where(map, intra_rc[7], intra_domain_rc[7])
#intra_rc[8] = np.where(map, intra_rc[8], intra_domain_rc[8])

np.savetxt("grouped_intramat.ndx",intra_rc.T, delimiter=" ",fmt = ['%4i', '%4i', '%4i', '%4i', '%2.6f', '%2.6f', '%2.6f', '%2.6f', '%2.6f'])
np.savetxt("grouped_intramat.ndx",intra_rc.T, delimiter=" ",fmt = ['%4i', '%4i', '%4i', '%4i', '%2.6f', '%.6e', '%2.6' ])
print("Finished job")

print(i_block)
print(len(sys.argv))
6 changes: 3 additions & 3 deletions tools/domain_sectioner/group_intramats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ i_block=$1
mat_1=$2
mat_2=$3

echo "Grouping $mat1 with $mat2 at atom $i_block"
echo "Group $mat1 with $mat2 at atom $i_block"

paste $mat_1 $mat_2 | awk -v i=$i_block '{if(($2<=i && $4<=i) || ($2>i && $4>i)){print $1,$2,$3,$4,$5,$6,$7,$8,$9} else{print $10,$11,$12,$13,$14,$15,$16,$17,$18}}' > grouped_intramat.ndx
paste $mat_1 $mat_2 | awk -v i=$i_block '{if(($2<=i && $4<=i) || ($2>i && $4>i)){print $1,$2,$3,$4,$5,$6,$7} else{print $8,$9,$10,$11,$12,$13,$14}}' > grouped_intramat.ndx

echo "Finished grouping"
echo "Finished job"