Showing posts with label Cygwin. Show all posts
Showing posts with label Cygwin. Show all posts

Sep 20, 2016

How to compile in Cygwin console

To compile in Cygwin console, additional installation is often required.
For example, gfortran is required to compile (build) Packmol.
However, default cygwin installation process does not include compilers (e.g., gcc, gfortran).

When installing Cygwin, we need to select necessary packages.
In a package search window, type "gcc" and then gcc packages will appear.
Change the default option into "install" or we can select particular packages in a subfolder.

In this way, other packages can be installed.
For example, to prepare MD simulation environment on Windows OS system, we will need:
required package of cygwin + python (for Moltemplate) + gcc (for Packmol) + make (for Packmol)
(gcc package includes gfortran)

Dec 17, 2015

initial setup for Cygwin on Windows 7 or later systems

After we install Cygwin (https://cygwin.com/install.html), we encounter many problems such as "xxx command not found".
To prevent such awkward situations from happening, we may want to do some initial setups.

1. PATH
We can check the current PATH by typing "echo $PATH" in Cygwin console.
To set up PATH, open "C:\cygwin64\home\username\.bash_profile" in a text editor.
Add any PATH you want to the section "# Set PATH so it includes user's private bin if it exists".
For example,
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
   PATH="/bin/:/home/myID/src/:${HOME}/bin"
# fi

($HOME denotes "/home/userID/" under the folder where Cygwin has been installed.  e.g., C:/cygwin64/home/myID/)

If we want to add more than one PATH, we use ":" in between directories.


2. Console (terminal) visibility
On Cygwin console, mouse right-click and select "options".
Go to "text" tab and set font to "Lucia console, 11 point".
Go to "window" tab and set size to 120 columns and 40 rows.  Set scrollback lines to 50000.
It will give more powerful environment for working in the console.


Dec 16, 2015

How to use Moltemplate on Windows OS systems

Moltemplate (http://www.moltemplate.org/) is a powerful tool for configuring molecules and assigning force field parameters.
However, its use on Windows OS is somewhat tricky.

1. Install Cygwin (https://cygwin.com/install.html).  Installation of required packages + python should be good enough.

2. Copy all Moltemplate files to C:\cygwin64\home\moltemplate

3. Open "C:\cygwin64\home\username\.bash_profile" in a text editor.  Add a new PATH (in yellow) to a section "# Set PATH so it includes user's private bin if it exists".  For example,

# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
   PATH="/bin/:/home/moltemplate/"
# fi

In Cygwin console (terminal), we can check if the PATH is correctly set by typing "echo $PATH"

5. Place examples (http://www.moltemplate.org/) in C:\cygwin64\home\moltemplate\examples

6. In Cygwin command window (console or teminal), navigate an example folder
(e.g., cd /home/moltemplate/examples/all_atom_examples/force_field_explicit/waterSPCE+Na+Cl/moltemplate_files)

7. In Cygwin command window, type:

moltemplate.sh  -atomstyle "full"  system.lt
or
moltemplate.sh  -xyz  system.xyz  -atomstyle "full"  system.lt
(This will use a premade xyz configuration of system, e.g., system.xyz).

LAMMPS input and data files will be created.  (e.g., system.in and system.data)