shirtsgroup / InterMol

Conversion tool for molecular simulations
MIT License
186 stars 53 forks source link

newlines in the -ls option are not passed through #315

Closed maaren closed 7 years ago

maaren commented 7 years ago

Example:

$ python /home/maaren/git/InterMol/intermol/convert.py --gropath /home/maaren/bin/ --gro_in 1-butanol_T298.15_1mol.gro 1-butanol_1mol.top --inefile mdin.mdp --lammps --odir ./ -ls 'pair_style lj/cut/coul/long 15.0 15.0\npair_modify tail yes\n'
INFO 2017-02-18 10:37:05 Beginning InterMol conversion

INFO 2017-02-18 10:37:05 InterMol is research software. If you make use of InterMol in scientific publications please cite the following reference:
Shirts, M.R., Klein, C., Swails, J.M. et al. J Comput Aided Mol Des (2016). doi:10.1007/s10822-016-9977-1

INFO 2017-02-18 10:37:06 Finished!

$ less 1-butanol_T298.15_1mol_converted.input
...
read_data 1-butanol_T298.15_1mol_converted.lmp

pair_style lj/cut/coul/long 15.0 15.0\npair_modify tail yes\npair_coeff 1 1   0.0660000   3.5000000
pair_coeff 2 2   0.0300000   2.5000000
pair_coeff 3 3   0.0660000   3.5000000
...
ctk3b commented 7 years ago

This is more of a bash problem than a Python one. You can simply write your command as below (with the $ symbol) and it will pass the line breaks through:

 -ls $'pair_style lj/cut/coul/long 15.0 15.0\npair_modify tail yes\n'

See here http://stackoverflow.com/a/26517782/2597468

Let me know if this works for you

maaren commented 7 years ago

Yep, works. Thnx!