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

Add setup_abfe and analyze_dhdl functionalities #28

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/pmx/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def smooth(x, window_len=11, window='hanning'):
print("Plotting: no smoothing for Wr")
plt.legend(shadow=True, fancybox=True, loc='upper center',
prop={'size': 12})
plt.ylabel(r'W [kJ/mol]', fontsize=20)
plt.ylabel(f'W [{units}]', fontsize=20)
plt.xlabel(r'# Snapshot', fontsize=20)
plt.grid(lw=2)
plt.xlim(0, x[-1]+1)
Expand All @@ -384,7 +384,7 @@ def smooth(x, window_len=11, window='hanning'):
plt.hist(wr, bins=nbins, orientation='horizontal', facecolor='blue',
alpha=.75, density=True)

x = np.arange(mini, maxi, .5)
x = np.arange(mini, maxi, .05)

y1 = gauss_func(Af, mf, devf, x)
y2 = gauss_func(Ab, mb, devb, x)
Expand Down
2 changes: 1 addition & 1 deletion src/pmx/gmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def get_gmx():
"""Gets path to gmx executable, and throws error if not found.
"""
gmx = which('gmx')
gmx = which('gmx_mpi') if which('gmx') is None else which('gmx')
if gmx is not None:
return gmx
else:
Expand Down
2 changes: 2 additions & 0 deletions src/pmx/scripts/analyze_dhdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ def main(args):
# plot work distributions
# -----------------------
if args.wplot.lower() != 'none':
res_ab = [i * unit_fact for i in res_ab]
res_ba = [i * unit_fact for i in res_ba]
if quiet is False:
print('\n Plotting histograms......')
# hierarchy of estimators: BAR > Crooks > Jarz
Expand Down
35 changes: 28 additions & 7 deletions src/pmx/scripts/setup_abfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,25 @@ def parse_options():
'behaviour, provide a random seed.',
default=None,
type=int)

parser.add_argument('--conc',
metavar='float',
dest='conc',
help='Specify salt concentration (mol/liter). '
'Default is no salt added.',
default=0,
type=float)
parser.add_argument('--pname',
metavar='pname',
dest='pname',
help='Name of the positive ion. '
'Default is NA.',
default='NA')
parser.add_argument('--nname',
metavar='nname',
dest='nname',
help='Name of the negative ion. '
'Default is CL.',
default='CL')
args, unknown = parser.parse_known_args()
check_unknown_cmd(unknown)

Expand Down Expand Up @@ -250,8 +268,9 @@ def main(args):
# -----------------
gmx.solvate(cp='doublebox.gro', cs='spc216.gro', p='doublebox.top', o='solvate.gro')
gmx.write_mdp(mdp='enmin', fout='genion.mdp')
gmx.grompp(f='genion.mdp', c='solvate.gro', p='doublebox.top', o='genion.tpr', maxwarn=1)
gmx.genion(s='genion.tpr', p='doublebox.top', o='genion.gro', conc=0.15, neutral=True)
gmx.grompp(f='genion.mdp', c='solvate.gro', p='doublebox.top', o='genion.tpr', maxwarn=10)
gmx.genion(s='genion.tpr', p='doublebox.top', o='genion.gro', conc=args.conc, neutral=True,
other_flags=f'-pname {args.pname} -nname {args.nname}')

# add restraints to topology
doubletop = Topology('doublebox.top', assign_types=False)
Expand All @@ -276,8 +295,9 @@ def main(args):
gmx.editconf(f='complex.gro', o='editconf.gro', bt='cubic', d=1.2)
gmx.solvate(cp='editconf.gro', cs='spc216.gro', p='complex.top', o='solvate.gro')
gmx.write_mdp(mdp='enmin', fout='genion.mdp')
gmx.grompp(f='genion.mdp', c='solvate.gro', p='complex.top', o='genion.tpr', maxwarn=1)
gmx.genion(s='genion.tpr', p='complex.top', o='genion.gro', conc=0.15, neutral=True)
gmx.grompp(f='genion.mdp', c='solvate.gro', p='complex.top', o='genion.tpr', maxwarn=10)
gmx.genion(s='genion.tpr', p='complex.top', o='genion.gro', conc=args.conc, neutral=True,
other_flags=f'-pname {args.pname} -nname {args.nname}')

# add restraints to topology
comtop = Topology('complex.top', assign_types=False)
Expand Down Expand Up @@ -314,8 +334,9 @@ def main(args):
gmx.editconf(f='ligand.gro', o='editconf.gro', bt='cubic', d=1.2)
gmx.solvate(cp='editconf.gro', cs='spc216.gro', p='ligand.top', o='solvate.gro')
gmx.write_mdp(mdp='enmin', fout='genion.mdp')
gmx.grompp(f='genion.mdp', c='solvate.gro', p='ligand.top', o='genion.tpr', maxwarn=1)
gmx.genion(s='genion.tpr', p='ligand.top', o='genion.gro', conc=0.15, neutral=True)
gmx.grompp(f='genion.mdp', c='solvate.gro', p='ligand.top', o='genion.tpr', maxwarn=10)
gmx.genion(s='genion.tpr', p='ligand.top', o='genion.gro', conc=args.conc, neutral=True,
other_flags=f'-pname {args.pname} -nname {args.nname}')

os.chdir('../')

Expand Down